@sankhyalabs/ezui 4.18.2 → 4.19.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 (78) hide show
  1. package/dist/cjs/constants-3a1d64fb.js +7 -0
  2. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-combo-box.cjs.entry.js +2 -2
  4. package/dist/cjs/ez-filter-input_2.cjs.entry.js +137 -0
  5. package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-grid.cjs.entry.js +373 -282
  7. package/dist/cjs/ez-list.cjs.entry.js +85 -72
  8. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +181 -0
  9. package/dist/cjs/{ez-filter-input_4.cjs.entry.js → ez-scroller_3.cjs.entry.js} +0 -116
  10. package/dist/cjs/ezui.cjs.js +1 -1
  11. package/dist/cjs/filter-column.cjs.entry.js +108 -0
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/collection/collection-manifest.json +3 -0
  14. package/dist/collection/components/ez-check/ez-check.css +1 -0
  15. package/dist/collection/components/ez-combo-box/ez-combo-box.js +1 -1
  16. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +186 -119
  17. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridUtils.js +8 -0
  18. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +8 -1
  19. package/dist/collection/components/ez-grid/ez-grid.css +14 -4
  20. package/dist/collection/components/ez-grid/ez-grid.js +49 -20
  21. package/dist/collection/components/ez-grid/subcomponents/filter-column.css +34 -0
  22. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +297 -0
  23. package/dist/collection/components/ez-list/ez-list.css +0 -1
  24. package/dist/collection/components/ez-list/ez-list.js +88 -77
  25. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.css +36 -0
  26. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +318 -0
  27. package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.js +1 -0
  28. package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.js +1 -0
  29. package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.css +18 -0
  30. package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.js +41 -0
  31. package/dist/collection/utils/constants.js +1 -0
  32. package/dist/custom-elements/index.d.ts +18 -0
  33. package/dist/custom-elements/index.js +761 -362
  34. package/dist/esm/constants-6dab64f7.js +4 -0
  35. package/dist/esm/ez-check.entry.js +1 -1
  36. package/dist/esm/ez-combo-box.entry.js +2 -2
  37. package/dist/esm/ez-filter-input_2.entry.js +132 -0
  38. package/dist/esm/ez-form-view.entry.js +1 -1
  39. package/dist/esm/ez-grid.entry.js +373 -282
  40. package/dist/esm/ez-list.entry.js +85 -72
  41. package/dist/esm/ez-multi-selection-list.entry.js +177 -0
  42. package/dist/esm/{ez-filter-input_4.entry.js → ez-scroller_3.entry.js} +3 -118
  43. package/dist/esm/ezui.js +1 -1
  44. package/dist/esm/filter-column.entry.js +104 -0
  45. package/dist/esm/loader.js +1 -1
  46. package/dist/ezui/ezui.esm.js +1 -1
  47. package/dist/ezui/p-06b3c6cd.entry.js +1 -0
  48. package/dist/ezui/{p-967758ac.entry.js → p-0dc118f3.entry.js} +1 -1
  49. package/dist/ezui/p-27a01a26.js +1 -0
  50. package/dist/ezui/p-353be5eb.entry.js +1 -0
  51. package/dist/ezui/p-3e25ecbc.entry.js +1 -0
  52. package/dist/ezui/{p-b945133d.entry.js → p-4186ca4f.entry.js} +1 -1
  53. package/dist/ezui/{p-b2056805.entry.js → p-5c0ac5ba.entry.js} +1 -1
  54. package/dist/ezui/{p-9334e296.entry.js → p-b7dd1382.entry.js} +2 -2
  55. package/dist/ezui/p-c72a799e.entry.js +1 -0
  56. package/dist/ezui/p-e04e9dbd.entry.js +1 -0
  57. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +5 -1
  58. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +14 -5
  59. package/dist/types/components/ez-grid/controller/ag-grid/AgGridUtils.d.ts +1 -0
  60. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +9 -7
  61. package/dist/types/components/ez-grid/ez-grid.d.ts +14 -4
  62. package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +45 -0
  63. package/dist/types/components/ez-list/ez-list.d.ts +5 -5
  64. package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +64 -0
  65. package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.d.ts +4 -0
  66. package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.d.ts +4 -0
  67. package/dist/types/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.d.ts +4 -0
  68. package/dist/types/components.d.ts +117 -1
  69. package/dist/types/utils/constants.d.ts +1 -0
  70. package/package.json +1 -1
  71. package/react/components.d.ts +3 -0
  72. package/react/components.js +3 -0
  73. package/react/components.js.map +1 -1
  74. package/dist/cjs/constants-5a75e2f3.js +0 -5
  75. package/dist/esm/constants-ca136201.js +0 -3
  76. package/dist/ezui/p-3f4ae3a3.js +0 -1
  77. package/dist/ezui/p-4ebb1d15.entry.js +0 -1
  78. package/dist/ezui/p-afea6e50.entry.js +0 -1
