@sankhyalabs/ezui 1.1.77 → 1.1.80
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/{AssetsUtils-dd585fba.js → AssetsUtils-02db4f46.js} +1 -1
- package/dist/cjs/CSSVarsUtils-66e86394.js +18 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -3
- package/dist/cjs/ez-button_3.cjs.entry.js +520 -0
- package/dist/cjs/ez-calendar_13.cjs.entry.js +2421 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +26 -37
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/{ez-button_11.cjs.entry.js → ez-grid.cjs.entry.js} +14 -1410
- package/dist/cjs/ez-icon.cjs.entry.js +30 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal_2.cjs.entry.js +370 -0
- package/dist/cjs/ez-popover.cjs.entry.js +2 -2
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +4 -4
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/{index-4e4bae01.js → index-2003dec4.js} +0 -10
- package/dist/cjs/{index-262d703b.js → index-a2266984.js} +18 -43
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +0 -2
- package/dist/collection/components/ez-application/ez-application.js +0 -2
- package/dist/collection/components/ez-calendar/ez-calendar.js +7 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -5
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +4 -0
- package/dist/collection/components/ez-date-input/ez-date-input.css +2 -2
- 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.css +0 -5
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +23 -34
- package/dist/collection/components/ez-form/DataBinder.js +44 -0
- package/dist/collection/components/ez-form/ez-form.css +1 -15
- package/dist/collection/components/ez-form/ez-form.js +112 -427
- package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +45 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +11 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.js +14 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.js +13 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/TextArea.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/TextInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/store/form.slice.js +38 -0
- package/dist/collection/components/ez-form/structure/FormItem.js +11 -0
- package/dist/collection/components/ez-form/structure/FormSheet.js +5 -0
- package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +86 -0
- package/dist/collection/components/ez-number-input/ez-number-input.css +0 -9
- package/dist/collection/components/ez-number-input/ez-number-input.js +20 -115
- package/dist/collection/components/ez-search/ez-search.js +6 -1
- package/dist/collection/components/test-du/test-du.js +65 -23
- package/dist/collection/utils/CSSVarsUtils.js +6 -6
- package/dist/custom-elements/index.d.ts +0 -12
- package/dist/custom-elements/index.js +530 -2278
- package/dist/esm/{AssetsUtils-3803e935.js → AssetsUtils-76ca41e1.js} +1 -1
- package/dist/esm/CSSVarsUtils-aeee9825.js +16 -0
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -3
- package/dist/esm/ez-button_3.entry.js +514 -0
- package/dist/esm/ez-calendar_13.entry.js +2405 -0
- package/dist/esm/ez-date-time-input.entry.js +26 -37
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/{ez-button_11.entry.js → ez-grid.entry.js} +4 -1390
- package/dist/esm/ez-icon.entry.js +26 -0
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-modal_2.entry.js +365 -0
- package/dist/esm/ez-popover.entry.js +2 -2
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +4 -4
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +2 -2
- package/dist/esm/{index-1dacecd3.js → index-077c7fcf.js} +0 -10
- package/dist/esm/{index-cfd5e193.js → index-afe19542.js} +17 -40
- package/dist/esm/loader.js +2 -2
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-00b837e2.js +1 -0
- package/dist/ezui/{p-516d0e0f.entry.js → p-0a2056d9.entry.js} +1 -1
- package/dist/ezui/p-0d8368fc.entry.js +1 -0
- package/dist/ezui/p-1e36e3ff.entry.js +1 -0
- package/dist/ezui/p-446ec85b.js +1 -0
- package/dist/ezui/p-49f3432a.entry.js +1 -0
- package/dist/ezui/{p-1ea8187e.entry.js → p-5509ee41.entry.js} +46 -46
- package/dist/ezui/{p-a18a2d7b.entry.js → p-57ea4b84.entry.js} +1 -1
- package/dist/ezui/{p-5a86e18a.entry.js → p-6d157776.entry.js} +1 -1
- package/dist/ezui/{p-8c51a6aa.entry.js → p-7a1f2e0e.entry.js} +1 -1
- package/dist/ezui/p-7de3c95d.js +1 -0
- package/dist/ezui/{p-7ef97c5f.entry.js → p-857ead8e.entry.js} +1 -1
- package/dist/ezui/p-8b099482.js +1 -0
- package/dist/ezui/{p-c6d469fc.entry.js → p-920bb8c9.entry.js} +1 -1
- package/dist/ezui/p-a4a39579.entry.js +1 -0
- package/dist/ezui/p-d5699f29.entry.js +1 -0
- package/dist/ezui/p-d64a3939.entry.js +1 -0
- package/dist/ezui/{p-5da66d3e.entry.js → p-da31cd21.entry.js} +1 -1
- package/dist/types/components/ez-application/ez-application.d.ts +0 -2
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -0
- package/dist/types/components/ez-form/DataBinder.d.ts +10 -0
- package/dist/types/components/ez-form/ez-form.d.ts +25 -32
- package/dist/types/components/ez-form/fieldbuilder/FieldBuilder.d.ts +2 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.d.ts +3 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/FileInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +8 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/TextArea.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/TextInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/store/form.slice.d.ts +24 -0
- package/dist/types/components/ez-form/structure/FormItem.d.ts +9 -0
- package/dist/types/components/ez-form/structure/FormSheet.d.ts +9 -0
- package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +27 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -20
- package/dist/types/components/ez-search/ez-search.d.ts +2 -0
- package/dist/types/components/test-du/test-du.d.ts +8 -2
- package/dist/types/components.d.ts +12 -82
- package/dist/types/utils/CSSVarsUtils.d.ts +1 -1
- package/package.json +1 -1
- package/react/components.d.ts +0 -2
- package/react/components.js +0 -2
- package/react/components.js.map +1 -1
- package/dist/cjs/ApplicationUtils-d1c1db56.js +0 -35
- package/dist/cjs/CSSVarsUtils-f8827674.js +0 -18
- package/dist/cjs/DataUnit-fdd7c70e.js +0 -474
- package/dist/cjs/ez-calendar.cjs.entry.js +0 -212
- package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +0 -630
- package/dist/cjs/ez-combo-box.cjs.entry.js +0 -250
- package/dist/cjs/ez-form.cjs.entry.js +0 -1838
- package/dist/cjs/ez-number-input.cjs.entry.js +0 -121
- package/dist/cjs/form-metadata.cjs.entry.js +0 -129
- package/dist/collection/components/ez-form/assets/trash-can-outline.svg +0 -3
- package/dist/collection/components/ez-form/store/Form.actions.js +0 -132
- package/dist/collection/components/ez-form/store/Form.reducer.js +0 -194
- package/dist/collection/components/ez-form/store/Form.selectors.js +0 -44
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +0 -301
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +0 -8
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +0 -24
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +0 -227
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +0 -14
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +0 -95
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +0 -27
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +0 -41
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +0 -37
- package/dist/esm/ApplicationUtils-01280a9d.js +0 -33
- package/dist/esm/CSSVarsUtils-e0128b01.js +0 -16
- package/dist/esm/DataUnit-1cd45202.js +0 -464
- package/dist/esm/ez-calendar.entry.js +0 -208
- package/dist/esm/ez-collapsible-box_6.entry.js +0 -621
- package/dist/esm/ez-combo-box.entry.js +0 -246
- package/dist/esm/ez-form.entry.js +0 -1834
- package/dist/esm/ez-number-input.entry.js +0 -117
- package/dist/esm/form-metadata.entry.js +0 -125
- package/dist/ezui/assets/trash-can-outline.svg +0 -3
- package/dist/ezui/p-37a611ea.js +0 -1
- package/dist/ezui/p-45689464.entry.js +0 -1
- package/dist/ezui/p-57291f97.entry.js +0 -1
- package/dist/ezui/p-69416bec.entry.js +0 -1
- package/dist/ezui/p-7107d7ef.js +0 -1
- package/dist/ezui/p-88f45a83.entry.js +0 -1
- package/dist/ezui/p-8f4851a6.js +0 -1
- package/dist/ezui/p-9dfd537e.js +0 -1
- package/dist/ezui/p-a223eed8.entry.js +0 -1
- package/dist/ezui/p-b36308e7.js +0 -1
- package/dist/ezui/p-c0af195b.entry.js +0 -1
- package/dist/ezui/p-d1889704.js +0 -1
- package/dist/ezui/p-e7ee2836.entry.js +0 -1
- package/dist/ezui/p-f7b835cf.entry.js +0 -1
- package/dist/types/components/ez-form/store/Form.actions.d.ts +0 -111
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +0 -20
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +0 -14
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +0 -91
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +0 -24
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +0 -16
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +0 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +0 -11
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +0 -13
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +0 -14
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +0 -19
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
|
-
import { collapseExpandGroup } from "../../store/Form.actions";
|
|
3
|
-
import { selectIsCollapsedFieldSet } from "../../store/Form.selectors";
|
|
4
|
-
import { Field } from "./Field";
|
|
5
|
-
export const FieldSet = ({ store, formName, source, dataUnit, enabled }) => {
|
|
6
|
-
const { label, fields } = source;
|
|
7
|
-
const fieldSetName = formName + label;
|
|
8
|
-
let isCollapsed = selectIsCollapsedFieldSet(store.getState(), formName + label);
|
|
9
|
-
let fieldToScroll;
|
|
10
|
-
source.fields.forEach((field) => {
|
|
11
|
-
if (fieldToScroll === undefined) {
|
|
12
|
-
const fieldError = dataUnit.getErrorMessage(field.name);
|
|
13
|
-
if (fieldError !== undefined && fieldError !== null && fieldError !== "") {
|
|
14
|
-
fieldToScroll = field.name;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
if (fieldToScroll) {
|
|
19
|
-
isCollapsed = false;
|
|
20
|
-
}
|
|
21
|
-
return h("div", { class: "col col--sd-12 padding--small" },
|
|
22
|
-
h("div", { class: "row margin-top--large" },
|
|
23
|
-
h("div", { class: "col col--sd-12 align--middle padding-horizontal--medium" },
|
|
24
|
-
h("ez-collapsible-box", { value: isCollapsed, label: label, onEzChange: () => store.dispatch(collapseExpandGroup(fieldSetName, !isCollapsed)) }),
|
|
25
|
-
isCollapsed ? null :
|
|
26
|
-
h("div", { class: "col col--sd-12" }, fields.map(field => h(Field, { enabled: enabled, field: field, dataUnit: dataUnit, forceScroll: fieldToScroll === field.name }))))));
|
|
27
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
|
-
import { NavigationBar } from "./NavigationBar";
|
|
3
|
-
import { selectCurrentTab, selectVisibleButtons } from "../../store/Form.selectors";
|
|
4
|
-
import { changeTab } from "../../store/Form.actions";
|
|
5
|
-
import { FieldSet } from "./FieldSet";
|
|
6
|
-
import { Field } from "./Field";
|
|
7
|
-
function buildFormItem(source, formName, store, dataUnit, enabled) {
|
|
8
|
-
if ("fields" in source) {
|
|
9
|
-
return h(FieldSet, { enabled: enabled, source: source, store: store, formName: formName, dataUnit: dataUnit });
|
|
10
|
-
}
|
|
11
|
-
const fieldName = source.name;
|
|
12
|
-
const errorMsg = dataUnit.getErrorMessage(fieldName);
|
|
13
|
-
const forceScroll = errorMsg === undefined || errorMsg === null || errorMsg === "" ? false : true;
|
|
14
|
-
return h(Field, { enabled: enabled, field: source, dataUnit: dataUnit, forceScroll: forceScroll });
|
|
15
|
-
}
|
|
16
|
-
export const FormSheet = ({ store, parentName, source, parentDataUnit, dataUnitBuilder, enabled }) => {
|
|
17
|
-
const selectedTab = selectCurrentTab(store.getState(), parentName);
|
|
18
|
-
const tabs = source.length > 1 ? source.map(form => h("ez-tab", { label: form.label, tabKey: form.name })) : null;
|
|
19
|
-
const { subForms, items, name } = source[selectedTab];
|
|
20
|
-
const dataUnit = dataUnitBuilder(source[selectedTab].dataUnit, parentDataUnit);
|
|
21
|
-
source[selectedTab].dataUnit = dataUnit;
|
|
22
|
-
const hasSubForms = subForms && subForms.length > 0;
|
|
23
|
-
const changeTabHandler = (index) => {
|
|
24
|
-
store.dispatch(changeTab(parentName, index));
|
|
25
|
-
};
|
|
26
|
-
//todos os campos e subformulários precisam estar ligados a um DU
|
|
27
|
-
const currentDU = dataUnit || parentDataUnit;
|
|
28
|
-
let buttons = selectVisibleButtons(store.getState());
|
|
29
|
-
if (currentDU.cardinality === "1") {
|
|
30
|
-
buttons.addVisible = false;
|
|
31
|
-
buttons.removeVisible = false;
|
|
32
|
-
buttons.nextVisible = false;
|
|
33
|
-
buttons.previousVisible = false;
|
|
34
|
-
}
|
|
35
|
-
return h("div", { class: "form-sheet" },
|
|
36
|
-
tabs ? h("ez-tabselector", { selectedIndex: selectedTab, selectedTab: name, onEzChange: (evt) => changeTabHandler(evt.target.selectedindex) }, tabs) : null,
|
|
37
|
-
dataUnit ? h(NavigationBar, { enabled: enabled, dataUnit: dataUnit, buttonProps: buttons }) : null,
|
|
38
|
-
h("div", { class: "tab__container" },
|
|
39
|
-
items ? items.map(item => buildFormItem(item, name, store, currentDU, enabled)) : null,
|
|
40
|
-
hasSubForms ? h(FormSheet, { enabled: enabled, store: store, source: subForms, parentName: name, parentDataUnit: currentDU, dataUnitBuilder: dataUnitBuilder }) : null));
|
|
41
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
|
-
import ApplicationUtils from "../../../../utils/ApplicationUtils";
|
|
3
|
-
function removeHandler(dataUnit) {
|
|
4
|
-
ApplicationUtils.confirm("Exclusão de registro", "Tem certeza que deseja Remover?", null, true).then(ok => {
|
|
5
|
-
if (ok) {
|
|
6
|
-
dataUnit.remove();
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
function saveHandler(dataUnit) {
|
|
11
|
-
setTimeout(() => {
|
|
12
|
-
//Esse debouncing é necessário quando o usuário clica no botão de salvar
|
|
13
|
-
//sem ter tirado o foco o último campo alterado.
|
|
14
|
-
dataUnit.save();
|
|
15
|
-
}, 50);
|
|
16
|
-
}
|
|
17
|
-
export const NavigationBar = ({ dataUnit: du, buttonProps, enabled }) => {
|
|
18
|
-
if (buttonProps.previousVisible
|
|
19
|
-
|| buttonProps.nextVisible
|
|
20
|
-
|| buttonProps.addVisible
|
|
21
|
-
|| buttonProps.removeVisible
|
|
22
|
-
|| buttonProps.saveVisible
|
|
23
|
-
|| buttonProps.cancelVisible
|
|
24
|
-
|| buttonProps.reloadVisible) {
|
|
25
|
-
return h("div", { class: "col col--sd-12 align--right" },
|
|
26
|
-
buttonProps.previousVisible ? h("ez-button", { key: du.name + "_previous", title: "Registro anterior", mode: "icon", enabled: enabled && du.hasPrevious(), onClick: () => du.previous(), image: "/themes/default/images/icons/actions-sprite.svg#previous-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
27
|
-
buttonProps.nextVisible ? h("ez-button", { key: du.name + "_next", title: "Pr\u00F3ximo registro", mode: "icon", enabled: enabled && du.hasNext(), onClick: () => du.next(), image: "/themes/default/images/icons/actions-sprite.svg#next-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
28
|
-
buttonProps.removeVisible ? h("ez-button", { key: du.name + "_remove", label: "Remover", enabled: enabled && du.hasCurrentRecord(), onClick: () => removeHandler(du), image: "/themes/default/images/icons/actions-sprite.svg#minus-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
29
|
-
buttonProps.addVisible ? h("ez-button", { key: du.name + "_add", label: "Adicionar", enabled: enabled, onClick: () => du.insert(), class: "button--secondary margin-right--medium" }) : null,
|
|
30
|
-
buttonProps.reloadVisible ? h("ez-button", { key: du.name + "_reload", title: "Recarregar", enabled: enabled, mode: "icon", onClick: () => du.load(), image: "/themes/default/images/icons/actions-sprite.svg#rotate", class: "button--secondary margin-right--medium" }) : null,
|
|
31
|
-
buttonProps.cancelVisible ? h("ez-button", { key: du.name + "_cancel", label: "Cancelar", enabled: enabled && du.hasChanges(), onClick: () => du.cancel(), class: "button--secondary margin-right--medium" }) : null,
|
|
32
|
-
buttonProps.saveVisible ? h("ez-button", { key: du.name + "_save", label: "Salvar", enabled: enabled && du.hasChanges(), onClick: () => saveHandler(du), class: "button--primary margin-right--medium" }) : null);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
class ApplicationUtils {
|
|
2
|
-
static async showDialog(title, message, icon = null, confirm, critical = false) {
|
|
3
|
-
return new Promise(resolve => {
|
|
4
|
-
let dialog = document.querySelector("ez-dialog");
|
|
5
|
-
if (!dialog) {
|
|
6
|
-
dialog = document.createElement("ez-dialog");
|
|
7
|
-
window.document.body.appendChild(dialog);
|
|
8
|
-
}
|
|
9
|
-
dialog.show(title, message, critical, confirm, icon).then(ok => resolve(ok));
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
static async alert(title, message, icon = null) {
|
|
13
|
-
return ApplicationUtils.showDialog(title, message, icon, false, false);
|
|
14
|
-
}
|
|
15
|
-
static async error(title, message, icon = null) {
|
|
16
|
-
return ApplicationUtils.showDialog(title, message, icon, false, true);
|
|
17
|
-
}
|
|
18
|
-
static async confirm(title, message, icon = null, critical = false) {
|
|
19
|
-
return ApplicationUtils.showDialog(title, message, icon, true, critical);
|
|
20
|
-
}
|
|
21
|
-
static async info(message) {
|
|
22
|
-
let toast = document.querySelector("ez-toast");
|
|
23
|
-
if (!toast) {
|
|
24
|
-
toast = document.createElement("ez-toast");
|
|
25
|
-
window.document.body.appendChild(toast);
|
|
26
|
-
}
|
|
27
|
-
toast.message = message;
|
|
28
|
-
toast.fadeTime = 4000;
|
|
29
|
-
toast.show();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { ApplicationUtils as A };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
class CSSVarsUtils {
|
|
2
|
-
static applyVarsTextInput(host, textInput) {
|
|
3
|
-
if (textInput) {
|
|
4
|
-
CSSVarsUtils.applyIfExists(host, textInput, '--text-input__input--background-color');
|
|
5
|
-
CSSVarsUtils.applyIfExists(host, textInput, '--text-input__input--border-color');
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
static applyIfExists(host, textInput, varName) {
|
|
9
|
-
const prop = getComputedStyle(host).getPropertyValue(varName);
|
|
10
|
-
if (prop) {
|
|
11
|
-
textInput.style.setProperty(varName, prop);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { CSSVarsUtils as C };
|
|
@@ -1,464 +0,0 @@
|
|
|
1
|
-
import { A as ApplicationUtils } from './ApplicationUtils-01280a9d.js';
|
|
2
|
-
|
|
3
|
-
function changeFieldValue(dataUnit, recordId, fieldName, value) {
|
|
4
|
-
return {
|
|
5
|
-
type: "FORM/CHANGEFIELD",
|
|
6
|
-
payload: { dataUnit, recordId, fieldName, value }
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
function changeTab(formId, index) {
|
|
10
|
-
return {
|
|
11
|
-
type: "FORM/CHANGETAB",
|
|
12
|
-
payload: { formId, index }
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function clearEdition(dataUnit, recordsLimit) {
|
|
16
|
-
return {
|
|
17
|
-
type: "FORM/CLEAREDITION",
|
|
18
|
-
payload: {
|
|
19
|
-
dataUnit,
|
|
20
|
-
recordsLimit
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function collapseExpandGroup(collapseId, collapsed) {
|
|
25
|
-
return {
|
|
26
|
-
type: "FORM/COLLAPSEGROUP",
|
|
27
|
-
payload: { collapseId, collapsed }
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function previousRecord(dataUnit) {
|
|
31
|
-
return {
|
|
32
|
-
type: "FORM/NAVIGATE",
|
|
33
|
-
payload: {
|
|
34
|
-
dataUnit,
|
|
35
|
-
limit: 0,
|
|
36
|
-
backward: true
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
function nextRecord(dataUnit, limit) {
|
|
41
|
-
return {
|
|
42
|
-
type: "FORM/NAVIGATE",
|
|
43
|
-
payload: {
|
|
44
|
-
dataUnit,
|
|
45
|
-
limit,
|
|
46
|
-
backward: false
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function insertRecord(dataUnit, insertionIndex) {
|
|
51
|
-
return {
|
|
52
|
-
type: "FORM/INSERT",
|
|
53
|
-
payload: {
|
|
54
|
-
dataUnit,
|
|
55
|
-
insertionIndex
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function formLoad() {
|
|
60
|
-
return {
|
|
61
|
-
type: "FORM/LOAD"
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function dataLoading(dataUnit) {
|
|
65
|
-
return {
|
|
66
|
-
type: "FORM/DATALOADING",
|
|
67
|
-
payload: {
|
|
68
|
-
dataUnit
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function savingChanges(dataUnit) {
|
|
73
|
-
return {
|
|
74
|
-
type: "FORM/SAVINGCHANGES",
|
|
75
|
-
payload: {
|
|
76
|
-
dataUnit
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function dataLoaded(dataUnit) {
|
|
81
|
-
return {
|
|
82
|
-
type: "FORM/DATALOADED",
|
|
83
|
-
payload: {
|
|
84
|
-
dataUnit
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function changesSaved(dataUnit) {
|
|
89
|
-
return {
|
|
90
|
-
type: "FORM/CHANGESSAVED",
|
|
91
|
-
payload: {
|
|
92
|
-
dataUnit
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function removingRecord(dataUnit) {
|
|
97
|
-
return {
|
|
98
|
-
type: "FORM/REMOVINGRECORD",
|
|
99
|
-
payload: {
|
|
100
|
-
dataUnit
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
function recordRemoved(dataUnit) {
|
|
105
|
-
return {
|
|
106
|
-
type: "FORM/RECORDREMOVED",
|
|
107
|
-
payload: {
|
|
108
|
-
dataUnit
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
function invalidField(tabController, tabIndex, dataUnit, recordIndex, recordId, fieldName, errorMessage) {
|
|
113
|
-
return {
|
|
114
|
-
type: "FORM/INVALIDFIELD",
|
|
115
|
-
payload: {
|
|
116
|
-
tabController,
|
|
117
|
-
tabIndex,
|
|
118
|
-
dataUnit,
|
|
119
|
-
recordId,
|
|
120
|
-
recordIndex,
|
|
121
|
-
fieldName,
|
|
122
|
-
errorMessage
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function showHideNavigationButtons(buttonName, status) {
|
|
127
|
-
return {
|
|
128
|
-
type: "FORM/SHOWHIDENAVBTN",
|
|
129
|
-
payload: {
|
|
130
|
-
buttonName,
|
|
131
|
-
status
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
//histórico
|
|
137
|
-
const selectCurrentTab = (state, formName) => {
|
|
138
|
-
const data = state.hist.present.currentTabIndex;
|
|
139
|
-
return data[formName] || 0;
|
|
140
|
-
};
|
|
141
|
-
const selectIsCollapsedFieldSet = (state, fieldSetName) => {
|
|
142
|
-
const data = state.hist.present.collapsedGroups;
|
|
143
|
-
return data[fieldSetName];
|
|
144
|
-
};
|
|
145
|
-
const selectRecordChanges = (state, dataUnit, recordId) => {
|
|
146
|
-
const data = selectDataUnitChanges(state, dataUnit);
|
|
147
|
-
return data ? data[recordId] : undefined;
|
|
148
|
-
};
|
|
149
|
-
const selectDataUnitChanges = (state, dataUnit) => {
|
|
150
|
-
const data = state.hist.present.changes;
|
|
151
|
-
return data[dataUnit];
|
|
152
|
-
};
|
|
153
|
-
const selectCurrentRecordIndex = (state, dataUnit) => {
|
|
154
|
-
const data = state.hist.present.currentRecordIndex;
|
|
155
|
-
return data[dataUnit] || 0;
|
|
156
|
-
};
|
|
157
|
-
const selectNewRecordIndex = (state, dataUnit) => {
|
|
158
|
-
const data = state.hist.present.newRecordIndex;
|
|
159
|
-
return data[dataUnit] || 0;
|
|
160
|
-
};
|
|
161
|
-
//não histórico
|
|
162
|
-
const selectLoadingData = (state, dataUnit) => {
|
|
163
|
-
const data = state.nonhist.dataLoading;
|
|
164
|
-
return data[dataUnit];
|
|
165
|
-
};
|
|
166
|
-
const selectErrorMessage = (state, dataUnit, recordId, fieldName) => {
|
|
167
|
-
const data = state.nonhist.invalidFields;
|
|
168
|
-
const dataUnitMessages = data[dataUnit] || {};
|
|
169
|
-
const recordMessages = dataUnitMessages[recordId] || {};
|
|
170
|
-
return recordMessages[fieldName] || "";
|
|
171
|
-
};
|
|
172
|
-
const selectVisibleButtons = state => state.nonhist.visibleButtons;
|
|
173
|
-
|
|
174
|
-
class DataUnit {
|
|
175
|
-
constructor(name, unitLabel, cardinality = "1", parentDU = null) {
|
|
176
|
-
this.name = name;
|
|
177
|
-
this.unitLabel = unitLabel;
|
|
178
|
-
this.cardinality = cardinality;
|
|
179
|
-
this._children = [];
|
|
180
|
-
this._fields = new Map();
|
|
181
|
-
this._requiredFields = [];
|
|
182
|
-
if (parentDU != null) {
|
|
183
|
-
parentDU._children.push(this);
|
|
184
|
-
this.parentDU = parentDU;
|
|
185
|
-
this.parentDUName = parentDU.name;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
set store(store) {
|
|
189
|
-
this._store = store;
|
|
190
|
-
}
|
|
191
|
-
set fields(value) {
|
|
192
|
-
if (value) {
|
|
193
|
-
value.forEach(f => this.addFieldMetadata(f));
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
addFieldMetadata(field) {
|
|
197
|
-
this._fields.set(field.name, field);
|
|
198
|
-
if (field.required) {
|
|
199
|
-
this._requiredFields.push(field);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
getFieldMetadata(name) {
|
|
203
|
-
if (this._fields) {
|
|
204
|
-
return this._fields.get(name);
|
|
205
|
-
}
|
|
206
|
-
return undefined;
|
|
207
|
-
}
|
|
208
|
-
get requiredFields() {
|
|
209
|
-
return this._requiredFields;
|
|
210
|
-
}
|
|
211
|
-
isLoading() {
|
|
212
|
-
return selectLoadingData(this._store.getState(), this.name);
|
|
213
|
-
}
|
|
214
|
-
hasChanges() {
|
|
215
|
-
const state = this._store.getState();
|
|
216
|
-
return selectDataUnitChanges(state, this.name) !== undefined || selectNewRecordIndex(state, this.name) > 0;
|
|
217
|
-
}
|
|
218
|
-
hasNext() {
|
|
219
|
-
return selectCurrentRecordIndex(this._store.getState(), this.name) < (this.records.length - 1);
|
|
220
|
-
}
|
|
221
|
-
hasPrevious() {
|
|
222
|
-
return selectCurrentRecordIndex(this._store.getState(), this.name) > 0;
|
|
223
|
-
}
|
|
224
|
-
hasCurrentRecord() {
|
|
225
|
-
return this.getCurrentRecord() != undefined;
|
|
226
|
-
}
|
|
227
|
-
previous() {
|
|
228
|
-
this._store.dispatch(previousRecord(this.name));
|
|
229
|
-
}
|
|
230
|
-
next() {
|
|
231
|
-
this._store.dispatch(nextRecord(this.name, this.records.length));
|
|
232
|
-
}
|
|
233
|
-
getValue(fieldName) {
|
|
234
|
-
const currentRecord = this.getCurrentRecord();
|
|
235
|
-
if (!currentRecord) {
|
|
236
|
-
return undefined;
|
|
237
|
-
}
|
|
238
|
-
const changes = this.getRecordChanges(currentRecord);
|
|
239
|
-
return changes && changes[fieldName] !== undefined ? changes[fieldName] : currentRecord[fieldName] || null;
|
|
240
|
-
}
|
|
241
|
-
getErrorMessage(fieldName) {
|
|
242
|
-
const currentRecord = this.getCurrentRecord();
|
|
243
|
-
return selectErrorMessage(this._store.getState(), this.name, currentRecord === null || currentRecord === void 0 ? void 0 : currentRecord.record__id, fieldName);
|
|
244
|
-
}
|
|
245
|
-
changeValue(fieldName, newValue) {
|
|
246
|
-
if (this.records.length == 0) {
|
|
247
|
-
this.insert();
|
|
248
|
-
}
|
|
249
|
-
if (this._changeDeboucing) {
|
|
250
|
-
window.clearTimeout(this._changeDeboucing);
|
|
251
|
-
}
|
|
252
|
-
this._changeDeboucing = window.setTimeout(() => {
|
|
253
|
-
const currentRecord = this.getCurrentRecord();
|
|
254
|
-
this._store.dispatch(changeFieldValue(this.name, currentRecord.record__id, fieldName, newValue));
|
|
255
|
-
}, 100);
|
|
256
|
-
}
|
|
257
|
-
cancel() {
|
|
258
|
-
this.records = this.records.filter(r => !r.record__id.startsWith("NEW_"));
|
|
259
|
-
this._store.dispatch(clearEdition(this.name, this.records.length - 1));
|
|
260
|
-
}
|
|
261
|
-
insert() {
|
|
262
|
-
const insertionIndex = this.records.length;
|
|
263
|
-
const newRecordIndex = selectNewRecordIndex(this._store.getState(), this.name);
|
|
264
|
-
const newRecord = { record__id: "NEW_" + (newRecordIndex + 1) };
|
|
265
|
-
this.bindToParent(newRecord);
|
|
266
|
-
this.records.push(newRecord);
|
|
267
|
-
this._store.dispatch(insertRecord(this.name, insertionIndex));
|
|
268
|
-
}
|
|
269
|
-
buildChange(r) {
|
|
270
|
-
const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
|
|
271
|
-
let recordChanges;
|
|
272
|
-
if (duChanges) {
|
|
273
|
-
recordChanges = duChanges[r.record__id];
|
|
274
|
-
}
|
|
275
|
-
let subChanges = [];
|
|
276
|
-
this._children.forEach(duChild => {
|
|
277
|
-
subChanges = subChanges.concat(duChild.getSubChanges(r.record__id));
|
|
278
|
-
});
|
|
279
|
-
if (recordChanges || subChanges.length > 0) {
|
|
280
|
-
const change = {
|
|
281
|
-
"__data__unit": this.name,
|
|
282
|
-
"__record__id": r.record__id,
|
|
283
|
-
"__sub__changes": subChanges
|
|
284
|
-
};
|
|
285
|
-
if (recordChanges) {
|
|
286
|
-
Object.keys(recordChanges).forEach(fieldName => { });
|
|
287
|
-
}
|
|
288
|
-
return change;
|
|
289
|
-
}
|
|
290
|
-
return undefined;
|
|
291
|
-
}
|
|
292
|
-
getSubChanges(id) {
|
|
293
|
-
const result = [];
|
|
294
|
-
if (this._records) {
|
|
295
|
-
this._records.filter(r => r.parent__record__id === id).forEach(r => {
|
|
296
|
-
const c = this.buildChange(r);
|
|
297
|
-
if (c) {
|
|
298
|
-
result.push(c);
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
return result;
|
|
303
|
-
}
|
|
304
|
-
getChangesToSave() {
|
|
305
|
-
let result = [];
|
|
306
|
-
if (this._records) {
|
|
307
|
-
this._records.forEach(r => {
|
|
308
|
-
const change = this.buildChange(r);
|
|
309
|
-
if (change) {
|
|
310
|
-
result.push(change);
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
return result;
|
|
315
|
-
}
|
|
316
|
-
save() {
|
|
317
|
-
if (!this.validateRecords("SAVE")) {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
this._store.dispatch(savingChanges(this.name));
|
|
321
|
-
let saveResult;
|
|
322
|
-
if (this.saveExecutor) {
|
|
323
|
-
saveResult = this.saveExecutor(this.getChangesToSave());
|
|
324
|
-
}
|
|
325
|
-
if (saveResult instanceof Promise) {
|
|
326
|
-
saveResult
|
|
327
|
-
.then(r => this.processSaveResult(r))
|
|
328
|
-
.catch(e => {
|
|
329
|
-
this._store.dispatch(dataLoaded(this.name));
|
|
330
|
-
ApplicationUtils.error("Falha ao tentar salvar", e);
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
else {
|
|
334
|
-
this.processSaveResult(saveResult);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
load() {
|
|
338
|
-
this._store.dispatch(dataLoading(this.name));
|
|
339
|
-
let result;
|
|
340
|
-
if (this.loadExecutor) {
|
|
341
|
-
result = this.loadExecutor({ dataUnit: this.name });
|
|
342
|
-
}
|
|
343
|
-
if (result instanceof Promise) {
|
|
344
|
-
result.then(r => this.processLoadResult(r));
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
347
|
-
this.processLoadResult(result);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
remove() {
|
|
351
|
-
const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
|
|
352
|
-
this._store.dispatch(removingRecord(this.name));
|
|
353
|
-
let removeResult;
|
|
354
|
-
if (this.removeExecutor) {
|
|
355
|
-
const record = this.getCurrentRecord();
|
|
356
|
-
removeResult = this.removeExecutor({ dataUnit: this.name, recordId: record.record__id, record });
|
|
357
|
-
}
|
|
358
|
-
else {
|
|
359
|
-
removeResult = true;
|
|
360
|
-
}
|
|
361
|
-
if (removeResult) {
|
|
362
|
-
if (removeResult instanceof Promise) {
|
|
363
|
-
removeResult.then(r => this.processRemoveResult(r, currentIndex));
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
this.processRemoveResult(removeResult, currentIndex);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
processSaveResult(result) {
|
|
371
|
-
if (result) {
|
|
372
|
-
if (result instanceof Array) {
|
|
373
|
-
result.forEach(item => this.processSaveResult(item));
|
|
374
|
-
}
|
|
375
|
-
else {
|
|
376
|
-
if (result.__data__unit === this.name) {
|
|
377
|
-
if (this.cardinality === "1") {
|
|
378
|
-
this.records = [this.buildRecordFromSaveResult(this.records[0], result)];
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
//FIXME: Isso está errado! tem que limpar todas as edições
|
|
384
|
-
this._store.dispatch(clearEdition(this.name, this.records.length - 1));
|
|
385
|
-
this._store.dispatch(changesSaved(this.name));
|
|
386
|
-
}
|
|
387
|
-
buildRecordFromSaveResult(baseRecord, saveResult) {
|
|
388
|
-
const newRecord = baseRecord ? Object.assign({}, baseRecord) : { record__id: "" };
|
|
389
|
-
Object.keys(saveResult).forEach(attrib => {
|
|
390
|
-
if (!attrib.startsWith("__")) {
|
|
391
|
-
newRecord[attrib] = saveResult[attrib];
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
return newRecord;
|
|
395
|
-
}
|
|
396
|
-
processLoadResult(records) {
|
|
397
|
-
this.records = records;
|
|
398
|
-
this._store.dispatch(clearEdition(this.name, this.records.length - 1));
|
|
399
|
-
this._store.dispatch(dataLoaded(this.name));
|
|
400
|
-
}
|
|
401
|
-
processRemoveResult(removed, recordIndex) {
|
|
402
|
-
if (removed) {
|
|
403
|
-
this.records.splice(recordIndex, 1);
|
|
404
|
-
this._store.dispatch(clearEdition(this.name, this.records.length - 1));
|
|
405
|
-
}
|
|
406
|
-
this._store.dispatch(recordRemoved(this.name));
|
|
407
|
-
}
|
|
408
|
-
set records(records) {
|
|
409
|
-
this._records = records;
|
|
410
|
-
if (this.parentDU) {
|
|
411
|
-
this._records.forEach(r => this.bindToParent(r));
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
bindToParent(r) {
|
|
415
|
-
if (this.parentDU) {
|
|
416
|
-
const parentRecord = this.parentDU.getCurrentRecord();
|
|
417
|
-
if (parentRecord) {
|
|
418
|
-
r.parent__record__id = parentRecord.record__id;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
get records() {
|
|
423
|
-
if (!this._records) {
|
|
424
|
-
this._records = [];
|
|
425
|
-
}
|
|
426
|
-
return this._records;
|
|
427
|
-
}
|
|
428
|
-
getCurrentRecord() {
|
|
429
|
-
const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
|
|
430
|
-
return this.records[currentIndex];
|
|
431
|
-
}
|
|
432
|
-
getRecordChanges(currentRecord = undefined) {
|
|
433
|
-
if (currentRecord === undefined) {
|
|
434
|
-
currentRecord = this.getCurrentRecord();
|
|
435
|
-
}
|
|
436
|
-
return currentRecord ? selectRecordChanges(this._store.getState(), this.name, currentRecord.record__id) : undefined;
|
|
437
|
-
}
|
|
438
|
-
validateRecords(triggedBy = "UNKNOWN") {
|
|
439
|
-
if (!this.recordsValidator) {
|
|
440
|
-
return true;
|
|
441
|
-
}
|
|
442
|
-
const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
|
|
443
|
-
const recordsToValidate = [];
|
|
444
|
-
this.records.forEach((record, i) => {
|
|
445
|
-
const changes = duChanges ? duChanges[record.record__id] : undefined;
|
|
446
|
-
if (changes) {
|
|
447
|
-
recordsToValidate.push(Object.assign(Object.assign(Object.assign({}, record), changes), { record__index: i, record__changedfields: Object.keys(changes) }));
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
const result = this.recordsValidator.validateRecords(this, recordsToValidate, triggedBy);
|
|
451
|
-
if (result.message) {
|
|
452
|
-
ApplicationUtils.info(result.message);
|
|
453
|
-
}
|
|
454
|
-
return result.isValid;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
var DependencyType;
|
|
458
|
-
(function (DependencyType) {
|
|
459
|
-
DependencyType["SEARCHING"] = "SEARCHING";
|
|
460
|
-
DependencyType["REQUIREMENT"] = "REQUIREMENT";
|
|
461
|
-
DependencyType["VISIBILITY"] = "REQUIREMENT";
|
|
462
|
-
})(DependencyType || (DependencyType = {}));
|
|
463
|
-
|
|
464
|
-
export { DependencyType as D, selectCurrentTab as a, selectVisibleButtons as b, collapseExpandGroup as c, changeTab as d, showHideNavigationButtons as e, formLoad as f, DataUnit as g, invalidField as i, selectIsCollapsedFieldSet as s };
|