Skip to content

Commit 7ca4a7c

Browse files
committed
docs updated
1 parent 8ba02c9 commit 7ca4a7c

10 files changed

Lines changed: 113 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Hide columns
1818
* Sticky table header
1919
* Sticky columns
20+
* Theming
21+
* Internationalization
2022

2123
## Commands
2224

docs/_sidebar.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* [Setup](/setup.md)
55
* [API Integration](api-integration.md)
66
* [Properties](properties.md)
7+
* [Theming](/theming.md)
8+
* [Internationalization](/internationalization.md)
79
* [Setup in ES5](/setup-es5.md)
810
* [Q&A](https://github.com/{{repo}}/discussions/categories/q-a)
911
* [Changelog](https://github.com/{{repo}}/releases)

docs/assets/sample-grid/grid.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class SampleGrid extends GridComponent {
4949
// perPageOptions: [25, 50, 100, 200],
5050
showFilters: true,
5151
showSettings: true,
52+
// theme: 'dArk',
53+
// language: 'Tamil',
5254
};
5355

5456
super(options);

docs/assets/sample-grid/i18n.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
gridCompI18n.default['first.page'] = 'Go to start';
2+
3+
Object.assign(gridCompI18n.default, {
4+
'last.page': 'Go to end',
5+
});
6+
7+
gridCompI18n.tamil = {
8+
'first.page': 'முதல் பக்கம்',
9+
'last.page': 'கடைசி பக்கம்',
10+
};

docs/get-started.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Every project has its own way of data handling and business logic. Considering t
1818
* Hide columns
1919
* Sticky table header
2020
* Sticky columns
21+
* Theming
22+
* Internationalization
2123

2224
<script>
2325
initPageGetStarted();

docs/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet" />
1414

1515
<link rel="stylesheet" href="assets/external/vue.css" />
16-
<link rel="stylesheet" href="assets/build/grid-core.min.css" />
1716
<link rel="stylesheet" href="assets/build/popover.min.css" />
1817
<link rel="stylesheet" href="assets/build/tooltip.min.css" />
1918
<link rel="stylesheet" href="assets/build/virtual-select.min.css" />
19+
<link rel="stylesheet" href="assets/build/grid-core.min.css" />
2020
<link rel="stylesheet" href="assets/styles.css" />
2121

2222
<!-- Global site tag (gtag.js) - Google Analytics -->
@@ -40,6 +40,7 @@
4040
<script src="assets/build/virtual-select.min.js"></script>
4141

4242
<script src="assets/sample-grid/db.js"></script>
43+
<script src="assets/sample-grid/i18n.js"></script>
4344
<script src="assets/sample-grid/grids-config.js"></script>
4445
<script src="assets/sample-grid/utils.js"></script>
4546
<script src="assets/sample-grid/filters-utils.js"></script>

docs/internationalization.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Internationalization
2+
3+
By default, all the text in this plugin would be in the `English` language only. Project developers could change all the default texts or use completely different languages.
4+
5+
To override or define a new language, set properties in the `JavaScript` global object `gridCompI18n`.
6+
7+
```js
8+
/** to override default text */
9+
gridCompI18n.default['first.page'] = 'Go to start';
10+
11+
/** or */
12+
Object.assign(gridCompI18n.default, {
13+
'last.page': 'Go to end',
14+
...
15+
});
16+
17+
/** to define a new language */
18+
gridCompI18n.tamil = {
19+
'first.page': 'முதல் பக்கம்',
20+
'last.page': 'கடைசி பக்கம்',
21+
...
22+
};
23+
```
24+
25+
!> Refer [i18n.js](https://github.com/{{repo}}/blob/main/src/i18n.js) for all available texts
26+
27+
### Set language
28+
29+
```js
30+
class GridComponent extends GridCoreComponent {
31+
constructor(options) {
32+
let defaultOptions = {
33+
language: 'tamil', /** TODO - set language */
34+
...
35+
};
36+
37+
super(Object.assign(defaultOptions, options));
38+
}
39+
}
40+
```

docs/properties.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
| showFilters | Boolean | false | Show filters button to open filters |
2020
| showSettings | Boolean | false | Show settings button to customize columns |
2121
| showSerialNumberCol | Boolean | false | Show serial number column |
22+
| theme | String | light | Default available themes are light and dark. But you could define custom themes and use here. ([more details](theming.md)) |
23+
| language | String | default | Language name to get i18n text ([more details](internationalization.md)) |
2224
| tooltipFontSize | String | 14px | Font size for tooltip |
2325
| tooltipAlignment | String | center | CSS Text alignment for tooltip |
2426
| tooltipEnterDelay | String | 300 | Delay time before showing tooltip (in milliseconds) |

docs/setup.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ class SampleGrid extends GridComponent {
3838

3939
super(Object.assign(options));
4040
}
41+
42+
/** custom column render metod. it needs to declared in column details (columns[].renderer) to use it */
43+
rendererEmailCol(colData, rowData) {
44+
let email = rowData[colData.key];
45+
let textTooltip = this.getTooltipAttrText(email, true);
46+
let html = `<a class="grid-comp-col-text" ${textTooltip} href="#/demo?email=${email}">${email}</a>`;
47+
48+
return html;
49+
}
4150
}
4251

4352
/** initialize grid */

docs/theming.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## Theming
2+
3+
By default, this plugin has `Light` and `Dark` themes. Project developers could change the colors of these default themes or add a new custom theme by defining CSS variables.
4+
5+
Define CSS variables under the class name `.grid-comp-theme-[THEME_NAME]`
6+
7+
```css
8+
.grid-comp-theme-blue {
9+
--grid-comp-color-primary-bg: blue;
10+
...
11+
}
12+
```
13+
14+
!> Refer [themes.scss](https://github.com/{{repo}}/tree/main/src/sass/partials/themes.scss) for available CSS variables.
15+
16+
17+
### Using theme
18+
19+
You could use the theme by setting `theme` property in any grid class.
20+
21+
```js
22+
class GridComponent extends GridCoreComponent {
23+
constructor(options) {
24+
let defaultOptions = {
25+
theme: 'blue', /** TODO - set theme */
26+
...
27+
};
28+
29+
super(Object.assign(defaultOptions, options));
30+
}
31+
}
32+
```
33+
34+
Theme could be changed runtime by calling `setTheme` method
35+
36+
```js
37+
/** to change for a specific grid */
38+
sampleGrid.setTheme('blue');
39+
40+
/** to change for all active grid instances */
41+
GridComponent.setTheme('blue');
42+
```

0 commit comments

Comments
 (0)