@@ -0,0 +1,318 @@
1
+ import { ArrayUtils } from '@sankhyalabs/core';
2
+ import { Fragment, h, Host } from '@stencil/core';
3
+ var ViewScenarios;
4
+ (function (ViewScenarios) {
5
+ ViewScenarios["DATASOURCE_RESULTS"] = "DATASOURCE_RESULTS";
6
+ ViewScenarios["DATASOURCE_RESULTS_EMPTY"] = "DATASOURCE_RESULTS_EMPTY";
7
+ ViewScenarios["DATASOURCE_INIT"] = "DATASOURCE_INIT";
8
+ ViewScenarios["OPTIONS_EMPTY"] = "OPTIONS_EMPTY";
9
+ ViewScenarios["OPTIONS"] = "OPTIONS";
10
+ })(ViewScenarios || (ViewScenarios = {}));
11
+ export class EzMuiltiSelectionList {
12
+ constructor() {
13
+ this.columnName = undefined;
14
+ this.dataSource = undefined;
15
+ this.useOptions = false;
16
+ this.options = undefined;
17
+ this.filteredOptions = undefined;
18
+ this.displayOptions = undefined;
19
+ this.viewScenario = undefined;
20
+ this.displayOptionToCheckAllItems = true;
21
+ }
22
+ async clearFilteredOptions() {
23
+ this.setInitialScenario();
24
+ this.filteredOptions = [];
25
+ if (this.searchInput) {
26
+ this.searchInput.value = '';
27
+ }
28
+ if (this.filterInput) {
29
+ this.filterInput.value = '';
30
+ }
31
+ }
32
+ onChangeUseOptions() {
33
+ this.setInitialScenario();
34
+ }
35
+ onChangeOptions() {
36
+ if (this.options) {
37
+ this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.options);
38
+ }
39
+ this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
40
+ this.setInitialScenario();
41
+ }
42
+ onChangeFilteredOptions(optionsListUpdated) {
43
+ this.displayOptions = this.filteredOptions;
44
+ this.displayOptionToCheckAllItems = this.filteredOptions.length > 1;
45
+ this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
46
+ this.changeFilteredOptions.emit(optionsListUpdated);
47
+ }
48
+ componentDidRender() {
49
+ this.changeCheckAllValeuFromFilteredOptions();
50
+ }
51
+ ordenationByCheckStateAndAlphabetically(filteredOptions) {
52
+ const listWithSelectChecked = [];
53
+ const listWithNotSelectChecked = [];
54
+ filteredOptions.forEach(item => (item.check ? listWithSelectChecked.push(item) : listWithNotSelectChecked.push(item)));
55
+ return [...ArrayUtils.sortAlphabetically(listWithSelectChecked), ...ArrayUtils.sortAlphabetically(listWithNotSelectChecked)];
56
+ }
57
+ changeCheckAllValeuFromFilteredOptions() {
58
+ var _a, _b, _c, _d;
59
+ const selectAll = (_a = this.filteredOptions) === null || _a === void 0 ? void 0 : _a.every(item => item.check === true);
60
+ const notSelectAll = (_b = this.filteredOptions) === null || _b === void 0 ? void 0 : _b.every(item => item.check === false);
61
+ const selectIndeterminated = ((_c = this.filteredOptions) === null || _c === void 0 ? void 0 : _c.some(item => item.check === false)) && ((_d = this.filteredOptions) === null || _d === void 0 ? void 0 : _d.some(item => item.check === true)) && (!selectAll || !notSelectAll);
62
+ if (this.checkInput && selectAll) {
63
+ this.checkInput.indeterminate = false;
64
+ this.checkInput.value = true;
65
+ return;
66
+ }
67
+ if (this.checkInput && selectIndeterminated) {
68
+ this.checkInput.indeterminate = true;
69
+ this.checkInput.value = false;
70
+ return;
71
+ }
72
+ if (this.checkInput && notSelectAll) {
73
+ this.checkInput.indeterminate = false;
74
+ this.checkInput.value = false;
75
+ return;
76
+ }
77
+ }
78
+ setInitialScenario() {
79
+ if (this.useOptions) {
80
+ this.viewScenario = ViewScenarios.OPTIONS;
81
+ this.changeCheckAllValeuFromFilteredOptions();
82
+ return;
83
+ }
84
+ this.viewScenario = this.options && this.options.length > 0 ? ViewScenarios.DATASOURCE_RESULTS : ViewScenarios.DATASOURCE_INIT;
85
+ }
86
+ async searchWithDataSource(searchArgument, fieldName) {
87
+ const { argument, mode } = searchArgument;
88
+ if (mode !== 'PRELOAD') {
89
+ return this.dataSource.fetchData(argument, fieldName);
90
+ }
91
+ }
92
+ handleSearchOnDataSource(event) {
93
+ var _a;
94
+ const optionsToSort = (_a = this.filteredOptions) !== null && _a !== void 0 ? _a : [];
95
+ if (event.detail && !optionsToSort.some(item => item.value == event.detail.value)) {
96
+ this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([...optionsToSort, event.detail]);
97
+ }
98
+ this.viewScenario = ViewScenarios.DATASOURCE_RESULTS;
99
+ }
100
+ handleRemoveItemFromOptions(item) {
101
+ this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter(i => i.value !== item.value));
102
+ if (this.filteredOptions.length === 0) {
103
+ this.viewScenario = ViewScenarios.DATASOURCE_INIT;
104
+ }
105
+ if (this.searchInput) {
106
+ this.searchInput.value = '';
107
+ }
108
+ }
109
+ handleSearchOnOption(event) {
110
+ if (event.detail) {
111
+ this.displayOptions = ArrayUtils.applyStringFilter(event.detail, this.filteredOptions, true);
112
+ this.viewScenario = this.displayOptions.length === 0 ? ViewScenarios.OPTIONS_EMPTY : ViewScenarios.OPTIONS;
113
+ return;
114
+ }
115
+ this.displayOptions = this.filteredOptions;
116
+ this.viewScenario = ViewScenarios.OPTIONS;
117
+ }
118
+ handleChangeSelectAllItems(event) {
119
+ this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([
120
+ ...this.filteredOptions.map(item => {
121
+ item.check = !!event.detail;
122
+ return item;
123
+ }),
124
+ ]);
125
+ }
126
+ handleChangeSelectedItem(event) {
127
+ const { detail: itemCheckSelected } = event;
128
+ this.filteredOptions = this.filteredOptions.map(item => {
129
+ if (item.label === itemCheckSelected.label) {
130
+ return Object.assign(Object.assign({}, item), { check: itemCheckSelected.check });
131
+ }
132
+ return item;
133
+ });
134
+ this.clearInputs();
135
+ }
136
+ clearInputs() {
137
+ this.filterInput ? (this.filterInput.value = '') : (this.searchInput.value = '');
138
+ }
139
+ buildViewList(hasDelete) {
140
+ return (h(Fragment, null, this.displayOptionToCheckAllItems && (h("ez-check", { ref: (element) => (this.checkInput = element), label: "Selecionar todos", class: "multi-selection__select-all", onEzChange: this.handleChangeSelectAllItems.bind(this) })), h("ez-list", { class: "multi-selection__list", dataSource: this.displayOptions, listMode: "check", hoverFeedback: true, onEzCheckChange: this.handleChangeSelectedItem.bind(this), itemSlotBuilder: hasDelete ? this.buildDeleteIconSlot.bind(this) : null })));
141
+ }
142
+ buildDeleteIconSlot(item) {
143
+ return h("ez-icon", { style: { cursor: 'pointer' }, iconName: "delete", onClick: () => this.handleRemoveItemFromOptions(item) });
144
+ }
145
+ buildInitViewWithDataSource() {
146
+ return h("multi-selection-box-message", { message: "Selecione os valores a serem filtrados atrav\u00E9s do campo de busca." });
147
+ }
148
+ buildViewEmptyResults() {
149
+ return h("multi-selection-box-message", { message: "Nenhum resultado encontrado." });
150
+ }
151
+ scenarioToDisplay(view) {
152
+ const scenarios = {
153
+ [ViewScenarios.DATASOURCE_INIT]: this.buildInitViewWithDataSource(),
154
+ [ViewScenarios.DATASOURCE_RESULTS]: this.buildViewList(true),
155
+ [ViewScenarios.DATASOURCE_RESULTS_EMPTY]: this.buildViewEmptyResults(),
156
+ [ViewScenarios.OPTIONS_EMPTY]: this.buildViewEmptyResults(),
157
+ [ViewScenarios.OPTIONS]: this.buildViewList(false),
158
+ };
159
+ return scenarios[view];
160
+ }
161
+ render() {
162
+ return (h(Host, null, h("div", { class: "multi-selection" }, this.useOptions ? (h("ez-filter-input", { ref: (element) => (this.filterInput = element), label: `Buscar..`, onEzChange: this.handleSearchOnOption.bind(this) })) : (h("ez-search", { class: "multi-selection__input", label: `Buscar...`, ref: (element) => (this.searchInput = element), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, optionLoader: (search) => this.searchWithDataSource(search, this.columnName), onEzChange: this.handleSearchOnDataSource.bind(this) })), h("ez-scroll", { class: "multi-selection__content-options" }, this.scenarioToDisplay(this.viewScenario)))));
163
+ }
164
+ static get is() { return "ez-multi-selection-list"; }
165
+ static get encapsulation() { return "scoped"; }
166
+ static get originalStyleUrls() {
167
+ return {
168
+ "$": ["ez-multi-selection-list.css"]
169
+ };
170
+ }
171
+ static get styleUrls() {
172
+ return {
173
+ "$": ["ez-multi-selection-list.css"]
174
+ };
175
+ }
176
+ static get properties() {
177
+ return {
178
+ "columnName": {
179
+ "type": "string",
180
+ "mutable": false,
181
+ "complexType": {
182
+ "original": "string",
183
+ "resolved": "string",
184
+ "references": {}
185
+ },
186
+ "required": false,
187
+ "optional": false,
188
+ "docs": {
189
+ "tags": [],
190
+ "text": "Nome da coluna onde ser\u00E3o aplicadas as op\u00E7\u00F5es selecionadas."
191
+ },
192
+ "attribute": "column-name",
193
+ "reflect": false
194
+ },
195
+ "dataSource": {
196
+ "type": "unknown",
197
+ "mutable": false,
198
+ "complexType": {
199
+ "original": "IMultiSelectionListDataSource",
200
+ "resolved": "IMultiSelectionListDataSource",
201
+ "references": {
202
+ "IMultiSelectionListDataSource": {
203
+ "location": "import",
204
+ "path": "./interfaces/IMultiSelectionListDataSource"
205
+ }
206
+ }
207
+ },
208
+ "required": false,
209
+ "optional": false,
210
+ "docs": {
211
+ "tags": [],
212
+ "text": "Classe que implementa o m\u00E9todo fetchData, respons\u00E1vel por realizar a pesquisa dos dados,\ncom base no termo informado pelo usu\u00E1rio."
213
+ }
214
+ },
215
+ "useOptions": {
216
+ "type": "boolean",
217
+ "mutable": true,
218
+ "complexType": {
219
+ "original": "boolean",
220
+ "resolved": "boolean",
221
+ "references": {}
222
+ },
223
+ "required": false,
224
+ "optional": false,
225
+ "docs": {
226
+ "tags": [],
227
+ "text": "Indica se deve ser exibida lista de op\u00E7\u00F5es do atributo options (true),\nou se deve utilizar o datasource (false)"
228
+ },
229
+ "attribute": "use-options",
230
+ "reflect": false,
231
+ "defaultValue": "false"
232
+ },
233
+ "options": {
234
+ "type": "unknown",
235
+ "mutable": false,
236
+ "complexType": {
237
+ "original": "IMultiSelectionOption[]",
238
+ "resolved": "IMultiSelectionOption[]",
239
+ "references": {
240
+ "IMultiSelectionOption": {
241
+ "location": "import",
242
+ "path": "./interfaces/IMultiSelectionOption"
243
+ }
244
+ }
245
+ },
246
+ "required": false,
247
+ "optional": false,
248
+ "docs": {
249
+ "tags": [],
250
+ "text": "Op\u00E7\u00F5es de filtros a serem exibidas na listagem."
251
+ }
252
+ }
253
+ };
254
+ }
255
+ static get states() {
256
+ return {
257
+ "filteredOptions": {},
258
+ "displayOptions": {},
259
+ "viewScenario": {},
260
+ "displayOptionToCheckAllItems": {}
261
+ };
262
+ }
263
+ static get events() {
264
+ return [{
265
+ "method": "changeFilteredOptions",
266
+ "name": "changeFilteredOptions",
267
+ "bubbles": true,
268
+ "cancelable": true,
269
+ "composed": true,
270
+ "docs": {
271
+ "tags": [],
272
+ "text": "Evento que informa que a lista de op\u00E7\u00F5es selecionadas sofreu altera\u00E7\u00E3o."
273
+ },
274
+ "complexType": {
275
+ "original": "IMultiSelectionOption[]",
276
+ "resolved": "IMultiSelectionOption[]",
277
+ "references": {
278
+ "IMultiSelectionOption": {
279
+ "location": "import",
280
+ "path": "./interfaces/IMultiSelectionOption"
281
+ }
282
+ }
283
+ }
284
+ }];
285
+ }
286
+ static get methods() {
287
+ return {
288
+ "clearFilteredOptions": {
289
+ "complexType": {
290
+ "signature": "() => Promise<void>",
291
+ "parameters": [],
292
+ "references": {
293
+ "Promise": {
294
+ "location": "global"
295
+ }
296
+ },
297
+ "return": "Promise<void>"
298
+ },
299
+ "docs": {
300
+ "text": "",
301
+ "tags": []
302
+ }
303
+ }
304
+ };
305
+ }
306
+ static get watchers() {
307
+ return [{
308
+ "propName": "useOptions",
309
+ "methodName": "onChangeUseOptions"
310
+ }, {
311
+ "propName": "options",
312
+ "methodName": "onChangeOptions"
313
+ }, {
314
+ "propName": "filteredOptions",
315
+ "methodName": "onChangeFilteredOptions"
316
+ }];
317
+ }
318
+ }
@@ -0,0 +1,18 @@
1
+ .multi-selection__message {
2
+ display: flex;
3
+ flex-direction: row;
4
+ align-items: center;
5
+ justify-content: center;
6
+ width: 100%;
7
+ min-height: 320px;
8
+ text-align: center;
9
+ }
10
+
11
+ .multi-selection__text-message {
12
+ margin-top: -30px;
13
+ font-family: var(--font-pattern);
14
+ font-size: var(--text--meduim);
15
+ padding: var(--space-xs);
16
+ color: var(--text--primary);
17
+ }
18
+
@@ -0,0 +1,41 @@
1
+ import { h } from '@stencil/core';
2
+ export class MultiSelectionBoxMessage {
3
+ constructor() {
4
+ this.message = undefined;
5
+ }
6
+ render() {
7
+ return (h("div", { class: "multi-selection__message" }, h("span", { class: "multi-selection__text-message" }, this.message)));
8
+ }
9
+ static get is() { return "multi-selection-box-message"; }
10
+ static get originalStyleUrls() {
11
+ return {
12
+ "$": ["multi-selection-box-message.css"]
13
+ };
14
+ }
15
+ static get styleUrls() {
16
+ return {
17
+ "$": ["multi-selection-box-message.css"]
18
+ };
19
+ }
20
+ static get properties() {
21
+ return {
22
+ "message": {
23
+ "type": "string",
24
+ "mutable": false,
25
+ "complexType": {
26
+ "original": "string",
27
+ "resolved": "string",
28
+ "references": {}
29
+ },
30
+ "required": false,
31
+ "optional": false,
32
+ "docs": {
33
+ "tags": [],
34
+ "text": ""
35
+ },
36
+ "attribute": "message",
37
+ "reflect": false
38
+ }
39
+ };
40
+ }
41
+ }
@@ -1,2 +1,3 @@
1
1
  export const REQUIRED_INFO = " (obrigatório) *";
