@sankhyalabs/ezui 3.6.0 → 4.0.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-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-alert.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -1
- package/dist/cjs/ez-breadcrumb.cjs.entry.js +12 -2
- package/dist/cjs/ez-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +16 -10
- package/dist/cjs/ez-date-input.cjs.entry.js +2 -2
- package/dist/cjs/ez-date-time-input.cjs.entry.js +4 -12
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-filter-input_4.cjs.entry.js +67 -6
- package/dist/cjs/ez-form-view.cjs.entry.js +30 -23
- package/dist/cjs/ez-form.cjs.entry.js +562 -545
- package/dist/cjs/ez-grid.cjs.entry.js +8 -5
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +51 -3
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +1 -1
- package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-edit.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ez-upload.cjs.entry.js +1 -1
- package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/{index-b54f47a1.js → index-892780f1.js} +0 -5
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/ez-breadcrumb/ez-breadcrumb.js +12 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +16 -10
- package/dist/collection/components/ez-date-input/ez-date-input.js +1 -1
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +3 -11
- package/dist/collection/components/ez-form/ez-form.css +0 -6
- package/dist/collection/components/ez-form/ez-form.js +18 -239
- package/dist/collection/components/ez-form-view/ez-form-view.js +51 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.js +4 -4
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.js +2 -2
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +2 -2
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.js +2 -2
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +6 -6
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +2 -2
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextArea.tpl.js +2 -2
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +5 -2
- package/dist/collection/components/ez-grid/ez-grid.css +4 -2
- package/dist/collection/components/ez-grid/ez-grid.js +1 -1
- package/dist/collection/components/ez-guide-navigator/ez-guide-navigator.css +1 -1
- package/dist/collection/components/ez-guide-navigator/ez-guide-navigator.js +218 -1
- package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.css +2 -0
- package/dist/collection/components/ez-tree/ez-tree.js +151 -3
- package/dist/collection/components/ez-tree/types/Node.js +7 -1
- package/dist/collection/components/ez-tree/types/Tree.js +6 -0
- package/dist/collection/{components/ez-form → utils/form}/DataBinder.js +118 -4
- package/dist/collection/{components/ez-form → utils/form}/FormMetadata.js +83 -36
- package/dist/collection/utils/form/index.js +2 -0
- package/dist/collection/utils/index.js +2 -0
- package/dist/custom-elements/index.js +701 -557
- package/dist/esm/ez-actions-button.entry.js +1 -1
- package/dist/esm/ez-alert.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -1
- package/dist/esm/ez-breadcrumb.entry.js +13 -3
- package/dist/esm/ez-button.entry.js +1 -1
- package/dist/esm/ez-calendar.entry.js +1 -1
- package/dist/esm/ez-card-item.entry.js +1 -1
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-chip.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +17 -11
- package/dist/esm/ez-date-input.entry.js +2 -2
- package/dist/esm/ez-date-time-input.entry.js +4 -12
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-dropdown.entry.js +1 -1
- package/dist/esm/ez-file-item.entry.js +1 -1
- package/dist/esm/ez-filter-input_4.entry.js +67 -6
- package/dist/esm/ez-form-view.entry.js +30 -23
- package/dist/esm/ez-form.entry.js +563 -546
- package/dist/esm/ez-grid.entry.js +8 -5
- package/dist/esm/ez-guide-navigator.entry.js +51 -3
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-loading-bar.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-radio-button.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +1 -1
- package/dist/esm/ez-tabselector.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +1 -1
- package/dist/esm/ez-text-edit.entry.js +1 -1
- package/dist/esm/ez-text-input.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ez-upload.entry.js +1 -1
- package/dist/esm/ez-view-stack.entry.js +1 -1
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/{index-c27164d3.js → index-de655f48.js} +0 -5
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-85c1e00f.entry.js → p-06b3e801.entry.js} +1 -1
- package/dist/ezui/{p-216e1153.entry.js → p-07b99b94.entry.js} +1 -1
- package/dist/ezui/p-09271677.entry.js +1 -0
- package/dist/ezui/{p-044a3427.entry.js → p-0c7e81fe.entry.js} +1 -1
- package/dist/ezui/p-0e53898b.entry.js +1 -0
- package/dist/ezui/{p-124859c3.entry.js → p-36f7ec68.entry.js} +1 -1
- package/dist/ezui/p-4555df8f.entry.js +1 -0
- package/dist/ezui/{p-1806b3c6.entry.js → p-493e2af4.entry.js} +1 -1
- package/dist/ezui/p-50883460.entry.js +1 -0
- package/dist/ezui/p-581df847.entry.js +1 -0
- package/dist/ezui/{p-78b28632.entry.js → p-600f1732.entry.js} +1 -1
- package/dist/ezui/{p-74379544.entry.js → p-622c2d53.entry.js} +1 -1
- package/dist/ezui/{p-bb011a51.entry.js → p-62481744.entry.js} +1 -1
- package/dist/ezui/{p-064e558f.entry.js → p-6818dd0a.entry.js} +1 -1
- package/dist/ezui/{p-e8271a0e.entry.js → p-695facd0.entry.js} +1 -1
- package/dist/ezui/p-6cf406ff.entry.js +1 -0
- package/dist/ezui/{p-07d71b7a.entry.js → p-7147d43a.entry.js} +1 -1
- package/dist/ezui/{p-108acc0f.entry.js → p-7c8fb43e.entry.js} +1 -1
- package/dist/ezui/{p-00ea9b50.js → p-7ffd12e7.js} +2 -2
- package/dist/ezui/{p-aaba630e.entry.js → p-86d29565.entry.js} +1 -1
- package/dist/ezui/{p-f978bebc.entry.js → p-8d5ec02b.entry.js} +1 -1
- package/dist/ezui/{p-149442dd.entry.js → p-9613fae6.entry.js} +1 -1
- package/dist/ezui/{p-38520b9c.entry.js → p-99d822cc.entry.js} +1 -1
- package/dist/ezui/p-9a1549c2.entry.js +1 -0
- package/dist/ezui/{p-330aef41.entry.js → p-a323b415.entry.js} +1 -1
- package/dist/ezui/{p-7ff5d0cc.entry.js → p-a4b281ca.entry.js} +1 -1
- package/dist/ezui/{p-e6cf82e8.entry.js → p-a67e056f.entry.js} +1 -1
- package/dist/ezui/p-ada6e6b0.entry.js +1 -0
- package/dist/ezui/{p-93c8bdc6.entry.js → p-b3c7b243.entry.js} +1 -1
- package/dist/ezui/{p-936ae3ac.entry.js → p-b941aeee.entry.js} +1 -1
- package/dist/ezui/{p-d015295f.entry.js → p-bbccda3f.entry.js} +1 -1
- package/dist/ezui/{p-66dba09c.entry.js → p-c0184982.entry.js} +1 -1
- package/dist/ezui/{p-ce1408dd.entry.js → p-cc40fcb3.entry.js} +1 -1
- package/dist/ezui/{p-80f79b1c.entry.js → p-cc5cfcb7.entry.js} +1 -1
- package/dist/ezui/{p-77c1ae43.entry.js → p-dc15b6d1.entry.js} +2 -2
- package/dist/ezui/{p-eae59101.entry.js → p-e6f3d036.entry.js} +1 -1
- package/dist/ezui/p-e748b5d3.entry.js +1 -0
- package/dist/ezui/{p-be4cc43f.entry.js → p-e85f1a6a.entry.js} +1 -1
- package/dist/ezui/{p-1cfae451.entry.js → p-eceb9382.entry.js} +1 -1
- package/dist/ezui/{p-bb0607a6.entry.js → p-fd87638e.entry.js} +1 -1
- package/dist/types/components/ez-breadcrumb/ez-breadcrumb.d.ts +2 -1
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +0 -1
- package/dist/types/components/ez-form/ez-form.d.ts +3 -23
- package/dist/types/components/ez-form/store/form.slice.d.ts +2 -2
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +7 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.d.ts +1 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.d.ts +1 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.d.ts +1 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.d.ts +2 -2
- package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.d.ts +1 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextArea.tpl.d.ts +1 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
- package/dist/types/components/ez-form-view/interfaces/IFormViewField.d.ts +1 -0
- package/dist/types/components/ez-guide-navigator/ez-guide-navigator.d.ts +32 -0
- package/dist/types/components/ez-guide-navigator/interfaces/IGuideItem.d.ts +1 -0
- package/dist/types/components/ez-tree/ez-tree.d.ts +18 -0
- package/dist/types/components.d.ts +71 -31
- package/dist/types/utils/form/DataBinder.d.ts +31 -0
- package/dist/types/utils/form/FormMetadata.d.ts +23 -0
- package/dist/types/utils/form/index.d.ts +2 -0
- package/dist/types/utils/form/interfaces/IFormCardConfig.d.ts +5 -0
- package/dist/types/utils/form/interfaces/IFormConfig.d.ts +12 -0
- package/dist/types/utils/form/interfaces/IFormSheetMetadata.d.ts +6 -0
- package/dist/types/{components/ez-form → utils/form}/interfaces/IRecordValidator.d.ts +1 -2
- package/dist/types/utils/form/interfaces/ISummaryField.d.ts +4 -0
- package/dist/types/{interfaces/ez-form → utils/form/interfaces}/ITabConfig.d.ts +1 -0
- package/dist/types/{components/ez-form → utils/form}/interfaces/index.d.ts +6 -4
- package/dist/types/utils/index.d.ts +2 -0
- package/package.json +2 -2
- package/dist/collection/interfaces/ez-form/IDefaultConfig.js +0 -1
- package/dist/collection/interfaces/ez-form/IFieldConfig.js +0 -1
- package/dist/collection/interfaces/ez-form/IFieldMetadata.js +0 -1
- package/dist/collection/interfaces/ez-form/IFieldSetMetadata.js +0 -1
- package/dist/collection/interfaces/ez-form/IFormSheetMetadata.js +0 -1
- package/dist/collection/interfaces/ez-form/IInvalidField.js +0 -1
- package/dist/collection/interfaces/ez-form/IRecordValidator.js +0 -1
- package/dist/collection/interfaces/ez-form/IValidationResult.js +0 -1
- package/dist/collection/interfaces/ez-form/index.js +0 -1
- package/dist/ezui/p-1a1c2eda.entry.js +0 -1
- package/dist/ezui/p-51ecf138.entry.js +0 -1
- package/dist/ezui/p-5473e08d.entry.js +0 -1
- package/dist/ezui/p-77d70bae.entry.js +0 -1
- package/dist/ezui/p-90c3d4fd.entry.js +0 -1
- package/dist/ezui/p-97cfbd29.entry.js +0 -1
- package/dist/ezui/p-a0e47238.entry.js +0 -1
- package/dist/ezui/p-bfca509e.entry.js +0 -1
- package/dist/ezui/p-cd1e0679.entry.js +0 -1
- package/dist/types/components/ez-form/DataBinder.d.ts +0 -22
- package/dist/types/components/ez-form/FormMetadata.d.ts +0 -16
- package/dist/types/components/ez-form/interfaces/IFormConfig.d.ts +0 -7
- package/dist/types/components/ez-form/interfaces/IFormSheetMetadata.d.ts +0 -9
- package/dist/types/components/ez-form/interfaces/ITabConfig.d.ts +0 -5
- package/dist/types/interfaces/ez-form/IDefaultConfig.d.ts +0 -5
- package/dist/types/interfaces/ez-form/IFieldConfig.d.ts +0 -13
- package/dist/types/interfaces/ez-form/IFieldMetadata.d.ts +0 -6
- package/dist/types/interfaces/ez-form/IFieldSetMetadata.d.ts +0 -5
- package/dist/types/interfaces/ez-form/IFormConfig.d.ts +0 -7
- package/dist/types/interfaces/ez-form/IFormSheetMetadata.d.ts +0 -10
- package/dist/types/interfaces/ez-form/IInvalidField.d.ts +0 -4
- package/dist/types/interfaces/ez-form/IRecordValidator.d.ts +0 -6
- package/dist/types/interfaces/ez-form/IValidationResult.d.ts +0 -8
- package/dist/types/interfaces/ez-form/index.d.ts +0 -10
- /package/dist/collection/{components/ez-form → utils/form}/interfaces/IDefaultConfig.js +0 -0
- /package/dist/collection/{components/ez-form → utils/form}/interfaces/IFieldConfig.js +0 -0
- /package/dist/collection/{components/ez-form/interfaces/IFormConfig.js → utils/form/interfaces/IFormCardConfig.js} +0 -0
- /package/dist/collection/{interfaces/ez-form → utils/form/interfaces}/IFormConfig.js +0 -0
- /package/dist/collection/{components/ez-form → utils/form}/interfaces/IFormSheetMetadata.js +0 -0
- /package/dist/collection/{components/ez-form → utils/form}/interfaces/IInvalidField.js +0 -0
- /package/dist/collection/{components/ez-form → utils/form}/interfaces/IRecordValidator.js +0 -0
- /package/dist/collection/{components/ez-form/interfaces/ITabConfig.js → utils/form/interfaces/ISummaryField.js} +0 -0
- /package/dist/collection/{interfaces/ez-form → utils/form/interfaces}/ITabConfig.js +0 -0
- /package/dist/collection/{components/ez-form → utils/form}/interfaces/IValidationResult.js +0 -0
- /package/dist/collection/{components/ez-form → utils/form}/interfaces/index.js +0 -0
- /package/dist/types/{components/ez-form → utils/form}/interfaces/IDefaultConfig.d.ts +0 -0
- /package/dist/types/{components/ez-form → utils/form}/interfaces/IFieldConfig.d.ts +0 -0
- /package/dist/types/{components/ez-form → utils/form}/interfaces/IInvalidField.d.ts +0 -0
- /package/dist/types/{components/ez-form → utils/form}/interfaces/IValidationResult.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLElement as HTMLElement$1, createEvent, h, Host, forceUpdate, proxyCustomElement } from '@stencil/core/internal/client';
|
|
2
2
|
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
3
|
-
import {
|
|
3
|
+
import { UserInterface, DateUtils as DateUtils$1, Action, WaitingChangeException, ApplicationContext, DataUnitAction, FloatingManager, ElementIDUtils, ObjectUtils as ObjectUtils$1, JSUtils, StringUtils as StringUtils$1, TimeFormatter, DataUnit, NumberUtils as NumberUtils$1, DataType, SortMode, MaskFormatter } from '@sankhyalabs/core';
|
|
4
4
|
|
|
5
5
|
var DialogType;
|
|
6
6
|
(function (DialogType) {
|
|
@@ -149,6 +149,509 @@ var CheckMode;
|
|
|
149
149
|
CheckMode["SWITCH"] = "SWITCH";
|
|
150
150
|
})(CheckMode || (CheckMode = {}));
|
|
151
151
|
|
|
152
|
+
const DETAIL_PATTERN = /child\[([^\]]+)\]/;
|
|
153
|
+
const REGEX_DEFAULT_VAR_KEY = /\$\{.+\}/;
|
|
154
|
+
class FormMetadata {
|
|
155
|
+
constructor() {
|
|
156
|
+
this._sheets = new Map();
|
|
157
|
+
this._requiredFields = [];
|
|
158
|
+
this._cleanOnCopyFields = [];
|
|
159
|
+
this._defaultValues = {};
|
|
160
|
+
}
|
|
161
|
+
static getDetailName(name) {
|
|
162
|
+
const result = DETAIL_PATTERN.exec(name);
|
|
163
|
+
return result ? result[1] : undefined;
|
|
164
|
+
}
|
|
165
|
+
getSheet(name) {
|
|
166
|
+
return this._sheets.get(name);
|
|
167
|
+
}
|
|
168
|
+
getAllSheets() {
|
|
169
|
+
return this._sheets;
|
|
170
|
+
}
|
|
171
|
+
addSheet(sheet) {
|
|
172
|
+
this._sheets.set(sheet.name, sheet);
|
|
173
|
+
}
|
|
174
|
+
addRequiredFields(fields) {
|
|
175
|
+
this._requiredFields = this._requiredFields.concat(fields);
|
|
176
|
+
}
|
|
177
|
+
getRequiredFields() {
|
|
178
|
+
return this._requiredFields;
|
|
179
|
+
}
|
|
180
|
+
addCleanOnCopyFields(fields) {
|
|
181
|
+
this._cleanOnCopyFields = this._cleanOnCopyFields.concat(fields);
|
|
182
|
+
}
|
|
183
|
+
getCleanOnCopyFields() {
|
|
184
|
+
return this._cleanOnCopyFields;
|
|
185
|
+
}
|
|
186
|
+
addDefaultValues(defaultValues) {
|
|
187
|
+
return this._defaultValues = Object.assign(Object.assign({}, this._defaultValues), defaultValues);
|
|
188
|
+
}
|
|
189
|
+
getDefaultValues() {
|
|
190
|
+
const result = {};
|
|
191
|
+
Object.entries(this._defaultValues).forEach(([key, value]) => {
|
|
192
|
+
if (typeof value === "string") {
|
|
193
|
+
const result = REGEX_DEFAULT_VAR_KEY.exec(value);
|
|
194
|
+
if (result) {
|
|
195
|
+
value = this.getDefaultVar(result[0]);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
result[key] = value;
|
|
199
|
+
});
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
202
|
+
getDefaultVar(name) {
|
|
203
|
+
if (name === "${data}") {
|
|
204
|
+
return DateUtils$1.getToday();
|
|
205
|
+
}
|
|
206
|
+
if (name === "${datahora}") {
|
|
207
|
+
return DateUtils$1.getToday(true);
|
|
208
|
+
}
|
|
209
|
+
return this._defaultVars ? this._defaultVars.get(name) : undefined;
|
|
210
|
+
}
|
|
211
|
+
setDefaultVars(vars) {
|
|
212
|
+
this._defaultVars = vars;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const buildFormConfigFromDataUnit = (dataUnit) => {
|
|
216
|
+
const unitMD = dataUnit.metadata;
|
|
217
|
+
let fields;
|
|
218
|
+
if (unitMD) {
|
|
219
|
+
fields = unitMD.fields
|
|
220
|
+
.filter(descriptor => descriptor.visible !== false)
|
|
221
|
+
.map(descriptor => { return { name: descriptor.name, defaultValue: descriptor.defaultValue }; });
|
|
222
|
+
}
|
|
223
|
+
const config = { fields };
|
|
224
|
+
return config;
|
|
225
|
+
};
|
|
226
|
+
const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
227
|
+
var _a, _b;
|
|
228
|
+
if (config == undefined) {
|
|
229
|
+
config = buildFormConfigFromDataUnit(dataUnit);
|
|
230
|
+
}
|
|
231
|
+
const sheets = new Map();
|
|
232
|
+
const hiddenTabs = new Map();
|
|
233
|
+
const requiredFields = [];
|
|
234
|
+
const cleanOnCopyFields = [];
|
|
235
|
+
const defaultValues = {};
|
|
236
|
+
(_a = config === null || config === void 0 ? void 0 : config.tabs) === null || _a === void 0 ? void 0 : _a.forEach((tab) => {
|
|
237
|
+
if (!hiddenTabs.has(tab.label) && tab.visible === false) {
|
|
238
|
+
hiddenTabs.set(tab.label, tab);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
(_b = config === null || config === void 0 ? void 0 : config.fields) === null || _b === void 0 ? void 0 : _b.forEach((field) => {
|
|
242
|
+
var _a, _b, _c;
|
|
243
|
+
if (field.visible !== false) {
|
|
244
|
+
const tabConfig = getTabConfig(field.tab || "__main", sheets);
|
|
245
|
+
if (hiddenTabs.has(tabConfig.label)) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const descriptor = dataUnit.getField(field.name);
|
|
249
|
+
if (descriptor && tabConfig.visible) {
|
|
250
|
+
if (!sheets.has(tabConfig)) {
|
|
251
|
+
sheets.set(tabConfig, []);
|
|
252
|
+
}
|
|
253
|
+
const formField = buildFormField(descriptor, field);
|
|
254
|
+
sheets.get(tabConfig).push(formField);
|
|
255
|
+
if (formField.required) {
|
|
256
|
+
requiredFields.push(field.name);
|
|
257
|
+
}
|
|
258
|
+
const cleanOnCopy = field.cleanOnCopy == undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : field.cleanOnCopy;
|
|
259
|
+
if (cleanOnCopy || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.cleanOnCopy)) {
|
|
260
|
+
cleanOnCopyFields.push(field.name);
|
|
261
|
+
}
|
|
262
|
+
let defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
|
|
263
|
+
if (defaultValue) {
|
|
264
|
+
if ((typeof defaultValue === "object") && defaultValue["type"] === "V") {
|
|
265
|
+
// Atualmente a configuração do formulário eventualmente deposita um objeto
|
|
266
|
+
// prototipado como {type: "V", value: "${nome.de.variavel}"} para campos com
|
|
267
|
+
// valor padrão do tipo variável. Dessa forma precisamos "desenvelopar" o valor
|
|
268
|
+
// para que a variável chegue corretamente a seu destino.
|
|
269
|
+
defaultValue = defaultValue["value"];
|
|
270
|
+
}
|
|
271
|
+
defaultValues[field.name] = defaultValue;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
const metadata = new FormMetadata();
|
|
277
|
+
metadata.setDefaultVars(config.defaultVars);
|
|
278
|
+
if (includeDetails) {
|
|
279
|
+
const unitMD = dataUnit.metadata;
|
|
280
|
+
if (unitMD != undefined && unitMD.children != undefined) {
|
|
281
|
+
unitMD.children.forEach(child => {
|
|
282
|
+
const { label, name, fields } = buildDetailSheet(child);
|
|
283
|
+
sheets.set({ name, label }, fields);
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
Array.from(sheets.entries())
|
|
288
|
+
.sort(sortTabs)
|
|
289
|
+
.forEach(([key, fields]) => {
|
|
290
|
+
metadata.addSheet({
|
|
291
|
+
label: (key.label === "__main") ? "Principal" : key.label,
|
|
292
|
+
name: key.name || key.label,
|
|
293
|
+
fields
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
metadata.addRequiredFields(requiredFields);
|
|
297
|
+
metadata.addCleanOnCopyFields(cleanOnCopyFields);
|
|
298
|
+
metadata.addDefaultValues(defaultValues);
|
|
299
|
+
return metadata;
|
|
300
|
+
};
|
|
301
|
+
const buildFormField = (descriptor, config) => {
|
|
302
|
+
let { name, label, group } = Object.assign({}, config);
|
|
303
|
+
let { readOnly, required } = Object.assign({}, config);
|
|
304
|
+
let props;
|
|
305
|
+
let userInterface;
|
|
306
|
+
if (descriptor) {
|
|
307
|
+
label = label || descriptor.label;
|
|
308
|
+
name = name || descriptor.name;
|
|
309
|
+
required = descriptor.required || (config === null || config === void 0 ? void 0 : config.required);
|
|
310
|
+
readOnly = descriptor.readOnly || (config === null || config === void 0 ? void 0 : config.readOnly);
|
|
311
|
+
props = descriptor.properties;
|
|
312
|
+
userInterface = descriptor.userInterface;
|
|
313
|
+
}
|
|
314
|
+
return {
|
|
315
|
+
name, label, group,
|
|
316
|
+
readOnly, required,
|
|
317
|
+
props,
|
|
318
|
+
userInterface: userInterface || UserInterface.SHORTTEXT
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
const getTabConfig = (tab, sheets) => {
|
|
322
|
+
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
323
|
+
return tabConfig || { label: tab, visible: true };
|
|
324
|
+
};
|
|
325
|
+
const sortTabs = (a, b) => {
|
|
326
|
+
return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
327
|
+
};
|
|
328
|
+
const buildDetailSheet = (child) => {
|
|
329
|
+
return {
|
|
330
|
+
name: `child[${child.name}]`,
|
|
331
|
+
label: child.label,
|
|
332
|
+
fields: []
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
class DataBinder {
|
|
337
|
+
constructor(dataUnit) {
|
|
338
|
+
this._invalidFields = new Map();
|
|
339
|
+
this.onDataUnitEvent = (action) => {
|
|
340
|
+
var _a;
|
|
341
|
+
switch (action.type) {
|
|
342
|
+
case Action.DATA_LOADED:
|
|
343
|
+
case Action.DATA_SAVED:
|
|
344
|
+
case Action.RECORDS_REMOVED:
|
|
345
|
+
case Action.RECORDS_ADDED:
|
|
346
|
+
case Action.RECORDS_COPIED:
|
|
347
|
+
case Action.EDITION_CANCELED:
|
|
348
|
+
case Action.SELECTION_CHANGED:
|
|
349
|
+
case Action.NEXT_SELECTED:
|
|
350
|
+
case Action.PREVIOUS_SELECTED:
|
|
351
|
+
this.clearInvalid();
|
|
352
|
+
case Action.DATA_CHANGED:
|
|
353
|
+
case Action.CHANGE_UNDONE:
|
|
354
|
+
case Action.CHANGE_REDONE:
|
|
355
|
+
case Action.RECORD_LOADED:
|
|
356
|
+
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
357
|
+
this.updateValue(field.fieldName, field.field);
|
|
358
|
+
});
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
this._fields = new Map();
|
|
363
|
+
this._dataUnit = dataUnit;
|
|
364
|
+
this._dataUnit.subscribe(this.onDataUnitEvent);
|
|
365
|
+
this._dataUnit.addInterceptor(this);
|
|
366
|
+
}
|
|
367
|
+
bind(fields, currentContextName, formMetadata, recordsValidator) {
|
|
368
|
+
fields.forEach(fieldElement => {
|
|
369
|
+
const { fieldName, contextName } = fieldElement.dataset;
|
|
370
|
+
if (contextName == undefined || contextName === currentContextName) {
|
|
371
|
+
this.updateBind(fieldName, fieldElement);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
this._formMetadata = formMetadata;
|
|
375
|
+
this._recordsValidator = recordsValidator;
|
|
376
|
+
}
|
|
377
|
+
onDisconnectedCallback() {
|
|
378
|
+
this._dataUnit.unsubscribe(this.onDataUnitEvent);
|
|
379
|
+
this._dataUnit.removeInterceptor(this);
|
|
380
|
+
}
|
|
381
|
+
markInvalid(field) {
|
|
382
|
+
this._invalidFields.set(field.name, field);
|
|
383
|
+
if (this._fields.has(field.name)) {
|
|
384
|
+
const fieldElement = this._fields.get(field.name).field;
|
|
385
|
+
if (!fieldElement["errorMessage"]) {
|
|
386
|
+
this.updateErrorMessage(field.name, fieldElement);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
clearInvalid() {
|
|
391
|
+
this._invalidFields.clear();
|
|
392
|
+
this._fields.forEach(fieldBinder => {
|
|
393
|
+
const fieldElement = fieldBinder.field;
|
|
394
|
+
fieldElement["errorMessage"] = "";
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
updateValue(fieldName, field) {
|
|
398
|
+
const bind = this._fields.get(fieldName);
|
|
399
|
+
try {
|
|
400
|
+
if (bind) {
|
|
401
|
+
bind.listen = false;
|
|
402
|
+
}
|
|
403
|
+
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
404
|
+
this.updateErrorMessage(fieldName, field);
|
|
405
|
+
}
|
|
406
|
+
finally {
|
|
407
|
+
if (bind) {
|
|
408
|
+
bind.listen = true;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
validate() {
|
|
413
|
+
return new Promise((accept, reject) => {
|
|
414
|
+
var _a;
|
|
415
|
+
const records = this._dataUnit.getModifiedRecords();
|
|
416
|
+
for (let i = 0; i < records.length; i++) {
|
|
417
|
+
const record = records[i];
|
|
418
|
+
const invalidResults = [];
|
|
419
|
+
let validationResult = this.validateRequired(record);
|
|
420
|
+
if (validationResult && !validationResult.isValid) {
|
|
421
|
+
invalidResults.push(validationResult);
|
|
422
|
+
}
|
|
423
|
+
validationResult = (_a = this._recordsValidator) === null || _a === void 0 ? void 0 : _a.validateRecord(record);
|
|
424
|
+
if (validationResult && !validationResult.isValid) {
|
|
425
|
+
invalidResults.push(validationResult);
|
|
426
|
+
}
|
|
427
|
+
if (invalidResults.length > 0) {
|
|
428
|
+
this.processValidationResult(invalidResults);
|
|
429
|
+
reject();
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return accept();
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
validateRequired(record) {
|
|
437
|
+
const requiredFields = this._formMetadata.getRequiredFields();
|
|
438
|
+
const invalidFields = [];
|
|
439
|
+
new Set(requiredFields).forEach(field => {
|
|
440
|
+
const value = record[field];
|
|
441
|
+
if (value == undefined || value === "") {
|
|
442
|
+
const errorMessage = this.getErrorMessage(field);
|
|
443
|
+
if (errorMessage) {
|
|
444
|
+
invalidFields.push({ name: field, message: errorMessage });
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
invalidFields.push({ name: field, message: "Essa informação é obrigatória" });
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
if (invalidFields.length > 0) {
|
|
452
|
+
return { isValid: false, invalidFields, infoMessage: "Há pelo menos um campo obrigatório não preenchido." };
|
|
453
|
+
}
|
|
454
|
+
return undefined;
|
|
455
|
+
}
|
|
456
|
+
processValidationResult(validationResult) {
|
|
457
|
+
validationResult.forEach(invalidResult => {
|
|
458
|
+
const invalidFields = invalidResult.invalidFields;
|
|
459
|
+
if (invalidFields) {
|
|
460
|
+
invalidFields.forEach(field => {
|
|
461
|
+
this.markInvalid(field);
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
if (invalidResult.infoMessage) {
|
|
465
|
+
ApplicationUtils.info(invalidResult.infoMessage);
|
|
466
|
+
}
|
|
467
|
+
if (invalidResult.errorMessage) {
|
|
468
|
+
const { errorTitle, errorMessage } = invalidResult;
|
|
469
|
+
ApplicationUtils.error(errorTitle, errorMessage);
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
updateErrorMessage(fieldName, field) {
|
|
474
|
+
const invalidField = this._invalidFields.get(fieldName);
|
|
475
|
+
if (invalidField) {
|
|
476
|
+
field["errorMessage"] = invalidField.message;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
getErrorMessage(fieldName) {
|
|
480
|
+
if (this._fields.has(fieldName)) {
|
|
481
|
+
const fieldElement = this._fields.get(fieldName).field;
|
|
482
|
+
return fieldElement["errorMessage"] || null;
|
|
483
|
+
}
|
|
484
|
+
return undefined;
|
|
485
|
+
}
|
|
486
|
+
updateBind(fieldName, field) {
|
|
487
|
+
const oldBind = this._fields.get(fieldName);
|
|
488
|
+
if (oldBind) {
|
|
489
|
+
oldBind.destroy();
|
|
490
|
+
}
|
|
491
|
+
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
492
|
+
this.updateErrorMessage(fieldName, field);
|
|
493
|
+
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
494
|
+
this.bindSearchOptionsLoader(fieldName, field);
|
|
495
|
+
this.applyEzUploadContext(fieldName, field);
|
|
496
|
+
}
|
|
497
|
+
changeStarted(fieldName, waitingChange) {
|
|
498
|
+
/**
|
|
499
|
+
* se o waitingChange não é blocante, add um event listener pra
|
|
500
|
+
* fazer o accept da promise
|
|
501
|
+
*
|
|
502
|
+
* se não tiver promise no waitingChange, eu crio uma e resolvo no bind
|
|
503
|
+
*
|
|
504
|
+
*
|
|
505
|
+
*/
|
|
506
|
+
if (this._dataUnit.records.length === 0) {
|
|
507
|
+
this._dataUnit.addRecord();
|
|
508
|
+
}
|
|
509
|
+
if (!waitingChange.blocking && waitingChange.promise == undefined) {
|
|
510
|
+
const bind = this._fields.get(fieldName);
|
|
511
|
+
if (bind) {
|
|
512
|
+
waitingChange.promise = new Promise((resolve, reject) => {
|
|
513
|
+
bind.waitingChangePromiseResolve = resolve;
|
|
514
|
+
bind.waitingChangePromiseReject = reject;
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
this._dataUnit.startChange(fieldName, waitingChange);
|
|
519
|
+
}
|
|
520
|
+
cancelWaitingChange(fieldName) {
|
|
521
|
+
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
522
|
+
this._dataUnit.cancelWaitingChange(fieldName);
|
|
523
|
+
const bind = this._fields.get(fieldName);
|
|
524
|
+
if (bind) {
|
|
525
|
+
bind.rejectWaitingChange(new WaitingChangeException("Change canceled", fieldName));
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
setFieldValue(fieldName, newValue) {
|
|
530
|
+
if (this._dataUnit.records.length === 0) {
|
|
531
|
+
this._dataUnit.addRecord();
|
|
532
|
+
}
|
|
533
|
+
this._invalidFields.delete(fieldName);
|
|
534
|
+
this._dataUnit.setFieldValue(fieldName, newValue);
|
|
535
|
+
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
536
|
+
const bind = this._fields.get(fieldName);
|
|
537
|
+
if (bind) {
|
|
538
|
+
bind.acceptWaitingChange();
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
bindSearchOptionsLoader(fieldName, field) {
|
|
543
|
+
if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
|
|
544
|
+
const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
|
|
545
|
+
if (loader) {
|
|
546
|
+
field["optionLoader"] = (arg) => {
|
|
547
|
+
return loader(arg, fieldName, this._dataUnit);
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
applyEzUploadContext(fieldName, field) {
|
|
553
|
+
var _a, _b;
|
|
554
|
+
if (field.nodeName === "EZ-UPLOAD") {
|
|
555
|
+
field["urlUpload"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__ADD__URL__");
|
|
556
|
+
field["urlDelete"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__DEL__URL__");
|
|
557
|
+
const descriptor = this._dataUnit.getField(fieldName);
|
|
558
|
+
const destination = (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.DESTINATION;
|
|
559
|
+
if (destination) {
|
|
560
|
+
field["requestHeaders"] = { XTRAINF: `{"destination": "${destination}"}` };
|
|
561
|
+
}
|
|
562
|
+
field["maxFiles"] = ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.MAX_FILES) || 0;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
interceptAction(action) {
|
|
566
|
+
var _a;
|
|
567
|
+
if (action.type === Action.RECORDS_COPIED) {
|
|
568
|
+
const cleanFields = this._formMetadata.getCleanOnCopyFields();
|
|
569
|
+
if (cleanFields) {
|
|
570
|
+
const records = action.payload;
|
|
571
|
+
return new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
|
|
572
|
+
const newRecord = Object.assign({}, record);
|
|
573
|
+
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
574
|
+
return newRecord;
|
|
575
|
+
}));
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
if (action.type === Action.SAVING_DATA) {
|
|
579
|
+
return new Promise((resolve) => {
|
|
580
|
+
this.validate()
|
|
581
|
+
.then(() => resolve(action))
|
|
582
|
+
.catch(() => { });
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
if (action.type === Action.RECORDS_ADDED) {
|
|
586
|
+
const defaultValues = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getDefaultValues();
|
|
587
|
+
if (defaultValues) {
|
|
588
|
+
const records = action.payload;
|
|
589
|
+
return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
|
|
590
|
+
const newRecord = Object.assign({}, record);
|
|
591
|
+
for (const field in defaultValues) {
|
|
592
|
+
const defaultValue = this.getFormattedValue(defaultValues[field]);
|
|
593
|
+
const recordValue = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
594
|
+
newRecord[field] = this._dataUnit.valueFromString(field, recordValue);
|
|
595
|
+
}
|
|
596
|
+
return newRecord;
|
|
597
|
+
}));
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return action;
|
|
601
|
+
}
|
|
602
|
+
getFormattedValue(defaultValue) {
|
|
603
|
+
if (defaultValue == undefined || typeof defaultValue !== "object") {
|
|
604
|
+
return defaultValue;
|
|
605
|
+
}
|
|
606
|
+
if ("formattedValue" in defaultValue) {
|
|
607
|
+
return defaultValue.formattedValue;
|
|
608
|
+
}
|
|
609
|
+
return defaultValue.value;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
class Bind {
|
|
613
|
+
constructor() {
|
|
614
|
+
this.listen = true;
|
|
615
|
+
this.startChangeEventName = "ezStartChange";
|
|
616
|
+
this.cancelWaitingChangeEventName = "ezCancelWaitingChange";
|
|
617
|
+
this.changeEventName = "ezChange";
|
|
618
|
+
}
|
|
619
|
+
destroy() {
|
|
620
|
+
this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
|
|
621
|
+
this.field.removeEventListener(this.cancelWaitingChangeEventName, this.cancelWaitingChangeListener);
|
|
622
|
+
this.field.removeEventListener(this.changeEventName, this.changeListener);
|
|
623
|
+
}
|
|
624
|
+
acceptWaitingChange() {
|
|
625
|
+
if (this.waitingChangePromiseResolve) {
|
|
626
|
+
this.waitingChangePromiseResolve();
|
|
627
|
+
this.waitingChangePromiseReject = undefined;
|
|
628
|
+
this.waitingChangePromiseResolve = undefined;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
rejectWaitingChange(reason) {
|
|
632
|
+
if (this.waitingChangePromiseReject) {
|
|
633
|
+
this.waitingChangePromiseReject(reason);
|
|
634
|
+
this.waitingChangePromiseReject = undefined;
|
|
635
|
+
this.waitingChangePromiseResolve = undefined;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
static create(fieldName, field, startChangeCallback, cancelWaitingChangeCallback, changeCallback) {
|
|
639
|
+
const b = new Bind();
|
|
640
|
+
b.field = field;
|
|
641
|
+
b.fieldName = fieldName;
|
|
642
|
+
b.startChangeListener = (evt) => { if (b.listen)
|
|
643
|
+
startChangeCallback(fieldName, evt.detail); };
|
|
644
|
+
b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
|
|
645
|
+
b.cancelWaitingChangeListener = () => { if (b.listen)
|
|
646
|
+
cancelWaitingChangeCallback(fieldName); };
|
|
647
|
+
b.field.addEventListener(b.cancelWaitingChangeEventName, b.cancelWaitingChangeListener);
|
|
648
|
+
b.changeListener = (evt) => { if (b.listen)
|
|
649
|
+
changeCallback(fieldName, evt.detail); };
|
|
650
|
+
b.field.addEventListener(b.changeEventName, b.changeListener);
|
|
651
|
+
return b;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
152
655
|
const ezActionsButtonCss = ":host{--ez-actions-button__actions-list--border-radius:var(--border--radius-medium, 12px);--ez-actions-button__actions-list--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-actions-button__actions-list--background-color:var(--background--xlight, #fff);--ez-actions-button__actions-list--padding:var(--space--small, 6px);--ez-actions-button__actions-list--top-margin:var(--space-small, 6px);--ez-actions-button__btn-action--min-width:'auto';--ez-actions-button__btn-action--background-color:var(--background--xlight, #fff);display:flex;flex-direction:column;height:fit-content;user-select:none}.ez-actions-button__actions-list{display:flex;flex-direction:column;position:fixed;width:fit-content;height:fit-content;z-index:var(--more-visible, 2);padding:var(--ez-actions-button__actions-list--padding);margin-top:var(--ez-actions-button__actions-list--top-margin);background-color:var(--ez-actions-button__actions-list--background-color);border-radius:var(--ez-actions-button__actions-list--border-radius);box-shadow:var(--ez-actions-button__actions-list--box-shadow)}.ez-actions-button__actions-list--lowered{margin-top:calc(var(--ez-actions-button__actions-list--top-margin) + 6px)}.ez-actions-button__btn-action{--ez-button--justify-content:flex-start;--ez-button--width:100%;--ez-button--min-width:var(--ez-actions-button__btn-action--min-width);--ez-button--background-color:var(--ez-actions-button__btn-action--background-color);--ez-button--font-weight:var(--text-weight--medium, 400);--ez-button--padding-left:var(--space--medium, 12px);--ez-button--padding-right:var(--space--medium, 12px)}.ez-actions-button__btn-action--spaced{--ez-button--padding-left:calc(var(--space--medium, 12px) + 24px)}.ez-actions-button__icon-right{margin-left:var(--space--small, 6px)}.ez-actions-button__icon-check,.ez-actions-button__icon-item{position:absolute;left:var(--space--medium, 12px)}.ez-actions-button__icon-check{color:var(--ez-button--hover-color)}.ez-actions-button__arrow{position:absolute;border-left:10px solid transparent;border-right:10px solid transparent;width:0;height:0;z-index:calc(var(--more-visible, 2) + 1);border-bottom:15px solid var(--ez-actions-button__btn-action--background-color)}.ez-actions-button__arrow--upped{margin-top:calc((var(--ez-actions-button__actions-list--top-margin) + 2px) * -1)}.ez-actions-button__arrow--small{margin-left:6px}.ez-actions-button__arrow--medium{margin-left:11px}.ez-actions-button__arrow--large{margin-left:13px}.ez-actions-button__arrow:only-child{display:none}.ez-actions-button__btn-transparent{--ez-button--background-color:transparent;--ez-button--hover--background-color:transparent;--ez-button--active--background-color:transparent;--ez-button--focus--border:none}.ez-actions-button__btn-label{--ez-button--padding-left:var(--space--medium, 12px);--ez-button--padding-right:var(--space--medium, 12px)}.ez-actions-button__list-container{position:relative}";
|
|
153
656
|
|
|
154
657
|
const EzActionsButton$1 = class extends HTMLElement$1 {
|
|
@@ -459,7 +962,10 @@ const EzBreadcrumb$1 = class extends HTMLElement$1 {
|
|
|
459
962
|
this.showDropdown = false;
|
|
460
963
|
this.collapseConfigPosition = -1;
|
|
461
964
|
}
|
|
462
|
-
watchPropHandler() {
|
|
965
|
+
watchPropHandler(newValue, oldValue) {
|
|
966
|
+
if (ObjectUtils$1.objectToString(newValue || []) !== ObjectUtils$1.objectToString(oldValue || [])) {
|
|
967
|
+
this.loadItems();
|
|
968
|
+
}
|
|
463
969
|
this.fillMode === "auto" && this.handleResize();
|
|
464
970
|
}
|
|
465
971
|
watchPropHiddenItems() {
|
|
@@ -472,7 +978,11 @@ const EzBreadcrumb$1 = class extends HTMLElement$1 {
|
|
|
472
978
|
this.setEvents();
|
|
473
979
|
}
|
|
474
980
|
componentWillLoad() {
|
|
981
|
+
this.loadItems();
|
|
982
|
+
}
|
|
983
|
+
loadItems() {
|
|
475
984
|
this.visibleItems = [...this.items];
|
|
985
|
+
this.hiddenItems = [];
|
|
476
986
|
if (this.fillMode === 'regular') {
|
|
477
987
|
this.configModeRegular();
|
|
478
988
|
}
|
|
@@ -517,6 +1027,9 @@ const EzBreadcrumb$1 = class extends HTMLElement$1 {
|
|
|
517
1027
|
this._renderSecond = true;
|
|
518
1028
|
return;
|
|
519
1029
|
}
|
|
1030
|
+
if (this._element.parentElement == undefined) {
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
520
1033
|
let { offsetWidth } = this._element.parentElement;
|
|
521
1034
|
let sumVisibleItems = 0;
|
|
522
1035
|
this.visibleItems.forEach(item => sumVisibleItems += item.width);
|
|
@@ -1351,6 +1864,10 @@ const EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
1351
1864
|
}
|
|
1352
1865
|
observeValue(newValue, oldValue) {
|
|
1353
1866
|
if (this._textInput && newValue != oldValue) {
|
|
1867
|
+
if (this.searchMode && typeof newValue === "string") {
|
|
1868
|
+
this.setInputValue();
|
|
1869
|
+
return;
|
|
1870
|
+
}
|
|
1354
1871
|
const newValueSelected = this.getSelectedOption(newValue);
|
|
1355
1872
|
const oldValueSelected = this.getSelectedOption(oldValue);
|
|
1356
1873
|
const currentValue = this.getSelectedOption(this.value);
|
|
@@ -1557,7 +2074,7 @@ const EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
1557
2074
|
var _a, _b;
|
|
1558
2075
|
const currentValue = this.getSelectedOption(this.value);
|
|
1559
2076
|
if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOption === null || newOption === void 0 ? void 0 : newOption.value) === null || _b === void 0 ? void 0 : _b.toString()))
|
|
1560
|
-
|| (currentValue == undefined && "value" in newOption)) {
|
|
2077
|
+
|| (currentValue == undefined && newOption != undefined && "value" in newOption)) {
|
|
1561
2078
|
const adjustedOpt = !(newOption === null || newOption === void 0 ? void 0 : newOption.value) ? undefined : newOption;
|
|
1562
2079
|
this.value = adjustedOpt;
|
|
1563
2080
|
}
|
|
@@ -1625,11 +2142,17 @@ const EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
1625
2142
|
}
|
|
1626
2143
|
}
|
|
1627
2144
|
validateDescriptionValue() {
|
|
1628
|
-
if (!this.searchMode ||
|
|
2145
|
+
if (!this.searchMode || StringUtils$1.isEmpty(this.value)) {
|
|
1629
2146
|
return;
|
|
1630
2147
|
}
|
|
1631
|
-
|
|
1632
|
-
if (
|
|
2148
|
+
let value = this.value;
|
|
2149
|
+
if (typeof value === "object") {
|
|
2150
|
+
if (!StringUtils$1.isEmpty(value.label)) {
|
|
2151
|
+
return;
|
|
2152
|
+
}
|
|
2153
|
+
value = value.value;
|
|
2154
|
+
}
|
|
2155
|
+
if (StringUtils$1.isEmpty(value)) {
|
|
1633
2156
|
return;
|
|
1634
2157
|
}
|
|
1635
2158
|
this.loadDescriptionValue(value);
|
|
@@ -1729,16 +2252,12 @@ const EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
1729
2252
|
(_a = this._optionsList) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".item").forEach((elem) => {
|
|
1730
2253
|
ElementIDUtils.addIDInfoIfNotExists(elem, "itemComboBox");
|
|
1731
2254
|
});
|
|
2255
|
+
this.validateDescriptionValue();
|
|
1732
2256
|
}
|
|
1733
2257
|
componentDidLoad() {
|
|
1734
2258
|
CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
|
|
1735
2259
|
this.setInputValue(false);
|
|
1736
2260
|
}
|
|
1737
|
-
componentShouldUpdate(newValue, oldValue) {
|
|
1738
|
-
if (this.isDifferentValues(newValue, oldValue)) {
|
|
1739
|
-
this.validateDescriptionValue();
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
2261
|
//---------------------------------------------
|
|
1743
2262
|
// Event handlers
|
|
1744
2263
|
//---------------------------------------------
|
|
@@ -1981,7 +2500,7 @@ const EzDateInput$1 = class extends HTMLElement$1 {
|
|
|
1981
2500
|
}
|
|
1982
2501
|
}
|
|
1983
2502
|
getTextValue(d) {
|
|
1984
|
-
return d ?
|
|
2503
|
+
return d ? DateUtils$1.formatDate(d) : undefined;
|
|
1985
2504
|
}
|
|
1986
2505
|
handleInput(event) {
|
|
1987
2506
|
const strValue = this._textInput.value;
|
|
@@ -2179,18 +2698,10 @@ const EzDateTimeInput$1 = class extends HTMLElement$1 {
|
|
|
2179
2698
|
}
|
|
2180
2699
|
}
|
|
2181
2700
|
getTextValue(date) {
|
|
2182
|
-
|
|
2183
|
-
year: 'numeric', month: 'numeric', day: 'numeric',
|
|
2184
|
-
hour: 'numeric', minute: 'numeric'
|
|
2185
|
-
};
|
|
2186
|
-
const optionsSecond = {
|
|
2187
|
-
year: 'numeric', month: 'numeric', day: 'numeric',
|
|
2188
|
-
hour: 'numeric', minute: 'numeric', second: 'numeric'
|
|
2189
|
-
};
|
|
2190
|
-
if (!date)
|
|
2701
|
+
if (!date) {
|
|
2191
2702
|
return;
|
|
2192
|
-
|
|
2193
|
-
return
|
|
2703
|
+
}
|
|
2704
|
+
return DateUtils$1.formatDateTime(date, this.showSeconds);
|
|
2194
2705
|
}
|
|
2195
2706
|
handleInput(event) {
|
|
2196
2707
|
const newValue = this.getParsedDateTime();
|
|
@@ -3380,212 +3891,6 @@ function createStore(reducer, preloadedState, enhancer) {
|
|
|
3380
3891
|
}, _ref2[$$observable] = observable, _ref2;
|
|
3381
3892
|
}
|
|
3382
3893
|
|
|
3383
|
-
class DataBinder {
|
|
3384
|
-
constructor(dataUnit) {
|
|
3385
|
-
this._invalidFields = new Map();
|
|
3386
|
-
this.onDataUnitEvent = (action) => {
|
|
3387
|
-
var _a;
|
|
3388
|
-
switch (action.type) {
|
|
3389
|
-
case Action.DATA_LOADED:
|
|
3390
|
-
case Action.DATA_SAVED:
|
|
3391
|
-
case Action.RECORDS_REMOVED:
|
|
3392
|
-
case Action.RECORDS_ADDED:
|
|
3393
|
-
case Action.RECORDS_COPIED:
|
|
3394
|
-
case Action.EDITION_CANCELED:
|
|
3395
|
-
case Action.SELECTION_CHANGED:
|
|
3396
|
-
case Action.NEXT_SELECTED:
|
|
3397
|
-
case Action.PREVIOUS_SELECTED:
|
|
3398
|
-
this.clearInvalid();
|
|
3399
|
-
case Action.DATA_CHANGED:
|
|
3400
|
-
case Action.CHANGE_UNDONE:
|
|
3401
|
-
case Action.CHANGE_REDONE:
|
|
3402
|
-
case Action.RECORD_LOADED:
|
|
3403
|
-
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
3404
|
-
this.updateValue(field.fieldName, field.field);
|
|
3405
|
-
});
|
|
3406
|
-
break;
|
|
3407
|
-
}
|
|
3408
|
-
};
|
|
3409
|
-
this._fields = new Map();
|
|
3410
|
-
this._dataUnit = dataUnit;
|
|
3411
|
-
this._dataUnit.subscribe(this.onDataUnitEvent);
|
|
3412
|
-
}
|
|
3413
|
-
bind(fields) {
|
|
3414
|
-
fields.forEach(fieldElement => {
|
|
3415
|
-
const fieldName = fieldElement.dataset.fieldName;
|
|
3416
|
-
this.updateBind(fieldName, fieldElement);
|
|
3417
|
-
});
|
|
3418
|
-
}
|
|
3419
|
-
onDisconnectedCallback() {
|
|
3420
|
-
this._dataUnit.unsubscribe(this.onDataUnitEvent);
|
|
3421
|
-
}
|
|
3422
|
-
markInvalid(field) {
|
|
3423
|
-
this._invalidFields.set(field.name, field);
|
|
3424
|
-
if (this._fields.has(field.name)) {
|
|
3425
|
-
const fieldElement = this._fields.get(field.name).field;
|
|
3426
|
-
if (!fieldElement["errorMessage"]) {
|
|
3427
|
-
this.updateErrorMessage(field.name, fieldElement);
|
|
3428
|
-
}
|
|
3429
|
-
}
|
|
3430
|
-
}
|
|
3431
|
-
clearInvalid() {
|
|
3432
|
-
this._invalidFields.clear();
|
|
3433
|
-
this._fields.forEach(fieldBinder => {
|
|
3434
|
-
const fieldElement = fieldBinder.field;
|
|
3435
|
-
fieldElement["errorMessage"] = "";
|
|
3436
|
-
});
|
|
3437
|
-
}
|
|
3438
|
-
updateValue(fieldName, field) {
|
|
3439
|
-
const bind = this._fields.get(fieldName);
|
|
3440
|
-
try {
|
|
3441
|
-
if (bind) {
|
|
3442
|
-
bind.listen = false;
|
|
3443
|
-
}
|
|
3444
|
-
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
3445
|
-
this.updateErrorMessage(fieldName, field);
|
|
3446
|
-
}
|
|
3447
|
-
finally {
|
|
3448
|
-
if (bind) {
|
|
3449
|
-
bind.listen = true;
|
|
3450
|
-
}
|
|
3451
|
-
}
|
|
3452
|
-
}
|
|
3453
|
-
updateErrorMessage(fieldName, field) {
|
|
3454
|
-
const invalidField = this._invalidFields.get(fieldName);
|
|
3455
|
-
if (invalidField) {
|
|
3456
|
-
field["errorMessage"] = invalidField.message;
|
|
3457
|
-
}
|
|
3458
|
-
}
|
|
3459
|
-
getErrorMessage(fieldName) {
|
|
3460
|
-
if (this._fields.has(fieldName)) {
|
|
3461
|
-
const fieldElement = this._fields.get(fieldName).field;
|
|
3462
|
-
return fieldElement["errorMessage"] || null;
|
|
3463
|
-
}
|
|
3464
|
-
return undefined;
|
|
3465
|
-
}
|
|
3466
|
-
updateBind(fieldName, field) {
|
|
3467
|
-
const oldBind = this._fields.get(fieldName);
|
|
3468
|
-
if (oldBind) {
|
|
3469
|
-
oldBind.destroy();
|
|
3470
|
-
}
|
|
3471
|
-
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
3472
|
-
this.updateErrorMessage(fieldName, field);
|
|
3473
|
-
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
3474
|
-
this.bindSearchOptionsLoader(fieldName, field);
|
|
3475
|
-
this.applyEzUploadContext(fieldName, field);
|
|
3476
|
-
}
|
|
3477
|
-
changeStarted(fieldName, waitingChange) {
|
|
3478
|
-
/**
|
|
3479
|
-
* se o waitingChange não é blocante, add um event listener pra
|
|
3480
|
-
* fazer o accept da promise
|
|
3481
|
-
*
|
|
3482
|
-
* se não tiver promise no waitingChange, eu crio uma e resolvo no bind
|
|
3483
|
-
*
|
|
3484
|
-
*
|
|
3485
|
-
*/
|
|
3486
|
-
if (this._dataUnit.records.length === 0) {
|
|
3487
|
-
this._dataUnit.addRecord();
|
|
3488
|
-
}
|
|
3489
|
-
if (!waitingChange.blocking && waitingChange.promise == undefined) {
|
|
3490
|
-
const bind = this._fields.get(fieldName);
|
|
3491
|
-
if (bind) {
|
|
3492
|
-
waitingChange.promise = new Promise((resolve, reject) => {
|
|
3493
|
-
bind.waitingChangePromiseResolve = resolve;
|
|
3494
|
-
bind.waitingChangePromiseReject = reject;
|
|
3495
|
-
});
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
this._dataUnit.startChange(fieldName, waitingChange);
|
|
3499
|
-
}
|
|
3500
|
-
cancelWaitingChange(fieldName) {
|
|
3501
|
-
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
3502
|
-
this._dataUnit.cancelWaitingChange(fieldName);
|
|
3503
|
-
const bind = this._fields.get(fieldName);
|
|
3504
|
-
if (bind) {
|
|
3505
|
-
bind.rejectWaitingChange(new WaitingChangeException("Change canceled", fieldName));
|
|
3506
|
-
}
|
|
3507
|
-
}
|
|
3508
|
-
}
|
|
3509
|
-
setFieldValue(fieldName, newValue) {
|
|
3510
|
-
if (this._dataUnit.records.length === 0) {
|
|
3511
|
-
this._dataUnit.addRecord();
|
|
3512
|
-
}
|
|
3513
|
-
this._invalidFields.delete(fieldName);
|
|
3514
|
-
this._dataUnit.setFieldValue(fieldName, newValue);
|
|
3515
|
-
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
3516
|
-
const bind = this._fields.get(fieldName);
|
|
3517
|
-
if (bind) {
|
|
3518
|
-
bind.acceptWaitingChange();
|
|
3519
|
-
}
|
|
3520
|
-
}
|
|
3521
|
-
}
|
|
3522
|
-
bindSearchOptionsLoader(fieldName, field) {
|
|
3523
|
-
if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
|
|
3524
|
-
const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
|
|
3525
|
-
if (loader) {
|
|
3526
|
-
field["optionLoader"] = (arg) => {
|
|
3527
|
-
return loader(arg, fieldName, this._dataUnit);
|
|
3528
|
-
};
|
|
3529
|
-
}
|
|
3530
|
-
}
|
|
3531
|
-
}
|
|
3532
|
-
applyEzUploadContext(fieldName, field) {
|
|
3533
|
-
var _a, _b;
|
|
3534
|
-
if (field.nodeName === "EZ-UPLOAD") {
|
|
3535
|
-
field["urlUpload"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__ADD__URL__");
|
|
3536
|
-
field["urlDelete"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__DEL__URL__");
|
|
3537
|
-
const descriptor = this._dataUnit.getField(fieldName);
|
|
3538
|
-
const destination = (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.DESTINATION;
|
|
3539
|
-
if (destination) {
|
|
3540
|
-
field["requestHeaders"] = { XTRAINF: `{"destination": "${destination}"}` };
|
|
3541
|
-
}
|
|
3542
|
-
field["maxFiles"] = ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.MAX_FILES) || 0;
|
|
3543
|
-
}
|
|
3544
|
-
}
|
|
3545
|
-
}
|
|
3546
|
-
class Bind {
|
|
3547
|
-
constructor() {
|
|
3548
|
-
this.listen = true;
|
|
3549
|
-
this.startChangeEventName = "ezStartChange";
|
|
3550
|
-
this.cancelWaitingChangeEventName = "ezCancelWaitingChange";
|
|
3551
|
-
this.changeEventName = "ezChange";
|
|
3552
|
-
}
|
|
3553
|
-
destroy() {
|
|
3554
|
-
this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
|
|
3555
|
-
this.field.removeEventListener(this.cancelWaitingChangeEventName, this.cancelWaitingChangeListener);
|
|
3556
|
-
this.field.removeEventListener(this.changeEventName, this.changeListener);
|
|
3557
|
-
}
|
|
3558
|
-
acceptWaitingChange() {
|
|
3559
|
-
if (this.waitingChangePromiseResolve) {
|
|
3560
|
-
this.waitingChangePromiseResolve();
|
|
3561
|
-
this.waitingChangePromiseReject = undefined;
|
|
3562
|
-
this.waitingChangePromiseResolve = undefined;
|
|
3563
|
-
}
|
|
3564
|
-
}
|
|
3565
|
-
rejectWaitingChange(reason) {
|
|
3566
|
-
if (this.waitingChangePromiseReject) {
|
|
3567
|
-
this.waitingChangePromiseReject(reason);
|
|
3568
|
-
this.waitingChangePromiseReject = undefined;
|
|
3569
|
-
this.waitingChangePromiseResolve = undefined;
|
|
3570
|
-
}
|
|
3571
|
-
}
|
|
3572
|
-
static create(fieldName, field, startChangeCallback, cancelWaitingChangeCallback, changeCallback) {
|
|
3573
|
-
const b = new Bind();
|
|
3574
|
-
b.field = field;
|
|
3575
|
-
b.fieldName = fieldName;
|
|
3576
|
-
b.startChangeListener = (evt) => { if (b.listen)
|
|
3577
|
-
startChangeCallback(fieldName, evt.detail); };
|
|
3578
|
-
b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
|
|
3579
|
-
b.cancelWaitingChangeListener = () => { if (b.listen)
|
|
3580
|
-
cancelWaitingChangeCallback(fieldName); };
|
|
3581
|
-
b.field.addEventListener(b.cancelWaitingChangeEventName, b.cancelWaitingChangeListener);
|
|
3582
|
-
b.changeListener = (evt) => { if (b.listen)
|
|
3583
|
-
changeCallback(fieldName, evt.detail); };
|
|
3584
|
-
b.field.addEventListener(b.changeEventName, b.changeListener);
|
|
3585
|
-
return b;
|
|
3586
|
-
}
|
|
3587
|
-
}
|
|
3588
|
-
|
|
3589
3894
|
const inicialState = {};
|
|
3590
3895
|
/////////////////////////////// REDUCERS ///////////////////////////////
|
|
3591
3896
|
function formReducer(state = inicialState, action) {
|
|
@@ -3629,144 +3934,7 @@ var FormActions;
|
|
|
3629
3934
|
FormActions["CHANGE_TAB"] = "FORM/CHANGE_TAB";
|
|
3630
3935
|
})(FormActions || (FormActions = {}));
|
|
3631
3936
|
|
|
3632
|
-
|
|
3633
|
-
constructor() {
|
|
3634
|
-
this._sheets = new Map();
|
|
3635
|
-
this._requiredFields = [];
|
|
3636
|
-
this._cleanOnCopyFields = [];
|
|
3637
|
-
this._defaultValues = {};
|
|
3638
|
-
}
|
|
3639
|
-
getSheet(name) {
|
|
3640
|
-
return this._sheets.get(name);
|
|
3641
|
-
}
|
|
3642
|
-
getAllSheets() {
|
|
3643
|
-
return this._sheets;
|
|
3644
|
-
}
|
|
3645
|
-
addSheet(sheet) {
|
|
3646
|
-
this._sheets.set(sheet.name, sheet);
|
|
3647
|
-
this._requiredFields = this._requiredFields.concat(sheet.requiredFields);
|
|
3648
|
-
this._cleanOnCopyFields = this._cleanOnCopyFields.concat(sheet.cleanOnCopyFields);
|
|
3649
|
-
this._defaultValues = sheet.defaultValues;
|
|
3650
|
-
}
|
|
3651
|
-
getRequiredFields() {
|
|
3652
|
-
return this._requiredFields;
|
|
3653
|
-
}
|
|
3654
|
-
getCleanOnCopyFields() {
|
|
3655
|
-
return this._cleanOnCopyFields;
|
|
3656
|
-
}
|
|
3657
|
-
getDefaultValues() {
|
|
3658
|
-
return this._defaultValues;
|
|
3659
|
-
}
|
|
3660
|
-
}
|
|
3661
|
-
const buildFromDataUnit = (dataUnit) => {
|
|
3662
|
-
const unitMD = dataUnit.metadata;
|
|
3663
|
-
const metadata = new FormMetadata();
|
|
3664
|
-
if (unitMD) {
|
|
3665
|
-
const visibleFields = (unitMD.fields || []).filter(descriptor => descriptor.visible !== false);
|
|
3666
|
-
const fields = visibleFields.map(descriptor => buildFormField(descriptor));
|
|
3667
|
-
let defaultValues = {};
|
|
3668
|
-
visibleFields
|
|
3669
|
-
.filter(descriptor => descriptor.defaultValue)
|
|
3670
|
-
.forEach((descriptor) => defaultValues[descriptor.name] = descriptor.defaultValue);
|
|
3671
|
-
metadata.addSheet({
|
|
3672
|
-
name: unitMD.name,
|
|
3673
|
-
label: unitMD.label,
|
|
3674
|
-
fields,
|
|
3675
|
-
requiredFields: visibleFields
|
|
3676
|
-
.filter(descriptor => descriptor.required)
|
|
3677
|
-
.map(descriptor => descriptor.name),
|
|
3678
|
-
cleanOnCopyFields: visibleFields
|
|
3679
|
-
.filter(descriptor => { var _a, _b; return ((_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy) || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum); })
|
|
3680
|
-
.map(descriptor => descriptor.name),
|
|
3681
|
-
defaultValues
|
|
3682
|
-
});
|
|
3683
|
-
}
|
|
3684
|
-
return metadata;
|
|
3685
|
-
};
|
|
3686
|
-
const buildFromConfig = (config, dataUnit) => {
|
|
3687
|
-
var _a, _b;
|
|
3688
|
-
const sheets = new Map();
|
|
3689
|
-
const hiddenTabs = new Map();
|
|
3690
|
-
const requiredFields = [];
|
|
3691
|
-
const cleanOnCopyFields = [];
|
|
3692
|
-
const defaultValues = {};
|
|
3693
|
-
(_a = config === null || config === void 0 ? void 0 : config.tabs) === null || _a === void 0 ? void 0 : _a.forEach((tab) => {
|
|
3694
|
-
if (!hiddenTabs.has(tab.label) && tab.visible === false) {
|
|
3695
|
-
hiddenTabs.set(tab.label, tab);
|
|
3696
|
-
}
|
|
3697
|
-
});
|
|
3698
|
-
(_b = config === null || config === void 0 ? void 0 : config.fields) === null || _b === void 0 ? void 0 : _b.forEach((field) => {
|
|
3699
|
-
var _a, _b, _c, _d;
|
|
3700
|
-
if (field.visible !== false) {
|
|
3701
|
-
const tabConfig = getTabConfig(field.tab || "__main", sheets);
|
|
3702
|
-
if (hiddenTabs.has(tabConfig.label)) {
|
|
3703
|
-
return;
|
|
3704
|
-
}
|
|
3705
|
-
const descriptor = dataUnit.getField(field.name);
|
|
3706
|
-
if (descriptor && tabConfig.visible) {
|
|
3707
|
-
if (!sheets.has(tabConfig)) {
|
|
3708
|
-
sheets.set(tabConfig, []);
|
|
3709
|
-
}
|
|
3710
|
-
const formField = buildFormField(descriptor, field);
|
|
3711
|
-
sheets.get(tabConfig).push(formField);
|
|
3712
|
-
if (formField.required) {
|
|
3713
|
-
requiredFields.push(field.name);
|
|
3714
|
-
}
|
|
3715
|
-
const cleanOnCopy = field.cleanOnCopy == undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : field.cleanOnCopy;
|
|
3716
|
-
if (cleanOnCopy || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum) || ((_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.cleanOnCopy)) {
|
|
3717
|
-
cleanOnCopyFields.push(field.name);
|
|
3718
|
-
}
|
|
3719
|
-
const defaultValue = field.defaultValue == undefined ? (_d = descriptor.properties) === null || _d === void 0 ? void 0 : _d.defaultValue : field.defaultValue;
|
|
3720
|
-
if (defaultValue) {
|
|
3721
|
-
defaultValues[field.name] = field.defaultValue;
|
|
3722
|
-
}
|
|
3723
|
-
}
|
|
3724
|
-
}
|
|
3725
|
-
});
|
|
3726
|
-
const metadata = new FormMetadata();
|
|
3727
|
-
Array.from(sheets.entries())
|
|
3728
|
-
.sort(sortTabs)
|
|
3729
|
-
.forEach(([key, fields]) => {
|
|
3730
|
-
metadata.addSheet({
|
|
3731
|
-
label: (key.label === "__main") ? "Principal" : key.label,
|
|
3732
|
-
name: key.label,
|
|
3733
|
-
fields,
|
|
3734
|
-
requiredFields,
|
|
3735
|
-
cleanOnCopyFields,
|
|
3736
|
-
defaultValues
|
|
3737
|
-
});
|
|
3738
|
-
});
|
|
3739
|
-
return metadata;
|
|
3740
|
-
};
|
|
3741
|
-
const buildFormField = (descriptor, config) => {
|
|
3742
|
-
let { name, label, group } = Object.assign({}, config);
|
|
3743
|
-
let { readOnly, required } = Object.assign({}, config);
|
|
3744
|
-
let props;
|
|
3745
|
-
let userInterface;
|
|
3746
|
-
if (descriptor) {
|
|
3747
|
-
label = label || descriptor.label;
|
|
3748
|
-
name = name || descriptor.name;
|
|
3749
|
-
required = descriptor.required || (config === null || config === void 0 ? void 0 : config.required);
|
|
3750
|
-
readOnly = descriptor.readOnly || (config === null || config === void 0 ? void 0 : config.readOnly);
|
|
3751
|
-
props = descriptor.properties;
|
|
3752
|
-
userInterface = descriptor.userInterface;
|
|
3753
|
-
}
|
|
3754
|
-
return {
|
|
3755
|
-
name, label, group,
|
|
3756
|
-
readOnly, required,
|
|
3757
|
-
props,
|
|
3758
|
-
userInterface: userInterface || UserInterface.SHORTTEXT
|
|
3759
|
-
};
|
|
3760
|
-
};
|
|
3761
|
-
const getTabConfig = (tab, sheets) => {
|
|
3762
|
-
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
3763
|
-
return tabConfig || { label: tab, visible: true };
|
|
3764
|
-
};
|
|
3765
|
-
const sortTabs = (a, b) => {
|
|
3766
|
-
return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
3767
|
-
};
|
|
3768
|
-
|
|
3769
|
-
const ezFormCss = ".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)}.multi-level__container.sc-ez-form{display:grid;grid-template-columns:minmax(20%, 300px) auto;width:100%}";
|
|
3937
|
+
const ezFormCss = ".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)}";
|
|
3770
3938
|
|
|
3771
3939
|
const EzForm$1 = class extends HTMLElement$1 {
|
|
3772
3940
|
constructor() {
|
|
@@ -3781,114 +3949,24 @@ const EzForm$1 = class extends HTMLElement$1 {
|
|
|
3781
3949
|
this.dataUnit = undefined;
|
|
3782
3950
|
this.config = undefined;
|
|
3783
3951
|
this.recordsValidator = undefined;
|
|
3784
|
-
this.multiLevel = undefined;
|
|
3785
|
-
this.levelResolver = undefined;
|
|
3786
|
-
this.contentBuilder = undefined;
|
|
3787
3952
|
}
|
|
3788
3953
|
/**
|
|
3789
3954
|
* Realiza validação no conteúdo de todos os campos.
|
|
3790
3955
|
*/
|
|
3791
3956
|
validate() {
|
|
3792
|
-
return
|
|
3793
|
-
var _a;
|
|
3794
|
-
const records = this.dataUnit.getModifiedRecords();
|
|
3795
|
-
for (let i = 0; i < records.length; i++) {
|
|
3796
|
-
const record = records[i];
|
|
3797
|
-
const invalidResults = [];
|
|
3798
|
-
let validationResult = this.validateRequired(record);
|
|
3799
|
-
if (validationResult && !validationResult.isValid) {
|
|
3800
|
-
invalidResults.push(validationResult);
|
|
3801
|
-
}
|
|
3802
|
-
validationResult = (_a = this.recordsValidator) === null || _a === void 0 ? void 0 : _a.validateRecord(this, record);
|
|
3803
|
-
if (validationResult && !validationResult.isValid) {
|
|
3804
|
-
invalidResults.push(validationResult);
|
|
3805
|
-
}
|
|
3806
|
-
if (invalidResults.length > 0) {
|
|
3807
|
-
this.processValidationResult(invalidResults);
|
|
3808
|
-
reject();
|
|
3809
|
-
break;
|
|
3810
|
-
}
|
|
3811
|
-
}
|
|
3812
|
-
accept();
|
|
3813
|
-
});
|
|
3957
|
+
return this._dataBinder.validate();
|
|
3814
3958
|
}
|
|
3815
3959
|
observeConfig() {
|
|
3816
3960
|
this.processMetadata();
|
|
3817
3961
|
}
|
|
3818
|
-
validateRequired(record) {
|
|
3819
|
-
const metadata = selectFormMetadata(this._store.getState());
|
|
3820
|
-
const requiredFields = this._staticFields
|
|
3821
|
-
.filter(f => f.dataset.required)
|
|
3822
|
-
.map(f => f.dataset.fieldName)
|
|
3823
|
-
.concat(metadata.getRequiredFields());
|
|
3824
|
-
const invalidFields = [];
|
|
3825
|
-
new Set(requiredFields).forEach(field => {
|
|
3826
|
-
const value = record[field];
|
|
3827
|
-
if (value == undefined || value === "") {
|
|
3828
|
-
const errorMessage = this._dataBinder.getErrorMessage(field);
|
|
3829
|
-
if (errorMessage) {
|
|
3830
|
-
invalidFields.push({ name: field, message: errorMessage });
|
|
3831
|
-
}
|
|
3832
|
-
else {
|
|
3833
|
-
invalidFields.push({ name: field, message: "Essa informação é obrigatória" });
|
|
3834
|
-
}
|
|
3835
|
-
}
|
|
3836
|
-
});
|
|
3837
|
-
if (invalidFields.length > 0) {
|
|
3838
|
-
return { isValid: false, invalidFields, infoMessage: "Há pelo menos um campo obrigatório não preenchido." };
|
|
3839
|
-
}
|
|
3840
|
-
return undefined;
|
|
3841
|
-
}
|
|
3842
|
-
processValidationResult(validationResult) {
|
|
3843
|
-
validationResult.forEach(invalidResult => {
|
|
3844
|
-
const invalidFields = invalidResult.invalidFields;
|
|
3845
|
-
if (invalidFields) {
|
|
3846
|
-
invalidFields.forEach(field => {
|
|
3847
|
-
this._dataBinder.markInvalid(field);
|
|
3848
|
-
});
|
|
3849
|
-
}
|
|
3850
|
-
if (invalidResult.infoMessage) {
|
|
3851
|
-
ApplicationUtils.info(invalidResult.infoMessage);
|
|
3852
|
-
}
|
|
3853
|
-
if (invalidResult.errorMessage) {
|
|
3854
|
-
const { errorTitle, errorMessage } = invalidResult;
|
|
3855
|
-
ApplicationUtils.error(errorTitle, errorMessage);
|
|
3856
|
-
}
|
|
3857
|
-
});
|
|
3858
|
-
}
|
|
3859
|
-
resolveLevel(items) {
|
|
3860
|
-
if (!this.levelResolver) {
|
|
3861
|
-
return items;
|
|
3862
|
-
}
|
|
3863
|
-
return this.levelResolver(items);
|
|
3864
|
-
}
|
|
3865
|
-
getMultiLevelContent(sheets, currentSheet, currentSheetId) {
|
|
3866
|
-
const treeItems = this.resolveLevel(sheets.map(sheet => {
|
|
3867
|
-
const item = {
|
|
3868
|
-
id: sheet.name,
|
|
3869
|
-
label: sheet.label
|
|
3870
|
-
};
|
|
3871
|
-
return item;
|
|
3872
|
-
}));
|
|
3873
|
-
return (h("div", { class: "multi-level__container" }, h("div", null, h("ez-tree", { selectedId: currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.name, items: treeItems, onEzChange: (evt) => {
|
|
3874
|
-
var _a;
|
|
3875
|
-
const selectedItem = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.id;
|
|
3876
|
-
if (selectedItem && selectedItem !== (currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.name)) {
|
|
3877
|
-
this._store.dispatch(changeTab(selectedItem));
|
|
3878
|
-
}
|
|
3879
|
-
} })), h("div", null, this.buildFormContent(currentSheetId, currentSheet))));
|
|
3880
|
-
}
|
|
3881
3962
|
getDynamicContent() {
|
|
3882
|
-
var _a
|
|
3963
|
+
var _a;
|
|
3883
3964
|
const formMD = selectFormMetadata(this._store.getState());
|
|
3884
|
-
if (!formMD)
|
|
3965
|
+
if (!formMD) {
|
|
3885
3966
|
return null;
|
|
3886
|
-
const allSheets = Array.from(formMD.getAllSheets().values());
|
|
3887
|
-
const currentSheetId = selectCurrentSheetId((_a = this._store) === null || _a === void 0 ? void 0 : _a.getState());
|
|
3888
|
-
const currentSheet = selectCurrentSheet((_b = this._store) === null || _b === void 0 ? void 0 : _b.getState());
|
|
3889
|
-
if (this.multiLevel) {
|
|
3890
|
-
return this.getMultiLevelContent(allSheets, currentSheet, currentSheetId);
|
|
3891
3967
|
}
|
|
3968
|
+
const allSheets = Array.from(formMD.getAllSheets().values());
|
|
3969
|
+
const currentSheet = selectCurrentSheet((_a = this._store) === null || _a === void 0 ? void 0 : _a.getState());
|
|
3892
3970
|
let result = [];
|
|
3893
3971
|
if (allSheets.length > 1) {
|
|
3894
3972
|
const tabs = allSheets.map((sheet, index) => {
|
|
@@ -3897,26 +3975,20 @@ const EzForm$1 = class extends HTMLElement$1 {
|
|
|
3897
3975
|
const idTabSelector = `selector`;
|
|
3898
3976
|
result.push(h("ez-tabselector", { tabs: this.buildIdTabSelector(tabs), onEzChange: (evt) => this._store.dispatch(changeTab(evt.detail)), selectedTab: currentSheet.name, "data-element-id": idTabSelector }));
|
|
3899
3977
|
}
|
|
3900
|
-
result = result.concat(this.buildFormContent(
|
|
3978
|
+
result = result.concat(this.buildFormContent(currentSheet));
|
|
3901
3979
|
return result;
|
|
3902
3980
|
}
|
|
3903
|
-
buildFormContent(
|
|
3981
|
+
buildFormContent(currentSheet) {
|
|
3904
3982
|
const fields = currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.fields;
|
|
3905
|
-
if (this.contentBuilder != undefined) {
|
|
3906
|
-
const customContent = this.contentBuilder(sheetId, fields);
|
|
3907
|
-
if (customContent != undefined) {
|
|
3908
|
-
return h("div", { "innerHTML": customContent });
|
|
3909
|
-
}
|
|
3910
|
-
}
|
|
3911
3983
|
if (currentSheet == undefined) {
|
|
3912
3984
|
return;
|
|
3913
3985
|
}
|
|
3914
3986
|
const idFormSheet = `${StringUtils$1.replaceAccentuatedChars(StringUtils$1.toCamelCase(currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.label), false)}_selectorContainer`;
|
|
3915
|
-
return (h("div", { class: "dynamic-content
|
|
3987
|
+
return (h("div", { class: "dynamic-content", "data-element-id": idFormSheet }, h("ez-form-view", { class: "ez-row ez-padding-vertical--small", fields: fields })));
|
|
3916
3988
|
}
|
|
3917
3989
|
processMetadata() {
|
|
3918
3990
|
if (!this.isStatic() && this.dataUnit && this._store) {
|
|
3919
|
-
const metadata =
|
|
3991
|
+
const metadata = buildFormMetadata(this.config, this.dataUnit);
|
|
3920
3992
|
this._store.dispatch(loadMetadata(metadata));
|
|
3921
3993
|
}
|
|
3922
3994
|
}
|
|
@@ -3924,58 +3996,10 @@ const EzForm$1 = class extends HTMLElement$1 {
|
|
|
3924
3996
|
var _a;
|
|
3925
3997
|
return ((_a = this._staticFields) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
3926
3998
|
}
|
|
3927
|
-
getFormattedValue(defaultValue) {
|
|
3928
|
-
if (defaultValue == undefined || typeof defaultValue !== "object") {
|
|
3929
|
-
return defaultValue;
|
|
3930
|
-
}
|
|
3931
|
-
if ("formattedValue" in defaultValue) {
|
|
3932
|
-
return defaultValue.formattedValue;
|
|
3933
|
-
}
|
|
3934
|
-
return defaultValue.value;
|
|
3935
|
-
}
|
|
3936
|
-
interceptAction(action) {
|
|
3937
|
-
if (action.type === Action.RECORDS_COPIED) {
|
|
3938
|
-
const metadata = selectFormMetadata(this._store.getState());
|
|
3939
|
-
const cleanFields = metadata.getCleanOnCopyFields();
|
|
3940
|
-
if (cleanFields) {
|
|
3941
|
-
const records = action.payload;
|
|
3942
|
-
return new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
|
|
3943
|
-
const newRecord = Object.assign({}, record);
|
|
3944
|
-
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
3945
|
-
return newRecord;
|
|
3946
|
-
}));
|
|
3947
|
-
}
|
|
3948
|
-
}
|
|
3949
|
-
if (action.type === Action.SAVING_DATA) {
|
|
3950
|
-
return new Promise((resolve) => {
|
|
3951
|
-
this.validate()
|
|
3952
|
-
.then(() => resolve(action))
|
|
3953
|
-
.catch(() => { });
|
|
3954
|
-
});
|
|
3955
|
-
}
|
|
3956
|
-
if (action.type === Action.RECORDS_ADDED) {
|
|
3957
|
-
const metadata = selectFormMetadata(this._store.getState());
|
|
3958
|
-
const defaultValues = metadata === null || metadata === void 0 ? void 0 : metadata.getDefaultValues();
|
|
3959
|
-
if (defaultValues) {
|
|
3960
|
-
const records = action.payload;
|
|
3961
|
-
return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
|
|
3962
|
-
const newRecord = Object.assign({}, record);
|
|
3963
|
-
for (const field in defaultValues) {
|
|
3964
|
-
const defaultValue = this.getFormattedValue(defaultValues[field]);
|
|
3965
|
-
const recordValue = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
3966
|
-
newRecord[field] = this.dataUnit.valueFromString(field, recordValue);
|
|
3967
|
-
}
|
|
3968
|
-
return newRecord;
|
|
3969
|
-
}));
|
|
3970
|
-
}
|
|
3971
|
-
}
|
|
3972
|
-
return action;
|
|
3973
|
-
}
|
|
3974
3999
|
componentWillLoad() {
|
|
3975
4000
|
if (this.dataUnit === undefined) {
|
|
3976
4001
|
this.dataUnit = new DataUnit("ez-form");
|
|
3977
4002
|
}
|
|
3978
|
-
this.dataUnit.addInterceptor(this);
|
|
3979
4003
|
this.dataUnit.subscribe(this.onDataUnitAction);
|
|
3980
4004
|
this._dataBinder = new DataBinder(this.dataUnit);
|
|
3981
4005
|
this._store = createStore(formReducer);
|
|
@@ -3986,12 +4010,13 @@ const EzForm$1 = class extends HTMLElement$1 {
|
|
|
3986
4010
|
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
3987
4011
|
}
|
|
3988
4012
|
componentDidRender() {
|
|
3989
|
-
|
|
4013
|
+
const metadata = selectFormMetadata(this._store.getState());
|
|
4014
|
+
metadata.addRequiredFields(this._staticFields.filter(f => f.dataset.required).map(f => f.dataset.fieldName));
|
|
4015
|
+
this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")), this.dataUnit.dataUnitId, metadata, this.recordsValidator);
|
|
3990
4016
|
this.ezReady.emit();
|
|
3991
4017
|
}
|
|
3992
4018
|
disconnectedCallback() {
|
|
3993
4019
|
this.dataUnit.unsubscribe(this.onDataUnitAction);
|
|
3994
|
-
this.dataUnit.removeInterceptor(this);
|
|
3995
4020
|
this._dataBinder.onDisconnectedCallback();
|
|
3996
4021
|
}
|
|
3997
4022
|
buildIdTabSelector(tabs) {
|
|
@@ -4011,17 +4036,17 @@ const EzForm$1 = class extends HTMLElement$1 {
|
|
|
4011
4036
|
};
|
|
4012
4037
|
|
|
4013
4038
|
const buildSwitch = (field) => {
|
|
4014
|
-
return buildField(field.name, field.label, field.readOnly, true);
|
|
4039
|
+
return buildField(field.name, field.label, field.readOnly, field.contextName, true);
|
|
4015
4040
|
};
|
|
4016
4041
|
const buildCheckBox = (field) => {
|
|
4017
|
-
return buildField(field.name, field.label, field.readOnly, false);
|
|
4042
|
+
return buildField(field.name, field.label, field.readOnly, field.contextName, false);
|
|
4018
4043
|
};
|
|
4019
|
-
function buildField(fieldName, fieldLabel, readOnly, switchMode
|
|
4044
|
+
function buildField(fieldName, fieldLabel, readOnly, contextName, switchMode) {
|
|
4020
4045
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-align--middle ez-padding-horizontal--small ez-padding-bottom--large" },
|
|
4021
|
-
h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? CheckMode.SWITCH : CheckMode.REGULAR, "data-field-name": fieldName, key: fieldName })));
|
|
4046
|
+
h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? CheckMode.SWITCH : CheckMode.REGULAR, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName })));
|
|
4022
4047
|
}
|
|
4023
4048
|
|
|
4024
|
-
const buildComboBox = ({ name, label, readOnly, required, props }) => {
|
|
4049
|
+
const buildComboBox = ({ name, label, readOnly, required, props, contextName }) => {
|
|
4025
4050
|
const prop = props === null || props === void 0 ? void 0 : props.options;
|
|
4026
4051
|
let options;
|
|
4027
4052
|
if (typeof prop === "string") {
|
|
@@ -4032,7 +4057,7 @@ const buildComboBox = ({ name, label, readOnly, required, props }) => {
|
|
|
4032
4057
|
options = prop;
|
|
4033
4058
|
}
|
|
4034
4059
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
4035
|
-
h("ez-combo-box", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, key: name, options: options })));
|
|
4060
|
+
h("ez-combo-box", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, options: options })));
|
|
4036
4061
|
};
|
|
4037
4062
|
|
|
4038
4063
|
const buildDate = ({ name, label, readOnly }) => {
|
|
@@ -4043,42 +4068,42 @@ const buildTime = ({ name, label, readOnly }) => {
|
|
|
4043
4068
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
4044
4069
|
h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
4045
4070
|
};
|
|
4046
|
-
const buildDateTime = ({ name, label, readOnly }) => {
|
|
4071
|
+
const buildDateTime = ({ name, label, readOnly, contextName }) => {
|
|
4047
4072
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
4048
|
-
h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
4073
|
+
h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName, key: name })));
|
|
4049
4074
|
};
|
|
4050
4075
|
|
|
4051
|
-
const buildFile = ({ name, label, readOnly }) => {
|
|
4076
|
+
const buildFile = ({ name, label, readOnly, contextName }) => {
|
|
4052
4077
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
4053
|
-
h("ez-upload", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
4078
|
+
h("ez-upload", { enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName, key: name })));
|
|
4054
4079
|
};
|
|
4055
4080
|
|
|
4056
|
-
const buildDecimal = ({ name, label, readOnly, props }) => {
|
|
4081
|
+
const buildDecimal = ({ name, label, readOnly, props, contextName }) => {
|
|
4057
4082
|
const precision = Number((props === null || props === void 0 ? void 0 : props.precision) || 2);
|
|
4058
4083
|
const prettyPrecision = Number((props === null || props === void 0 ? void 0 : props.prettyPrecision) || precision);
|
|
4059
|
-
return buildNumeric(name, label, readOnly, precision, prettyPrecision);
|
|
4084
|
+
return buildNumeric(name, label, readOnly, precision, prettyPrecision, contextName);
|
|
4060
4085
|
};
|
|
4061
|
-
const buildInteger = ({ name, label, readOnly }) => {
|
|
4062
|
-
return buildNumeric(name, label, readOnly, 0, 0);
|
|
4086
|
+
const buildInteger = ({ name, label, readOnly, contextName }) => {
|
|
4087
|
+
return buildNumeric(name, label, readOnly, 0, 0, contextName);
|
|
4063
4088
|
};
|
|
4064
|
-
function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecision) {
|
|
4089
|
+
function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecision, contextName) {
|
|
4065
4090
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
4066
|
-
h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, key: fieldName })));
|
|
4091
|
+
h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName })));
|
|
4067
4092
|
}
|
|
4068
4093
|
|
|
4069
|
-
const buildSearch = ({ name, label, readOnly, required }) => {
|
|
4094
|
+
const buildSearch = ({ name, label, readOnly, required, contextName }) => {
|
|
4070
4095
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
4071
|
-
h("ez-search", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, key: name })));
|
|
4096
|
+
h("ez-search", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name })));
|
|
4072
4097
|
};
|
|
4073
4098
|
|
|
4074
|
-
const buildTextArea = ({ name, label, readOnly }) => {
|
|
4099
|
+
const buildTextArea = ({ name, label, readOnly, contextName }) => {
|
|
4075
4100
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small", key: name },
|
|
4076
|
-
h("ez-text-area", { enabled: !readOnly, label: label, "data-field-name": name })));
|
|
4101
|
+
h("ez-text-area", { enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName })));
|
|
4077
4102
|
};
|
|
4078
4103
|
|
|
4079
|
-
const buildTextInput = ({ name, label, readOnly }) => {
|
|
4104
|
+
const buildTextInput = ({ name, label, readOnly, contextName }) => {
|
|
4080
4105
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
4081
|
-
h("ez-text-input", { label: label, "data-field-name": name, key: name, enabled: !readOnly })));
|
|
4106
|
+
h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly })));
|
|
4082
4107
|
};
|
|
4083
4108
|
|
|
4084
4109
|
const uiBuilders = new Map();
|
|
@@ -4105,8 +4130,12 @@ const EzFormView$1 = class extends HTMLElement$1 {
|
|
|
4105
4130
|
constructor() {
|
|
4106
4131
|
super();
|
|
4107
4132
|
this.__registerHost();
|
|
4133
|
+
this.ezContentReady = createEvent(this, "ezContentReady", 7);
|
|
4108
4134
|
this.fields = undefined;
|
|
4109
4135
|
}
|
|
4136
|
+
async showUp() {
|
|
4137
|
+
this._element.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
4138
|
+
}
|
|
4110
4139
|
groupFields(fields) {
|
|
4111
4140
|
const result = new Map();
|
|
4112
4141
|
fields.forEach(item => {
|
|
@@ -4125,6 +4154,9 @@ const EzFormView$1 = class extends HTMLElement$1 {
|
|
|
4125
4154
|
});
|
|
4126
4155
|
return result;
|
|
4127
4156
|
}
|
|
4157
|
+
componentDidRender() {
|
|
4158
|
+
this.ezContentReady.emit(Array.from(this._element.querySelectorAll("[data-field-name]")));
|
|
4159
|
+
}
|
|
4128
4160
|
render() {
|
|
4129
4161
|
ElementIDUtils.addIDInfoIfNotExists(this._element, 'ezFormView');
|
|
4130
4162
|
if (this.fields == undefined) {
|
|
@@ -123244,6 +123276,7 @@ class AgGridController {
|
|
|
123244
123276
|
}
|
|
123245
123277
|
;
|
|
123246
123278
|
initDatagrid(container, options) {
|
|
123279
|
+
var _a;
|
|
123247
123280
|
if (this._grid === undefined) {
|
|
123248
123281
|
LicenseManager.setLicenseKey(ApplicationContext.getContextValue("__EZUI__GRID_LICENSE__"));
|
|
123249
123282
|
this._columnStateChangeCallback = options.onColumnStateChange;
|
|
@@ -123293,8 +123326,10 @@ class AgGridController {
|
|
|
123293
123326
|
else {
|
|
123294
123327
|
this._grid = new Grid(container, this._gridOptions);
|
|
123295
123328
|
}
|
|
123296
|
-
|
|
123297
|
-
|
|
123329
|
+
const selection = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getSelection();
|
|
123330
|
+
if (selection) {
|
|
123331
|
+
this.selectRows(selection);
|
|
123332
|
+
}
|
|
123298
123333
|
this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
|
|
123299
123334
|
}
|
|
123300
123335
|
}
|
|
@@ -123759,7 +123794,7 @@ class AgGridController {
|
|
|
123759
123794
|
}
|
|
123760
123795
|
}
|
|
123761
123796
|
|
|
123762
|
-
const ezGridCss = ".sc-ez-grid-h{display:grid;grid-template-rows:auto 1fr auto;height:100%;width:100%;--ezgrid__header--background-color:var(--background--xlight, #FFF)}.grid-header.sc-ez-grid{display:flex;justify-content:space-between;align-items:center;background-color:var(--ezgrid__header--background-color, #FFF);z-index:var(--visible)}.grid__container.sc-ez-grid{box-shadow:
|
|
123797
|
+
const ezGridCss = ".sc-ez-grid-h{display:grid;grid-template-rows:auto 1fr auto;height:100%;width:100%;--ezgrid__header--background-color:var(--background--xlight, #FFF);--ezgrid__container--shadow:0 0 16px 0 rgb(0 38 111 / 12%)}.grid-header.sc-ez-grid{display:flex;justify-content:space-between;align-items:center;background-color:var(--ezgrid__header--background-color, #FFF);z-index:var(--visible)}.grid__container.sc-ez-grid{box-shadow:var(--ezgrid__container--shadow);padding-top:15px;margin-top:-12px;background-color:var(--ezgrid__header--background-color)}.grid-header__container.sc-ez-grid{display:flex;align-items:center}";
|
|
123763
123798
|
|
|
123764
123799
|
const EzGrid$1 = class extends HTMLElement$1 {
|
|
123765
123800
|
constructor() {
|
|
@@ -123900,7 +123935,7 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
123900
123935
|
onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
|
|
123901
123936
|
onPaginationChange: (paginationInfo) => {
|
|
123902
123937
|
var _a;
|
|
123903
|
-
if (((_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) > paginationInfo.currentPage && this._paginationChangedByKeyboard) {
|
|
123938
|
+
if (((_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) > (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.currentPage) && this._paginationChangedByKeyboard) {
|
|
123904
123939
|
this._gridController.setFocusLastRow();
|
|
123905
123940
|
}
|
|
123906
123941
|
else {
|
|
@@ -123972,7 +124007,7 @@ var EzScrollDirection;
|
|
|
123972
124007
|
EzScrollDirection["BOTH"] = "both";
|
|
123973
124008
|
})(EzScrollDirection || (EzScrollDirection = {}));
|
|
123974
124009
|
|
|
123975
|
-
const ezGuideNavigatorCss = ":host{--ez-guide-navigator--padding-left:var(--space--large);--ez-guide-navigator--padding-right:var(--space--small);--ez-guide-navigator--box-shadow:var(--shadow, 0px 0px 24px 0px #000);--ez-guide-navigator--background-color:var(--color--inverted);--ez-guide-navigator--border-radius:0px var(--border--radius-medium) var(--border--radius-medium) 0px;--ez-guide-navigator--actions-gap:var(--space--medium);--ez-guide-navigator--actions-margin:var(--space--
|
|
124010
|
+
const ezGuideNavigatorCss = ":host{--ez-guide-navigator--padding-left:var(--space--large);--ez-guide-navigator--padding-right:var(--space--small);--ez-guide-navigator--box-shadow:var(--shadow, 0px 0px 24px 0px #000);--ez-guide-navigator--background-color:var(--color--inverted);--ez-guide-navigator--border-radius:0px var(--border--radius-medium) var(--border--radius-medium) 0px;--ez-guide-navigator--actions-gap:var(--space--medium);--ez-guide-navigator--actions-margin:var(--space--large) 0 var(--space--medium);--ez-guide-navigator--actions-padding-right:calc(var(--space--medium, 12px) + var(--space--small, 6px))}.inverted{transform:rotate(180deg)}.ez-guide-navigator{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;height:100%;padding-left:var(--ez-guide-navigator--padding-left);padding-right:var(--ez-guide-navigator--padding-right);background-color:var(--ez-guide-navigator--background-color);-webkit-box-shadow:var(--ez-guide-navigator--box-shadow);box-shadow:var(--ez-guide-navigator--box-shadow);border-radius:var(--ez-guide-navigator--border-radius)}.ez-guide-navigator__actions{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:var(--ez-guide-navigator--actions-gap);margin:var(--ez-guide-navigator--actions-margin);padding-right:var(--ez-guide-navigator--actions-padding-right)}.hidden{display:none}";
|
|
123976
124011
|
|
|
123977
124012
|
const ENTER_KEY = "Enter";
|
|
123978
124013
|
const EzGuideNavigator$1 = class extends HTMLElement$1 {
|
|
@@ -123980,7 +124015,9 @@ const EzGuideNavigator$1 = class extends HTMLElement$1 {
|
|
|
123980
124015
|
super();
|
|
123981
124016
|
this.__registerHost();
|
|
123982
124017
|
this.__attachShadow();
|
|
124018
|
+
this.ezSelectionChange = createEvent(this, "ezSelectionChange", 7);
|
|
123983
124019
|
this.open = true;
|
|
124020
|
+
this.selectedId = undefined;
|
|
123984
124021
|
this.items = [];
|
|
123985
124022
|
this.tooltipResolver = undefined;
|
|
123986
124023
|
this.filterText = "";
|
|
@@ -123997,6 +124034,48 @@ const EzGuideNavigator$1 = class extends HTMLElement$1 {
|
|
|
123997
124034
|
async enableItem(id) {
|
|
123998
124035
|
[].concat(id).forEach(item => this._tree.enableItem(item));
|
|
123999
124036
|
}
|
|
124037
|
+
/**
|
|
124038
|
+
* Atualiza um ou mais items
|
|
124039
|
+
*/
|
|
124040
|
+
async updateItem(item) {
|
|
124041
|
+
[].concat(item).forEach(item => this._tree.updateItem(item));
|
|
124042
|
+
}
|
|
124043
|
+
/**
|
|
124044
|
+
* Obtem um item pelo id
|
|
124045
|
+
*/
|
|
124046
|
+
async getItem(id) {
|
|
124047
|
+
return this._tree.getItem(id);
|
|
124048
|
+
}
|
|
124049
|
+
/**
|
|
124050
|
+
* Obtem um array do caminho de itens da seleção atual.
|
|
124051
|
+
* @returns Retorna um array do caminho de itens da seleção atual.
|
|
124052
|
+
*/
|
|
124053
|
+
async getCurrentPath() {
|
|
124054
|
+
var _a;
|
|
124055
|
+
return (_a = this._tree) === null || _a === void 0 ? void 0 : _a.getCurrentPath();
|
|
124056
|
+
}
|
|
124057
|
+
/**
|
|
124058
|
+
* Seleciona o item desejado pelo ID.
|
|
124059
|
+
* @param id - ID do item que receberá a seleção.
|
|
124060
|
+
*/
|
|
124061
|
+
async selectGuide(id) {
|
|
124062
|
+
if (this._tree == undefined || id == undefined) {
|
|
124063
|
+
return;
|
|
124064
|
+
}
|
|
124065
|
+
this._tree.selectItem(id);
|
|
124066
|
+
this.getCurrentPath()
|
|
124067
|
+
.then((currentPath) => {
|
|
124068
|
+
currentPath === null || currentPath === void 0 ? void 0 : currentPath.forEach((item) => {
|
|
124069
|
+
this._tree.openItem(item.id);
|
|
124070
|
+
});
|
|
124071
|
+
});
|
|
124072
|
+
}
|
|
124073
|
+
/**
|
|
124074
|
+
* Obtem o item pai a partir de um id
|
|
124075
|
+
*/
|
|
124076
|
+
async getParent(id) {
|
|
124077
|
+
return this._tree.getParent(id);
|
|
124078
|
+
}
|
|
124000
124079
|
async handleToggleSidebar() {
|
|
124001
124080
|
this.open = !this.open;
|
|
124002
124081
|
}
|
|
@@ -124005,9 +124084,13 @@ const EzGuideNavigator$1 = class extends HTMLElement$1 {
|
|
|
124005
124084
|
this._tree.applyFilter(this.filterText);
|
|
124006
124085
|
}
|
|
124007
124086
|
}
|
|
124087
|
+
onFilterChanged(event) {
|
|
124088
|
+
this.filterText = event.detail;
|
|
124089
|
+
event.stopPropagation();
|
|
124090
|
+
}
|
|
124008
124091
|
render() {
|
|
124009
124092
|
ElementIDUtils.addIDInfoIfNotExists(this._element);
|
|
124010
|
-
return (h(Host, null, h("ez-sidebar-button", { class: this.open ? "hidden" : "", onEzClick: this.handleToggleSidebar.bind(this), "aria-controls": "navigator", "aria-expanded": this.open, "data-element-id": ElementIDUtils.getInternalIDInfo("openButton") }), h("aside", { tabIndex: -1, id: "navigator", class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-guide-navigator " + (this.open ? "" : "hidden"), "data-element-id": ElementIDUtils.getInternalIDInfo("sidebar") }, h("div", { role: "search", class: "ez-guide-navigator__actions" }, h("ez-filter-input", { mode: "slim", value: this.filterText, onEzChange: (event) =>
|
|
124093
|
+
return (h(Host, null, h("ez-sidebar-button", { class: this.open ? "hidden" : "", onEzClick: this.handleToggleSidebar.bind(this), "aria-controls": "navigator", "aria-expanded": this.open, "data-element-id": ElementIDUtils.getInternalIDInfo("openButton") }), h("aside", { tabIndex: -1, id: "navigator", class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-guide-navigator " + (this.open ? "" : "hidden"), "data-element-id": ElementIDUtils.getInternalIDInfo("sidebar") }, h("div", { role: "search", class: "ez-guide-navigator__actions" }, h("ez-filter-input", { mode: "slim", value: this.filterText, onEzChange: (event) => this.onFilterChanged(event), label: "Buscar guia", "aria-placeholder": "Buscar guia", onKeyUp: this.handleFilterTree.bind(this), "data-element-id": ElementIDUtils.getInternalIDInfo("textinput") }), h("ez-button", { onClick: this.handleToggleSidebar.bind(this), class: "inverted", mode: "icon", size: "small", iconName: "show_menu", title: "Ocultar menu", "aria-label": "Ocultar menu", "aria-controls": "navigator", "data-element-id": ElementIDUtils.getInternalIDInfo("closeButton") })), h("ez-scroller", { direction: EzScrollDirection.VERTICAL, activeShadow: true }, h("ez-tree", { ref: element => (this._tree = element), items: this.items, "data-element-id": ElementIDUtils.getInternalIDInfo("tree"), tooltipResolver: this.tooltipResolver, onEzChange: evt => this.ezSelectionChange.emit(evt.detail), selectedId: this.selectedId })))));
|
|
124011
124094
|
}
|
|
124012
124095
|
get _element() { return this; }
|
|
124013
124096
|
static get style() { return ezGuideNavigatorCss; }
|
|
@@ -125349,7 +125432,7 @@ const EzSearch$1 = class extends HTMLElement$1 {
|
|
|
125349
125432
|
static get style() { return ezSearchCss; }
|
|
125350
125433
|
};
|
|
125351
125434
|
|
|
125352
|
-
const ezSidebarButtonCss = ":host{
|
|
125435
|
+
const ezSidebarButtonCss = ":host{position:relative;--ez-sidebar-button--width:6px;--ez-sidebar-button--hover--width:12px;--ez-sidebar-button--height:96px;--ez-sidebar-button--background-color--xlight:var(--background--xlight, #fff);--ez-sidebar-button--background-color--primary:var(--color--primary);--ez-sidebar-button--space--small:var(--space--small, 6px);--ez-sidebar-button--space--medium:var(--space--medium, 12px);--ez-sidebar-button--box-shadow:var(--shadow--small, 0px 0px 16px rgba(0, 38, 111, 0.07));--ez-sidebar-button--hover--box-shadow:var(--shadow--hard, 0px 0px 16px rgba(43, 58, 84, 0.24));--ez-sidebar-button--border--radius-small:var(--border--radius-small);--ez-sidebar-button--border--radius-medium:var(--border--radius-medium)}button{position:absolute;display:flex;background:var(--ez-sidebar-button--background-color--xlight);border:0;border-radius:0 var(--ez-sidebar-button--border--radius-medium) var(--ez-sidebar-button--border--radius-medium) 0;box-shadow:var(--ez-sidebar-button--box-shadow);padding:0;cursor:pointer}span{width:var(--ez-sidebar-button--width);height:var(--ez-sidebar-button--height);margin:var(--ez-sidebar-button--space--medium) var(--ez-sidebar-button--space--small) var(--ez-sidebar-button--space--medium) 0;background:var(--ez-sidebar-button--background-color--primary);border-radius:0 var(--ez-sidebar-button--border--radius-small) var(--ez-sidebar-button--border--radius-small) 0}button:hover{box-shadow:var(--ez-sidebar-button--hover--box-shadow)}button:hover span{width:var(--ez-sidebar-button--hover--width);margin:var(--ez-sidebar-button--space--medium) var(--ez-sidebar-button--space--medium) var(--ez-sidebar-button--space--medium) 0}";
|
|
125353
125436
|
|
|
125354
125437
|
const EzSidebarButton$1 = class extends HTMLElement$1 {
|
|
125355
125438
|
constructor() {
|
|
@@ -126454,7 +126537,13 @@ class Node$1 {
|
|
|
126454
126537
|
return this._isLazyLoad && !this._childrenLoaded;
|
|
126455
126538
|
}
|
|
126456
126539
|
isExpandable() {
|
|
126457
|
-
|
|
126540
|
+
if (this._isLazyLoad) {
|
|
126541
|
+
return true;
|
|
126542
|
+
}
|
|
126543
|
+
if (this.children.size > 0) {
|
|
126544
|
+
return true;
|
|
126545
|
+
}
|
|
126546
|
+
return false;
|
|
126458
126547
|
}
|
|
126459
126548
|
getChildren() {
|
|
126460
126549
|
if (this.isPlaceHolder) {
|
|
@@ -126524,6 +126613,12 @@ class Tree extends Node$1 {
|
|
|
126524
126613
|
return;
|
|
126525
126614
|
}
|
|
126526
126615
|
Object.keys(item).forEach(attrib => node.item[attrib] = item[attrib]);
|
|
126616
|
+
if (item.children == undefined) {
|
|
126617
|
+
node.children.clear();
|
|
126618
|
+
}
|
|
126619
|
+
else if (Array.isArray(item.children)) {
|
|
126620
|
+
node.updateChildren(item.children);
|
|
126621
|
+
}
|
|
126527
126622
|
this._changeCallback();
|
|
126528
126623
|
}
|
|
126529
126624
|
async open(path) {
|
|
@@ -126676,6 +126771,55 @@ const EzTree$1 = class extends HTMLElement$1 {
|
|
|
126676
126771
|
async applyFilter(pattern) {
|
|
126677
126772
|
this._tree.setFilterPattern(pattern);
|
|
126678
126773
|
}
|
|
126774
|
+
/**
|
|
126775
|
+
* Atualiza um item
|
|
126776
|
+
*/
|
|
126777
|
+
async updateItem(item) {
|
|
126778
|
+
this._tree.updateItem(item);
|
|
126779
|
+
}
|
|
126780
|
+
/**
|
|
126781
|
+
* Obtem um item pelo id
|
|
126782
|
+
*/
|
|
126783
|
+
async getItem(id) {
|
|
126784
|
+
return new Promise(resolve => {
|
|
126785
|
+
const node = this._tree.getNode(id);
|
|
126786
|
+
resolve(node === null || node === void 0 ? void 0 : node.item);
|
|
126787
|
+
});
|
|
126788
|
+
}
|
|
126789
|
+
/**
|
|
126790
|
+
* Obtem um array do caminho de itens da seleção atual.
|
|
126791
|
+
* @returns Retorna um array do caminho de itens da seleção atual.
|
|
126792
|
+
*/
|
|
126793
|
+
async getCurrentPath() {
|
|
126794
|
+
var _a, _b, _c;
|
|
126795
|
+
const node = (_a = this._tree) === null || _a === void 0 ? void 0 : _a.getNode(this.selectedId);
|
|
126796
|
+
if (node == undefined) {
|
|
126797
|
+
return;
|
|
126798
|
+
}
|
|
126799
|
+
const currentPath = [];
|
|
126800
|
+
let parentNode;
|
|
126801
|
+
let parentItem = (_b = node.parent) === null || _b === void 0 ? void 0 : _b.item;
|
|
126802
|
+
currentPath.push(this.getItemPathAttrs(node.item));
|
|
126803
|
+
while (parentItem != undefined) {
|
|
126804
|
+
currentPath.unshift(this.getItemPathAttrs(parentItem));
|
|
126805
|
+
parentNode = this._tree.getNode(parentItem.id);
|
|
126806
|
+
parentItem = (_c = parentNode === null || parentNode === void 0 ? void 0 : parentNode.parent) === null || _c === void 0 ? void 0 : _c.item;
|
|
126807
|
+
}
|
|
126808
|
+
return currentPath;
|
|
126809
|
+
}
|
|
126810
|
+
/**
|
|
126811
|
+
* Obtem o item pai a partir de um id
|
|
126812
|
+
*/
|
|
126813
|
+
async getParent(id) {
|
|
126814
|
+
return new Promise(resolve => {
|
|
126815
|
+
var _a;
|
|
126816
|
+
const node = this._tree.getNode(id);
|
|
126817
|
+
if (node) {
|
|
126818
|
+
resolve((_a = node.parent) === null || _a === void 0 ? void 0 : _a.item);
|
|
126819
|
+
}
|
|
126820
|
+
resolve(undefined);
|
|
126821
|
+
});
|
|
126822
|
+
}
|
|
126679
126823
|
observeItems(newValue, oldValue) {
|
|
126680
126824
|
if (ObjectUtils$1.objectToString(newValue) !== ObjectUtils$1.objectToString(oldValue)) {
|
|
126681
126825
|
this._tree.load(this.items || []);
|
|
@@ -126718,6 +126862,9 @@ const EzTree$1 = class extends HTMLElement$1 {
|
|
|
126718
126862
|
event.preventDefault();
|
|
126719
126863
|
}
|
|
126720
126864
|
}
|
|
126865
|
+
getItemPathAttrs({ id, label }) {
|
|
126866
|
+
return { id, label };
|
|
126867
|
+
}
|
|
126721
126868
|
openClose(item) {
|
|
126722
126869
|
if (item == undefined) {
|
|
126723
126870
|
return;
|
|
@@ -126801,9 +126948,6 @@ const EzTree$1 = class extends HTMLElement$1 {
|
|
|
126801
126948
|
if (node) {
|
|
126802
126949
|
this.value = node.item;
|
|
126803
126950
|
}
|
|
126804
|
-
else {
|
|
126805
|
-
this.selectedId = undefined;
|
|
126806
|
-
}
|
|
126807
126951
|
}
|
|
126808
126952
|
render() {
|
|
126809
126953
|
ElementIDUtils.addIDInfoIfNotExists(this._element, 'ezTree');
|
|
@@ -127305,10 +127449,10 @@ const EzDialog = /*@__PURE__*/proxyCustomElement(EzDialog$1, [1,"ez-dialog",{"co
|
|
|
127305
127449
|
const EzDropdown = /*@__PURE__*/proxyCustomElement(EzDropdown$1, [1,"ez-dropdown",{"items":[1040],"value":[1040],"itemBuilder":[16]}]);
|
|
127306
127450
|
const EzFileItem = /*@__PURE__*/proxyCustomElement(EzFileItem$1, [1,"ez-file-item",{"canRemove":[4,"can-remove"],"fileName":[1,"file-name"],"iconName":[1,"icon-name"],"fileSize":[2,"file-size"],"progress":[2]}]);
|
|
127307
127451
|
const EzFilterInput = /*@__PURE__*/proxyCustomElement(EzFilterInput$1, [1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"asyncSearch":[516,"async-search"]}]);
|
|
127308
|
-
const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16]
|
|
127452
|
+
const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16]}]);
|
|
127309
127453
|
const EzFormView = /*@__PURE__*/proxyCustomElement(EzFormView$1, [2,"ez-form-view",{"fields":[16]}]);
|
|
127310
127454
|
const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"_paginationInfo":[32],"_paginationChangedByKeyboard":[32]},[[0,"ezSelectionChange","onSelectionChange"]]]);
|
|
127311
|
-
const EzGuideNavigator = /*@__PURE__*/proxyCustomElement(EzGuideNavigator$1, [1,"ez-guide-navigator",{"open":[1540],"items":[16],"tooltipResolver":[16],"filterText":[32]}]);
|
|
127455
|
+
const EzGuideNavigator = /*@__PURE__*/proxyCustomElement(EzGuideNavigator$1, [1,"ez-guide-navigator",{"open":[1540],"selectedId":[1537,"selected-id"],"items":[16],"tooltipResolver":[16],"filterText":[32]}]);
|
|
127312
127456
|
const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]);
|
|
127313
127457
|
const EzList = /*@__PURE__*/proxyCustomElement(EzList$1, [1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"hoverFeedback":[1028,"hover-feedback"],"_listItems":[32],"_listGroupItems":[32]}]);
|
|
127314
127458
|
const EzLoadingBar = /*@__PURE__*/proxyCustomElement(EzLoadingBar$1, [1,"ez-loading-bar",{"_showLoading":[32]}]);
|