@exmg/exm-grid 1.0.7 → 1.0.8-alpha.21

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.
Files changed (47) hide show
  1. package/dist/index.d.ts +14 -0
  2. package/dist/index.js +14 -0
  3. package/package.json +17 -19
  4. package/index.d.ts +0 -14
  5. package/index.js +0 -14
  6. package/src/search/exm-toolbar-search.d.ts +0 -25
  7. package/src/search/exm-toolbar-search.js +0 -197
  8. package/src/styles/exm-grid-base-toolbar-styles-css.d.ts +0 -1
  9. package/src/styles/exm-grid-base-toolbar-styles-css.js +0 -103
  10. package/src/styles/exm-grid-common-styles-css.d.ts +0 -1
  11. package/src/styles/exm-grid-common-styles-css.js +0 -104
  12. package/src/styles/exm-grid-pagination-styles-css.d.ts +0 -1
  13. package/src/styles/exm-grid-pagination-styles-css.js +0 -104
  14. package/src/styles/exm-grid-setting-selection-list-styles-css.d.ts +0 -1
  15. package/src/styles/exm-grid-setting-selection-list-styles-css.js +0 -12
  16. package/src/styles/exm-grid-styles-css.d.ts +0 -1
  17. package/src/styles/exm-grid-styles-css.js +0 -412
  18. package/src/table/exm-grid-base-toolbar.d.ts +0 -23
  19. package/src/table/exm-grid-base-toolbar.js +0 -91
  20. package/src/table/exm-grid-pagination.d.ts +0 -37
  21. package/src/table/exm-grid-pagination.js +0 -190
  22. package/src/table/exm-grid-setting-selection-list.d.ts +0 -24
  23. package/src/table/exm-grid-setting-selection-list.js +0 -124
  24. package/src/table/exm-grid-smart-toolbar.d.ts +0 -31
  25. package/src/table/exm-grid-smart-toolbar.js +0 -138
  26. package/src/table/exm-grid-toolbar-filters.d.ts +0 -36
  27. package/src/table/exm-grid-toolbar-filters.js +0 -77
  28. package/src/table/exm-grid-toolbar.d.ts +0 -42
  29. package/src/table/exm-grid-toolbar.js +0 -283
  30. package/src/table/exm-grid.d.ts +0 -130
  31. package/src/table/exm-grid.js +0 -333
  32. package/src/table/featrues/exm-column-sortable.d.ts +0 -12
  33. package/src/table/featrues/exm-column-sortable.js +0 -50
  34. package/src/table/featrues/exm-row-expandable.d.ts +0 -9
  35. package/src/table/featrues/exm-row-expandable.js +0 -42
  36. package/src/table/featrues/exm-row-selectable.d.ts +0 -20
  37. package/src/table/featrues/exm-row-selectable.js +0 -204
  38. package/src/table/featrues/exm-row-sortable.d.ts +0 -9
  39. package/src/table/featrues/exm-row-sortable.js +0 -50
  40. package/src/table/types/exm-grid-smart-toolbar-types.d.ts +0 -17
  41. package/src/table/types/exm-grid-smart-toolbar-types.js +0 -6
  42. package/src/table/types/exm-grid-toolbar-types.d.ts +0 -55
  43. package/src/table/types/exm-grid-toolbar-types.js +0 -16
  44. package/src/table/types/exm-grid-types.d.ts +0 -15
  45. package/src/table/types/exm-grid-types.js +0 -2
  46. package/src/table/utils/exm-query-selectors.d.ts +0 -12
  47. package/src/table/utils/exm-query-selectors.js +0 -37