2
2
  export const ALL_RECORD = "ALL_RECORD";
3
+ export const DISTINCT_FILTER_NAME_PREFIX = 'FILTRO_COLUNA_';
@@ -164,6 +164,12 @@ export const EzModalContainer: {
164
164
  new (): EzModalContainer;
165
165
  };
166
166
 
167
+ interface EzMultiSelectionList extends Components.EzMultiSelectionList, HTMLElement {}
168
+ export const EzMultiSelectionList: {
169
+ prototype: EzMultiSelectionList;
170
+ new (): EzMultiSelectionList;
171
+ };
172
+
167
173
  interface EzNumberInput extends Components.EzNumberInput, HTMLElement {}
168
174
  export const EzNumberInput: {
169
175
  prototype: EzNumberInput;
@@ -266,6 +272,18 @@ export const EzViewStack: {
266
272
  new (): EzViewStack;
267
273
  };
268
274
 
275
+ interface FilterColumn extends Components.FilterColumn, HTMLElement {}
276
+ export const FilterColumn: {
277
+ prototype: FilterColumn;
278
+ new (): FilterColumn;
279
+ };
280
+
281
+ interface MultiSelectionBoxMessage extends Components.MultiSelectionBoxMessage, HTMLElement {}
282
+ export const MultiSelectionBoxMessage: {
283
+ prototype: MultiSelectionBoxMessage;
284
+ new (): MultiSelectionBoxMessage;
285
+ };
286
+
269
287
  /**
270
288
  * Utility to define all custom elements within this package using the tag name provided in the component's source.
271
289
  * When defining each custom element, it will also check it's safe to define by: