@sankhyalabs/ezui 2.10.1 → 2.12.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 +1 -1
- package/dist/cjs/ez-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item.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 +1 -1
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-dropdown.cjs.entry.js +503 -0
- package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-filter-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +140 -0
- package/dist/cjs/ez-form.cjs.entry.js +228 -330
- package/dist/cjs/ez-grid.cjs.entry.js +1 -1
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-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-scroller.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +1 -1
- package/dist/cjs/ez-sidebar-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-tabselector.cjs.entry.js +6 -3
- 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-tree.cjs.entry.js +109 -22
- 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-8646c40d.js → index-5e208fa5.js} +11 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/ez-dropdown/ez-dropdown.css +349 -0
- package/dist/collection/components/ez-dropdown/ez-dropdown.js +339 -0
- package/dist/collection/components/ez-dropdown/structure/DropdownItem.js +33 -0
- package/dist/collection/components/ez-dropdown/structure/SubmenuControl.js +241 -0
- package/dist/collection/components/ez-form/{structure/FormSheetMetadata.js → FormMetadata.js} +39 -54
- package/dist/collection/components/ez-form/ez-form.css +7 -1
- package/dist/collection/components/ez-form/ez-form.js +128 -19
- package/dist/collection/components/ez-form/interfaces/IDefaultConfig.js +1 -0
- package/dist/collection/components/ez-form/interfaces/IFieldConfig.js +1 -0
- package/dist/collection/components/ez-form/interfaces/IFormConfig.js +1 -0
- package/dist/collection/components/ez-form/interfaces/IFormSheetMetadata.js +1 -0
- package/dist/collection/components/ez-form/interfaces/IInvalidField.js +1 -0
- package/dist/collection/components/ez-form/interfaces/IRecordValidator.js +1 -0
- package/dist/collection/components/ez-form/interfaces/ITabConfig.js +1 -0
- package/dist/collection/components/ez-form/interfaces/IValidationResult.js +1 -0
- package/dist/collection/components/ez-form/interfaces/index.js +1 -0
- package/dist/collection/components/ez-form/store/form.slice.js +6 -2
- package/dist/collection/components/ez-form-view/ez-form-view.css +6 -0
- package/dist/collection/components/ez-form-view/ez-form-view.js +71 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +26 -0
- package/dist/collection/components/{ez-form/fieldbuilder/tpl → ez-form-view/fieldbuilder/templates}/CheckBox.tpl.js +4 -4
- package/dist/collection/components/{ez-form/fieldbuilder/tpl → ez-form-view/fieldbuilder/templates}/ComboBox.tpl.js +2 -2
- package/dist/collection/components/{ez-form/fieldbuilder/tpl → ez-form-view/fieldbuilder/templates}/DateInput.tpl.js +1 -1
- package/dist/collection/components/{ez-form/fieldbuilder/tpl → ez-form-view/fieldbuilder/templates}/NumberInput.tpl.js +3 -3
- package/dist/collection/components/ez-form-view/interfaces/IFormViewField.js +1 -0
- package/dist/collection/components/ez-form-view/interfaces/index.js +1 -0
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +5 -2
- package/dist/collection/components/ez-tree/ez-tree.css +8 -6
- package/dist/collection/components/ez-tree/ez-tree.js +89 -11
- package/dist/collection/components/ez-tree/subcomponents/DefaultTooltipResolver.js +3 -0
- package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +4 -4
- package/dist/collection/components/ez-tree/subcomponents/index.js +1 -0
- package/dist/collection/components/ez-tree/types/Node.js +26 -4
- package/dist/collection/components/ez-tree/types/Tree.js +23 -2
- package/dist/custom-elements/index.d.ts +12 -0
- package/dist/custom-elements/index.js +977 -355
- 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 +1 -1
- package/dist/esm/ez-button.entry.js +1 -1
- package/dist/esm/ez-calendar.entry.js +1 -1
- package/dist/esm/ez-card-item.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 +1 -1
- package/dist/esm/ez-date-input.entry.js +1 -1
- package/dist/esm/ez-date-time-input.entry.js +1 -1
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-dropdown.entry.js +499 -0
- package/dist/esm/ez-file-item.entry.js +1 -1
- package/dist/esm/ez-filter-input.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +136 -0
- package/dist/esm/ez-form.entry.js +229 -331
- package/dist/esm/ez-grid.entry.js +1 -1
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-loading-bar.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-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-scroller.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +1 -1
- package/dist/esm/ez-sidebar-button.entry.js +1 -1
- package/dist/esm/ez-tabselector.entry.js +6 -3
- 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-tree.entry.js +109 -22
- package/dist/esm/ez-upload.entry.js +1 -1
- package/dist/esm/ez-view-stack.entry.js +1 -1
- package/dist/esm/ezui.js +2 -2
- package/dist/esm/{index-7bc778b3.js → index-c5203f95.js} +11 -0
- package/dist/esm/loader.js +2 -2
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-739d60d1.entry.js → p-0c3f7bf2.entry.js} +1 -1
- package/dist/ezui/{p-171c3236.entry.js → p-0cd0545d.entry.js} +1 -1
- package/dist/ezui/{p-ad5fe50b.entry.js → p-1a27bb9f.entry.js} +1 -1
- package/dist/ezui/{p-3cfefc57.entry.js → p-1b94b9dc.entry.js} +1 -1
- package/dist/ezui/{p-f18f16e0.entry.js → p-20c01161.entry.js} +1 -1
- package/dist/ezui/{p-1634c851.entry.js → p-24717f87.entry.js} +1 -1
- package/dist/ezui/{p-7e496975.entry.js → p-3320768e.entry.js} +1 -1
- package/dist/ezui/{p-123a2bd5.entry.js → p-36ed5c45.entry.js} +1 -1
- package/dist/ezui/{p-25e83e46.entry.js → p-3b2091dd.entry.js} +1 -1
- package/dist/ezui/p-47bcc678.entry.js +1 -0
- package/dist/ezui/{p-9def6fd0.entry.js → p-47ca5e09.entry.js} +1 -1
- package/dist/ezui/{p-04fab1e9.entry.js → p-4c444816.entry.js} +1 -1
- package/dist/ezui/{p-9334a724.entry.js → p-608d13e8.entry.js} +1 -1
- package/dist/ezui/{p-50ae478a.entry.js → p-626b8940.entry.js} +1 -1
- package/dist/ezui/{p-14a04845.entry.js → p-6630eca2.entry.js} +1 -1
- package/dist/ezui/{p-9404f22b.entry.js → p-67b9a2cb.entry.js} +1 -1
- package/dist/ezui/{p-93bcc628.entry.js → p-6dec5cfa.entry.js} +1 -1
- package/dist/ezui/{p-5dc3af60.entry.js → p-6f9aba86.entry.js} +1 -1
- package/dist/ezui/p-7799666d.entry.js +1 -0
- package/dist/ezui/p-7b80df03.js +1 -0
- package/dist/ezui/{p-5c9ce8a7.entry.js → p-7d42065a.entry.js} +1 -1
- package/dist/ezui/{p-74c7f960.entry.js → p-81897c04.entry.js} +1 -1
- package/dist/ezui/p-91f8c816.entry.js +1 -0
- package/dist/ezui/p-97d2d2f6.entry.js +1 -0
- package/dist/ezui/{p-32f9f83a.entry.js → p-98c448c9.entry.js} +1 -1
- package/dist/ezui/{p-a86d00b3.entry.js → p-99aea44b.entry.js} +1 -1
- package/dist/ezui/p-a4b4645d.entry.js +1 -0
- package/dist/ezui/{p-e613d9bf.entry.js → p-ab5eee38.entry.js} +1 -1
- package/dist/ezui/{p-a2e55b33.entry.js → p-ad7151e0.entry.js} +1 -1
- package/dist/ezui/{p-f6111077.entry.js → p-ad8b7412.entry.js} +1 -1
- package/dist/ezui/{p-1a89d3ff.entry.js → p-b2e861cb.entry.js} +1 -1
- package/dist/ezui/{p-f2627de5.entry.js → p-b2efb22c.entry.js} +1 -1
- package/dist/ezui/{p-04a3b457.entry.js → p-b5557d33.entry.js} +1 -1
- package/dist/ezui/p-ba03ac61.entry.js +1 -0
- package/dist/ezui/{p-6fd5e142.entry.js → p-bc324ee8.entry.js} +1 -1
- package/dist/ezui/{p-cfcc23e6.entry.js → p-bd9792e2.entry.js} +1 -1
- package/dist/ezui/{p-7c227b86.entry.js → p-bf8a633d.entry.js} +1 -1
- package/dist/ezui/{p-ea877274.entry.js → p-c071db26.entry.js} +1 -1
- package/dist/ezui/{p-46113d5a.entry.js → p-c3529df3.entry.js} +1 -1
- package/dist/ezui/{p-b60fbad2.entry.js → p-ca7435a6.entry.js} +1 -1
- package/dist/ezui/{p-37335c51.entry.js → p-e203c89f.entry.js} +1 -1
- package/dist/ezui/{p-f2c4e811.entry.js → p-fc97f773.entry.js} +1 -1
- package/dist/types/components/ez-dropdown/ez-dropdown.d.ts +58 -0
- package/dist/types/components/ez-dropdown/structure/DropdownItem.d.ts +28 -0
- package/dist/types/components/ez-dropdown/structure/SubmenuControl.d.ts +78 -0
- package/dist/types/components/ez-form/DataBinder.d.ts +1 -1
- package/dist/types/components/ez-form/FormMetadata.d.ts +16 -0
- package/dist/types/components/ez-form/ez-form.d.ts +21 -43
- package/dist/types/components/ez-form/interfaces/IDefaultConfig.d.ts +5 -0
- package/dist/types/components/ez-form/interfaces/IFieldConfig.d.ts +13 -0
- package/dist/types/components/ez-form/interfaces/IFormConfig.d.ts +7 -0
- package/dist/types/components/ez-form/interfaces/IFormSheetMetadata.d.ts +9 -0
- package/dist/types/components/ez-form/interfaces/IInvalidField.d.ts +4 -0
- package/dist/types/components/ez-form/interfaces/IRecordValidator.d.ts +6 -0
- package/dist/types/components/ez-form/interfaces/ITabConfig.d.ts +5 -0
- package/dist/types/components/ez-form/interfaces/IValidationResult.d.ts +8 -0
- package/dist/types/components/ez-form/interfaces/index.d.ts +8 -0
- package/dist/types/components/ez-form/store/form.slice.d.ts +5 -3
- package/dist/types/components/ez-form-view/fieldbuilder/FieldBuilder.d.ts +2 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.d.ts +3 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.d.ts +2 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.d.ts +2 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.d.ts +3 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.d.ts +2 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextArea.tpl.d.ts +2 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +2 -0
- package/dist/types/components/ez-form-view/interfaces/IFormViewField.d.ts +10 -0
- package/dist/types/components/ez-form-view/interfaces/index.d.ts +1 -0
- package/dist/types/components/ez-tree/ez-tree.d.ts +13 -0
- package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +1 -0
- package/dist/types/components/ez-tree/subcomponents/DefaultTooltipResolver.d.ts +2 -0
- package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +2 -0
- package/dist/types/components/ez-tree/subcomponents/index.d.ts +1 -0
- package/dist/types/components/ez-tree/types/Node.d.ts +1 -0
- package/dist/types/components/ez-tree/types/Tree.d.ts +1 -0
- package/dist/types/components.d.ts +111 -2
- package/package.json +1 -1
- package/react/components.d.ts +2 -0
- package/react/components.js +2 -0
- package/react/components.js.map +1 -1
- package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +0 -48
- package/dist/collection/components/ez-form/structure/FormItem.js +0 -11
- package/dist/collection/components/ez-form/structure/FormSheet.js +0 -6
- package/dist/ezui/p-1cc11468.entry.js +0 -1
- package/dist/ezui/p-3c7ea91b.js +0 -1
- package/dist/ezui/p-79e409c6.entry.js +0 -1
- package/dist/ezui/p-941e9792.entry.js +0 -1
- package/dist/ezui/p-ddb1c350.entry.js +0 -1
- package/dist/types/components/ez-form/fieldbuilder/FieldBuilder.d.ts +0 -2
- package/dist/types/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.d.ts +0 -3
- package/dist/types/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.d.ts +0 -6
- package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +0 -15
- package/dist/types/components/ez-form/fieldbuilder/tpl/FileInput.tpl.d.ts +0 -5
- package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +0 -7
- package/dist/types/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.d.ts +0 -6
- package/dist/types/components/ez-form/fieldbuilder/tpl/TextArea.tpl.d.ts +0 -5
- package/dist/types/components/ez-form/fieldbuilder/tpl/TextInput.tpl.d.ts +0 -5
- package/dist/types/components/ez-form/structure/FormItem.d.ts +0 -9
- package/dist/types/components/ez-form/structure/FormSheet.d.ts +0 -10
- package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +0 -35
- /package/dist/collection/components/{ez-form/fieldbuilder/tpl → ez-form-view/fieldbuilder/templates}/FileInput.tpl.js +0 -0
- /package/dist/collection/components/{ez-form/fieldbuilder/tpl → ez-form-view/fieldbuilder/templates}/SearchInput.tpl.js +0 -0
- /package/dist/collection/components/{ez-form/fieldbuilder/tpl → ez-form-view/fieldbuilder/templates}/TextArea.tpl.js +0 -0
- /package/dist/collection/components/{ez-form/fieldbuilder/tpl → ez-form-view/fieldbuilder/templates}/TextInput.tpl.js +0 -0
package/dist/collection/components/ez-form/{structure/FormSheetMetadata.js → FormMetadata.js}
RENAMED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserInterface } from "@sankhyalabs/core";
|
|
1
2
|
export class FormMetadata {
|
|
2
3
|
constructor() {
|
|
3
4
|
this._sheets = new Map();
|
|
@@ -27,40 +28,20 @@ export class FormMetadata {
|
|
|
27
28
|
return this._defaultValues;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
export const isRequiredField = (descriptor, config) => {
|
|
31
|
-
if (descriptor.required) {
|
|
32
|
-
//Se for required pelo descritor não olha pra configuração.
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
return config === null || config === void 0 ? void 0 : config.required;
|
|
36
|
-
};
|
|
37
|
-
export const isReadOnlyField = (descriptor, config) => {
|
|
38
|
-
if (descriptor.readOnly) {
|
|
39
|
-
//Se for readOnly pelo descritor não olha pra configuração.
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
return config === null || config === void 0 ? void 0 : config.readOnly;
|
|
43
|
-
};
|
|
44
31
|
export const buildFromDataUnit = (dataUnit) => {
|
|
45
|
-
var _a, _b;
|
|
46
32
|
const unitMD = dataUnit.metadata;
|
|
47
33
|
const metadata = new FormMetadata();
|
|
48
34
|
if (unitMD) {
|
|
49
|
-
const visibleFields = (
|
|
50
|
-
const
|
|
51
|
-
(_b = unitMD === null || unitMD === void 0 ? void 0 : unitMD.fields) === null || _b === void 0 ? void 0 : _b.forEach((descriptor) => {
|
|
52
|
-
if (descriptor.visible !== false) {
|
|
53
|
-
resolveFieldGroup(items, null, descriptor);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
35
|
+
const visibleFields = (unitMD.fields || []).filter(descriptor => descriptor.visible !== false);
|
|
36
|
+
const fields = visibleFields.map(descriptor => buildFormField(descriptor));
|
|
56
37
|
let defaultValues = {};
|
|
57
38
|
visibleFields
|
|
58
39
|
.filter(descriptor => descriptor.defaultValue)
|
|
59
|
-
.
|
|
40
|
+
.forEach((descriptor) => defaultValues[descriptor.name] = descriptor.defaultValue);
|
|
60
41
|
metadata.addSheet({
|
|
61
|
-
label: unitMD.label,
|
|
62
42
|
name: unitMD.name,
|
|
63
|
-
|
|
43
|
+
label: unitMD.label,
|
|
44
|
+
fields,
|
|
64
45
|
requiredFields: visibleFields
|
|
65
46
|
.filter(descriptor => descriptor.required)
|
|
66
47
|
.map(descriptor => descriptor.name),
|
|
@@ -72,29 +53,6 @@ export const buildFromDataUnit = (dataUnit) => {
|
|
|
72
53
|
}
|
|
73
54
|
return metadata;
|
|
74
55
|
};
|
|
75
|
-
function getTabConfig(tab, sheets) {
|
|
76
|
-
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
77
|
-
return tabConfig || { label: tab, visible: true };
|
|
78
|
-
}
|
|
79
|
-
function sortTabs(a, b) {
|
|
80
|
-
return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
81
|
-
}
|
|
82
|
-
function resolveFieldGroup(items, field, descriptor) {
|
|
83
|
-
const fieldMD = { config: field, descriptor: descriptor };
|
|
84
|
-
let group = (field === null || field === void 0 ? void 0 : field.group) || descriptor.group;
|
|
85
|
-
if (group) {
|
|
86
|
-
const key = `group::${group}`;
|
|
87
|
-
if (!items.has(key)) {
|
|
88
|
-
items.set(key, { label: group, items: [fieldMD] });
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
items.get(key).items.push(fieldMD);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
items.set((field === null || field === void 0 ? void 0 : field.name) || descriptor.name, fieldMD);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
56
|
export const buildFromConfig = (config, dataUnit) => {
|
|
99
57
|
var _a, _b;
|
|
100
58
|
const sheets = new Map();
|
|
@@ -117,10 +75,11 @@ export const buildFromConfig = (config, dataUnit) => {
|
|
|
117
75
|
const descriptor = dataUnit.getField(field.name);
|
|
118
76
|
if (descriptor && tabConfig.visible) {
|
|
119
77
|
if (!sheets.has(tabConfig)) {
|
|
120
|
-
sheets.set(tabConfig,
|
|
78
|
+
sheets.set(tabConfig, []);
|
|
121
79
|
}
|
|
122
|
-
const
|
|
123
|
-
|
|
80
|
+
const formField = buildFormField(descriptor, field);
|
|
81
|
+
sheets.get(tabConfig).push(formField);
|
|
82
|
+
if (formField.required) {
|
|
124
83
|
requiredFields.push(field.name);
|
|
125
84
|
}
|
|
126
85
|
const cleanOnCopy = field.cleanOnCopy == undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : field.cleanOnCopy;
|
|
@@ -131,18 +90,17 @@ export const buildFromConfig = (config, dataUnit) => {
|
|
|
131
90
|
if (defaultValue) {
|
|
132
91
|
defaultValues[field.name] = field.defaultValue;
|
|
133
92
|
}
|
|
134
|
-
resolveFieldGroup(tabItens, field, descriptor);
|
|
135
93
|
}
|
|
136
94
|
}
|
|
137
95
|
});
|
|
138
96
|
const metadata = new FormMetadata();
|
|
139
97
|
Array.from(sheets.entries())
|
|
140
98
|
.sort(sortTabs)
|
|
141
|
-
.forEach(([key,
|
|
99
|
+
.forEach(([key, fields]) => {
|
|
142
100
|
metadata.addSheet({
|
|
143
101
|
label: (key.label === "__main") ? "Principal" : key.label,
|
|
144
102
|
name: key.label,
|
|
145
|
-
|
|
103
|
+
fields,
|
|
146
104
|
requiredFields,
|
|
147
105
|
cleanOnCopyFields,
|
|
148
106
|
defaultValues
|
|
@@ -150,3 +108,30 @@ export const buildFromConfig = (config, dataUnit) => {
|
|
|
150
108
|
});
|
|
151
109
|
return metadata;
|
|
152
110
|
};
|
|
111
|
+
const buildFormField = (descriptor, config) => {
|
|
112
|
+
let { name, label, group } = Object.assign({}, config);
|
|
113
|
+
let { readOnly, required } = Object.assign({}, config);
|
|
114
|
+
let props;
|
|
115
|
+
let userInterface;
|
|
116
|
+
if (descriptor) {
|
|
117
|
+
label = label || descriptor.label;
|
|
118
|
+
name = name || descriptor.name;
|
|
119
|
+
required = descriptor.required || (config === null || config === void 0 ? void 0 : config.required);
|
|
120
|
+
readOnly = descriptor.readOnly || (config === null || config === void 0 ? void 0 : config.readOnly);
|
|
121
|
+
props = descriptor.properties;
|
|
122
|
+
userInterface = descriptor.userInterface;
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
name, label, group,
|
|
126
|
+
readOnly, required,
|
|
127
|
+
props,
|
|
128
|
+
userInterface: userInterface || UserInterface.SHORTTEXT
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
const getTabConfig = (tab, sheets) => {
|
|
132
|
+
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
133
|
+
return tabConfig || { label: tab, visible: true };
|
|
134
|
+
};
|
|
135
|
+
const sortTabs = (a, b) => {
|
|
136
|
+
return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
137
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
:host {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: 100%;
|
|
@@ -7,4 +7,10 @@ ez-form {
|
|
|
7
7
|
.dynamic-content ez-collapsible-box {
|
|
8
8
|
--ez-collapsible-box__header--padding-right: var(--space-small, 6px);
|
|
9
9
|
--ez-collapsible-box__header--padding-left: var(--space-small, 6px);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.multi-level__container {
|
|
13
|
+
display: grid;
|
|
14
|
+
grid-template-columns: minmax(20%, 300px) auto;
|
|
15
|
+
width: 100%;
|
|
10
16
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { FormSheet } from "./structure/FormSheet";
|
|
4
|
-
import { buildFromConfig, buildFromDataUnit } from "./structure/FormSheetMetadata";
|
|
1
|
+
import { Action, DataUnit, DataUnitAction, ElementIDUtils, StringUtils } from "@sankhyalabs/core";
|
|
2
|
+
import { Component, Element, Event, Host, Method, Prop, Watch, forceUpdate, h } from "@stencil/core";
|
|
5
3
|
import { createStore } from "redux";
|
|
6
|
-
import { formReducer, selectCurrentSheet, selectFormMetadata, loadMetadata, changeTab } from "./store/form.slice";
|
|
7
|
-
import DataBinder from "./DataBinder";
|
|
8
4
|
import ApplicationUtils from "../../utils/ApplicationUtils";
|
|
5
|
+
import DataBinder from "./DataBinder";
|
|
6
|
+
import { changeTab, formReducer, loadMetadata, selectCurrentSheet, selectCurrentSheetId, selectFormMetadata } from "./store/form.slice";
|
|
7
|
+
import { buildFromConfig, buildFromDataUnit } from "./FormMetadata";
|
|
9
8
|
export class EzForm {
|
|
10
9
|
constructor() {
|
|
11
10
|
this.onDataUnitAction = (action) => {
|
|
@@ -85,17 +84,43 @@ export class EzForm {
|
|
|
85
84
|
}
|
|
86
85
|
});
|
|
87
86
|
}
|
|
87
|
+
resolveLevel(items) {
|
|
88
|
+
if (!this.levelResolver) {
|
|
89
|
+
return items;
|
|
90
|
+
}
|
|
91
|
+
return this.levelResolver(items);
|
|
92
|
+
}
|
|
93
|
+
getMultiLevelContent(sheets, currentSheet, currentSheetId) {
|
|
94
|
+
const treeItems = this.resolveLevel(sheets.map(sheet => {
|
|
95
|
+
const item = {
|
|
96
|
+
id: sheet.name,
|
|
97
|
+
label: sheet.label
|
|
98
|
+
};
|
|
99
|
+
return item;
|
|
100
|
+
}));
|
|
101
|
+
return (h("div", { class: "multi-level__container" },
|
|
102
|
+
h("div", null,
|
|
103
|
+
h("ez-tree", { selectedId: currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.name, items: treeItems, onEzChange: (evt) => {
|
|
104
|
+
var _a;
|
|
105
|
+
const selectedItem = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.id;
|
|
106
|
+
if (selectedItem && selectedItem !== (currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.name)) {
|
|
107
|
+
this._store.dispatch(changeTab(selectedItem));
|
|
108
|
+
}
|
|
109
|
+
} })),
|
|
110
|
+
h("div", null, this.buildFormContent(currentSheetId, currentSheet))));
|
|
111
|
+
}
|
|
88
112
|
getDynamicContent() {
|
|
89
|
-
var _a;
|
|
113
|
+
var _a, _b;
|
|
90
114
|
const formMD = selectFormMetadata(this._store.getState());
|
|
91
115
|
if (!formMD)
|
|
92
116
|
return null;
|
|
93
|
-
const currentSheet = selectCurrentSheet((_a = this._store) === null || _a === void 0 ? void 0 : _a.getState());
|
|
94
|
-
if (!currentSheet) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
117
|
const allSheets = Array.from(formMD.getAllSheets().values());
|
|
98
|
-
const
|
|
118
|
+
const currentSheetId = selectCurrentSheetId((_a = this._store) === null || _a === void 0 ? void 0 : _a.getState());
|
|
119
|
+
const currentSheet = selectCurrentSheet((_b = this._store) === null || _b === void 0 ? void 0 : _b.getState());
|
|
120
|
+
if (this.multiLevel) {
|
|
121
|
+
return this.getMultiLevelContent(allSheets, currentSheet, currentSheetId);
|
|
122
|
+
}
|
|
123
|
+
let result = [];
|
|
99
124
|
if (allSheets.length > 1) {
|
|
100
125
|
const tabs = allSheets.map((sheet, index) => {
|
|
101
126
|
return { tabKey: sheet.name, label: sheet.label, index };
|
|
@@ -103,12 +128,26 @@ export class EzForm {
|
|
|
103
128
|
const idTabSelector = `selector`;
|
|
104
129
|
result.push(h("ez-tabselector", { tabs: this.buildIdTabSelector(tabs), onEzChange: (evt) => this._store.dispatch(changeTab(evt.detail)), selectedTab: currentSheet.name, "data-element-id": idTabSelector }));
|
|
105
130
|
}
|
|
106
|
-
|
|
107
|
-
result.push(h(FormSheet, { store: this._store, source: currentSheet, dataElementId: idFormSheet }));
|
|
131
|
+
result = result.concat(this.buildFormContent(currentSheetId, currentSheet));
|
|
108
132
|
return result;
|
|
109
133
|
}
|
|
134
|
+
buildFormContent(sheetId, currentSheet) {
|
|
135
|
+
const fields = currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.fields;
|
|
136
|
+
if (this.contentBuilder != undefined) {
|
|
137
|
+
const customContent = this.contentBuilder(sheetId, fields);
|
|
138
|
+
if (customContent != undefined) {
|
|
139
|
+
return h("div", { "innerHTML": customContent });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (currentSheet == undefined) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const idFormSheet = `${StringUtils.replaceAccentuatedChars(StringUtils.toCamelCase(currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.label), false)}_selectorContainer`;
|
|
146
|
+
return (h("div", { class: "dynamic-content ez-box__container", "data-element-id": idFormSheet },
|
|
147
|
+
h("ez-form-view", { class: "ez-row ez-padding-vertical--small", fields: fields })));
|
|
148
|
+
}
|
|
110
149
|
processMetadata() {
|
|
111
|
-
if (!this.isStatic() && this.dataUnit) {
|
|
150
|
+
if (!this.isStatic() && this.dataUnit && this._store) {
|
|
112
151
|
const metadata = this.config != undefined && Object.values(this.config).length > 0 ? buildFromConfig(this.config, this.dataUnit) : buildFromDataUnit(this.dataUnit);
|
|
113
152
|
this._store.dispatch(loadMetadata(metadata));
|
|
114
153
|
}
|
|
@@ -148,7 +187,7 @@ export class EzForm {
|
|
|
148
187
|
}
|
|
149
188
|
if (action.type === Action.RECORDS_ADDED) {
|
|
150
189
|
const metadata = selectFormMetadata(this._store.getState());
|
|
151
|
-
const defaultValues = metadata.getDefaultValues();
|
|
190
|
+
const defaultValues = metadata === null || metadata === void 0 ? void 0 : metadata.getDefaultValues();
|
|
152
191
|
if (defaultValues) {
|
|
153
192
|
const records = action.payload;
|
|
154
193
|
return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
|
|
@@ -197,6 +236,7 @@ export class EzForm {
|
|
|
197
236
|
return (h(Host, null, this.isStatic() ? null : this.getDynamicContent()));
|
|
198
237
|
}
|
|
199
238
|
static get is() { return "ez-form"; }
|
|
239
|
+
static get encapsulation() { return "scoped"; }
|
|
200
240
|
static get originalStyleUrls() { return {
|
|
201
241
|
"$": ["ez-form.css"]
|
|
202
242
|
}; }
|
|
@@ -232,7 +272,8 @@ export class EzForm {
|
|
|
232
272
|
"resolved": "IFormConfig",
|
|
233
273
|
"references": {
|
|
234
274
|
"IFormConfig": {
|
|
235
|
-
"location": "
|
|
275
|
+
"location": "import",
|
|
276
|
+
"path": "./interfaces"
|
|
236
277
|
}
|
|
237
278
|
}
|
|
238
279
|
},
|
|
@@ -251,7 +292,8 @@ export class EzForm {
|
|
|
251
292
|
"resolved": "IRecordValidator",
|
|
252
293
|
"references": {
|
|
253
294
|
"IRecordValidator": {
|
|
254
|
-
"location": "
|
|
295
|
+
"location": "import",
|
|
296
|
+
"path": "./interfaces"
|
|
255
297
|
}
|
|
256
298
|
}
|
|
257
299
|
},
|
|
@@ -261,6 +303,72 @@ export class EzForm {
|
|
|
261
303
|
"tags": [],
|
|
262
304
|
"text": "Define um validador respons\u00E1vel pela integridade dos registros."
|
|
263
305
|
}
|
|
306
|
+
},
|
|
307
|
+
"multiLevel": {
|
|
308
|
+
"type": "boolean",
|
|
309
|
+
"mutable": false,
|
|
310
|
+
"complexType": {
|
|
311
|
+
"original": "boolean",
|
|
312
|
+
"resolved": "boolean",
|
|
313
|
+
"references": {}
|
|
314
|
+
},
|
|
315
|
+
"required": false,
|
|
316
|
+
"optional": false,
|
|
317
|
+
"docs": {
|
|
318
|
+
"tags": [],
|
|
319
|
+
"text": "Habilita o modo de organiza\u00E7\u00E3o com v\u00E1rios n\u00EDveis."
|
|
320
|
+
},
|
|
321
|
+
"attribute": "multi-level",
|
|
322
|
+
"reflect": false
|
|
323
|
+
},
|
|
324
|
+
"levelResolver": {
|
|
325
|
+
"type": "unknown",
|
|
326
|
+
"mutable": false,
|
|
327
|
+
"complexType": {
|
|
328
|
+
"original": "(items: Array<ITreeItem>) => Array<ITreeItem>",
|
|
329
|
+
"resolved": "(items: ITreeItem[]) => ITreeItem[]",
|
|
330
|
+
"references": {
|
|
331
|
+
"Array": {
|
|
332
|
+
"location": "global"
|
|
333
|
+
},
|
|
334
|
+
"ITreeItem": {
|
|
335
|
+
"location": "import",
|
|
336
|
+
"path": "../ez-tree/interfaces/ITreeItem"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
"required": false,
|
|
341
|
+
"optional": false,
|
|
342
|
+
"docs": {
|
|
343
|
+
"tags": [],
|
|
344
|
+
"text": "Define um resolvedor de n\u00EDvel no modo `multiLevel`."
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"contentBuilder": {
|
|
348
|
+
"type": "unknown",
|
|
349
|
+
"mutable": false,
|
|
350
|
+
"complexType": {
|
|
351
|
+
"original": "(selectedTab: string, fields: Array<IFormViewField>) => HTMLElement | string",
|
|
352
|
+
"resolved": "(selectedTab: string, fields: IFormViewField[]) => string | HTMLElement",
|
|
353
|
+
"references": {
|
|
354
|
+
"Array": {
|
|
355
|
+
"location": "global"
|
|
356
|
+
},
|
|
357
|
+
"IFormViewField": {
|
|
358
|
+
"location": "import",
|
|
359
|
+
"path": "../ez-form-view/interfaces"
|
|
360
|
+
},
|
|
361
|
+
"HTMLElement": {
|
|
362
|
+
"location": "global"
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
"required": false,
|
|
367
|
+
"optional": false,
|
|
368
|
+
"docs": {
|
|
369
|
+
"tags": [],
|
|
370
|
+
"text": "Define um construtor. Isso permite personalizar o conte\u00FAdo do formul\u00E1rio"
|
|
371
|
+
}
|
|
264
372
|
}
|
|
265
373
|
}; }
|
|
266
374
|
static get events() { return [{
|
|
@@ -296,7 +404,8 @@ export class EzForm {
|
|
|
296
404
|
"path": "@sankhyalabs/core"
|
|
297
405
|
},
|
|
298
406
|
"IValidationResult": {
|
|
299
|
-
"location": "
|
|
407
|
+
"location": "import",
|
|
408
|
+
"path": "./interfaces"
|
|
300
409
|
}
|
|
301
410
|
},
|
|
302
411
|
"return": "Promise<void>"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -20,15 +20,19 @@ export function loadMetadata(formMetadata) {
|
|
|
20
20
|
export function changeTab(currentSheet) {
|
|
21
21
|
return {
|
|
22
22
|
type: FormActions.CHANGE_TAB,
|
|
23
|
-
payload: currentSheet.tabKey
|
|
23
|
+
payload: typeof currentSheet === "string" ? currentSheet : currentSheet.tabKey
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
/////////////////////////////// SELECTORS ///////////////////////////////
|
|
27
27
|
export function selectFormMetadata(state) {
|
|
28
28
|
return state.formMetadata;
|
|
29
29
|
}
|
|
30
|
+
export function selectCurrentSheetId(state) {
|
|
31
|
+
return state.currentSheet;
|
|
32
|
+
}
|
|
30
33
|
export function selectCurrentSheet(state) {
|
|
31
|
-
|
|
34
|
+
const currentSheetId = selectCurrentSheetId(state);
|
|
35
|
+
return currentSheetId ? state.formMetadata.getSheet(currentSheetId) : Array.from(state.formMetadata.getAllSheets().values())[0];
|
|
32
36
|
}
|
|
33
37
|
/////////////////////////////// TYPES ///////////////////////////////
|
|
34
38
|
var FormActions;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Component, Element, Host, Prop, h } from '@stencil/core';
|
|
2
|
+
import { fieldBuilder } from './fieldbuilder/FieldBuilder';
|
|
3
|
+
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
4
|
+
export class EzFormView {
|
|
5
|
+
groupFields(fields) {
|
|
6
|
+
const result = new Map();
|
|
7
|
+
fields.forEach(item => {
|
|
8
|
+
const groupLabel = item.group;
|
|
9
|
+
if (groupLabel) {
|
|
10
|
+
let groupFields = result.get(groupLabel);
|
|
11
|
+
if (groupFields == undefined) {
|
|
12
|
+
groupFields = [];
|
|
13
|
+
result.set(groupLabel, groupFields);
|
|
14
|
+
}
|
|
15
|
+
groupFields.push(item);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
result.set(item.name, item);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
ElementIDUtils.addIDInfoIfNotExists(this._element, 'ezFormView');
|
|
25
|
+
if (this.fields == undefined) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
return (h(Host, null, Array.from(this.groupFields(this.fields).entries()).map(([label, value]) => {
|
|
29
|
+
if (Array.isArray(value)) {
|
|
30
|
+
return (h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, value.map(fi => fieldBuilder(fi))));
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return fieldBuilder(value);
|
|
34
|
+
}
|
|
35
|
+
})));
|
|
36
|
+
}
|
|
37
|
+
static get is() { return "ez-form-view"; }
|
|
38
|
+
static get encapsulation() { return "scoped"; }
|
|
39
|
+
static get originalStyleUrls() { return {
|
|
40
|
+
"$": ["ez-form-view.css"]
|
|
41
|
+
}; }
|
|
42
|
+
static get styleUrls() { return {
|
|
43
|
+
"$": ["ez-form-view.css"]
|
|
44
|
+
}; }
|
|
45
|
+
static get properties() { return {
|
|
46
|
+
"fields": {
|
|
47
|
+
"type": "unknown",
|
|
48
|
+
"mutable": false,
|
|
49
|
+
"complexType": {
|
|
50
|
+
"original": "Array<IFormViewField>",
|
|
51
|
+
"resolved": "IFormViewField[]",
|
|
52
|
+
"references": {
|
|
53
|
+
"Array": {
|
|
54
|
+
"location": "global"
|
|
55
|
+
},
|
|
56
|
+
"IFormViewField": {
|
|
57
|
+
"location": "import",
|
|
58
|
+
"path": "./interfaces/IFormViewField"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"required": false,
|
|
63
|
+
"optional": false,
|
|
64
|
+
"docs": {
|
|
65
|
+
"tags": [],
|
|
66
|
+
"text": "Define a lista de metadados usada para criar os campos de user interface."
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}; }
|
|
70
|
+
static get elementRef() { return "_element"; }
|
|
71
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { UserInterface } from "@sankhyalabs/core";
|
|
2
|
+
import { buildCheckBox, buildSwitch } from "./templates/CheckBox.tpl";
|
|
3
|
+
import { buildComboBox } from "./templates/ComboBox.tpl";
|
|
4
|
+
import { buildDate, buildTime, buildDateTime } from "./templates/DateInput.tpl";
|
|
5
|
+
import { buildFile } from "./templates/FileInput.tpl";
|
|
6
|
+
import { buildDecimal, buildInteger } from "./templates/NumberInput.tpl";
|
|
7
|
+
import { buildSearch } from "./templates/SearchInput.tpl";
|
|
8
|
+
import { buildTextArea } from "./templates/TextArea.tpl";
|
|
9
|
+
import { buildTextInput } from "./templates/TextInput.tpl";
|
|
10
|
+
const uiBuilders = new Map();
|
|
11
|
+
uiBuilders.set(UserInterface.CHECKBOX, buildCheckBox);
|
|
12
|
+
uiBuilders.set(UserInterface.SWITCH, buildSwitch);
|
|
13
|
+
uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
|
|
14
|
+
uiBuilders.set(UserInterface.DATE, buildDate);
|
|
15
|
+
uiBuilders.set(UserInterface.TIME, buildTime);
|
|
16
|
+
uiBuilders.set(UserInterface.DATETIME, buildDateTime);
|
|
17
|
+
uiBuilders.set(UserInterface.FILE, buildFile);
|
|
18
|
+
uiBuilders.set(UserInterface.DECIMALNUMBER, buildDecimal);
|
|
19
|
+
uiBuilders.set(UserInterface.INTEGERNUMBER, buildInteger);
|
|
20
|
+
uiBuilders.set(UserInterface.SEARCH, buildSearch);
|
|
21
|
+
uiBuilders.set(UserInterface.LONGTEXT, buildTextArea);
|
|
22
|
+
export const fieldBuilder = (field) => {
|
|
23
|
+
const builder = uiBuilders.get(field.userInterface) || buildTextInput;
|
|
24
|
+
const label = field.required ? `${field.label} (obrigatório) *` : field.label;
|
|
25
|
+
return builder(Object.assign(Object.assign({}, field), { label }));
|
|
26
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { CheckMode } from "../../../ez-check/CheckMode";
|
|
3
|
-
export const buildSwitch = (
|
|
4
|
-
return buildField(
|
|
3
|
+
export const buildSwitch = (field) => {
|
|
4
|
+
return buildField(field.name, field.label, field.readOnly, true);
|
|
5
5
|
};
|
|
6
|
-
export const buildCheckBox = (
|
|
7
|
-
return buildField(
|
|
6
|
+
export const buildCheckBox = (field) => {
|
|
7
|
+
return buildField(field.name, field.label, field.readOnly, false);
|
|
8
8
|
};
|
|
9
9
|
function buildField(fieldName, fieldLabel, readOnly, switchMode = false) {
|
|
10
10
|
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" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
export const buildComboBox = ({ name, label, readOnly, required }
|
|
3
|
-
const prop =
|
|
2
|
+
export const buildComboBox = ({ name, label, readOnly, required, props }) => {
|
|
3
|
+
const prop = props === null || props === void 0 ? void 0 : props.options;
|
|
4
4
|
let options;
|
|
5
5
|
if (typeof prop === "string") {
|
|
6
6
|
const parsed = JSON.parse(prop);
|
|
@@ -7,7 +7,7 @@ export const buildTime = ({ name, label, readOnly }) => {
|
|
|
7
7
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
8
8
|
h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
9
9
|
};
|
|
10
|
-
export const
|
|
10
|
+
export const buildDateTime = ({ name, label, readOnly }) => {
|
|
11
11
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
12
12
|
h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
13
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
export const buildDecimal = ({ name, label, readOnly }
|
|
3
|
-
const precision = Number((
|
|
4
|
-
const prettyPrecision = Number((
|
|
2
|
+
export const buildDecimal = ({ name, label, readOnly, props }) => {
|
|
3
|
+
const precision = Number((props === null || props === void 0 ? void 0 : props.precision) || 2);
|
|
4
|
+
const prettyPrecision = Number((props === null || props === void 0 ? void 0 : props.prettyPrecision) || precision);
|
|
5
5
|
return buildNumeric(name, label, readOnly, precision, prettyPrecision);
|
|
6
6
|
};
|
|
7
7
|
export const buildInteger = ({ name, label, readOnly }) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -68,9 +68,12 @@ export class EzTabselector {
|
|
|
68
68
|
}
|
|
69
69
|
componentWillRender() {
|
|
70
70
|
if (!this._processedTabs) {
|
|
71
|
-
this._processedTabs = [];
|
|
72
71
|
if (this.tabs) {
|
|
73
|
-
if (
|
|
72
|
+
if (Array.isArray(this.tabs)) {
|
|
73
|
+
this._processedTabs = [...this.tabs];
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this._processedTabs = [];
|
|
74
77
|
this.tabs.split(",").forEach((label) => {
|
|
75
78
|
label = label.trim();
|
|
76
79
|
this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
|
|
@@ -86,17 +86,11 @@ ul.first-level {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
.tree-item:hover {
|
|
89
|
-
/*private*/
|
|
90
|
-
cursor: pointer;
|
|
91
|
-
|
|
92
89
|
/*public*/
|
|
93
90
|
background-color: var(--ez-tree__tree-item--hover--background-color);
|
|
94
91
|
}
|
|
95
92
|
|
|
96
93
|
.tree-item[disabled], .tree-item[disabled]:hover {
|
|
97
|
-
/*private*/
|
|
98
|
-
cursor: unset;
|
|
99
|
-
|
|
100
94
|
/*public*/
|
|
101
95
|
background-color: var(--ez-tree__tree-item--disabled--background-color);
|
|
102
96
|
}
|
|
@@ -118,12 +112,20 @@ ul.first-level {
|
|
|
118
112
|
--ez-icon--color: var(--ez-tree--color);
|
|
119
113
|
}
|
|
120
114
|
|
|
115
|
+
.item-icon:hover {
|
|
116
|
+
/*private*/
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
}
|
|
119
|
+
|
|
121
120
|
.tree-item[selected] .item-icon {
|
|
122
121
|
/*public*/
|
|
123
122
|
--ez-icon--color: var(--ez-tree--selected--color);
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
.tree-item[disabled] .item-icon {
|
|
126
|
+
/*private*/
|
|
127
|
+
cursor: unset;
|
|
128
|
+
|
|
127
129
|
/*public*/
|
|
128
130
|
--ez-icon--color: var(--ez-tree--disabled--color);
|
|
129
131
|
}
|