@sankhyalabs/ezui 5.22.0-dev.44 → 5.22.0-dev.46
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-custom-form-input_2.cjs.entry.js +3 -2
- package/dist/cjs/ez-form.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +40 -7
- package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +3 -2
- package/dist/collection/components/ez-search/ez-search.js +41 -8
- package/dist/collection/utils/form/FormMetadata.js +1 -1
- package/dist/custom-elements/index.js +44 -10
- package/dist/esm/ez-custom-form-input_2.entry.js +3 -2
- package/dist/esm/ez-form.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +40 -7
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-91266ddd.entry.js → p-15d7af92.entry.js} +1 -1
- package/dist/ezui/p-3de9a663.entry.js +1 -0
- package/dist/ezui/p-dc8b36c3.entry.js +1 -0
- package/dist/types/components/ez-search/ez-search.d.ts +4 -1
- package/package.json +1 -1
- package/dist/ezui/p-10820c20.entry.js +0 -1
- package/dist/ezui/p-3dd919b7.entry.js +0 -1
|
@@ -65,7 +65,7 @@ const EzCustomFormInput = class {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
getContent() {
|
|
68
|
-
var _a, _b;
|
|
68
|
+
var _a, _b, _c, _d, _e;
|
|
69
69
|
const fieldProps = new Map();
|
|
70
70
|
for (const prop in this.formViewField.props) {
|
|
71
71
|
fieldProps.set(prop, this.formViewField.props[prop]);
|
|
@@ -103,7 +103,8 @@ const EzCustomFormInput = class {
|
|
|
103
103
|
if (typeof gui === 'string') {
|
|
104
104
|
gui = core.HTMLBuilder.parseElement(gui);
|
|
105
105
|
}
|
|
106
|
-
|
|
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);
|
|
107
108
|
this.gui = index.h("div", { key: core.StringUtils.generateUUID(), ref: el => el && el.appendChild(gui) });
|
|
108
109
|
}
|
|
109
110
|
setValue(value) {
|
|
@@ -105,7 +105,7 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
const descriptor = dataUnit.getField(field.name);
|
|
108
|
-
if (descriptor && tabConfig.visible) {
|
|
108
|
+
if (descriptor && descriptor.visible && tabConfig.visible) {
|
|
109
109
|
if (!sheets.has(tabConfig)) {
|
|
110
110
|
sheets.set(tabConfig, []);
|
|
111
111
|
}
|
|
@@ -50,7 +50,7 @@ const EzSearch = class {
|
|
|
50
50
|
this.options = undefined;
|
|
51
51
|
this.suppressSearch = false;
|
|
52
52
|
this.ensureClearButtonVisible = false;
|
|
53
|
-
this.suppressPreLoad =
|
|
53
|
+
this.suppressPreLoad = true;
|
|
54
54
|
this.autoFocus = false;
|
|
55
55
|
}
|
|
56
56
|
observeErrorMessage() {
|
|
@@ -62,12 +62,25 @@ const EzSearch = class {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
getValue(val) {
|
|
66
|
+
return typeof val === 'object' ? val === null || val === void 0 ? void 0 : val.value : val;
|
|
67
|
+
}
|
|
65
68
|
validateNewValue(newValue, oldValue) {
|
|
66
|
-
const
|
|
67
|
-
|
|
69
|
+
const parsedNewValue = this.getValue(newValue);
|
|
70
|
+
const parsedOldValue = this.getValue(oldValue);
|
|
71
|
+
const newValueIsValid = parsedNewValue !== "[object Object]" && !!parsedNewValue;
|
|
72
|
+
const oldValueIsValid = parsedOldValue !== "[object Object]" && !!parsedOldValue;
|
|
73
|
+
const valuesIsDifferent = parsedNewValue !== parsedOldValue;
|
|
74
|
+
if (!oldValueIsValid && newValueIsValid) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
if (newValueIsValid && oldValueIsValid && valuesIsDifferent) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
68
81
|
}
|
|
69
82
|
async observeValue(newValue, oldValue) {
|
|
70
|
-
if (this._textInput &&
|
|
83
|
+
if (this._textInput && this.validateNewValue(newValue, oldValue)) {
|
|
71
84
|
if (typeof newValue === "string") {
|
|
72
85
|
await this.handleValueAsString(newValue);
|
|
73
86
|
return;
|
|
@@ -155,6 +168,9 @@ const EzSearch = class {
|
|
|
155
168
|
return;
|
|
156
169
|
}
|
|
157
170
|
await this.loadDescriptionValue(value);
|
|
171
|
+
if (!this._currentValue) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
158
174
|
this.setInputValue();
|
|
159
175
|
this.ezChange.emit(this.value);
|
|
160
176
|
this._currentValue = this.value;
|
|
@@ -210,7 +226,7 @@ const EzSearch = class {
|
|
|
210
226
|
return;
|
|
211
227
|
}
|
|
212
228
|
let text = (!this.showSelectedValue || currentValue.value == undefined) ? currentValue.label : currentValue.label ? `${currentValue.value} - ${currentValue.label}` : currentValue.value;
|
|
213
|
-
text = text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
|
|
229
|
+
text = text === null || text === void 0 ? void 0 : text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
|
|
214
230
|
return text;
|
|
215
231
|
}
|
|
216
232
|
getText() {
|
|
@@ -537,6 +553,19 @@ const EzSearch = class {
|
|
|
537
553
|
this._preSelection = undefined;
|
|
538
554
|
this.updateVisibleOptions();
|
|
539
555
|
}
|
|
556
|
+
async handleInitialValue() {
|
|
557
|
+
const valueIsValid = !!this.getValue(this.value);
|
|
558
|
+
if (!valueIsValid) {
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
if (typeof this.value === "string") {
|
|
562
|
+
await this.handleValueAsString(this.value);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
let text = this.getFormattedText(this.value);
|
|
566
|
+
text = this.replaceQuotes(text);
|
|
567
|
+
this._textInput.value = text;
|
|
568
|
+
}
|
|
540
569
|
//---------------------------------------------
|
|
541
570
|
// Lifecycle web component
|
|
542
571
|
//---------------------------------------------
|
|
@@ -568,10 +597,9 @@ const EzSearch = class {
|
|
|
568
597
|
core.ElementIDUtils.addIDInfoIfNotExists(elem, "itemSearch");
|
|
569
598
|
});
|
|
570
599
|
}
|
|
571
|
-
componentDidLoad() {
|
|
600
|
+
async componentDidLoad() {
|
|
572
601
|
this._currentValue = this.value;
|
|
573
602
|
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
|
|
574
|
-
this.setInputValue(false);
|
|
575
603
|
this._resizeObserver = new ResizeObserver((entries) => {
|
|
576
604
|
window.requestAnimationFrame(() => {
|
|
577
605
|
if (!Array.isArray(entries) || !entries.length)
|
|
@@ -582,12 +610,17 @@ const EzSearch = class {
|
|
|
582
610
|
}
|
|
583
611
|
});
|
|
584
612
|
});
|
|
613
|
+
await this.handleInitialValue();
|
|
585
614
|
if (this.autoFocus) {
|
|
586
615
|
requestAnimationFrame(() => {
|
|
587
616
|
this.setFocus({ selectText: true });
|
|
588
617
|
});
|
|
589
618
|
}
|
|
590
619
|
}
|
|
620
|
+
disconnectedCallback() {
|
|
621
|
+
var _a;
|
|
622
|
+
(_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
623
|
+
}
|
|
591
624
|
//---------------------------------------------
|
|
592
625
|
// Event handlers
|
|
593
626
|
//---------------------------------------------
|
|
@@ -56,7 +56,7 @@ export class EzCustomFormInput {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
getContent() {
|
|
59
|
-
var _a, _b;
|
|
59
|
+
var _a, _b, _c, _d, _e;
|
|
60
60
|
const fieldProps = new Map();
|
|
61
61
|
for (const prop in this.formViewField.props) {
|
|
62
62
|
fieldProps.set(prop, this.formViewField.props[prop]);
|
|
@@ -94,7 +94,8 @@ export class EzCustomFormInput {
|
|
|
94
94
|
if (typeof gui === 'string') {
|
|
95
95
|
gui = HTMLBuilder.parseElement(gui);
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
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 : '';
|
|
98
|
+
gui.setAttribute('value', value);
|
|
98
99
|
this.gui = h("div", { key: StringUtils.generateUUID(), ref: el => el && el.appendChild(gui) });
|
|
99
100
|
}
|
|
100
101
|
setValue(value) {
|
|
@@ -38,7 +38,7 @@ export class EzSearch {
|
|
|
38
38
|
this.options = undefined;
|
|
39
39
|
this.suppressSearch = false;
|
|
40
40
|
this.ensureClearButtonVisible = false;
|
|
41
|
-
this.suppressPreLoad =
|
|
41
|
+
this.suppressPreLoad = true;
|
|
42
42
|
this.autoFocus = false;
|
|
43
43
|
}
|
|
44
44
|
observeErrorMessage() {
|
|
@@ -50,12 +50,25 @@ export class EzSearch {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
getValue(val) {
|
|
54
|
+
return typeof val === 'object' ? val === null || val === void 0 ? void 0 : val.value : val;
|
|
55
|
+
}
|
|
53
56
|
validateNewValue(newValue, oldValue) {
|
|
54
|
-
const
|
|
55
|
-
|
|
57
|
+
const parsedNewValue = this.getValue(newValue);
|
|
58
|
+
const parsedOldValue = this.getValue(oldValue);
|
|
59
|
+
const newValueIsValid = parsedNewValue !== "[object Object]" && !!parsedNewValue;
|
|
60
|
+
const oldValueIsValid = parsedOldValue !== "[object Object]" && !!parsedOldValue;
|
|
61
|
+
const valuesIsDifferent = parsedNewValue !== parsedOldValue;
|
|
62
|
+
if (!oldValueIsValid && newValueIsValid) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
if (newValueIsValid && oldValueIsValid && valuesIsDifferent) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
56
69
|
}
|
|
57
70
|
async observeValue(newValue, oldValue) {
|
|
58
|
-
if (this._textInput &&
|
|
71
|
+
if (this._textInput && this.validateNewValue(newValue, oldValue)) {
|
|
59
72
|
if (typeof newValue === "string") {
|
|
60
73
|
await this.handleValueAsString(newValue);
|
|
61
74
|
return;
|
|
@@ -143,6 +156,9 @@ export class EzSearch {
|
|
|
143
156
|
return;
|
|
144
157
|
}
|
|
145
158
|
await this.loadDescriptionValue(value);
|
|
159
|
+
if (!this._currentValue) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
146
162
|
this.setInputValue();
|
|
147
163
|
this.ezChange.emit(this.value);
|
|
148
164
|
this._currentValue = this.value;
|
|
@@ -198,7 +214,7 @@ export class EzSearch {
|
|
|
198
214
|
return;
|
|
199
215
|
}
|
|
200
216
|
let text = (!this.showSelectedValue || currentValue.value == undefined) ? currentValue.label : currentValue.label ? `${currentValue.value} - ${currentValue.label}` : currentValue.value;
|
|
201
|
-
text = text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
|
|
217
|
+
text = text === null || text === void 0 ? void 0 : text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
|
|
202
218
|
return text;
|
|
203
219
|
}
|
|
204
220
|
getText() {
|
|
@@ -525,6 +541,19 @@ export class EzSearch {
|
|
|
525
541
|
this._preSelection = undefined;
|
|
526
542
|
this.updateVisibleOptions();
|
|
527
543
|
}
|
|
544
|
+
async handleInitialValue() {
|
|
545
|
+
const valueIsValid = !!this.getValue(this.value);
|
|
546
|
+
if (!valueIsValid) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
if (typeof this.value === "string") {
|
|
550
|
+
await this.handleValueAsString(this.value);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
let text = this.getFormattedText(this.value);
|
|
554
|
+
text = this.replaceQuotes(text);
|
|
555
|
+
this._textInput.value = text;
|
|
556
|
+
}
|
|
528
557
|
//---------------------------------------------
|
|
529
558
|
// Lifecycle web component
|
|
530
559
|
//---------------------------------------------
|
|
@@ -556,10 +585,9 @@ export class EzSearch {
|
|
|
556
585
|
ElementIDUtils.addIDInfoIfNotExists(elem, "itemSearch");
|
|
557
586
|
});
|
|
558
587
|
}
|
|
559
|
-
componentDidLoad() {
|
|
588
|
+
async componentDidLoad() {
|
|
560
589
|
this._currentValue = this.value;
|
|
561
590
|
CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
|
|
562
|
-
this.setInputValue(false);
|
|
563
591
|
this._resizeObserver = new ResizeObserver((entries) => {
|
|
564
592
|
window.requestAnimationFrame(() => {
|
|
565
593
|
if (!Array.isArray(entries) || !entries.length)
|
|
@@ -570,12 +598,17 @@ export class EzSearch {
|
|
|
570
598
|
}
|
|
571
599
|
});
|
|
572
600
|
});
|
|
601
|
+
await this.handleInitialValue();
|
|
573
602
|
if (this.autoFocus) {
|
|
574
603
|
requestAnimationFrame(() => {
|
|
575
604
|
this.setFocus({ selectText: true });
|
|
576
605
|
});
|
|
577
606
|
}
|
|
578
607
|
}
|
|
608
|
+
disconnectedCallback() {
|
|
609
|
+
var _a;
|
|
610
|
+
(_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
611
|
+
}
|
|
579
612
|
//---------------------------------------------
|
|
580
613
|
// Event handlers
|
|
581
614
|
//---------------------------------------------
|
|
@@ -1070,7 +1103,7 @@ export class EzSearch {
|
|
|
1070
1103
|
},
|
|
1071
1104
|
"attribute": "suppress-pre-load",
|
|
1072
1105
|
"reflect": false,
|
|
1073
|
-
"defaultValue": "
|
|
1106
|
+
"defaultValue": "true"
|
|
1074
1107
|
},
|
|
1075
1108
|
"autoFocus": {
|
|
1076
1109
|
"type": "boolean",
|
|
@@ -97,7 +97,7 @@ export const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
const descriptor = dataUnit.getField(field.name);
|
|
100
|
-
if (descriptor && tabConfig.visible) {
|
|
100
|
+
if (descriptor && descriptor.visible && tabConfig.visible) {
|
|
101
101
|
if (!sheets.has(tabConfig)) {
|
|
102
102
|
sheets.set(tabConfig, []);
|
|
103
103
|
}
|
|
@@ -429,7 +429,7 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
|
429
429
|
return;
|
|
430
430
|
}
|
|
431
431
|
const descriptor = dataUnit.getField(field.name);
|
|
432
|
-
if (descriptor && tabConfig.visible) {
|
|
432
|
+
if (descriptor && descriptor.visible && tabConfig.visible) {
|
|
433
433
|
if (!sheets.has(tabConfig)) {
|
|
434
434
|
sheets.set(tabConfig, []);
|
|
435
435
|
}
|
|
@@ -3536,7 +3536,7 @@ const EzCustomFormInput$1 = class extends HTMLElement$1 {
|
|
|
3536
3536
|
}
|
|
3537
3537
|
}
|
|
3538
3538
|
getContent() {
|
|
3539
|
-
var _a, _b;
|
|
3539
|
+
var _a, _b, _c, _d, _e;
|
|
3540
3540
|
const fieldProps = new Map();
|
|
3541
3541
|
for (const prop in this.formViewField.props) {
|
|
3542
3542
|
fieldProps.set(prop, this.formViewField.props[prop]);
|
|
@@ -3574,7 +3574,8 @@ const EzCustomFormInput$1 = class extends HTMLElement$1 {
|
|
|
3574
3574
|
if (typeof gui === 'string') {
|
|
3575
3575
|
gui = HTMLBuilder.parseElement(gui);
|
|
3576
3576
|
}
|
|
3577
|
-
|
|
3577
|
+
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 : '';
|
|
3578
|
+
gui.setAttribute('value', value);
|
|
3578
3579
|
this.gui = h("div", { key: StringUtils$1.generateUUID(), ref: el => el && el.appendChild(gui) });
|
|
3579
3580
|
}
|
|
3580
3581
|
setValue(value) {
|
|
@@ -73403,7 +73404,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
|
|
|
73403
73404
|
this.options = undefined;
|
|
73404
73405
|
this.suppressSearch = false;
|
|
73405
73406
|
this.ensureClearButtonVisible = false;
|
|
73406
|
-
this.suppressPreLoad =
|
|
73407
|
+
this.suppressPreLoad = true;
|
|
73407
73408
|
this.autoFocus = false;
|
|
73408
73409
|
}
|
|
73409
73410
|
observeErrorMessage() {
|
|
@@ -73415,12 +73416,25 @@ const EzSearch$1 = class extends HTMLElement$1 {
|
|
|
73415
73416
|
}
|
|
73416
73417
|
}
|
|
73417
73418
|
}
|
|
73419
|
+
getValue(val) {
|
|
73420
|
+
return typeof val === 'object' ? val === null || val === void 0 ? void 0 : val.value : val;
|
|
73421
|
+
}
|
|
73418
73422
|
validateNewValue(newValue, oldValue) {
|
|
73419
|
-
const
|
|
73420
|
-
|
|
73423
|
+
const parsedNewValue = this.getValue(newValue);
|
|
73424
|
+
const parsedOldValue = this.getValue(oldValue);
|
|
73425
|
+
const newValueIsValid = parsedNewValue !== "[object Object]" && !!parsedNewValue;
|
|
73426
|
+
const oldValueIsValid = parsedOldValue !== "[object Object]" && !!parsedOldValue;
|
|
73427
|
+
const valuesIsDifferent = parsedNewValue !== parsedOldValue;
|
|
73428
|
+
if (!oldValueIsValid && newValueIsValid) {
|
|
73429
|
+
return true;
|
|
73430
|
+
}
|
|
73431
|
+
if (newValueIsValid && oldValueIsValid && valuesIsDifferent) {
|
|
73432
|
+
return true;
|
|
73433
|
+
}
|
|
73434
|
+
return false;
|
|
73421
73435
|
}
|
|
73422
73436
|
async observeValue(newValue, oldValue) {
|
|
73423
|
-
if (this._textInput &&
|
|
73437
|
+
if (this._textInput && this.validateNewValue(newValue, oldValue)) {
|
|
73424
73438
|
if (typeof newValue === "string") {
|
|
73425
73439
|
await this.handleValueAsString(newValue);
|
|
73426
73440
|
return;
|
|
@@ -73508,6 +73522,9 @@ const EzSearch$1 = class extends HTMLElement$1 {
|
|
|
73508
73522
|
return;
|
|
73509
73523
|
}
|
|
73510
73524
|
await this.loadDescriptionValue(value);
|
|
73525
|
+
if (!this._currentValue) {
|
|
73526
|
+
return;
|
|
73527
|
+
}
|
|
73511
73528
|
this.setInputValue();
|
|
73512
73529
|
this.ezChange.emit(this.value);
|
|
73513
73530
|
this._currentValue = this.value;
|
|
@@ -73563,7 +73580,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
|
|
|
73563
73580
|
return;
|
|
73564
73581
|
}
|
|
73565
73582
|
let text = (!this.showSelectedValue || currentValue.value == undefined) ? currentValue.label : currentValue.label ? `${currentValue.value} - ${currentValue.label}` : currentValue.value;
|
|
73566
|
-
text = text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
|
|
73583
|
+
text = text === null || text === void 0 ? void 0 : text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
|
|
73567
73584
|
return text;
|
|
73568
73585
|
}
|
|
73569
73586
|
getText() {
|
|
@@ -73890,6 +73907,19 @@ const EzSearch$1 = class extends HTMLElement$1 {
|
|
|
73890
73907
|
this._preSelection = undefined;
|
|
73891
73908
|
this.updateVisibleOptions();
|
|
73892
73909
|
}
|
|
73910
|
+
async handleInitialValue() {
|
|
73911
|
+
const valueIsValid = !!this.getValue(this.value);
|
|
73912
|
+
if (!valueIsValid) {
|
|
73913
|
+
return;
|
|
73914
|
+
}
|
|
73915
|
+
if (typeof this.value === "string") {
|
|
73916
|
+
await this.handleValueAsString(this.value);
|
|
73917
|
+
return;
|
|
73918
|
+
}
|
|
73919
|
+
let text = this.getFormattedText(this.value);
|
|
73920
|
+
text = this.replaceQuotes(text);
|
|
73921
|
+
this._textInput.value = text;
|
|
73922
|
+
}
|
|
73893
73923
|
//---------------------------------------------
|
|
73894
73924
|
// Lifecycle web component
|
|
73895
73925
|
//---------------------------------------------
|
|
@@ -73921,10 +73951,9 @@ const EzSearch$1 = class extends HTMLElement$1 {
|
|
|
73921
73951
|
ElementIDUtils.addIDInfoIfNotExists(elem, "itemSearch");
|
|
73922
73952
|
});
|
|
73923
73953
|
}
|
|
73924
|
-
componentDidLoad() {
|
|
73954
|
+
async componentDidLoad() {
|
|
73925
73955
|
this._currentValue = this.value;
|
|
73926
73956
|
CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
|
|
73927
|
-
this.setInputValue(false);
|
|
73928
73957
|
this._resizeObserver = new ResizeObserver((entries) => {
|
|
73929
73958
|
window.requestAnimationFrame(() => {
|
|
73930
73959
|
if (!Array.isArray(entries) || !entries.length)
|
|
@@ -73935,12 +73964,17 @@ const EzSearch$1 = class extends HTMLElement$1 {
|
|
|
73935
73964
|
}
|
|
73936
73965
|
});
|
|
73937
73966
|
});
|
|
73967
|
+
await this.handleInitialValue();
|
|
73938
73968
|
if (this.autoFocus) {
|
|
73939
73969
|
requestAnimationFrame(() => {
|
|
73940
73970
|
this.setFocus({ selectText: true });
|
|
73941
73971
|
});
|
|
73942
73972
|
}
|
|
73943
73973
|
}
|
|
73974
|
+
disconnectedCallback() {
|
|
73975
|
+
var _a;
|
|
73976
|
+
(_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
73977
|
+
}
|
|
73944
73978
|
//---------------------------------------------
|
|
73945
73979
|
// Event handlers
|
|
73946
73980
|
//---------------------------------------------
|
|
@@ -61,7 +61,7 @@ const EzCustomFormInput = class {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
getContent() {
|
|
64
|
-
var _a, _b;
|
|
64
|
+
var _a, _b, _c, _d, _e;
|
|
65
65
|
const fieldProps = new Map();
|
|
66
66
|
for (const prop in this.formViewField.props) {
|
|
67
67
|
fieldProps.set(prop, this.formViewField.props[prop]);
|
|
@@ -99,7 +99,8 @@ const EzCustomFormInput = class {
|
|
|
99
99
|
if (typeof gui === 'string') {
|
|
100
100
|
gui = HTMLBuilder.parseElement(gui);
|
|
101
101
|
}
|
|
102
|
-
|
|
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);
|
|
103
104
|
this.gui = h("div", { key: StringUtils.generateUUID(), ref: el => el && el.appendChild(gui) });
|
|
104
105
|
}
|
|
105
106
|
setValue(value) {
|
|
@@ -101,7 +101,7 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
const descriptor = dataUnit.getField(field.name);
|
|
104
|
-
if (descriptor && tabConfig.visible) {
|
|
104
|
+
if (descriptor && descriptor.visible && tabConfig.visible) {
|
|
105
105
|
if (!sheets.has(tabConfig)) {
|
|
106
106
|
sheets.set(tabConfig, []);
|
|
107
107
|
}
|
|
@@ -46,7 +46,7 @@ const EzSearch = class {
|
|
|
46
46
|
this.options = undefined;
|
|
47
47
|
this.suppressSearch = false;
|
|
48
48
|
this.ensureClearButtonVisible = false;
|
|
49
|
-
this.suppressPreLoad =
|
|
49
|
+
this.suppressPreLoad = true;
|
|
50
50
|
this.autoFocus = false;
|
|
51
51
|
}
|
|
52
52
|
observeErrorMessage() {
|
|
@@ -58,12 +58,25 @@ const EzSearch = class {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
getValue(val) {
|
|
62
|
+
return typeof val === 'object' ? val === null || val === void 0 ? void 0 : val.value : val;
|
|
63
|
+
}
|
|
61
64
|
validateNewValue(newValue, oldValue) {
|
|
62
|
-
const
|
|
63
|
-
|
|
65
|
+
const parsedNewValue = this.getValue(newValue);
|
|
66
|
+
const parsedOldValue = this.getValue(oldValue);
|
|
67
|
+
const newValueIsValid = parsedNewValue !== "[object Object]" && !!parsedNewValue;
|
|
68
|
+
const oldValueIsValid = parsedOldValue !== "[object Object]" && !!parsedOldValue;
|
|
69
|
+
const valuesIsDifferent = parsedNewValue !== parsedOldValue;
|
|
70
|
+
if (!oldValueIsValid && newValueIsValid) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (newValueIsValid && oldValueIsValid && valuesIsDifferent) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
64
77
|
}
|
|
65
78
|
async observeValue(newValue, oldValue) {
|
|
66
|
-
if (this._textInput &&
|
|
79
|
+
if (this._textInput && this.validateNewValue(newValue, oldValue)) {
|
|
67
80
|
if (typeof newValue === "string") {
|
|
68
81
|
await this.handleValueAsString(newValue);
|
|
69
82
|
return;
|
|
@@ -151,6 +164,9 @@ const EzSearch = class {
|
|
|
151
164
|
return;
|
|
152
165
|
}
|
|
153
166
|
await this.loadDescriptionValue(value);
|
|
167
|
+
if (!this._currentValue) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
154
170
|
this.setInputValue();
|
|
155
171
|
this.ezChange.emit(this.value);
|
|
156
172
|
this._currentValue = this.value;
|
|
@@ -206,7 +222,7 @@ const EzSearch = class {
|
|
|
206
222
|
return;
|
|
207
223
|
}
|
|
208
224
|
let text = (!this.showSelectedValue || currentValue.value == undefined) ? currentValue.label : currentValue.label ? `${currentValue.value} - ${currentValue.label}` : currentValue.value;
|
|
209
|
-
text = text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
|
|
225
|
+
text = text === null || text === void 0 ? void 0 : text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
|
|
210
226
|
return text;
|
|
211
227
|
}
|
|
212
228
|
getText() {
|
|
@@ -533,6 +549,19 @@ const EzSearch = class {
|
|
|
533
549
|
this._preSelection = undefined;
|
|
534
550
|
this.updateVisibleOptions();
|
|
535
551
|
}
|
|
552
|
+
async handleInitialValue() {
|
|
553
|
+
const valueIsValid = !!this.getValue(this.value);
|
|
554
|
+
if (!valueIsValid) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (typeof this.value === "string") {
|
|
558
|
+
await this.handleValueAsString(this.value);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
let text = this.getFormattedText(this.value);
|
|
562
|
+
text = this.replaceQuotes(text);
|
|
563
|
+
this._textInput.value = text;
|
|
564
|
+
}
|
|
536
565
|
//---------------------------------------------
|
|
537
566
|
// Lifecycle web component
|
|
538
567
|
//---------------------------------------------
|
|
@@ -564,10 +593,9 @@ const EzSearch = class {
|
|
|
564
593
|
ElementIDUtils.addIDInfoIfNotExists(elem, "itemSearch");
|
|
565
594
|
});
|
|
566
595
|
}
|
|
567
|
-
componentDidLoad() {
|
|
596
|
+
async componentDidLoad() {
|
|
568
597
|
this._currentValue = this.value;
|
|
569
598
|
CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
|
|
570
|
-
this.setInputValue(false);
|
|
571
599
|
this._resizeObserver = new ResizeObserver((entries) => {
|
|
572
600
|
window.requestAnimationFrame(() => {
|
|
573
601
|
if (!Array.isArray(entries) || !entries.length)
|
|
@@ -578,12 +606,17 @@ const EzSearch = class {
|
|
|
578
606
|
}
|
|
579
607
|
});
|
|
580
608
|
});
|
|
609
|
+
await this.handleInitialValue();
|
|
581
610
|
if (this.autoFocus) {
|
|
582
611
|
requestAnimationFrame(() => {
|
|
583
612
|
this.setFocus({ selectText: true });
|
|
584
613
|
});
|
|
585
614
|
}
|
|
586
615
|
}
|
|
616
|
+
disconnectedCallback() {
|
|
617
|
+
var _a;
|
|
618
|
+
(_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
619
|
+
}
|
|
587
620
|
//---------------------------------------------
|
|
588
621
|
// Event handlers
|
|
589
622
|
//---------------------------------------------
|
package/dist/ezui/ezui.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as o}from"./p-23a36bb6.js";export{s as setNonce}from"./p-23a36bb6.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o(JSON.parse('[["p-98dc7ce3",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"selectionToastConfig":[16],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"columnfilterDataSource":[16],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"autoFocus":[4,"auto-focus"],"paginationCounterMode":[1,"pagination-counter-mode"],"enableGridInsert":[4,"enable-grid-insert"],"enableContinuousInsert":[4,"enable-continuous-insert"],"enableLockManger":[4,"enable-lock-manger"],"_paginationInfo":[32],"_paginationChangedByKeyboard":[32],"_showSelectionCounter":[32],"_isAllSelection":[32],"_currentPageSelected":[32],"_selectionCount":[32],"_hasLeftButtons":[32],"_customFormatters":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64],"quickFilter":[64],"locateColumn":[64],"filterColumns":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"refreshSelectedRows":[64],"getCustomValueFormatter":[64],"setFocus":[64],"stopEdit":[64],"checkStopEditOutsideClick":[64]},[[0,"ezSelectionChange","onSelectionChange"],[2,"click","handleClick"]]]]],["p-6e429cff",[[1,"ez-guide-navigator",{"open":[1540],"selectedId":[1537,"selected-id"],"items":[16],"tooltipResolver":[16],"filterText":[32],"disableItem":[64],"openGuideNavidator":[64],"enableItem":[64],"updateItem":[64],"getItem":[64],"getCurrentPath":[64],"selectGuide":[64],"getParent":[64]}]]],["p-09de35a2",[[1,"ez-alert-list",{"alerts":[1040],"enableDragAndDrop":[516,"enable-drag-and-drop"],"enableExpand":[516,"enable-expand"],"itemRightSlotBuilder":[16],"opened":[1540],"expanded":[1540],"_container":[32]}]]],["p-c3045972",[[1,"ez-sidebar-navigator",{"type":[1],"mode":[1025],"size":[1],"isResponsive":[4,"is-responsive"],"titleMenu":[1,"title-menu"],"showCollapseMenu":[4,"show-collapse-menu"],"showFixedButton":[4,"show-fixed-button"],"open":[32],"changeModeMenu":[64],"closeSidebar":[64],"openSidebar":[64]}]]],["p-1e7a8633",[[1,"ez-breadcrumb",{"items":[1040],"fillMode":[1025,"fill-mode"],"maxItems":[1026,"max-items"],"positionEllipsis":[1026,"position-ellipsis"],"visibleItems":[32],"hiddenItems":[32],"showDropdown":[32],"collapseConfigPosition":[32]}]]],["p-7409eeaa",[[1,"ez-split-button",{"enabled":[516],"iconName":[513,"icon-name"],"image":[513],"items":[16],"label":[513],"leftTitle":[513,"left-title"],"rightTitle":[513,"right-title"],"mode":[513],"size":[513],"show":[32],"setBlur":[64],"setLeftButtonFocus":[64],"setRightButtonFocus":[64]},[[2,"click","clickListener"]]]]],["p-bcb53f27",[[1,"ez-actions-button",{"enabled":[516],"actions":[1040],"size":[513],"showLabel":[516,"show-label"],"displayIcon":[513,"display-icon"],"checkOption":[516,"check-option"],"value":[513],"isTransparent":[516,"is-transparent"],"arrowActive":[516,"arrow-active"],"_selectedAction":[32],"hideActions":[64],"showActions":[64],"isOpened":[64]}]]],["p-9ceefe4d",[[1,"ez-dialog",{"confirm":[1028],"dialogType":[1025,"dialog-type"],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"beforeClose":[1040],"show":[64]},[[8,"keydown","handleKeyDown"]]]]],["p-6d79930d",[[6,"ez-modal-container",{"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"showTitleBar":[4,"show-title-bar"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"cancelButtonStatus":[1,"cancel-button-status"],"okButtonStatus":[1,"ok-button-status"],"showCloseButton":[4,"show-close-button"]},[[4,"ezCloseModal","handleEzModalAction"]]]]],["p-90bcd2ba",[[4,"ez-split-item",{"label":[1],"enableExpand":[516,"enable-expand"],"size":[1],"_expanded":[32]}]]],["p-1f50fa05",[[1,"ez-alert",{"alertType":[513,"alert-type"]}]]],["p-650e4b6d",[[1,"ez-badge",{"size":[513],"label":[513],"iconLeft":[513,"icon-left"],"iconRight":[513,"icon-right"],"position":[1040],"hasSlot":[32]}]]],["p-17be134a",[[1,"ez-chip",{"label":[513],"enabled":[516],"removePosition":[513,"remove-position"],"mode":[513],"value":[1540],"showNativeTooltip":[4,"show-native-tooltip"],"setFocus":[64],"setBlur":[64]}]]],["p-555c9018",[[1,"ez-file-item",{"canRemove":[4,"can-remove"],"fileName":[1,"file-name"],"iconName":[1,"icon-name"],"fileSize":[2,"file-size"],"progress":[2]}]]],["p-bc2f844e",[[0,"ez-application"]]],["p-cd2e78f0",[[1,"ez-chart",{"type":[1],"xAxis":[16],"yAxis":[16],"chartTitle":[1,"chart-title"],"chartSubTitle":[1,"chart-sub-title"],"legendEnabled":[4,"legend-enabled"],"series":[16],"width":[2],"height":[2]}]]],["p-5ed81457",[[1,"ez-loading-bar",{"_showLoading":[32],"hide":[64],"show":[64]}]]],["p-fec696ab",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"heightMode":[1,"height-mode"],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"],"closeOutsideLeave":[4,"close-outside-leave"],"scrim":[1]}]]],["p-b54e17d2",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[516,"use-header"],"heightMode":[513,"height-mode"],"ezTitle":[1,"ez-title"],"enabledScroll":[4,"enabled-scroll"]}]]],["p-9f5fa3f9",[[1,"ez-radio-button",{"value":[1544],"options":[1040],"enabled":[516],"label":[513],"direction":[1537]}]]],["p-1285c902",[[0,"ez-split-panel",{"direction":[1],"anchorToExpand":[4,"anchor-to-expand"],"rebuildLayout":[64]}]]],["p-8df1ca33",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["p-44caad9a",[[0,"ez-view-stack",{"show":[64],"getSelectedIndex":[64]}]]],["p-c0d9c4f8",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"_processedTabs":[32],"goToTab":[64]}]]],["p-8888d9ed",[[1,"ez-tree",{"items":[1040],"value":[1040],"selectedId":[1537,"selected-id"],"iconResolver":[16],"tooltipResolver":[16],"_tree":[32],"_waintingForLoad":[32],"selectItem":[64],"openItem":[64],"disableItem":[64],"enableItem":[64],"addChild":[64],"applyFilter":[64],"updateItem":[64],"getItem":[64],"getCurrentPath":[64],"getParent":[64]},[[2,"keydown","onKeyDownListener"]]]]],["p-f9e551de",[[2,"ez-multi-selection-list",{"columnName":[1,"column-name"],"dataSource":[16],"useOptions":[1028,"use-options"],"options":[1040],"isTextSearch":[4,"is-text-search"],"filteredOptions":[32],"displayOptions":[32],"viewScenario":[32],"displayOptionToCheckAllItems":[32],"clearFilteredOptions":[64]}]]],["p-e347df9c",[[1,"ez-collapsible-box",{"value":[1540],"boxBordered":[4,"box-bordered"],"label":[513],"subtitle":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"headerAlign":[513,"header-align"],"removable":[516],"editable":[516],"conditionalSave":[16],"_activeEditText":[32],"showHide":[64],"applyFocusTextEdit":[64],"cancelEdition":[64]}]]],["p-1f830a2f",[[1,"ez-combo-box",{"limitCharsToSearch":[2,"limit-chars-to-search"],"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"stopPropagateEnterKeyEvent":[4,"stop-propagate-enter-key-event"],"canShowError":[516,"can-show-error"],"mode":[513],"hideErrorOnFocusOut":[4,"hide-error-on-focus-out"],"listOptionsPosition":[16],"isTextSearch":[4,"is-text-search"],"autoFocus":[4,"auto-focus"],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32],"_criteria":[32],"getValueAsync":[64],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"clearValue":[64]},[[11,"scroll","scrollListener"]]]]],["p-19098a3f",[[1,"ez-time-input",{"label":[513],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"canShowError":[516,"can-show-error"],"autoFocus":[4,"auto-focus"],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["p-97af4b13",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"canShowError":[516,"can-show-error"],"errorMessage":[1537,"error-message"],"allowNegative":[4,"allow-negative"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"autoFocus":[4,"auto-focus"],"_value":[32],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"getValueAsync":[64]}]]],["p-a80b1287",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"overlayType":[513,"overlay-type"],"updatePosition":[64],"show":[64],"showUnder":[64],"hide":[64]}]]],["p-bfad39eb",[[2,"ez-list",{"dataSource":[1040],"listMode":[1,"list-mode"],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"itemLeftSlotBuilder":[1040],"hoverFeedback":[1028,"hover-feedback"],"_listItems":[32],"_listGroupItems":[32],"clearHistory":[64],"scrollToTop":[64],"setSelection":[64],"getSelection":[64],"getList":[64],"removeSelection":[64]}]]],["p-0306dff7",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"fitHorizontal":[64],"hide":[64]},[[11,"scroll","scrollListener"]]]]],["p-2aa8e4b2",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"errorMessage":[1537,"error-message"],"mask":[1],"cleanValueMask":[4,"clean-value-mask"],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513],"noBorder":[516,"no-border"],"password":[4],"autoFocus":[4,"auto-focus"],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["p-0a75bb05",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"canShowError":[516,"can-show-error"],"autoFocus":[4,"auto-focus"],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"getValueAsync":[64]}]]],["p-ffd246f5",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"canShowError":[516,"can-show-error"],"autoFocus":[4,"auto-focus"],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"getValueAsync":[64]}]]],["p-d0ca26fe",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513],"enableResize":[516,"enable-resize"],"autoRows":[516,"auto-rows"],"autoFocus":[4,"auto-focus"],"appendTextToSelection":[64],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["p-77a4bd35",[[1,"ez-upload",{"label":[1],"subtitle":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["p-990b4318",[[1,"ez-sidebar-button"],[1,"ez-scroller",{"direction":[1],"locked":[4],"activeShadow":[4,"active-shadow"],"isActive":[32]},[[2,"click","clickListener"],[1,"mousedown","mouseDownHandler"],[1,"mouseup","mouseUpHandler"],[1,"mousemove","mouseMoveHandler"]]]]],["p-3dd919b7",[[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"stopPropagateEnterKeyEvent":[4,"stop-propagate-enter-key-event"],"mode":[513],"canShowError":[516,"can-show-error"],"hideErrorOnFocusOut":[4,"hide-error-on-focus-out"],"listOptionsPosition":[16],"isTextSearch":[4,"is-text-search"],"ignoreLimitCharsToSearch":[4,"ignore-limit-chars-to-search"],"options":[1040],"suppressSearch":[4,"suppress-search"],"ensureClearButtonVisible":[4,"ensure-clear-button-visible"],"suppressPreLoad":[4,"suppress-pre-load"],"autoFocus":[4,"auto-focus"],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32],"_showLoadingDescription":[32],"_criteria":[32],"getValueAsync":[64],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"clearValue":[64]},[[11,"scroll","scrollListener"]]]]],["p-7fdd479f",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"indeterminate":[1540],"mode":[513],"compact":[4],"getMode":[64],"setFocus":[64]}]]],["p-7bc07c31",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["p-c4320a39",[[1,"ez-dropdown",{"items":[1040],"value":[1040],"itemBuilder":[16]},[[4,"click","handleClickOutside"]]],[0,"ez-skeleton",{"count":[2],"variant":[1],"width":[1],"height":[1],"marginBottom":[1,"margin-bottom"],"animation":[1]}]]],["p-2bb2a0c4",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]},[[2,"click","clickListener"]]]]],["p-10820c20",[[2,"ez-custom-form-input",{"customEditor":[16],"formViewField":[16],"value":[1032],"detailContext":[1,"detail-context"],"builderFallback":[16],"selectedRecord":[16],"gui":[32],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}],[1,"ez-text-edit",{"value":[1],"styled":[16],"_newValue":[32],"applyFocusSelect":[64]}]]],["p-0db68715",[[0,"multi-selection-box-message",{"message":[1]}],[1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"asyncSearch":[516,"async-search"],"canShowError":[516,"can-show-error"],"autoFocus":[4,"auto-focus"],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"setValue":[64],"endSearch":[64]}],[1,"ez-card-item",{"item":[16],"enableKey":[4,"enable-key"],"compacted":[4]}]]],["p-a5b91a77",[[2,"ez-form-view",{"fields":[16],"selectedRecord":[16],"_customEditors":[32],"showUp":[64],"addCustomEditor":[64],"setFieldProp":[64]}]]],["p-91266ddd",[[2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16],"fieldToFocus":[1,"field-to-focus"],"onlyStaticFields":[4,"only-static-fields"],"_fieldsProps":[32],"validate":[64],"addCustomEditor":[64],"setFieldProp":[64]}]]],["p-baf80b13",[[0,"filter-column",{"opened":[4],"columnName":[1,"column-name"],"columnLabel":[1,"column-label"],"gridHeaderHidden":[4,"grid-header-hidden"],"noHeaderTaskBar":[1028,"no-header-task-bar"],"dataSource":[16],"dataUnit":[16],"options":[1040],"selectedItems":[32],"fieldDescriptor":[32],"useOptions":[32],"isTextSearch":[32],"hide":[64],"show":[64]}]]]]'),e)));
|
|
1
|
+
import{p as e,b as o}from"./p-23a36bb6.js";export{s as setNonce}from"./p-23a36bb6.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o(JSON.parse('[["p-98dc7ce3",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"selectionToastConfig":[16],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"columnfilterDataSource":[16],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"autoFocus":[4,"auto-focus"],"paginationCounterMode":[1,"pagination-counter-mode"],"enableGridInsert":[4,"enable-grid-insert"],"enableContinuousInsert":[4,"enable-continuous-insert"],"enableLockManger":[4,"enable-lock-manger"],"_paginationInfo":[32],"_paginationChangedByKeyboard":[32],"_showSelectionCounter":[32],"_isAllSelection":[32],"_currentPageSelected":[32],"_selectionCount":[32],"_hasLeftButtons":[32],"_customFormatters":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64],"quickFilter":[64],"locateColumn":[64],"filterColumns":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"refreshSelectedRows":[64],"getCustomValueFormatter":[64],"setFocus":[64],"stopEdit":[64],"checkStopEditOutsideClick":[64]},[[0,"ezSelectionChange","onSelectionChange"],[2,"click","handleClick"]]]]],["p-6e429cff",[[1,"ez-guide-navigator",{"open":[1540],"selectedId":[1537,"selected-id"],"items":[16],"tooltipResolver":[16],"filterText":[32],"disableItem":[64],"openGuideNavidator":[64],"enableItem":[64],"updateItem":[64],"getItem":[64],"getCurrentPath":[64],"selectGuide":[64],"getParent":[64]}]]],["p-09de35a2",[[1,"ez-alert-list",{"alerts":[1040],"enableDragAndDrop":[516,"enable-drag-and-drop"],"enableExpand":[516,"enable-expand"],"itemRightSlotBuilder":[16],"opened":[1540],"expanded":[1540],"_container":[32]}]]],["p-c3045972",[[1,"ez-sidebar-navigator",{"type":[1],"mode":[1025],"size":[1],"isResponsive":[4,"is-responsive"],"titleMenu":[1,"title-menu"],"showCollapseMenu":[4,"show-collapse-menu"],"showFixedButton":[4,"show-fixed-button"],"open":[32],"changeModeMenu":[64],"closeSidebar":[64],"openSidebar":[64]}]]],["p-1e7a8633",[[1,"ez-breadcrumb",{"items":[1040],"fillMode":[1025,"fill-mode"],"maxItems":[1026,"max-items"],"positionEllipsis":[1026,"position-ellipsis"],"visibleItems":[32],"hiddenItems":[32],"showDropdown":[32],"collapseConfigPosition":[32]}]]],["p-7409eeaa",[[1,"ez-split-button",{"enabled":[516],"iconName":[513,"icon-name"],"image":[513],"items":[16],"label":[513],"leftTitle":[513,"left-title"],"rightTitle":[513,"right-title"],"mode":[513],"size":[513],"show":[32],"setBlur":[64],"setLeftButtonFocus":[64],"setRightButtonFocus":[64]},[[2,"click","clickListener"]]]]],["p-bcb53f27",[[1,"ez-actions-button",{"enabled":[516],"actions":[1040],"size":[513],"showLabel":[516,"show-label"],"displayIcon":[513,"display-icon"],"checkOption":[516,"check-option"],"value":[513],"isTransparent":[516,"is-transparent"],"arrowActive":[516,"arrow-active"],"_selectedAction":[32],"hideActions":[64],"showActions":[64],"isOpened":[64]}]]],["p-9ceefe4d",[[1,"ez-dialog",{"confirm":[1028],"dialogType":[1025,"dialog-type"],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"beforeClose":[1040],"show":[64]},[[8,"keydown","handleKeyDown"]]]]],["p-6d79930d",[[6,"ez-modal-container",{"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"showTitleBar":[4,"show-title-bar"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"cancelButtonStatus":[1,"cancel-button-status"],"okButtonStatus":[1,"ok-button-status"],"showCloseButton":[4,"show-close-button"]},[[4,"ezCloseModal","handleEzModalAction"]]]]],["p-90bcd2ba",[[4,"ez-split-item",{"label":[1],"enableExpand":[516,"enable-expand"],"size":[1],"_expanded":[32]}]]],["p-1f50fa05",[[1,"ez-alert",{"alertType":[513,"alert-type"]}]]],["p-650e4b6d",[[1,"ez-badge",{"size":[513],"label":[513],"iconLeft":[513,"icon-left"],"iconRight":[513,"icon-right"],"position":[1040],"hasSlot":[32]}]]],["p-17be134a",[[1,"ez-chip",{"label":[513],"enabled":[516],"removePosition":[513,"remove-position"],"mode":[513],"value":[1540],"showNativeTooltip":[4,"show-native-tooltip"],"setFocus":[64],"setBlur":[64]}]]],["p-555c9018",[[1,"ez-file-item",{"canRemove":[4,"can-remove"],"fileName":[1,"file-name"],"iconName":[1,"icon-name"],"fileSize":[2,"file-size"],"progress":[2]}]]],["p-bc2f844e",[[0,"ez-application"]]],["p-cd2e78f0",[[1,"ez-chart",{"type":[1],"xAxis":[16],"yAxis":[16],"chartTitle":[1,"chart-title"],"chartSubTitle":[1,"chart-sub-title"],"legendEnabled":[4,"legend-enabled"],"series":[16],"width":[2],"height":[2]}]]],["p-5ed81457",[[1,"ez-loading-bar",{"_showLoading":[32],"hide":[64],"show":[64]}]]],["p-fec696ab",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"heightMode":[1,"height-mode"],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"],"closeOutsideLeave":[4,"close-outside-leave"],"scrim":[1]}]]],["p-b54e17d2",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[516,"use-header"],"heightMode":[513,"height-mode"],"ezTitle":[1,"ez-title"],"enabledScroll":[4,"enabled-scroll"]}]]],["p-9f5fa3f9",[[1,"ez-radio-button",{"value":[1544],"options":[1040],"enabled":[516],"label":[513],"direction":[1537]}]]],["p-1285c902",[[0,"ez-split-panel",{"direction":[1],"anchorToExpand":[4,"anchor-to-expand"],"rebuildLayout":[64]}]]],["p-8df1ca33",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["p-44caad9a",[[0,"ez-view-stack",{"show":[64],"getSelectedIndex":[64]}]]],["p-c0d9c4f8",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"_processedTabs":[32],"goToTab":[64]}]]],["p-8888d9ed",[[1,"ez-tree",{"items":[1040],"value":[1040],"selectedId":[1537,"selected-id"],"iconResolver":[16],"tooltipResolver":[16],"_tree":[32],"_waintingForLoad":[32],"selectItem":[64],"openItem":[64],"disableItem":[64],"enableItem":[64],"addChild":[64],"applyFilter":[64],"updateItem":[64],"getItem":[64],"getCurrentPath":[64],"getParent":[64]},[[2,"keydown","onKeyDownListener"]]]]],["p-f9e551de",[[2,"ez-multi-selection-list",{"columnName":[1,"column-name"],"dataSource":[16],"useOptions":[1028,"use-options"],"options":[1040],"isTextSearch":[4,"is-text-search"],"filteredOptions":[32],"displayOptions":[32],"viewScenario":[32],"displayOptionToCheckAllItems":[32],"clearFilteredOptions":[64]}]]],["p-e347df9c",[[1,"ez-collapsible-box",{"value":[1540],"boxBordered":[4,"box-bordered"],"label":[513],"subtitle":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"headerAlign":[513,"header-align"],"removable":[516],"editable":[516],"conditionalSave":[16],"_activeEditText":[32],"showHide":[64],"applyFocusTextEdit":[64],"cancelEdition":[64]}]]],["p-1f830a2f",[[1,"ez-combo-box",{"limitCharsToSearch":[2,"limit-chars-to-search"],"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressSearch":[4,"suppress-search"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"stopPropagateEnterKeyEvent":[4,"stop-propagate-enter-key-event"],"canShowError":[516,"can-show-error"],"mode":[513],"hideErrorOnFocusOut":[4,"hide-error-on-focus-out"],"listOptionsPosition":[16],"isTextSearch":[4,"is-text-search"],"autoFocus":[4,"auto-focus"],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32],"_criteria":[32],"getValueAsync":[64],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"clearValue":[64]},[[11,"scroll","scrollListener"]]]]],["p-19098a3f",[[1,"ez-time-input",{"label":[513],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"canShowError":[516,"can-show-error"],"autoFocus":[4,"auto-focus"],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["p-97af4b13",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"canShowError":[516,"can-show-error"],"errorMessage":[1537,"error-message"],"allowNegative":[4,"allow-negative"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"autoFocus":[4,"auto-focus"],"_value":[32],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"getValueAsync":[64]}]]],["p-a80b1287",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"overlayType":[513,"overlay-type"],"updatePosition":[64],"show":[64],"showUnder":[64],"hide":[64]}]]],["p-bfad39eb",[[2,"ez-list",{"dataSource":[1040],"listMode":[1,"list-mode"],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"itemLeftSlotBuilder":[1040],"hoverFeedback":[1028,"hover-feedback"],"_listItems":[32],"_listGroupItems":[32],"clearHistory":[64],"scrollToTop":[64],"setSelection":[64],"getSelection":[64],"getList":[64],"removeSelection":[64]}]]],["p-0306dff7",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"fitHorizontal":[64],"hide":[64]},[[11,"scroll","scrollListener"]]]]],["p-2aa8e4b2",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"errorMessage":[1537,"error-message"],"mask":[1],"cleanValueMask":[4,"clean-value-mask"],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513],"noBorder":[516,"no-border"],"password":[4],"autoFocus":[4,"auto-focus"],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["p-0a75bb05",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"canShowError":[516,"can-show-error"],"autoFocus":[4,"auto-focus"],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"getValueAsync":[64]}]]],["p-ffd246f5",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"canShowError":[516,"can-show-error"],"autoFocus":[4,"auto-focus"],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"getValueAsync":[64]}]]],["p-d0ca26fe",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513],"enableResize":[516,"enable-resize"],"autoRows":[516,"auto-rows"],"autoFocus":[4,"auto-focus"],"appendTextToSelection":[64],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}]]],["p-77a4bd35",[[1,"ez-upload",{"label":[1],"subtitle":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["p-990b4318",[[1,"ez-sidebar-button"],[1,"ez-scroller",{"direction":[1],"locked":[4],"activeShadow":[4,"active-shadow"],"isActive":[32]},[[2,"click","clickListener"],[1,"mousedown","mouseDownHandler"],[1,"mouseup","mouseUpHandler"],[1,"mousemove","mouseMoveHandler"]]]]],["p-3de9a663",[[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"stopPropagateEnterKeyEvent":[4,"stop-propagate-enter-key-event"],"mode":[513],"canShowError":[516,"can-show-error"],"hideErrorOnFocusOut":[4,"hide-error-on-focus-out"],"listOptionsPosition":[16],"isTextSearch":[4,"is-text-search"],"ignoreLimitCharsToSearch":[4,"ignore-limit-chars-to-search"],"options":[1040],"suppressSearch":[4,"suppress-search"],"ensureClearButtonVisible":[4,"ensure-clear-button-visible"],"suppressPreLoad":[4,"suppress-pre-load"],"autoFocus":[4,"auto-focus"],"_preSelection":[32],"_visibleOptions":[32],"_startLoading":[32],"_showLoading":[32],"_showLoadingDescription":[32],"_criteria":[32],"getValueAsync":[64],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"clearValue":[64]},[[11,"scroll","scrollListener"]]]]],["p-7fdd479f",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[1540],"indeterminate":[1540],"mode":[513],"compact":[4],"getMode":[64],"setFocus":[64]}]]],["p-7bc07c31",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["p-c4320a39",[[1,"ez-dropdown",{"items":[1040],"value":[1040],"itemBuilder":[16]},[[4,"click","handleClickOutside"]]],[0,"ez-skeleton",{"count":[2],"variant":[1],"width":[1],"height":[1],"marginBottom":[1,"margin-bottom"],"animation":[1]}]]],["p-2bb2a0c4",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]},[[2,"click","clickListener"]]]]],["p-dc8b36c3",[[2,"ez-custom-form-input",{"customEditor":[16],"formViewField":[16],"value":[1032],"detailContext":[1,"detail-context"],"builderFallback":[16],"selectedRecord":[16],"gui":[32],"setFocus":[64],"setBlur":[64],"isInvalid":[64]}],[1,"ez-text-edit",{"value":[1],"styled":[16],"_newValue":[32],"applyFocusSelect":[64]}]]],["p-0db68715",[[0,"multi-selection-box-message",{"message":[1]}],[1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"asyncSearch":[516,"async-search"],"canShowError":[516,"can-show-error"],"autoFocus":[4,"auto-focus"],"setFocus":[64],"setBlur":[64],"isInvalid":[64],"setValue":[64],"endSearch":[64]}],[1,"ez-card-item",{"item":[16],"enableKey":[4,"enable-key"],"compacted":[4]}]]],["p-a5b91a77",[[2,"ez-form-view",{"fields":[16],"selectedRecord":[16],"_customEditors":[32],"showUp":[64],"addCustomEditor":[64],"setFieldProp":[64]}]]],["p-15d7af92",[[2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16],"fieldToFocus":[1,"field-to-focus"],"onlyStaticFields":[4,"only-static-fields"],"_fieldsProps":[32],"validate":[64],"addCustomEditor":[64],"setFieldProp":[64]}]]],["p-baf80b13",[[0,"filter-column",{"opened":[4],"columnName":[1,"column-name"],"columnLabel":[1,"column-label"],"gridHeaderHidden":[4,"grid-header-hidden"],"noHeaderTaskBar":[1028,"no-header-task-bar"],"dataSource":[16],"dataUnit":[16],"options":[1040],"selectedItems":[32],"fieldDescriptor":[32],"useOptions":[32],"isTextSearch":[32],"hide":[64],"show":[64]}]]]]'),e)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,f as n,H as r,g as s}from"./p-23a36bb6.js";import{DateUtils as o,Action as l,StringUtils as a,DataUnit as h,ElementIDUtils as u}from"@sankhyalabs/core";import{b as c,D as d}from"./p-455e737c.js";import"./p-2187f86c.js";import"./p-ab574d59.js";const f=/child\[([^\]]+)\]/,p=/\$\{.+\}/;class v{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const e=f.exec(t);return e?e[1]:void 0}getSheet(t){return this._sheets.get(t)}getAllSheets(){return this._sheets}addSheet(t){this._sheets.set(t.name,t)}addRequiredFields(t){this._requiredFields=this._requiredFields.concat(t)}getRequiredFields(){return this._requiredFields}addCleanOnCopyFields(t){this._cleanOnCopyFields=this._cleanOnCopyFields.concat(t)}getCleanOnCopyFields(){return this._cleanOnCopyFields}addDefaultValues(t){return this._defaultValues=Object.assign(Object.assign({},this._defaultValues),t)}getDefaultValues(){const t={};return Object.entries(this._defaultValues).forEach((([e,i])=>{if("string"==typeof i){const t=p.exec(i);t&&(i=this.getDefaultVar(t[0]))}t[e]=i})),t}getDefaultVar(t){return"${data}"===t?o.getToday():"${datahora}"===t?o.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const m=(t,e)=>"__main"==t[0].label?-1:(t[0].order||1e4)-(e[0].order||1e4);function b(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var y="function"==typeof Symbol&&Symbol.observable||"@@observable",w=function(){return Math.random().toString(36).substring(7).split("").join(".")},g={INIT:"@@redux/INIT"+w(),REPLACE:"@@redux/REPLACE"+w(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+w()}};function E(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function O(t,e,i){var n;if("function"==typeof e&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(b(0));if("function"==typeof e&&void 0===i&&(i=e,e=void 0),void 0!==i){if("function"!=typeof i)throw new Error(b(1));return i(O)(t,e)}if("function"!=typeof t)throw new Error(b(2));var r=t,s=e,o=[],l=o,a=!1;function h(){l===o&&(l=o.slice())}function u(){if(a)throw new Error(b(3));return s}function c(t){if("function"!=typeof t)throw new Error(b(4));if(a)throw new Error(b(5));var e=!0;return h(),l.push(t),function(){if(e){if(a)throw new Error(b(6));e=!1,h();var i=l.indexOf(t);l.splice(i,1),o=null}}}function d(t){if(!E(t))throw new Error(b(7));if(void 0===t.type)throw new Error(b(8));if(a)throw new Error(b(9));try{a=!0,s=r(s,t)}finally{a=!1}for(var e=o=l,i=0;i<e.length;i++)(0,e[i])();return t}function f(t){if("function"!=typeof t)throw new Error(b(10));r=t,d({type:g.REPLACE})}function p(){var t,e=c;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(b(11));function i(){t.next&&t.next(u())}return i(),{unsubscribe:e(i)}}})[y]=function(){return this},t}return d({type:g.INIT}),(n={dispatch:d,subscribe:c,getState:u,replaceReducer:f})[y]=p,n}const C={};function j(t=C,e){switch(e.type){case F.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:e.payload,currentSheet:void 0});case F.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:e.payload});default:return t}}function _(t){return t.formMetadata}function A(t){const e=function(t){return t.currentSheet}(t);return e?t.formMetadata.getSheet(e):Array.from(t.formMetadata.getAllSheets().values())[0]}var F;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(F||(F={}));const z=class{constructor(i){t(this,i),this.ezFormRequestClearFieldToFocus=e(this,"ezFormRequestClearFieldToFocus",7),this.ezFormSetFields=e(this,"ezFormSetFields",7),this.ezReady=e(this,"ezReady",7),this.formItemsReady=e(this,"formItemsReady",7),this._customEditors=new Map,this.onDataUnitAction=t=>{t.type===l.METADATA_LOADED&&this.processMetadata()},this._fieldsProps=new Map,this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0,this.fieldToFocus=void 0,this.onlyStaticFields=!1}validate(){return this._dataBinder.validate()}async addCustomEditor(t,e,i){if(this._formView)return void this._formView.addCustomEditor(t,e,i);const n=new Map(this._customEditors);n.set(t,{customEditor:e,detailContext:i}),this._customEditors=n}observeConfig(){this.processMetadata()}async setFieldProp(t,e,i){const n=new Map(this._fieldsProps),r=this._fieldsProps.get(t);n.set(t,Object.assign(Object.assign({},r),{[e]:i})),this._fieldsProps=n}getDynamicContent(){var t;const e=_(this._store.getState());if(!e)return null;const n=Array.from(e.getAllSheets().values()),r=A(null===(t=this._store)||void 0===t?void 0:t.getState());let s=[];if(n.length>1){const t=n.map(((t,e)=>({tabKey:t.name,label:t.label,index:e}))),e="selector";s.push(i("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:F.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:r.name,"data-element-id":e}))}return s=s.concat(this.buildFormContent(r)),s}buildFormContent(t){const e=null==t?void 0:t.fields;if(null==t)return;this.ezFormSetFields.emit(e);const n=`${a.replaceAccentuatedChars(a.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return i("div",{class:"dynamic-content","data-element-id":n},i("ez-form-view",{ref:t=>this._formView=t,class:"ez-row ez-padding-vertical--small",fields:e,selectedRecord:this.dataUnit.getSelectedRecord()}))}processMetadata(){if(this.bindFields()&&this.dataUnit&&this._store){const t=((t,e,i=!1)=>{var n,r;null!=t&&!0!==(null==t?void 0:t.emptyConfig)||(t=(t=>{const e=t.metadata;let i;return e&&(i=e.fields.filter((t=>!1!==t.visible)).map((t=>({name:t.name,defaultValue:t.defaultValue})))),{emptyConfig:!1,fields:i}})(e));const s=new Map,o=new Map,l=[],a=[],h={};null===(n=null==t?void 0:t.tabs)||void 0===n||n.forEach((t=>{o.has(t.label)||!1!==t.visible||o.set(t.label,t)})),null===(r=null==t?void 0:t.fields)||void 0===r||r.forEach((t=>{var i,n,r;if(!1!==t.visible){const u=((t,e)=>("string"==typeof t?Array.from(e.keys()).find((e=>e.label===t)):t)||{label:t,visible:!0})(t.tab||"__main",s);if(o.has(u.label))return;const d=e.getField(t.name);if(d&&u.visible){s.has(u)||s.set(u,[]);const e=c(d,t);s.get(u).push(e),e.required&&l.push(t.name),((null==t.cleanOnCopy?null===(i=d.properties)||void 0===i?void 0:i.cleanOnCopy:t.cleanOnCopy)||(null===(n=d.properties)||void 0===n?void 0:n.cleanOnCopy))&&a.push(t.name);let o=null==t.defaultValue?null===(r=d.properties)||void 0===r?void 0:r.defaultValue:t.defaultValue;if(o&&null!=o.value){const{type:e,value:i}=o;if(e)if("V"===e)o=i;else try{const t=JSON.parse(i);o=t&&"value"in t?t:i}catch(t){}h[t.name]=o}}}}));const u=new v;if(u.setDefaultVars(t.defaultVars),i){const t=e.metadata;null!=t&&null!=t.children&&t.children.forEach((t=>{const{label:e,name:i,fields:n}=(t=>({name:`child[${t.name}]`,label:t.label,fields:[]}))(t);s.set({name:i,label:e},n)}))}return Array.from(s.entries()).sort(m).forEach((([t,e])=>{u.addSheet({label:"__main"===t.label?"Principal":t.label,name:t.name||t.label,fields:e})})),u.addRequiredFields(l),u.addCleanOnCopyFields(a),u.addDefaultValues(h),u})(this.config,this.dataUnit);this._store.dispatch({type:F.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}bindFields(){return!this.isStatic()||!1===this.onlyStaticFields}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new h("ez-form")),this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new d(this.dataUnit),this._store=O(j),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),u.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}componentDidRender(){const t=_(this._store.getState());t.addRequiredFields(this._staticFields.filter((t=>t.dataset.required)).map((t=>t.dataset.fieldName))),this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")),this.dataUnit.dataUnitId,t,this.recordsValidator),this.ezReady.emit(),this.handleFieldToFocus(),this.setCustomEditors(),this.setFieldsProps()}setCustomEditors(){if(this._formView)for(const[t,e]of this._customEditors)this._formView.addCustomEditor(t,e.customEditor,e.detailContext),this._customEditors.delete(t)}handleFieldToFocus(){var t;if(null==this.fieldToFocus)return;const e=A(null===(t=this._store)||void 0===t?void 0:t.getState());(null==e?void 0:e.fields).some((t=>t.name===this.fieldToFocus))&&requestAnimationFrame((()=>{this._dataBinder.setFocus(this.fieldToFocus),this.ezFormRequestClearFieldToFocus.emit()}))}setFieldsProps(){if(this._formView)for(const[t,e]of this._fieldsProps){for(const i in e)this._formView.setFieldProp(t,i,e[i]);this._fieldsProps.delete(t)}}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback()}buildIdTabSelector(t){return t&&t.forEach((t=>t[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=a.toCamelCase(t.label))),t}render(){return i(r,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return s(this)}static get watchers(){return{config:["observeConfig"]}}};z.style=".sc-ez-form-h{display:flex;flex-direction:column;width:100%}.dynamic-content.sc-ez-form ez-collapsible-box.sc-ez-form{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{z as ez_form}
|
|
1
|
+
import{r as t,c as e,h as i,f as n,H as r,g as s}from"./p-23a36bb6.js";import{DateUtils as o,Action as l,StringUtils as a,DataUnit as h,ElementIDUtils as u}from"@sankhyalabs/core";import{b as c,D as d}from"./p-455e737c.js";import"./p-2187f86c.js";import"./p-ab574d59.js";const f=/child\[([^\]]+)\]/,p=/\$\{.+\}/;class v{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const e=f.exec(t);return e?e[1]:void 0}getSheet(t){return this._sheets.get(t)}getAllSheets(){return this._sheets}addSheet(t){this._sheets.set(t.name,t)}addRequiredFields(t){this._requiredFields=this._requiredFields.concat(t)}getRequiredFields(){return this._requiredFields}addCleanOnCopyFields(t){this._cleanOnCopyFields=this._cleanOnCopyFields.concat(t)}getCleanOnCopyFields(){return this._cleanOnCopyFields}addDefaultValues(t){return this._defaultValues=Object.assign(Object.assign({},this._defaultValues),t)}getDefaultValues(){const t={};return Object.entries(this._defaultValues).forEach((([e,i])=>{if("string"==typeof i){const t=p.exec(i);t&&(i=this.getDefaultVar(t[0]))}t[e]=i})),t}getDefaultVar(t){return"${data}"===t?o.getToday():"${datahora}"===t?o.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const m=(t,e)=>"__main"==t[0].label?-1:(t[0].order||1e4)-(e[0].order||1e4);function b(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var y="function"==typeof Symbol&&Symbol.observable||"@@observable",w=function(){return Math.random().toString(36).substring(7).split("").join(".")},g={INIT:"@@redux/INIT"+w(),REPLACE:"@@redux/REPLACE"+w(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+w()}};function E(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function O(t,e,i){var n;if("function"==typeof e&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(b(0));if("function"==typeof e&&void 0===i&&(i=e,e=void 0),void 0!==i){if("function"!=typeof i)throw new Error(b(1));return i(O)(t,e)}if("function"!=typeof t)throw new Error(b(2));var r=t,s=e,o=[],l=o,a=!1;function h(){l===o&&(l=o.slice())}function u(){if(a)throw new Error(b(3));return s}function c(t){if("function"!=typeof t)throw new Error(b(4));if(a)throw new Error(b(5));var e=!0;return h(),l.push(t),function(){if(e){if(a)throw new Error(b(6));e=!1,h();var i=l.indexOf(t);l.splice(i,1),o=null}}}function d(t){if(!E(t))throw new Error(b(7));if(void 0===t.type)throw new Error(b(8));if(a)throw new Error(b(9));try{a=!0,s=r(s,t)}finally{a=!1}for(var e=o=l,i=0;i<e.length;i++)(0,e[i])();return t}function f(t){if("function"!=typeof t)throw new Error(b(10));r=t,d({type:g.REPLACE})}function p(){var t,e=c;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(b(11));function i(){t.next&&t.next(u())}return i(),{unsubscribe:e(i)}}})[y]=function(){return this},t}return d({type:g.INIT}),(n={dispatch:d,subscribe:c,getState:u,replaceReducer:f})[y]=p,n}const C={};function j(t=C,e){switch(e.type){case F.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:e.payload,currentSheet:void 0});case F.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:e.payload});default:return t}}function _(t){return t.formMetadata}function A(t){const e=function(t){return t.currentSheet}(t);return e?t.formMetadata.getSheet(e):Array.from(t.formMetadata.getAllSheets().values())[0]}var F;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(F||(F={}));const z=class{constructor(i){t(this,i),this.ezFormRequestClearFieldToFocus=e(this,"ezFormRequestClearFieldToFocus",7),this.ezFormSetFields=e(this,"ezFormSetFields",7),this.ezReady=e(this,"ezReady",7),this.formItemsReady=e(this,"formItemsReady",7),this._customEditors=new Map,this.onDataUnitAction=t=>{t.type===l.METADATA_LOADED&&this.processMetadata()},this._fieldsProps=new Map,this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0,this.fieldToFocus=void 0,this.onlyStaticFields=!1}validate(){return this._dataBinder.validate()}async addCustomEditor(t,e,i){if(this._formView)return void this._formView.addCustomEditor(t,e,i);const n=new Map(this._customEditors);n.set(t,{customEditor:e,detailContext:i}),this._customEditors=n}observeConfig(){this.processMetadata()}async setFieldProp(t,e,i){const n=new Map(this._fieldsProps),r=this._fieldsProps.get(t);n.set(t,Object.assign(Object.assign({},r),{[e]:i})),this._fieldsProps=n}getDynamicContent(){var t;const e=_(this._store.getState());if(!e)return null;const n=Array.from(e.getAllSheets().values()),r=A(null===(t=this._store)||void 0===t?void 0:t.getState());let s=[];if(n.length>1){const t=n.map(((t,e)=>({tabKey:t.name,label:t.label,index:e}))),e="selector";s.push(i("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:F.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:r.name,"data-element-id":e}))}return s=s.concat(this.buildFormContent(r)),s}buildFormContent(t){const e=null==t?void 0:t.fields;if(null==t)return;this.ezFormSetFields.emit(e);const n=`${a.replaceAccentuatedChars(a.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return i("div",{class:"dynamic-content","data-element-id":n},i("ez-form-view",{ref:t=>this._formView=t,class:"ez-row ez-padding-vertical--small",fields:e,selectedRecord:this.dataUnit.getSelectedRecord()}))}processMetadata(){if(this.bindFields()&&this.dataUnit&&this._store){const t=((t,e,i=!1)=>{var n,r;null!=t&&!0!==(null==t?void 0:t.emptyConfig)||(t=(t=>{const e=t.metadata;let i;return e&&(i=e.fields.filter((t=>!1!==t.visible)).map((t=>({name:t.name,defaultValue:t.defaultValue})))),{emptyConfig:!1,fields:i}})(e));const s=new Map,o=new Map,l=[],a=[],h={};null===(n=null==t?void 0:t.tabs)||void 0===n||n.forEach((t=>{o.has(t.label)||!1!==t.visible||o.set(t.label,t)})),null===(r=null==t?void 0:t.fields)||void 0===r||r.forEach((t=>{var i,n,r;if(!1!==t.visible){const u=((t,e)=>("string"==typeof t?Array.from(e.keys()).find((e=>e.label===t)):t)||{label:t,visible:!0})(t.tab||"__main",s);if(o.has(u.label))return;const d=e.getField(t.name);if(d&&d.visible&&u.visible){s.has(u)||s.set(u,[]);const e=c(d,t);s.get(u).push(e),e.required&&l.push(t.name),((null==t.cleanOnCopy?null===(i=d.properties)||void 0===i?void 0:i.cleanOnCopy:t.cleanOnCopy)||(null===(n=d.properties)||void 0===n?void 0:n.cleanOnCopy))&&a.push(t.name);let o=null==t.defaultValue?null===(r=d.properties)||void 0===r?void 0:r.defaultValue:t.defaultValue;if(o&&null!=o.value){const{type:e,value:i}=o;if(e)if("V"===e)o=i;else try{const t=JSON.parse(i);o=t&&"value"in t?t:i}catch(t){}h[t.name]=o}}}}));const u=new v;if(u.setDefaultVars(t.defaultVars),i){const t=e.metadata;null!=t&&null!=t.children&&t.children.forEach((t=>{const{label:e,name:i,fields:n}=(t=>({name:`child[${t.name}]`,label:t.label,fields:[]}))(t);s.set({name:i,label:e},n)}))}return Array.from(s.entries()).sort(m).forEach((([t,e])=>{u.addSheet({label:"__main"===t.label?"Principal":t.label,name:t.name||t.label,fields:e})})),u.addRequiredFields(l),u.addCleanOnCopyFields(a),u.addDefaultValues(h),u})(this.config,this.dataUnit);this._store.dispatch({type:F.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}bindFields(){return!this.isStatic()||!1===this.onlyStaticFields}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new h("ez-form")),this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new d(this.dataUnit),this._store=O(j),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),u.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}componentDidRender(){const t=_(this._store.getState());t.addRequiredFields(this._staticFields.filter((t=>t.dataset.required)).map((t=>t.dataset.fieldName))),this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")),this.dataUnit.dataUnitId,t,this.recordsValidator),this.ezReady.emit(),this.handleFieldToFocus(),this.setCustomEditors(),this.setFieldsProps()}setCustomEditors(){if(this._formView)for(const[t,e]of this._customEditors)this._formView.addCustomEditor(t,e.customEditor,e.detailContext),this._customEditors.delete(t)}handleFieldToFocus(){var t;if(null==this.fieldToFocus)return;const e=A(null===(t=this._store)||void 0===t?void 0:t.getState());(null==e?void 0:e.fields).some((t=>t.name===this.fieldToFocus))&&requestAnimationFrame((()=>{this._dataBinder.setFocus(this.fieldToFocus),this.ezFormRequestClearFieldToFocus.emit()}))}setFieldsProps(){if(this._formView)for(const[t,e]of this._fieldsProps){for(const i in e)this._formView.setFieldProp(t,i,e[i]);this._fieldsProps.delete(t)}}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback()}buildIdTabSelector(t){return t&&t.forEach((t=>t[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=a.toCamelCase(t.label))),t}render(){return i(r,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return s(this)}static get watchers(){return{config:["observeConfig"]}}};z.style=".sc-ez-form-h{display:flex;flex-direction:column;width:100%}.dynamic-content.sc-ez-form ez-collapsible-box.sc-ez-form{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{z as ez_form}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as s,H as e,g as r}from"./p-23a36bb6.js";import{C as o}from"./p-9e11fc7b.js";import{ObjectUtils as a,StringUtils as h,FloatingManager as l,ElementIDUtils as n}from"@sankhyalabs/core";import{A as c}from"./p-2187f86c.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-4607fb89.js";import{R as d}from"./p-05e1f4e7.js";const u=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._textEmptyList="Nenhum resultado encontrado",this._textEmptySearch="Nenhum resultado de {0} encontrado",this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._showLoadingDescription=!1,this._criteria=void 0,this.value=void 0,this.label=void 0,this.enabled=!0,this.errorMessage=void 0,this.optionLoader=void 0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.stopPropagateEnterKeyEvent=!1,this.mode="regular",this.canShowError=!0,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.ignoreLimitCharsToSearch=!1,this.options=void 0,this.suppressSearch=!1,this.ensureClearButtonVisible=!1,this.suppressPreLoad=!0,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.errorMessage&&this.setInputValue())}getValue(t){return"object"==typeof t?null==t?void 0:t.value:t}validateNewValue(t,i){const s=this.getValue(t),e=this.getValue(i),r="[object Object]"!==s&&!!s,o="[object Object]"!==e&&!!e;return!(o||!r)||!(!r||!o||s===e)}async observeValue(t,i){if(this._textInput&&this.validateNewValue(t,i)){if("string"==typeof t)return void await this.handleValueAsString(t);const i=this.getSelectedOption(t),s=this.getSelectedOption(this._currentValue);this.isDifferentValues(s,i)&&(this._currentValue=i,this.setInputValue(),this.ezChange.emit(null!=i?i:void 0)),this.resetOptions()}}observeOptions(t,i){!t.length&&this.suppressPreLoad||(null==t?void 0:t.join(""))!==(null==i?void 0:i.join(""))&&this.loadOptions(v.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()})))}async handleValueAsString(t){this.getSelectedOption(t)?this.setInputValue():(await this.loadDescriptionValue(t),this._currentValue&&(this.setInputValue(),this.ezChange.emit(this.value),this._currentValue=this.value))}updateListPosition(){let{verticalPosition:t,horizontalPosition:i,fromBottom:s,fromRight:e,bottomLimit:r,hardPosition:o}=this.getListPosition();const a=this._listWrapper.getBoundingClientRect(),h=this._listContainer.getBoundingClientRect(),l=this._textInput.getBoundingClientRect(),n=r||window.innerHeight;!s&&(a.top<0||h.bottom+a.height>n)&&(s=!0),o||(t=t||0,i=i||0,s?t=window.innerHeight-l.top+t:t+=h.top,e?i=window.innerWidth-l.right+i:i+=h.left),null!=t&&(this._listWrapper.style[s?"bottom":"top"]=`${t}px`,this._listWrapper.style[s?"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:this.errorMessage||!this.canShowError||"slim"===this.mode?6:-13}}isDifferentValues(t,i){return a.objectToString(t||{})!==a.objectToString(i||{})}getFormattedText(t){if(null==t)return;let i=this.showSelectedValue&&null!=t.value?t.label?`${t.value} - ${t.label}`:t.value:t.label;return i=null==i?void 0:i.replace(new RegExp(this._startHighlightTag,"g"),"").replace(new RegExp(this._endHighlightTag,"g"),""),i}getText(){const t=this.getSelectedOption(this._currentValue),i=this.getFormattedText(t);return this.replaceQuotes(i)}replaceQuotes(t){if(null!=t)return String(t).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?Object.assign(Object.assign({},t),{value:this.replaceHighlight(null==t?void 0:t.value),label:this.replaceHighlight(null==t?void 0:t.label)}):t}updateVisibleOptions(){let t=this._source||[];this._visibleOptions=this.suppressEmptyOption?t:[{value:void 0,label:""}].concat(t),this._maxWidthValue=this.getMaxWidthValue()}getMaxWidthValue(){var t;const i=[];return null===(t=this._visibleOptions)||void 0===t||t.forEach((t=>{const s=this.getWidthValue(t.value);i.includes(s)||i.push(s)})),i.length>1?Math.max(...i):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}createOption(t){let{key:i,title:s}=t;const e=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g");s=h.decodeHtmlEntities(s);const o={value:null==i?void 0:i.replace(e,"").replace(r,""),label:null==s?void 0:s.replace(e,"").replace(r,"")};this.selectOption(o)}buildItem(t,i){t.label=t.label||t.value;const e={key:t.value,title:t.label,details:t.details};return s("div",{style:{height:"100%"},class:i===this._preSelection?"item preselected":"item",id:`item_${t.value}`,onMouseDown:()=>this.createOption(e),onMouseOver:()=>this._preSelection=i},s("ez-card-item",{item:e,compacted:!0,enableKey:this.showOptionValue}))}showOptions(){this.enabled&&(this.isOptionsVisible()||(this._resizeObserver&&this._resizeObserver.observe(this._textInput),this._floatingID=l.float(this._listWrapper,this._listContainer,{autoClose:!1,isFixed:!0,backClickListener:()=>this.hideOptions()}),this.setFocus(),window.requestAnimationFrame((()=>{this.updateListPosition(),this.listOptionsPosition||this._listWrapper.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))))}hideOptions(){void 0!==this._floatingID&&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(`div#item_${t.value.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g,"\\$1")}`):void 0;i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})}))}selectCurrentOption(){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection]),this._preSelection=void 0):this.controlListWithOnlyOne()}updateSource(t){this._startLoading=!1,t instanceof Promise?(this._showLoading=!0,this._showLoadingDescription=!0,t.then((t=>{this.updateSource(t)})).finally((()=>{this._showLoading=!1,this._showLoadingDescription=!1})),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(t)?(this._source=t,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1,this.controlEmptySearch())):this.selectOption(t))}clearSource(){this._source=[],this.updateVisibleOptions()}replaceHighlight(t){const i=new RegExp(this._startHighlightTag,"g"),s=new RegExp(this._endHighlightTag,"g");return String(null!=t?t:"").replace(i,"").replace(s,"")}selectOption(t,i=!0){var s,e;const r=this.getSelectedOption(this.value),o=Object.assign(Object.assign({},t),{value:this.replaceHighlight(null==t?void 0:t.value),label:this.replaceHighlight(null==t?void 0:t.label)}),a=Object.assign(Object.assign({},o),{value:this.replaceQuotes(null==o?void 0:o.value),label:this.replaceQuotes(null==o?void 0:o.label)});if((null===(s=null==r?void 0:r.value)||void 0===s?void 0:s.toString())!==(null===(e=null==a?void 0:a.value)||void 0===e?void 0:e.toString())||null==r&&null!=a&&"value"in a){const t=(null==a?void 0:a.value)?a:void 0;this.value=t,this._currentValue=t}else this.setInputValue(),this.resetOptions();this._visibleOptions=[],this.clearSource(),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._currentValue?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue()}),this._deboucingTime),this.resetOptions()}setInputValue(t=!0){const i=this.getText();(this._textInput.value||"")!==i&&(this._textInput.value=i,t&&(this.errorMessage=null))}clearSearch(){this.value=null,this._currentValue=null}controlListWithOnlyOne(t=!0){var i,s;const e=null===(i=this._visibleOptions)||void 0===i?void 0:i.filter((t=>""!==t.label&&null!=t.value));if((null==e?void 0:e.length)>0){const i=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g");let o=h.decodeHtmlEntities(e[0].label);const a={value:null===(s=e[0].value)||void 0===s?void 0:s.replace(i,"").replace(r,""),label:null==o?void 0:o.replace(i,"").replace(r,"")};this.selectOption(a,t)}}controlEmptySearch(){var t;(null===(t=this._visibleOptions)||void 0===t?void 0:t.length)?this.controlListWithOnlyOne():(this.clearSearch(),c.info(this._textEmptyList))}async loadDescriptionValue(t){var i,s;if(null==t)return;if((null===(i=this.options)||void 0===i?void 0:i.length)>0)return void this.loadOptionValue(t);const e={mode:v.PREDICTIVE,argument:t},r=await(null===(s=this.optionLoader)||void 0===s?void 0:s.call(this,e));null!=r&&(r instanceof Promise?r.then((t=>{this.setDescriptionValue(t)})):this.setDescriptionValue(r))}setDescriptionValue(t){const i=(null==t?void 0:t[0])||t;null!=i&&Object.keys(i).length?(this._currentValue=i?Object.assign(Object.assign({},i),{value:this.replaceHighlight(i.value),label:this.replaceHighlight(i.label)}):i,this.value=this._currentValue,this.setTextInputValue()):this.showNoResultMessage()}setTextInputValue(){if(this._textInput&&null==this._textInput.value){if(null==this.value)return;const t="string"==typeof this.value?this.value:this.getFormattedText(this.value);this._textInput.value=this.replaceQuotes(t)}}loadOptionValue(t){var i;const s=null===(i=this.options)||void 0===i?void 0:i.find((i=>i.value===t));null!=s?this.selectOption(s):this.showNoResultMessage()}async showNoResultMessage(){this.clearSearch(),c.info(this._textEmptySearch.replace("{0}",this.getFieldLabel()))}getFieldLabel(){var t;return null===(t=this.label)||void 0===t?void 0:t.replace(d,"").toUpperCase()}resetOptions(){this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}async handleInitialValue(){if(!this.getValue(this.value))return;if("string"==typeof this.value)return void await this.handleValueAsString(this.value);let t=this.getFormattedText(this.value);t=this.replaceQuotes(t),this._textInput.value=t}componentWillLoad(){if(void 0===this.options){this.options=[];const t=this.el.querySelectorAll("option");t&&t.forEach((t=>{let i=t.innerText,s=t.getAttribute("value"),e=t.getAttribute("details");s||(s=i),this.options.push({label:i,value:s,details:e}),t.hidden=!0}))}this.updateSource([])}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,"itemSearch")}))}async componentDidLoad(){this._currentValue=this.value,o.applyVarsTextInput(this.el,this._textInput),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`)}))})),await this.handleInitialValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}disconnectedCallback(){var t;null===(t=this._resizeObserver)||void 0===t||t.disconnect()}handlerIconClick(){this.loadOptions(v.ADVANCED)}buildNumberArgument(t){return this.isTextSearch?NaN:Number(t||void 0)}onTextInputChangeHandler(t){var i;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(t)}),this._deboucingTime));const s=null===(i=t.target.value)||void 0===i?void 0:i.trim(),e=this.buildNumberArgument(s);this._criteria||(this._textInput.value=t.data||s),this._criteria=s,s?(this._showLoading=!1,this.clearSource(),this.ignoreLimitCharsToSearch||!isNaN(e)||s.length>=this._limitCharsToSearch?(this._showLoading=!0,this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions(v.PREDICTIVE,isNaN(e)?s:e.toString())}),this._deboucingTime),this.showOptions()):this.hideOptions()):(this.hideOptions(),this._showLoading=!1,this.clearSource())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}keyDownHandler(t){switch(this._tabPressed=!1,t.ctrlKey&&("f"!==t.key&&"F"!==t.key||(this.loadOptions(v.ADVANCED),t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault())),t.key){case"ArrowDown":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.nextOption();break;case"ArrowUp":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.previousOption();break;case"Enter":this.handleEventPropagation(t),this.selectCurrentOption();break;case"Escape":this.cancelPreselection();break;case"Tab":this._tabPressed=!0,this.controlListWithOnlyOne(!1)}}handleEventPropagation(t){this._listContainer.hasChildNodes()&&this.stopPropagateEnterKeyEvent&&t.stopPropagation()}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}canShowLoadSpinDescription(){return this._showLoadingDescription&&null==this._floatingID}render(){var t;return n.addIDInfoIfNotExists(this.el,"input"),s(e,null,s("ez-text-input",{"data-element-id":n.getInternalIDInfo("textInput"),class:this.suppressSearch?"suppressed-search-input":"",ref:t=>this._textInput=t,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:t=>this.onTextInputChangeHandler(t),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:t=>this.keyDownHandler(t),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode},s("button",{class:"btn",slot:"leftIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},this.canShowLoadSpinDescription()?s("div",{class:"message__loading"}):s("ez-icon",{iconName:"search"})),(null===(t=this._textInput)||void 0===t?void 0:t.value)&&(this._criteria||this.value)||this.ensureClearButtonVisible?s("button",{class:"btn btn__close",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.clearSearch()},s("ez-icon",{iconName:"close"})):void 0),s("section",{class:"list-container",ref:t=>this._listContainer=t},s("div",{class:"list-wrapper",ref:t=>this._listWrapper=t},s("ul",{class:"list-options",ref:t=>this._optionsList=t},!this._showLoading&&0===this._visibleOptions.length&&s("div",{class:"message"},s("span",{class:"message__no-result"},this._textEmptyList)),this._showLoading&&s("div",{class:"message"},s("div",{class:"message__loading"})),s("span",{class:"item__value item__value--hidden",ref:t=>this._itemValueBasis=t}),this.canShowListOptions()&&this._visibleOptions.map(((t,i)=>this.buildItem(t,i)))))))}get el(){return r(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};var v;!function(t){t.ADVANCED="ADVANCED",t.PRELOAD="PRELOAD",t.PREDICTIVE="PREDICTIVE"}(v||(v={})),u.style=":host{--ez-search--height:42px;--ez-search--width:100%;--ez-search__icon--width:48px;--ez-search--border-radius:var(--border--radius-medium, 12px);--ez-search--border-radius-small:var(--border--radius-small, 6px);--ez-search--font-size:var(--text--medium, 14px);--ez-search--font-family:var(--font-pattern, Arial);--ez-search--font-weight--large:var(--text-weight--large, 500);--ez-search--font-weight--medium:var(--text-weight--medium, 400);--ez-search--background-color--xlight:var(--background--xlight, #fff);--ez-search--background-medium:var(--background--medium, #f0f3f7);--ez-search--line-height:calc(var(--text--medium, 14px) + 4px);--ez-search__input--background-color:var(--background--medium, #e0e0e0);--ez-search__input--border:var(--border--medium, 2px solid);--ez-search__input--border-color:var(--ez-search__input--background-color);--ez-search__input--focus--border-color:var(--color--primary, #008561);--ez-search__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-search__input--disabled--color:var(--text--disable, #AFB6C0);--ez-search__input--error--border-color:#CC2936;--ez-search__btn--color:var(--title--primary, #2B3A54);--ez-search__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-search__btn-hover--color:var(--color--primary, #4e4e4e);--ez-search__label--color:var(--title--primary, #2B3A54);--ez-search__list-title--primary:var(--title--primary, #2B3A54);--ez-search__list-text--primary:var(--text--primary, #626e82);--ez-search__list-height:calc(var(--ez-search--font-size) + var(--ez-search--space--medium) + 4px);--ez-search__list-min-width:64px;--ez-search--space--medium:var(--space--medium, 12px);--ez-search--space--small:var(--space--small, 6px);--ez-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-search__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-search--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{min-width:var(--ez-search__list-min-width);overflow:auto;position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:350px;min-width:150px;background-color:var(--ez-search--background-color--xlight);border-radius:var(--ez-search--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.list-options{margin-top:0px;box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-search__scrollbar--color-background);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-search__scrollbar--color-default);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-search__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-search--border-radius-small);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size);line-height:var(--ez-search--line-height)}.item__label{font-weight:var(--ez-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-search__list-text--primary);font-weight:var(--ez-search--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-search__list-height)}.message__no-result{color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-search__list-title--primary);border-top:3px solid transparent}.item__list>li:hover{background-color:var(--ez-search--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-search__btn--color)}.btn:disabled{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:hover{color:var(--ez-search__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}";export{u as ez_search}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,H as s,c as e,g as o}from"./p-23a36bb6.js";import{C as l}from"./p-4607fb89.js";import{ObjectUtils as n,HTMLBuilder as h,StringUtils as a,ElementIDUtils as d}from"@sankhyalabs/core";import{A as r}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){n.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,s,e,o,n;const d=new Map;for(const t in this.formViewField.props)d.set(t,this.formViewField.props[t]);const r={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===(s=this.formViewField.props)||void 0===s?void 0:s.options,props:this.formViewField.props?d:void 0,optionLoader:this.formViewField.optionLoader},source:l.FORM,detailContext:this.detailContext};let u=this.customEditor.getEditorElement(r);if(!u)return u=this.builderFallback(this.formViewField),this.handleValue(u),void(this.gui=u);if(!(u instanceof HTMLElement)&&"string"!=typeof u)return this.handleValue(u),void(this.gui=u);"string"==typeof u&&(u=h.parseElement(u));const c=null!==(n=null!==(o=null===(e=this.value)||void 0===e?void 0:e.value)&&void 0!==o?o:this.value)&&void 0!==n?n:"";u.setAttribute("value",c),this.gui=i("div",{key:a.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 i(s,null,this.gui)}static get watchers(){return{value:["watchValue"],customEditor:["watchCustomEditor"],formViewField:["watchFormViewField"],detailContext:["watchDetailContext"],builderFallback:["watchBuilderFallback"],selectedRecord:["watchSelectedRecord"]}}},c=class{constructor(i){t(this,i),this.saveEdition=e(this,"saveEdition",7),this.cancelEdition=e(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}):r.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 d.addIDInfoIfNotExists(this._element,"input"),i(s,null,i("span",{class:"text-edit__hidden-value",ref:t=>this._valueBasis=t}),i("ez-text-input",{"data-element-id":d.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}),i("ez-button",{class:"text-edit__icon-check",mode:"icon",iconName:"check",size:"small",onClick:()=>{this.handleSaveEdition()}}),i("ez-button",{class:"text-edit__icon-close",mode:"icon",iconName:"close",size:"small",onClick:()=>{this.handleCancelEdition()}}))}get _element(){return o(this)}};c.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,c as ez_text_edit}
|
|
@@ -113,6 +113,7 @@ export declare class EzSearch {
|
|
|
113
113
|
*/
|
|
114
114
|
autoFocus: boolean;
|
|
115
115
|
observeErrorMessage(): void;
|
|
116
|
+
private getValue;
|
|
116
117
|
private validateNewValue;
|
|
117
118
|
observeValue(newValue: IOption | string, oldValue: IOption | string): Promise<void>;
|
|
118
119
|
observeOptions(newOptions: IOption[], oldOptions: IOption[]): void;
|
|
@@ -171,9 +172,11 @@ export declare class EzSearch {
|
|
|
171
172
|
private showNoResultMessage;
|
|
172
173
|
private getFieldLabel;
|
|
173
174
|
private resetOptions;
|
|
175
|
+
private handleInitialValue;
|
|
174
176
|
componentWillLoad(): void;
|
|
175
177
|
componentDidRender(): void;
|
|
176
|
-
componentDidLoad(): void
|
|
178
|
+
componentDidLoad(): Promise<void>;
|
|
179
|
+
disconnectedCallback(): void;
|
|
177
180
|
private handlerIconClick;
|
|
178
181
|
private buildNumberArgument;
|
|
179
182
|
private onTextInputChangeHandler;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,H as s,c as e,g as o}from"./p-23a36bb6.js";import{C as n}from"./p-4607fb89.js";import{ObjectUtils as l,HTMLBuilder as h,StringUtils as a,ElementIDUtils as d}from"@sankhyalabs/core";import{A as r}from"./p-2187f86c.js";import"./p-ab574d59.js";import"./p-b853763b.js";const c=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){l.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,s;const e=new Map;for(const t in this.formViewField.props)e.set(t,this.formViewField.props[t]);const o={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===(s=this.formViewField.props)||void 0===s?void 0:s.options,props:this.formViewField.props?e:void 0,optionLoader:this.formViewField.optionLoader},source:n.FORM,detailContext:this.detailContext};let l=this.customEditor.getEditorElement(o);return l?l instanceof HTMLElement||"string"==typeof l?("string"==typeof l&&(l=h.parseElement(l)),l.setAttribute("value",this.value),void(this.gui=i("div",{key:a.generateUUID(),ref:t=>t&&t.appendChild(l)}))):(this.handleValue(l),void(this.gui=l)):(l=this.builderFallback(this.formViewField),this.handleValue(l),void(this.gui=l))}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 i(s,null,this.gui)}static get watchers(){return{value:["watchValue"],customEditor:["watchCustomEditor"],formViewField:["watchFormViewField"],detailContext:["watchDetailContext"],builderFallback:["watchBuilderFallback"],selectedRecord:["watchSelectedRecord"]}}},u=class{constructor(i){t(this,i),this.saveEdition=e(this,"saveEdition",7),this.cancelEdition=e(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 n=null===(i=null===(t=this._inputElement)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector("input");null!=n&&(n.style.fontSize=s,n.style.fontWeight=e,n.style.fontFamily=o);const l=this._valueBasis;null!=l&&(l.style.fontSize=s,l.style.fontWeight=e,l.style.fontFamily=o)}handleSaveEdition(){this._newValue?this.saveEdition.emit({value:this.value,newValue:this._newValue}):r.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 d.addIDInfoIfNotExists(this._element,"input"),i(s,null,i("span",{class:"text-edit__hidden-value",ref:t=>this._valueBasis=t}),i("ez-text-input",{"data-element-id":d.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}),i("ez-button",{class:"text-edit__icon-check",mode:"icon",iconName:"check",size:"small",onClick:()=>{this.handleSaveEdition()}}),i("ez-button",{class:"text-edit__icon-close",mode:"icon",iconName:"close",size:"small",onClick:()=>{this.handleCancelEdition()}}))}get _element(){return o(this)}};u.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{c as ez_custom_form_input,u as ez_text_edit}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,H as e,g as r}from"./p-23a36bb6.js";import{C as o}from"./p-9e11fc7b.js";import{ObjectUtils as a,StringUtils as h,FloatingManager as l,ElementIDUtils as n}from"@sankhyalabs/core";import{A as c}from"./p-2187f86c.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-4607fb89.js";import{R as d}from"./p-05e1f4e7.js";const u=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._textEmptyList="Nenhum resultado encontrado",this._textEmptySearch="Nenhum resultado de {0} encontrado",this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._showLoadingDescription=!1,this._criteria=void 0,this.value=void 0,this.label=void 0,this.enabled=!0,this.errorMessage=void 0,this.optionLoader=void 0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.stopPropagateEnterKeyEvent=!1,this.mode="regular",this.canShowError=!0,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.ignoreLimitCharsToSearch=!1,this.options=void 0,this.suppressSearch=!1,this.ensureClearButtonVisible=!1,this.suppressPreLoad=!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.errorMessage&&this.setInputValue())}validateNewValue(t,i){const s=t=>"object"==typeof t?null==t?void 0:t.value:t;return s(t)!==s(i)}async observeValue(t,i){if(this._textInput&&t!==i&&this.validateNewValue(t,i)){if("string"==typeof t)return void await this.handleValueAsString(t);const i=this.getSelectedOption(t),s=this.getSelectedOption(this._currentValue);this.isDifferentValues(s,i)&&(this._currentValue=i,this.setInputValue(),this.ezChange.emit(null!=i?i:void 0)),this.resetOptions()}}observeOptions(t,i){!t.length&&this.suppressPreLoad||(null==t?void 0:t.join(""))!==(null==i?void 0:i.join(""))&&this.loadOptions(v.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()})))}async handleValueAsString(t){this.getSelectedOption(t)?this.setInputValue():(await this.loadDescriptionValue(t),this.setInputValue(),this.ezChange.emit(this.value),this._currentValue=this.value)}updateListPosition(){let{verticalPosition:t,horizontalPosition:i,fromBottom:s,fromRight:e,bottomLimit:r,hardPosition:o}=this.getListPosition();const a=this._listWrapper.getBoundingClientRect(),h=this._listContainer.getBoundingClientRect(),l=this._textInput.getBoundingClientRect(),n=r||window.innerHeight;!s&&(a.top<0||h.bottom+a.height>n)&&(s=!0),o||(t=t||0,i=i||0,s?t=window.innerHeight-l.top+t:t+=h.top,e?i=window.innerWidth-l.right+i:i+=h.left),null!=t&&(this._listWrapper.style[s?"bottom":"top"]=`${t}px`,this._listWrapper.style[s?"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:this.errorMessage||!this.canShowError||"slim"===this.mode?6:-13}}isDifferentValues(t,i){return a.objectToString(t||{})!==a.objectToString(i||{})}getFormattedText(t){if(null==t)return;let i=this.showSelectedValue&&null!=t.value?t.label?`${t.value} - ${t.label}`:t.value:t.label;return i=i.replace(new RegExp(this._startHighlightTag,"g"),"").replace(new RegExp(this._endHighlightTag,"g"),""),i}getText(){const t=this.getSelectedOption(this._currentValue),i=this.getFormattedText(t);return this.replaceQuotes(i)}replaceQuotes(t){if(null!=t)return String(t).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?Object.assign(Object.assign({},t),{value:this.replaceHighlight(null==t?void 0:t.value),label:this.replaceHighlight(null==t?void 0:t.label)}):t}updateVisibleOptions(){let t=this._source||[];this._visibleOptions=this.suppressEmptyOption?t:[{value:void 0,label:""}].concat(t),this._maxWidthValue=this.getMaxWidthValue()}getMaxWidthValue(){var t;const i=[];return null===(t=this._visibleOptions)||void 0===t||t.forEach((t=>{const s=this.getWidthValue(t.value);i.includes(s)||i.push(s)})),i.length>1?Math.max(...i):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}createOption(t){let{key:i,title:s}=t;const e=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g");s=h.decodeHtmlEntities(s);const o={value:null==i?void 0:i.replace(e,"").replace(r,""),label:null==s?void 0:s.replace(e,"").replace(r,"")};this.selectOption(o)}buildItem(t,i){t.label=t.label||t.value;const e={key:t.value,title:t.label,details:t.details};return s("div",{style:{height:"100%"},class:i===this._preSelection?"item preselected":"item",id:`item_${t.value}`,onMouseDown:()=>this.createOption(e),onMouseOver:()=>this._preSelection=i},s("ez-card-item",{item:e,compacted:!0,enableKey:this.showOptionValue}))}showOptions(){this.enabled&&(this.isOptionsVisible()||(this._resizeObserver&&this._resizeObserver.observe(this._textInput),this._floatingID=l.float(this._listWrapper,this._listContainer,{autoClose:!1,isFixed:!0,backClickListener:()=>this.hideOptions()}),this.setFocus(),window.requestAnimationFrame((()=>{this.updateListPosition(),this.listOptionsPosition||this._listWrapper.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))))}hideOptions(){void 0!==this._floatingID&&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(`div#item_${t.value.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g,"\\$1")}`):void 0;i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})}))}selectCurrentOption(){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection]),this._preSelection=void 0):this.controlListWithOnlyOne()}updateSource(t){this._startLoading=!1,t instanceof Promise?(this._showLoading=!0,this._showLoadingDescription=!0,t.then((t=>{this.updateSource(t)})).finally((()=>{this._showLoading=!1,this._showLoadingDescription=!1})),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(t)?(this._source=t,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1,this.controlEmptySearch())):this.selectOption(t))}clearSource(){this._source=[],this.updateVisibleOptions()}replaceHighlight(t){const i=new RegExp(this._startHighlightTag,"g"),s=new RegExp(this._endHighlightTag,"g");return String(null!=t?t:"").replace(i,"").replace(s,"")}selectOption(t,i=!0){var s,e;const r=this.getSelectedOption(this.value),o=Object.assign(Object.assign({},t),{value:this.replaceHighlight(null==t?void 0:t.value),label:this.replaceHighlight(null==t?void 0:t.label)}),a=Object.assign(Object.assign({},o),{value:this.replaceQuotes(null==o?void 0:o.value),label:this.replaceQuotes(null==o?void 0:o.label)});if((null===(s=null==r?void 0:r.value)||void 0===s?void 0:s.toString())!==(null===(e=null==a?void 0:a.value)||void 0===e?void 0:e.toString())||null==r&&null!=a&&"value"in a){const t=(null==a?void 0:a.value)?a:void 0;this.value=t,this._currentValue=t}else this.setInputValue(),this.resetOptions();this._visibleOptions=[],this.clearSource(),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._currentValue?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue()}),this._deboucingTime),this.resetOptions()}setInputValue(t=!0){const i=this.getText();(this._textInput.value||"")!==i&&(this._textInput.value=i,t&&(this.errorMessage=null))}clearSearch(){this.value=null,this._currentValue=null}controlListWithOnlyOne(t=!0){var i,s;const e=null===(i=this._visibleOptions)||void 0===i?void 0:i.filter((t=>""!==t.label&&null!=t.value));if((null==e?void 0:e.length)>0){const i=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g");let o=h.decodeHtmlEntities(e[0].label);const a={value:null===(s=e[0].value)||void 0===s?void 0:s.replace(i,"").replace(r,""),label:null==o?void 0:o.replace(i,"").replace(r,"")};this.selectOption(a,t)}}controlEmptySearch(){var t;(null===(t=this._visibleOptions)||void 0===t?void 0:t.length)?this.controlListWithOnlyOne():(this.clearSearch(),c.info(this._textEmptyList))}async loadDescriptionValue(t){var i,s;if(null==t)return;if((null===(i=this.options)||void 0===i?void 0:i.length)>0)return void this.loadOptionValue(t);const e={mode:v.PREDICTIVE,argument:t},r=await(null===(s=this.optionLoader)||void 0===s?void 0:s.call(this,e));null!=r&&(r instanceof Promise?r.then((t=>{this.setDescriptionValue(t)})):this.setDescriptionValue(r))}setDescriptionValue(t){const i=(null==t?void 0:t[0])||t;null!=i&&Object.keys(i).length?(this._currentValue=i?Object.assign(Object.assign({},i),{value:this.replaceHighlight(i.value),label:this.replaceHighlight(i.label)}):i,this.value=this._currentValue,this.setTextInputValue()):this.showNoResultMessage()}setTextInputValue(){if(this._textInput&&null==this._textInput.value){if(null==this.value)return;const t="string"==typeof this.value?this.value:this.getFormattedText(this.value);this._textInput.value=this.replaceQuotes(t)}}loadOptionValue(t){var i;const s=null===(i=this.options)||void 0===i?void 0:i.find((i=>i.value===t));null!=s?this.selectOption(s):this.showNoResultMessage()}async showNoResultMessage(){this.clearSearch(),c.info(this._textEmptySearch.replace("{0}",this.getFieldLabel()))}getFieldLabel(){var t;return null===(t=this.label)||void 0===t?void 0:t.replace(d,"").toUpperCase()}resetOptions(){this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}componentWillLoad(){if(void 0===this.options){this.options=[];const t=this.el.querySelectorAll("option");t&&t.forEach((t=>{let i=t.innerText,s=t.getAttribute("value"),e=t.getAttribute("details");s||(s=i),this.options.push({label:i,value:s,details:e}),t.hidden=!0}))}this.updateSource([])}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,"itemSearch")}))}componentDidLoad(){this._currentValue=this.value,o.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.loadOptions(v.ADVANCED)}buildNumberArgument(t){return this.isTextSearch?NaN:Number(t||void 0)}onTextInputChangeHandler(t){var i;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(t)}),this._deboucingTime));const s=null===(i=t.target.value)||void 0===i?void 0:i.trim(),e=this.buildNumberArgument(s);this._criteria||(this._textInput.value=t.data||s),this._criteria=s,s?(this._showLoading=!1,this.clearSource(),this.ignoreLimitCharsToSearch||!isNaN(e)||s.length>=this._limitCharsToSearch?(this._showLoading=!0,this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions(v.PREDICTIVE,isNaN(e)?s:e.toString())}),this._deboucingTime),this.showOptions()):this.hideOptions()):(this.hideOptions(),this._showLoading=!1,this.clearSource())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}keyDownHandler(t){switch(this._tabPressed=!1,t.ctrlKey&&("f"!==t.key&&"F"!==t.key||(this.loadOptions(v.ADVANCED),t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault())),t.key){case"ArrowDown":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.nextOption();break;case"ArrowUp":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.previousOption();break;case"Enter":this.handleEventPropagation(t),this.selectCurrentOption();break;case"Escape":this.cancelPreselection();break;case"Tab":this._tabPressed=!0,this.controlListWithOnlyOne(!1)}}handleEventPropagation(t){this._listContainer.hasChildNodes()&&this.stopPropagateEnterKeyEvent&&t.stopPropagation()}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}canShowLoadSpinDescription(){return this._showLoadingDescription&&null==this._floatingID}render(){var t;return n.addIDInfoIfNotExists(this.el,"input"),s(e,null,s("ez-text-input",{"data-element-id":n.getInternalIDInfo("textInput"),class:this.suppressSearch?"suppressed-search-input":"",ref:t=>this._textInput=t,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:t=>this.onTextInputChangeHandler(t),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:t=>this.keyDownHandler(t),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode},s("button",{class:"btn",slot:"leftIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},this.canShowLoadSpinDescription()?s("div",{class:"message__loading"}):s("ez-icon",{iconName:"search"})),(null===(t=this._textInput)||void 0===t?void 0:t.value)&&(this._criteria||this.value)||this.ensureClearButtonVisible?s("button",{class:"btn btn__close",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.clearSearch()},s("ez-icon",{iconName:"close"})):void 0),s("section",{class:"list-container",ref:t=>this._listContainer=t},s("div",{class:"list-wrapper",ref:t=>this._listWrapper=t},s("ul",{class:"list-options",ref:t=>this._optionsList=t},!this._showLoading&&0===this._visibleOptions.length&&s("div",{class:"message"},s("span",{class:"message__no-result"},this._textEmptyList)),this._showLoading&&s("div",{class:"message"},s("div",{class:"message__loading"})),s("span",{class:"item__value item__value--hidden",ref:t=>this._itemValueBasis=t}),this.canShowListOptions()&&this._visibleOptions.map(((t,i)=>this.buildItem(t,i)))))))}get el(){return r(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};var v;!function(t){t.ADVANCED="ADVANCED",t.PRELOAD="PRELOAD",t.PREDICTIVE="PREDICTIVE"}(v||(v={})),u.style=":host{--ez-search--height:42px;--ez-search--width:100%;--ez-search__icon--width:48px;--ez-search--border-radius:var(--border--radius-medium, 12px);--ez-search--border-radius-small:var(--border--radius-small, 6px);--ez-search--font-size:var(--text--medium, 14px);--ez-search--font-family:var(--font-pattern, Arial);--ez-search--font-weight--large:var(--text-weight--large, 500);--ez-search--font-weight--medium:var(--text-weight--medium, 400);--ez-search--background-color--xlight:var(--background--xlight, #fff);--ez-search--background-medium:var(--background--medium, #f0f3f7);--ez-search--line-height:calc(var(--text--medium, 14px) + 4px);--ez-search__input--background-color:var(--background--medium, #e0e0e0);--ez-search__input--border:var(--border--medium, 2px solid);--ez-search__input--border-color:var(--ez-search__input--background-color);--ez-search__input--focus--border-color:var(--color--primary, #008561);--ez-search__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-search__input--disabled--color:var(--text--disable, #AFB6C0);--ez-search__input--error--border-color:#CC2936;--ez-search__btn--color:var(--title--primary, #2B3A54);--ez-search__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-search__btn-hover--color:var(--color--primary, #4e4e4e);--ez-search__label--color:var(--title--primary, #2B3A54);--ez-search__list-title--primary:var(--title--primary, #2B3A54);--ez-search__list-text--primary:var(--text--primary, #626e82);--ez-search__list-height:calc(var(--ez-search--font-size) + var(--ez-search--space--medium) + 4px);--ez-search__list-min-width:64px;--ez-search--space--medium:var(--space--medium, 12px);--ez-search--space--small:var(--space--small, 6px);--ez-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-search__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-search--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{min-width:var(--ez-search__list-min-width);overflow:auto;position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:350px;min-width:150px;background-color:var(--ez-search--background-color--xlight);border-radius:var(--ez-search--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.list-options{margin-top:0px;box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-search__scrollbar--color-background);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-search__scrollbar--color-default);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-search__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-search--border-radius-small);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size);line-height:var(--ez-search--line-height)}.item__label{font-weight:var(--ez-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-search__list-text--primary);font-weight:var(--ez-search--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-search__list-height)}.message__no-result{color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-search__list-title--primary);border-top:3px solid transparent}.item__list>li:hover{background-color:var(--ez-search--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-search__btn--color)}.btn:disabled{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:hover{color:var(--ez-search__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}";export{u as ez_search}
|