@sankhyalabs/ezui 5.22.0-dev.4 → 5.22.0-dev.41
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/dist/cjs/DataBinder-3b083480.js +445 -0
- package/dist/cjs/FocusResolver-885f2173.js +35 -0
- package/dist/cjs/ez-button.cjs.entry.js +11 -5
- package/dist/cjs/ez-card-item_3.cjs.entry.js +21 -6
- package/dist/cjs/ez-chart.cjs.entry.js +1 -1
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +64 -11
- package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +33 -4
- package/dist/cjs/ez-date-input.cjs.entry.js +12 -3
- package/dist/cjs/ez-date-time-input.cjs.entry.js +9 -3
- package/dist/cjs/ez-dialog.cjs.entry.js +9 -1
- package/dist/cjs/{ez-dropdown.cjs.entry.js → ez-dropdown_2.cjs.entry.js} +75 -8
- package/dist/cjs/ez-form-view.cjs.entry.js +5 -4
- package/dist/cjs/ez-form.cjs.entry.js +4 -324
- package/dist/cjs/ez-grid.cjs.entry.js +14742 -70307
- package/dist/cjs/ez-list.cjs.entry.js +6 -7
- package/dist/cjs/ez-modal-container.cjs.entry.js +2 -1
- package/dist/cjs/ez-modal.cjs.entry.js +19 -4
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +13 -1
- package/dist/cjs/ez-popup.cjs.entry.js +21 -2
- package/dist/cjs/ez-scroller_2.cjs.entry.js +3 -3
- package/dist/cjs/ez-search.cjs.entry.js +66 -33
- package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-button.cjs.entry.js +2 -2
- package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +67 -5
- package/dist/cjs/ez-text-input.cjs.entry.js +51 -5
- package/dist/cjs/ez-time-input.cjs.entry.js +6 -0
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/index-9e5554cb.js +2 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ez-button/ez-button.css +21 -11
- package/dist/collection/components/ez-button/ez-button.js +12 -6
- package/dist/collection/components/ez-card-item/ez-card-item.css +60 -10
- package/dist/collection/components/ez-card-item/ez-card-item.js +30 -3
- package/dist/collection/components/ez-check/ez-check.css +1 -6
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +2 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +1 -1
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +109 -13
- package/dist/collection/components/ez-date-input/ez-date-input.css +1 -1
- package/dist/collection/components/ez-date-input/ez-date-input.js +38 -4
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +1 -1
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +35 -4
- package/dist/collection/components/ez-dialog/ez-dialog.js +9 -1
- package/dist/collection/components/ez-dropdown/ez-dropdown.js +33 -8
- package/dist/collection/components/ez-filter-input/ez-filter-input.js +35 -4
- package/dist/collection/components/ez-form/ez-form.js +1 -0
- package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +47 -5
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +3 -2
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +238 -55
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +107 -5
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +222 -42
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +16 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +8 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +2 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +4 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.js +2 -0
- package/dist/collection/components/ez-grid/ez-grid.css +17 -7
- package/dist/collection/components/ez-grid/ez-grid.js +181 -7
- package/dist/collection/components/ez-list/ez-list.css +2 -1
- package/dist/collection/components/ez-list/ez-list.js +6 -7
- package/dist/collection/components/ez-modal/ez-modal.css +1 -1
- package/dist/collection/components/ez-modal/ez-modal.js +36 -3
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +20 -1
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +1 -1
- package/dist/collection/components/ez-number-input/ez-number-input.js +49 -1
- package/dist/collection/components/ez-popup/ez-popup.css +5 -1
- package/dist/collection/components/ez-popup/ez-popup.js +38 -1
- package/dist/collection/components/ez-scroller/ez-scroller.css +1 -0
- package/dist/collection/components/ez-search/ez-search.css +21 -10
- package/dist/collection/components/ez-search/ez-search.js +147 -34
- package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.css +3 -0
- package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.js +1 -1
- package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.css +3 -1
- package/dist/collection/components/ez-split-button/ez-split-button.css +48 -12
- package/dist/collection/components/ez-split-button/ez-split-button.js +3 -3
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +1 -0
- package/dist/collection/components/ez-text-area/ez-text-area.css +73 -28
- package/dist/collection/components/ez-text-area/ez-text-area.js +103 -3
- package/dist/collection/components/ez-text-input/ez-text-input.css +41 -71
- package/dist/collection/components/ez-text-input/ez-text-input.js +86 -4
- package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
- package/dist/collection/sw.js +46 -0
- package/dist/collection/utils/FocusResolver.js +31 -0
- package/dist/collection/utils/form/DataBinder.js +20 -5
- package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +1 -1
- package/dist/collection/utils/validators/recordvalidator/IInvalidCells.js +1 -0
- package/dist/collection/utils/validators/recordvalidator/RecordValidationProcessor.js +7 -1
- package/dist/custom-elements/index.js +15623 -70811
- package/dist/esm/DataBinder-02fa9bb9.js +441 -0
- package/dist/esm/FocusResolver-1ccbf850.js +33 -0
- package/dist/esm/ez-button.entry.js +11 -5
- package/dist/esm/ez-card-item_3.entry.js +21 -6
- package/dist/esm/ez-chart.entry.js +1 -1
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +65 -12
- package/dist/esm/ez-custom-form-input_2.entry.js +34 -5
- package/dist/esm/ez-date-input.entry.js +12 -3
- package/dist/esm/ez-date-time-input.entry.js +9 -3
- package/dist/esm/ez-dialog.entry.js +9 -1
- package/dist/esm/{ez-dropdown.entry.js → ez-dropdown_2.entry.js} +75 -9
- package/dist/esm/ez-form-view.entry.js +5 -4
- package/dist/esm/ez-form.entry.js +3 -323
- package/dist/esm/ez-grid.entry.js +14685 -70250
- package/dist/esm/ez-list.entry.js +6 -7
- package/dist/esm/ez-modal-container.entry.js +2 -1
- package/dist/esm/ez-modal.entry.js +19 -4
- package/dist/esm/ez-multi-selection-list.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +13 -1
- package/dist/esm/ez-popup.entry.js +21 -2
- package/dist/esm/ez-scroller_2.entry.js +3 -3
- package/dist/esm/ez-search.entry.js +66 -33
- package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
- package/dist/esm/ez-split-button.entry.js +2 -2
- package/dist/esm/ez-split-item.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +67 -5
- package/dist/esm/ez-text-input.entry.js +51 -5
- package/dist/esm/ez-time-input.entry.js +6 -0
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/index-5a720e56.js +2 -6
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-076e868b.entry.js +1 -0
- package/dist/ezui/p-0e1cc2d1.entry.js +1 -0
- package/dist/ezui/p-16e21a40.entry.js +1 -0
- package/dist/ezui/p-2de9f0aa.entry.js +1 -0
- package/dist/ezui/p-3b546374.entry.js +1 -0
- package/dist/ezui/p-3cc9b84a.entry.js +1 -0
- package/dist/ezui/p-3d38bfea.entry.js +1 -0
- package/dist/ezui/p-455e737c.js +1 -0
- package/dist/ezui/p-554522db.entry.js +1 -0
- package/dist/ezui/p-57528846.entry.js +1 -0
- package/dist/ezui/p-6bc25bc8.entry.js +1 -0
- package/dist/ezui/p-70f1c812.entry.js +1 -0
- package/dist/ezui/p-7f5afb1f.entry.js +1 -0
- package/dist/ezui/p-802dc63e.entry.js +1 -0
- package/dist/ezui/p-880f73ea.entry.js +309 -0
- package/dist/ezui/p-8f026744.entry.js +1 -0
- package/dist/ezui/p-940760bf.entry.js +1 -0
- package/dist/ezui/p-a4ee2991.entry.js +1 -0
- package/dist/ezui/{p-82ac8b06.entry.js → p-a563df31.entry.js} +1 -1
- package/dist/ezui/p-a921e3e7.entry.js +1 -0
- package/dist/ezui/p-b858fc6e.entry.js +1 -0
- package/dist/ezui/p-be34c77f.entry.js +1 -0
- package/dist/ezui/{p-9aa27e69.entry.js → p-bef7daac.entry.js} +1 -1
- package/dist/ezui/p-bfc30e61.entry.js +1 -0
- package/dist/ezui/p-bfc59380.entry.js +1 -0
- package/dist/ezui/p-d960a031.entry.js +1 -0
- package/dist/ezui/p-dc628ed3.js +1 -0
- package/dist/ezui/{p-33792b2b.entry.js → p-e18d9e6a.entry.js} +1 -1
- package/dist/ezui/p-e3ec7422.entry.js +1 -0
- package/dist/ezui/{p-31674f8e.entry.js → p-e7395eae.entry.js} +1 -1
- package/dist/types/components/ez-button/ez-button.d.ts +2 -1
- package/dist/types/components/ez-card-item/ez-card-item.d.ts +5 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +12 -1
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +6 -1
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +6 -1
- package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -0
- package/dist/types/components/ez-dropdown/ez-dropdown.d.ts +4 -0
- package/dist/types/components/ez-dropdown/structure/DropdownItem.d.ts +1 -1
- package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +6 -1
- package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +7 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.d.ts +1 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +56 -4
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +32 -4
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +23 -1
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +33 -7
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +4 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +2 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +1 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +27 -1
- package/dist/types/components/ez-modal/ez-modal.d.ts +6 -0
- package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +4 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +8 -0
- package/dist/types/components/ez-popup/ez-popup.d.ts +7 -0
- package/dist/types/components/ez-search/ez-search.d.ts +23 -2
- package/dist/types/components/ez-split-button/ez-split-button.d.ts +1 -1
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +17 -0
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +9 -0
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
- package/dist/types/components.d.ts +211 -10
- package/dist/types/utils/FocusResolver.d.ts +5 -0
- package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +2 -0
- package/dist/types/utils/form/DataBinder.d.ts +3 -0
- package/dist/types/utils/validators/recordvalidator/IInvalidCells.d.ts +5 -0
- package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +1 -1
- package/package.json +12 -4
- package/dist/cjs/RecordValidationProcessor-4c893e04.js +0 -102
- package/dist/cjs/ez-skeleton.cjs.entry.js +0 -67
- package/dist/esm/RecordValidationProcessor-b00b8b77.js +0 -99
- package/dist/esm/ez-skeleton.entry.js +0 -63
- package/dist/ezui/p-034e21ca.entry.js +0 -1
- package/dist/ezui/p-044d46d5.entry.js +0 -1
- package/dist/ezui/p-04f24913.js +0 -1
- package/dist/ezui/p-24ca32a3.entry.js +0 -1
- package/dist/ezui/p-2af4e2de.entry.js +0 -1
- package/dist/ezui/p-36180f4d.entry.js +0 -1
- package/dist/ezui/p-5fefcdc9.entry.js +0 -1
- package/dist/ezui/p-752c4069.entry.js +0 -1
- package/dist/ezui/p-81cffa53.entry.js +0 -1
- package/dist/ezui/p-81f99ace.entry.js +0 -1
- package/dist/ezui/p-8eef0f70.entry.js +0 -1
- package/dist/ezui/p-9634631d.entry.js +0 -1
- package/dist/ezui/p-9a11e223.entry.js +0 -1
- package/dist/ezui/p-9a23d513.entry.js +0 -1
- package/dist/ezui/p-9c2e2d68.entry.js +0 -1
- package/dist/ezui/p-a35b41e6.entry.js +0 -1
- package/dist/ezui/p-b0e71d23.entry.js +0 -1
- package/dist/ezui/p-b150ccd3.entry.js +0 -304
- package/dist/ezui/p-c3b7a23e.entry.js +0 -1
- package/dist/ezui/p-cd1a2e6b.entry.js +0 -1
- package/dist/ezui/p-dbeee5aa.entry.js +0 -1
- package/dist/ezui/p-de870657.entry.js +0 -1
- package/dist/ezui/p-e151e795.entry.js +0 -1
- package/dist/ezui/p-ee9315ff.entry.js +0 -1
- package/dist/ezui/p-f1c3f85d.entry.js +0 -1
- package/dist/ezui/p-f291db18.entry.js +0 -1
|
@@ -6,7 +6,7 @@ export declare class RecordValidationProcessor {
|
|
|
6
6
|
private _validationSource;
|
|
7
7
|
private _validator;
|
|
8
8
|
constructor(dataUnit: DataUnit, validationSource: IValidationSource, validator: IRecordValidator);
|
|
9
|
-
validate(): Promise<void>;
|
|
9
|
+
validate(isSaving?: boolean): Promise<void>;
|
|
10
10
|
private validateRequired;
|
|
11
11
|
private processValidationResult;
|
|
12
12
|
private markAsInvalid;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sankhyalabs/ezui",
|
|
3
|
-
"version": "5.22.0-dev.
|
|
3
|
+
"version": "5.22.0-dev.41",
|
|
4
4
|
"description": "Biblioteca de componentes Sankhya.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/custom-elements/index.js",
|
|
@@ -46,9 +46,17 @@
|
|
|
46
46
|
"author": "",
|
|
47
47
|
"license": "ISC",
|
|
48
48
|
"devDependencies": {
|
|
49
|
+
"@ag-grid-community/core": "^28.1.1",
|
|
50
|
+
"@ag-grid-community/styles": "^28.1.1",
|
|
51
|
+
"@ag-grid-enterprise/clipboard": "^28.1.1",
|
|
52
|
+
"@ag-grid-enterprise/core": "^28.1.1",
|
|
53
|
+
"@ag-grid-enterprise/menu": "^28.1.1",
|
|
54
|
+
"@ag-grid-enterprise/range-selection": "^28.1.1",
|
|
55
|
+
"@ag-grid-enterprise/server-side-row-model": "^28.1.1",
|
|
49
56
|
"@babel/preset-env": "^7.16.11",
|
|
50
57
|
"@commitlint/cli": "^18.4.3",
|
|
51
58
|
"@commitlint/config-conventional": "^18.4.3",
|
|
59
|
+
"@rollup/plugin-strip": "^3.0.4",
|
|
52
60
|
"@sankhyalabs/core": "^5.16.0",
|
|
53
61
|
"@sankhyalabs/docscss": "^1.0.4",
|
|
54
62
|
"@sankhyalabs/ez-design": "^4.0.0",
|
|
@@ -62,8 +70,6 @@
|
|
|
62
70
|
"@types/jest": "^26.0.20",
|
|
63
71
|
"@types/puppeteer": "^5.4.2",
|
|
64
72
|
"@types/uuid": "^9.0.2",
|
|
65
|
-
"ag-grid-community": "^28.1.1",
|
|
66
|
-
"ag-grid-enterprise": "^28.1.1",
|
|
67
73
|
"gulp": "^4.0.2",
|
|
68
74
|
"gulp-run": "^1.7.1",
|
|
69
75
|
"gulp-watch": "^5.0.1",
|
|
@@ -82,6 +88,7 @@
|
|
|
82
88
|
"split-grid": "^1.0.11",
|
|
83
89
|
"storybook-addon-preview": "^2.2.0",
|
|
84
90
|
"uuid": "^9.0.0",
|
|
91
|
+
"workbox-build": "^4.3.1",
|
|
85
92
|
"ws": "^7.5.6"
|
|
86
93
|
},
|
|
87
94
|
"jest": {
|
|
@@ -99,5 +106,6 @@
|
|
|
99
106
|
},
|
|
100
107
|
"resolutions": {
|
|
101
108
|
"postcss": "8.1.7"
|
|
102
|
-
}
|
|
109
|
+
},
|
|
110
|
+
"dependencies": {}
|
|
103
111
|
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const core = require('@sankhyalabs/core');
|
|
4
|
-
const ApplicationUtils = require('./ApplicationUtils-c9d1205c.js');
|
|
5
|
-
|
|
6
|
-
const buildFieldMetadata = (descriptor, config) => {
|
|
7
|
-
let { name, label, group } = Object.assign({}, config);
|
|
8
|
-
let { readOnly, required } = Object.assign({}, config);
|
|
9
|
-
let props;
|
|
10
|
-
let userInterface;
|
|
11
|
-
if (descriptor) {
|
|
12
|
-
label = label || descriptor.label;
|
|
13
|
-
name = name || descriptor.name;
|
|
14
|
-
required = descriptor.required || (config === null || config === void 0 ? void 0 : config.required);
|
|
15
|
-
readOnly = descriptor.readOnly || (config === null || config === void 0 ? void 0 : config.readOnly);
|
|
16
|
-
props = descriptor.properties;
|
|
17
|
-
userInterface = descriptor.userInterface;
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
name, label, group,
|
|
21
|
-
readOnly, required,
|
|
22
|
-
props,
|
|
23
|
-
userInterface: userInterface || core.UserInterface.SHORTTEXT
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
class RecordValidationProcessor {
|
|
28
|
-
constructor(dataUnit, validationSource, validator) {
|
|
29
|
-
this._dataUnit = dataUnit;
|
|
30
|
-
this._validationSource = validationSource;
|
|
31
|
-
this._validator = validator;
|
|
32
|
-
}
|
|
33
|
-
validate() {
|
|
34
|
-
return new Promise((accept, reject) => {
|
|
35
|
-
const records = this._dataUnit.getModifiedRecords();
|
|
36
|
-
for (let i = 0; i < records.length; i++) {
|
|
37
|
-
const record = records[i];
|
|
38
|
-
const invalidResults = [];
|
|
39
|
-
let validationResult = this.validateRequired(record);
|
|
40
|
-
if (validationResult && !validationResult.isValid) {
|
|
41
|
-
invalidResults.push(validationResult);
|
|
42
|
-
}
|
|
43
|
-
if (this._validator) {
|
|
44
|
-
validationResult = this._validator.validateRecord(record);
|
|
45
|
-
if (validationResult && !validationResult.isValid) {
|
|
46
|
-
invalidResults.push(validationResult);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (invalidResults.length > 0) {
|
|
50
|
-
this.processValidationResult(invalidResults, record.__record__id__);
|
|
51
|
-
reject();
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return accept();
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
validateRequired(record) {
|
|
59
|
-
const requiredFields = this._validationSource.getRequiredFields();
|
|
60
|
-
const invalidFields = [];
|
|
61
|
-
new Set(requiredFields).forEach(field => {
|
|
62
|
-
const value = record[field];
|
|
63
|
-
if (value == undefined || value === "") {
|
|
64
|
-
const errorMessage = this._validationSource.getMessageForField(field, record.__record__id__);
|
|
65
|
-
if (errorMessage) {
|
|
66
|
-
invalidFields.push({ name: field, message: errorMessage });
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
invalidFields.push({ name: field, message: "Essa informação é obrigatória" });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
if (invalidFields.length > 0) {
|
|
74
|
-
return { isValid: false, invalidFields, infoMessage: "Há pelo menos um campo obrigatório não preenchido." };
|
|
75
|
-
}
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
processValidationResult(validationResult, recordId) {
|
|
79
|
-
validationResult.forEach(invalidResult => {
|
|
80
|
-
const invalidFields = invalidResult.invalidFields;
|
|
81
|
-
if (invalidFields) {
|
|
82
|
-
invalidFields.forEach(field => {
|
|
83
|
-
this.markAsInvalid(field, recordId);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
if (invalidResult.infoMessage) {
|
|
87
|
-
ApplicationUtils.ApplicationUtils.info(invalidResult.infoMessage);
|
|
88
|
-
}
|
|
89
|
-
if (invalidResult.errorMessage) {
|
|
90
|
-
const { errorTitle, errorMessage } = invalidResult;
|
|
91
|
-
ApplicationUtils.ApplicationUtils.error(errorTitle, errorMessage);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
markAsInvalid(field, recordId) {
|
|
96
|
-
this._dataUnit.setInvalidField(field.name, field.message, recordId);
|
|
97
|
-
this._validationSource.markAsInvalid(field, recordId);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
exports.RecordValidationProcessor = RecordValidationProcessor;
|
|
102
|
-
exports.buildFieldMetadata = buildFieldMetadata;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-9e5554cb.js');
|
|
6
|
-
|
|
7
|
-
const ALLOWED_ANIMATIONS = ['progress', 'progress-dark', 'pulse', 'false'];
|
|
8
|
-
|
|
9
|
-
const ezSkeletonCss = ".skeleton {\n\tbox-sizing: border-box;\n\toutline: none;\n\toverflow: hidden;\n\tposition: relative;\n\n\tbackground:var(--skeleton-background, #eff1f6) no-repeat;\n\n\tborder-radius: var(--skeleton-border-radius, 4px);\n\twidth: var(--skeleton-width, 100%);\n\theight: var(--skeleton-height, 20px);\n\tdisplay: inline-block;\n\tmargin-bottom: var(--skeleton-margin-bottom, 0px);\n\twill-change: transform;\n\n\t&:after,\n\t&:before {\n\t\tbox-sizing: border-box;\n\t}\n\n\t&.circle {\n\t\twidth: var(--skeleton-width, 40px);\n\t\theight: var(--skeleton-height, 40px);\n\t\tmargin-bottom: var(--skeleton-margin-bottom, 5px);\n\t\tborder-radius: var(--skeleton-border-radius, 50%);\n\t}\n\n\t&.rect {\n\t\tborder-radius: var(--skeleton-border-radius, 0px);\n\t}\n\n\t&.progress,\n\t&.progress-dark {\n\t\tanimation: progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\tbackground-size: 200px 100%;\n\t}\n\n\t&.progress {\n\t\tbackground-image: linear-gradient(\n\t\t\t90deg,\n\t\t\trgba(255, 255, 255, 0),\n\t\t\trgba(255, 255, 255, 0.6),\n\t\t\trgba(255, 255, 255, 0)\n\t\t);\n\t}\n\n\t&.progress-dark {\n\t\tbackground-image: linear-gradient(\n\t\t\t90deg,\n\t\t\ttransparent,\n\t\t\trgba(0, 0, 0, 0.2),\n\t\t\ttransparent\n\t\t);\n\t}\n\n\t&.pulse {\n\t\tanimation: pulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\tanimation-delay: 0.5s;\n\t}\n\n\t@media (prefers-reduced-motion: reduce) {\n\t\t&.pulse,\n\t\t&.progress-dark,\n\t\t&.progress {\n\t\t\tanimation: none;\n\t\t}\n\n\t\t&.progress,\n\t\t&.progress-dark {\n\t\t\tbackground-image: none;\n\t\t}\n\t}\n}\n\n@keyframes progress {\n\t0% {\n\t\tbackground-position: -200px 0;\n\t}\n\t100% {\n\t\tbackground-position: calc(200px + 100%) 0;\n\t}\n}\n\n@keyframes pulse {\n\t0% {\n\t\topacity: 1;\n\t}\n\t50% {\n\t\topacity: 0.4;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}";
|
|
10
|
-
|
|
11
|
-
const EzSkeleton = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
index.registerInstance(this, hostRef);
|
|
14
|
-
this.items = [];
|
|
15
|
-
this.count = 1;
|
|
16
|
-
this.variant = 'text';
|
|
17
|
-
this.width = null;
|
|
18
|
-
this.height = null;
|
|
19
|
-
this.marginBottom = null;
|
|
20
|
-
this.animation = 'progress';
|
|
21
|
-
}
|
|
22
|
-
componentWillLoad() {
|
|
23
|
-
this.init();
|
|
24
|
-
}
|
|
25
|
-
componentWillUpdate() {
|
|
26
|
-
this.init();
|
|
27
|
-
}
|
|
28
|
-
init() {
|
|
29
|
-
this.items.length = this.count;
|
|
30
|
-
this.items.fill(1);
|
|
31
|
-
if (!ALLOWED_ANIMATIONS.includes(this.animation)) {
|
|
32
|
-
this.animation = 'progress';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
get style() {
|
|
36
|
-
let dimenssionsStyles = {
|
|
37
|
-
width: null,
|
|
38
|
-
height: null,
|
|
39
|
-
marginBottom: null
|
|
40
|
-
};
|
|
41
|
-
if (this.width) {
|
|
42
|
-
dimenssionsStyles.width = this.width;
|
|
43
|
-
}
|
|
44
|
-
if (this.height) {
|
|
45
|
-
dimenssionsStyles.height = this.height;
|
|
46
|
-
}
|
|
47
|
-
if (this.marginBottom) {
|
|
48
|
-
dimenssionsStyles.marginBottom = this.marginBottom;
|
|
49
|
-
}
|
|
50
|
-
return dimenssionsStyles;
|
|
51
|
-
}
|
|
52
|
-
render() {
|
|
53
|
-
return this.items.map((_, index$1) => {
|
|
54
|
-
return (index.h("span", { key: index$1, class: {
|
|
55
|
-
circle: this.variant === 'circle',
|
|
56
|
-
rect: this.variant === 'rect',
|
|
57
|
-
progress: this.animation === 'progress',
|
|
58
|
-
'progress-dark': this.animation === 'progress-dark',
|
|
59
|
-
pulse: this.animation === 'pulse',
|
|
60
|
-
skeleton: true
|
|
61
|
-
}, "data-busy": "true", "data-valuemin": "0", "data-valuemax": "100", "data-valuetext": "Loading...", role: "progressbar", tabindex: "0", style: this.style }));
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
EzSkeleton.style = ezSkeletonCss;
|
|
66
|
-
|
|
67
|
-
exports.ez_skeleton = EzSkeleton;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { UserInterface } from '@sankhyalabs/core';
|
|
2
|
-
import { A as ApplicationUtils } from './ApplicationUtils-eaf91331.js';
|
|
3
|
-
|
|
4
|
-
const buildFieldMetadata = (descriptor, config) => {
|
|
5
|
-
let { name, label, group } = Object.assign({}, config);
|
|
6
|
-
let { readOnly, required } = Object.assign({}, config);
|
|
7
|
-
let props;
|
|
8
|
-
let userInterface;
|
|
9
|
-
if (descriptor) {
|
|
10
|
-
label = label || descriptor.label;
|
|
11
|
-
name = name || descriptor.name;
|
|
12
|
-
required = descriptor.required || (config === null || config === void 0 ? void 0 : config.required);
|
|
13
|
-
readOnly = descriptor.readOnly || (config === null || config === void 0 ? void 0 : config.readOnly);
|
|
14
|
-
props = descriptor.properties;
|
|
15
|
-
userInterface = descriptor.userInterface;
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
name, label, group,
|
|
19
|
-
readOnly, required,
|
|
20
|
-
props,
|
|
21
|
-
userInterface: userInterface || UserInterface.SHORTTEXT
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
class RecordValidationProcessor {
|
|
26
|
-
constructor(dataUnit, validationSource, validator) {
|
|
27
|
-
this._dataUnit = dataUnit;
|
|
28
|
-
this._validationSource = validationSource;
|
|
29
|
-
this._validator = validator;
|
|
30
|
-
}
|
|
31
|
-
validate() {
|
|
32
|
-
return new Promise((accept, reject) => {
|
|
33
|
-
const records = this._dataUnit.getModifiedRecords();
|
|
34
|
-
for (let i = 0; i < records.length; i++) {
|
|
35
|
-
const record = records[i];
|
|
36
|
-
const invalidResults = [];
|
|
37
|
-
let validationResult = this.validateRequired(record);
|
|
38
|
-
if (validationResult && !validationResult.isValid) {
|
|
39
|
-
invalidResults.push(validationResult);
|
|
40
|
-
}
|
|
41
|
-
if (this._validator) {
|
|
42
|
-
validationResult = this._validator.validateRecord(record);
|
|
43
|
-
if (validationResult && !validationResult.isValid) {
|
|
44
|
-
invalidResults.push(validationResult);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (invalidResults.length > 0) {
|
|
48
|
-
this.processValidationResult(invalidResults, record.__record__id__);
|
|
49
|
-
reject();
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return accept();
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
validateRequired(record) {
|
|
57
|
-
const requiredFields = this._validationSource.getRequiredFields();
|
|
58
|
-
const invalidFields = [];
|
|
59
|
-
new Set(requiredFields).forEach(field => {
|
|
60
|
-
const value = record[field];
|
|
61
|
-
if (value == undefined || value === "") {
|
|
62
|
-
const errorMessage = this._validationSource.getMessageForField(field, record.__record__id__);
|
|
63
|
-
if (errorMessage) {
|
|
64
|
-
invalidFields.push({ name: field, message: errorMessage });
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
invalidFields.push({ name: field, message: "Essa informação é obrigatória" });
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
if (invalidFields.length > 0) {
|
|
72
|
-
return { isValid: false, invalidFields, infoMessage: "Há pelo menos um campo obrigatório não preenchido." };
|
|
73
|
-
}
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
processValidationResult(validationResult, recordId) {
|
|
77
|
-
validationResult.forEach(invalidResult => {
|
|
78
|
-
const invalidFields = invalidResult.invalidFields;
|
|
79
|
-
if (invalidFields) {
|
|
80
|
-
invalidFields.forEach(field => {
|
|
81
|
-
this.markAsInvalid(field, recordId);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
if (invalidResult.infoMessage) {
|
|
85
|
-
ApplicationUtils.info(invalidResult.infoMessage);
|
|
86
|
-
}
|
|
87
|
-
if (invalidResult.errorMessage) {
|
|
88
|
-
const { errorTitle, errorMessage } = invalidResult;
|
|
89
|
-
ApplicationUtils.error(errorTitle, errorMessage);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
markAsInvalid(field, recordId) {
|
|
94
|
-
this._dataUnit.setInvalidField(field.name, field.message, recordId);
|
|
95
|
-
this._validationSource.markAsInvalid(field, recordId);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export { RecordValidationProcessor as R, buildFieldMetadata as b };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-5a720e56.js';
|
|
2
|
-
|
|
3
|
-
const ALLOWED_ANIMATIONS = ['progress', 'progress-dark', 'pulse', 'false'];
|
|
4
|
-
|
|
5
|
-
const ezSkeletonCss = ".skeleton {\n\tbox-sizing: border-box;\n\toutline: none;\n\toverflow: hidden;\n\tposition: relative;\n\n\tbackground:var(--skeleton-background, #eff1f6) no-repeat;\n\n\tborder-radius: var(--skeleton-border-radius, 4px);\n\twidth: var(--skeleton-width, 100%);\n\theight: var(--skeleton-height, 20px);\n\tdisplay: inline-block;\n\tmargin-bottom: var(--skeleton-margin-bottom, 0px);\n\twill-change: transform;\n\n\t&:after,\n\t&:before {\n\t\tbox-sizing: border-box;\n\t}\n\n\t&.circle {\n\t\twidth: var(--skeleton-width, 40px);\n\t\theight: var(--skeleton-height, 40px);\n\t\tmargin-bottom: var(--skeleton-margin-bottom, 5px);\n\t\tborder-radius: var(--skeleton-border-radius, 50%);\n\t}\n\n\t&.rect {\n\t\tborder-radius: var(--skeleton-border-radius, 0px);\n\t}\n\n\t&.progress,\n\t&.progress-dark {\n\t\tanimation: progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\tbackground-size: 200px 100%;\n\t}\n\n\t&.progress {\n\t\tbackground-image: linear-gradient(\n\t\t\t90deg,\n\t\t\trgba(255, 255, 255, 0),\n\t\t\trgba(255, 255, 255, 0.6),\n\t\t\trgba(255, 255, 255, 0)\n\t\t);\n\t}\n\n\t&.progress-dark {\n\t\tbackground-image: linear-gradient(\n\t\t\t90deg,\n\t\t\ttransparent,\n\t\t\trgba(0, 0, 0, 0.2),\n\t\t\ttransparent\n\t\t);\n\t}\n\n\t&.pulse {\n\t\tanimation: pulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\tanimation-delay: 0.5s;\n\t}\n\n\t@media (prefers-reduced-motion: reduce) {\n\t\t&.pulse,\n\t\t&.progress-dark,\n\t\t&.progress {\n\t\t\tanimation: none;\n\t\t}\n\n\t\t&.progress,\n\t\t&.progress-dark {\n\t\t\tbackground-image: none;\n\t\t}\n\t}\n}\n\n@keyframes progress {\n\t0% {\n\t\tbackground-position: -200px 0;\n\t}\n\t100% {\n\t\tbackground-position: calc(200px + 100%) 0;\n\t}\n}\n\n@keyframes pulse {\n\t0% {\n\t\topacity: 1;\n\t}\n\t50% {\n\t\topacity: 0.4;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}";
|
|
6
|
-
|
|
7
|
-
const EzSkeleton = class {
|
|
8
|
-
constructor(hostRef) {
|
|
9
|
-
registerInstance(this, hostRef);
|
|
10
|
-
this.items = [];
|
|
11
|
-
this.count = 1;
|
|
12
|
-
this.variant = 'text';
|
|
13
|
-
this.width = null;
|
|
14
|
-
this.height = null;
|
|
15
|
-
this.marginBottom = null;
|
|
16
|
-
this.animation = 'progress';
|
|
17
|
-
}
|
|
18
|
-
componentWillLoad() {
|
|
19
|
-
this.init();
|
|
20
|
-
}
|
|
21
|
-
componentWillUpdate() {
|
|
22
|
-
this.init();
|
|
23
|
-
}
|
|
24
|
-
init() {
|
|
25
|
-
this.items.length = this.count;
|
|
26
|
-
this.items.fill(1);
|
|
27
|
-
if (!ALLOWED_ANIMATIONS.includes(this.animation)) {
|
|
28
|
-
this.animation = 'progress';
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
get style() {
|
|
32
|
-
let dimenssionsStyles = {
|
|
33
|
-
width: null,
|
|
34
|
-
height: null,
|
|
35
|
-
marginBottom: null
|
|
36
|
-
};
|
|
37
|
-
if (this.width) {
|
|
38
|
-
dimenssionsStyles.width = this.width;
|
|
39
|
-
}
|
|
40
|
-
if (this.height) {
|
|
41
|
-
dimenssionsStyles.height = this.height;
|
|
42
|
-
}
|
|
43
|
-
if (this.marginBottom) {
|
|
44
|
-
dimenssionsStyles.marginBottom = this.marginBottom;
|
|
45
|
-
}
|
|
46
|
-
return dimenssionsStyles;
|
|
47
|
-
}
|
|
48
|
-
render() {
|
|
49
|
-
return this.items.map((_, index) => {
|
|
50
|
-
return (h("span", { key: index, class: {
|
|
51
|
-
circle: this.variant === 'circle',
|
|
52
|
-
rect: this.variant === 'rect',
|
|
53
|
-
progress: this.animation === 'progress',
|
|
54
|
-
'progress-dark': this.animation === 'progress-dark',
|
|
55
|
-
pulse: this.animation === 'pulse',
|
|
56
|
-
skeleton: true
|
|
57
|
-
}, "data-busy": "true", "data-valuemin": "0", "data-valuemax": "100", "data-valuetext": "Loading...", role: "progressbar", tabindex: "0", style: this.style }));
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
EzSkeleton.style = ezSkeletonCss;
|
|
62
|
-
|
|
63
|
-
export { EzSkeleton as ez_skeleton };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,c as t,h as e,H as s,g as r}from"./p-e4c7eb39.js";import{C as o}from"./p-9e11fc7b.js";import{ObjectUtils as a,StringUtils as l,FloatingManager as h,ElementIDUtils as n}from"@sankhyalabs/core";import{A as c}from"./p-2187f86c.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-4607fb89.js";import{R as d}from"./p-05e1f4e7.js";const u=class{constructor(e){i(this,e),this.ezChange=t(this,"ezChange",7),this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._textEmptyList="Nenhum resultado encontrado",this._textEmptySearch="Nenhum resultado de {0} encontrado",this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._criteria=void 0,this.value=void 0,this.label=void 0,this.enabled=!0,this.errorMessage=void 0,this.optionLoader=void 0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.mode="regular",this.canShowError=!0,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.ignoreLimitCharsToSearch=!1,this.options=void 0,this.suppressSearch=!1}observeErrorMessage(){var i;this._textInput&&(this._textInput.errorMessage=this.errorMessage,!(null===(i=this.errorMessage)||void 0===i?void 0:i.trim())&&this.errorMessage&&this.setInputValue())}validateNewValue(i,t){const e=i=>"object"==typeof i?null==i?void 0:i.value:i;return e(i)!==e(t)}async observeValue(i,t){if(this._textInput&&i!==t&&this.validateNewValue(i,t)){if("string"==typeof i)return void await this.handleValueAsString(i);const t=this.getSelectedOption(i),e=this.getSelectedOption(this._currentValue);this.isDifferentValues(e,t)&&(this._currentValue=t,this.setInputValue(),this.ezChange.emit(null!=t?t:void 0)),this.resetOptions()}}observeOptions(i,t){(null==i?void 0:i.join(""))!==(null==t?void 0:t.join(""))&&this.loadOptions(v.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?i=>{let t=setInterval((()=>{this._showLoading||(clearInterval(t),i(this.value))}),100)}:i=>i(this.value))}async setFocus(){this._textInput&&this._textInput.setFocus()}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}scrollListener(){var i;null!=this._floatingID&&((null===(i=this.listOptionsPosition)||void 0===i?void 0:i.hardPosition)?this.hideOptions():window.requestAnimationFrame((()=>{this.updateListPosition()})))}async handleValueAsString(i){this.getSelectedOption(i)?this.setInputValue():(await this.loadDescriptionValue(i),this.setInputValue(),this.ezChange.emit(this.value),this._currentValue=this.value)}updateListPosition(){let{verticalPosition:i,horizontalPosition:t,fromBottom:e,fromRight:s,bottomLimit:r,hardPosition:o}=this.getListPosition();const a=this._listWrapper.getBoundingClientRect(),l=this._listContainer.getBoundingClientRect(),h=this._textInput.getBoundingClientRect(),n=r||window.innerHeight;!e&&(a.top<0||l.bottom+a.height>n)&&(e=!0),o||(i=i||0,t=t||0,e?i=window.innerHeight-h.top+i:i+=l.top,s?t=window.innerWidth-h.right+t:t+=l.left),null!=i&&(this._listWrapper.style[e?"bottom":"top"]=`${i}px`,this._listWrapper.style[e?"top":"bottom"]=""),null!=t&&(this._listWrapper.style[s?"right":"left"]=`${t}px`,this._listWrapper.style[s?"left":"right"]="")}getListPosition(){return this.listOptionsPosition?this.listOptionsPosition:{verticalPosition:this.errorMessage||!this.canShowError||"slim"===this.mode?6:-13}}isDifferentValues(i,t){return a.objectToString(i||{})!==a.objectToString(t||{})}getFormattedText(i){if(null==i)return;let t=this.showSelectedValue&&null!=i.value?`${i.value} - ${i.label}`:i.label;return t=t.replace(new RegExp(this._startHighlightTag,"g"),"").replace(new RegExp(this._endHighlightTag,"g"),""),t}getText(){const i=this.getSelectedOption(this._currentValue),t=this.getFormattedText(i);if(null!=t)return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')}getSelectedOption(i){return"string"==typeof i||i instanceof String?this._visibleOptions.find((t=>t.value===i)):i?Object.assign(Object.assign({},i),{value:this.replaceHighlight(null==i?void 0:i.value),label:this.replaceHighlight(null==i?void 0:i.label)}):i}updateVisibleOptions(){let i=this._source||[];this._visibleOptions=this.suppressEmptyOption?i:[{value:void 0,label:""}].concat(i),this._maxWidthValue=this.getMaxWidthValue()}getMaxWidthValue(){var i;const t=[];return null===(i=this._visibleOptions)||void 0===i||i.forEach((i=>{const e=this.getWidthValue(i.value);t.includes(e)||t.push(e)})),t.length>1?Math.max(...t):0}getWidthValue(i){if(null!=this._itemValueBasis){const t=this._itemValueBasis;if(null!=i)return t.innerHTML=i,t.clientWidth>0?t.clientWidth+2:0;t.innerHTML=""}return 0}createOption(i){let{key:t,title:e}=i;const s=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g");e=l.decodeHtmlEntities(e);const o={value:null==t?void 0:t.replace(s,"").replace(r,""),label:null==e?void 0:e.replace(s,"").replace(r,"")};this.selectOption(o)}buildItem(i,t){i.label=i.label||i.value;const s={key:i.value,title:i.label,details:i.details};return e("div",{style:{height:"100%"},class:t===this._preSelection?"item preselected":"item",id:`item_${i.value}`,onMouseDown:()=>this.createOption(s),onMouseOver:()=>this._preSelection=t},e("ez-card-item",{item:s}))}showOptions(){this.enabled&&(this.isOptionsVisible()||(this._resizeObserver&&this._resizeObserver.observe(this._textInput),this._floatingID=h.float(this._listWrapper,this._listContainer,{autoClose:!1,isFixed:!0,backClickListener:()=>this.hideOptions()}),this.setFocus(),window.requestAnimationFrame((()=>{this.updateListPosition(),this.listOptionsPosition||this._listWrapper.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))))}hideOptions(){void 0!==this._floatingID&&h.close(this._floatingID),this._floatingID=void 0,this._resizeObserver&&this._resizeObserver.unobserve(this._textInput)}isOptionsVisible(){return void 0!==this._floatingID&&h.isFloating(this._floatingID)}nextOption(){this.isOptionsVisible()&&(this.showOptions(),this._preSelection=void 0===this._preSelection?0:Math.min(this._preSelection+1,this._visibleOptions.length-1),this.scrollToOption(this._visibleOptions[this._preSelection]))}previousOption(){this._preSelection=void 0===this._preSelection?0:Math.max(this._preSelection-1,0),this.scrollToOption(this._visibleOptions[this._preSelection])}scrollToOption(i){window.requestAnimationFrame((()=>{const t=(null==i?void 0:i.value)?this._optionsList.querySelector(`div#item_${i.value.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g,"\\$1")}`):void 0;t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}))}selectCurrentOption(){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection]),this._preSelection=void 0):this.controlListWithOnlyOne()}updateSource(i){this._startLoading=!1,i instanceof Promise?(this._showLoading=!0,i.then((i=>{this._showLoading=!1,this.updateSource(i)})).catch((()=>this._showLoading=!1)),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(i)?(this._source=i,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1,this.controlEmptySearch())):this.selectOption(i))}clearSource(){this._source=[],this.updateVisibleOptions()}replaceHighlight(i){const t=new RegExp(this._startHighlightTag,"g"),e=new RegExp(this._endHighlightTag,"g");return(null!=i?i:"").replace(t,"").replace(e,"")}selectOption(i){var t,e;const s=this.getSelectedOption(this.value),r=Object.assign(Object.assign({},i),{value:this.replaceHighlight(null==i?void 0:i.value),label:this.replaceHighlight(null==i?void 0:i.label)});if((null===(t=null==s?void 0:s.value)||void 0===t?void 0:t.toString())!==(null===(e=null==r?void 0:r.value)||void 0===e?void 0:e.toString())||null==s&&null!=r&&"value"in r){const i=(null==r?void 0:r.value)?r:void 0;this.value=i,this._currentValue=i}else this.setInputValue(),this.resetOptions();this._visibleOptions=[],this.clearSource()}loadOptions(i,t=""){this._criteria=t,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:i,argument:t}):this.options)}cancelPreselection(){!this._textInput.value&&this._currentValue?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue()}),this._deboucingTime),this.resetOptions()}setInputValue(i=!0){const t=this.getText();(this._textInput.value||"")!==t&&(this._textInput.value=t,i&&(this.errorMessage=null))}clearSearch(){this.value=null,this._currentValue=null}controlListWithOnlyOne(){var i,t;const e=null===(i=this._visibleOptions)||void 0===i?void 0:i.filter((i=>""!==i.label&&null!=i.value));if((null==e?void 0:e.length)>0){const i=new RegExp(this._startHighlightTag,"g"),s=new RegExp(this._endHighlightTag,"g");let r=l.decodeHtmlEntities(e[0].label);const o={value:null===(t=e[0].value)||void 0===t?void 0:t.replace(i,"").replace(s,""),label:null==r?void 0:r.replace(i,"").replace(s,"")};this.selectOption(o)}}controlEmptySearch(){var i;(null===(i=this._visibleOptions)||void 0===i?void 0:i.length)?this.controlListWithOnlyOne():(this.clearSearch(),c.info(this._textEmptyList))}validateDescriptionValue(){if(l.isEmpty(this.value))return;if(!this.validateNewValue(this.value,this._currentValue))return;let i=this.value;"object"!=typeof i&&this.loadDescriptionValue(i)}async loadDescriptionValue(i){var t,e;if(null==i)return;if((null===(t=this.options)||void 0===t?void 0:t.length)>0)return void this.loadOptionValue(i);const s={mode:v.PREDICTIVE,argument:i},r=await(null===(e=this.optionLoader)||void 0===e?void 0:e.call(this,s));null!=r&&(r instanceof Promise?r.then((i=>{this.setDescriptionValue(i)})):this.setDescriptionValue(r))}setDescriptionValue(i){const t=(null==i?void 0:i[0])||i;null!=t&&Object.keys(t).length?(this._currentValue=t?Object.assign(Object.assign({},t),{value:this.replaceHighlight(t.value),label:this.replaceHighlight(t.label)}):t,this.value=this._currentValue):this.showNoResultMessage()}loadOptionValue(i){var t;const e=null===(t=this.options)||void 0===t?void 0:t.find((t=>t.value===i));null!=e?this.selectOption(e):this.showNoResultMessage()}async showNoResultMessage(){this.clearSearch(),c.info(this._textEmptySearch.replace("{0}",this.getFieldLabel()))}getFieldLabel(){var i;return null===(i=this.label)||void 0===i?void 0:i.replace(d,"").toUpperCase()}resetOptions(){this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}componentWillLoad(){if(void 0===this.options){this.options=[];const i=this.el.querySelectorAll("option");i&&i.forEach((i=>{let t=i.innerText,e=i.getAttribute("value"),s=i.getAttribute("details");e||(e=t),this.options.push({label:t,value:e,details:s}),i.hidden=!0}))}this.updateSource([])}componentDidRender(){var i;void 0===this._floatingID&&this._listWrapper.remove(),null===(i=this._optionsList)||void 0===i||i.querySelectorAll(".item").forEach((i=>{n.addIDInfoIfNotExists(i,"itemSearch")})),this.validateDescriptionValue()}componentDidLoad(){this._currentValue=this.value,o.applyVarsTextInput(this.el,this._textInput),this.setInputValue(!1),this._resizeObserver=new ResizeObserver((i=>{window.requestAnimationFrame((()=>{if(!Array.isArray(i)||!i.length)return;const{clientWidth:t}=this._listContainer;t>0&&this._listWrapper&&(this._listWrapper.style.width=`${t}px`)}))}))}handlerIconClick(){this.loadOptions(v.ADVANCED)}buildNumberArgument(i){return this.isTextSearch?NaN:Number(i||void 0)}onTextInputChangeHandler(i){var t;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(i)}),this._deboucingTime));const e=null===(t=i.target.value)||void 0===t?void 0:t.trim(),s=this.buildNumberArgument(e);this._criteria||(this._textInput.value=i.data||e),this._criteria=e,e?(this._showLoading=!1,this.clearSource(),!isNaN(s)||e.length>=this._limitCharsToSearch?(this._showLoading=!0,this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions(v.PREDICTIVE,isNaN(s)?e:s.toString())}),this._deboucingTime),this.showOptions()):this.hideOptions()):(this.hideOptions(),this._showLoading=!1,this.clearSource())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}keyDownHandler(i){switch(this._tabPressed=!1,i.ctrlKey&&("f"!==i.key&&"F"!==i.key||(this.loadOptions(v.ADVANCED),i.stopPropagation(),i.stopImmediatePropagation(),i.preventDefault())),i.key){case"ArrowDown":this.nextOption(),i.stopPropagation();break;case"ArrowUp":this.previousOption(),i.stopPropagation();break;case"Enter":this.selectCurrentOption();break;case"Escape":this.cancelPreselection();break;case"Tab":this._tabPressed=!0,this.controlListWithOnlyOne()}}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}render(){var i;return n.addIDInfoIfNotExists(this.el,"input"),e(s,null,e("ez-text-input",{"data-element-id":n.getInternalIDInfo("textInput"),class:this.suppressSearch?"suppressed-search-input":"",ref:i=>this._textInput=i,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:i=>this.onTextInputChangeHandler(i),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:i=>this.keyDownHandler(i),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode},e("button",{class:"btn",slot:"leftIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},e("ez-icon",{iconName:"search"})),(null===(i=this._textInput)||void 0===i?void 0:i.value)&&(this._criteria||this.value)?e("button",{class:"btn btn__close",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.clearSearch()},e("ez-icon",{iconName:"close"})):void 0),e("section",{class:"list-container",ref:i=>this._listContainer=i},e("div",{class:"list-wrapper",ref:i=>this._listWrapper=i},e("ul",{class:"list-options",ref:i=>this._optionsList=i},!this._showLoading&&0===this._visibleOptions.length&&e("div",{class:"message"},e("span",{class:"message__no-result"},this._textEmptyList)),this._showLoading&&e("div",{class:"message"},e("div",{class:"message__loading"})),e("span",{class:"item__value item__value--hidden",ref:i=>this._itemValueBasis=i}),this.canShowListOptions()&&this._visibleOptions.map(((i,t)=>this.buildItem(i,t)))))))}get el(){return r(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};var v;!function(i){i.ADVANCED="ADVANCED",i.PRELOAD="PRELOAD",i.PREDICTIVE="PREDICTIVE"}(v||(v={})),u.style=":host{--ez-search--height:42px;--ez-search--width:100%;--ez-search__icon--width:48px;--ez-search--border-radius:var(--border--radius-medium, 12px);--ez-search--border-radius-small:var(--border--radius-small, 6px);--ez-search--font-size:var(--text--medium, 14px);--ez-search--font-family:var(--font-pattern, Arial);--ez-search--font-weight--large:var(--text-weight--large, 500);--ez-search--font-weight--medium:var(--text-weight--medium, 400);--ez-search--background-color--xlight:var(--background--xlight, #fff);--ez-search--background-medium:var(--background--medium, #f0f3f7);--ez-search--line-height:calc(var(--text--medium, 14px) + 4px);--ez-search__input--background-color:var(--background--medium, #e0e0e0);--ez-search__input--border:var(--border--medium, 2px solid);--ez-search__input--border-color:var(--ez-search__input--background-color);--ez-search__input--focus--border-color:var(--color--primary, #008561);--ez-search__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-search__input--disabled--color:var(--text--disable, #AFB6C0);--ez-search__input--error--border-color:#CC2936;--ez-search__btn--color:var(--title--primary, #2B3A54);--ez-search__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-search__btn-hover--color:var(--color--primary, #4e4e4e);--ez-search__label--color:var(--title--primary, #2B3A54);--ez-search__list-title--primary:var(--title--primary, #2B3A54);--ez-search__list-text--primary:var(--text--primary, #626e82);--ez-search__list-height:calc(var(--ez-search--font-size) + var(--ez-search--space--medium) + 4px);--ez-search__list-min-width:64px;--ez-search--space--medium:var(--space--medium, 12px);--ez-search--space--small:var(--space--small, 6px);--ez-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-search__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-search--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{min-width:var(--ez-search__list-min-width);overflow:auto;position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:350px;min-width:150px;background-color:var(--ez-search--background-color--xlight);border-radius:var(--ez-search--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-search--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;gap:3px;scrollbar-color:var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--ez-search__scrollbar--color-background);width:var(--ez-search__scrollbar--width);max-width:var(--ez-search__scrollbar--width);min-width:var(--ez-search__scrollbar--width)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-search__scrollbar--color-background);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-search__scrollbar--color-default);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-search__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-search--border-radius-small);padding:var(--ez-search--space--small);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size);line-height:var(--ez-search--line-height)}.item__label{font-weight:var(--ez-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-search__list-text--primary);font-weight:var(--ez-search--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-search__list-height)}.message__no-result{color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-search__list-title--primary);border-top:3px solid transparent}.item__list>li:hover{background-color:var(--ez-search--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-search__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-search__btn-disabled--color)}.btn:disabled:hover{cursor:unset;color:var(--ez-search__btn-disabled--color)}.btn:hover{color:var(--ez-search__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";export{u as ez_search}
|