@@ -1,283 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { css, html } from 'lit';
3
- import { ExmgElement } from '@exmg/lit-base/index.js';
4
- import { customElement, property } from 'lit/decorators.js';
5
- import { ifDefined } from 'lit/directives/if-defined.js';
6
- import { repeat } from 'lit/directives/repeat.js';
7
- import '@material/web/icon/icon.js';
8
- import '@material/web/iconbutton/icon-button.js';
9
- import './exm-grid-toolbar-filters.js';
10
- import '@polymer/paper-item/paper-item.js';
11
- import './exm-grid-base-toolbar.js';
12
- import './exm-grid-setting-selection-list.js';
13
- import '../search/exm-toolbar-search.js';
14
- import { FilterConfigType, SettingConfigType, } from './types/exm-grid-toolbar-types.js';
15
- let ExmGridToolbar = class ExmGridToolbar extends ExmgElement {
16
- constructor() {
17
- super(...arguments);
18
- this.description = '';
19
- this.actions = [];
20
- this.filters = [];
21
- this.settings = [];
22
- this.searchEnabled = false;
23
- this.searchPlaceholder = 'Search';
24
- this.disableSeperator = false;
25
- }
26
- emitActionExecutedEvent(action) {
27
- return () => {
28
- this.dispatchEvent(new CustomEvent('exm-grid-toolbar-action-executed', {
29
- detail: {
30
- id: action.id,
31
- },
32
- composed: true,
33
- bubbles: true,
34
- }));
35
- };
36
- }
37
- emitFilterChangedEvent(filter) {
38
- return (event) => {
39
- this.saveFilterInLocalStorage(filter.id, event.detail.value);
40
- this.dispatchEvent(new CustomEvent('exm-grid-toolbar-filter-changed', {
41
- detail: {
42
- id: filter.id,
43
- value: event.detail.value,
44
- },
45
- composed: true,
46
- bubbles: true,
47
- }));
48
- };
49
- }
50
- saveFilterInLocalStorage(filterId, value) {
51
- if (filterId.length > 0) {
52
- const key = `${filterId}${window.location.pathname}`;
53
- localStorage.setItem(key, value);
54
- }
55
- }
56
- getFilterFromLocalStorage(filterId) {
57
- if (filterId.length > 0) {
58
- const key = `${filterId}${window.location.pathname}`;
59
- return localStorage.getItem(key);
60
- }
61
- return null;
62
- }
63
- emitSettingChangedEvent(setting) {
64
- return (event) => {
65
- this.dispatchEvent(new CustomEvent('exm-grid-toolbar-setting-changed', {
66
- detail: {
67
- id: setting.id,
68
- value: event.detail.value,
69
- },
70
- composed: true,
71
- bubbles: true,
72
- }));
73
- };
74
- }
75
- renderActions() {
76
- return repeat(this.actions, (action) => html `
77
- <md-icon-button
78
- class="action"
79
- title="${ifDefined(action.tooltip)}"
80
- @click="${this.emitActionExecutedEvent(action)}"
81
- ><md-icon>${action.icon}</md-icon></md-icon-button
82
- >
83
- `);
84
- }
85
- renderSearch() {
86
- return html `<exm-toolbar-search placeHolder=${this.searchPlaceholder}></exm-toolbar-search> `;
87
- }
88
- renderDescription() {
89
- return html ` ${this.description} `;
90
- }
91
- renderFilters() {
92
- return repeat(this.filters, (filter) => this.renderFilter(filter));
93
- }
94
- renderFilter(filter) {
95
- if (this.isFilterSingleSelectConfig(filter)) {
96
- return this.renderSingleSelectFilter(filter);
97
- }
98
- return undefined;
99
- }
100
- isFilterSingleSelectConfig(filter) {
101
- return filter.config.type === FilterConfigType.SingleSelect;
102
- }
103
- getSelectedFilter(filter) {
104
- return this.getFilterFromLocalStorage(filter.id) || filter.config.data[0].id || 0;
105
- }
106
- renderSingleSelectFilter(filter) {
107
- const items = filter.config.data.map((item) => ({ label: item.title, value: item.id }));
108
- return html `
109
- <exm-grid-toolbar-filters
110
- selected="${this.getSelectedFilter(filter)}"
111
- ?disabled="${!!filter.disabled}"
112
- .items=${items}
113
- @exm-grid-toolbar-filter-changed="${this.emitFilterChangedEvent(filter)}"
114
- ></exm-grid-toolbar-filters>
115
- `;
116
- }
117
- renderSettings() {
118
- return repeat(this.settings, (setting) => this.renderSetting(setting));
119
- }
120
- renderSetting(setting) {
121
- if (this.isSettingSelectionListConfig(setting)) {
122
- return this.renderSelectionListSetting(setting);
123
- }
124
- return undefined;
125
- }
126
- isSettingSelectionListConfig(setting) {
127
- return setting.config.type === SettingConfigType.SelectionList;
128
- }
129
- renderSelectionListSetting(setting) {
130
- return html `
131
- <exm-grid-setting-selection-list
132
- class="setting"
133
- setting-id="${setting.id}"
134
- dialog-title="${ifDefined(setting.dialogTitle)}"
135
- tooltip="${ifDefined(setting.tooltip)}"
136
- icon="${ifDefined(setting.icon)}"
137
- .settingData="${setting.config.data}"
138
- @exm-grid-setting-changed="${this.emitSettingChangedEvent(setting)}"
139
- >
140
- </exm-grid-setting-selection-list>
141
- `;
142
- }
143
- render() {
144
- return html `
145
- <style>
146
- :host {
147
- --paper-item-focused: {
148
- background-color: var(
149
- --exm-theme-table-toolbar-filter-item-active-bg-color,
150
- var(--exm-theme-table-on-surface-low, var(--mdc-theme-surface))
151
- );
152
- }
153
- --paper-item-selected: {
154
- background-color: var(
155
- --exm-theme-table-toolbar-filter-item-active-bg-color,
156
- var(--exm-theme-table-on-surface-low, var(--mdc-theme-surface))
157
- );
158
- }
159
- --paper-button-ink-color: var(
160
- --exm-theme-table-toolbar-filter-item-active-bg-color,
161
- var(--mdc-theme-surface)
162
- );
163
- --paper-input-container-color: var(--exm-grid-toolbar-on-surface-color, var(--mdc-theme-on-surface));
164
- --paper-input-container-focus-color: var(--exm-grid-toolbar-on-surface-color, var(--mdc-theme-primary));
165
-
166
- --exm-paper-combobox-selected-item-color: var(
167
- --exm-grid-toolbar-on-surface-color,
168
- var(--mdc-theme-on-surface)
169
- );
170
- --exm-paper-combobox-selected-item-bg-color: var(--exm-grid-toolbar-surface-color, transparent);
171
- --exm-paper-combobox-dropdown-button-color: var(
172
- --exm-grid-toolbar-on-surface-color,
173
- var(--mdc-theme-on-surface)
174
- );
175
- --exm-paper-combobox-dropdown-button-bg-color: var(--exm-grid-toolbar-surface-color, transparent);
176
- --exm-paper-combobox-dropdown-list-color: var(
177
- --exm-grid-toolbar-on-surface-color,
178
- var(--mdc-theme-on-surface)
179
- );
180
- --exm-paper-combobox-dropdown-list-bg-color: var(
181
- --exm-grid-toolbar-surface-color,
182
- var(--mdc-theme-surface)
183
- );
184
- }
185
- :host exm-grid-base-toolbar[active] {
186
- --paper-item-focused: {
187
- background-color: var(
188
- --exm-theme-table-toolbar-filter-item-active-bg-color,
189
- var(--exm-theme-table-on-surface-low, var(--mdc-theme-surface))
190
- );
191
- }
192
- --paper-item-selected: {
193
- background-color: var(
194
- --exm-theme-table-toolbar-filter-item-active-bg-color,
195
- var(--exm-theme-table-on-surface-low, var(--mdc-theme-surface))
196
- );
197
- }
198
- --paper-button-ink-color: var(
199
- --exm-theme-table-toolbar-filter-item-active-bg-color,
200
- var(--mdc-theme-secondary)
201
- );
202
- --paper-input-container-color: var(--exm-grid-toolbar-active-on-surface-color, var(--mdc-theme-on-surface));
203
- --paper-input-container-focus-color: var(
204
- --exm-grid-toolbar-active-on-surface-color,
205
- var(--mdc-theme-primary)
206
- );
207
-
208
- --exm-paper-combobox-selected-item-color: var(
209
- --exm-grid-toolbar-active-on-surface-color,
210
- var(--mdc-theme-on-surface)
211
- );
212
- --exm-paper-combobox-selected-item-bg-color: var(--exm-grid-toolbar-bg-active-surface-color, transparent);
213
- --exm-paper-combobox-dropdown-button-color: var(
214
- --exm-grid-toolbar-active-on-surface-color,
215
- var(--mdc-theme-on-surface)
216
- );
217
- --exm-paper-combobox-dropdown-button-bg-color: var(--exm-grid-toolbar-bg-active-surface-color, transparent);
218
- --exm-paper-combobox-dropdown-list-color: var(
219
- --exm-grid-toolbar-active-on-surface-color,
220
- var(--mdc-theme-on-surface)
221
- );
222
- --exm-paper-combobox-dropdown-list-bg-color: var(
223
- --exm-grid-toolbar-bg-active-surface-color,
224
- var(--mdc-theme-surface)
225
- );
226
- }
227
- .title {
228
- display: flex;
229
- align-items: center;
230
- height: 48px;
231
- flex: 1;
232
- }
233
- .title > exm-toolbar-search {
234
- flex: 1;
235
- }
236
- </style>
237
- <exm-grid-base-toolbar ?disableSeperator=${this.disableSeperator}>
238
- <div slot="actions">${this.renderActions()}</div>
239
- ${this.searchEnabled
240
- ? html `<div class="title" slot="description">${this.renderSearch()}</div>`
241
- : html `<div class="title" slot="description">${this.renderDescription()}</div>`}
242
-
243
- <div slot="filters">${this.renderFilters()}</div>
244
- <div slot="settings">${this.renderSettings()}</div>
245
- <div class="extra" slot="extra"><slot name="extra"></slot></div>
246
- </exm-grid-base-toolbar>
247
- `;
248
- }
249
- };
250
- ExmGridToolbar.styles = [
251
- css `
252
- exm-grid-toolbar-filters {
253
- padding-left: 10px;
254
- border-radius: 4px;
255
- }
256
- `,
257
- ];
258
- __decorate([
259
- property({ type: String })
260
- ], ExmGridToolbar.prototype, "description", void 0);
261
- __decorate([
262
- property({ type: Array })
263
- ], ExmGridToolbar.prototype, "actions", void 0);
264
- __decorate([
265
- property({ type: Array })
266
- ], ExmGridToolbar.prototype, "filters", void 0);
267
- __decorate([
268
- property({ type: Array })
269
- ], ExmGridToolbar.prototype, "settings", void 0);
270
- __decorate([
271
- property({ type: Boolean })
272
- ], ExmGridToolbar.prototype, "searchEnabled", void 0);
273
- __decorate([
274
- property({ type: String })
275
- ], ExmGridToolbar.prototype, "searchPlaceholder", void 0);
276
- __decorate([
277
- property({ type: Boolean })
278
- ], ExmGridToolbar.prototype, "disableSeperator", void 0);
279
- ExmGridToolbar = __decorate([
280
- customElement('exm-grid-toolbar')
281
- ], ExmGridToolbar);
282
- export { ExmGridToolbar };
283
- //# sourceMappingURL=exm-grid-toolbar.js.map
@@ -1,130 +0,0 @@
1
- import { ExmgElement } from '@exmg/lit-base/index.js';
2
- import '@exmg/exm-sortable/exm-sortable.js';
3
- import { SORT_DIRECTION } from './types/exm-grid-types.js';
4
- type GenericPropertyValues<T, V = unknown> = Map<T, V>;
5
- type Props = Exclude<keyof ExmGrid, number | symbol>;
6
- type SmartPropertyValue = GenericPropertyValues<Props>;
7
- /**
8
- * ### Styling
9
- * The following custom properties and mixins are available for styling:
10
- *
11
- * Custom property | Description | Default
12
- * ----------------|-------------|----------
13
- * `--exm-arrow-upward-url` | Url to icon that is used for soring direction indicator | `url('/assets/arrow-upward.svg');`
14
- * `--exm-table-card-width` | table card width | `100%;`
15
- * `--exm-table-card-margin-bottom` | table bottom margin | `5px;`
16
- * `--exm-table-color` | table text color | `#02182b;`
17
- * `--exm-table-background-color` | table background color | `#ffffff;`
18
- * `--exm-table-box-shadow` | table box shadow | `#{0px 1px 5px 0px rgba($onSurface, .2), 0px 2px 2px 0px rgba($onSurface, .14), 0px 3px 1px -2px rgba($onSurface, .12)},`
19
- * `--exm-table-row-divider-color` | table rows separator color | `#dbdbdb;`
20
- * `--exm-table-row-selected-color` | selected row text color | `#02182b;`
21
- * `--exm-table-row-selected-background-color` | selected row background color | `#e2f1fe;`
22
- * `--exm-table-row-hover-color` | row hover text color | `#02182b;`
23
- * `--exm-table-row-hover-background-color` | row hover background color | `#f1f1f1;`
24
- * `--exm-table-row-dragged-background-color` | sortable row background color when dragged | `#f1f1f1;`
25
- * `--exm-table-rows-expanded-divider-border` | border between row and expanded row detail | `none;`
26
- * `--exm-table-rows-expanded-border` | border around row and expanded row detail | `1px solid #dbdbdb;`
27
- * `--exm-table-rows-expanded-background-color` | background color of row and expanded row detail | `#e2f1fe;`
28
- * `--exm-table-rows-expanded-color` | text color of row and expanded row detail | `#02182b;`
29
- * `--exm-table-th-color` | header text color | `#0071dc;`
30
- * `--exm-table-columns-background-color` | header background color | `#ffffff;`
31
- * `--exm-table-th-sortable-hover-color` | sortable header hover text color | `#02182b;`
32
- * `--exm-table-th-height` | header height | `48px;`
33
- * `--exm-table-th-sort-margin-left` | header margin after text but before icon | `0px;`
34
- * `--exm-table-td-height` | row cell height | `48px;`
35
- * `--exm-table-th-sort-icon-height` | sort icon height | `1em;`
36
- * `--exm-table-th-sort-icon-width` | sort icon width | `1em;`
37
- * `--exm-table-col-number-padding-right` | right padding of number column | `10px;`
38
- * `--exm-table-checkbox-cell-width` | width of cell with checkbox | `24px;`
39
- */
40
- export declare class ExmGrid extends ExmgElement {
41
- static styles: import("lit").CSSResult[];
42
- /**
43
- * Array of data which mapped to rows
44
- */
45
- items: unknown[];
46
- /**
47
- * Feature that turn on sort by column
48
- */
49
- sortable: boolean;
50
- /**
51
- * Name of sort column which should be sorted by default
52
- */
53
- defaultSortColumn?: string;
54
- /**
55
- * Default sort direction
56
- */
57
- defaultSortDirection?: SORT_DIRECTION;
58
- /**
59
- * Feature that allow sort rows
60
- * If table has turn on feature `selectable` then it takes precedence and `rowSelectable` will be ignored
61
- */
62
- rowsSortable: boolean;
63
- /**
64
- * Feature that allow select rows
65
- */
66
- rowsSelectable: boolean;
67
- /**
68
- * By default a ros is also selactable by clicking anywhere inside the row when the rowSElectable option is enabled
69
- */
70
- disableRowClickSelection: boolean;
71
- /**
72
- * If rows are selectable you can also pass selector to checkboxes.
73
- * We can have checkboxes in thead or / and tbody.
74
- */
75
- selectableCheckboxSelector?: string;
76
- /**
77
- * Map of column names that should be hidden
78
- */
79
- hiddenColumnNames: Record<string, string>;
80
- /**
81
- * Map of row id and selection state
82
- * Useful for setup default selection or manipulating programmatically
83
- */
84
- selectedRowIds: Record<string, boolean>;
85
- /**
86
- * Map of row id and expandable row state
87
- * Useful for setup default expanded rows or manipulating programmatically
88
- */
89
- expandedRowIds: Record<string, boolean>;
90
- /**
91
- * Selector to element inside row which will trigger expand / collapse action on related row detail
92
- */
93
- expandableToggleSelector?: string;
94
- /**
95
- * Set table layout. If fixed then text overflow will be hidden and ellipsis added.
96
- */
97
- tableLayout: 'fixed' | 'auto';
98
- private querySelectors?;
99
- withToolbar: boolean;
100
- private rowSelectableFeature?;
101
- private rowExpandableFeature?;
102
- private rowSortableFeature?;
103
- private columnSortableFeature?;
104
- private componentReady;
105
- private getQuerySelectors;
106
- private getTable;
107
- private getTableBody;
108
- private findTableBody;
109
- private getColumns;
110
- private getBodyRowSelector;
111
- private canSortRows;
112
- private rowsOrderChange;
113
- private updateColumnVisibility;
114
- private updateAutoColspan;
115
- private observeExpandedRowIds;
116
- private observeSelectedRowIds;
117
- private observeItems;
118
- private initGridAttributes;
119
- protected firstUpdated(): Promise<void>;
120
- protected updated(changedProps: SmartPropertyValue): void;
121
- private renderWithoutSortable;
122
- private renderWithSortable;
123
- protected render(): import("lit-html").TemplateResult<1>;
124
- }
125
- declare global {
126
- interface HTMLElementTagNameMap {
127
- 'exm-grid': ExmGrid;
128
- }
129
- }
130
- export {};