@sankhyalabs/ezui 2.14.0-develop.1 → 2.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ez-filter-input_3.cjs.entry.js +14 -3
- package/dist/cjs/ez-form-view.cjs.entry.js +140 -0
- package/dist/cjs/ez-form.cjs.entry.js +184 -325
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/ez-form/{structure/FormMetadata.js → FormMetadata.js} +38 -53
- package/dist/collection/components/ez-form/ez-form.css +1 -1
- package/dist/collection/components/ez-form/ez-form.js +16 -20
- 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-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-tree/ez-tree.js +3 -3
- package/dist/collection/components/ez-tree/types/Tree.js +11 -0
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +334 -329
- package/dist/esm/ez-filter-input_3.entry.js +14 -3
- package/dist/esm/ez-form-view.entry.js +136 -0
- package/dist/esm/ez-form.entry.js +186 -327
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-97d2d2f6.entry.js +1 -0
- package/dist/ezui/p-a47b3526.entry.js +1 -0
- package/dist/ezui/p-ba03ac61.entry.js +1 -0
- package/dist/types/components/ez-form/DataBinder.d.ts +1 -1
- package/dist/types/components/ez-form/{structure/FormMetadata.d.ts → FormMetadata.d.ts} +2 -5
- package/dist/types/components/ez-form/ez-form.d.ts +4 -3
- 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 +2 -2
- 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/types/Tree.d.ts +1 -0
- package/dist/types/components.d.ts +26 -3
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -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-6500a260.entry.js +0 -1
- package/dist/ezui/p-6c45dc64.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/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
|
@@ -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 { FloatingManager, ElementIDUtils, StringUtils as StringUtils$1, DateUtils as DateUtils$1, TimeFormatter, ObjectUtils as ObjectUtils$1,
|
|
3
|
+
import { FloatingManager, ElementIDUtils, StringUtils as StringUtils$1, DateUtils as DateUtils$1, TimeFormatter, ObjectUtils as ObjectUtils$1, Action, WaitingChangeException, ApplicationContext, UserInterface, DataUnitAction, DataUnit, NumberUtils as NumberUtils$1, DataType, SortMode, JSUtils, MaskFormatter } from '@sankhyalabs/core';
|
|
4
4
|
|
|
5
5
|
var DialogType;
|
|
6
6
|
(function (DialogType) {
|
|
@@ -2714,284 +2714,6 @@ let EzFilterInput$1 = class extends HTMLElement$1 {
|
|
|
2714
2714
|
static get style() { return ezFilterInputCss; }
|
|
2715
2715
|
};
|
|
2716
2716
|
|
|
2717
|
-
class FormMetadata {
|
|
2718
|
-
constructor() {
|
|
2719
|
-
this._sheets = new Map();
|
|
2720
|
-
this._requiredFields = [];
|
|
2721
|
-
this._cleanOnCopyFields = [];
|
|
2722
|
-
this._defaultValues = {};
|
|
2723
|
-
}
|
|
2724
|
-
getSheet(name) {
|
|
2725
|
-
return this._sheets.get(name);
|
|
2726
|
-
}
|
|
2727
|
-
getAllSheets() {
|
|
2728
|
-
return this._sheets;
|
|
2729
|
-
}
|
|
2730
|
-
addSheet(sheet) {
|
|
2731
|
-
this._sheets.set(sheet.name, sheet);
|
|
2732
|
-
this._requiredFields = this._requiredFields.concat(sheet.requiredFields);
|
|
2733
|
-
this._cleanOnCopyFields = this._cleanOnCopyFields.concat(sheet.cleanOnCopyFields);
|
|
2734
|
-
this._defaultValues = sheet.defaultValues;
|
|
2735
|
-
}
|
|
2736
|
-
getRequiredFields() {
|
|
2737
|
-
return this._requiredFields;
|
|
2738
|
-
}
|
|
2739
|
-
getCleanOnCopyFields() {
|
|
2740
|
-
return this._cleanOnCopyFields;
|
|
2741
|
-
}
|
|
2742
|
-
getDefaultValues() {
|
|
2743
|
-
return this._defaultValues;
|
|
2744
|
-
}
|
|
2745
|
-
}
|
|
2746
|
-
const isRequiredField = (descriptor, config) => {
|
|
2747
|
-
if (descriptor.required) {
|
|
2748
|
-
//Se for required pelo descritor não olha pra configuração.
|
|
2749
|
-
return true;
|
|
2750
|
-
}
|
|
2751
|
-
return config === null || config === void 0 ? void 0 : config.required;
|
|
2752
|
-
};
|
|
2753
|
-
const isReadOnlyField = (descriptor, config) => {
|
|
2754
|
-
if (descriptor.readOnly) {
|
|
2755
|
-
//Se for readOnly pelo descritor não olha pra configuração.
|
|
2756
|
-
return true;
|
|
2757
|
-
}
|
|
2758
|
-
return config === null || config === void 0 ? void 0 : config.readOnly;
|
|
2759
|
-
};
|
|
2760
|
-
const buildFromDataUnit = (dataUnit) => {
|
|
2761
|
-
var _a, _b;
|
|
2762
|
-
const unitMD = dataUnit.metadata;
|
|
2763
|
-
const metadata = new FormMetadata();
|
|
2764
|
-
if (unitMD) {
|
|
2765
|
-
const visibleFields = (_a = unitMD.fields) === null || _a === void 0 ? void 0 : _a.filter(descriptor => descriptor.visible !== false);
|
|
2766
|
-
const items = new Map();
|
|
2767
|
-
(_b = unitMD === null || unitMD === void 0 ? void 0 : unitMD.fields) === null || _b === void 0 ? void 0 : _b.forEach((descriptor) => {
|
|
2768
|
-
if (descriptor.visible !== false) {
|
|
2769
|
-
resolveFieldGroup(items, null, descriptor);
|
|
2770
|
-
}
|
|
2771
|
-
});
|
|
2772
|
-
let defaultValues = {};
|
|
2773
|
-
visibleFields
|
|
2774
|
-
.filter(descriptor => descriptor.defaultValue)
|
|
2775
|
-
.forEach((descriptor) => defaultValues[descriptor.name] = descriptor.defaultValue);
|
|
2776
|
-
metadata.addSheet({
|
|
2777
|
-
label: unitMD.label,
|
|
2778
|
-
name: unitMD.name,
|
|
2779
|
-
items: Array.from(items.values()),
|
|
2780
|
-
requiredFields: visibleFields
|
|
2781
|
-
.filter(descriptor => descriptor.required)
|
|
2782
|
-
.map(descriptor => descriptor.name),
|
|
2783
|
-
cleanOnCopyFields: visibleFields
|
|
2784
|
-
.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); })
|
|
2785
|
-
.map(descriptor => descriptor.name),
|
|
2786
|
-
defaultValues
|
|
2787
|
-
});
|
|
2788
|
-
}
|
|
2789
|
-
return metadata;
|
|
2790
|
-
};
|
|
2791
|
-
function getTabConfig(tab, sheets) {
|
|
2792
|
-
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
2793
|
-
return tabConfig || { label: tab, visible: true };
|
|
2794
|
-
}
|
|
2795
|
-
function sortTabs(a, b) {
|
|
2796
|
-
return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
2797
|
-
}
|
|
2798
|
-
function resolveFieldGroup(items, field, descriptor) {
|
|
2799
|
-
const fieldMD = { config: field, descriptor: descriptor };
|
|
2800
|
-
let group = (field === null || field === void 0 ? void 0 : field.group) || descriptor.group;
|
|
2801
|
-
if (group) {
|
|
2802
|
-
const key = `group::${group}`;
|
|
2803
|
-
if (!items.has(key)) {
|
|
2804
|
-
items.set(key, { label: group, items: [fieldMD] });
|
|
2805
|
-
}
|
|
2806
|
-
else {
|
|
2807
|
-
items.get(key).items.push(fieldMD);
|
|
2808
|
-
}
|
|
2809
|
-
}
|
|
2810
|
-
else {
|
|
2811
|
-
items.set((field === null || field === void 0 ? void 0 : field.name) || descriptor.name, fieldMD);
|
|
2812
|
-
}
|
|
2813
|
-
}
|
|
2814
|
-
const buildFromConfig = (config, dataUnit) => {
|
|
2815
|
-
var _a, _b;
|
|
2816
|
-
const sheets = new Map();
|
|
2817
|
-
const hiddenTabs = new Map();
|
|
2818
|
-
const requiredFields = [];
|
|
2819
|
-
const cleanOnCopyFields = [];
|
|
2820
|
-
const defaultValues = {};
|
|
2821
|
-
(_a = config === null || config === void 0 ? void 0 : config.tabs) === null || _a === void 0 ? void 0 : _a.forEach((tab) => {
|
|
2822
|
-
if (!hiddenTabs.has(tab.label) && tab.visible === false) {
|
|
2823
|
-
hiddenTabs.set(tab.label, tab);
|
|
2824
|
-
}
|
|
2825
|
-
});
|
|
2826
|
-
(_b = config === null || config === void 0 ? void 0 : config.fields) === null || _b === void 0 ? void 0 : _b.forEach((field) => {
|
|
2827
|
-
var _a, _b, _c, _d;
|
|
2828
|
-
if (field.visible !== false) {
|
|
2829
|
-
const tabConfig = getTabConfig(field.tab || "__main", sheets);
|
|
2830
|
-
if (hiddenTabs.has(tabConfig.label)) {
|
|
2831
|
-
return;
|
|
2832
|
-
}
|
|
2833
|
-
const descriptor = dataUnit.getField(field.name);
|
|
2834
|
-
if (descriptor && tabConfig.visible) {
|
|
2835
|
-
if (!sheets.has(tabConfig)) {
|
|
2836
|
-
sheets.set(tabConfig, new Map());
|
|
2837
|
-
}
|
|
2838
|
-
const tabItens = sheets.get(tabConfig);
|
|
2839
|
-
if (isRequiredField(descriptor, field)) {
|
|
2840
|
-
requiredFields.push(field.name);
|
|
2841
|
-
}
|
|
2842
|
-
const cleanOnCopy = field.cleanOnCopy == undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : field.cleanOnCopy;
|
|
2843
|
-
if (cleanOnCopy || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum) || ((_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.cleanOnCopy)) {
|
|
2844
|
-
cleanOnCopyFields.push(field.name);
|
|
2845
|
-
}
|
|
2846
|
-
const defaultValue = field.defaultValue == undefined ? (_d = descriptor.properties) === null || _d === void 0 ? void 0 : _d.defaultValue : field.defaultValue;
|
|
2847
|
-
if (defaultValue) {
|
|
2848
|
-
defaultValues[field.name] = field.defaultValue;
|
|
2849
|
-
}
|
|
2850
|
-
resolveFieldGroup(tabItens, field, descriptor);
|
|
2851
|
-
}
|
|
2852
|
-
}
|
|
2853
|
-
});
|
|
2854
|
-
const metadata = new FormMetadata();
|
|
2855
|
-
Array.from(sheets.entries())
|
|
2856
|
-
.sort(sortTabs)
|
|
2857
|
-
.forEach(([key, value]) => {
|
|
2858
|
-
metadata.addSheet({
|
|
2859
|
-
label: (key.label === "__main") ? "Principal" : key.label,
|
|
2860
|
-
name: key.label,
|
|
2861
|
-
items: Array.from(value.values()),
|
|
2862
|
-
requiredFields,
|
|
2863
|
-
cleanOnCopyFields,
|
|
2864
|
-
defaultValues
|
|
2865
|
-
});
|
|
2866
|
-
});
|
|
2867
|
-
return metadata;
|
|
2868
|
-
};
|
|
2869
|
-
|
|
2870
|
-
const buildTextArea = ({ name, label, readOnly }) => {
|
|
2871
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small", key: name },
|
|
2872
|
-
h("ez-text-area", { enabled: !readOnly, label: label, "data-field-name": name })));
|
|
2873
|
-
};
|
|
2874
|
-
|
|
2875
|
-
const buildTextInput = ({ name, label, readOnly }) => {
|
|
2876
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
2877
|
-
h("ez-text-input", { label: label, "data-field-name": name, key: name, enabled: !readOnly })));
|
|
2878
|
-
};
|
|
2879
|
-
|
|
2880
|
-
const buildSwitch = (fieldConfig) => {
|
|
2881
|
-
return buildField$1(fieldConfig.name, fieldConfig.label, fieldConfig.readOnly, true);
|
|
2882
|
-
};
|
|
2883
|
-
const buildCheckBox = (fieldConfig) => {
|
|
2884
|
-
return buildField$1(fieldConfig.name, fieldConfig.label, fieldConfig.readOnly, false);
|
|
2885
|
-
};
|
|
2886
|
-
function buildField$1(fieldName, fieldLabel, readOnly, switchMode = false) {
|
|
2887
|
-
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" },
|
|
2888
|
-
h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? CheckMode.SWITCH : CheckMode.REGULAR, "data-field-name": fieldName, key: fieldName })));
|
|
2889
|
-
}
|
|
2890
|
-
|
|
2891
|
-
const buildComboBox = ({ name, label, readOnly, required }, properties) => {
|
|
2892
|
-
const prop = properties === null || properties === void 0 ? void 0 : properties.options;
|
|
2893
|
-
let options;
|
|
2894
|
-
if (typeof prop === "string") {
|
|
2895
|
-
const parsed = JSON.parse(prop);
|
|
2896
|
-
options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
|
|
2897
|
-
}
|
|
2898
|
-
else {
|
|
2899
|
-
options = prop;
|
|
2900
|
-
}
|
|
2901
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
2902
|
-
h("ez-combo-box", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, key: name, options: options })));
|
|
2903
|
-
};
|
|
2904
|
-
|
|
2905
|
-
const buildSearch = ({ name, label, readOnly, required }) => {
|
|
2906
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
2907
|
-
h("ez-search", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, key: name })));
|
|
2908
|
-
};
|
|
2909
|
-
|
|
2910
|
-
const buildFile = ({ name, label, readOnly }) => {
|
|
2911
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
2912
|
-
h("ez-upload", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
2913
|
-
};
|
|
2914
|
-
|
|
2915
|
-
const buildDate = ({ name, label, readOnly }) => {
|
|
2916
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
2917
|
-
h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
2918
|
-
};
|
|
2919
|
-
const buildTime = ({ name, label, readOnly }) => {
|
|
2920
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
2921
|
-
h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
2922
|
-
};
|
|
2923
|
-
const buildTimeDate = ({ name, label, readOnly }) => {
|
|
2924
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
2925
|
-
h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
2926
|
-
};
|
|
2927
|
-
|
|
2928
|
-
const buildDecimal = ({ name, label, readOnly }, properties) => {
|
|
2929
|
-
const precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
|
|
2930
|
-
const prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
|
|
2931
|
-
return buildNumeric(name, label, readOnly, precision, prettyPrecision);
|
|
2932
|
-
};
|
|
2933
|
-
const buildInteger = ({ name, label, readOnly }) => {
|
|
2934
|
-
return buildNumeric(name, label, readOnly, 0, 0);
|
|
2935
|
-
};
|
|
2936
|
-
function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecision) {
|
|
2937
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
2938
|
-
h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, key: fieldName })));
|
|
2939
|
-
}
|
|
2940
|
-
|
|
2941
|
-
const uiBuilders = new Map();
|
|
2942
|
-
uiBuilders.set(UserInterface.LONGTEXT, buildTextArea);
|
|
2943
|
-
uiBuilders.set(UserInterface.CHECKBOX, buildCheckBox);
|
|
2944
|
-
uiBuilders.set(UserInterface.SWITCH, buildSwitch);
|
|
2945
|
-
uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
|
|
2946
|
-
uiBuilders.set(UserInterface.SEARCH, buildSearch);
|
|
2947
|
-
uiBuilders.set(UserInterface.FILE, buildFile);
|
|
2948
|
-
uiBuilders.set(UserInterface.DATE, buildDate);
|
|
2949
|
-
uiBuilders.set(UserInterface.TIME, buildTime);
|
|
2950
|
-
uiBuilders.set(UserInterface.DATETIME, buildTimeDate);
|
|
2951
|
-
uiBuilders.set(UserInterface.DECIMALNUMBER, buildDecimal);
|
|
2952
|
-
uiBuilders.set(UserInterface.INTEGERNUMBER, buildInteger);
|
|
2953
|
-
const buildField = (field) => {
|
|
2954
|
-
const descriptor = field.descriptor;
|
|
2955
|
-
const config = Object.assign({}, field.config);
|
|
2956
|
-
let builder;
|
|
2957
|
-
let props;
|
|
2958
|
-
if (descriptor) {
|
|
2959
|
-
if (!config.label) {
|
|
2960
|
-
config.label = descriptor.label;
|
|
2961
|
-
}
|
|
2962
|
-
if (!config.name) {
|
|
2963
|
-
config.name = descriptor.name;
|
|
2964
|
-
}
|
|
2965
|
-
// Forçamos uma avaliação priorizando o descriptor.
|
|
2966
|
-
config.required = isRequiredField(descriptor, config);
|
|
2967
|
-
config.readOnly = isReadOnlyField(descriptor, config);
|
|
2968
|
-
props = descriptor.properties;
|
|
2969
|
-
builder = uiBuilders.get(descriptor.userInterface);
|
|
2970
|
-
}
|
|
2971
|
-
if (config.required) {
|
|
2972
|
-
config.label = `${config.label} (obrigatório) *`;
|
|
2973
|
-
}
|
|
2974
|
-
if (!builder) {
|
|
2975
|
-
builder = buildTextInput;
|
|
2976
|
-
}
|
|
2977
|
-
return builder(config, props);
|
|
2978
|
-
};
|
|
2979
|
-
|
|
2980
|
-
const FormItem = ({ source }) => {
|
|
2981
|
-
if ("items" in source) {
|
|
2982
|
-
const fieldSet = source;
|
|
2983
|
-
return h("ez-collapsible-box", { label: source.label, "header-size": "large", key: source.label }, fieldSet.items.map(fi => buildField(fi)));
|
|
2984
|
-
}
|
|
2985
|
-
else {
|
|
2986
|
-
return buildField(source);
|
|
2987
|
-
}
|
|
2988
|
-
};
|
|
2989
|
-
|
|
2990
|
-
const FormSheet = ({ store, source, dataElementId }) => {
|
|
2991
|
-
return (h("div", { class: "dynamic-content ez-box__container", "data-element-id": dataElementId },
|
|
2992
|
-
h("div", { class: "ez-row ez-padding-vertical--small" }, source.items.map(item => h(FormItem, { store: store, source: item })))));
|
|
2993
|
-
};
|
|
2994
|
-
|
|
2995
2717
|
/**
|
|
2996
2718
|
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
|
|
2997
2719
|
*
|
|
@@ -3315,49 +3037,6 @@ function createStore(reducer, preloadedState, enhancer) {
|
|
|
3315
3037
|
}, _ref2[$$observable] = observable, _ref2;
|
|
3316
3038
|
}
|
|
3317
3039
|
|
|
3318
|
-
const inicialState = {};
|
|
3319
|
-
/////////////////////////////// REDUCERS ///////////////////////////////
|
|
3320
|
-
function formReducer(state = inicialState, action) {
|
|
3321
|
-
switch (action.type) {
|
|
3322
|
-
case FormActions.METADATA_LOADED:
|
|
3323
|
-
return Object.assign(Object.assign({}, state), { formMetadata: action.payload, currentSheet: undefined });
|
|
3324
|
-
case FormActions.CHANGE_TAB:
|
|
3325
|
-
return Object.assign(Object.assign({}, state), { currentSheet: action.payload });
|
|
3326
|
-
default:
|
|
3327
|
-
return state;
|
|
3328
|
-
}
|
|
3329
|
-
}
|
|
3330
|
-
/////////////////////////////// ACTION CREATORS ///////////////////////////////
|
|
3331
|
-
function loadMetadata(formMetadata) {
|
|
3332
|
-
return {
|
|
3333
|
-
type: FormActions.METADATA_LOADED,
|
|
3334
|
-
payload: formMetadata
|
|
3335
|
-
};
|
|
3336
|
-
}
|
|
3337
|
-
function changeTab(currentSheet) {
|
|
3338
|
-
return {
|
|
3339
|
-
type: FormActions.CHANGE_TAB,
|
|
3340
|
-
payload: typeof currentSheet === "string" ? currentSheet : currentSheet.tabKey
|
|
3341
|
-
};
|
|
3342
|
-
}
|
|
3343
|
-
/////////////////////////////// SELECTORS ///////////////////////////////
|
|
3344
|
-
function selectFormMetadata(state) {
|
|
3345
|
-
return state.formMetadata;
|
|
3346
|
-
}
|
|
3347
|
-
function selectCurrentSheetId(state) {
|
|
3348
|
-
return state.currentSheet;
|
|
3349
|
-
}
|
|
3350
|
-
function selectCurrentSheet(state) {
|
|
3351
|
-
const currentSheetId = selectCurrentSheetId(state);
|
|
3352
|
-
return currentSheetId ? state.formMetadata.getSheet(currentSheetId) : Array.from(state.formMetadata.getAllSheets().values())[0];
|
|
3353
|
-
}
|
|
3354
|
-
/////////////////////////////// TYPES ///////////////////////////////
|
|
3355
|
-
var FormActions;
|
|
3356
|
-
(function (FormActions) {
|
|
3357
|
-
FormActions["METADATA_LOADED"] = "FORM/METADATA_LOADED";
|
|
3358
|
-
FormActions["CHANGE_TAB"] = "FORM/CHANGE_TAB";
|
|
3359
|
-
})(FormActions || (FormActions = {}));
|
|
3360
|
-
|
|
3361
3040
|
class DataBinder {
|
|
3362
3041
|
constructor(dataUnit) {
|
|
3363
3042
|
this._invalidFields = new Map();
|
|
@@ -3564,7 +3243,187 @@ class Bind {
|
|
|
3564
3243
|
}
|
|
3565
3244
|
}
|
|
3566
3245
|
|
|
3567
|
-
const
|
|
3246
|
+
const inicialState = {};
|
|
3247
|
+
/////////////////////////////// REDUCERS ///////////////////////////////
|
|
3248
|
+
function formReducer(state = inicialState, action) {
|
|
3249
|
+
switch (action.type) {
|
|
3250
|
+
case FormActions.METADATA_LOADED:
|
|
3251
|
+
return Object.assign(Object.assign({}, state), { formMetadata: action.payload, currentSheet: undefined });
|
|
3252
|
+
case FormActions.CHANGE_TAB:
|
|
3253
|
+
return Object.assign(Object.assign({}, state), { currentSheet: action.payload });
|
|
3254
|
+
default:
|
|
3255
|
+
return state;
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
/////////////////////////////// ACTION CREATORS ///////////////////////////////
|
|
3259
|
+
function loadMetadata(formMetadata) {
|
|
3260
|
+
return {
|
|
3261
|
+
type: FormActions.METADATA_LOADED,
|
|
3262
|
+
payload: formMetadata
|
|
3263
|
+
};
|
|
3264
|
+
}
|
|
3265
|
+
function changeTab(currentSheet) {
|
|
3266
|
+
return {
|
|
3267
|
+
type: FormActions.CHANGE_TAB,
|
|
3268
|
+
payload: typeof currentSheet === "string" ? currentSheet : currentSheet.tabKey
|
|
3269
|
+
};
|
|
3270
|
+
}
|
|
3271
|
+
/////////////////////////////// SELECTORS ///////////////////////////////
|
|
3272
|
+
function selectFormMetadata(state) {
|
|
3273
|
+
return state.formMetadata;
|
|
3274
|
+
}
|
|
3275
|
+
function selectCurrentSheetId(state) {
|
|
3276
|
+
return state.currentSheet;
|
|
3277
|
+
}
|
|
3278
|
+
function selectCurrentSheet(state) {
|
|
3279
|
+
const currentSheetId = selectCurrentSheetId(state);
|
|
3280
|
+
return currentSheetId ? state.formMetadata.getSheet(currentSheetId) : Array.from(state.formMetadata.getAllSheets().values())[0];
|
|
3281
|
+
}
|
|
3282
|
+
/////////////////////////////// TYPES ///////////////////////////////
|
|
3283
|
+
var FormActions;
|
|
3284
|
+
(function (FormActions) {
|
|
3285
|
+
FormActions["METADATA_LOADED"] = "FORM/METADATA_LOADED";
|
|
3286
|
+
FormActions["CHANGE_TAB"] = "FORM/CHANGE_TAB";
|
|
3287
|
+
})(FormActions || (FormActions = {}));
|
|
3288
|
+
|
|
3289
|
+
class FormMetadata {
|
|
3290
|
+
constructor() {
|
|
3291
|
+
this._sheets = new Map();
|
|
3292
|
+
this._requiredFields = [];
|
|
3293
|
+
this._cleanOnCopyFields = [];
|
|
3294
|
+
this._defaultValues = {};
|
|
3295
|
+
}
|
|
3296
|
+
getSheet(name) {
|
|
3297
|
+
return this._sheets.get(name);
|
|
3298
|
+
}
|
|
3299
|
+
getAllSheets() {
|
|
3300
|
+
return this._sheets;
|
|
3301
|
+
}
|
|
3302
|
+
addSheet(sheet) {
|
|
3303
|
+
this._sheets.set(sheet.name, sheet);
|
|
3304
|
+
this._requiredFields = this._requiredFields.concat(sheet.requiredFields);
|
|
3305
|
+
this._cleanOnCopyFields = this._cleanOnCopyFields.concat(sheet.cleanOnCopyFields);
|
|
3306
|
+
this._defaultValues = sheet.defaultValues;
|
|
3307
|
+
}
|
|
3308
|
+
getRequiredFields() {
|
|
3309
|
+
return this._requiredFields;
|
|
3310
|
+
}
|
|
3311
|
+
getCleanOnCopyFields() {
|
|
3312
|
+
return this._cleanOnCopyFields;
|
|
3313
|
+
}
|
|
3314
|
+
getDefaultValues() {
|
|
3315
|
+
return this._defaultValues;
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
const buildFromDataUnit = (dataUnit) => {
|
|
3319
|
+
const unitMD = dataUnit.metadata;
|
|
3320
|
+
const metadata = new FormMetadata();
|
|
3321
|
+
if (unitMD) {
|
|
3322
|
+
const visibleFields = (unitMD.fields || []).filter(descriptor => descriptor.visible !== false);
|
|
3323
|
+
const fields = visibleFields.map(descriptor => buildFormField(descriptor));
|
|
3324
|
+
let defaultValues = {};
|
|
3325
|
+
visibleFields
|
|
3326
|
+
.filter(descriptor => descriptor.defaultValue)
|
|
3327
|
+
.forEach((descriptor) => defaultValues[descriptor.name] = descriptor.defaultValue);
|
|
3328
|
+
metadata.addSheet({
|
|
3329
|
+
name: unitMD.name,
|
|
3330
|
+
label: unitMD.label,
|
|
3331
|
+
fields,
|
|
3332
|
+
requiredFields: visibleFields
|
|
3333
|
+
.filter(descriptor => descriptor.required)
|
|
3334
|
+
.map(descriptor => descriptor.name),
|
|
3335
|
+
cleanOnCopyFields: visibleFields
|
|
3336
|
+
.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); })
|
|
3337
|
+
.map(descriptor => descriptor.name),
|
|
3338
|
+
defaultValues
|
|
3339
|
+
});
|
|
3340
|
+
}
|
|
3341
|
+
return metadata;
|
|
3342
|
+
};
|
|
3343
|
+
const buildFromConfig = (config, dataUnit) => {
|
|
3344
|
+
var _a, _b;
|
|
3345
|
+
const sheets = new Map();
|
|
3346
|
+
const hiddenTabs = new Map();
|
|
3347
|
+
const requiredFields = [];
|
|
3348
|
+
const cleanOnCopyFields = [];
|
|
3349
|
+
const defaultValues = {};
|
|
3350
|
+
(_a = config === null || config === void 0 ? void 0 : config.tabs) === null || _a === void 0 ? void 0 : _a.forEach((tab) => {
|
|
3351
|
+
if (!hiddenTabs.has(tab.label) && tab.visible === false) {
|
|
3352
|
+
hiddenTabs.set(tab.label, tab);
|
|
3353
|
+
}
|
|
3354
|
+
});
|
|
3355
|
+
(_b = config === null || config === void 0 ? void 0 : config.fields) === null || _b === void 0 ? void 0 : _b.forEach((field) => {
|
|
3356
|
+
var _a, _b, _c, _d;
|
|
3357
|
+
if (field.visible !== false) {
|
|
3358
|
+
const tabConfig = getTabConfig(field.tab || "__main", sheets);
|
|
3359
|
+
if (hiddenTabs.has(tabConfig.label)) {
|
|
3360
|
+
return;
|
|
3361
|
+
}
|
|
3362
|
+
const descriptor = dataUnit.getField(field.name);
|
|
3363
|
+
if (descriptor && tabConfig.visible) {
|
|
3364
|
+
if (!sheets.has(tabConfig)) {
|
|
3365
|
+
sheets.set(tabConfig, []);
|
|
3366
|
+
}
|
|
3367
|
+
const formField = buildFormField(descriptor, field);
|
|
3368
|
+
sheets.get(tabConfig).push(formField);
|
|
3369
|
+
if (formField.required) {
|
|
3370
|
+
requiredFields.push(field.name);
|
|
3371
|
+
}
|
|
3372
|
+
const cleanOnCopy = field.cleanOnCopy == undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : field.cleanOnCopy;
|
|
3373
|
+
if (cleanOnCopy || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum) || ((_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.cleanOnCopy)) {
|
|
3374
|
+
cleanOnCopyFields.push(field.name);
|
|
3375
|
+
}
|
|
3376
|
+
const defaultValue = field.defaultValue == undefined ? (_d = descriptor.properties) === null || _d === void 0 ? void 0 : _d.defaultValue : field.defaultValue;
|
|
3377
|
+
if (defaultValue) {
|
|
3378
|
+
defaultValues[field.name] = field.defaultValue;
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
});
|
|
3383
|
+
const metadata = new FormMetadata();
|
|
3384
|
+
Array.from(sheets.entries())
|
|
3385
|
+
.sort(sortTabs)
|
|
3386
|
+
.forEach(([key, fields]) => {
|
|
3387
|
+
metadata.addSheet({
|
|
3388
|
+
label: (key.label === "__main") ? "Principal" : key.label,
|
|
3389
|
+
name: key.label,
|
|
3390
|
+
fields,
|
|
3391
|
+
requiredFields,
|
|
3392
|
+
cleanOnCopyFields,
|
|
3393
|
+
defaultValues
|
|
3394
|
+
});
|
|
3395
|
+
});
|
|
3396
|
+
return metadata;
|
|
3397
|
+
};
|
|
3398
|
+
const buildFormField = (descriptor, config) => {
|
|
3399
|
+
let { name, label, group } = Object.assign({}, config);
|
|
3400
|
+
let { readOnly, required } = Object.assign({}, config);
|
|
3401
|
+
let props;
|
|
3402
|
+
let userInterface;
|
|
3403
|
+
if (descriptor) {
|
|
3404
|
+
label = label || descriptor.label;
|
|
3405
|
+
name = name || descriptor.name;
|
|
3406
|
+
required = descriptor.required || (config === null || config === void 0 ? void 0 : config.required);
|
|
3407
|
+
readOnly = descriptor.readOnly || (config === null || config === void 0 ? void 0 : config.readOnly);
|
|
3408
|
+
props = descriptor.properties;
|
|
3409
|
+
userInterface = descriptor.userInterface;
|
|
3410
|
+
}
|
|
3411
|
+
return {
|
|
3412
|
+
name, label, group,
|
|
3413
|
+
readOnly, required,
|
|
3414
|
+
props,
|
|
3415
|
+
userInterface: userInterface || UserInterface.SHORTTEXT
|
|
3416
|
+
};
|
|
3417
|
+
};
|
|
3418
|
+
const getTabConfig = (tab, sheets) => {
|
|
3419
|
+
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
3420
|
+
return tabConfig || { label: tab, visible: true };
|
|
3421
|
+
};
|
|
3422
|
+
const sortTabs = (a, b) => {
|
|
3423
|
+
return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
3424
|
+
};
|
|
3425
|
+
|
|
3426
|
+
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%}";
|
|
3568
3427
|
|
|
3569
3428
|
let EzForm$1 = class extends HTMLElement$1 {
|
|
3570
3429
|
constructor() {
|
|
@@ -3693,8 +3552,9 @@ let EzForm$1 = class extends HTMLElement$1 {
|
|
|
3693
3552
|
return result;
|
|
3694
3553
|
}
|
|
3695
3554
|
buildFormContent(sheetId, currentSheet) {
|
|
3555
|
+
const fields = currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.fields;
|
|
3696
3556
|
if (this.contentBuilder != undefined) {
|
|
3697
|
-
const customContent = this.contentBuilder(sheetId,
|
|
3557
|
+
const customContent = this.contentBuilder(sheetId, fields);
|
|
3698
3558
|
if (customContent != undefined) {
|
|
3699
3559
|
return h("div", { "innerHTML": customContent });
|
|
3700
3560
|
}
|
|
@@ -3703,7 +3563,7 @@ let EzForm$1 = class extends HTMLElement$1 {
|
|
|
3703
3563
|
return;
|
|
3704
3564
|
}
|
|
3705
3565
|
const idFormSheet = `${StringUtils$1.replaceAccentuatedChars(StringUtils$1.toCamelCase(currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.label), false)}_selectorContainer`;
|
|
3706
|
-
return h(
|
|
3566
|
+
return (h("div", { class: "dynamic-content ez-box__container", "data-element-id": idFormSheet }, h("ez-form-view", { class: "ez-row ez-padding-vertical--small", fields: fields })));
|
|
3707
3567
|
}
|
|
3708
3568
|
processMetadata() {
|
|
3709
3569
|
if (!this.isStatic() && this.dataUnit && this._store) {
|
|
@@ -3801,6 +3661,138 @@ let EzForm$1 = class extends HTMLElement$1 {
|
|
|
3801
3661
|
static get style() { return ezFormCss; }
|
|
3802
3662
|
};
|
|
3803
3663
|
|
|
3664
|
+
const buildSwitch = (field) => {
|
|
3665
|
+
return buildField(field.name, field.label, field.readOnly, true);
|
|
3666
|
+
};
|
|
3667
|
+
const buildCheckBox = (field) => {
|
|
3668
|
+
return buildField(field.name, field.label, field.readOnly, false);
|
|
3669
|
+
};
|
|
3670
|
+
function buildField(fieldName, fieldLabel, readOnly, switchMode = false) {
|
|
3671
|
+
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" },
|
|
3672
|
+
h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? CheckMode.SWITCH : CheckMode.REGULAR, "data-field-name": fieldName, key: fieldName })));
|
|
3673
|
+
}
|
|
3674
|
+
|
|
3675
|
+
const buildComboBox = ({ name, label, readOnly, required, props }) => {
|
|
3676
|
+
const prop = props === null || props === void 0 ? void 0 : props.options;
|
|
3677
|
+
let options;
|
|
3678
|
+
if (typeof prop === "string") {
|
|
3679
|
+
const parsed = JSON.parse(prop);
|
|
3680
|
+
options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
|
|
3681
|
+
}
|
|
3682
|
+
else {
|
|
3683
|
+
options = prop;
|
|
3684
|
+
}
|
|
3685
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
3686
|
+
h("ez-combo-box", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, key: name, options: options })));
|
|
3687
|
+
};
|
|
3688
|
+
|
|
3689
|
+
const buildDate = ({ name, label, readOnly }) => {
|
|
3690
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
3691
|
+
h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
3692
|
+
};
|
|
3693
|
+
const buildTime = ({ name, label, readOnly }) => {
|
|
3694
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
3695
|
+
h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
3696
|
+
};
|
|
3697
|
+
const buildDateTime = ({ name, label, readOnly }) => {
|
|
3698
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
3699
|
+
h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
3700
|
+
};
|
|
3701
|
+
|
|
3702
|
+
const buildFile = ({ name, label, readOnly }) => {
|
|
3703
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
3704
|
+
h("ez-upload", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
3705
|
+
};
|
|
3706
|
+
|
|
3707
|
+
const buildDecimal = ({ name, label, readOnly, props }) => {
|
|
3708
|
+
const precision = Number((props === null || props === void 0 ? void 0 : props.precision) || 2);
|
|
3709
|
+
const prettyPrecision = Number((props === null || props === void 0 ? void 0 : props.prettyPrecision) || precision);
|
|
3710
|
+
return buildNumeric(name, label, readOnly, precision, prettyPrecision);
|
|
3711
|
+
};
|
|
3712
|
+
const buildInteger = ({ name, label, readOnly }) => {
|
|
3713
|
+
return buildNumeric(name, label, readOnly, 0, 0);
|
|
3714
|
+
};
|
|
3715
|
+
function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecision) {
|
|
3716
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
3717
|
+
h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, key: fieldName })));
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3720
|
+
const buildSearch = ({ name, label, readOnly, required }) => {
|
|
3721
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
3722
|
+
h("ez-search", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, key: name })));
|
|
3723
|
+
};
|
|
3724
|
+
|
|
3725
|
+
const buildTextArea = ({ name, label, readOnly }) => {
|
|
3726
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small", key: name },
|
|
3727
|
+
h("ez-text-area", { enabled: !readOnly, label: label, "data-field-name": name })));
|
|
3728
|
+
};
|
|
3729
|
+
|
|
3730
|
+
const buildTextInput = ({ name, label, readOnly }) => {
|
|
3731
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
|
|
3732
|
+
h("ez-text-input", { label: label, "data-field-name": name, key: name, enabled: !readOnly })));
|
|
3733
|
+
};
|
|
3734
|
+
|
|
3735
|
+
const uiBuilders = new Map();
|
|
3736
|
+
uiBuilders.set(UserInterface.CHECKBOX, buildCheckBox);
|
|
3737
|
+
uiBuilders.set(UserInterface.SWITCH, buildSwitch);
|
|
3738
|
+
uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
|
|
3739
|
+
uiBuilders.set(UserInterface.DATE, buildDate);
|
|
3740
|
+
uiBuilders.set(UserInterface.TIME, buildTime);
|
|
3741
|
+
uiBuilders.set(UserInterface.DATETIME, buildDateTime);
|
|
3742
|
+
uiBuilders.set(UserInterface.FILE, buildFile);
|
|
3743
|
+
uiBuilders.set(UserInterface.DECIMALNUMBER, buildDecimal);
|
|
3744
|
+
uiBuilders.set(UserInterface.INTEGERNUMBER, buildInteger);
|
|
3745
|
+
uiBuilders.set(UserInterface.SEARCH, buildSearch);
|
|
3746
|
+
uiBuilders.set(UserInterface.LONGTEXT, buildTextArea);
|
|
3747
|
+
const fieldBuilder = (field) => {
|
|
3748
|
+
const builder = uiBuilders.get(field.userInterface) || buildTextInput;
|
|
3749
|
+
const label = field.required ? `${field.label} (obrigatório) *` : field.label;
|
|
3750
|
+
return builder(Object.assign(Object.assign({}, field), { label }));
|
|
3751
|
+
};
|
|
3752
|
+
|
|
3753
|
+
const ezFormViewCss = ".sc-ez-form-view-h{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}";
|
|
3754
|
+
|
|
3755
|
+
let EzFormView$1 = class extends HTMLElement$1 {
|
|
3756
|
+
constructor() {
|
|
3757
|
+
super();
|
|
3758
|
+
this.__registerHost();
|
|
3759
|
+
}
|
|
3760
|
+
groupFields(fields) {
|
|
3761
|
+
const result = new Map();
|
|
3762
|
+
fields.forEach(item => {
|
|
3763
|
+
const groupLabel = item.group;
|
|
3764
|
+
if (groupLabel) {
|
|
3765
|
+
let groupFields = result.get(groupLabel);
|
|
3766
|
+
if (groupFields == undefined) {
|
|
3767
|
+
groupFields = [];
|
|
3768
|
+
result.set(groupLabel, groupFields);
|
|
3769
|
+
}
|
|
3770
|
+
groupFields.push(item);
|
|
3771
|
+
}
|
|
3772
|
+
else {
|
|
3773
|
+
result.set(item.name, item);
|
|
3774
|
+
}
|
|
3775
|
+
});
|
|
3776
|
+
return result;
|
|
3777
|
+
}
|
|
3778
|
+
render() {
|
|
3779
|
+
ElementIDUtils.addIDInfoIfNotExists(this._element, 'ezFormView');
|
|
3780
|
+
if (this.fields == undefined) {
|
|
3781
|
+
return;
|
|
3782
|
+
}
|
|
3783
|
+
return (h(Host, null, Array.from(this.groupFields(this.fields).entries()).map(([label, value]) => {
|
|
3784
|
+
if (Array.isArray(value)) {
|
|
3785
|
+
return (h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, value.map(fi => fieldBuilder(fi))));
|
|
3786
|
+
}
|
|
3787
|
+
else {
|
|
3788
|
+
return fieldBuilder(value);
|
|
3789
|
+
}
|
|
3790
|
+
})));
|
|
3791
|
+
}
|
|
3792
|
+
get _element() { return this; }
|
|
3793
|
+
static get style() { return ezFormViewCss; }
|
|
3794
|
+
};
|
|
3795
|
+
|
|
3804
3796
|
/**
|
|
3805
3797
|
* @ag-grid-community/all-modules - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue * @version v28.1.1
|
|
3806
3798
|
* @link https://www.ag-grid.com/
|
|
@@ -122164,6 +122156,17 @@ class Tree extends Node$1 {
|
|
|
122164
122156
|
}
|
|
122165
122157
|
});
|
|
122166
122158
|
}
|
|
122159
|
+
updateItem(item) {
|
|
122160
|
+
if (item == undefined) {
|
|
122161
|
+
return;
|
|
122162
|
+
}
|
|
122163
|
+
const node = this.getNode(item.id);
|
|
122164
|
+
if (node == undefined) {
|
|
122165
|
+
return;
|
|
122166
|
+
}
|
|
122167
|
+
Object.keys(item).forEach(attrib => node.item[attrib] = item[attrib]);
|
|
122168
|
+
this._changeCallback();
|
|
122169
|
+
}
|
|
122167
122170
|
async open(path) {
|
|
122168
122171
|
return new Promise(async (resolve) => {
|
|
122169
122172
|
await this.walk(this, path, node => node.item.expanded = true);
|
|
@@ -122339,7 +122342,7 @@ let EzTree$1 = class extends HTMLElement$1 {
|
|
|
122339
122342
|
if (expanded) {
|
|
122340
122343
|
this.ezOpenItem.emit(item);
|
|
122341
122344
|
}
|
|
122342
|
-
|
|
122345
|
+
this._tree.updateItem(item);
|
|
122343
122346
|
}
|
|
122344
122347
|
previousLevel() {
|
|
122345
122348
|
var _a;
|
|
@@ -122348,7 +122351,7 @@ let EzTree$1 = class extends HTMLElement$1 {
|
|
|
122348
122351
|
}
|
|
122349
122352
|
if (this.value.expanded) {
|
|
122350
122353
|
this.value.expanded = false;
|
|
122351
|
-
|
|
122354
|
+
this._tree.updateItem(this.value);
|
|
122352
122355
|
}
|
|
122353
122356
|
else {
|
|
122354
122357
|
const node = this._tree.getNode(this.value.id);
|
|
@@ -122371,7 +122374,7 @@ let EzTree$1 = class extends HTMLElement$1 {
|
|
|
122371
122374
|
}
|
|
122372
122375
|
else {
|
|
122373
122376
|
this.value.expanded = true;
|
|
122374
|
-
|
|
122377
|
+
this._tree.updateItem(this.value);
|
|
122375
122378
|
}
|
|
122376
122379
|
}
|
|
122377
122380
|
indexOf(id) {
|
|
@@ -122914,6 +122917,7 @@ const EzDropdown = /*@__PURE__*/proxyCustomElement(EzDropdown$1, [1,"ez-dropdown
|
|
|
122914
122917
|
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]}]);
|
|
122915
122918
|
const EzFilterInput = /*@__PURE__*/proxyCustomElement(EzFilterInput$1, [1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513]}]);
|
|
122916
122919
|
const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16],"multiLevel":[4,"multi-level"],"levelResolver":[16],"contentBuilder":[16]}]);
|
|
122920
|
+
const EzFormView = /*@__PURE__*/proxyCustomElement(EzFormView$1, [2,"ez-form-view",{"fields":[16]}]);
|
|
122917
122921
|
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"]]]);
|
|
122918
122922
|
const EzGuideNavigator = /*@__PURE__*/proxyCustomElement(EzGuideNavigator$1, [1,"ez-guide-navigator",{"binder":[16],"open":[1540],"items":[32],"filterText":[32]}]);
|
|
122919
122923
|
const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]);
|
|
@@ -122958,6 +122962,7 @@ const defineCustomElements = (opts) => {
|
|
|
122958
122962
|
EzFileItem,
|
|
122959
122963
|
EzFilterInput,
|
|
122960
122964
|
EzForm,
|
|
122965
|
+
EzFormView,
|
|
122961
122966
|
EzGrid,
|
|
122962
122967
|
EzGuideNavigator,
|
|
122963
122968
|
EzIcon,
|
|
@@ -122989,4 +122994,4 @@ const defineCustomElements = (opts) => {
|
|
|
122989
122994
|
}
|
|
122990
122995
|
};
|
|
122991
122996
|
|
|
122992
|
-
export { EzActionsButton, EzAlert, EzApplication, EzBreadcrumb, EzButton, EzCalendar, EzCardItem, EzCheck, EzChip, EzCollapsibleBox, EzComboBox, EzDateInput, EzDateTimeInput, EzDialog, EzDropdown, EzFileItem, EzFilterInput, EzForm, EzGrid, EzGuideNavigator, EzIcon, EzList, EzLoadingBar, EzModal, EzModalContainer, EzNumberInput, EzPopover, EzPopup, EzRadioButton, EzScroller, EzSearch, EzSidebarButton, EzTabselector, EzTextArea, EzTextEdit, EzTextInput, EzTimeInput, EzToast, EzTree, EzUpload, EzViewStack, defineCustomElements };
|
|
122997
|
+
export { EzActionsButton, EzAlert, EzApplication, EzBreadcrumb, EzButton, EzCalendar, EzCardItem, EzCheck, EzChip, EzCollapsibleBox, EzComboBox, EzDateInput, EzDateTimeInput, EzDialog, EzDropdown, EzFileItem, EzFilterInput, EzForm, EzFormView, EzGrid, EzGuideNavigator, EzIcon, EzList, EzLoadingBar, EzModal, EzModalContainer, EzNumberInput, EzPopover, EzPopup, EzRadioButton, EzScroller, EzSearch, EzSidebarButton, EzTabselector, EzTextArea, EzTextEdit, EzTextInput, EzTimeInput, EzToast, EzTree, EzUpload, EzViewStack, defineCustomElements };
|