@exmg/exm-grid 0.0.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +501 -0
- package/assets/arrow-upward.svg +7 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/search/exm-toolbar-search.d.ts +22 -0
- package/dist/search/exm-toolbar-search.js +194 -0
- package/dist/styles/exm-grid-base-toolbar-styles-css.d.ts +1 -0
- package/dist/styles/exm-grid-base-toolbar-styles-css.js +103 -0
- package/dist/styles/exm-grid-common-styles-css.d.ts +1 -0
- package/dist/styles/exm-grid-common-styles-css.js +104 -0
- package/dist/styles/exm-grid-pagination-styles-css.d.ts +1 -0
- package/dist/styles/exm-grid-pagination-styles-css.js +104 -0
- package/dist/styles/exm-grid-setting-selection-list-styles-css.d.ts +1 -0
- package/dist/styles/exm-grid-setting-selection-list-styles-css.js +12 -0
- package/dist/styles/exm-grid-styles-css.d.ts +1 -0
- package/dist/styles/exm-grid-styles-css.js +416 -0
- package/dist/table/exm-grid-base-toolbar.d.ts +23 -0
- package/dist/table/exm-grid-base-toolbar.js +91 -0
- package/dist/table/exm-grid-pagination.d.ts +37 -0
- package/dist/table/exm-grid-pagination.js +190 -0
- package/dist/table/exm-grid-setting-selection-list.d.ts +24 -0
- package/dist/table/exm-grid-setting-selection-list.js +124 -0
- package/dist/table/exm-grid-smart-toolbar.d.ts +31 -0
- package/dist/table/exm-grid-smart-toolbar.js +138 -0
- package/dist/table/exm-grid-toolbar-filters.d.ts +36 -0
- package/dist/table/exm-grid-toolbar-filters.js +77 -0
- package/dist/table/exm-grid-toolbar.d.ts +41 -0
- package/dist/table/exm-grid-toolbar.js +282 -0
- package/dist/table/exm-grid.d.ts +130 -0
- package/dist/table/exm-grid.js +333 -0
- package/dist/table/featrues/exm-column-sortable.d.ts +12 -0
- package/dist/table/featrues/exm-column-sortable.js +50 -0
- package/dist/table/featrues/exm-row-expandable.d.ts +9 -0
- package/dist/table/featrues/exm-row-expandable.js +42 -0
- package/dist/table/featrues/exm-row-selectable.d.ts +20 -0
- package/dist/table/featrues/exm-row-selectable.js +204 -0
- package/dist/table/featrues/exm-row-sortable.d.ts +9 -0
- package/dist/table/featrues/exm-row-sortable.js +50 -0
- package/dist/table/types/exm-grid-smart-toolbar-types.d.ts +17 -0
- package/dist/table/types/exm-grid-smart-toolbar-types.js +6 -0
- package/dist/table/types/exm-grid-toolbar-types.d.ts +55 -0
- package/dist/table/types/exm-grid-toolbar-types.js +16 -0
- package/dist/table/types/exm-grid-types.d.ts +15 -0
- package/dist/table/types/exm-grid-types.js +2 -0
- package/dist/table/utils/exm-query-selectors.d.ts +12 -0
- package/dist/table/utils/exm-query-selectors.js +37 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
# `<exm-copy-to-clipboard>` [](https://www.npmjs.com/package/@exmg/exm-copy-to-clipboard)
|
|
2
|
+
|
|
3
|
+
# @exmg/exm-grid
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @exmg/exm-grid
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Before start ensure that you have installed `web-animation-js`. It is required by `@exmg/exm-paper-combobox`
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install web-animation-js
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Load this script in index.html
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<!-- Ensure Web Animations polyfill is loaded -->
|
|
21
|
+
<script src="../node_modules/web-animations-js/web-animations-next-lite.min.js"></script>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Some dependencies `@plymer/paper-item` use `@apply` to apply css mixins.
|
|
25
|
+
This require to load script in index.html
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<script src="../node_modules/@webcomponents/shadycss/apply-shim.min.js"></script>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Anatomy
|
|
32
|
+
|
|
33
|
+
This library contains following components:
|
|
34
|
+
|
|
35
|
+
1. Grid (main component)
|
|
36
|
+
2. Toolbar (optional)
|
|
37
|
+
3. Pagination (optional)
|
|
38
|
+
|
|
39
|
+
Conceptual usage:
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<exm-grid ...params>
|
|
43
|
+
<table>
|
|
44
|
+
<thead>
|
|
45
|
+
<tr class="grid-columns">
|
|
46
|
+
...column definitions
|
|
47
|
+
</tr>
|
|
48
|
+
</thead>
|
|
49
|
+
<tbody class="grid-data">
|
|
50
|
+
...table rows
|
|
51
|
+
</tbody>
|
|
52
|
+
</table>
|
|
53
|
+
<exm-grid-smart-toolbar slot="toolbar" ...params></exm-grid-smart-toolbar>
|
|
54
|
+
<exm-grid-pagination slot="pagination" ...params></exm-grid-pagination>
|
|
55
|
+
</exm-grid>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Grid Card
|
|
59
|
+
|
|
60
|
+
`<exm-grid>` is main grid component. All other params/data/components should be put inside it as properties or children elements
|
|
61
|
+
GridElement accept slots:
|
|
62
|
+
|
|
63
|
+
- default - this jus table (required)
|
|
64
|
+
- toolbar - slot for toolbar placed above table
|
|
65
|
+
- pagination - slot for pagination placed below table
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<div class="table-card">
|
|
69
|
+
<slot name="toolbar"></slot>
|
|
70
|
+
<div class="table-container"><slot></slot></div>
|
|
71
|
+
<slot name="pagination"></slot>
|
|
72
|
+
</div>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<exm-grid>
|
|
77
|
+
<table></table>
|
|
78
|
+
<exm-grid-smart-toolbar slot="toolbar" ...params></exm-grid-smart-toolbar>
|
|
79
|
+
<exm-grid-pagination slot="pagination" ...params></exm-grid-pagination>
|
|
80
|
+
</exm-grid>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`exm-grid-pagination` can be also embedded inside table
|
|
84
|
+
|
|
85
|
+
### Toolbars
|
|
86
|
+
|
|
87
|
+
There are 3 toolbars available out of the box:
|
|
88
|
+
|
|
89
|
+
1. exm-grid-base-toolbar
|
|
90
|
+
2. exm-grid-toolbar
|
|
91
|
+
3. exm-grid-smart-toolbar
|
|
92
|
+
|
|
93
|
+
#### Grid base toolbar
|
|
94
|
+
|
|
95
|
+
The most base toolbar.
|
|
96
|
+
|
|
97
|
+
Do you want to use it? **Least likely**.
|
|
98
|
+
|
|
99
|
+
Base toolbar is most context agnostic from toolbars available. It serves only as container for
|
|
100
|
+
various visual section (actions, description, filters) and only behavior it has - it can change its
|
|
101
|
+
background color depending on if there are any child elements in "filters" section.
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
<exm-grid-base-toolbar>
|
|
105
|
+
<div slot="actions">
|
|
106
|
+
...render anything here
|
|
107
|
+
</div>
|
|
108
|
+
<div slot="description">...render anything here (prefer plain text)</div>
|
|
109
|
+
<div slot="filters">
|
|
110
|
+
...render anything here
|
|
111
|
+
</div>
|
|
112
|
+
</exm-grid-base-toolbar>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### Grid toolbar
|
|
116
|
+
|
|
117
|
+
Wraps around **grid base toolbar**.
|
|
118
|
+
|
|
119
|
+
Do you want to use it? **Probably in some cases where you want more control than smart toolbar gives you**.
|
|
120
|
+
|
|
121
|
+
This toolbar accepts actions, description and filters via props and fires events `exm-grid-toolbar-action-executed`
|
|
122
|
+
and `exm-grid-toolbar-filter-changed`.
|
|
123
|
+
|
|
124
|
+
Please read the docs to see how actions and filters should look like to pass them into toolbar.
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
<exm-grid-toolbar
|
|
128
|
+
.actions="${this.actions}"
|
|
129
|
+
description="${this.description}"
|
|
130
|
+
.filters="${this.filters}"
|
|
131
|
+
@exm-grid-toolbar-action-executed="${this.onActionExecuted}"
|
|
132
|
+
@exm-grid-toolbar-filter-changed="${this.onFilterChanged}"
|
|
133
|
+
></exm-grid-toolbar>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Grid smart toolbar
|
|
137
|
+
|
|
138
|
+
Wraps around **grid toolbar**.
|
|
139
|
+
|
|
140
|
+
Do you want to use it? **Most likely**.
|
|
141
|
+
|
|
142
|
+
**In most cases you will want to use exactly grid smart toolbar.**
|
|
143
|
+
|
|
144
|
+
This toolbar accepts actions, description, filters and amount-of-selected-items via props and fires events `exm-grid-toolbar-action-executed`
|
|
145
|
+
and `exm-grid-toolbar-filter-changed`.
|
|
146
|
+
|
|
147
|
+
This toolbar is most context dependent from toolbars available. It automates some logic, but needs additional
|
|
148
|
+
information to be passed: amount-of-selected-items. Actions passed into this toolbar should contain
|
|
149
|
+
additional information when action should be displayed.
|
|
150
|
+
|
|
151
|
+
Please read the docs to see how actions and filters should look like to pass them into toolbar.
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
<exm-grid-smart-toolbar
|
|
155
|
+
amount-of-selected-items="${this.amountOfSelectedItems}"
|
|
156
|
+
.actions="${this.actions}"
|
|
157
|
+
description="${this.description}"
|
|
158
|
+
.filters="${this.filters}"
|
|
159
|
+
@exm-grid-toolbar-action-executed="${this.onActionExecuted}"
|
|
160
|
+
@exm-grid-toolbar-filter-changed="${this.onFilterChanged}"
|
|
161
|
+
></exm-grid-smart-toolbar>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Pagination
|
|
165
|
+
|
|
166
|
+
Simple pagination component that gives you all features described in material design specification.
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
<exm-grid-pagination
|
|
170
|
+
page-index=${this.pageIndex}
|
|
171
|
+
page-size=${this.pageSize}
|
|
172
|
+
item-count=${this.itemCount}
|
|
173
|
+
@exm-grid-pagination-page-size-changed="${this.onGridPageSizeChanged}"
|
|
174
|
+
@exm-grid-pagination-page-changed="${this.onGridPageChanged}"
|
|
175
|
+
>
|
|
176
|
+
</exm-grid-pagination>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Grid requirements
|
|
180
|
+
|
|
181
|
+
- Columns has be added to `table > thead > tr.grid.columns`
|
|
182
|
+
|
|
183
|
+
- Body has to be added to `table > tbody.grid-data`
|
|
184
|
+
|
|
185
|
+
- You should use `import {repeat} from 'lit/directives/repeat';` function to map you items to rows.
|
|
186
|
+
|
|
187
|
+
- Each row inside `tbody.grid-data` should have attribute `data-row-key` with unique value
|
|
188
|
+
|
|
189
|
+
- If table is expandable then for each row you have to add related row `table > tbody.grid-data tr.grid-row-detail`
|
|
190
|
+
This row must have attribute `data-row-detail-key` with same value as its relative row
|
|
191
|
+
|
|
192
|
+
- Element `exm-grid` require property `.items` - needed to detect any changes on data
|
|
193
|
+
|
|
194
|
+
## Optional
|
|
195
|
+
|
|
196
|
+
- toolbar should be placed in `table > thead > tr.grid-toolbar`
|
|
197
|
+
|
|
198
|
+
- when amount of columns may change you may use attribute `data-auto-colspan` on both `th and td` elements
|
|
199
|
+
|
|
200
|
+
- if column has number values then you can use class `grid-col-number`
|
|
201
|
+
|
|
202
|
+
- if cell should be visible only on hover then you can use class `grid-cell-visible-on-hover`
|
|
203
|
+
|
|
204
|
+
- if icon which trigger expanding / collapsing row-detail has to rotate then add class `grid-icon-rotate`
|
|
205
|
+
|
|
206
|
+
- if table has fixed layout then add class `grid-checkbox-cell` to `td and th` containing checkboxes
|
|
207
|
+
|
|
208
|
+
Example how should looks most minimal markup to meet with requirements:
|
|
209
|
+
|
|
210
|
+
```html
|
|
211
|
+
<exm-grid .itmes="${items}">
|
|
212
|
+
<table>
|
|
213
|
+
<thead>
|
|
214
|
+
<tr class="grid-columns">
|
|
215
|
+
<th><span>Col1</span></th>
|
|
216
|
+
<th><span>Col2</span></th>
|
|
217
|
+
</tr>
|
|
218
|
+
</thead>
|
|
219
|
+
<tbody class="grid-data">
|
|
220
|
+
${repeat( this.items, ({id}) => id, (i) => { return html`
|
|
221
|
+
<tr data-row-key="${i.id}">
|
|
222
|
+
<td>#${i.id}</td>
|
|
223
|
+
<td>${i.value}</td>
|
|
224
|
+
</tr>
|
|
225
|
+
`; } ); }
|
|
226
|
+
</tbody>
|
|
227
|
+
</table>
|
|
228
|
+
</exm-grid>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Features
|
|
232
|
+
|
|
233
|
+
### Column sortable
|
|
234
|
+
|
|
235
|
+
- You should add attribute `sortable` attribute on `exm-grid`
|
|
236
|
+
|
|
237
|
+
- You must have defined columns and on `th` element you should add `data-sort` attribute with unique name of column.
|
|
238
|
+
You can also omit name in `data-sort` attribute but then you should setup `data-column-key`
|
|
239
|
+
both configuration are fine
|
|
240
|
+
|
|
241
|
+
```html
|
|
242
|
+
<th data-column-key="month" data-sort><span>Month</span></th>
|
|
243
|
+
<th data-column-key="year" data-sort="year-column"><span>Year</span></th>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
- To handle sort changing you should add listener `@exm-grid-sort-change` on `exm-grid`. You will receive `CustomEvent<EventDetailSortChange>`
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
export type EventDetailSortChange = {
|
|
250
|
+
column: string;
|
|
251
|
+
sortDirection?: 'ASC' | 'DESC';
|
|
252
|
+
};
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
- To setup default sorting you should setup attributes `default-sort-column` and `default-sort-direction` on `exm-grid`
|
|
256
|
+
|
|
257
|
+
Example:
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
```html
|
|
262
|
+
<exm-grid
|
|
263
|
+
.items="${this.items}"
|
|
264
|
+
default-sort-column="year-column"
|
|
265
|
+
default-sort-direction="DESC"
|
|
266
|
+
?sortable="${true}"
|
|
267
|
+
@exm-grid-sort-change="${this.onSortChange}"
|
|
268
|
+
>
|
|
269
|
+
<table>
|
|
270
|
+
<thead>
|
|
271
|
+
<tr class="grid-columns">
|
|
272
|
+
<th data-column-key="month" data-sort><span>Month</span></th>
|
|
273
|
+
<th data-column-key="year" data-sort="year-column"><span>Year</span></th>
|
|
274
|
+
</tr>
|
|
275
|
+
</thead>
|
|
276
|
+
</table>
|
|
277
|
+
</exm-grid>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Expandable rows
|
|
281
|
+
|
|
282
|
+
- You should pass attribute `expandable-toggle-selector` to `exm-grid`
|
|
283
|
+
|
|
284
|
+
```html
|
|
285
|
+
<exm-grid .items="${this.items}" expandable-toggle-selector=".expandable-trigger">
|
|
286
|
+
<tbody class="grid-data">
|
|
287
|
+
${ repeat( items, item => items.id, item => html`
|
|
288
|
+
<tr data-row-key="${i.id}">
|
|
289
|
+
<td>First</td>
|
|
290
|
+
<td>Second</td>
|
|
291
|
+
<td class="grid-cell-visible-on-hover">
|
|
292
|
+
<span class="expandable-trigger grid-icon-rotate">${arrowIcon}</span>
|
|
293
|
+
</td>
|
|
294
|
+
</tr>
|
|
295
|
+
<tr class="grid-row-detail" data-row-detail-key="${i.id}">
|
|
296
|
+
<td data-auto-colspan>Here goes row detail...</td>
|
|
297
|
+
</tr>
|
|
298
|
+
` ) }
|
|
299
|
+
</tbody>
|
|
300
|
+
</exm-grid>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
- If you want to programmatically expand / collapse row with detail you can pass property `.expandedRowIds` to `exm-grid` element
|
|
304
|
+
Where type of `expandedRowIds` looks
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
const expandedRowIds: Record<string, boolean> = {
|
|
308
|
+
'1': true,
|
|
309
|
+
'2': false,
|
|
310
|
+
};
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Key is just id which you pass by attributes `data-row-key` and `data-row-detail-key` and value is just flag what will expand when true otherwise collapse
|
|
314
|
+
|
|
315
|
+
- When row detail is being expanded then to element which trigger action will be added attribute `data-is-expanded`.
|
|
316
|
+
Row with trigger will have attribute `data-has-expanded-detail`,
|
|
317
|
+
To row detail is added attribute `data-is-row-expanded`. When collapsed both attributes are removed.
|
|
318
|
+
|
|
319
|
+
### Selectable rows
|
|
320
|
+
|
|
321
|
+
To turn on this feature attribute `rows-selectable` has to be set on `exm-grid` element
|
|
322
|
+
|
|
323
|
+
- If you want to programmatically select / unselect row you may pass property `.selectedRowIds` to `exm-grid` element
|
|
324
|
+
Where type of `selectedRowIds` looks
|
|
325
|
+
|
|
326
|
+
```typescript
|
|
327
|
+
const selectedRowIds: Record<string, boolean> = {
|
|
328
|
+
'1': true,
|
|
329
|
+
'2': false,
|
|
330
|
+
};
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Key is just id which you pass by attributes `data-row-key` and `data-row-detail-key` and value is just flag perhaps makr row as selected when true otherwise unselect
|
|
334
|
+
|
|
335
|
+
#### Checkboxes
|
|
336
|
+
|
|
337
|
+
It is optional. You can add checkbox to header and/or rows. There is needed 2 things to do to be checkbox works with
|
|
338
|
+
row selection:
|
|
339
|
+
|
|
340
|
+
- on `exm-grid` element set attribute`selectable-checkbox-selector=".selectable-checkbox"`
|
|
341
|
+
|
|
342
|
+
- checkbox component needs to implement event `change` and property `checked`.
|
|
343
|
+
|
|
344
|
+
- If your checkbox component implements `indeterminate` property it will be take into account for the main checkbox selector
|
|
345
|
+
|
|
346
|
+
- Optionally cells `th td` can have class `grid-checkbox-cell`
|
|
347
|
+
|
|
348
|
+
```html
|
|
349
|
+
<exm-grid .items="${this.items}" selectable-checkbox-selector=".selectable-checkbox" ?rows-selectable="${true}">
|
|
350
|
+
<table>
|
|
351
|
+
<thead>
|
|
352
|
+
<tr class="grid-columns">
|
|
353
|
+
<th class="grid-checkbox-cell"><md-checkbox class="selectable-checkbox"></md-checkbox></th>
|
|
354
|
+
</tr>
|
|
355
|
+
</thead>
|
|
356
|
+
<tbody class="grid-data">
|
|
357
|
+
<tr>
|
|
358
|
+
<td class="grid-checkbox-cell"><input type="checkbox" class="selection-checkbox"</td>
|
|
359
|
+
</tr>
|
|
360
|
+
</tbody>
|
|
361
|
+
</table>
|
|
362
|
+
</exm-grid>
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Rows sortable
|
|
366
|
+
|
|
367
|
+
To turn on this feature attribute `rows-sortable` has to be set on `exm-grid`. Element `tr` or any descend `tr` element
|
|
368
|
+
must have class `grid-row-drag-handler`.
|
|
369
|
+
|
|
370
|
+
Each time order will be changed event `exm-grid-rows-order-changed` and `exm-grid-rows-order-updated` is triggered and has o be handled.
|
|
371
|
+
Handling this event `must to trigger` update property `items` otherwise it won't take effect.
|
|
372
|
+
|
|
373
|
+
Event details of `CustomEvent<EventDetailRowsOrderChanged>` has such structure:
|
|
374
|
+
|
|
375
|
+
```typescript
|
|
376
|
+
export type EventDetailRowsOrderChanged<T extends object = any> = {
|
|
377
|
+
items: T[];
|
|
378
|
+
};
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Event details of `CustomEvent<EventDetailRowsOrderUpdated>` has such structure:
|
|
382
|
+
|
|
383
|
+
```typescript
|
|
384
|
+
export interface EventDetailRowsOrderUpdated {
|
|
385
|
+
sourceIndex: number;
|
|
386
|
+
targetIndex: number;
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
`Items are sorted as it is done in UI.`
|
|
391
|
+
|
|
392
|
+
```
|
|
393
|
+
onRowsOrderChanged(event: CustomEvent<EventDetailRowsOrderChanged>) {
|
|
394
|
+
// store current order and update items
|
|
395
|
+
this.items = [...event.detail.items];
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
```html
|
|
400
|
+
<exm-grid .items="${this.items}" ?rows-sortable="${true}" @exm-grid-rows-order-changed="${this.onRowsOrderChanged}">
|
|
401
|
+
<table>
|
|
402
|
+
<thead>
|
|
403
|
+
<tr class="grid-columns">
|
|
404
|
+
<th></th>
|
|
405
|
+
<th><span>ID</span></th>
|
|
406
|
+
</tr>
|
|
407
|
+
</thead>
|
|
408
|
+
<tbody class="grid-data">
|
|
409
|
+
<tr>
|
|
410
|
+
<td><span class="grid-row-drag-handler">${dragIcon}</span></td>
|
|
411
|
+
<td>1</td>
|
|
412
|
+
</tr>
|
|
413
|
+
</tbody>
|
|
414
|
+
</table>
|
|
415
|
+
</exm-grid>
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
### Columns visibility management
|
|
419
|
+
|
|
420
|
+
To hide / show columns you can use property `hiddenColumnNames` of `exm-grid`
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
const hiddenColumnNames: Record<string, string> = {};
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
whenever you want to change column visibility update property `hiddenColumnNames`
|
|
427
|
+
|
|
428
|
+
```html
|
|
429
|
+
<exm-grid .items="${this.items}" .hiddenColumnNames="${{col1: 'col1', col2: 'col2'}}"></exm-grid>
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Styles
|
|
433
|
+
|
|
434
|
+
You should import table styles
|
|
435
|
+
|
|
436
|
+
```
|
|
437
|
+
import {style as tableStyles} from '../src/table/exm-grid-styles';
|
|
438
|
+
|
|
439
|
+
export class DemoSimpleGridTable extends LitELement {
|
|
440
|
+
static styles = [
|
|
441
|
+
tableStyles,
|
|
442
|
+
];
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
Additionally you can also override css variables:
|
|
447
|
+
|
|
448
|
+
| Custom property | Description | Default |
|
|
449
|
+
| ------------------------------------------------------------- | ------------------------------------------------------- | -------------------------------------------------------------- |
|
|
450
|
+
| `--exm-arrow-upward-url` | Url to icon that is used for soring direction indicator | `url('/node_modules/@exmg/exm-grid/assets/arrow-upward.svg');` |
|
|
451
|
+
| `--exm-theme-table-card-width` | table card width | `100%;` |
|
|
452
|
+
| `--exm-theme-table-card-margin-bottom` | table bottom margin | `5px;` |
|
|
453
|
+
| `--exm-theme-table-on-surface` | table text color | `#02182b;` |
|
|
454
|
+
| `--exm-theme-table-surface` | table background color | `#ffffff;` |
|
|
455
|
+
| `--exm-theme-table-box-shadow` | table box shadow | `none` |
|
|
456
|
+
| `--exm-theme-table-row-divider-color` | table rows separator color | `#02182b; 0.14` |
|
|
457
|
+
| `--exm-theme-table-row-selected-color` | selected row text color | `#02182b;` |
|
|
458
|
+
| `--exm-theme-table-row-selected-background-color` | selected row background color | `#e2f1fe;` |
|
|
459
|
+
| `--exm-theme-table-row-hover-color` | row hover text color | `#02182b;` |
|
|
460
|
+
| `--exm-theme-table-row-hover-background-color` | row hover background color | `#f1f1f1;` |
|
|
461
|
+
| `--exm-theme-table-row-dragged-background-color` | sortable row background color when dragged | `#f1f1f1;` |
|
|
462
|
+
| `--exm-theme-table-rows-expanded-divider-border` | border between row and expanded row detail | `none;` |
|
|
463
|
+
| `--exm-theme-table-rows-expanded-border` | border around row and expanded row detail | `1px solid #dbdbdb;` |
|
|
464
|
+
| `--exm-theme-table-rows-expanded-background-color` | background color of row and expanded row detail | `#e2f1fe;` |
|
|
465
|
+
| `--exm-theme-table-rows-expanded-color` | text color of row and expanded row detail | `#02182b;` |
|
|
466
|
+
| `--exm-theme-table-th-color` | header text color | `#0071dc;` |
|
|
467
|
+
| `--exm-theme-table-columns-background-color` | header background color | `#ffffff;` |
|
|
468
|
+
| `--exm-theme-table-th-sortable-hover-color` | sortable header hover text color | `#02182b;` |
|
|
469
|
+
| `--exm-theme-table-th-height` | header height | `48px;` |
|
|
470
|
+
| `--exm-theme-table-th-sort-margin-left` | header margin after text but before icon | `0px;` |
|
|
471
|
+
| `--exm-theme-table-td-height` | row cell height | `48px;` |
|
|
472
|
+
| `--exm-theme-table-th-sort-icon-height` | sort icon height | `1em;` |
|
|
473
|
+
| `--exm-theme-table-th-sort-icon-width` | sort icon width | `1em;` |
|
|
474
|
+
| `--exm-theme-table-toolbar-background-color` | Toolbar background color | `$background;` |
|
|
475
|
+
| `--exm-theme-table-toolbar-color` | Toolbar text color | `$onBackground` |
|
|
476
|
+
| `--exm-theme-table-toolbar-active-bg-color` | Toolbar background color when any action available | `$background;` |
|
|
477
|
+
| `--exm-theme-table-toolbar-active-color` | Toolbar text color when any action available | `$onBackground` |
|
|
478
|
+
| `--exm-theme-table-pagination-bg-color` | Pagination background color | `--mdc-theme-surface` |
|
|
479
|
+
| `--exm-theme-table-pagination-color` | Pagination text color | `--mdc-theme-on-surface` |
|
|
480
|
+
| `--exm-theme-table-on-surface-disabled` | Disabled color | `--mdc-theme-on-surface with filter .38` |
|
|
481
|
+
| `--exm-theme-table-toolbar-filter-item-active-bg-color` | Background color for combobox | `--mdc-theme-surface` |
|
|
482
|
+
| `--exm-theme-grid-setting-checkbox-bg-color` | Background color of setting checkbox | `$mdcThemeSecondary` |
|
|
483
|
+
| `--exm-theme-table-toolbar-setting-list-item-active-bg-color` | Background color of active list item color | `$mdcThemeSecondary` |
|
|
484
|
+
|
|
485
|
+
## Responsiveness
|
|
486
|
+
|
|
487
|
+
By default grid has `table-layout` set to `auto` It can be changed to `fixed`
|
|
488
|
+
|
|
489
|
+
```html
|
|
490
|
+
<exm-grid .items="${this.items}" table-layout="fixed"></exm-grid>
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
- auto - table will shrink as much as possible. If content will overflow then scroll will be added.
|
|
494
|
+
|
|
495
|
+
- fixed - table has layout set to fixed. If content will overflow then ellipsis will be added to text
|
|
496
|
+
|
|
497
|
+
## Additional references
|
|
498
|
+
|
|
499
|
+
- [Additional Documentation](https://exmg.github.io/exmachina-web-components/ExmGrid.html)
|
|
500
|
+
|
|
501
|
+
- [Demo](https://exmg.github.io/exmachina-web-components/demo/?el=exm-grid)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In -->
|
|
2
|
+
<svg version="1.1"
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
|
4
|
+
x="0px" y="0px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
|
|
5
|
+
<defs></defs>
|
|
6
|
+
<g id="arrow-upward"><path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/></g>
|
|
7
|
+
</svg>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { EventDetailRowsOrderChanged, EventDetailRowsOrderUpdated, EventDetailSelectedRowsChange, EventDetailSortChange, SORT_DIRECTION, } from './table/types/exm-grid-types.js';
|
|
2
|
+
export { ExmGrid } from './table/exm-grid.js';
|
|
3
|
+
export { ExmGridPagination } from './table/exm-grid-pagination.js';
|
|
4
|
+
export { ExmGridBaseToolbar } from './table/exm-grid-base-toolbar.js';
|
|
5
|
+
export { ExmGridSmartToolbar } from './table/exm-grid-smart-toolbar.js';
|
|
6
|
+
export { ActionAmountSelectedItemsCondition, ActionConditionType, ActionWithCondition, BaseActionCondition, } from './table/types/exm-grid-smart-toolbar-types.js';
|
|
7
|
+
export { ExmGridToolbar } from './table/exm-grid-toolbar.js';
|
|
8
|
+
export { EventDetailGridToolbarSettingChanged, Action, Filter, FilterConfigType, FilterSingleSelectConfig, BaseFilterConfig, BaseSettingConfig, Setting, SettingConfigId, SettingConfigType, SettingSelectionListConfig, SettingSelectionListItem, } from './table/types/exm-grid-toolbar-types.js';
|
|
9
|
+
export { ToolbarSearch } from './search/exm-toolbar-search.js';
|
|
10
|
+
export { ExmGridToolbarFilters, EventSelectPayload } from './table/exm-grid-toolbar-filters.js';
|
|
11
|
+
export { style as gridStyles } from './styles/exm-grid-styles-css.js';
|
|
12
|
+
export { style as gridBaseToolbarStyles } from './styles/exm-grid-base-toolbar-styles-css.js';
|
|
13
|
+
export { style as gridCommonStyles } from './styles/exm-grid-common-styles-css.js';
|
|
14
|
+
export { style as gridPaginationStyles } from './styles/exm-grid-pagination-styles-css.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { ExmGrid } from './table/exm-grid.js';
|
|
2
|
+
export { ExmGridPagination } from './table/exm-grid-pagination.js';
|
|
3
|
+
export { ExmGridBaseToolbar } from './table/exm-grid-base-toolbar.js';
|
|
4
|
+
export { ExmGridSmartToolbar } from './table/exm-grid-smart-toolbar.js';
|
|
5
|
+
export { ActionConditionType, } from './table/types/exm-grid-smart-toolbar-types.js';
|
|
6
|
+
export { ExmGridToolbar } from './table/exm-grid-toolbar.js';
|
|
7
|
+
export { FilterConfigType, SettingConfigId, SettingConfigType, } from './table/types/exm-grid-toolbar-types.js';
|
|
8
|
+
export { ToolbarSearch } from './search/exm-toolbar-search.js';
|
|
9
|
+
export { ExmGridToolbarFilters } from './table/exm-grid-toolbar-filters.js';
|
|
10
|
+
export { style as gridStyles } from './styles/exm-grid-styles-css.js';
|
|
11
|
+
export { style as gridBaseToolbarStyles } from './styles/exm-grid-base-toolbar-styles-css.js';
|
|
12
|
+
export { style as gridCommonStyles } from './styles/exm-grid-common-styles-css.js';
|
|
13
|
+
export { style as gridPaginationStyles } from './styles/exm-grid-pagination-styles-css.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ExmgElement } from '@exmg/lit-base/index.js';
|
|
2
|
+
export declare class ToolbarSearch extends ExmgElement {
|
|
3
|
+
_isSearch: boolean;
|
|
4
|
+
filterValue?: string | null;
|
|
5
|
+
placeHolder: string;
|
|
6
|
+
search?: HTMLInputElement;
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
private _debouncer;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
_getValue(): string;
|
|
11
|
+
_handleClear(e: CustomEvent): void;
|
|
12
|
+
_handleKeyUp(e: KeyboardEvent): void;
|
|
13
|
+
_notifyChange(): void;
|
|
14
|
+
_handleInputBlur(): void;
|
|
15
|
+
_hideSearch(): void;
|
|
16
|
+
_showSearch(): void;
|
|
17
|
+
}
|
|
18
|
+
declare global {
|
|
19
|
+
interface HTMLElementTagNameMap {
|
|
20
|
+
'exm-toolbar-search': ToolbarSearch;
|
|
21
|
+
}
|
|
22
|
+
}
|