@digital-realty/ix-grid 1.0.38 → 2.0.0-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.
Files changed (41) hide show
  1. package/dist/IxGrid.d.ts +55 -55
  2. package/dist/IxGrid.js +219 -219
  3. package/dist/components/IxGridColumnFilter.d.ts +28 -28
  4. package/dist/components/IxGridColumnFilter.js +152 -152
  5. package/dist/components/IxGridDownloadMenu.d.ts +12 -12
  6. package/dist/components/IxGridDownloadMenu.js +35 -35
  7. package/dist/components/IxGridNav.d.ts +15 -15
  8. package/dist/components/IxGridNav.js +20 -20
  9. package/dist/components/IxGridRowFilter.d.ts +40 -40
  10. package/dist/components/IxGridRowFilter.js +188 -188
  11. package/dist/components/IxPagination.d.ts +13 -13
  12. package/dist/components/IxPagination.js +59 -59
  13. package/dist/components/grid-column-filter-styles.d.ts +1 -1
  14. package/dist/components/grid-column-filter-styles.js +2 -2
  15. package/dist/components/grid-download-menu-styles.d.ts +1 -1
  16. package/dist/components/grid-download-menu-styles.js +2 -2
  17. package/dist/components/grid-row-filter-styles.d.ts +1 -1
  18. package/dist/components/grid-row-filter-styles.js +2 -2
  19. package/dist/components/ix-grid-nav.d.ts +1 -1
  20. package/dist/components/ix-grid-nav.js +2 -2
  21. package/dist/components/pagination-styles.d.ts +1 -1
  22. package/dist/components/pagination-styles.js +2 -2
  23. package/dist/grid-view-styles.d.ts +1 -1
  24. package/dist/grid-view-styles.js +2 -2
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +2 -2
  27. package/dist/ix-grid-copy.d.ts +10 -10
  28. package/dist/ix-grid-copy.js +10 -10
  29. package/dist/ix-grid.d.ts +1 -1
  30. package/dist/ix-grid.js +2 -2
  31. package/dist/react/IxGridNav.d.ts +2 -2
  32. package/dist/react/IxGridNav.js +8 -8
  33. package/dist/test/ix-grid-column-filter.test.d.ts +1 -1
  34. package/dist/test/ix-grid-column-filter.test.js +35 -35
  35. package/dist/test/ix-grid-row-filter.test.d.ts +1 -1
  36. package/dist/test/ix-grid-row-filter.test.js +36 -36
  37. package/dist/test/ix-grid.test.d.ts +1 -1
  38. package/dist/test/ix-grid.test.js +42 -42
  39. package/dist/test/ix-pagination.test.d.ts +1 -1
  40. package/dist/test/ix-pagination.test.js +21 -21
  41. package/package.json +2 -3
