@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-75065.1 → 0.0.0-bugfix-dev-KB-83282.1
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/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 +3 -15
- 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_2.cjs.entry.js +1 -1
- 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-list_3.cjs.entry.js +387 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +59 -185
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-double-list.cjs.entry.js +1 -1
- 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-filter-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +1 -1
- package/dist/cjs/ez-grid.cjs.entry.js +59 -1
- 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 +186 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/{ez-multi-selection-list_2.cjs.entry.js → ez-popover-core_2.cjs.entry.js} +116 -197
- 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 +1 -1
- 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 +1 -1
- package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ez-tooltip.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-9e5554cb.js → index-a7b0c73d.js} +8 -7
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/ez-badge/ez-badge.css +1 -12
- package/dist/collection/components/ez-badge/ez-badge.js +1 -31
- package/dist/collection/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.css +205 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.js +426 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -250
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +61 -194
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +3 -0
- package/dist/collection/components/ez-grid/ez-grid.js +56 -1
- package/dist/collection/components/ez-popover-plus/ez-popover-plus.css +0 -64
- package/dist/collection/components/ez-popover-plus/ez-popover-plus.js +47 -127
- package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.css +67 -0
- package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.js +468 -0
- package/dist/custom-elements/index.d.ts +12 -0
- package/dist/custom-elements/index.js +394 -218
- 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 +3 -15
- 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_2.entry.js +1 -1
- 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-list_3.entry.js +381 -0
- package/dist/esm/ez-combo-box.entry.js +60 -186
- package/dist/esm/ez-date-input.entry.js +1 -1
- package/dist/esm/ez-date-time-input.entry.js +1 -1
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-double-list.entry.js +1 -1
- package/dist/esm/ez-dropdown_2.entry.js +1 -1
- package/dist/esm/ez-file-item.entry.js +1 -1
- package/dist/esm/ez-filter-input.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +1 -1
- package/dist/esm/ez-grid.entry.js +60 -2
- 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 +182 -0
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/{ez-multi-selection-list_2.entry.js → ez-popover-core_2.entry.js} +116 -197
- 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 +1 -1
- 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 +1 -1
- package/dist/esm/ez-text-input.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ez-tooltip.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-5a720e56.js → index-baa5e267.js} +9 -7
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-e6b38ade.entry.js → p-0306dff7.entry.js} +1 -1
- package/dist/ezui/{p-91ccae0c.entry.js → p-09de35a2.entry.js} +1 -1
- package/dist/ezui/{p-88c615f0.entry.js → p-0fa52b0f.entry.js} +1 -1
- package/dist/ezui/{p-92fbaf2b.entry.js → p-0faf71c5.entry.js} +1 -1
- package/dist/ezui/{p-b2f6bc0a.entry.js → p-17be134a.entry.js} +1 -1
- package/dist/ezui/{p-c96fbbef.entry.js → p-17de16e5.entry.js} +1 -1
- package/dist/ezui/{p-24b42f3d.entry.js → p-17eabf46.entry.js} +1 -1
- package/dist/ezui/{p-3885e66e.entry.js → p-1ad6c61b.entry.js} +1 -1
- package/dist/ezui/{p-81461d2f.entry.js → p-1e7a8633.entry.js} +1 -1
- package/dist/ezui/{p-6b51c9cc.entry.js → p-1f50fa05.entry.js} +1 -1
- package/dist/ezui/{p-cf33bc48.entry.js → p-20c024f7.entry.js} +1 -1
- package/dist/ezui/{p-e4c7eb39.js → p-23a36bb6.js} +2 -2
- package/dist/ezui/{p-6d31c43c.entry.js → p-2bb2a0c4.entry.js} +1 -1
- package/dist/ezui/{p-ca8936df.entry.js → p-2f45506d.entry.js} +1 -1
- package/dist/ezui/{p-9fc250d4.entry.js → p-3195a7a7.entry.js} +1 -1
- package/dist/ezui/{p-23dab72f.entry.js → p-31b71e50.entry.js} +1 -1
- package/dist/ezui/{p-b22889ea.entry.js → p-3429080c.entry.js} +1 -1
- package/dist/ezui/{p-0378416a.entry.js → p-44caad9a.entry.js} +1 -1
- package/dist/ezui/{p-a3319796.entry.js → p-53116373.entry.js} +46 -46
- package/dist/ezui/{p-7567ccdd.entry.js → p-555c9018.entry.js} +1 -1
- package/dist/ezui/{p-3791d9c8.entry.js → p-556468d9.entry.js} +1 -1
- package/dist/ezui/{p-9066b0b0.entry.js → p-56fe5341.entry.js} +1 -1
- package/dist/ezui/{p-cf3b60fd.entry.js → p-58783dcf.entry.js} +1 -1
- package/dist/ezui/{p-044d46d5.entry.js → p-5b205c80.entry.js} +1 -1
- package/dist/ezui/{p-6fc26622.entry.js → p-5ed81457.entry.js} +1 -1
- package/dist/ezui/p-650e4b6d.entry.js +1 -0
- package/dist/ezui/{p-03b0ed5a.entry.js → p-65f471bc.entry.js} +1 -1
- package/dist/ezui/{p-6d8b3298.entry.js → p-6cdd3e0a.entry.js} +1 -1
- package/dist/ezui/{p-fc194825.entry.js → p-6e429cff.entry.js} +1 -1
- package/dist/ezui/{p-11bfeca3.entry.js → p-77a4bd35.entry.js} +1 -1
- package/dist/ezui/p-7bd15498.entry.js +1 -0
- package/dist/ezui/{p-2069c78a.entry.js → p-7e677b7b.entry.js} +1 -1
- package/dist/ezui/{p-e18d9e6a.entry.js → p-7fdd479f.entry.js} +1 -1
- package/dist/ezui/{p-82fa4b09.entry.js → p-8df1ca33.entry.js} +1 -1
- package/dist/ezui/{p-a921e3e7.entry.js → p-990b4318.entry.js} +1 -1
- package/dist/ezui/{p-c2b20f78.entry.js → p-9f5fa3f9.entry.js} +1 -1
- package/dist/ezui/{p-0cfbbe82.entry.js → p-a4cee65d.entry.js} +1 -1
- package/dist/ezui/{p-dfca5946.entry.js → p-a80b1287.entry.js} +1 -1
- package/dist/ezui/{p-f30e0590.entry.js → p-b26f6c5b.entry.js} +1 -1
- package/dist/ezui/p-bc2f844e.entry.js +1 -0
- package/dist/ezui/{p-92748142.entry.js → p-c0d9c4f8.entry.js} +1 -1
- package/dist/ezui/{p-4818b8ce.entry.js → p-c1527804.entry.js} +1 -1
- package/dist/ezui/p-c297aa52.entry.js +1 -0
- package/dist/ezui/{p-b9282c79.entry.js → p-cb1535f7.entry.js} +1 -1
- package/dist/ezui/{p-f4da7e1e.entry.js → p-cf87aacb.entry.js} +1 -1
- package/dist/ezui/{p-5010315a.entry.js → p-d9548bdf.entry.js} +1 -1
- package/dist/ezui/{p-708b196e.entry.js → p-da1b4a38.entry.js} +1 -1
- package/dist/ezui/p-dc73e1fe.entry.js +1 -0
- package/dist/ezui/{p-bef7daac.entry.js → p-e347df9c.entry.js} +1 -1
- package/dist/ezui/{p-9e95bfeb.entry.js → p-e6a9041d.entry.js} +1 -1
- package/dist/ezui/{p-68b2e579.entry.js → p-ea54d056.entry.js} +1 -1
- package/dist/ezui/p-f5931caa.entry.js +1 -0
- package/dist/ezui/{p-44b39e81.entry.js → p-fa6732f2.entry.js} +1 -1
- package/dist/ezui/{p-e3f8660b.entry.js → p-fd0a19d6.entry.js} +1 -1
- package/dist/types/components/ez-badge/ez-badge.d.ts +0 -5
- package/dist/types/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.d.ts +104 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -16
- package/dist/types/components/ez-grid/ez-grid.d.ts +5 -0
- package/dist/types/components/ez-popover-plus/ez-popover-plus.d.ts +6 -19
- package/dist/types/components/ez-popover-plus/subcomponent/ez-popover-core.d.ts +81 -0
- package/dist/types/components.d.ts +218 -11
- package/package.json +1 -1
- package/react/components.d.ts +2 -0
- package/react/components.js +2 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +0 -236
- package/dist/esm/ez-custom-form-input_2.entry.js +0 -231
- package/dist/ezui/p-000159dc.entry.js +0 -1
- package/dist/ezui/p-3af64edd.entry.js +0 -1
- package/dist/ezui/p-6ec40dec.entry.js +0 -1
- package/dist/ezui/p-cba34702.entry.js +0 -1
- package/dist/ezui/p-fcc78b7f.entry.js +0 -1
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-9e5554cb.js');
|
|
6
|
-
const ICustomRender = require('./ICustomRender-6fafffce.js');
|
|
7
|
-
const core = require('@sankhyalabs/core');
|
|
8
|
-
const ApplicationUtils = require('./ApplicationUtils-c9d1205c.js');
|
|
9
|
-
require('./DialogType-2114c337.js');
|
|
10
|
-
require('./CheckMode-ecb90b87.js');
|
|
11
|
-
|
|
12
|
-
const EzCustomFormInput = class {
|
|
13
|
-
constructor(hostRef) {
|
|
14
|
-
index.registerInstance(this, hostRef);
|
|
15
|
-
this.gui = undefined;
|
|
16
|
-
this.customEditor = undefined;
|
|
17
|
-
this.formViewField = undefined;
|
|
18
|
-
this.value = undefined;
|
|
19
|
-
this.detailContext = undefined;
|
|
20
|
-
this.builderFallback = undefined;
|
|
21
|
-
this.selectedRecord = undefined;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Aplica foco no campo.
|
|
25
|
-
*/
|
|
26
|
-
async setFocus() {
|
|
27
|
-
var _a, _b;
|
|
28
|
-
(_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["setFocus"]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Remove o foco do campo.
|
|
32
|
-
*/
|
|
33
|
-
async setBlur() {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
(_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["setBlur"]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Retorna se o conteúdo é inválido.
|
|
39
|
-
*/
|
|
40
|
-
async isInvalid() {
|
|
41
|
-
var _a, _b;
|
|
42
|
-
return ((_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["isInvalid"]) === null || _b === void 0 ? void 0 : _b.call(_a)) || false;
|
|
43
|
-
}
|
|
44
|
-
watchValue() {
|
|
45
|
-
this.handleValue(this.gui);
|
|
46
|
-
}
|
|
47
|
-
watchCustomEditor() {
|
|
48
|
-
this.getContent();
|
|
49
|
-
}
|
|
50
|
-
watchFormViewField(newValue, oldValue) {
|
|
51
|
-
if (!core.ObjectUtils.equals(newValue, oldValue))
|
|
52
|
-
this.getContent();
|
|
53
|
-
}
|
|
54
|
-
watchDetailContext() {
|
|
55
|
-
this.getContent();
|
|
56
|
-
}
|
|
57
|
-
watchBuilderFallback() {
|
|
58
|
-
this.getContent();
|
|
59
|
-
}
|
|
60
|
-
watchSelectedRecord(newValue, oldValue) {
|
|
61
|
-
const newRecordId = newValue === null || newValue === void 0 ? void 0 : newValue['__record__id__'];
|
|
62
|
-
const oldRecordId = oldValue === null || oldValue === void 0 ? void 0 : oldValue['__record__id__'];
|
|
63
|
-
if (newRecordId !== oldRecordId) {
|
|
64
|
-
this.getContent();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
getContent() {
|
|
68
|
-
var _a, _b, _c, _d, _e;
|
|
69
|
-
const fieldProps = new Map();
|
|
70
|
-
for (const prop in this.formViewField.props) {
|
|
71
|
-
fieldProps.set(prop, this.formViewField.props[prop]);
|
|
72
|
-
}
|
|
73
|
-
const params = {
|
|
74
|
-
value: this.value,
|
|
75
|
-
name: this.formViewField.name,
|
|
76
|
-
currentEditor: this.builderFallback(this.formViewField),
|
|
77
|
-
setValue: (value) => this.setValue(value),
|
|
78
|
-
getValue: this.getValue,
|
|
79
|
-
record: this.selectedRecord,
|
|
80
|
-
editorMetadata: {
|
|
81
|
-
label: this.formViewField.label,
|
|
82
|
-
hidden: ((_a = this.formViewField.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
|
|
83
|
-
userInterface: this.formViewField.userInterface,
|
|
84
|
-
options: (_b = this.formViewField.props) === null || _b === void 0 ? void 0 : _b.options,
|
|
85
|
-
props: this.formViewField.props ? fieldProps : undefined,
|
|
86
|
-
optionLoader: this.formViewField.optionLoader
|
|
87
|
-
},
|
|
88
|
-
source: ICustomRender.CustomEditorSource.FORM,
|
|
89
|
-
detailContext: this.detailContext
|
|
90
|
-
};
|
|
91
|
-
let gui = this.customEditor.getEditorElement(params);
|
|
92
|
-
if (!gui) {
|
|
93
|
-
gui = this.builderFallback(this.formViewField);
|
|
94
|
-
this.handleValue(gui);
|
|
95
|
-
this.gui = gui;
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (!(gui instanceof index.H) && typeof gui !== 'string') {
|
|
99
|
-
this.handleValue(gui);
|
|
100
|
-
this.gui = gui;
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (typeof gui === 'string') {
|
|
104
|
-
gui = core.HTMLBuilder.parseElement(gui);
|
|
105
|
-
}
|
|
106
|
-
const value = (_e = (_d = (_c = this.value) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : this.value) !== null && _e !== void 0 ? _e : '';
|
|
107
|
-
gui.setAttribute('value', value);
|
|
108
|
-
this.gui = index.h("div", { key: core.StringUtils.generateUUID(), ref: el => el && el.appendChild(gui) });
|
|
109
|
-
}
|
|
110
|
-
setValue(value) {
|
|
111
|
-
this.value = value;
|
|
112
|
-
}
|
|
113
|
-
getValue() {
|
|
114
|
-
return this.value;
|
|
115
|
-
}
|
|
116
|
-
handleValue(gui) {
|
|
117
|
-
var _a;
|
|
118
|
-
//@ts-ignore
|
|
119
|
-
(_a = gui.$children$) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
|
|
120
|
-
child.$attrs$.value = this.value;
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
componentWillLoad() {
|
|
124
|
-
this.getContent();
|
|
125
|
-
}
|
|
126
|
-
render() {
|
|
127
|
-
return (index.h(index.Host, null, this.gui));
|
|
128
|
-
}
|
|
129
|
-
static get watchers() { return {
|
|
130
|
-
"value": ["watchValue"],
|
|
131
|
-
"customEditor": ["watchCustomEditor"],
|
|
132
|
-
"formViewField": ["watchFormViewField"],
|
|
133
|
-
"detailContext": ["watchDetailContext"],
|
|
134
|
-
"builderFallback": ["watchBuilderFallback"],
|
|
135
|
-
"selectedRecord": ["watchSelectedRecord"]
|
|
136
|
-
}; }
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const ezTextEditCss = ":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";
|
|
140
|
-
|
|
141
|
-
const EzTextEdit = class {
|
|
142
|
-
constructor(hostRef) {
|
|
143
|
-
index.registerInstance(this, hostRef);
|
|
144
|
-
this.saveEdition = index.createEvent(this, "saveEdition", 7);
|
|
145
|
-
this.cancelEdition = index.createEvent(this, "cancelEdition", 7);
|
|
146
|
-
this._newValue = undefined;
|
|
147
|
-
this.value = undefined;
|
|
148
|
-
this.styled = undefined;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Aplica foco no campo.
|
|
152
|
-
*/
|
|
153
|
-
async applyFocusSelect() {
|
|
154
|
-
this.calcSizeInput(this.value, true);
|
|
155
|
-
}
|
|
156
|
-
calcSizeInput(value, setSelect = false) {
|
|
157
|
-
var _a, _b;
|
|
158
|
-
const textInput = (_b = (_a = this._inputElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input');
|
|
159
|
-
if (textInput != undefined) {
|
|
160
|
-
const sizeText = this.getWidthValue(value);
|
|
161
|
-
textInput.style.width = sizeText + 'px';
|
|
162
|
-
if (setSelect) {
|
|
163
|
-
setTimeout(() => textInput.select(), 100);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
getWidthValue(value) {
|
|
168
|
-
if (this._valueBasis != undefined) {
|
|
169
|
-
const span = this._valueBasis;
|
|
170
|
-
if (value != undefined) {
|
|
171
|
-
const cursorSpace = 2;
|
|
172
|
-
span.innerHTML = value;
|
|
173
|
-
return span.clientWidth > 0 ? (span.clientWidth + cursorSpace) : cursorSpace;
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
span.innerHTML = "";
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return 0;
|
|
180
|
-
}
|
|
181
|
-
setStyledInput() {
|
|
182
|
-
var _a, _b;
|
|
183
|
-
let fontSize = "";
|
|
184
|
-
let fontWeight = "";
|
|
185
|
-
let fontFamily = "";
|
|
186
|
-
if (this.styled != undefined) {
|
|
187
|
-
fontSize = this.styled.fontSize;
|
|
188
|
-
fontWeight = this.styled.fontWeight;
|
|
189
|
-
fontFamily = this.styled.fontFamily;
|
|
190
|
-
}
|
|
191
|
-
const textInput = (_b = (_a = this._inputElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input');
|
|
192
|
-
if (textInput != undefined) {
|
|
193
|
-
textInput.style.fontSize = fontSize;
|
|
194
|
-
textInput.style.fontWeight = fontWeight;
|
|
195
|
-
textInput.style.fontFamily = fontFamily;
|
|
196
|
-
}
|
|
197
|
-
const span = this._valueBasis;
|
|
198
|
-
if (span != undefined) {
|
|
199
|
-
span.style.fontSize = fontSize;
|
|
200
|
-
span.style.fontWeight = fontWeight;
|
|
201
|
-
span.style.fontFamily = fontFamily;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
handleSaveEdition() {
|
|
205
|
-
if (!this._newValue) {
|
|
206
|
-
ApplicationUtils.ApplicationUtils.alert("Aviso", "Não é possível salvar um campo em branco.").then(() => {
|
|
207
|
-
this.setNewValue(this.value, true);
|
|
208
|
-
});
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
this.saveEdition.emit({ value: this.value, newValue: this._newValue });
|
|
212
|
-
}
|
|
213
|
-
handleCancelEdition() {
|
|
214
|
-
this.cancelEdition.emit();
|
|
215
|
-
}
|
|
216
|
-
setNewValue(value, setSelect = false) {
|
|
217
|
-
this._newValue = value;
|
|
218
|
-
this.calcSizeInput(this._newValue, setSelect);
|
|
219
|
-
}
|
|
220
|
-
componentDidLoad() {
|
|
221
|
-
this.applyFocusSelect();
|
|
222
|
-
this.setNewValue(this.value);
|
|
223
|
-
}
|
|
224
|
-
componentDidRender() {
|
|
225
|
-
this.setStyledInput();
|
|
226
|
-
}
|
|
227
|
-
render() {
|
|
228
|
-
core.ElementIDUtils.addIDInfoIfNotExists(this._element, 'input');
|
|
229
|
-
return (index.h(index.Host, null, index.h("span", { class: "text-edit__hidden-value", ref: elem => this._valueBasis = elem }), index.h("ez-text-input", { "data-element-id": core.ElementIDUtils.getInternalIDInfo("textInput"), onInput: () => { this.calcSizeInput(this._newValue); }, class: "text-edit__form-input", value: this._newValue, ref: (elem) => this._inputElement = elem, mode: "slim", onEzChange: (evt) => this.setNewValue(evt === null || evt === void 0 ? void 0 : evt.detail), noBorder: true }), index.h("ez-button", { class: "text-edit__icon-check", mode: "icon", iconName: "check", size: "small", onClick: () => { this.handleSaveEdition(); } }), index.h("ez-button", { class: "text-edit__icon-close", mode: "icon", iconName: "close", size: "small", onClick: () => { this.handleCancelEdition(); } })));
|
|
230
|
-
}
|
|
231
|
-
get _element() { return index.getElement(this); }
|
|
232
|
-
};
|
|
233
|
-
EzTextEdit.style = ezTextEditCss;
|
|
234
|
-
|
|
235
|
-
exports.ez_custom_form_input = EzCustomFormInput;
|
|
236
|
-
exports.ez_text_edit = EzTextEdit;
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, a as H, h, H as Host, c as createEvent, g as getElement } from './index-5a720e56.js';
|
|
2
|
-
import { C as CustomEditorSource } from './ICustomRender-875b5a40.js';
|
|
3
|
-
import { ObjectUtils, HTMLBuilder, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
4
|
-
import { A as ApplicationUtils } from './ApplicationUtils-eaf91331.js';
|
|
5
|
-
import './DialogType-54a62731.js';
|
|
6
|
-
import './CheckMode-bdb2ec19.js';
|
|
7
|
-
|
|
8
|
-
const EzCustomFormInput = class {
|
|
9
|
-
constructor(hostRef) {
|
|
10
|
-
registerInstance(this, hostRef);
|
|
11
|
-
this.gui = undefined;
|
|
12
|
-
this.customEditor = undefined;
|
|
13
|
-
this.formViewField = undefined;
|
|
14
|
-
this.value = undefined;
|
|
15
|
-
this.detailContext = undefined;
|
|
16
|
-
this.builderFallback = undefined;
|
|
17
|
-
this.selectedRecord = undefined;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Aplica foco no campo.
|
|
21
|
-
*/
|
|
22
|
-
async setFocus() {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
(_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["setFocus"]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Remove o foco do campo.
|
|
28
|
-
*/
|
|
29
|
-
async setBlur() {
|
|
30
|
-
var _a, _b;
|
|
31
|
-
(_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["setBlur"]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Retorna se o conteúdo é inválido.
|
|
35
|
-
*/
|
|
36
|
-
async isInvalid() {
|
|
37
|
-
var _a, _b;
|
|
38
|
-
return ((_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["isInvalid"]) === null || _b === void 0 ? void 0 : _b.call(_a)) || false;
|
|
39
|
-
}
|
|
40
|
-
watchValue() {
|
|
41
|
-
this.handleValue(this.gui);
|
|
42
|
-
}
|
|
43
|
-
watchCustomEditor() {
|
|
44
|
-
this.getContent();
|
|
45
|
-
}
|
|
46
|
-
watchFormViewField(newValue, oldValue) {
|
|
47
|
-
if (!ObjectUtils.equals(newValue, oldValue))
|
|
48
|
-
this.getContent();
|
|
49
|
-
}
|
|
50
|
-
watchDetailContext() {
|
|
51
|
-
this.getContent();
|
|
52
|
-
}
|
|
53
|
-
watchBuilderFallback() {
|
|
54
|
-
this.getContent();
|
|
55
|
-
}
|
|
56
|
-
watchSelectedRecord(newValue, oldValue) {
|
|
57
|
-
const newRecordId = newValue === null || newValue === void 0 ? void 0 : newValue['__record__id__'];
|
|
58
|
-
const oldRecordId = oldValue === null || oldValue === void 0 ? void 0 : oldValue['__record__id__'];
|
|
59
|
-
if (newRecordId !== oldRecordId) {
|
|
60
|
-
this.getContent();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
getContent() {
|
|
64
|
-
var _a, _b, _c, _d, _e;
|
|
65
|
-
const fieldProps = new Map();
|
|
66
|
-
for (const prop in this.formViewField.props) {
|
|
67
|
-
fieldProps.set(prop, this.formViewField.props[prop]);
|
|
68
|
-
}
|
|
69
|
-
const params = {
|
|
70
|
-
value: this.value,
|
|
71
|
-
name: this.formViewField.name,
|
|
72
|
-
currentEditor: this.builderFallback(this.formViewField),
|
|
73
|
-
setValue: (value) => this.setValue(value),
|
|
74
|
-
getValue: this.getValue,
|
|
75
|
-
record: this.selectedRecord,
|
|
76
|
-
editorMetadata: {
|
|
77
|
-
label: this.formViewField.label,
|
|
78
|
-
hidden: ((_a = this.formViewField.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
|
|
79
|
-
userInterface: this.formViewField.userInterface,
|
|
80
|
-
options: (_b = this.formViewField.props) === null || _b === void 0 ? void 0 : _b.options,
|
|
81
|
-
props: this.formViewField.props ? fieldProps : undefined,
|
|
82
|
-
optionLoader: this.formViewField.optionLoader
|
|
83
|
-
},
|
|
84
|
-
source: CustomEditorSource.FORM,
|
|
85
|
-
detailContext: this.detailContext
|
|
86
|
-
};
|
|
87
|
-
let gui = this.customEditor.getEditorElement(params);
|
|
88
|
-
if (!gui) {
|
|
89
|
-
gui = this.builderFallback(this.formViewField);
|
|
90
|
-
this.handleValue(gui);
|
|
91
|
-
this.gui = gui;
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (!(gui instanceof H) && typeof gui !== 'string') {
|
|
95
|
-
this.handleValue(gui);
|
|
96
|
-
this.gui = gui;
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (typeof gui === 'string') {
|
|
100
|
-
gui = HTMLBuilder.parseElement(gui);
|
|
101
|
-
}
|
|
102
|
-
const value = (_e = (_d = (_c = this.value) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : this.value) !== null && _e !== void 0 ? _e : '';
|
|
103
|
-
gui.setAttribute('value', value);
|
|
104
|
-
this.gui = h("div", { key: StringUtils.generateUUID(), ref: el => el && el.appendChild(gui) });
|
|
105
|
-
}
|
|
106
|
-
setValue(value) {
|
|
107
|
-
this.value = value;
|
|
108
|
-
}
|
|
109
|
-
getValue() {
|
|
110
|
-
return this.value;
|
|
111
|
-
}
|
|
112
|
-
handleValue(gui) {
|
|
113
|
-
var _a;
|
|
114
|
-
//@ts-ignore
|
|
115
|
-
(_a = gui.$children$) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
|
|
116
|
-
child.$attrs$.value = this.value;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
componentWillLoad() {
|
|
120
|
-
this.getContent();
|
|
121
|
-
}
|
|
122
|
-
render() {
|
|
123
|
-
return (h(Host, null, this.gui));
|
|
124
|
-
}
|
|
125
|
-
static get watchers() { return {
|
|
126
|
-
"value": ["watchValue"],
|
|
127
|
-
"customEditor": ["watchCustomEditor"],
|
|
128
|
-
"formViewField": ["watchFormViewField"],
|
|
129
|
-
"detailContext": ["watchDetailContext"],
|
|
130
|
-
"builderFallback": ["watchBuilderFallback"],
|
|
131
|
-
"selectedRecord": ["watchSelectedRecord"]
|
|
132
|
-
}; }
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
const ezTextEditCss = ":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";
|
|
136
|
-
|
|
137
|
-
const EzTextEdit = class {
|
|
138
|
-
constructor(hostRef) {
|
|
139
|
-
registerInstance(this, hostRef);
|
|
140
|
-
this.saveEdition = createEvent(this, "saveEdition", 7);
|
|
141
|
-
this.cancelEdition = createEvent(this, "cancelEdition", 7);
|
|
142
|
-
this._newValue = undefined;
|
|
143
|
-
this.value = undefined;
|
|
144
|
-
this.styled = undefined;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Aplica foco no campo.
|
|
148
|
-
*/
|
|
149
|
-
async applyFocusSelect() {
|
|
150
|
-
this.calcSizeInput(this.value, true);
|
|
151
|
-
}
|
|
152
|
-
calcSizeInput(value, setSelect = false) {
|
|
153
|
-
var _a, _b;
|
|
154
|
-
const textInput = (_b = (_a = this._inputElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input');
|
|
155
|
-
if (textInput != undefined) {
|
|
156
|
-
const sizeText = this.getWidthValue(value);
|
|
157
|
-
textInput.style.width = sizeText + 'px';
|
|
158
|
-
if (setSelect) {
|
|
159
|
-
setTimeout(() => textInput.select(), 100);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
getWidthValue(value) {
|
|
164
|
-
if (this._valueBasis != undefined) {
|
|
165
|
-
const span = this._valueBasis;
|
|
166
|
-
if (value != undefined) {
|
|
167
|
-
const cursorSpace = 2;
|
|
168
|
-
span.innerHTML = value;
|
|
169
|
-
return span.clientWidth > 0 ? (span.clientWidth + cursorSpace) : cursorSpace;
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
span.innerHTML = "";
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return 0;
|
|
176
|
-
}
|
|
177
|
-
setStyledInput() {
|
|
178
|
-
var _a, _b;
|
|
179
|
-
let fontSize = "";
|
|
180
|
-
let fontWeight = "";
|
|
181
|
-
let fontFamily = "";
|
|
182
|
-
if (this.styled != undefined) {
|
|
183
|
-
fontSize = this.styled.fontSize;
|
|
184
|
-
fontWeight = this.styled.fontWeight;
|
|
185
|
-
fontFamily = this.styled.fontFamily;
|
|
186
|
-
}
|
|
187
|
-
const textInput = (_b = (_a = this._inputElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input');
|
|
188
|
-
if (textInput != undefined) {
|
|
189
|
-
textInput.style.fontSize = fontSize;
|
|
190
|
-
textInput.style.fontWeight = fontWeight;
|
|
191
|
-
textInput.style.fontFamily = fontFamily;
|
|
192
|
-
}
|
|
193
|
-
const span = this._valueBasis;
|
|
194
|
-
if (span != undefined) {
|
|
195
|
-
span.style.fontSize = fontSize;
|
|
196
|
-
span.style.fontWeight = fontWeight;
|
|
197
|
-
span.style.fontFamily = fontFamily;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
handleSaveEdition() {
|
|
201
|
-
if (!this._newValue) {
|
|
202
|
-
ApplicationUtils.alert("Aviso", "Não é possível salvar um campo em branco.").then(() => {
|
|
203
|
-
this.setNewValue(this.value, true);
|
|
204
|
-
});
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
this.saveEdition.emit({ value: this.value, newValue: this._newValue });
|
|
208
|
-
}
|
|
209
|
-
handleCancelEdition() {
|
|
210
|
-
this.cancelEdition.emit();
|
|
211
|
-
}
|
|
212
|
-
setNewValue(value, setSelect = false) {
|
|
213
|
-
this._newValue = value;
|
|
214
|
-
this.calcSizeInput(this._newValue, setSelect);
|
|
215
|
-
}
|
|
216
|
-
componentDidLoad() {
|
|
217
|
-
this.applyFocusSelect();
|
|
218
|
-
this.setNewValue(this.value);
|
|
219
|
-
}
|
|
220
|
-
componentDidRender() {
|
|
221
|
-
this.setStyledInput();
|
|
222
|
-
}
|
|
223
|
-
render() {
|
|
224
|
-
ElementIDUtils.addIDInfoIfNotExists(this._element, 'input');
|
|
225
|
-
return (h(Host, null, h("span", { class: "text-edit__hidden-value", ref: elem => this._valueBasis = elem }), h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), onInput: () => { this.calcSizeInput(this._newValue); }, class: "text-edit__form-input", value: this._newValue, ref: (elem) => this._inputElement = elem, mode: "slim", onEzChange: (evt) => this.setNewValue(evt === null || evt === void 0 ? void 0 : evt.detail), noBorder: true }), h("ez-button", { class: "text-edit__icon-check", mode: "icon", iconName: "check", size: "small", onClick: () => { this.handleSaveEdition(); } }), h("ez-button", { class: "text-edit__icon-close", mode: "icon", iconName: "close", size: "small", onClick: () => { this.handleCancelEdition(); } })));
|
|
226
|
-
}
|
|
227
|
-
get _element() { return getElement(this); }
|
|
228
|
-
};
|
|
229
|
-
EzTextEdit.style = ezTextEditCss;
|
|
230
|
-
|
|
231
|
-
export { EzCustomFormInput as ez_custom_form_input, EzTextEdit as ez_text_edit };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,h as a,H as t,g as i}from"./p-e4c7eb39.js";import{ElementIDUtils as d}from"@sankhyalabs/core";var s;!function(e){e.EXTRA_LARGE="extra-large",e.LARGE="large",e.MEDIUM="medium",e.SMALL_MEDIUM="small-medium",e.SMALL="small",e.EXTRA_SMALL="extra-small"}(s||(s={}));const n=class{constructor(a){e(this,a),this._sizes={[s.EXTRA_LARGE]:{sufix:"xl"},[s.LARGE]:{sufix:"lg"},[s.MEDIUM]:{sufix:"md"},[s.SMALL_MEDIUM]:{sufix:"sm"},[s.SMALL]:{sufix:"xs"},[s.EXTRA_SMALL]:{sufix:"2xs"}},this.hasSlot=!1,this.size="small",this.label=void 0,this.iconLeft=void 0,this.iconRight=void 0,this.position={horizontal:"right",vertical:"top"},this.alignItems="center"}getIconSize(){switch(this.size){case"large":return"large";case"medium":case"small-medium":return"small";case"small":return"x-small";default:return null}}getAlignItemsClass(){switch(this.alignItems){case"flex-end":return"end";case"flex-start":return"start";default:return"center"}}componentDidLoad(){this._element&&d.addIDInfo(this._element),this._badge&&d.addIDInfo(this._badge,"ezBadge",{id:"embedded"})}handleSlotChange(){this.hasSlot=!0}validateIconLeft(){return this.iconLeft&&""!==this.iconLeft.trim()}validateIconRight(){return this.iconRight&&""!==this.iconRight.trim()}validateLabel(){return this.label&&""!==this.label.trim()}createContainerClassName(){let e=this._sizes[this.size].sufix,a=["badge__content","badge__content--icon-align-"+this.getAlignItemsClass()];return this.hasSlot&&(a.push("badge__content--fill-"+e),"bottom"==this.position.vertical&&"right"==this.position.horizontal&&a.push("badge__content--fill-bottom-right"),"bottom"==this.position.vertical&&"left"==this.position.horizontal&&a.push("badge__content--fill-bottom-left"),"top"==this.position.vertical&&"right"==this.position.horizontal&&a.push("badge__content--fill-top-right"),"top"==this.position.vertical&&"left"==this.position.horizontal&&a.push("badge__content--fill-top-left")),a.push(this.label?"badge__content--text-"+e:this.iconLeft||this.iconRight?"badge__content--icon-"+e:"badge__content--fill-"+e),a.join(" ")}render(){return a(t,null,a("div",{class:"badge"},a("div",null,a("slot",{name:"child-badge",onSlotchange:()=>{this.handleSlotChange()}})),a("div",{class:this.createContainerClassName(),ref:e=>this._badge=e},this.validateIconLeft()&&a("ez-icon",{class:"icon",iconName:this.iconLeft,size:this.getIconSize()}),this.validateLabel()&&a("label",{title:this.label},this.label),this.validateIconRight()&&a("ez-icon",{class:"icon",iconName:this.iconRight,size:this.getIconSize()}))))}get _element(){return i(this)}};n.style=":host{--ez-badge--size-2xs:var(--space--2xs, 8px);--ez-badge--size-xs:var(--space--xs, 12px);--ez-badge--size-sm:var(--space--sm, 16px);--ez-badge--size-md:var(--space--md, 20px);--ez-badge--size-lg:var(--space--lg, 24px);--ez-badge--size-xl:var(--space--xl, 32px);--ez-badge--padding-2xs:0;--ez-badge--padding-xs:var(--space--nano, 2px);--ez-badge--padding-sm:calc(var(--space--nano, 2px) + 1px);--ez-badge--padding-md:var(--space--3xs, 4px);--ez-badge--padding-lg:calc(var(--space--3xs, 4px) + 2px);--ez-badge--padding-xl:var(--space--2xs);--ez-badge--border-radius:calc(var(--border--radius-medium, 12px) + 8px);--ez-badge--font-family:var(--font-pattern, Roboto);--ez-badge--font-weight-medium:var(--text-weight--medium, 400);--ez-badge--background-color:var(--color--primary, #008561);--ez-badge--border-none:0;--ez-badge--color:var(--text--inverted, #ffffff);--ez-badge--gap:calc(var(--ez-badge--padding-xs) + 1px);--ez-badge--font-size-md:var(--text--medium);--ez-badge--font-size-sm:var(--text--medium);--ez-badge--font-size-xs:var(--text--small)}ez-icon{--ez-icon--color:inherit}.badge{display:flex;justify-content:center;align-items:center;position:relative}.badge__content{font-family:var(--ez-badge--font-family, Roboto);font-weight:var(--ez-badge--font-weight-medium, 400);background-color:var(--ez-badge--background-color, #008561);border:var(--ez-badge--border-none, 0);color:var(--ez-badge--color, #ffffff);border-radius:var(--ez-badge--border-radius, 20px);gap:var(--ez-badge--gap, 3px);display:flex;justify-content:center}.badge__content--fill-xs{height:var(--ez-badge--size-xs, 12px);min-width:var(--ez-badge--size-xs, 12px)}.badge__content--fill-2xs{height:var(--ez-badge--size-2xs, 8px);min-width:var(--ez-badge--size-2xs, 8px)}.badge__content--text-md{height:calc(var(--ez-badge--size-md, 20px) - 2px);min-width:var(--ez-badge--size-sm, 20px);padding-top:var(--ez-badge--padding-sm);padding-bottom:var(--ez-badge--padding-sm);padding-right:var(--ez-badge--padding-xl);padding-left:var(--ez-badge--padding-xl);font-size:var(--ez-badge--font-size-md)}.badge__content--text-sm{height:calc(var(--ez-badge--size-sm, 16px) - 2px);min-width:var(--ez-badge--size-sm, 16px);padding-top:var(--ez-badge--padding-sm);padding-bottom:var(--ez-badge--padding-sm);padding-right:var(--ez-badge--padding-xl);padding-left:var(--ez-badge--padding-xl);font-size:var(--ez-badge--font-size-sm)}.badge__content--text-xs{height:var(--ez-badge--size-sm, 16px);min-width:var(--ez-badge--size-sm, 16px);padding-top:var(--ez-badge--padding-2xs);padding-bottom:var(--ez-badge--padding-2xs);padding-right:var(--ez-badge--padding-lg);padding-left:var(--ez-badge--padding-lg);font-size:var(--ez-badge--font-size-xs)}.badge__content--icon-lg{height:var(--ez-badge--size-lg, 24px);min-width:var(--ez-badge--size-lg, 24px);padding:var(--ez-badge--padding-md)}.badge__content--icon-md{height:var(--ez-badge--size-sm, 16px);min-width:var(--ez-badge--size-sm, 16px);padding:var(--ez-badge--padding-md)}.badge__content--icon-sm{height:var(--ez-badge--size-sm, 16px);min-width:var(--ez-badge--size-sm, 16px);padding:var(--ez-badge--padding-xs)}.badge__content--icon-xs{height:var(--ez-badge--size-xs, 12px);min-width:var(--ez-badge--size-xs, 12px);padding:var(--ez-badge--padding-xs)}.badge__content--icon-align-center{align-items:center}.badge__content--icon-align-start{align-items:flex-start}.badge__content--icon-align-end{align-items:flex-end}.badge__content--fill{position:absolute;top:0;inset-inline-end:0;z-index:var(--most-visible, 2)}.badge__content--fill-top-right{transform:translate(50%, -50%);position:absolute;top:0;right:0}.badge__content--fill-top-left{transform:translate(-50%, -50%);position:absolute;top:0;left:0}.badge__content--fill-bottom-left{transform:translate(-50%, 50%);position:absolute;bottom:0;left:0}.badge__content--fill-bottom-right{transform:translate(50%, 50%);position:absolute;bottom:0;right:0}";export{n as ez_badge}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,a as i,h as s,H as e,c as o,g as l}from"./p-e4c7eb39.js";import{C as n}from"./p-4607fb89.js";import{ObjectUtils as h,HTMLBuilder as a,StringUtils as d,ElementIDUtils as r}from"@sankhyalabs/core";import{A as c}from"./p-2187f86c.js";import"./p-ab574d59.js";import"./p-b853763b.js";const u=class{constructor(i){t(this,i),this.gui=void 0,this.customEditor=void 0,this.formViewField=void 0,this.value=void 0,this.detailContext=void 0,this.builderFallback=void 0,this.selectedRecord=void 0}async setFocus(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setFocus)||void 0===i||i.call(t)}async setBlur(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setBlur)||void 0===i||i.call(t)}async isInvalid(){var t,i;return(null===(i=null===(t=this.gui)||void 0===t?void 0:t.isInvalid)||void 0===i?void 0:i.call(t))||!1}watchValue(){this.handleValue(this.gui)}watchCustomEditor(){this.getContent()}watchFormViewField(t,i){h.equals(t,i)||this.getContent()}watchDetailContext(){this.getContent()}watchBuilderFallback(){this.getContent()}watchSelectedRecord(t,i){(null==t?void 0:t.__record__id__)!==(null==i?void 0:i.__record__id__)&&this.getContent()}getContent(){var t,e,o,l,h;const r=new Map;for(const t in this.formViewField.props)r.set(t,this.formViewField.props[t]);const c={value:this.value,name:this.formViewField.name,currentEditor:this.builderFallback(this.formViewField),setValue:t=>this.setValue(t),getValue:this.getValue,record:this.selectedRecord,editorMetadata:{label:this.formViewField.label,hidden:!1===(null===(t=this.formViewField.props)||void 0===t?void 0:t.visible),userInterface:this.formViewField.userInterface,options:null===(e=this.formViewField.props)||void 0===e?void 0:e.options,props:this.formViewField.props?r:void 0,optionLoader:this.formViewField.optionLoader},source:n.FORM,detailContext:this.detailContext};let u=this.customEditor.getEditorElement(c);if(!u)return u=this.builderFallback(this.formViewField),this.handleValue(u),void(this.gui=u);if(!(u instanceof i)&&"string"!=typeof u)return this.handleValue(u),void(this.gui=u);"string"==typeof u&&(u=a.parseElement(u));const v=null!==(h=null!==(l=null===(o=this.value)||void 0===o?void 0:o.value)&&void 0!==l?l:this.value)&&void 0!==h?h:"";u.setAttribute("value",v),this.gui=s("div",{key:d.generateUUID(),ref:t=>t&&t.appendChild(u)})}setValue(t){this.value=t}getValue(){return this.value}handleValue(t){var i;null===(i=t.t)||void 0===i||i.forEach((t=>{t.i.value=this.value}))}componentWillLoad(){this.getContent()}render(){return s(e,null,this.gui)}static get watchers(){return{value:["watchValue"],customEditor:["watchCustomEditor"],formViewField:["watchFormViewField"],detailContext:["watchDetailContext"],builderFallback:["watchBuilderFallback"],selectedRecord:["watchSelectedRecord"]}}},v=class{constructor(i){t(this,i),this.saveEdition=o(this,"saveEdition",7),this.cancelEdition=o(this,"cancelEdition",7),this._newValue=void 0,this.value=void 0,this.styled=void 0}async applyFocusSelect(){this.calcSizeInput(this.value,!0)}calcSizeInput(t,i=!1){var s,e;const o=null===(e=null===(s=this._inputElement)||void 0===s?void 0:s.shadowRoot)||void 0===e?void 0:e.querySelector("input");if(null!=o){const s=this.getWidthValue(t);o.style.width=s+"px",i&&setTimeout((()=>o.select()),100)}}getWidthValue(t){if(null!=this._valueBasis){const i=this._valueBasis;if(null!=t){const s=2;return i.innerHTML=t,i.clientWidth>0?i.clientWidth+s:s}i.innerHTML=""}return 0}setStyledInput(){var t,i;let s="",e="",o="";null!=this.styled&&(s=this.styled.fontSize,e=this.styled.fontWeight,o=this.styled.fontFamily);const l=null===(i=null===(t=this._inputElement)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector("input");null!=l&&(l.style.fontSize=s,l.style.fontWeight=e,l.style.fontFamily=o);const n=this._valueBasis;null!=n&&(n.style.fontSize=s,n.style.fontWeight=e,n.style.fontFamily=o)}handleSaveEdition(){this._newValue?this.saveEdition.emit({value:this.value,newValue:this._newValue}):c.alert("Aviso","Não é possível salvar um campo em branco.").then((()=>{this.setNewValue(this.value,!0)}))}handleCancelEdition(){this.cancelEdition.emit()}setNewValue(t,i=!1){this._newValue=t,this.calcSizeInput(this._newValue,i)}componentDidLoad(){this.applyFocusSelect(),this.setNewValue(this.value)}componentDidRender(){this.setStyledInput()}render(){return r.addIDInfoIfNotExists(this._element,"input"),s(e,null,s("span",{class:"text-edit__hidden-value",ref:t=>this._valueBasis=t}),s("ez-text-input",{"data-element-id":r.getInternalIDInfo("textInput"),onInput:()=>{this.calcSizeInput(this._newValue)},class:"text-edit__form-input",value:this._newValue,ref:t=>this._inputElement=t,mode:"slim",onEzChange:t=>this.setNewValue(null==t?void 0:t.detail),noBorder:!0}),s("ez-button",{class:"text-edit__icon-check",mode:"icon",iconName:"check",size:"small",onClick:()=>{this.handleSaveEdition()}}),s("ez-button",{class:"text-edit__icon-close",mode:"icon",iconName:"close",size:"small",onClick:()=>{this.handleCancelEdition()}}))}get _element(){return l(this)}};v.style=":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";export{u as ez_custom_form_input,v as ez_text_edit}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,c as t,h as i}from"./p-e4c7eb39.js";const s=class{constructor(i){o(this,i),this.applicationLoaded=t(this,"applicationLoaded",7)}componentWillLoad(){}componentDidLoad(){this.applicationLoaded.emit(!0)}render(){return i("div",null)}};s.style="";export{s as ez_application}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,F as n,H as o,g as s}from"./p-e4c7eb39.js";import{ArrayUtils as r}from"@sankhyalabs/core";var l;!function(t){t.DATASOURCE_RESULTS="DATASOURCE_RESULTS",t.DATASOURCE_RESULTS_EMPTY="DATASOURCE_RESULTS_EMPTY",t.DATASOURCE_INIT="DATASOURCE_INIT",t.OPTIONS_EMPTY="OPTIONS_EMPTY",t.OPTIONS="OPTIONS"}(l||(l={}));const a=class{constructor(i){t(this,i),this.changeFilteredOptions=e(this,"changeFilteredOptions",7),this.columnName=void 0,this.dataSource=void 0,this.useOptions=!1,this.options=void 0,this.isTextSearch=!1,this.filteredOptions=void 0,this.displayOptions=void 0,this.viewScenario=void 0,this.displayOptionToCheckAllItems=!0}async clearFilteredOptions(){this.setInitialScenario(),this.filteredOptions=[],this.searchInput&&(this.searchInput.value=""),this.filterInput&&(this.filterInput.value="")}onChangeUseOptions(){this.setInitialScenario()}onChangeOptions(){this.options&&(this.filteredOptions=this.ordenationByCheckStateAndAlphabetically(this.options)),this.checkInput&&this.changeCheckAllValeuFromFilteredOptions(),this.setInitialScenario()}onChangeFilteredOptions(t){this.displayOptions=this.filteredOptions,this.displayOptionToCheckAllItems=this.filteredOptions.length>1,this.checkInput&&this.changeCheckAllValeuFromFilteredOptions(),this.changeFilteredOptions.emit(t)}componentDidRender(){this.changeCheckAllValeuFromFilteredOptions()}ordenationByCheckStateAndAlphabetically(t){const e=[],i=[];let n;return t.forEach((t=>{null==t.value||""===t.label?n=Object.assign(Object.assign({},t),{label:"(Vazio)"}):t.check?e.push(t):i.push(t)})),(null==n?[]:[n]).concat(null==this.dataSource?r.sortAlphabetically(e):this.dataSource.sortItems(this.columnName,e)).concat(null==this.dataSource?r.sortAlphabetically(i):this.dataSource.sortItems(this.columnName,i))}changeCheckAllValeuFromFilteredOptions(){var t,e,i,n;const o=null===(t=this.filteredOptions)||void 0===t?void 0:t.every((t=>!0===t.check)),s=null===(e=this.filteredOptions)||void 0===e?void 0:e.every((t=>!1===t.check)),r=(null===(i=this.filteredOptions)||void 0===i?void 0:i.some((t=>!1===t.check)))&&(null===(n=this.filteredOptions)||void 0===n?void 0:n.some((t=>!0===t.check)))&&(!o||!s);return this.checkInput&&o?(this.checkInput.indeterminate=!1,void(this.checkInput.value=!0)):this.checkInput&&r?(this.checkInput.indeterminate=!0,void(this.checkInput.value=!1)):this.checkInput&&s?(this.checkInput.indeterminate=!1,void(this.checkInput.value=!1)):void 0}setInitialScenario(){if(this.useOptions)return this.viewScenario=l.OPTIONS,void this.changeCheckAllValeuFromFilteredOptions();this.viewScenario=this.options&&this.options.length>0?l.DATASOURCE_RESULTS:l.DATASOURCE_INIT}async searchWithDataSource(t,e){const{argument:i,mode:n}=t;if("PRELOAD"!==n&&e)return this.dataSource.fetchData(i,e)}handleSearchOnDataSource(t){var e;const i=null!==(e=this.filteredOptions)&&void 0!==e?e:[];t.detail&&!i.some((e=>e.value==t.detail.value))&&(this.filteredOptions=this.ordenationByCheckStateAndAlphabetically([...i,t.detail])),this.viewScenario=l.DATASOURCE_RESULTS,this.searchInput.value=""}handleRemoveItemFromOptions(t){this.filteredOptions=this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter((e=>e.value!==t.value))),0===this.filteredOptions.length&&(this.viewScenario=l.DATASOURCE_INIT),this.searchInput&&(this.searchInput.value="")}handleSearchOnOption(t){if(t.detail)return this.displayOptions=r.applyStringFilter(t.detail,this.filteredOptions,!0),void(this.viewScenario=0===this.displayOptions.length?l.OPTIONS_EMPTY:l.OPTIONS);this.displayOptions=this.filteredOptions,this.viewScenario=l.OPTIONS}handleChangeSelectAllItems(t){this.filteredOptions=this.ordenationByCheckStateAndAlphabetically([...this.filteredOptions.map((e=>(e.check=!!t.detail,e)))])}handleChangeSelectedItem(t){const{detail:e}=t;this.filteredOptions.find((t=>t.label===e.label)).check=e.check}buildViewList(t){return i(n,null,this.displayOptionToCheckAllItems&&i("ez-check",{ref:t=>this.checkInput=t,label:"Selecionar todos",class:"multi-selection__select-all",onEzChange:this.handleChangeSelectAllItems.bind(this)}),i("ez-list",{class:"multi-selection__list",dataSource:this.displayOptions,listMode:"check",hoverFeedback:!0,onEzCheckChange:this.handleChangeSelectedItem.bind(this),itemSlotBuilder:t?this.buildDeleteIconSlot.bind(this):null}))}buildDeleteIconSlot(t){return i("ez-icon",{style:{cursor:"pointer"},iconName:"delete",onClick:()=>this.handleRemoveItemFromOptions(t)})}buildInitViewWithDataSource(){return i("multi-selection-box-message",{message:"Selecione os valores a serem filtrados através do campo de busca."})}buildViewEmptyResults(){return i("multi-selection-box-message",{message:"Nenhum resultado encontrado."})}scenarioToDisplay(t){const e={[l.DATASOURCE_INIT]:()=>this.buildInitViewWithDataSource(),[l.DATASOURCE_RESULTS]:()=>this.buildViewList(!0),[l.DATASOURCE_RESULTS_EMPTY]:()=>this.buildViewEmptyResults(),[l.OPTIONS_EMPTY]:()=>this.buildViewEmptyResults(),[l.OPTIONS]:()=>this.buildViewList(!1)}[t];return e?e():void 0}render(){return i(o,null,i("div",{class:"multi-selection"},this.useOptions?i("ez-filter-input",{ref:t=>this.filterInput=t,label:"Buscar..",onEzChange:this.handleSearchOnOption.bind(this)}):i("ez-search",{class:"multi-selection__input",label:"Buscar...",ref:t=>this.searchInput=t,suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,optionLoader:t=>this.searchWithDataSource(t,this.columnName),onEzChange:this.handleSearchOnDataSource.bind(this),isTextSearch:this.isTextSearch}),i("ez-scroll",{class:"multi-selection__content-options"},this.scenarioToDisplay(this.viewScenario))))}static get watchers(){return{useOptions:["onChangeUseOptions"],options:["onChangeOptions"],filteredOptions:["onChangeFilteredOptions"]}}};a.style=".sc-ez-multi-selection-list-h{--ez-check--outter-gap:0px;--ez-multi-selection-default-height:322px;display:block;width:304px;height:var(--ez-multi-selection-default-height);min-height:fit-content;max-height:calc(100vh - 350px)}.multi-selection__input.sc-ez-multi-selection-list{margin-bottom:var(--space--2xs, 8px)}.multi-selection__content-options.sc-ez-multi-selection-list{position:relative;left:-4px}.multi-selection__select-all.sc-ez-multi-selection-list{height:var(--space--xl);margin:0 var(--space--small, 6px)}.multi-selection__list.sc-ez-multi-selection-list{max-height:calc(100vh - 435px);overflow-y:auto;overflow-x:clip}.multi-selection__list.sc-ez-multi-selection-list::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";const c=Math.min,h=Math.max,u=Math.round,d=t=>({x:t,y:t}),f={left:"right",right:"left",bottom:"top",top:"bottom"},p={start:"end",end:"start"};function m(t,e,i){return h(t,c(e,i))}function v(t,e){return"function"==typeof t?t(e):t}function b(t){return t.split("-")[0]}function g(t){return t.split("-")[1]}function y(t){return"x"===t?"y":"x"}function x(t){return"y"===t?"height":"width"}function w(t){return["top","bottom"].includes(b(t))?"y":"x"}function _(t){return y(w(t))}function z(t){return t.replace(/start|end/g,(t=>p[t]))}function O(t){return t.replace(/left|right|bottom|top/g,(t=>f[t]))}function S(t){const{x:e,y:i,width:n,height:o}=t;return{width:n,height:o,top:i,left:e,right:e+n,bottom:i+o,x:e,y:i}}function k(t,e,i){let{reference:n,floating:o}=t;const s=w(e),r=_(e),l=x(r),a=b(e),c="y"===s,h=n.x+n.width/2-o.width/2,u=n.y+n.height/2-o.height/2,d=n[l]/2-o[l]/2;let f;switch(a){case"top":f={x:h,y:n.y-o.height};break;case"bottom":f={x:h,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:u};break;case"left":f={x:n.x-o.width,y:u};break;default:f={x:n.x,y:n.y}}switch(g(e)){case"start":f[r]-=d*(i&&c?-1:1);break;case"end":f[r]+=d*(i&&c?-1:1)}return f}async function C(t,e){var i;void 0===e&&(e={});const{x:n,y:o,platform:s,rects:r,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:d=!1,padding:f=0}=v(e,t),p=function(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}(f),m=l[d?"floating"===u?"reference":"floating":u],b=S(await s.getClippingRect({element:null==(i=await(null==s.isElement?void 0:s.isElement(m)))||i?m:m.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:h,strategy:a})),g="floating"===u?{x:n,y:o,width:r.floating.width,height:r.floating.height}:r.reference,y=await(null==s.getOffsetParent?void 0:s.getOffsetParent(l.floating)),x=await(null==s.isElement?void 0:s.isElement(y))&&await(null==s.getScale?void 0:s.getScale(y))||{x:1,y:1},w=S(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:g,offsetParent:y,strategy:a}):g);return{top:(b.top-w.top+p.top)/x.y,bottom:(w.bottom-b.bottom+p.bottom)/x.y,left:(b.left-w.left+p.left)/x.x,right:(w.right-b.right+p.right)/x.x}}function A(){return"undefined"!=typeof window}function P(t){return E(t)?(t.nodeName||"").toLowerCase():"#document"}function R(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function T(t){var e;return null==(e=(E(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function E(t){return!!A()&&(t instanceof Node||t instanceof R(t).Node)}function D(t){return!!A()&&(t instanceof Element||t instanceof R(t).Element)}function F(t){return!!A()&&(t instanceof HTMLElement||t instanceof R(t).HTMLElement)}function L(t){return!(!A()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof R(t).ShadowRoot)}function I(t){const{overflow:e,overflowX:i,overflowY:n,display:o}=U(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+i)&&!["inline","contents"].includes(o)}function B(t){return["table","td","th"].includes(P(t))}function N(t){return[":popover-open",":modal"].some((e=>{try{return t.matches(e)}catch(t){return!1}}))}function V(t){const e=j(),i=D(t)?U(t):t;return["transform","translate","scale","rotate","perspective"].some((t=>!!i[t]&&"none"!==i[t]))||!!i.containerType&&"normal"!==i.containerType||!e&&!!i.backdropFilter&&"none"!==i.backdropFilter||!e&&!!i.filter&&"none"!==i.filter||["transform","translate","scale","rotate","perspective","filter"].some((t=>(i.willChange||"").includes(t)))||["paint","layout","strict","content"].some((t=>(i.contain||"").includes(t)))}function j(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function M(t){return["html","body","#document"].includes(P(t))}function U(t){return R(t).getComputedStyle(t)}function $(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function G(t){if("html"===P(t))return t;const e=t.assignedSlot||t.parentNode||L(t)&&t.host||T(t);return L(e)?e.host:e}function W(t){const e=G(t);return M(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&I(e)?e:W(e)}function Y(t,e,i){var n;void 0===e&&(e=[]),void 0===i&&(i=!0);const o=W(t),s=o===(null==(n=t.ownerDocument)?void 0:n.body),r=R(o);if(s){const t=H(r);return e.concat(r,r.visualViewport||[],I(o)?o:[],t&&i?Y(t):[])}return e.concat(o,Y(o,[],i))}function H(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function X(t){const e=U(t);let i=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const o=F(t),s=o?t.offsetWidth:i,r=o?t.offsetHeight:n,l=u(i)!==s||u(n)!==r;return l&&(i=s,n=r),{width:i,height:n,$:l}}function q(t){return D(t)?t:t.contextElement}function J(t){const e=q(t);if(!F(e))return d(1);const i=e.getBoundingClientRect(),{width:n,height:o,$:s}=X(e);let r=(s?u(i.width):i.width)/n,l=(s?u(i.height):i.height)/o;return r&&Number.isFinite(r)||(r=1),l&&Number.isFinite(l)||(l=1),{x:r,y:l}}const K=d(0);function Q(t){const e=R(t);return j()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:K}function Z(t,e,i,n){void 0===e&&(e=!1),void 0===i&&(i=!1);const o=t.getBoundingClientRect(),s=q(t);let r=d(1);e&&(n?D(n)&&(r=J(n)):r=J(t));const l=function(t,e,i){return void 0===e&&(e=!1),!(!i||e&&i!==R(t))&&e}(s,i,n)?Q(s):d(0);let a=(o.left+l.x)/r.x,c=(o.top+l.y)/r.y,h=o.width/r.x,u=o.height/r.y;if(s){const t=R(s),e=n&&D(n)?R(n):n;let i=t,o=H(i);for(;o&&n&&e!==i;){const t=J(o),e=o.getBoundingClientRect(),n=U(o),s=e.left+(o.clientLeft+parseFloat(n.paddingLeft))*t.x,r=e.top+(o.clientTop+parseFloat(n.paddingTop))*t.y;a*=t.x,c*=t.y,h*=t.x,u*=t.y,a+=s,c+=r,i=R(o),o=H(i)}}return S({width:h,height:u,x:a,y:c})}function tt(t,e){const i=$(t).scrollLeft;return e?e.left+i:Z(T(t)).left+i}function et(t,e,i){void 0===i&&(i=!1);const n=t.getBoundingClientRect();return{x:n.left+e.scrollLeft-(i?0:tt(t,n)),y:n.top+e.scrollTop}}function it(t,e,i){let n;if("viewport"===e)n=function(t,e){const i=R(t),n=T(t),o=i.visualViewport;let s=n.clientWidth,r=n.clientHeight,l=0,a=0;if(o){s=o.width,r=o.height;const t=j();(!t||t&&"fixed"===e)&&(l=o.offsetLeft,a=o.offsetTop)}return{width:s,height:r,x:l,y:a}}(t,i);else if("document"===e)n=function(t){const e=T(t),i=$(t),n=t.ownerDocument.body,o=h(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=h(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let r=-i.scrollLeft+tt(t);const l=-i.scrollTop;return"rtl"===U(n).direction&&(r+=h(e.clientWidth,n.clientWidth)-o),{width:o,height:s,x:r,y:l}}(T(t));else if(D(e))n=function(t,e){const i=Z(t,!0,"fixed"===e),n=i.top+t.clientTop,o=i.left+t.clientLeft,s=F(t)?J(t):d(1);return{width:t.clientWidth*s.x,height:t.clientHeight*s.y,x:o*s.x,y:n*s.y}}(e,i);else{const i=Q(t);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return S(n)}function nt(t,e){const i=G(t);return!(i===e||!D(i)||M(i))&&("fixed"===U(i).position||nt(i,e))}function ot(t,e,i){const n=F(e),o=T(e),s="fixed"===i,r=Z(t,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=d(0);if(n||!n&&!s)if(("body"!==P(e)||I(o))&&(l=$(e)),n){const t=Z(e,!0,s,e);a.x=t.x+e.clientLeft,a.y=t.y+e.clientTop}else o&&(a.x=tt(o));const c=!o||n||s?d(0):et(o,l);return{x:r.left+l.scrollLeft-a.x-c.x,y:r.top+l.scrollTop-a.y-c.y,width:r.width,height:r.height}}function st(t){return"static"===U(t).position}function rt(t,e){if(!F(t)||"fixed"===U(t).position)return null;if(e)return e(t);let i=t.offsetParent;return T(t)===i&&(i=i.ownerDocument.body),i}function lt(t,e){const i=R(t);if(N(t))return i;if(!F(t)){let e=G(t);for(;e&&!M(e);){if(D(e)&&!st(e))return e;e=G(e)}return i}let n=rt(t,e);for(;n&&B(n)&&st(n);)n=rt(n,e);return n&&M(n)&&st(n)&&!V(n)?i:n||function(t){let e=G(t);for(;F(e)&&!M(e);){if(V(e))return e;if(N(e))return null;e=G(e)}return null}(t)||i}const at={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:i,offsetParent:n,strategy:o}=t;const s="fixed"===o,r=T(n),l=!!e&&N(e.floating);if(n===r||l&&s)return i;let a={scrollLeft:0,scrollTop:0},c=d(1);const h=d(0),u=F(n);if((u||!u&&!s)&&(("body"!==P(n)||I(r))&&(a=$(n)),F(n))){const t=Z(n);c=J(n),h.x=t.x+n.clientLeft,h.y=t.y+n.clientTop}const f=!r||u||s?d(0):et(r,a,!0);return{width:i.width*c.x,height:i.height*c.y,x:i.x*c.x-a.scrollLeft*c.x+h.x+f.x,y:i.y*c.y-a.scrollTop*c.y+h.y+f.y}},getDocumentElement:T,getClippingRect:function(t){let{element:e,boundary:i,rootBoundary:n,strategy:o}=t;const s=[..."clippingAncestors"===i?N(e)?[]:function(t,e){const i=e.get(t);if(i)return i;let n=Y(t,[],!1).filter((t=>D(t)&&"body"!==P(t))),o=null;const s="fixed"===U(t).position;let r=s?G(t):t;for(;D(r)&&!M(r);){const e=U(r),i=V(r);i||"fixed"!==e.position||(o=null),(s?!i&&!o:!i&&"static"===e.position&&o&&["absolute","fixed"].includes(o.position)||I(r)&&!i&&nt(t,r))?n=n.filter((t=>t!==r)):o=e,r=G(r)}return e.set(t,n),n}(e,this._c):[].concat(i),n],r=s.reduce(((t,i)=>{const n=it(e,i,o);return t.top=h(n.top,t.top),t.right=c(n.right,t.right),t.bottom=c(n.bottom,t.bottom),t.left=h(n.left,t.left),t}),it(e,s[0],o));return{width:r.right-r.left,height:r.bottom-r.top,x:r.left,y:r.top}},getOffsetParent:lt,getElementRects:async function(t){const e=this.getOffsetParent||lt,i=this.getDimensions,n=await i(t.floating);return{reference:ot(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:i}=X(t);return{width:e,height:i}},getScale:J,isElement:D,isRTL:function(t){return"rtl"===U(t).direction}},ct=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:i,y:n,placement:o}=e,{mainAxis:s=!0,crossAxis:r=!1,limiter:l={fn:t=>{let{x:e,y:i}=t;return{x:e,y:i}}},...a}=v(t,e),c={x:i,y:n},h=await C(e,a),u=w(b(o)),d=y(u);let f=c[d],p=c[u];s&&(f=m(f+h["y"===d?"top":"left"],f,f-h["y"===d?"bottom":"right"])),r&&(p=m(p+h["y"===u?"top":"left"],p,p-h["y"===u?"bottom":"right"]));const g=l.fn({...e,[d]:f,[u]:p});return{...g,data:{x:g.x-i,y:g.y-n,enabled:{[d]:s,[u]:r}}}}}},ht=class{constructor(i){t(this,i),this.ezVisibilityChange=e(this,"ezVisibilityChange",7),this.TIME_DEBOUNCE=500,this.autoClose=!0,this.boxWidth="fit-content",this.opened=!1,this.overlayType="light",this.anchorElement=void 0,this.options={horizontalGap:0,verticalGap:0,fromRight:!1}}async observeOpened(t,e){if(t!==e)return t?this.openPopover():this.hidePopover(),void this.ezVisibilityChange.emit(t)}async updatePosition(t,e){this.updateOptionPosition(t,e),await this.updatePositionPopover()}async show(t,e){this.updateOptionPosition(t,e),this.opened=!0}async showUnder(t,e){e&&(this.options=e),this.anchorElement=t,this.opened=!0}async hide(){this.opened=!1}async setOptions(t){Object.assign(this.options,t)}async setAnchorElement(t){this.anchorElement=t}parseSizePixel(t,e){return t?"string"==typeof t?Number(t.replace("px","")):null!=t?t:0:null!=e?e:0}updateOptionPosition(t,e){Object.assign(this.options,{horizontalGap:this.parseSizePixel(e,this.options.horizontalGap),verticalGap:this.parseSizePixel(t,this.options.verticalGap)})}async updatePositionPopover(){var t;this._box&&this.opened&&(this.anchorElement||(this.anchorElement=this._host),"string"==typeof this.anchorElement&&(this.anchorElement=document.getElementById(this.anchorElement)),await((t,e,i)=>{const n=new Map,o={platform:at,...i},s={...o.platform,_c:n};return(async(t,e,i)=>{const{placement:n="bottom",strategy:o="absolute",middleware:s=[],platform:r}=i,l=s.filter(Boolean),a=await(null==r.isRTL?void 0:r.isRTL(e));let c=await r.getElementRects({reference:t,floating:e,strategy:o}),{x:h,y:u}=k(c,n,a),d=n,f={},p=0;for(let i=0;i<l.length;i++){const{name:s,fn:m}=l[i],{x:v,y:b,data:g,reset:y}=await m({x:h,y:u,initialPlacement:n,placement:d,strategy:o,middlewareData:f,rects:c,platform:r,elements:{reference:t,floating:e}});h=null!=v?v:h,u=null!=b?b:u,f={...f,[s]:{...f[s],...g}},y&&p<=50&&(p++,"object"==typeof y&&(y.placement&&(d=y.placement),y.rects&&(c=!0===y.rects?await r.getElementRects({reference:t,floating:e,strategy:o}):y.rects),({x:h,y:u}=k(c,d,a))),i=-1)}return{x:h,y:u,placement:d,strategy:o,middlewareData:f}})(t,e,{...o,platform:s})})(this.anchorElement,this._box,{placement:this.options.fromRight?"bottom-end":"bottom-start",middleware:[(void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var i,n;const{placement:o,middlewareData:s,rects:r,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:h=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=v(t,e);if(null!=(i=s.arrow)&&i.alignmentOffset)return{};const S=b(o),k=w(l),A=b(l)===l,P=await(null==a.isRTL?void 0:a.isRTL(c.floating)),R=d||(A||!m?[O(l)]:function(t){const e=O(t);return[z(t),e,z(e)]}(l)),T="none"!==p;!d&&T&&R.push(...function(t,e,i,n){const o=g(t);let s=function(t,e,i){const n=["left","right"],o=["right","left"],s=["top","bottom"],r=["bottom","top"];switch(t){case"top":case"bottom":return i?e?o:n:e?n:o;case"left":case"right":return e?s:r;default:return[]}}(b(t),"start"===i,n);return o&&(s=s.map((t=>t+"-"+o)),e&&(s=s.concat(s.map(z)))),s}(l,m,p,P));const E=[l,...R],D=await C(e,y),F=[];let L=(null==(n=s.flip)?void 0:n.overflows)||[];if(h&&F.push(D[S]),u){const t=function(t,e,i){void 0===i&&(i=!1);const n=g(t),o=_(t),s=x(o);let r="x"===o?n===(i?"end":"start")?"right":"left":"start"===n?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=O(r)),[r,O(r)]}(o,r,P);F.push(D[t[0]],D[t[1]])}if(L=[...L,{placement:o,overflows:F}],!F.every((t=>t<=0))){var I,B;const t=((null==(I=s.flip)?void 0:I.index)||0)+1,e=E[t];if(e)return{data:{index:t,overflows:L},reset:{placement:e}};let i=null==(B=L.filter((t=>t.overflows[0]<=0)).sort(((t,e)=>t.overflows[1]-e.overflows[1]))[0])?void 0:B.placement;if(!i)switch(f){case"bestFit":{var N;const t=null==(N=L.filter((t=>{if(T){const e=w(t.placement);return e===k||"y"===e}return!0})).map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])?void 0:N[0];t&&(i=t);break}case"initialPlacement":i=l}if(o!==i)return{reset:{placement:i}}}return{}}}),ct({padding:5})],strategy:"fixed"}).then((({x:t,y:e,placement:i})=>{const n=i.includes("bottom")?e+this.options.verticalGap:e-this.options.verticalGap,o=i.includes("start")?t+this.options.horizontalGap:t-this.options.horizontalGap;Object.assign(this._box.style,{top:`${n}px`,left:`${o}px`})})))}hidePopover(){this._box&&(this._box.style.display="",this.hideOverlay(),this.ezVisibilityChange.emit(!1))}async openPopover(){this._box&&(this._box.style.display="flex",this._box.style.visibility="hidden",await this.updatePositionPopover(),this.openOverlay(),this.ezVisibilityChange.emit(!0),this._box.style.visibility="visible")}openOverlay(){this._overlay&&this._overlayIsActive&&(this._overlay.style.display="block")}hideOverlay(){this._overlay&&(this._overlay.style.display="none")}checkStatusOverlay(){return"none"!==this.overlayType||!("none"!==this.overlayType||!this.autoClose)}updatePositionDebounce(){this.opened&&(clearTimeout(this._timeoutDebounce),this._timeoutDebounce=setTimeout((()=>{this.updatePositionPopover()}),this.TIME_DEBOUNCE))}componentWillLoad(){window.addEventListener("scroll",this.updatePositionDebounce.bind(this),!0),window.addEventListener("resize",this.updatePositionDebounce.bind(this),!0)}componentDidLoad(){this._overlayIsActive=this.checkStatusOverlay(),this._resizeObserver=new ResizeObserver(this.updatePositionPopover.bind(this)),this._resizeObserver.observe(this._box)}disconnectedCallback(){window.removeEventListener("scroll",this.updatePositionDebounce.bind(this),!0),window.removeEventListener("resize",this.updatePositionDebounce.bind(this),!0),this._resizeObserver.disconnect()}render(){return i(o,null,i("div",{ref:t=>this._overlay=t,onClick:()=>this.hide(),class:`popover__overlay popover__overlay--${this.overlayType}`}),i("section",{ref:t=>this._box=t,class:{popover__box:!0,"popover__box--fit-content":"fit-content"===this.boxWidth,"popover__box--full-width":"fit-content"!==this.boxWidth}},i("slot",null)))}get _host(){return s(this)}static get watchers(){return{opened:["observeOpened"]}}};ht.style=":host{--ez-popover__box--border-radius:var(--border--radius-medium, 12px);--ez-popover__box--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-popover__box--background-color:var(--background--xlight, #fff);--ez-popover__box--z-index:var(--most-visible, 4);position:relative;display:flex;user-select:none}.popover__overlay{display:none;position:fixed;padding:0;top:0px;left:0px;width:100%;height:100vh;box-sizing:border-box;z-index:var(--more-visible--2x, 3)}.popover__overlay--light{background-color:rgba(var(--rgb-background--overlay), var(--opacity--bright))}.popover__overlay--medium{background-color:rgba(var(--rgb-background--overlay), var(--opacity--soft));backdrop-filter:blur(var(--background-blur--medium))}.popover__box{display:none;position:fixed;top:0;left:0;z-index:var(--ez-popover__box--z-index);flex-direction:column;height:fit-content;background-color:var(--ez-popover__box--background-color);border-radius:var(--ez-popover__box--border-radius);box-shadow:var(--ez-popover__box--box-shadow)}.popover__box--fit-content{width:fit-content}.popover__box--full-width{width:calc(100% - 10px)}";export{a as ez_multi_selection_list,ht as ez_popover_plus}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as o,H as e,g as s}from"./p-e4c7eb39.js";import{ObjectUtils as r,FloatingManager as l,StringUtils as a,ElementIDUtils as n}from"@sankhyalabs/core";import"./p-2187f86c.js";import{C as h}from"./p-ec7db713.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-4607fb89.js";const b=class{constructor(o){t(this,o),this.ezChange=i(this,"ezChange",7),this._changeDeboucingTimeout=null,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._textEmptyList="Nenhum resultado encontrado",this._lookupMode=!1,this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._criteria=void 0,this.limitCharsToSearch=3,this.value=void 0,this.label=void 0,this.enabled=!0,this.options=void 0,this.errorMessage=void 0,this.showSelectedValue=!1,this.showOptionValue=!1,this.suppressSearch=!1,this.optionLoader=void 0,this.suppressEmptyOption=!1,this.stopPropagateEnterKeyEvent=!0,this.canShowError=!0,this.mode="regular",this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.autoFocus=!1}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,i){if(this._textInput&&t!=i)try{if("string"==typeof t)return void this.setInputValue();const o=this.getSelectedOption(t),e=this.getSelectedOption(i),s=this.getSelectedOption(this.value);this.isDifferentValues(s,o)&&(this.value=o),this.isDifferentValues(o,e)&&(this.setInputValue(),this._lookupMode||this.ezChange.emit(null===o?void 0:o)),this.resetOptions()}finally{this._lookupMode=!1}}observeOptions(t,i){r.equals(t,i)||this.loadOptions(c.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?t=>{let i=setInterval((()=>{this._showLoading||(clearInterval(i),t(this.value))}),100)}:t=>t(this.value))}async setFocus(t){this._textInput&&this._textInput.setFocus(t)}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}scrollListener(){var t;null!=this._floatingID&&((null===(t=this.listOptionsPosition)||void 0===t?void 0:t.hardPosition)?this.hideOptions():window.requestAnimationFrame((()=>{this.updateListPosition()})))}updateListPosition(){let{verticalPosition:t,horizontalPosition:i,fromBottom:o,fromRight:e,bottomLimit:s,hardPosition:r}=this.getListPosition();const l=this._listWrapper.getBoundingClientRect(),a=this._listContainer.getBoundingClientRect(),n=this._textInput.getBoundingClientRect(),h=s||window.innerHeight;!o&&(l.top<0||a.bottom+l.height>h)&&(o=!0),r||(t=t||0,i=i||0,o?t=window.innerHeight-n.top+t:t+=a.top,e?i=window.innerWidth-n.right+i:i+=a.left),null!=t&&(this._listWrapper.style[o?"bottom":"top"]=`${t}px`,this._listWrapper.style[o?"top":"bottom"]=""),null!=i&&(this._listWrapper.style[e?"right":"left"]=`${i}px`,this._listWrapper.style[e?"left":"right"]="")}getListPosition(){return this.listOptionsPosition?this.listOptionsPosition:{verticalPosition:6}}isDifferentValues(t,i){return r.objectToString(t||{})!==r.objectToString(i||{})}getFormattedText(t){if(null!=t)return this.showSelectedValue&&null!=t.value?t.label?`${t.value} - ${t.label}`:t.value:t.label}getText(){const t=this.getSelectedOption(this.value),i=this.getFormattedText(t);if(null!=i)return String(i).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')}getSelectedOption(t){return"string"==typeof t||t instanceof String?this._visibleOptions.find((i=>i.value===t)):t}updateVisibleOptions(){let t=this._source||[];if(this._criteria){const i=this._criteria.toUpperCase();t=t.filter((t=>t.label.toLocaleUpperCase().indexOf(i)>-1))}this.hasToAddEmptyoption(t)&&(t=[{value:void 0,label:""}].concat(t)),this._visibleOptions=t,this._maxWidthValue=this.getMaxWidthValue()}hasToAddEmptyoption(t){return!this.suppressEmptyOption&&!t.filter((t=>!t.value)).length}getMaxWidthValue(){var t;if(this.showOptionValue){const i=[];return null===(t=this._visibleOptions)||void 0===t||t.forEach((t=>{const o=this.getWidthValue(t.value);i.includes(o)||i.push(o)})),i.length>1?Math.max(...i):0}return 0}getWidthValue(t){if(null!=this._itemValueBasis){const i=this._itemValueBasis;if(null!=t)return i.innerHTML=t,i.clientWidth>0?i.clientWidth+2:0;i.innerHTML=""}return 0}buildItem(t,i){const e=this.showOptionValue&&this._maxWidthValue>0?`${this._maxWidthValue}px`:"";return t.label=t.label||t.value,o("li",{class:i===this._preSelection?"item preselected":"item",id:`item_${t.value}`,onMouseDown:()=>this.selectOption(t),onMouseOver:()=>this._preSelection=i},this.showOptionValue?o("span",{class:"item__value",title:t.value,style:{width:e,minWidth:e,maxWidth:e}},t.value):void 0,o("span",{class:"item__label "+(this.showOptionValue?"item__label--bold":""),title:t.label},t.label))}showOptions(){var t,i;if(!this.enabled)return;if(this.isOptionsVisible())return;const o=null!==(i=null===(t=this.value)||void 0===t?void 0:t.value)&&void 0!==i?i:this.value,e=this._visibleOptions.findIndex((t=>t.value===o));this._preSelection=-1===e?0:e,this._resizeObserver&&this._resizeObserver.observe(this._textInput),this._floatingID=l.float(this._listWrapper,this._listContainer,{autoClose:!0,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&&l.close(this._floatingID),this._floatingID=void 0,this._resizeObserver&&this._resizeObserver.unobserve(this._textInput)}isOptionsVisible(){return void 0!==this._floatingID&&l.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(t){window.requestAnimationFrame((()=>{const i=(null==t?void 0:t.value)?this._optionsList.querySelector(`li#item_${t.value.replace(/[<>\[\]#=]/g,"\\$&").replace(/:/g,"\\:")}`):void 0;i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})}))}selectCurrentOption(t=!0){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection],t),this._preSelection=void 0):this.controlListWithOnlyOne(t)}controlListWithOnlyOne(t=!0){var i;const o=null===(i=this._visibleOptions)||void 0===i?void 0:i.filter((t=>""!==t.label&&null!=t.value));if((null==o?void 0:o.length)>0){let i=a.decodeHtmlEntities(o[0].label);this.selectOption({value:o[0].value,label:i},t)}}updateSource(t){this._startLoading=!1,t instanceof Promise?(this._showLoading=!0,t.then((t=>{this._showLoading=!1,this.updateSource(t)})).catch((()=>this._showLoading=!1)),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(t)?(this._source=t,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1)):this.selectOption(t))}selectOption(t,i=!0){var o,e;const s=this.getSelectedOption(this.value);(null===(o=null==s?void 0:s.value)||void 0===o?void 0:o.toString())!==(null===(e=null==t?void 0:t.value)||void 0===e?void 0:e.toString())||null==s&&null!=t&&"value"in t?this.value=(null==t?void 0:t.value)?t:void 0:this.resetOptions(),i&&setTimeout((()=>{this.setFocus()}),0)}loadOptions(t,i=""){this._criteria=i,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:t,argument:i}):this.options)}cancelPreselection(){!this._textInput.value&&this.value?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue(!1)}),this._deboucingTime)}setInputValue(t=!0){const i=this.getText();(this._textInput.value||"")!==i&&(this._textInput.value=i,t&&(this.errorMessage=null))}clearSearch(){this.value=null}resetOptions(){this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}componentWillLoad(){if(void 0===this.options){this.options=[];const t=this.el.querySelectorAll("option");t&&t.forEach((t=>{let i=t.innerText,o=t.getAttribute("value");o||(o=i),this.options.push({label:i,value:o}),t.hidden=!0}))}this.loadOptions(c.PRELOAD)}componentDidRender(){var t;void 0===this._floatingID&&this._listWrapper.remove(),null===(t=this._optionsList)||void 0===t||t.querySelectorAll(".item").forEach((t=>{n.addIDInfoIfNotExists(t,"itemComboBox")}))}componentDidLoad(){h.applyVarsTextInput(this.el,this._textInput),this.setInputValue(!1),this._resizeObserver=new ResizeObserver((t=>{window.requestAnimationFrame((()=>{if(!Array.isArray(t)||!t.length)return;const{clientWidth:i}=this._listContainer;i>0&&this._listWrapper&&(this._listWrapper.style.width=`${i}px`)}))})),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}handlerIconClick(){this.showOptions()}onTextInputChangeHandler(t){var i;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(t)}),this._deboucingTime));const o=null===(i=t.target.value)||void 0===i?void 0:i.trim();this._criteria||(this._textInput.value=t.data||o),this._criteria=o,o?(this.updateVisibleOptions(),this.showOptions()):(this._preSelection=void 0,this.updateVisibleOptions())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}onTextInputClickHandler(){this.showOptions()}keyDownHandler(t){switch(this._tabPressed=!1,t.ctrlKey&&("f"!==t.key&&"F"!==t.key||(this.loadOptions(c.ADVANCED),t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault())),t.key){case"ArrowDown":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.showOptions(),this.nextOption();break;case"ArrowUp":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.showOptions(),this.previousOption();break;case"Enter":this.handleEventPropagation(t),this.isOptionsVisible()&&this.selectCurrentOption();break;case"Escape":this.isOptionsVisible()&&t.stopPropagation(),this.cancelPreselection(),this.resetOptions();break;case"Tab":this._tabPressed=!0,this.isOptionsVisible()&&this.selectCurrentOption(!1),this.resetOptions()}}handleEventPropagation(t){this._listContainer.hasChildNodes()&&this.stopPropagateEnterKeyEvent&&t.stopPropagation()}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}render(){return n.addIDInfoIfNotExists(this.el,"input"),o(e,null,o("ez-text-input",{"data-element-id":n.getInternalIDInfo("textInput"),class:"text-input-slot-container "+(this.suppressSearch?"suppressed-search-input":""),ref:t=>this._textInput=t,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:t=>this.onTextInputChangeHandler(t),onClick:()=>this.onTextInputClickHandler(),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:t=>this.keyDownHandler(t),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode},o("button",{class:"btn",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},o("ez-icon",{iconName:"chevron-down"}))),o("section",{class:"list-container",ref:t=>this._listContainer=t},o("div",{class:"list-wrapper",ref:t=>this._listWrapper=t},o("ul",{class:"list-options",ref:t=>this._optionsList=t},!this._showLoading&&0===this._visibleOptions.length&&o("div",{class:"message"},o("span",{class:"message__no-result"},this._textEmptyList)),this._showLoading&&o("div",{class:"message"},o("div",{class:"message__loading"})),this.showOptionValue?o("span",{class:"item__value item__value--hidden",ref:t=>this._itemValueBasis=t}):void 0,this.canShowListOptions()&&this._visibleOptions.map(((t,i)=>this.buildItem(t,i)))))))}get el(){return s(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};var c;!function(t){t.ADVANCED="ADVANCED",t.PRELOAD="PRELOAD",t.PREDICTIVE="PREDICTIVE"}(c||(c={})),b.style=":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box__min-width:0px;--ez-combo-box__max-width:100%;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box--line-height:calc(var(--text--medium, 14px) + 4px);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--title--primary, #2B3A54);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #2B3A54);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium) + 4px);--ez-combo-box__list-min-width:64px;--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-combo-box__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-combo-box__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-combo-box__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-combo-box__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__scrollbar--width:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--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-combo-box__list-min-width);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:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small) + 9px);background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-combo-box--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-combo-box__scrollbar--color-clicked) var(--ez-combo-box__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__scrollbar--color-background);width:var(--ez-combo-box__scrollbar--width);max-width:var(--ez-combo-box__scrollbar--width);min-width:var(--ez-combo-box__scrollbar--width)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__scrollbar--color-background);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__scrollbar--color-default);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-combo-box__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-combo-box__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-combo-box--border-radius-small);padding:var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size);line-height:var(--ez-combo-box--line-height)}.item__label{font-weight:var(--ez-combo-box--font-weight--medium)}.item__label--bold{font-weight:var(--ez-combo-box--font-weight--large)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--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-combo-box__list-height)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--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-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;padding:0px;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-combo-box__btn-disabled--color)}.btn:hover{color:var(--ez-combo-box__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}.text-input-slot-container{--ez-text-input__icon--width:32px;--ez-text-input__min-width:var(--ez-combo-box__min-width);--ez-text-input__max-width:var(--ez-combo-box__max-width)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";export{b as ez_combo_box}
|