@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-76625.0 → 0.0.0-bugfix-dev-KB-83282.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ez-card-item_2.cjs.entry.js +7 -1415
- package/dist/cjs/ez-combo-box-list_3.cjs.entry.js +387 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +58 -184
- package/dist/cjs/ez-grid.cjs.entry.js +58 -0
- package/dist/cjs/ez-popover-core_2.cjs.entry.js +1504 -0
- package/dist/cjs/ez-search.cjs.entry.js +158 -28
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/index-a7b0c73d.js +6 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/ez-card-item/ez-card-item.css +3 -1
- package/dist/collection/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.css +205 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.js +426 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -250
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +61 -194
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +3 -0
- package/dist/collection/components/ez-grid/ez-grid.js +56 -1
- package/dist/collection/components/ez-popover-plus/ez-popover-plus.js +27 -33
- package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.css +2 -2
- package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.js +18 -77
- package/dist/collection/components/ez-search/ez-search.css +219 -0
- package/dist/collection/components/ez-search/ez-search.js +167 -28
- package/dist/custom-elements/index.d.ts +6 -6
- package/dist/custom-elements/index.js +468 -359
- package/dist/esm/ez-card-item_2.entry.js +7 -1415
- package/dist/esm/ez-combo-box-list_3.entry.js +381 -0
- package/dist/esm/ez-combo-box.entry.js +59 -185
- package/dist/esm/ez-grid.entry.js +59 -1
- package/dist/esm/ez-popover-core_2.entry.js +1499 -0
- package/dist/esm/ez-search.entry.js +159 -29
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/index-baa5e267.js +6 -6
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-3a009184.entry.js +1 -0
- package/dist/ezui/{p-a5950a0d.entry.js → p-53116373.entry.js} +46 -46
- package/dist/ezui/p-58783dcf.entry.js +1 -0
- package/dist/ezui/p-65f471bc.entry.js +1 -0
- package/dist/ezui/p-7bd15498.entry.js +1 -0
- package/dist/ezui/p-f5931caa.entry.js +1 -0
- package/dist/types/components/ez-combo-box/ez-combo-box-list/ez-combo-box-list.d.ts +104 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -16
- package/dist/types/components/ez-grid/ez-grid.d.ts +5 -0
- package/dist/types/components/ez-popover-plus/ez-popover-plus.d.ts +4 -5
- package/dist/types/components/ez-popover-plus/subcomponent/ez-popover-core.d.ts +2 -12
- package/dist/types/components/ez-search/ez-search.d.ts +13 -3
- package/dist/types/components.d.ts +127 -66
- package/package.json +1 -1
- package/react/components.d.ts +1 -1
- package/react/components.js +1 -1
- package/react/components.js.map +1 -1
- package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +0 -236
- package/dist/cjs/ez-popover-plus_3.cjs.entry.js +0 -184
- package/dist/cjs/searchFormatters-b7e1ed1e.js +0 -23
- package/dist/collection/components/ez-search/subcomponent/search-list/search-list.css +0 -227
- package/dist/collection/components/ez-search/subcomponent/search-list/search-list.js +0 -289
- package/dist/collection/components/ez-search/utils/searchFormatters.js +0 -18
- package/dist/esm/ez-custom-form-input_2.entry.js +0 -231
- package/dist/esm/ez-popover-plus_3.entry.js +0 -178
- package/dist/esm/searchFormatters-8229207e.js +0 -20
- package/dist/ezui/p-31da1b57.entry.js +0 -1
- package/dist/ezui/p-37201156.entry.js +0 -1
- package/dist/ezui/p-40a60148.js +0 -1
- package/dist/ezui/p-64b461b3.entry.js +0 -1
- package/dist/ezui/p-b7706b43.entry.js +0 -1
- package/dist/ezui/p-dc8b36c3.entry.js +0 -1
- package/dist/types/components/ez-search/subcomponent/search-list/search-list.d.ts +0 -23
- package/dist/types/components/ez-search/utils/searchFormatters.d.ts +0 -2
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
import { Host, h } from '@stencil/core';
|
|
2
|
-
import { StringUtils } from '@sankhyalabs/core';
|
|
3
|
-
import { replaceHighlight, replaceQuotes } from '../../utils/searchFormatters';
|
|
4
|
-
export class SearchList {
|
|
5
|
-
constructor() {
|
|
6
|
-
this._startHighlightTag = "<span class='card-item__highlight'>";
|
|
7
|
-
this._endHighlightTag = "</span>";
|
|
8
|
-
this.showLoading = undefined;
|
|
9
|
-
this.visibleOptions = [];
|
|
10
|
-
this.textEmptyList = undefined;
|
|
11
|
-
this.canShowListOptions = undefined;
|
|
12
|
-
this.value = undefined;
|
|
13
|
-
this.showOptionValue = true;
|
|
14
|
-
this.preSelection = undefined;
|
|
15
|
-
}
|
|
16
|
-
async nextOption() {
|
|
17
|
-
const newPreSelection = this.preSelection === undefined ? 0 : Math.min(this.preSelection + 1, this.visibleOptions.length - 1);
|
|
18
|
-
this.changePreSelection.emit(newPreSelection);
|
|
19
|
-
this.scrollToOption(this.visibleOptions[newPreSelection]);
|
|
20
|
-
}
|
|
21
|
-
async previousOption() {
|
|
22
|
-
const newPreSelection = this.preSelection === undefined ? 0 : Math.max(this.preSelection - 1, 0);
|
|
23
|
-
this.changePreSelection.emit(newPreSelection);
|
|
24
|
-
this.scrollToOption(this.visibleOptions[newPreSelection]);
|
|
25
|
-
}
|
|
26
|
-
selectOption(newOption) {
|
|
27
|
-
const newOptionsReplaced = Object.assign(Object.assign({}, newOption), { value: replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.value), label: replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.label) });
|
|
28
|
-
const newOptionsFormatted = Object.assign(Object.assign({}, newOptionsReplaced), { value: replaceQuotes(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value), label: replaceQuotes(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.label) });
|
|
29
|
-
this.changeValue.emit(newOptionsFormatted);
|
|
30
|
-
}
|
|
31
|
-
createOption(detail) {
|
|
32
|
-
let { key, title } = detail;
|
|
33
|
-
const startHighlight = new RegExp(this._startHighlightTag, 'g');
|
|
34
|
-
const endHighlight = new RegExp(this._endHighlightTag, 'g');
|
|
35
|
-
title = StringUtils.decodeHtmlEntities(title);
|
|
36
|
-
const option = {
|
|
37
|
-
value: key === null || key === void 0 ? void 0 : key.replace(startHighlight, '').replace(endHighlight, ''),
|
|
38
|
-
label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
|
|
39
|
-
};
|
|
40
|
-
this.selectOption(option);
|
|
41
|
-
}
|
|
42
|
-
scrollToOption(opt) {
|
|
43
|
-
window.requestAnimationFrame(() => {
|
|
44
|
-
const liElem = (opt === null || opt === void 0 ? void 0 : opt.value)
|
|
45
|
-
? this._optionsList.querySelector(`div#item_${opt.value.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g, '\\$1')}`)
|
|
46
|
-
: undefined;
|
|
47
|
-
if (liElem) {
|
|
48
|
-
liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
buildItem(opt, index) {
|
|
53
|
-
opt.label = opt.label || opt.value;
|
|
54
|
-
const card = {
|
|
55
|
-
key: opt.value,
|
|
56
|
-
title: opt.label,
|
|
57
|
-
details: opt.details
|
|
58
|
-
};
|
|
59
|
-
return h("div", { style: { "height": "100%" }, class: index === this.preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.createOption(card), onMouseOver: () => this.changePreSelection.emit(index) }, h("ez-card-item", { item: card, compacted: true, enableKey: this.showOptionValue }));
|
|
60
|
-
}
|
|
61
|
-
render() {
|
|
62
|
-
return (h(Host, null, h("ul", { class: "list-options", ref: elem => this._optionsList = elem }, !this.showLoading
|
|
63
|
-
&& this.visibleOptions.length === 0
|
|
64
|
-
&& h("div", { class: "message" }, h("span", { class: "message__no-result" }, this.textEmptyList)), this.showLoading
|
|
65
|
-
&& h("div", { class: "message" }, h("div", { class: "message__loading" })), this.canShowListOptions && this.visibleOptions.map((opt, index) => this.buildItem(opt, index)))));
|
|
66
|
-
}
|
|
67
|
-
static get is() { return "search-list"; }
|
|
68
|
-
static get encapsulation() { return "shadow"; }
|
|
69
|
-
static get originalStyleUrls() {
|
|
70
|
-
return {
|
|
71
|
-
"$": ["search-list.css"]
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
static get styleUrls() {
|
|
75
|
-
return {
|
|
76
|
-
"$": ["search-list.css"]
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
static get properties() {
|
|
80
|
-
return {
|
|
81
|
-
"showLoading": {
|
|
82
|
-
"type": "boolean",
|
|
83
|
-
"mutable": false,
|
|
84
|
-
"complexType": {
|
|
85
|
-
"original": "boolean",
|
|
86
|
-
"resolved": "boolean",
|
|
87
|
-
"references": {}
|
|
88
|
-
},
|
|
89
|
-
"required": false,
|
|
90
|
-
"optional": false,
|
|
91
|
-
"docs": {
|
|
92
|
-
"tags": [],
|
|
93
|
-
"text": ""
|
|
94
|
-
},
|
|
95
|
-
"attribute": "show-loading",
|
|
96
|
-
"reflect": false
|
|
97
|
-
},
|
|
98
|
-
"visibleOptions": {
|
|
99
|
-
"type": "unknown",
|
|
100
|
-
"mutable": false,
|
|
101
|
-
"complexType": {
|
|
102
|
-
"original": "Array<IOption>",
|
|
103
|
-
"resolved": "IOption[]",
|
|
104
|
-
"references": {
|
|
105
|
-
"Array": {
|
|
106
|
-
"location": "global"
|
|
107
|
-
},
|
|
108
|
-
"IOption": {
|
|
109
|
-
"location": "import",
|
|
110
|
-
"path": "../../ez-search"
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
"required": false,
|
|
115
|
-
"optional": false,
|
|
116
|
-
"docs": {
|
|
117
|
-
"tags": [],
|
|
118
|
-
"text": ""
|
|
119
|
-
},
|
|
120
|
-
"defaultValue": "[]"
|
|
121
|
-
},
|
|
122
|
-
"textEmptyList": {
|
|
123
|
-
"type": "string",
|
|
124
|
-
"mutable": false,
|
|
125
|
-
"complexType": {
|
|
126
|
-
"original": "string",
|
|
127
|
-
"resolved": "string",
|
|
128
|
-
"references": {}
|
|
129
|
-
},
|
|
130
|
-
"required": false,
|
|
131
|
-
"optional": false,
|
|
132
|
-
"docs": {
|
|
133
|
-
"tags": [],
|
|
134
|
-
"text": ""
|
|
135
|
-
},
|
|
136
|
-
"attribute": "text-empty-list",
|
|
137
|
-
"reflect": false
|
|
138
|
-
},
|
|
139
|
-
"canShowListOptions": {
|
|
140
|
-
"type": "boolean",
|
|
141
|
-
"mutable": false,
|
|
142
|
-
"complexType": {
|
|
143
|
-
"original": "boolean",
|
|
144
|
-
"resolved": "boolean",
|
|
145
|
-
"references": {}
|
|
146
|
-
},
|
|
147
|
-
"required": false,
|
|
148
|
-
"optional": false,
|
|
149
|
-
"docs": {
|
|
150
|
-
"tags": [],
|
|
151
|
-
"text": ""
|
|
152
|
-
},
|
|
153
|
-
"attribute": "can-show-list-options",
|
|
154
|
-
"reflect": false
|
|
155
|
-
},
|
|
156
|
-
"value": {
|
|
157
|
-
"type": "string",
|
|
158
|
-
"mutable": false,
|
|
159
|
-
"complexType": {
|
|
160
|
-
"original": "IOption | string",
|
|
161
|
-
"resolved": "IOption | string",
|
|
162
|
-
"references": {
|
|
163
|
-
"IOption": {
|
|
164
|
-
"location": "import",
|
|
165
|
-
"path": "../../ez-search"
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
"required": false,
|
|
170
|
-
"optional": false,
|
|
171
|
-
"docs": {
|
|
172
|
-
"tags": [],
|
|
173
|
-
"text": ""
|
|
174
|
-
},
|
|
175
|
-
"attribute": "value",
|
|
176
|
-
"reflect": false
|
|
177
|
-
},
|
|
178
|
-
"showOptionValue": {
|
|
179
|
-
"type": "boolean",
|
|
180
|
-
"mutable": false,
|
|
181
|
-
"complexType": {
|
|
182
|
-
"original": "boolean",
|
|
183
|
-
"resolved": "boolean",
|
|
184
|
-
"references": {}
|
|
185
|
-
},
|
|
186
|
-
"required": false,
|
|
187
|
-
"optional": false,
|
|
188
|
-
"docs": {
|
|
189
|
-
"tags": [],
|
|
190
|
-
"text": ""
|
|
191
|
-
},
|
|
192
|
-
"attribute": "show-option-value",
|
|
193
|
-
"reflect": false,
|
|
194
|
-
"defaultValue": "true"
|
|
195
|
-
},
|
|
196
|
-
"preSelection": {
|
|
197
|
-
"type": "number",
|
|
198
|
-
"mutable": false,
|
|
199
|
-
"complexType": {
|
|
200
|
-
"original": "number",
|
|
201
|
-
"resolved": "number",
|
|
202
|
-
"references": {}
|
|
203
|
-
},
|
|
204
|
-
"required": false,
|
|
205
|
-
"optional": false,
|
|
206
|
-
"docs": {
|
|
207
|
-
"tags": [],
|
|
208
|
-
"text": ""
|
|
209
|
-
},
|
|
210
|
-
"attribute": "pre-selection",
|
|
211
|
-
"reflect": false
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
static get events() {
|
|
216
|
-
return [{
|
|
217
|
-
"method": "changeValue",
|
|
218
|
-
"name": "changeValue",
|
|
219
|
-
"bubbles": true,
|
|
220
|
-
"cancelable": true,
|
|
221
|
-
"composed": true,
|
|
222
|
-
"docs": {
|
|
223
|
-
"tags": [],
|
|
224
|
-
"text": ""
|
|
225
|
-
},
|
|
226
|
-
"complexType": {
|
|
227
|
-
"original": "IOption",
|
|
228
|
-
"resolved": "IOption",
|
|
229
|
-
"references": {
|
|
230
|
-
"IOption": {
|
|
231
|
-
"location": "import",
|
|
232
|
-
"path": "../../ez-search"
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}, {
|
|
237
|
-
"method": "changePreSelection",
|
|
238
|
-
"name": "changePreSelection",
|
|
239
|
-
"bubbles": true,
|
|
240
|
-
"cancelable": true,
|
|
241
|
-
"composed": true,
|
|
242
|
-
"docs": {
|
|
243
|
-
"tags": [],
|
|
244
|
-
"text": ""
|
|
245
|
-
},
|
|
246
|
-
"complexType": {
|
|
247
|
-
"original": "number",
|
|
248
|
-
"resolved": "number",
|
|
249
|
-
"references": {}
|
|
250
|
-
}
|
|
251
|
-
}];
|
|
252
|
-
}
|
|
253
|
-
static get methods() {
|
|
254
|
-
return {
|
|
255
|
-
"nextOption": {
|
|
256
|
-
"complexType": {
|
|
257
|
-
"signature": "() => Promise<void>",
|
|
258
|
-
"parameters": [],
|
|
259
|
-
"references": {
|
|
260
|
-
"Promise": {
|
|
261
|
-
"location": "global"
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
"return": "Promise<void>"
|
|
265
|
-
},
|
|
266
|
-
"docs": {
|
|
267
|
-
"text": "",
|
|
268
|
-
"tags": []
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
"previousOption": {
|
|
272
|
-
"complexType": {
|
|
273
|
-
"signature": "() => Promise<void>",
|
|
274
|
-
"parameters": [],
|
|
275
|
-
"references": {
|
|
276
|
-
"Promise": {
|
|
277
|
-
"location": "global"
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
"return": "Promise<void>"
|
|
281
|
-
},
|
|
282
|
-
"docs": {
|
|
283
|
-
"text": "",
|
|
284
|
-
"tags": []
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const START_HIGH_LIGHT_TAG = "<span class='card-item__highlight'>";
|
|
2
|
-
const END_HIGH_LIGHT_TAG = "</span>";
|
|
3
|
-
export function replaceHighlight(value) {
|
|
4
|
-
const startHighlight = new RegExp(START_HIGH_LIGHT_TAG, 'g');
|
|
5
|
-
const endHighlight = new RegExp(END_HIGH_LIGHT_TAG, 'g');
|
|
6
|
-
const newValue = String(value !== null && value !== void 0 ? value : "").replace(startHighlight, '').replace(endHighlight, '');
|
|
7
|
-
return replaceQuotes(newValue);
|
|
8
|
-
}
|
|
9
|
-
export function replaceQuotes(text) {
|
|
10
|
-
if (text == undefined) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
return String(text)
|
|
14
|
-
.replace(/&/g, '&')
|
|
15
|
-
.replace(/</g, '<')
|
|
16
|
-
.replace(/>/g, '>')
|
|
17
|
-
.replace(/"/g, '"');
|
|
18
|
-
}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-baa5e267.js';
|
|
2
|
-
import { C as CustomEditorSource } from './ICustomRender-875b5a40.js';
|
|
3
|
-
import { ObjectUtils, HTMLBuilder, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
4
|
-
import { A as ApplicationUtils } from './ApplicationUtils-eaf91331.js';
|
|
5
|
-
import './DialogType-54a62731.js';
|
|
6
|
-
import './CheckMode-bdb2ec19.js';
|
|
7
|
-
|
|
8
|
-
const EzCustomFormInput = class {
|
|
9
|
-
constructor(hostRef) {
|
|
10
|
-
registerInstance(this, hostRef);
|
|
11
|
-
this.gui = undefined;
|
|
12
|
-
this.customEditor = undefined;
|
|
13
|
-
this.formViewField = undefined;
|
|
14
|
-
this.value = undefined;
|
|
15
|
-
this.detailContext = undefined;
|
|
16
|
-
this.builderFallback = undefined;
|
|
17
|
-
this.selectedRecord = undefined;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Aplica foco no campo.
|
|
21
|
-
*/
|
|
22
|
-
async setFocus() {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
(_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["setFocus"]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Remove o foco do campo.
|
|
28
|
-
*/
|
|
29
|
-
async setBlur() {
|
|
30
|
-
var _a, _b;
|
|
31
|
-
(_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["setBlur"]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Retorna se o conteúdo é inválido.
|
|
35
|
-
*/
|
|
36
|
-
async isInvalid() {
|
|
37
|
-
var _a, _b;
|
|
38
|
-
return ((_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["isInvalid"]) === null || _b === void 0 ? void 0 : _b.call(_a)) || false;
|
|
39
|
-
}
|
|
40
|
-
watchValue() {
|
|
41
|
-
this.handleValue(this.gui);
|
|
42
|
-
}
|
|
43
|
-
watchCustomEditor() {
|
|
44
|
-
this.getContent();
|
|
45
|
-
}
|
|
46
|
-
watchFormViewField(newValue, oldValue) {
|
|
47
|
-
if (!ObjectUtils.equals(newValue, oldValue))
|
|
48
|
-
this.getContent();
|
|
49
|
-
}
|
|
50
|
-
watchDetailContext() {
|
|
51
|
-
this.getContent();
|
|
52
|
-
}
|
|
53
|
-
watchBuilderFallback() {
|
|
54
|
-
this.getContent();
|
|
55
|
-
}
|
|
56
|
-
watchSelectedRecord(newValue, oldValue) {
|
|
57
|
-
const newRecordId = newValue === null || newValue === void 0 ? void 0 : newValue['__record__id__'];
|
|
58
|
-
const oldRecordId = oldValue === null || oldValue === void 0 ? void 0 : oldValue['__record__id__'];
|
|
59
|
-
if (newRecordId !== oldRecordId) {
|
|
60
|
-
this.getContent();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
getContent() {
|
|
64
|
-
var _a, _b, _c, _d, _e;
|
|
65
|
-
const fieldProps = new Map();
|
|
66
|
-
for (const prop in this.formViewField.props) {
|
|
67
|
-
fieldProps.set(prop, this.formViewField.props[prop]);
|
|
68
|
-
}
|
|
69
|
-
const params = {
|
|
70
|
-
value: this.value,
|
|
71
|
-
name: this.formViewField.name,
|
|
72
|
-
currentEditor: this.builderFallback(this.formViewField),
|
|
73
|
-
setValue: (value) => this.setValue(value),
|
|
74
|
-
getValue: this.getValue,
|
|
75
|
-
record: this.selectedRecord,
|
|
76
|
-
editorMetadata: {
|
|
77
|
-
label: this.formViewField.label,
|
|
78
|
-
hidden: ((_a = this.formViewField.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
|
|
79
|
-
userInterface: this.formViewField.userInterface,
|
|
80
|
-
options: (_b = this.formViewField.props) === null || _b === void 0 ? void 0 : _b.options,
|
|
81
|
-
props: this.formViewField.props ? fieldProps : undefined,
|
|
82
|
-
optionLoader: this.formViewField.optionLoader
|
|
83
|
-
},
|
|
84
|
-
source: CustomEditorSource.FORM,
|
|
85
|
-
detailContext: this.detailContext
|
|
86
|
-
};
|
|
87
|
-
let gui = this.customEditor.getEditorElement(params);
|
|
88
|
-
if (!gui) {
|
|
89
|
-
gui = this.builderFallback(this.formViewField);
|
|
90
|
-
this.handleValue(gui);
|
|
91
|
-
this.gui = gui;
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (!(gui instanceof HTMLElement) && typeof gui !== 'string') {
|
|
95
|
-
this.handleValue(gui);
|
|
96
|
-
this.gui = gui;
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (typeof gui === 'string') {
|
|
100
|
-
gui = HTMLBuilder.parseElement(gui);
|
|
101
|
-
}
|
|
102
|
-
const value = (_e = (_d = (_c = this.value) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : this.value) !== null && _e !== void 0 ? _e : '';
|
|
103
|
-
gui.setAttribute('value', value);
|
|
104
|
-
this.gui = h("div", { key: StringUtils.generateUUID(), ref: el => el && el.appendChild(gui) });
|
|
105
|
-
}
|
|
106
|
-
setValue(value) {
|
|
107
|
-
this.value = value;
|
|
108
|
-
}
|
|
109
|
-
getValue() {
|
|
110
|
-
return this.value;
|
|
111
|
-
}
|
|
112
|
-
handleValue(gui) {
|
|
113
|
-
var _a;
|
|
114
|
-
//@ts-ignore
|
|
115
|
-
(_a = gui.$children$) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
|
|
116
|
-
child.$attrs$.value = this.value;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
componentWillLoad() {
|
|
120
|
-
this.getContent();
|
|
121
|
-
}
|
|
122
|
-
render() {
|
|
123
|
-
return (h(Host, null, this.gui));
|
|
124
|
-
}
|
|
125
|
-
static get watchers() { return {
|
|
126
|
-
"value": ["watchValue"],
|
|
127
|
-
"customEditor": ["watchCustomEditor"],
|
|
128
|
-
"formViewField": ["watchFormViewField"],
|
|
129
|
-
"detailContext": ["watchDetailContext"],
|
|
130
|
-
"builderFallback": ["watchBuilderFallback"],
|
|
131
|
-
"selectedRecord": ["watchSelectedRecord"]
|
|
132
|
-
}; }
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
const ezTextEditCss = ":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";
|
|
136
|
-
|
|
137
|
-
const EzTextEdit = class {
|
|
138
|
-
constructor(hostRef) {
|
|
139
|
-
registerInstance(this, hostRef);
|
|
140
|
-
this.saveEdition = createEvent(this, "saveEdition", 7);
|
|
141
|
-
this.cancelEdition = createEvent(this, "cancelEdition", 7);
|
|
142
|
-
this._newValue = undefined;
|
|
143
|
-
this.value = undefined;
|
|
144
|
-
this.styled = undefined;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Aplica foco no campo.
|
|
148
|
-
*/
|
|
149
|
-
async applyFocusSelect() {
|
|
150
|
-
this.calcSizeInput(this.value, true);
|
|
151
|
-
}
|
|
152
|
-
calcSizeInput(value, setSelect = false) {
|
|
153
|
-
var _a, _b;
|
|
154
|
-
const textInput = (_b = (_a = this._inputElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input');
|
|
155
|
-
if (textInput != undefined) {
|
|
156
|
-
const sizeText = this.getWidthValue(value);
|
|
157
|
-
textInput.style.width = sizeText + 'px';
|
|
158
|
-
if (setSelect) {
|
|
159
|
-
setTimeout(() => textInput.select(), 100);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
getWidthValue(value) {
|
|
164
|
-
if (this._valueBasis != undefined) {
|
|
165
|
-
const span = this._valueBasis;
|
|
166
|
-
if (value != undefined) {
|
|
167
|
-
const cursorSpace = 2;
|
|
168
|
-
span.innerHTML = value;
|
|
169
|
-
return span.clientWidth > 0 ? (span.clientWidth + cursorSpace) : cursorSpace;
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
span.innerHTML = "";
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return 0;
|
|
176
|
-
}
|
|
177
|
-
setStyledInput() {
|
|
178
|
-
var _a, _b;
|
|
179
|
-
let fontSize = "";
|
|
180
|
-
let fontWeight = "";
|
|
181
|
-
let fontFamily = "";
|
|
182
|
-
if (this.styled != undefined) {
|
|
183
|
-
fontSize = this.styled.fontSize;
|
|
184
|
-
fontWeight = this.styled.fontWeight;
|
|
185
|
-
fontFamily = this.styled.fontFamily;
|
|
186
|
-
}
|
|
187
|
-
const textInput = (_b = (_a = this._inputElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input');
|
|
188
|
-
if (textInput != undefined) {
|
|
189
|
-
textInput.style.fontSize = fontSize;
|
|
190
|
-
textInput.style.fontWeight = fontWeight;
|
|
191
|
-
textInput.style.fontFamily = fontFamily;
|
|
192
|
-
}
|
|
193
|
-
const span = this._valueBasis;
|
|
194
|
-
if (span != undefined) {
|
|
195
|
-
span.style.fontSize = fontSize;
|
|
196
|
-
span.style.fontWeight = fontWeight;
|
|
197
|
-
span.style.fontFamily = fontFamily;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
handleSaveEdition() {
|
|
201
|
-
if (!this._newValue) {
|
|
202
|
-
ApplicationUtils.alert("Aviso", "Não é possível salvar um campo em branco.").then(() => {
|
|
203
|
-
this.setNewValue(this.value, true);
|
|
204
|
-
});
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
this.saveEdition.emit({ value: this.value, newValue: this._newValue });
|
|
208
|
-
}
|
|
209
|
-
handleCancelEdition() {
|
|
210
|
-
this.cancelEdition.emit();
|
|
211
|
-
}
|
|
212
|
-
setNewValue(value, setSelect = false) {
|
|
213
|
-
this._newValue = value;
|
|
214
|
-
this.calcSizeInput(this._newValue, setSelect);
|
|
215
|
-
}
|
|
216
|
-
componentDidLoad() {
|
|
217
|
-
this.applyFocusSelect();
|
|
218
|
-
this.setNewValue(this.value);
|
|
219
|
-
}
|
|
220
|
-
componentDidRender() {
|
|
221
|
-
this.setStyledInput();
|
|
222
|
-
}
|
|
223
|
-
render() {
|
|
224
|
-
ElementIDUtils.addIDInfoIfNotExists(this._element, 'input');
|
|
225
|
-
return (h(Host, null, h("span", { class: "text-edit__hidden-value", ref: elem => this._valueBasis = elem }), h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), onInput: () => { this.calcSizeInput(this._newValue); }, class: "text-edit__form-input", value: this._newValue, ref: (elem) => this._inputElement = elem, mode: "slim", onEzChange: (evt) => this.setNewValue(evt === null || evt === void 0 ? void 0 : evt.detail), noBorder: true }), h("ez-button", { class: "text-edit__icon-check", mode: "icon", iconName: "check", size: "small", onClick: () => { this.handleSaveEdition(); } }), h("ez-button", { class: "text-edit__icon-close", mode: "icon", iconName: "close", size: "small", onClick: () => { this.handleCancelEdition(); } })));
|
|
226
|
-
}
|
|
227
|
-
get _element() { return getElement(this); }
|
|
228
|
-
};
|
|
229
|
-
EzTextEdit.style = ezTextEditCss;
|
|
230
|
-
|
|
231
|
-
export { EzCustomFormInput as ez_custom_form_input, EzTextEdit as ez_text_edit };
|