@@ -1,40 +1,40 @@
1
- import { LitElement } from 'lit';
2
- import '@digital-realty/ix-icon/ix-icon.js';
3
- import '@digital-realty/ix-icon-button/ix-icon-button.js';
4
- import '@digital-realty/ix-button/ix-button.js';
5
- import '@digital-realty/ix-select/ix-select.js';
6
- import type { Column } from '../IxGrid.js';
7
- export interface Filter {
8
- columnField: string;
9
- operatorValue: string;
10
- value: string;
11
- }
12
- export declare class IxGridRowFilter extends LitElement {
13
- static readonly styles: import("lit").CSSResult[];
14
- columns: Column[];
15
- private isDropdownVisible;
16
- private filters;
17
- private filterableColumns;
18
- private filterColumns;
19
- private activeFilters;
20
- private mapSelect;
21
- updateActiveFilters(): void;
22
- connectedCallback(): void;
23
- disconnectedCallback(): void;
24
- firstUpdated(): void;
25
- get filterNames(): string[];
26
- get unselectedFilters(): string[];
27
- closeOnOuterClick: (e: Event) => void;
28
- parseFilterQueryString(): Filter[];
29
- dispatchUpdate(): void;
30
- addFilter(): void;
31
- clearFilters(): void;
32
- removeFilter(index: number): void;
33
- private onfilterColumnChange;
34
- private onfilterValueChange;
35
- formatCamelCaseToEnglish(text: string): string;
36
- renderToolTip(): string | import("lit").TemplateResult<1>;
37
- renderFilterInput(value: Filter, index: number): import("lit").TemplateResult<1>;
38
- renderDropdown(): import("lit").TemplateResult<1>;
39
- render(): import("lit").TemplateResult<1>;
40
- }
1
+ import { LitElement } from 'lit';
2
+ import '@digital-realty/ix-icon/ix-icon.js';
3
+ import '@digital-realty/ix-icon-button/ix-icon-button.js';
4
+ import '@digital-realty/ix-button/ix-button.js';
5
+ import '@digital-realty/ix-select/ix-select.js';
6
+ import type { Column } from '../IxGrid.js';
7
+ export interface Filter {
8
+ columnField: string;
9
+ operatorValue: string;
10
+ value: string;
11
+ }
12
+ export declare class IxGridRowFilter extends LitElement {
13
+ static readonly styles: import("lit").CSSResult[];
14
+ columns: Column[];
15
+ private isDropdownVisible;
16
+ private filters;
17
+ private filterableColumns;
18
+ private filterColumns;
19
+ private activeFilters;
20
+ private mapSelect;
21
+ updateActiveFilters(): void;
22
+ connectedCallback(): void;
23
+ disconnectedCallback(): void;
24
+ firstUpdated(): void;
25
+ get filterNames(): string[];
26
+ get unselectedFilters(): string[];
27
+ closeOnOuterClick: (e: Event) => void;
28
+ parseFilterQueryString(): Filter[];
29
+ dispatchUpdate(): void;
30
+ addFilter(): void;
31
+ clearFilters(): void;
32
+ removeFilter(index: number): void;
33
+ private onfilterColumnChange;
34
+ private onfilterValueChange;
35
+ formatCamelCaseToEnglish(text: string): string;
36
+ renderToolTip(): string | import("lit").TemplateResult<1>;
37
+ renderFilterInput(value: Filter, index: number): import("lit").TemplateResult<1>;
38
+ renderDropdown(): import("lit").TemplateResult<1>;
39
+ render(): import("lit").TemplateResult<1>;
40
+ }
@@ -1,148 +1,148 @@
1
- import { __decorate } from "tslib";
2
- import { LitElement, html, nothing } from 'lit';
3
- import { customElement, property, state } from 'lit/decorators.js';
4
- import { repeat } from 'lit/directives/repeat.js';
5
- import '@digital-realty/ix-icon/ix-icon.js';
6
- import '@digital-realty/ix-icon-button/ix-icon-button.js';
7
- import '@digital-realty/ix-button/ix-button.js';
8
- import '@digital-realty/ix-select/ix-select.js';
9
- import { IxGridViewStyles } from '../grid-view-styles.js';
10
- import { IxGridRowFilterStyles } from './grid-row-filter-styles.js';
11
- import { copy } from '../ix-grid-copy.js';
12
- let IxGridRowFilter = class IxGridRowFilter extends LitElement {
13
- constructor() {
14
- super(...arguments);
15
- this.columns = [];
16
- this.isDropdownVisible = false;
17
- this.filters = [];
18
- this.filterableColumns = [];
19
- this.filterColumns = [];
20
- this.activeFilters = [];
21
- this.mapSelect = false;
22
- this.closeOnOuterClick = (e) => {
23
- if (!e.composedPath().includes(this)) {
24
- this.isDropdownVisible = false;
25
- }
26
- };
27
- }
28
- updateActiveFilters() {
29
- this.activeFilters = this.filters.filter(filter => filter.value.length > 0);
30
- }
31
- connectedCallback() {
32
- super.connectedCallback();
33
- document.addEventListener('click', this.closeOnOuterClick);
34
- }
35
- disconnectedCallback() {
36
- super.disconnectedCallback();
37
- document.removeEventListener('click', this.closeOnOuterClick);
38
- }
39
- firstUpdated() {
40
- this.filterableColumns = this.columns.filter(column => column.filterable);
41
- this.filterColumns = this.filterableColumns.map(column => column.name);
42
- this.filters = this.parseFilterQueryString();
43
- if (!this.filters.length) {
44
- this.addFilter();
45
- }
46
- this.updateActiveFilters();
47
- this.dispatchUpdate();
48
- }
49
- get filterNames() {
50
- return this.filters.map(filter => filter.columnField);
51
- }
52
- get unselectedFilters() {
53
- return this.filterColumns.filter(f => !this.filterNames.includes(f));
54
- }
55
- parseFilterQueryString() {
56
- const params = new URLSearchParams(window.location.search);
57
- const filters = [];
58
- for (const [key, value] of params) {
59
- if (this.filterColumns.includes(key)) {
60
- filters.push({
61
- columnField: key,
62
- operatorValue: 'contains',
63
- value,
64
- });
65
- }
66
- }
67
- return filters;
68
- }
69
- dispatchUpdate() {
70
- this.dispatchEvent(new CustomEvent('rowFilter', {
71
- detail: {
72
- filters: this.filters.filter(filter => filter.value.length >= 3),
73
- },
74
- bubbles: true,
75
- composed: true,
76
- }));
77
- }
78
- addFilter() {
79
- const nextFilter = this.filterColumns.find(filter => !this.filterNames.includes(filter)) ||
80
- '';
81
- this.filters = [
82
- ...this.filters,
83
- {
84
- columnField: nextFilter,
85
- operatorValue: 'contains',
86
- value: '',
87
- },
88
- ];
89
- this.updateActiveFilters();
90
- }
91
- clearFilters() {
92
- this.filters = [];
93
- this.addFilter();
94
- this.dispatchUpdate();
95
- }
96
- removeFilter(index) {
97
- this.filters = this.filters.filter((_, i) => i !== index);
98
- this.dispatchUpdate();
99
- if (this.filters.length === 0) {
100
- this.isDropdownVisible = false;
101
- this.addFilter();
102
- }
103
- }
104
- onfilterColumnChange(index, e) {
105
- const selectedValue = e.target.value;
106
- this.filters[index].columnField = selectedValue;
107
- this.filters = [...this.filters];
108
- if (this.filters[index].value.length >= 3) {
109
- this.dispatchUpdate();
110
- }
111
- }
112
- onfilterValueChange(index, e) {
113
- const oldValueLength = this.filters[index].value.length;
114
- const { value } = e.target;
115
- this.filters[index].value = value;
116
- const newValueLength = this.filters[index].value.length;
117
- if (this.filters[index].columnField.length > 0 &&
118
- (newValueLength >= 3 || newValueLength < oldValueLength)) {
119
- this.dispatchUpdate();
120
- }
121
- this.updateActiveFilters();
122
- }
123
- formatCamelCaseToEnglish(text) {
124
- const spaced = text.replace(/([A-Z])/g, ' $1').toLowerCase();
125
- const english = spaced.charAt(0).toUpperCase() + spaced.slice(1);
126
- return english;
127
- }
128
- renderToolTip() {
129
- if (this.isDropdownVisible) {
130
- return copy.hideFilters;
131
- }
132
- if (!this.activeFilters.length) {
133
- return copy.showFilters;
134
- }
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, html, nothing } from 'lit';
3
+ import { customElement, property, state } from 'lit/decorators.js';
4
+ import { repeat } from 'lit/directives/repeat.js';
5
+ import '@digital-realty/ix-icon/ix-icon.js';
6
+ import '@digital-realty/ix-icon-button/ix-icon-button.js';
7
+ import '@digital-realty/ix-button/ix-button.js';
8
+ import '@digital-realty/ix-select/ix-select.js';
9
+ import { IxGridViewStyles } from '../grid-view-styles.js';
10
+ import { IxGridRowFilterStyles } from './grid-row-filter-styles.js';
11
+ import { copy } from '../ix-grid-copy.js';
12
+ let IxGridRowFilter = class IxGridRowFilter extends LitElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.columns = [];
16
+ this.isDropdownVisible = false;
17
+ this.filters = [];
18
+ this.filterableColumns = [];
19
+ this.filterColumns = [];
20
+ this.activeFilters = [];
21
+ this.mapSelect = false;
22
+ this.closeOnOuterClick = (e) => {
23
+ if (!e.composedPath().includes(this)) {
24
+ this.isDropdownVisible = false;
25
+ }
26
+ };
27
+ }
28
+ updateActiveFilters() {
29
+ this.activeFilters = this.filters.filter(filter => filter.value.length > 0);
30
+ }
31
+ connectedCallback() {
32
+ super.connectedCallback();
33
+ document.addEventListener('click', this.closeOnOuterClick);
34
+ }
35
+ disconnectedCallback() {
36
+ super.disconnectedCallback();
37
+ document.removeEventListener('click', this.closeOnOuterClick);
38
+ }
39
+ firstUpdated() {
40
+ this.filterableColumns = this.columns.filter(column => column.filterable);
41
+ this.filterColumns = this.filterableColumns.map(column => column.name);
42
+ this.filters = this.parseFilterQueryString();
43
+ if (!this.filters.length) {
44
+ this.addFilter();
45
+ }
46
+ this.updateActiveFilters();
47
+ this.dispatchUpdate();
48
+ }
49
+ get filterNames() {
50
+ return this.filters.map(filter => filter.columnField);
51
+ }
52
+ get unselectedFilters() {
53
+ return this.filterColumns.filter(f => !this.filterNames.includes(f));
54
+ }
55
+ parseFilterQueryString() {
56
+ const params = new URLSearchParams(window.location.search);
57
+ const filters = [];
58
+ for (const [key, value] of params) {
59
+ if (this.filterColumns.includes(key)) {
60
+ filters.push({
61
+ columnField: key,
62
+ operatorValue: 'contains',
63
+ value,
64
+ });
65
+ }
66
+ }
67
+ return filters;
68
+ }
69
+ dispatchUpdate() {
70
+ this.dispatchEvent(new CustomEvent('rowFilter', {
71
+ detail: {
72
+ filters: this.filters.filter(filter => filter.value.length >= 3),
73
+ },
74
+ bubbles: true,
75
+ composed: true,
76
+ }));
77
+ }
78
+ addFilter() {
79
+ const nextFilter = this.filterColumns.find(filter => !this.filterNames.includes(filter)) ||
80
+ '';
81
+ this.filters = [
82
+ ...this.filters,
83
+ {
84
+ columnField: nextFilter,
85
+ operatorValue: 'contains',
86
+ value: '',
87
+ },
88
+ ];
89
+ this.updateActiveFilters();
90
+ }
91
+ clearFilters() {
92
+ this.filters = [];
93
+ this.addFilter();
94
+ this.dispatchUpdate();
95
+ }
96
+ removeFilter(index) {
97
+ this.filters = this.filters.filter((_, i) => i !== index);
98
+ this.dispatchUpdate();
99
+ if (this.filters.length === 0) {
100
+ this.isDropdownVisible = false;
101
+ this.addFilter();
102
+ }
103
+ }
104
+ onfilterColumnChange(index, e) {
105
+ const selectedValue = e.target.value;
106
+ this.filters[index].columnField = selectedValue;
107
+ this.filters = [...this.filters];
108
+ if (this.filters[index].value.length >= 3) {
109
+ this.dispatchUpdate();
110
+ }
111
+ }
112
+ onfilterValueChange(index, e) {
113
+ const oldValueLength = this.filters[index].value.length;
114
+ const { value } = e.target;
115
+ this.filters[index].value = value;
116
+ const newValueLength = this.filters[index].value.length;
117
+ if (this.filters[index].columnField.length > 0 &&
118
+ (newValueLength >= 3 || newValueLength < oldValueLength)) {
119
+ this.dispatchUpdate();
120
+ }
121
+ this.updateActiveFilters();
122
+ }
123
+ formatCamelCaseToEnglish(text) {
124
+ const spaced = text.replace(/([A-Z])/g, ' $1').toLowerCase();
125
+ const english = spaced.charAt(0).toUpperCase() + spaced.slice(1);
126
+ return english;
127
+ }
128
+ renderToolTip() {
129
+ if (this.isDropdownVisible) {
130
+ return copy.hideFilters;
131
+ }
132
+ if (!this.activeFilters.length) {
133
+ return copy.showFilters;
134
+ }
135
135
  return html ` <p>${this.activeFilters.length} ${copy.activeFilter}</p>
136
136
  <ul>
137
137
  ${this.activeFilters.map(filter => html `<li>
138
138
  ${this.formatCamelCaseToEnglish(filter.columnField)}
139
139
  ${filter.operatorValue} ${filter.value}
140
140
  </li>`)}
141
- </ul>`;
142
- }
143
- renderFilterInput(value, index) {
144
- const options = [value.columnField, ...this.unselectedFilters];
145
- const filterOptions = this.filterableColumns.filter(column => options.includes(column.name));
141
+ </ul>`;
142
+ }
143
+ renderFilterInput(value, index) {
144
+ const options = [value.columnField, ...this.unselectedFilters];
145
+ const filterOptions = this.filterableColumns.filter(column => options.includes(column.name));
146
146
  return html `
147
147
  <div class="filter-form">
148
148
  <div class="filter-remove filter-form-column">
@@ -150,15 +150,15 @@ let IxGridRowFilter = class IxGridRowFilter extends LitElement {
150
150
  <ix-icon-button
151
151
  icon="close"
152
152
  @click=${() => this.removeFilter(index)}
153
- @keyDown=${(e) => {
154
- if (e.key === ' ' || e.key === 'Enter') {
155
- this.removeFilter(index);
156
- }
153
+ @keyDown=${(e) => {
154
+ if (e.key === ' ' || e.key === 'Enter') {
155
+ this.removeFilter(index);
156
+ }
157
157
  }}
158
158
  ></ix-icon-button>
159
159
  </div>
160
160
  </div>
161
- ${this.mapSelect
161
+ ${this.mapSelect
162
162
  ? html `<div
163
163
  class="filter-form-column filter-form-column-border filterColumnField"
164
164
  >
@@ -185,7 +185,7 @@ let IxGridRowFilter = class IxGridRowFilter extends LitElement {
185
185
  `)}
186
186
  </select>
187
187
  </div>
188
- </div>`
188
+ </div>`
189
189
  : nothing}
190
190
 
191
191
  <div
@@ -242,11 +242,11 @@ let IxGridRowFilter = class IxGridRowFilter extends LitElement {
242
242
  </div>
243
243
  </div>
244
244
  </div>
245
- `;
246
- }
247
- renderDropdown() {
248
- const disableAddButton = this.filters.length >= this.filterColumns.length ||
249
- this.activeFilters.length < this.filters.length;
245
+ `;
246
+ }
247
+ renderDropdown() {
248
+ const disableAddButton = this.filters.length >= this.filterColumns.length ||
249
+ this.activeFilters.length < this.filters.length;
250
250
  return html ` <div class="filter-dropdown-content">
251
251
  <div class="filter-body">
252
252
  ${this.filters.map((filter, index) => this.renderFilterInput(filter, index))}
@@ -268,24 +268,24 @@ let IxGridRowFilter = class IxGridRowFilter extends LitElement {
268
268
  <span class="add">CLEAR ALL</span>
269
269
  </button>
270
270
  </div>
271
- </div>`;
272
- }
273
- render() {
271
+ </div>`;
272
+ }
273
+ render() {
274
274
  return html ` <div class="grid-menu">
275
275
  <div class="filter-container tooltip-container">
276
- ${this.activeFilters.length > 0
276
+ ${this.activeFilters.length > 0
277
277
  ? html `<span class="filter-superscript"
278
278
  >${this.activeFilters.length}</span
279
- >`
279
+ >`
280
280
  : nothing}
281
281
  <ix-button
282
282
  appearance="text"
283
283
  class="filter_list filter-button"
284
- @click=${() => {
285
- this.isDropdownVisible = !this.isDropdownVisible;
284
+ @click=${() => {
285
+ this.isDropdownVisible = !this.isDropdownVisible;
286
286
  }}
287
- @keyDown=${() => {
288
- this.isDropdownVisible = !this.isDropdownVisible;
287
+ @keyDown=${() => {
288
+ this.isDropdownVisible = !this.isDropdownVisible;
289
289
  }}
290
290
  >
291
291
  <div class="slot-wrap">
@@ -298,33 +298,33 @@ let IxGridRowFilter = class IxGridRowFilter extends LitElement {
298
298
  <div class="tool-tip">${this.renderToolTip()}</div>
299
299
  ${this.isDropdownVisible ? this.renderDropdown() : nothing}
300
300
  </div>
301
- </div>`;
302
- }
303
- };
304
- IxGridRowFilter.styles = [IxGridViewStyles, IxGridRowFilterStyles];
305
- __decorate([
306
- property({ type: Array })
307
- ], IxGridRowFilter.prototype, "columns", void 0);
308
- __decorate([
309
- state()
310
- ], IxGridRowFilter.prototype, "isDropdownVisible", void 0);
311
- __decorate([
312
- state()
313
- ], IxGridRowFilter.prototype, "filters", void 0);
314
- __decorate([
315
- state()
316
- ], IxGridRowFilter.prototype, "filterableColumns", void 0);
317
- __decorate([
318
- state()
319
- ], IxGridRowFilter.prototype, "filterColumns", void 0);
320
- __decorate([
321
- state()
322
- ], IxGridRowFilter.prototype, "activeFilters", void 0);
323
- __decorate([
324
- state()
325
- ], IxGridRowFilter.prototype, "mapSelect", void 0);
326
- IxGridRowFilter = __decorate([
327
- customElement('ix-grid-row-filter')
328
- ], IxGridRowFilter);
329
- export { IxGridRowFilter };
301
+ </div>`;
302
+ }
303
+ };
304
+ IxGridRowFilter.styles = [IxGridViewStyles, IxGridRowFilterStyles];
305
+ __decorate([
306
+ property({ type: Array })
307
+ ], IxGridRowFilter.prototype, "columns", void 0);
308
+ __decorate([
309
+ state()
310
+ ], IxGridRowFilter.prototype, "isDropdownVisible", void 0);
311
+ __decorate([
312
+ state()
313
+ ], IxGridRowFilter.prototype, "filters", void 0);
314
+ __decorate([
315
+ state()
316
+ ], IxGridRowFilter.prototype, "filterableColumns", void 0);
317
+ __decorate([
318
+ state()
319
+ ], IxGridRowFilter.prototype, "filterColumns", void 0);
320
+ __decorate([
321
+ state()
322
+ ], IxGridRowFilter.prototype, "activeFilters", void 0);
323
+ __decorate([
324
+ state()
325
+ ], IxGridRowFilter.prototype, "mapSelect", void 0);
326
+ IxGridRowFilter = __decorate([
327
+ customElement('ix-grid-row-filter')
328
+ ], IxGridRowFilter);
329
+ export { IxGridRowFilter };
330
330
  //# sourceMappingURL=IxGridRowFilter.js.map
@@ -1,13 +1,13 @@
1
- import { LitElement } from 'lit';
2
- import '@digital-realty/ix-icon-button/ix-icon-button.js';
3
- import '@digital-realty/ix-select/ix-select.js';
4
- export declare class IxPagination extends LitElement {
5
- static readonly styles: import("lit").CSSResult[];
6
- recordCount: number;
7
- page: number;
8
- pageSize: number;
9
- pageSizes: number[];
10
- private changePage;
11
- updatePagination(page?: number, pageSize?: number): void;
12
- render(): import("lit").TemplateResult<1>;
13
- }
1
+ import { LitElement } from 'lit';
2
+ import '@digital-realty/ix-icon-button/ix-icon-button.js';
3
+ import '@digital-realty/ix-select/ix-select.js';
4
+ export declare class IxPagination extends LitElement {
5
+ static readonly styles: import("lit").CSSResult[];
6
+ recordCount: number;
7
+ page: number;
8
+ pageSize: number;
9
+ pageSizes: number[];
10
+ private changePage;
11
+ updatePagination(page?: number, pageSize?: number): void;
12
+ render(): import("lit").TemplateResult<1>;
13
+ }