@sankhyalabs/ezui 5.22.0-dev.37 → 5.22.0-dev.39
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-aff1dcc7.js +445 -0
- package/dist/cjs/FocusResolver-885f2173.js +35 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-alert.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -1
- package/dist/cjs/ez-badge.cjs.entry.js +1 -1
- package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/ez-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item_3.cjs.entry.js +9 -3
- package/dist/cjs/ez-chart.cjs.entry.js +1 -1
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-chip.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 +47 -11
- package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +2 -2
- package/dist/cjs/ez-date-input.cjs.entry.js +9 -3
- package/dist/cjs/ez-date-time-input.cjs.entry.js +9 -3
- package/dist/cjs/ez-dialog.cjs.entry.js +10 -2
- package/dist/cjs/ez-dropdown_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +4 -325
- package/dist/cjs/ez-grid.cjs.entry.js +255 -63
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +8 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +29 -13
- package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
- package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +7 -1
- package/dist/cjs/ez-text-input.cjs.entry.js +8 -2
- package/dist/cjs/ez-time-input.cjs.entry.js +7 -1
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ez-tree.cjs.entry.js +1 -1
- package/dist/cjs/ez-upload.cjs.entry.js +1 -1
- package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/filter-column.cjs.entry.js +1 -1
- package/dist/cjs/{index-a7b0c73d.js → index-9e5554cb.js} +3 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +75 -14
- package/dist/collection/components/ez-date-input/ez-date-input.js +35 -4
- 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-filter-input/ez-filter-input.js +35 -4
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +52 -14
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +3 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +166 -45
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +7 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +1 -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 +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
- package/dist/collection/components/ez-grid/ez-grid.js +83 -1
- package/dist/collection/components/ez-number-input/ez-number-input.js +25 -0
- package/dist/collection/components/ez-search/ez-search.js +55 -14
- package/dist/collection/components/ez-text-area/ez-text-area.js +24 -0
- package/dist/collection/components/ez-text-input/ez-text-input.css +14 -38
- package/dist/collection/components/ez-text-input/ez-text-input.js +24 -0
- package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
- package/dist/collection/utils/FocusResolver.js +31 -0
- package/dist/collection/utils/form/DataBinder.js +18 -3
- package/dist/custom-elements/index.js +443 -103
- package/dist/esm/DataBinder-bd240826.js +441 -0
- package/dist/esm/FocusResolver-1ccbf850.js +33 -0
- package/dist/esm/ez-actions-button.entry.js +1 -1
- package/dist/esm/ez-alert-list.entry.js +1 -1
- package/dist/esm/ez-alert.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -1
- package/dist/esm/ez-badge.entry.js +1 -1
- package/dist/esm/ez-breadcrumb.entry.js +1 -1
- package/dist/esm/ez-button.entry.js +1 -1
- package/dist/esm/ez-calendar.entry.js +1 -1
- package/dist/esm/ez-card-item_3.entry.js +9 -3
- package/dist/esm/ez-chart.entry.js +1 -1
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-chip.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +48 -12
- package/dist/esm/ez-custom-form-input_2.entry.js +2 -2
- package/dist/esm/ez-date-input.entry.js +9 -3
- package/dist/esm/ez-date-time-input.entry.js +9 -3
- package/dist/esm/ez-dialog.entry.js +10 -2
- package/dist/esm/ez-dropdown_2.entry.js +1 -1
- package/dist/esm/ez-file-item.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +3 -324
- package/dist/esm/ez-grid.entry.js +254 -62
- package/dist/esm/ez-guide-navigator.entry.js +1 -1
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-loading-bar.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-multi-selection-list.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +8 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-radio-button.entry.js +1 -1
- package/dist/esm/ez-scroller_2.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +29 -13
- package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
- package/dist/esm/ez-split-button.entry.js +1 -1
- package/dist/esm/ez-split-item.entry.js +1 -1
- package/dist/esm/ez-split-panel.entry.js +1 -1
- package/dist/esm/ez-tabselector.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +7 -1
- package/dist/esm/ez-text-input.entry.js +8 -2
- package/dist/esm/ez-time-input.entry.js +7 -1
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ez-tree.entry.js +1 -1
- package/dist/esm/ez-upload.entry.js +1 -1
- package/dist/esm/ez-view-stack.entry.js +1 -1
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/filter-column.entry.js +1 -1
- package/dist/esm/{index-baa5e267.js → index-5a720e56.js} +3 -1
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-44caad9a.entry.js → p-0378416a.entry.js} +1 -1
- package/dist/ezui/{p-5b205c80.entry.js → p-044d46d5.entry.js} +1 -1
- package/dist/ezui/p-076e868b.entry.js +1 -0
- package/dist/ezui/{p-b54e17d2.entry.js → p-0e1cc2d1.entry.js} +1 -1
- package/dist/ezui/{p-1285c902.entry.js → p-11b09aa1.entry.js} +1 -1
- package/dist/ezui/{p-77a4bd35.entry.js → p-11bfeca3.entry.js} +1 -1
- package/dist/ezui/p-16e21a40.entry.js +1 -0
- package/dist/ezui/{p-8888d9ed.entry.js → p-1b08bf3c.entry.js} +1 -1
- package/dist/ezui/p-2c3ac210.entry.js +1 -0
- package/dist/ezui/{p-abce5219.entry.js → p-2de9f0aa.entry.js} +1 -1
- package/dist/ezui/{p-baf80b13.entry.js → p-30951bd7.entry.js} +1 -1
- package/dist/ezui/{p-a2e5b8c3.entry.js → p-3b546374.entry.js} +1 -1
- package/dist/ezui/{p-37219d42.entry.js → p-3cc9b84a.entry.js} +1 -1
- package/dist/ezui/p-3d38bfea.entry.js +1 -0
- package/dist/ezui/{p-7bc07c31.entry.js → p-3f8c33e0.entry.js} +1 -1
- package/dist/ezui/{p-cdc472cc.entry.js → p-52100a6e.entry.js} +1 -1
- package/dist/ezui/{p-6d79930d.entry.js → p-554522db.entry.js} +1 -1
- package/dist/ezui/{p-1f50fa05.entry.js → p-6b51c9cc.entry.js} +1 -1
- package/dist/ezui/p-6bc25bc8.entry.js +1 -0
- package/dist/ezui/p-6ec40dec.entry.js +1 -0
- package/dist/ezui/{p-5ed81457.entry.js → p-6fc26622.entry.js} +1 -1
- package/dist/ezui/{p-f9e551de.entry.js → p-70f1c812.entry.js} +1 -1
- package/dist/ezui/{p-555c9018.entry.js → p-7567ccdd.entry.js} +1 -1
- package/dist/ezui/{p-bfad39eb.entry.js → p-7f5afb1f.entry.js} +1 -1
- package/dist/ezui/p-802dc63e.entry.js +1 -0
- package/dist/ezui/{p-1e7a8633.entry.js → p-81461d2f.entry.js} +1 -1
- package/dist/ezui/p-81f06699.js +1 -0
- package/dist/ezui/{p-8df1ca33.entry.js → p-82fa4b09.entry.js} +1 -1
- package/dist/ezui/{p-bcb53f27.entry.js → p-868b56f7.entry.js} +1 -1
- package/dist/ezui/{p-09de35a2.entry.js → p-91ccae0c.entry.js} +1 -1
- package/dist/ezui/{p-c0d9c4f8.entry.js → p-92748142.entry.js} +1 -1
- package/dist/ezui/p-940760bf.entry.js +1 -0
- package/dist/ezui/{p-c4320a39.entry.js → p-a563df31.entry.js} +1 -1
- package/dist/ezui/{p-990b4318.entry.js → p-a921e3e7.entry.js} +1 -1
- package/dist/ezui/{p-17be134a.entry.js → p-b2f6bc0a.entry.js} +1 -1
- package/dist/ezui/{p-c3045972.entry.js → p-b858fc6e.entry.js} +1 -1
- package/dist/ezui/p-be34c77f.entry.js +1 -0
- package/dist/ezui/{p-e347df9c.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-9f5fa3f9.entry.js → p-c2b20f78.entry.js} +1 -1
- package/dist/ezui/p-dc628ed3.js +1 -0
- package/dist/ezui/{p-a80b1287.entry.js → p-dfca5946.entry.js} +1 -1
- package/dist/ezui/{p-7fdd479f.entry.js → p-e18d9e6a.entry.js} +1 -1
- package/dist/ezui/{p-9d9ecb7c.entry.js → p-e3ec7422.entry.js} +1 -1
- package/dist/ezui/{p-23a36bb6.js → p-e4c7eb39.js} +2 -2
- package/dist/ezui/{p-0306dff7.entry.js → p-e6b38ade.entry.js} +1 -1
- package/dist/ezui/{p-90bcd2ba.entry.js → p-e7395eae.entry.js} +1 -1
- package/dist/ezui/{p-650e4b6d.entry.js → p-f1c2c19e.entry.js} +1 -1
- package/dist/ezui/{p-6e429cff.entry.js → p-fc194825.entry.js} +1 -1
- package/dist/ezui/{p-c3c3d640.entry.js → p-fc8b1807.entry.js} +2 -2
- package/dist/ezui/p-fe10f986.entry.js +1 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -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-filter-input/ez-filter-input.d.ts +6 -1
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +10 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +18 -6
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +2 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +10 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
- package/dist/types/components/ez-search/ez-search.d.ts +6 -1
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -0
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
- package/dist/types/components.d.ts +91 -6
- package/dist/types/utils/FocusResolver.d.ts +5 -0
- package/dist/types/utils/form/DataBinder.d.ts +3 -0
- package/package.json +1 -1
- package/dist/cjs/RecordValidationProcessor-10846595.js +0 -108
- package/dist/esm/RecordValidationProcessor-9c6cc267.js +0 -105
- package/dist/ezui/p-0f3b2e67.entry.js +0 -1
- package/dist/ezui/p-10820c20.entry.js +0 -1
- package/dist/ezui/p-49456b34.entry.js +0 -1
- package/dist/ezui/p-5a90d7d1.entry.js +0 -1
- package/dist/ezui/p-62732269.entry.js +0 -1
- package/dist/ezui/p-b3b94f72.entry.js +0 -1
- package/dist/ezui/p-b95632e8.entry.js +0 -1
- package/dist/ezui/p-bc2f844e.entry.js +0 -1
- package/dist/ezui/p-c25f0e92.entry.js +0 -1
- package/dist/ezui/p-d2c06f38.entry.js +0 -1
- package/dist/ezui/p-e85c48d7.entry.js +0 -1
- package/dist/ezui/p-f299c608.entry.js +0 -1
- package/dist/ezui/p-f42855b9.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-
|
|
2
|
-
import { ObjectUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-5a720e56.js';
|
|
2
|
+
import { ObjectUtils, FloatingManager, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import './ApplicationUtils-eaf91331.js';
|
|
4
4
|
import { C as CSSVarsUtils } from './CSSVarsUtils-71ce76be.js';
|
|
5
5
|
import './DialogType-54a62731.js';
|
|
@@ -34,12 +34,13 @@ const EzComboBox = class {
|
|
|
34
34
|
this.suppressSearch = false;
|
|
35
35
|
this.optionLoader = undefined;
|
|
36
36
|
this.suppressEmptyOption = false;
|
|
37
|
-
this.stopPropagateEnterKeyEvent =
|
|
37
|
+
this.stopPropagateEnterKeyEvent = true;
|
|
38
38
|
this.canShowError = true;
|
|
39
39
|
this.mode = "regular";
|
|
40
40
|
this.hideErrorOnFocusOut = true;
|
|
41
41
|
this.listOptionsPosition = undefined;
|
|
42
42
|
this.isTextSearch = false;
|
|
43
|
+
this.autoFocus = false;
|
|
43
44
|
}
|
|
44
45
|
observeErrorMessage() {
|
|
45
46
|
var _a;
|
|
@@ -102,9 +103,9 @@ const EzComboBox = class {
|
|
|
102
103
|
/**
|
|
103
104
|
* Aplica o foco no campo.
|
|
104
105
|
*/
|
|
105
|
-
async setFocus() {
|
|
106
|
+
async setFocus(options) {
|
|
106
107
|
if (this._textInput) {
|
|
107
|
-
this._textInput.setFocus();
|
|
108
|
+
this._textInput.setFocus(options);
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
/**
|
|
@@ -264,11 +265,15 @@ const EzComboBox = class {
|
|
|
264
265
|
: undefined, h("span", { class: "item__label " + (this.showOptionValue ? "item__label--bold" : ""), title: opt.label }, opt.label));
|
|
265
266
|
}
|
|
266
267
|
showOptions() {
|
|
268
|
+
var _a, _b;
|
|
267
269
|
if (!this.enabled)
|
|
268
270
|
return;
|
|
269
271
|
if (this.isOptionsVisible()) {
|
|
270
272
|
return;
|
|
271
273
|
}
|
|
274
|
+
const valueString = (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : this.value;
|
|
275
|
+
const indexValue = this._visibleOptions.findIndex(option => option.value === valueString);
|
|
276
|
+
this._preSelection = indexValue === -1 ? 0 : indexValue;
|
|
272
277
|
if (!!this._resizeObserver)
|
|
273
278
|
this._resizeObserver.observe(this._textInput);
|
|
274
279
|
this._floatingID = FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, isFixed: true, backClickListener: () => this.hideOptions() });
|
|
@@ -310,11 +315,26 @@ const EzComboBox = class {
|
|
|
310
315
|
liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
311
316
|
});
|
|
312
317
|
}
|
|
313
|
-
selectCurrentOption() {
|
|
318
|
+
selectCurrentOption(focusOnInput = true) {
|
|
314
319
|
if (this._preSelection !== undefined) {
|
|
315
|
-
this.selectOption(this._visibleOptions[this._preSelection]);
|
|
320
|
+
this.selectOption(this._visibleOptions[this._preSelection], focusOnInput);
|
|
316
321
|
this._preSelection = undefined;
|
|
317
322
|
}
|
|
323
|
+
else {
|
|
324
|
+
this.controlListWithOnlyOne(focusOnInput);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
controlListWithOnlyOne(focusOnInput = true) {
|
|
328
|
+
var _a;
|
|
329
|
+
const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
|
|
330
|
+
if ((source === null || source === void 0 ? void 0 : source.length) > 0) {
|
|
331
|
+
let title = StringUtils.decodeHtmlEntities(source[0].label);
|
|
332
|
+
const option = {
|
|
333
|
+
value: source[0].value,
|
|
334
|
+
label: title,
|
|
335
|
+
};
|
|
336
|
+
this.selectOption(option, focusOnInput);
|
|
337
|
+
}
|
|
318
338
|
}
|
|
319
339
|
updateSource(source) {
|
|
320
340
|
this._startLoading = false;
|
|
@@ -340,7 +360,7 @@ const EzComboBox = class {
|
|
|
340
360
|
}
|
|
341
361
|
}
|
|
342
362
|
}
|
|
343
|
-
selectOption(newOption) {
|
|
363
|
+
selectOption(newOption, focusOnInput = true) {
|
|
344
364
|
var _a, _b;
|
|
345
365
|
const currentValue = this.getSelectedOption(this.value);
|
|
346
366
|
if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOption === null || newOption === void 0 ? void 0 : newOption.value) === null || _b === void 0 ? void 0 : _b.toString()))
|
|
@@ -351,6 +371,11 @@ const EzComboBox = class {
|
|
|
351
371
|
else {
|
|
352
372
|
this.resetOptions();
|
|
353
373
|
}
|
|
374
|
+
if (focusOnInput) {
|
|
375
|
+
setTimeout(() => {
|
|
376
|
+
this.setFocus();
|
|
377
|
+
}, 0);
|
|
378
|
+
}
|
|
354
379
|
}
|
|
355
380
|
loadOptions(mode, argument = "") {
|
|
356
381
|
this._criteria = argument;
|
|
@@ -434,6 +459,11 @@ const EzComboBox = class {
|
|
|
434
459
|
}
|
|
435
460
|
});
|
|
436
461
|
});
|
|
462
|
+
if (this.autoFocus) {
|
|
463
|
+
requestAnimationFrame(() => {
|
|
464
|
+
this.setFocus({ selectText: true });
|
|
465
|
+
});
|
|
466
|
+
}
|
|
437
467
|
}
|
|
438
468
|
//---------------------------------------------
|
|
439
469
|
// Event handlers
|
|
@@ -488,18 +518,24 @@ const EzComboBox = class {
|
|
|
488
518
|
}
|
|
489
519
|
switch (event.key) {
|
|
490
520
|
case "ArrowDown":
|
|
521
|
+
event.stopPropagation();
|
|
522
|
+
if (this.canShowListOptions())
|
|
523
|
+
event.preventDefault();
|
|
491
524
|
this.showOptions();
|
|
492
525
|
this.nextOption();
|
|
493
|
-
event.stopPropagation();
|
|
494
526
|
break;
|
|
495
527
|
case "ArrowUp":
|
|
528
|
+
event.stopPropagation();
|
|
529
|
+
if (this.canShowListOptions())
|
|
530
|
+
event.preventDefault();
|
|
496
531
|
this.showOptions();
|
|
497
532
|
this.previousOption();
|
|
498
|
-
event.stopPropagation();
|
|
499
533
|
break;
|
|
500
534
|
case "Enter":
|
|
501
535
|
this.handleEventPropagation(event);
|
|
502
|
-
this.
|
|
536
|
+
if (this.isOptionsVisible()) {
|
|
537
|
+
this.selectCurrentOption();
|
|
538
|
+
}
|
|
503
539
|
break;
|
|
504
540
|
case "Escape":
|
|
505
541
|
if (this.isOptionsVisible()) {
|
|
@@ -511,7 +547,7 @@ const EzComboBox = class {
|
|
|
511
547
|
case "Tab":
|
|
512
548
|
this._tabPressed = true;
|
|
513
549
|
if (this.isOptionsVisible()) {
|
|
514
|
-
this.selectCurrentOption();
|
|
550
|
+
this.selectCurrentOption(false);
|
|
515
551
|
}
|
|
516
552
|
this.resetOptions();
|
|
517
553
|
break;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, a as H, h, H as Host, c as createEvent, g as getElement } from './index-5a720e56.js';
|
|
2
2
|
import { C as CustomEditorSource } from './ICustomRender-875b5a40.js';
|
|
3
3
|
import { ObjectUtils, HTMLBuilder, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
4
4
|
import { A as ApplicationUtils } from './ApplicationUtils-eaf91331.js';
|
|
@@ -91,7 +91,7 @@ const EzCustomFormInput = class {
|
|
|
91
91
|
this.gui = gui;
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
if (!(gui instanceof
|
|
94
|
+
if (!(gui instanceof H) && typeof gui !== 'string') {
|
|
95
95
|
this.handleValue(gui);
|
|
96
96
|
this.gui = gui;
|
|
97
97
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-5a720e56.js';
|
|
2
2
|
import { DateUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { C as CSSVarsUtils } from './CSSVarsUtils-71ce76be.js';
|
|
4
4
|
|
|
@@ -19,6 +19,7 @@ const EzDateInput = class {
|
|
|
19
19
|
this.errorMessage = undefined;
|
|
20
20
|
this.mode = "regular";
|
|
21
21
|
this.canShowError = true;
|
|
22
|
+
this.autoFocus = false;
|
|
22
23
|
}
|
|
23
24
|
observeLabel() {
|
|
24
25
|
if (this._textInput) {
|
|
@@ -55,8 +56,8 @@ const EzDateInput = class {
|
|
|
55
56
|
/**
|
|
56
57
|
* Aplica o foco no campo.
|
|
57
58
|
*/
|
|
58
|
-
async setFocus() {
|
|
59
|
-
this._textInput.setFocus();
|
|
59
|
+
async setFocus(options) {
|
|
60
|
+
this._textInput.setFocus(options);
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Remove o foco do campo.
|
|
@@ -174,6 +175,11 @@ const EzDateInput = class {
|
|
|
174
175
|
componentDidLoad() {
|
|
175
176
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
176
177
|
this.setInputValue();
|
|
178
|
+
if (this.autoFocus) {
|
|
179
|
+
requestAnimationFrame(() => {
|
|
180
|
+
this.setFocus({ selectText: true });
|
|
181
|
+
});
|
|
182
|
+
}
|
|
177
183
|
}
|
|
178
184
|
render() {
|
|
179
185
|
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-5a720e56.js';
|
|
2
2
|
import { DateUtils, TimeFormatter, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { C as CSSVarsUtils } from './CSSVarsUtils-71ce76be.js';
|
|
4
4
|
|
|
@@ -20,6 +20,7 @@ const EzDateTimeInput = class {
|
|
|
20
20
|
this.showSeconds = false;
|
|
21
21
|
this.mode = "regular";
|
|
22
22
|
this.canShowError = true;
|
|
23
|
+
this.autoFocus = false;
|
|
23
24
|
}
|
|
24
25
|
observeLabel() {
|
|
25
26
|
if (this._textInput) {
|
|
@@ -56,8 +57,8 @@ const EzDateTimeInput = class {
|
|
|
56
57
|
/**
|
|
57
58
|
* Aplica o foco no campo.
|
|
58
59
|
*/
|
|
59
|
-
async setFocus() {
|
|
60
|
-
this._textInput.setFocus();
|
|
60
|
+
async setFocus(options) {
|
|
61
|
+
this._textInput.setFocus(options);
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
64
|
* Remove o foco do campo.
|
|
@@ -224,6 +225,11 @@ const EzDateTimeInput = class {
|
|
|
224
225
|
componentDidLoad() {
|
|
225
226
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
226
227
|
this.setInputValue();
|
|
228
|
+
if (this.autoFocus) {
|
|
229
|
+
requestAnimationFrame(() => {
|
|
230
|
+
this.setFocus({ selectText: true });
|
|
231
|
+
});
|
|
232
|
+
}
|
|
227
233
|
}
|
|
228
234
|
render() {
|
|
229
235
|
ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, f as forceUpdate, h, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, f as forceUpdate, h, g as getElement } from './index-5a720e56.js';
|
|
2
2
|
import { D as DialogType } from './DialogType-54a62731.js';
|
|
3
3
|
import { FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
|
|
4
|
+
import { F as FocusResolver } from './FocusResolver-1ccbf850.js';
|
|
4
5
|
|
|
5
6
|
const ezDialogCss = ":host{--dialog__container-padding:var(--space--large, 24px);--dialog__btn__close--background-color:var(--title--primary, #2b3a54);--dialog__btn__no--padding-right:var(--space--large, 24px);--dialog__btn__close__image:url('data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg%22%3E<path d=\"M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z\"/></svg>');--dialog__title--font-pattern:var(--font-pattern, \"Roboto\");--dialog__title--padding-left:var(--space--small, 6px);--dialog__title__container--padding-bottom:var(--space--medium, 12px);--dialog__title--weight--large:var(--text-weight--large, 600);--dialog__body--font-pattern:var(--font-pattern, \"Roboto\");--dialog__body--text-shadow:var(--text-shadow, \"0 0 0 #353535, 0 0 1px transparent\");--dialog__body--text-weight--medium:var(--text-weight--medium, 400);--dialog__body--padding-bottom:var(--space--large, 24px);--dialog__body--font-size:var(--text--medium, 14px);--dialog__body--color:var(--text--primary, #626e82);--dialog__icon--color:var(--text--inverted, #fff);--dialog__critical--background-color:var(--color--alert-error-800, #BD0025);--dialog__warning--background-color:var(--color--alert-warning-500, #EFB103);--dialog__success--background-color:var(--color--alert-success-500, #00523c);--dialog-z-index:var(--elevation--100, 100);--dialog--warning__image:url('data: image/svg+xml;utf8,<svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.5,0 0,13 h 15 z m 0,2.73684 5.1341,8.89476 H 2.36591 Z M 6.81818,5.47368 V 8.21053 H 8.18182 V 5.47368 Z m 0,4.10527 V 10.9474 H 8.18182 V 9.57895\"/></svg>');--dialog--critical__image:url('data: image/svg+xml;utf8,<svg width=\"13\" height=\"13\" viewBox=\"0 0 13 13\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.6534493,6.4948538 12.762051,1.3864299 C 12.914368,1.2341297 13,1.027552 13,0.81215179 13,0.59676225 12.914369,0.39018443 12.762051,0.23787352 12.609733,0.08557341 12.40318,0 12.187747,0 11.972425,0 11.765762,0.08557341 11.613445,0.23787352 L 6.5048431,5.3462975 1.3961977,0.23787352 C 1.2438802,0.08557341 1.0373043,0 0.82189458,0 0.60649572,0 0.39990901,0.08557341 0.24759147,0.23787352 0.09527396,0.39018443 0.00970766,0.59676225 0.00970766,0.81215179 c 0,0.21540021 0.0855663,0.42197791 0.23788381,0.57427811 L 5.3562369,6.4948538 0.24759147,11.604381 c -0.0775121,0.07492 -0.13931586,0.164543 -0.18182835,0.263595 -0.04250169,0.09905 -0.064850182,0.205678 -0.0657357237,0.313391 -8.8554258e-4,0.107813 0.0197049337,0.214771 0.0605827337,0.314472 0.04086693,0.0998 0.10119858,0.190415 0.17746563,0.266625 0.0762779,0.07622 0.16695386,0.136398 0.26675594,0.177208 0.099802,0.04082 0.20672745,0.06127 0.31452961,0.06029 0.1078025,-9.53e-4 0.21433799,-0.0235 0.31337139,-0.06604 0.099045,-0.04265 0.1886052,-0.104571 0.263465,-0.182081 L 6.5048431,7.6434102 11.613445,12.751855 c 0.152317,0.152312 0.35898,0.237831 0.574302,0.237831 0.215433,0 0.421986,-0.08552 0.574304,-0.237831 C 12.914368,12.599545 13,12.393 13,12.177578 13,11.962157 12.91437,11.75561 12.762051,11.603299 Z\"/></svg>')}h2{margin-block-start:0;margin-block-end:0;margin-inline-start:0px;margin-inline-end:0px}.overlay{position:fixed;display:flex;top:0px;z-index:var(--dialog-z-index);left:0px;width:100%;box-sizing:border-box;height:100vh;background-color:rgba(var(--rgb-background--overlay), var(--opacity--soft));backdrop-filter:blur(var(--background-blur--medium))}.dialog{display:flex;width:80%;position:absolute;top:50%;left:50%;margin-right:-50%;box-sizing:border-box;transform:translate(-50%, -50%);box-shadow:0px 0px 16px rgba(0, 38, 111, 0.122)}@media screen and (min-width: 768px){.dialog{width:50%}}@media screen and (min-width: 992px){.dialog{width:33.33333%}}.dialog__container{width:100%;background:#FFFF;border-radius:0px 6px 6px 0px;box-sizing:border-box;padding:var(--dialog__container-padding)}.dialog__container--default{border-radius:6px 6px 6px 6px}.dialog__critical--indicator{box-sizing:border-box;width:12px;border-radius:6px 0px 0px 6px;background-color:var(--dialog__critical--background-color)}.dialog__warning--indicator{width:12px;border-radius:6px 0px 0px 6px;box-sizing:border-box;background-color:var(--dialog__warning--background-color)}.dialog__success--indicator{width:12px;border-radius:6px 0px 0px 6px;box-sizing:border-box;background-color:var(--dialog__success--background-color)}.message{font-size:var(--dialog__body--font-size);font-weight:var(--dialog__body--text-weight--medium);font-family:var(--dialog__body--font-pattern);text-shadow:var(--dialog__body--text-shadow);padding-bottom:var(--dialog__body--padding-bottom);color:var(--dialog__body--color);max-height:30vh;content-visibility:auto;margin-bottom:24px;overflow-y:auto}.changeable__icon{background:var(--dialog__warning--background-color);--ez-icon--color:var(--dialog__icon--color);display:grid;place-items:center;width:26px;height:26px;border-radius:50%}.changeable__icon.critical{background:var(--dialog__critical--background-color)}.title{display:flex;font-family:var(--dialog__title--font-pattern);margin:0;font-weight:var(--dialog__title--weight--large);line-height:0;color:var(--title--primary)}.title__container{display:flex;padding-bottom:var(--dialog__title__container--padding-bottom)}.title__box{display:flex;width:100%;align-items:center;align-self:center}.title__label{padding-left:var(--dialog__title--padding-left)}.title__label--no-icon{padding-left:0}.title-icon--critical{background-color:var(--dialog__critical--background-color)}.title-icon--success{background-color:var(--dialog__success--background-color)}.title-icon--warn{background-color:var(--dialog__warning--background-color)}.btn-close{justify-content:flex-end;align-self:flex-start;align-items:flex-start;display:flex;outline:none;width:10%;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:'';display:flex;background-color:var(--dialog__btn__close--background-color);width:12px;height:12px;-webkit-mask-image:var(--dialog__btn__close__image);mask-image:var(--dialog__btn__close__image)}.title-icon::after{content:'';display:flex;background-color:#FFFF;width:15px;height:15px;-webkit-mask-image:var(--dialog--warning__image);mask-image:var(--dialog--warning__image)}.button-yes-no__container{display:flex;box-sizing:border-box;align-self:center;align-items:center;justify-content:flex-end}.button__cancel{padding-right:var(--dialog__btn__no--padding-right)}.button__confirm{--ez-button--background-color:var(--color--primary);--ez-button--color:var(--color--inverted);--ez-button--hover--background-color:var(--color--primary-600);--ez-button--hover-color:var(--color--inverted)}.button__confirm--danger{--ez-button--background-color:var(--color--alert-error-800, #BD0025);--ez-button--color:var(--color--inverted);--ez-button--hover--background-color:var(--color-alert--error-900, #a10020);--ez-button--hover-color:var(--color--inverted)}.button__confirm--container{display:flex;justify-content:flex-end}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
|
|
6
7
|
|
|
@@ -170,6 +171,7 @@ const EzDialog = class {
|
|
|
170
171
|
const dialog = this._element.shadowRoot.querySelector('.overlay .dialog');
|
|
171
172
|
if (dialog instanceof HTMLDivElement) {
|
|
172
173
|
dialog.style.outline = 'none';
|
|
174
|
+
this._lastActiveElement = document.activeElement;
|
|
173
175
|
dialog.focus();
|
|
174
176
|
}
|
|
175
177
|
}
|
|
@@ -182,7 +184,13 @@ const EzDialog = class {
|
|
|
182
184
|
focusOnPrimaryButton() {
|
|
183
185
|
const btnConfirm = this._element.shadowRoot.querySelector(`#${this.PRIMARY_BUTTON_ID}`);
|
|
184
186
|
const buttonElement = btnConfirm === null || btnConfirm === void 0 ? void 0 : btnConfirm.shadowRoot.querySelector('button');
|
|
185
|
-
|
|
187
|
+
requestAnimationFrame(() => {
|
|
188
|
+
buttonElement === null || buttonElement === void 0 ? void 0 : buttonElement.focus();
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
disconnectedCallback() {
|
|
192
|
+
FocusResolver.resolveFocus(this._lastActiveElement);
|
|
193
|
+
this._lastActiveElement = undefined;
|
|
186
194
|
}
|
|
187
195
|
render() {
|
|
188
196
|
if (this.opened && this._currentMessage) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-
|
|
1
|
+
import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-5a720e56.js';
|
|
2
2
|
import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
|
|
3
3
|
|
|
4
4
|
const DropdownItem = ({ item, hasIcon, hasChildren, isLockedLevels, onSubActionClick }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-5a720e56.js';
|
|
2
2
|
import { StringUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
|
|
4
4
|
const ezFileItemCss = ":host{display:flex;width:100%;--ez-file-item--height:42px;--ez-file-item--padding:9px;--ez-file-item--border-radius:var(--border--radius-medium, 12px);--ez-file-item--border-color:var(--color--strokes, #DCE0E8);--ez-file-item--border-style:var(--border--small, 1px solid);--ez-file-item--font-family:var(--font-pattern, Arial);--ez-file-item--font-size:var(--text--medium, 14px);--ez-file-item--font-weight:var(--text-weight--medium, 400);--ez-file-item--color:var(--title--primary, #2B3A54);--ez-file-item__file-size--font-weight:var(--text-weight--large, 600);--ez-file-item__file-size--color:var(--color--primary, #008561);--ez-file-item__background-progress--color:var(--color--primary-300, E2F4EF);--ez-file-item--icon-color:var(--title--primary, #2B3A54)}.box{display:flex;box-sizing:border-box;position:relative;align-items:center;justify-content:space-between;width:100%;padding:var(--ez-file-item--padding);border:var(--ez-file-item--border-color) var(--ez-file-item--border-style);border-radius:var(--ez-file-item--border-radius);height:var(--ez-file-item--height)}.box::before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;clip-path:inset(2px calc(var(--ez-file-item--upload-progress, 0%) + 2px) 2px 2px round calc(var(--ez-file-item--border-radius) - 4px));background-color:var(--ez-file-item__background-progress--color)}.content{display:flex;align-items:center;z-index:0;overflow:hidden}.file-name{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-family:var(--ez-file-item--font-family);font-size:var(--ez-file-item--font-size);font-weight:var(--ez-file-item--font-weight);color:var(--ez-file-item--color)}.file-type-icon{flex-shrink:0;--ez-icon--color:var(--ez-file-item--icon-color);padding-right:var(--ez-file-item--padding)}.file-size{padding-left:2px;overflow:hidden;flex-shrink:0;white-space:nowrap;font-family:var(--ez-file-item--font-family);font-size:var(--ez-file-item--font-size);font-weight:var(--ez-file-item__file-size--font-weight);color:var(--ez-file-item__file-size--color)}.btn-remove{cursor:pointer;flex-shrink:0;--ez-icon--color:var(--ez-file-item--icon-color)}";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, r as registerInstance, c as createEvent, g as getElement, H as Host } from './index-
|
|
1
|
+
import { h, r as registerInstance, c as createEvent, g as getElement, H as Host } from './index-5a720e56.js';
|
|
2
2
|
import { ObjectUtils, UserInterface, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { R as REQUIRED_INFO } from './constants-4e0d35b7.js';
|
|
4
4
|
import { C as CheckMode } from './CheckMode-bdb2ec19.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, f as forceUpdate, H as Host, g as getElement } from './index-
|
|
2
|
-
import { DateUtils, Action, StringUtils,
|
|
3
|
-
import { b as buildFieldMetadata,
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, f as forceUpdate, H as Host, g as getElement } from './index-5a720e56.js';
|
|
2
|
+
import { DateUtils, Action, StringUtils, DataUnit, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { b as buildFieldMetadata, D as DataBinder } from './DataBinder-bd240826.js';
|
|
4
4
|
import './ApplicationUtils-eaf91331.js';
|
|
5
5
|
import './DialogType-54a62731.js';
|
|
6
6
|
|
|
@@ -179,327 +179,6 @@ const buildDetailSheet = (child) => {
|
|
|
179
179
|
};
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
class DataBinder {
|
|
183
|
-
constructor(dataUnit) {
|
|
184
|
-
this.onDataUnitEvent = (action) => {
|
|
185
|
-
var _a, _b;
|
|
186
|
-
switch (action.type) {
|
|
187
|
-
case Action.DATA_LOADED:
|
|
188
|
-
case Action.DATA_SAVED:
|
|
189
|
-
case Action.RECORDS_REMOVED:
|
|
190
|
-
case Action.RECORDS_ADDED:
|
|
191
|
-
case Action.RECORDS_COPIED:
|
|
192
|
-
case Action.EDITION_CANCELED:
|
|
193
|
-
case Action.SELECTION_CHANGED:
|
|
194
|
-
case Action.NEXT_SELECTED:
|
|
195
|
-
case Action.PREVIOUS_SELECTED:
|
|
196
|
-
this.clearInvalid();
|
|
197
|
-
case Action.DATA_CHANGED:
|
|
198
|
-
case Action.CHANGE_UNDONE:
|
|
199
|
-
case Action.CHANGE_REDONE:
|
|
200
|
-
case Action.RECORD_LOADED:
|
|
201
|
-
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
202
|
-
this.updateValue(field.fieldName, field.field);
|
|
203
|
-
});
|
|
204
|
-
break;
|
|
205
|
-
case Action.FIELD_INVALIDATED:
|
|
206
|
-
(_b = this._fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
|
|
207
|
-
this.updateErrorMessage(field.fieldName, field.field);
|
|
208
|
-
});
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
this._uuid = StringUtils.generateUUID();
|
|
213
|
-
this._fields = new Map();
|
|
214
|
-
this._dataUnit = dataUnit;
|
|
215
|
-
this.applyDefaultValues();
|
|
216
|
-
this._dataUnit.subscribe(this.onDataUnitEvent);
|
|
217
|
-
this._dataUnit.addInterceptor(this);
|
|
218
|
-
this.setContextDataBinder(dataUnit);
|
|
219
|
-
}
|
|
220
|
-
get dataBinderId() {
|
|
221
|
-
return this._uuid;
|
|
222
|
-
}
|
|
223
|
-
setContextDataBinder(dataUnit) {
|
|
224
|
-
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
|
|
225
|
-
const dataBinders = [...(dataBindersByDataUnit.get(dataUnit.dataUnitId) || []), this];
|
|
226
|
-
dataBindersByDataUnit.set(dataUnit.dataUnitId, dataBinders);
|
|
227
|
-
ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
|
|
228
|
-
}
|
|
229
|
-
applyDefaultValues() {
|
|
230
|
-
const recordIds = (this._dataUnit.getAddedRecords() || []).map(r => r.__record__id__);
|
|
231
|
-
if (recordIds.length > 0) {
|
|
232
|
-
const defaultValues = this.getDefaultValues();
|
|
233
|
-
if (defaultValues) {
|
|
234
|
-
Object.keys(defaultValues).forEach(field => {
|
|
235
|
-
this._dataUnit.setFieldValue(field, defaultValues[field], recordIds);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
bind(fields, currentContextName, formMetadata, recordsValidator) {
|
|
241
|
-
fields.forEach(fieldElement => {
|
|
242
|
-
const { fieldName, contextName } = fieldElement.dataset;
|
|
243
|
-
if (contextName == undefined || contextName === currentContextName) {
|
|
244
|
-
this.updateBind(fieldName, fieldElement);
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
this._formMetadata = formMetadata;
|
|
248
|
-
this._recordValidatorProcessor = new RecordValidationProcessor(this._dataUnit, {
|
|
249
|
-
getRequiredFields: () => this._formMetadata.getRequiredFields(),
|
|
250
|
-
markAsInvalid: field => this.markInvalid(field),
|
|
251
|
-
getMessageForField: field => this.getErrorMessage(field),
|
|
252
|
-
}, recordsValidator);
|
|
253
|
-
}
|
|
254
|
-
disconnectDataUnit() {
|
|
255
|
-
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
|
|
256
|
-
const dataBinders = dataBindersByDataUnit.get(this._dataUnit.dataUnitId);
|
|
257
|
-
const dataBindersFiltered = dataBinders.filter((dataBinder) => dataBinder.dataBinderId !== this.dataBinderId);
|
|
258
|
-
dataBindersByDataUnit.set(this._dataUnit.dataUnitId, dataBindersFiltered);
|
|
259
|
-
ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
|
|
260
|
-
}
|
|
261
|
-
onDisconnectedCallback() {
|
|
262
|
-
this._dataUnit.unsubscribe(this.onDataUnitEvent);
|
|
263
|
-
this._dataUnit.removeInterceptor(this);
|
|
264
|
-
this.disconnectDataUnit();
|
|
265
|
-
}
|
|
266
|
-
getCurrentRecordId() {
|
|
267
|
-
const record = this._dataUnit.getSelectedRecord();
|
|
268
|
-
return record === null || record === void 0 ? void 0 : record.__record__id__;
|
|
269
|
-
}
|
|
270
|
-
markInvalid(field) {
|
|
271
|
-
if (this._fields.has(field.name)) {
|
|
272
|
-
const fieldElement = this._fields.get(field.name).field;
|
|
273
|
-
this.updateErrorMessage(field.name, fieldElement, field.message);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
setFocus(fieldName) {
|
|
277
|
-
if (!this._fields.has(fieldName)) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
const fieldElement = this._fields.get(fieldName).field;
|
|
281
|
-
if (typeof fieldElement["setFocus"] != "function") {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
fieldElement["setFocus"]();
|
|
285
|
-
}
|
|
286
|
-
clearInvalid(recordId) {
|
|
287
|
-
this._dataUnit.clearInvalid(recordId);
|
|
288
|
-
this._fields.forEach(fieldBinder => {
|
|
289
|
-
const fieldElement = fieldBinder.field;
|
|
290
|
-
fieldElement["errorMessage"] = "";
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
updateValue(fieldName, field) {
|
|
294
|
-
const bind = this._fields.get(fieldName);
|
|
295
|
-
try {
|
|
296
|
-
if (bind) {
|
|
297
|
-
bind.listen = false;
|
|
298
|
-
}
|
|
299
|
-
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
300
|
-
this.updateErrorMessage(fieldName, field);
|
|
301
|
-
}
|
|
302
|
-
finally {
|
|
303
|
-
if (bind) {
|
|
304
|
-
bind.listen = true;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
validate() {
|
|
309
|
-
return this._recordValidatorProcessor.validate();
|
|
310
|
-
}
|
|
311
|
-
static async validateByDataunit(dataUnit) {
|
|
312
|
-
try {
|
|
313
|
-
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__");
|
|
314
|
-
const dataBinders = dataBindersByDataUnit.get(dataUnit.dataUnitId) || [];
|
|
315
|
-
await Promise.all(dataBinders.map((dataBinder) => dataBinder.validate()));
|
|
316
|
-
return true;
|
|
317
|
-
}
|
|
318
|
-
catch (_a) {
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
updateErrorMessage(fieldName, field, message) {
|
|
323
|
-
if (message == undefined) {
|
|
324
|
-
message = this._dataUnit.getInvalidMessage(this.getCurrentRecordId(), fieldName);
|
|
325
|
-
}
|
|
326
|
-
if (!field["errorMessage"]) {
|
|
327
|
-
field["errorMessage"] = message;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
getErrorMessage(fieldName) {
|
|
331
|
-
if (this._fields.has(fieldName)) {
|
|
332
|
-
const fieldElement = this._fields.get(fieldName).field;
|
|
333
|
-
return fieldElement["errorMessage"];
|
|
334
|
-
}
|
|
335
|
-
return undefined;
|
|
336
|
-
}
|
|
337
|
-
updateBind(fieldName, field) {
|
|
338
|
-
const oldBind = this._fields.get(fieldName);
|
|
339
|
-
if (oldBind) {
|
|
340
|
-
oldBind.destroy();
|
|
341
|
-
}
|
|
342
|
-
this.bindSearchOptionsLoader(fieldName, field);
|
|
343
|
-
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
344
|
-
this.updateErrorMessage(fieldName, field);
|
|
345
|
-
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
346
|
-
this.applyEzUploadContext(fieldName, field);
|
|
347
|
-
}
|
|
348
|
-
changeStarted(fieldName, waitingChange) {
|
|
349
|
-
/**
|
|
350
|
-
* se o waitingChange não é blocante, add um event listener pra
|
|
351
|
-
* fazer o accept da promise
|
|
352
|
-
*
|
|
353
|
-
* se não tiver promise no waitingChange, eu crio uma e resolvo no bind
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*/
|
|
357
|
-
if (this._dataUnit.records.length === 0) {
|
|
358
|
-
this._dataUnit.addRecord();
|
|
359
|
-
}
|
|
360
|
-
if (!waitingChange.blocking && waitingChange.promise == undefined) {
|
|
361
|
-
const bind = this._fields.get(fieldName);
|
|
362
|
-
if (bind) {
|
|
363
|
-
waitingChange.promise = new Promise((resolve, reject) => {
|
|
364
|
-
bind.waitingChangePromiseResolve = resolve;
|
|
365
|
-
bind.waitingChangePromiseReject = reject;
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
this._dataUnit.startChange(fieldName, waitingChange);
|
|
370
|
-
}
|
|
371
|
-
cancelWaitingChange(fieldName) {
|
|
372
|
-
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
373
|
-
this._dataUnit.cancelWaitingChange(fieldName);
|
|
374
|
-
const bind = this._fields.get(fieldName);
|
|
375
|
-
if (bind) {
|
|
376
|
-
bind.rejectWaitingChange(new WaitingChangeException("Change canceled", fieldName));
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
setFieldValue(fieldName, newValue) {
|
|
381
|
-
if (this._dataUnit.records.length === 0) {
|
|
382
|
-
this._dataUnit.addRecord();
|
|
383
|
-
}
|
|
384
|
-
this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
|
|
385
|
-
const record = this._dataUnit.getSelectedRecord();
|
|
386
|
-
this._dataUnit.setFieldValue(fieldName, newValue, record ? [record.__record__id__] : undefined);
|
|
387
|
-
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
388
|
-
const bind = this._fields.get(fieldName);
|
|
389
|
-
if (bind) {
|
|
390
|
-
bind.acceptWaitingChange();
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
bindSearchOptionsLoader(fieldName, field) {
|
|
395
|
-
if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
|
|
396
|
-
const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
|
|
397
|
-
if (loader) {
|
|
398
|
-
field["optionLoader"] = (arg) => {
|
|
399
|
-
return loader(arg, fieldName, this._dataUnit);
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
applyEzUploadContext(fieldName, field) {
|
|
405
|
-
var _a, _b;
|
|
406
|
-
if (field.nodeName === "EZ-UPLOAD") {
|
|
407
|
-
field["urlUpload"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__ADD__URL__");
|
|
408
|
-
field["urlDelete"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__DEL__URL__");
|
|
409
|
-
const descriptor = this._dataUnit.getField(fieldName);
|
|
410
|
-
const destination = (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.DESTINATION;
|
|
411
|
-
if (destination) {
|
|
412
|
-
field["requestHeaders"] = { XTRAINF: `{"destination": "${destination}"}` };
|
|
413
|
-
}
|
|
414
|
-
field["maxFiles"] = ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.MAX_FILES) || 0;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
interceptAction(action) {
|
|
418
|
-
if (action.type === Action.RECORDS_COPIED) {
|
|
419
|
-
const cleanFields = this._formMetadata.getCleanOnCopyFields();
|
|
420
|
-
if (cleanFields) {
|
|
421
|
-
const records = action.payload;
|
|
422
|
-
return new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
|
|
423
|
-
const newRecord = Object.assign({}, record);
|
|
424
|
-
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
425
|
-
return newRecord;
|
|
426
|
-
}));
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
if (action.type === Action.SAVING_DATA) {
|
|
430
|
-
return new Promise((resolve) => {
|
|
431
|
-
this.validate()
|
|
432
|
-
.then(() => resolve(action))
|
|
433
|
-
.catch(() => { });
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
if (action.type === Action.RECORDS_ADDED) {
|
|
437
|
-
const defaultValues = this.getDefaultValues();
|
|
438
|
-
if (defaultValues) {
|
|
439
|
-
const records = action.payload;
|
|
440
|
-
return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
|
|
441
|
-
return Object.assign(Object.assign({}, record), defaultValues);
|
|
442
|
-
}));
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
return action;
|
|
446
|
-
}
|
|
447
|
-
getDefaultValues() {
|
|
448
|
-
var _a;
|
|
449
|
-
const rawDefaultValues = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getDefaultValues();
|
|
450
|
-
if (rawDefaultValues) {
|
|
451
|
-
const defaultValues = {};
|
|
452
|
-
for (const field in rawDefaultValues) {
|
|
453
|
-
defaultValues[field] = this._dataUnit.valueFromString(field, rawDefaultValues[field]);
|
|
454
|
-
}
|
|
455
|
-
return defaultValues;
|
|
456
|
-
}
|
|
457
|
-
return undefined;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
class Bind {
|
|
461
|
-
constructor() {
|
|
462
|
-
this.listen = true;
|
|
463
|
-
this.startChangeEventName = "ezStartChange";
|
|
464
|
-
this.cancelWaitingChangeEventName = "ezCancelWaitingChange";
|
|
465
|
-
this.changeEventName = "ezChange";
|
|
466
|
-
}
|
|
467
|
-
destroy() {
|
|
468
|
-
this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
|
|
469
|
-
this.field.removeEventListener(this.cancelWaitingChangeEventName, this.cancelWaitingChangeListener);
|
|
470
|
-
this.field.removeEventListener(this.changeEventName, this.changeListener);
|
|
471
|
-
}
|
|
472
|
-
acceptWaitingChange() {
|
|
473
|
-
if (this.waitingChangePromiseResolve) {
|
|
474
|
-
this.waitingChangePromiseResolve();
|
|
475
|
-
this.waitingChangePromiseReject = undefined;
|
|
476
|
-
this.waitingChangePromiseResolve = undefined;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
rejectWaitingChange(reason) {
|
|
480
|
-
if (this.waitingChangePromiseReject) {
|
|
481
|
-
this.waitingChangePromiseReject(reason);
|
|
482
|
-
this.waitingChangePromiseReject = undefined;
|
|
483
|
-
this.waitingChangePromiseResolve = undefined;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
static create(fieldName, field, startChangeCallback, cancelWaitingChangeCallback, changeCallback) {
|
|
487
|
-
const b = new Bind();
|
|
488
|
-
b.field = field;
|
|
489
|
-
b.fieldName = fieldName;
|
|
490
|
-
b.startChangeListener = (evt) => { if (b.listen)
|
|
491
|
-
startChangeCallback(fieldName, evt.detail); };
|
|
492
|
-
b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
|
|
493
|
-
b.cancelWaitingChangeListener = () => { if (b.listen)
|
|
494
|
-
cancelWaitingChangeCallback(fieldName); };
|
|
495
|
-
b.field.addEventListener(b.cancelWaitingChangeEventName, b.cancelWaitingChangeListener);
|
|
496
|
-
b.changeListener = (evt) => { if (b.listen)
|
|
497
|
-
changeCallback(fieldName, evt.detail); };
|
|
498
|
-
b.field.addEventListener(b.changeEventName, b.changeListener);
|
|
499
|
-
return b;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
182
|
/**
|
|
504
183
|
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
|
|
505
184
|
*
|