@sankhyalabs/ezui 1.1.4 → 1.1.8
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/README.md +72 -72
- package/dist/{ezui/DataUnit-285bec19.js → cjs/DataUnit-28b290cb.js} +382 -369
- package/dist/{ezui/index-919090de.js → cjs/RequestMetadata-2cd01e8a.js} +4 -383
- package/dist/cjs/ez-action-chip.cjs.entry.js +52 -0
- package/dist/cjs/ez-button_14.cjs.entry.js +3341 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +131 -0
- package/dist/cjs/ez-modal.cjs.entry.js +115 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +248 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +180 -0
- package/dist/cjs/ezui.cjs.js +19 -0
- package/dist/cjs/form-metadata.cjs.entry.js +74 -0
- package/dist/cjs/index-9403fe8f.js +1322 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +31 -0
- package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -0
- package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -0
- package/dist/collection/components/ez-button/ez-button.css +94 -0
- package/dist/collection/components/ez-button/ez-button.js +125 -0
- package/dist/collection/components/ez-calendar/ez-calendar.css +210 -0
- package/dist/collection/components/ez-calendar/ez-calendar.js +215 -0
- package/dist/collection/components/ez-check/ez-check.css +266 -0
- package/dist/collection/components/ez-check/ez-check.js +168 -0
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +68 -0
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -0
- package/dist/collection/components/ez-date-input/ez-date-input.css +39 -0
- package/dist/collection/components/ez-date-input/ez-date-input.js +172 -0
- package/dist/collection/components/ez-form/ez-form.css +19 -0
- package/dist/collection/components/ez-form/ez-form.js +368 -0
- package/dist/collection/components/ez-form/store/Form.actions.js +132 -0
- package/dist/collection/components/ez-form/store/Form.reducer.js +194 -0
- package/dist/collection/components/ez-form/store/Form.selectors.js +44 -0
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +207 -0
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -0
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +24 -0
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -0
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -0
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -0
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -0
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -0
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -0
- package/dist/collection/components/ez-icon/ez-icon.css +37 -0
- package/dist/collection/components/ez-icon/ez-icon.js +56 -0
- package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -0
- package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -0
- package/dist/collection/components/ez-modal/ez-modal.css +87 -0
- package/dist/collection/components/ez-modal/ez-modal.js +224 -0
- package/dist/collection/components/ez-number-input/ez-number-input.css +144 -0
- package/dist/collection/components/ez-number-input/ez-number-input.js +465 -0
- package/dist/collection/components/ez-popover/ez-popover.css +39 -0
- package/dist/collection/components/ez-popover/ez-popover.js +323 -0
- package/dist/collection/components/ez-search/ez-search.css +296 -0
- package/dist/{ezui/ez-search.entry.js → collection/components/ez-search/ez-search.js} +527 -334
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +126 -0
- package/dist/{ezui/ez-tabselector.entry.js → collection/components/ez-tabselector/ez-tabselector.js} +283 -209
- package/dist/collection/components/ez-text-area/ez-text-area.css +140 -0
- package/dist/collection/components/ez-text-area/ez-text-area.js +267 -0
- package/dist/collection/components/ez-text-input/ez-text-input.css +170 -0
- package/dist/collection/components/ez-text-input/ez-text-input.js +395 -0
- package/dist/collection/components/ez-time-input/ez-time-input.css +155 -0
- package/dist/collection/components/ez-time-input/ez-time-input.js +326 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/servidor.js +101 -0
- package/dist/collection/utils/FloatingManager.js +16 -0
- package/dist/collection/utils/utils.js +6 -0
- package/dist/custom-elements/index.js +5071 -0
- package/dist/esm/DataUnit-69e518fa.js +378 -0
- package/dist/esm/RequestMetadata-c265c9d5.js +527 -0
- package/dist/{ezui → esm}/ez-action-chip.entry.js +42 -42
- package/dist/esm/ez-button_14.entry.js +3324 -0
- package/dist/{ezui → esm}/ez-label-chip.entry.js +121 -121
- package/dist/{ezui → esm}/ez-modal.entry.js +105 -96
- package/dist/{ezui → esm}/ez-number-input.entry.js +238 -238
- package/dist/{ezui → esm}/ez-time-input.entry.js +170 -170
- package/dist/esm/ezui.js +17 -0
- package/dist/{ezui → esm}/form-metadata.entry.js +66 -66
- package/dist/esm/index-95bb3fd9.js +1293 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/ezui/ezui.esm.js +1 -122
- package/dist/ezui/index.esm.js +0 -1
- package/dist/ezui/p-10ef58b3.js +1 -0
- package/dist/ezui/p-185c57f4.js +1 -0
- package/dist/ezui/p-22b82efb.entry.js +1 -0
- package/dist/ezui/p-77fdb4fd.entry.js +1 -0
- package/dist/ezui/p-9dfccb16.js +1 -0
- package/dist/ezui/p-b0974f4f.entry.js +1 -0
- package/dist/ezui/p-db11c600.entry.js +1 -0
- package/dist/ezui/p-dd4331b7.entry.js +1 -0
- package/dist/ezui/p-f6fd31ab.entry.js +1 -0
- package/dist/ezui/p-fa260f22.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
- package/dist/types/components/ez-button/ez-button.d.ts +20 -20
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
- package/dist/types/components/ez-check/ez-check.d.ts +32 -32
- package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
- package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
- package/dist/types/components/ez-form/ez-form.d.ts +31 -27
- package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -104
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -11
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -13
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +55 -48
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -7
- package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
- package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
- package/dist/types/components/ez-modal/ez-modal.d.ts +32 -26
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
- package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
- package/dist/types/components/ez-search/ez-search.d.ts +95 -95
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
- package/dist/types/components.d.ts +8 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +2 -2
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +13 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +114 -114
- package/react/components.d.ts +22 -0
- package/react/components.js +25 -0
- package/react/components.js.map +1 -0
- package/react/react-component-lib/createComponent.d.ts +10 -0
- package/react/react-component-lib/createComponent.js +59 -0
- package/react/react-component-lib/createComponent.js.map +1 -0
- package/react/react-component-lib/createOverlayComponent.d.ts +20 -0
- package/react/react-component-lib/createOverlayComponent.js +89 -0
- package/react/react-component-lib/createOverlayComponent.js.map +1 -0
- package/react/react-component-lib/index.d.ts +2 -0
- package/react/react-component-lib/index.js +3 -0
- package/react/react-component-lib/index.js.map +1 -0
- package/react/react-component-lib/interfaces.d.ts +29 -0
- package/react/react-component-lib/interfaces.js +1 -0
- package/react/react-component-lib/interfaces.js.map +1 -0
- package/react/react-component-lib/utils/attachProps.d.ts +12 -0
- package/react/react-component-lib/utils/attachProps.js +96 -0
- package/react/react-component-lib/utils/attachProps.js.map +1 -0
- package/react/react-component-lib/utils/case.d.ts +2 -0
- package/react/react-component-lib/utils/case.js +7 -0
- package/react/react-component-lib/utils/case.js.map +1 -0
- package/react/react-component-lib/utils/dev.d.ts +2 -0
- package/react/react-component-lib/utils/dev.js +13 -0
- package/react/react-component-lib/utils/dev.js.map +1 -0
- package/react/react-component-lib/utils/index.d.ts +7 -0
- package/react/react-component-lib/utils/index.js +21 -0
- package/react/react-component-lib/utils/index.js.map +1 -0
- package/dist/ezui/app-globals-0f993ce5.js +0 -3
- package/dist/ezui/css-shim-003e9264.js +0 -4
- package/dist/ezui/dom-1b195079.js +0 -73
- package/dist/ezui/ez-button.entry.js +0 -47
- package/dist/ezui/ez-calendar.entry.js +0 -102
- package/dist/ezui/ez-check.entry.js +0 -62
- package/dist/ezui/ez-collapsable-box.entry.js +0 -32
- package/dist/ezui/ez-combo-box.entry.js +0 -181
- package/dist/ezui/ez-date-input.entry.js +0 -77
- package/dist/ezui/ez-form.entry.js +0 -1907
- package/dist/ezui/ez-icon.entry.js +0 -17
- package/dist/ezui/ez-popover.entry.js +0 -112
- package/dist/ezui/ez-text-area.entry.js +0 -105
- package/dist/ezui/ez-text-input.entry.js +0 -202
- package/dist/ezui/index-39044be2.js +0 -2832
- package/dist/ezui/place-holder.entry.js +0 -15
- package/dist/ezui/shadow-css-c1ad5fdc.js +0 -383
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Component, Host, h, Element, Prop } from '@stencil/core';
|
|
2
|
+
import DataUnit from './DataUnit';
|
|
3
|
+
export class FormMetadata {
|
|
4
|
+
buildField(element) {
|
|
5
|
+
const label = element.textContent;
|
|
6
|
+
let name = element.getAttribute("name") || label;
|
|
7
|
+
let userInterface = element.getAttribute("ui") || "SHORTTEXT";
|
|
8
|
+
const defaultValue = element.getAttribute("defaultValue");
|
|
9
|
+
const required = element.getAttribute("required") === "true";
|
|
10
|
+
const readOnly = element.getAttribute("readonly") === "true";
|
|
11
|
+
return { name, userInterface, label, defaultValue, required, readOnly };
|
|
12
|
+
}
|
|
13
|
+
buildFieldSet(element) {
|
|
14
|
+
const label = element.getAttribute("label");
|
|
15
|
+
const fields = Array.from(element.getElementsByTagName('FIELD')).map(f => this.buildField(f));
|
|
16
|
+
return { label, fields };
|
|
17
|
+
}
|
|
18
|
+
fromElements(elements, label, name, dataUnit, many, autoLoad) {
|
|
19
|
+
const form = {
|
|
20
|
+
name: name || label,
|
|
21
|
+
label,
|
|
22
|
+
autoLoad
|
|
23
|
+
};
|
|
24
|
+
if (dataUnit) {
|
|
25
|
+
form.dataUnit = new DataUnit(dataUnit, many ? 'N' : '1');
|
|
26
|
+
}
|
|
27
|
+
Array.from(elements).forEach(child => {
|
|
28
|
+
const tagName = child.tagName.toUpperCase();
|
|
29
|
+
switch (tagName) {
|
|
30
|
+
case 'FIELD':
|
|
31
|
+
if (!form.items) {
|
|
32
|
+
form.items = [];
|
|
33
|
+
}
|
|
34
|
+
form.items.push(this.buildField(child));
|
|
35
|
+
break;
|
|
36
|
+
case 'FIELD-SET':
|
|
37
|
+
if (!form.items) {
|
|
38
|
+
form.items = [];
|
|
39
|
+
}
|
|
40
|
+
form.items.push(this.buildFieldSet(child));
|
|
41
|
+
break;
|
|
42
|
+
case 'SUB-FORM':
|
|
43
|
+
if (!form.subForms) {
|
|
44
|
+
form.subForms = [];
|
|
45
|
+
}
|
|
46
|
+
const label = child.getAttribute("label") || "Subform " + (form.subForms.length + 1);
|
|
47
|
+
const name = child.getAttribute("name") || label;
|
|
48
|
+
form.subForms.push(this.fromElements(child.children, label, name, child.getAttribute("dataunit"), child.hasAttribute("many"), child.getAttribute("autoload") === "true"));
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return form;
|
|
53
|
+
}
|
|
54
|
+
componentWillLoad() {
|
|
55
|
+
if (!this.dataunit) {
|
|
56
|
+
this.dataunit = "dataunit_" + (this.name || this.label || new Date().getTime());
|
|
57
|
+
}
|
|
58
|
+
this.metadata = this.fromElements(this._host.children, this.label, this.name, this.dataunit, this.many, this.autoload);
|
|
59
|
+
}
|
|
60
|
+
render() {
|
|
61
|
+
return h(Host, null);
|
|
62
|
+
}
|
|
63
|
+
static get is() { return "form-metadata"; }
|
|
64
|
+
static get encapsulation() { return "shadow"; }
|
|
65
|
+
static get properties() { return {
|
|
66
|
+
"name": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"mutable": false,
|
|
69
|
+
"complexType": {
|
|
70
|
+
"original": "string",
|
|
71
|
+
"resolved": "string",
|
|
72
|
+
"references": {}
|
|
73
|
+
},
|
|
74
|
+
"required": false,
|
|
75
|
+
"optional": false,
|
|
76
|
+
"docs": {
|
|
77
|
+
"tags": [],
|
|
78
|
+
"text": ""
|
|
79
|
+
},
|
|
80
|
+
"attribute": "name",
|
|
81
|
+
"reflect": false
|
|
82
|
+
},
|
|
83
|
+
"label": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"mutable": false,
|
|
86
|
+
"complexType": {
|
|
87
|
+
"original": "string",
|
|
88
|
+
"resolved": "string",
|
|
89
|
+
"references": {}
|
|
90
|
+
},
|
|
91
|
+
"required": false,
|
|
92
|
+
"optional": false,
|
|
93
|
+
"docs": {
|
|
94
|
+
"tags": [],
|
|
95
|
+
"text": ""
|
|
96
|
+
},
|
|
97
|
+
"attribute": "label",
|
|
98
|
+
"reflect": false
|
|
99
|
+
},
|
|
100
|
+
"dataunit": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"mutable": true,
|
|
103
|
+
"complexType": {
|
|
104
|
+
"original": "string",
|
|
105
|
+
"resolved": "string",
|
|
106
|
+
"references": {}
|
|
107
|
+
},
|
|
108
|
+
"required": false,
|
|
109
|
+
"optional": false,
|
|
110
|
+
"docs": {
|
|
111
|
+
"tags": [],
|
|
112
|
+
"text": ""
|
|
113
|
+
},
|
|
114
|
+
"attribute": "dataunit",
|
|
115
|
+
"reflect": false
|
|
116
|
+
},
|
|
117
|
+
"many": {
|
|
118
|
+
"type": "boolean",
|
|
119
|
+
"mutable": false,
|
|
120
|
+
"complexType": {
|
|
121
|
+
"original": "boolean",
|
|
122
|
+
"resolved": "boolean",
|
|
123
|
+
"references": {}
|
|
124
|
+
},
|
|
125
|
+
"required": false,
|
|
126
|
+
"optional": false,
|
|
127
|
+
"docs": {
|
|
128
|
+
"tags": [],
|
|
129
|
+
"text": ""
|
|
130
|
+
},
|
|
131
|
+
"attribute": "many",
|
|
132
|
+
"reflect": false
|
|
133
|
+
},
|
|
134
|
+
"autoload": {
|
|
135
|
+
"type": "boolean",
|
|
136
|
+
"mutable": false,
|
|
137
|
+
"complexType": {
|
|
138
|
+
"original": "boolean",
|
|
139
|
+
"resolved": "boolean",
|
|
140
|
+
"references": {}
|
|
141
|
+
},
|
|
142
|
+
"required": false,
|
|
143
|
+
"optional": false,
|
|
144
|
+
"docs": {
|
|
145
|
+
"tags": [],
|
|
146
|
+
"text": ""
|
|
147
|
+
},
|
|
148
|
+
"attribute": "autoload",
|
|
149
|
+
"reflect": false
|
|
150
|
+
},
|
|
151
|
+
"metadata": {
|
|
152
|
+
"type": "unknown",
|
|
153
|
+
"mutable": true,
|
|
154
|
+
"complexType": {
|
|
155
|
+
"original": "Form",
|
|
156
|
+
"resolved": "Form",
|
|
157
|
+
"references": {
|
|
158
|
+
"Form": {
|
|
159
|
+
"location": "import",
|
|
160
|
+
"path": "./FormMetadata"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"required": false,
|
|
165
|
+
"optional": false,
|
|
166
|
+
"docs": {
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": ""
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}; }
|
|
172
|
+
static get elementRef() { return "_host"; }
|
|
173
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component, Host, h } from '@stencil/core';
|
|
2
|
+
export class PlaceHolder {
|
|
3
|
+
render() {
|
|
4
|
+
return h(Host, null);
|
|
5
|
+
}
|
|
6
|
+
static get is() { return "place-holder"; }
|
|
7
|
+
static get encapsulation() { return "shadow"; }
|
|
8
|
+
static get originalStyleUrls() { return {
|
|
9
|
+
"$": ["css/place-holder.css"]
|
|
10
|
+
}; }
|
|
11
|
+
static get styleUrls() { return {
|
|
12
|
+
"$": ["./css/place-holder.css"]
|
|
13
|
+
}; }
|
|
14
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { DateUtils } from "@sankhyalabs/core";
|
|
2
|
+
import { h } from "@stencil/core";
|
|
3
|
+
import { DependencyType } from "../FormMetadata";
|
|
4
|
+
function scrollToView(forceScroll, elem) {
|
|
5
|
+
if (forceScroll) {
|
|
6
|
+
window.requestAnimationFrame(() => elem.scrollIntoView());
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export const Field = ({ dataUnit, source, forceScroll }) => {
|
|
10
|
+
const { name, label, userInterface, properties, required, dependencies } = source;
|
|
11
|
+
const value = dataUnit.getValue(name) || null;
|
|
12
|
+
const loadingData = dataUnit.isLoading();
|
|
13
|
+
const formattedLabel = required ? `* ${label} (obrigatório)` : label;
|
|
14
|
+
const errorMessage = dataUnit.getErrorMessage(name);
|
|
15
|
+
const changeFieldHandler = (newValue) => {
|
|
16
|
+
dataUnit.changeValue(name, newValue);
|
|
17
|
+
};
|
|
18
|
+
switch (userInterface) {
|
|
19
|
+
case 'LONGTEXT':
|
|
20
|
+
return h("div", { class: "col col--sd-12 padding--small" },
|
|
21
|
+
h("ez-text-area", { label: formattedLabel, onInput: evt => changeFieldHandler(evt.target['value']), value: value || '', errormessage: errorMessage, ref: elem => scrollToView(forceScroll, elem) }));
|
|
22
|
+
case 'CHECKBOX':
|
|
23
|
+
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
24
|
+
h("ez-check", { onInput: evt => changeFieldHandler(evt.target['value']), ref: elem => scrollToView(forceScroll, elem) }));
|
|
25
|
+
case 'SWITCH':
|
|
26
|
+
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
27
|
+
h("div", { class: "row" },
|
|
28
|
+
h("div", { class: "col col--sd-2" },
|
|
29
|
+
h("ez-check", { mode: "switch", value: value === "S", ref: elem => scrollToView(forceScroll, elem) })),
|
|
30
|
+
h("div", { class: "col col--sd-10" },
|
|
31
|
+
h("label", { class: "text text--primary text--medium" }, label))));
|
|
32
|
+
case 'OPTIONSELECTOR':
|
|
33
|
+
const optsObj = JSON.parse(properties.find(prop => prop.name === 'options').value);
|
|
34
|
+
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
35
|
+
h("ez-combo-box", { value: value, label: formattedLabel, onEzChange: (event) => changeFieldHandler(event.target['value']), errormessage: errorMessage, ref: elem => scrollToView(forceScroll, elem) }, Object.keys(optsObj).map(key => h("option", { value: key }, optsObj[key]))));
|
|
36
|
+
case 'SEARCH':
|
|
37
|
+
const context = {};
|
|
38
|
+
properties.forEach(({ name, value }) => {
|
|
39
|
+
context[name] = value;
|
|
40
|
+
});
|
|
41
|
+
let criteriaList = [];
|
|
42
|
+
dependencies === null || dependencies === void 0 ? void 0 : dependencies.forEach(dependency => {
|
|
43
|
+
var _a;
|
|
44
|
+
if (dependency.type === DependencyType.SEARCHING) {
|
|
45
|
+
if (((_a = dependency.masterFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
46
|
+
let criteria = {
|
|
47
|
+
expression: dependency.expression,
|
|
48
|
+
paramNames: [...dependency.masterFields],
|
|
49
|
+
paramResolver: name => dataUnit.getValue(name)
|
|
50
|
+
};
|
|
51
|
+
criteriaList.push(criteria);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
if (criteriaList.length > 0) {
|
|
56
|
+
context['CRITERIA'] = criteriaList;
|
|
57
|
+
}
|
|
58
|
+
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
59
|
+
h("ez-search", { label: label, onEzChange: (event) => changeFieldHandler(event.target['value']), showvalue: true, value: value, loadexecutor: (argument, callback) => dataUnit.fieldSearchExecutor(argument, context, callback) }));
|
|
60
|
+
case 'DATE':
|
|
61
|
+
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
62
|
+
h("ez-date-input", { label: formattedLabel, enabled: true, value: !value ? null : DateUtils.clearTime(value), onEzChange: (event) => changeFieldHandler(event.target['value']), errormessage: errorMessage, ref: elem => scrollToView(forceScroll, elem) }));
|
|
63
|
+
//IMAGE, FILE, DATE, DATETIME, ELAPSEDTIME, DECIMALNUMBER, INTEGERNUMBER, PASSWORD, MASKEDTEXT, HTML
|
|
64
|
+
default:
|
|
65
|
+
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData
|
|
66
|
+
?
|
|
67
|
+
h("place-holder", null)
|
|
68
|
+
:
|
|
69
|
+
h("ez-text-input", { loading: loadingData, label: formattedLabel, onInput: (event) => changeFieldHandler(event.target['value']), value: value, errormessage: errorMessage, ref: elem => scrollToView(forceScroll, elem) }));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
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 }) => {
|
|
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-collapsable-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, { source: field, dataUnit: dataUnit, forceScroll: fieldToScroll === field.name }))))));
|
|
27
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
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) {
|
|
8
|
+
if ("fields" in source) {
|
|
9
|
+
return h(FieldSet, { source: source, store: store, formName: formName, dataUnit: dataUnit });
|
|
10
|
+
}
|
|
11
|
+
const errorMsg = dataUnit.getErrorMessage(source.name);
|
|
12
|
+
const forceScroll = errorMsg === undefined || errorMsg === null || errorMsg === "" ? false : true;
|
|
13
|
+
return h(Field, { source: source, dataUnit: dataUnit, forceScroll: forceScroll });
|
|
14
|
+
}
|
|
15
|
+
export const FormSheet = ({ store, parentName, source, parentDataUnit, dataUnitBuilder }) => {
|
|
16
|
+
const selectedTab = selectCurrentTab(store.getState(), parentName);
|
|
17
|
+
const tabs = source.length > 1 ? source.map(form => h("ez-tab", { label: form.label, tabKey: form.name })) : null;
|
|
18
|
+
const { subForms, items, name } = source[selectedTab];
|
|
19
|
+
const dataUnit = dataUnitBuilder(source[selectedTab].dataUnit);
|
|
20
|
+
source[selectedTab].dataUnit = dataUnit;
|
|
21
|
+
const hasSubForms = subForms && subForms.length > 0;
|
|
22
|
+
const changeTabHandler = (index) => {
|
|
23
|
+
store.dispatch(changeTab(parentName, index));
|
|
24
|
+
};
|
|
25
|
+
//todos os campos e subformulários precisam estar ligados a um DU
|
|
26
|
+
const currentDU = dataUnit || parentDataUnit;
|
|
27
|
+
let buttons = selectVisibleButtons(store.getState());
|
|
28
|
+
if (currentDU.cardinality === "1") {
|
|
29
|
+
buttons.addVisible = false;
|
|
30
|
+
buttons.removeVisible = false;
|
|
31
|
+
buttons.nextVisible = false;
|
|
32
|
+
buttons.previousVisible = false;
|
|
33
|
+
}
|
|
34
|
+
return h("div", { class: "form-sheet" },
|
|
35
|
+
tabs ? h("ez-tabselector", { selectedindex: selectedTab, selectedtab: name, onChange: (evt) => changeTabHandler(evt.target.selectedindex) }, tabs) : null,
|
|
36
|
+
dataUnit ? h(NavigationBar, { dataUnit: dataUnit, buttonProps: buttons }) : null,
|
|
37
|
+
h("div", { class: "tab__container" },
|
|
38
|
+
items ? items.map(item => buildFormItem(item, name, store, currentDU)) : null,
|
|
39
|
+
hasSubForms ? h(FormSheet, { store: store, source: subForms, parentName: name, parentDataUnit: currentDU, dataUnitBuilder: dataUnitBuilder }) : null));
|
|
40
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
function removeHandler(dataUnit) {
|
|
3
|
+
if (confirm("Tem certeza que deseja Remover?")) {
|
|
4
|
+
dataUnit.remove();
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export const NavigationBar = ({ dataUnit: du, buttonProps }) => {
|
|
8
|
+
if (buttonProps.previousVisible
|
|
9
|
+
|| buttonProps.nextVisible
|
|
10
|
+
|| buttonProps.addVisible
|
|
11
|
+
|| buttonProps.removeVisible
|
|
12
|
+
|| buttonProps.saveVisible
|
|
13
|
+
|| buttonProps.cancelVisible
|
|
14
|
+
|| buttonProps.reloadVisible) {
|
|
15
|
+
return h("div", { class: "col col--sd-12 align--right" },
|
|
16
|
+
buttonProps.previousVisible ? h("ez-button", { title: "Registro anterior", mode: "icon", enabled: du.hasPrevious(), onClick: () => du.previous(), image: "/themes/default/images/icons/actions-sprite.svg#previous-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
17
|
+
buttonProps.nextVisible ? h("ez-button", { title: "Pr\u00F3ximo registro", mode: "icon", enabled: du.hasNext(), onClick: () => du.next(), image: "/themes/default/images/icons/actions-sprite.svg#next-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
18
|
+
buttonProps.removeVisible ? h("ez-button", { title: "Remover " + du.unitLabel, mode: "icon", enabled: du.hasCurrentRecord(), onClick: () => removeHandler(du), image: "/themes/default/images/icons/actions-sprite.svg#minus-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
19
|
+
buttonProps.addVisible ? h("ez-button", { label: "Criar " + du.unitLabel, onClick: () => du.insert(), class: "button--secondary margin-right--medium" }) : null,
|
|
20
|
+
buttonProps.reloadVisible ? h("ez-button", { title: "Recarregar", mode: "icon", onClick: () => du.load(), image: "/themes/default/images/icons/actions-sprite.svg#rotate", class: "button--secondary margin-right--medium" }) : null,
|
|
21
|
+
buttonProps.cancelVisible ? h("ez-button", { label: "Cancelar", enabled: du.hasChanges(), onClick: () => du.cancel(), class: "button--secondary margin-right--medium" }) : null,
|
|
22
|
+
buttonProps.saveVisible ? h("ez-button", { label: "Salvar", enabled: du.hasChanges(), onClick: () => du.save(), class: "button--primary margin-right--medium" }) : null);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
position: relative;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
svg {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
fill: var(--color--icon);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.x-small {
|
|
15
|
+
width: 12px;
|
|
16
|
+
height: 12px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.small {
|
|
20
|
+
width: 16px;
|
|
21
|
+
height: 16px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.medium {
|
|
25
|
+
width: 20px;
|
|
26
|
+
height: 20px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.large {
|
|
30
|
+
width: 24px;
|
|
31
|
+
height: 24px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.x-large {
|
|
35
|
+
width: 30px;
|
|
36
|
+
height: 30px;
|
|
37
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Component, h, Prop } from '@stencil/core';
|
|
2
|
+
export class EzIcon {
|
|
3
|
+
constructor() {
|
|
4
|
+
/*Tamanho do icone*/
|
|
5
|
+
this.size = 'medium';
|
|
6
|
+
}
|
|
7
|
+
render() {
|
|
8
|
+
return (h("svg", { class: this.size, role: "img" },
|
|
9
|
+
h("use", { xlinkHref: this.href })));
|
|
10
|
+
}
|
|
11
|
+
static get is() { return "ez-icon"; }
|
|
12
|
+
static get encapsulation() { return "shadow"; }
|
|
13
|
+
static get originalStyleUrls() { return {
|
|
14
|
+
"$": ["ez-icon.css"]
|
|
15
|
+
}; }
|
|
16
|
+
static get styleUrls() { return {
|
|
17
|
+
"$": ["ez-icon.css"]
|
|
18
|
+
}; }
|
|
19
|
+
static get properties() { return {
|
|
20
|
+
"size": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"mutable": false,
|
|
23
|
+
"complexType": {
|
|
24
|
+
"original": "string",
|
|
25
|
+
"resolved": "string",
|
|
26
|
+
"references": {}
|
|
27
|
+
},
|
|
28
|
+
"required": false,
|
|
29
|
+
"optional": false,
|
|
30
|
+
"docs": {
|
|
31
|
+
"tags": [],
|
|
32
|
+
"text": ""
|
|
33
|
+
},
|
|
34
|
+
"attribute": "size",
|
|
35
|
+
"reflect": true,
|
|
36
|
+
"defaultValue": "'medium'"
|
|
37
|
+
},
|
|
38
|
+
"href": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"mutable": false,
|
|
41
|
+
"complexType": {
|
|
42
|
+
"original": "string",
|
|
43
|
+
"resolved": "string",
|
|
44
|
+
"references": {}
|
|
45
|
+
},
|
|
46
|
+
"required": false,
|
|
47
|
+
"optional": false,
|
|
48
|
+
"docs": {
|
|
49
|
+
"tags": [],
|
|
50
|
+
"text": ""
|
|
51
|
+
},
|
|
52
|
+
"attribute": "href",
|
|
53
|
+
"reflect": true
|
|
54
|
+
}
|
|
55
|
+
}; }
|
|
56
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
/* dimensions */
|
|
3
|
+
--lc--height: 36px;
|
|
4
|
+
--lc--width: 100%;
|
|
5
|
+
--lc__icon--width: 48px;
|
|
6
|
+
/* general */
|
|
7
|
+
--lc--border-radius: var(--border--radius-large, 24px);
|
|
8
|
+
--lc--font-size: var(--text--medium, 14px);
|
|
9
|
+
--lc--font-family: var(--font-pattern, Arial);
|
|
10
|
+
--lc--font-weight: var(--text-weight--large, 500);
|
|
11
|
+
--lc--space--medium: var(--space--medium, 6px);
|
|
12
|
+
--lc__border: 1px solid;
|
|
13
|
+
--lc__border-color-strokes: var(--color--strokes, #DCE0E8);
|
|
14
|
+
/* label */
|
|
15
|
+
--lc__label--title--primary: var(--title--primary, #919191);
|
|
16
|
+
--lc__label--color-primary: var(--color--primary, #008561);
|
|
17
|
+
--lc__label-color--disable-secondary: var(--color--disable-secondary, #F2F5F8);
|
|
18
|
+
--lc__label--background-color: #0085610F;
|
|
19
|
+
--lc__label__default--background-color--hover: var(--color--primary-200, #f2faf8);
|
|
20
|
+
--lc__label__default--border-color--hover: var(--color--primary-600, #007a5a);
|
|
21
|
+
--lc__label--text--disabled: var(--text--disable, #AFB6C0);
|
|
22
|
+
--lc__label--text--primary: var(--text--primary, #626e82);
|
|
23
|
+
/* message box */
|
|
24
|
+
--lc__message_box--font-size: var(--text--small, 12px);
|
|
25
|
+
--lc__message_box--info--color: var(--color--success, #22085d);
|
|
26
|
+
--lc__message_box--error--color: var(--color--error, #FF0000);
|
|
27
|
+
/***************
|
|
28
|
+
host style
|
|
29
|
+
***************/
|
|
30
|
+
/*public*/
|
|
31
|
+
width: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.padding-right--small {
|
|
35
|
+
padding-right: var(--lc--space--medium);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.padding-left--small {
|
|
39
|
+
padding-left: var(--lc--space--medium);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.label__container {
|
|
43
|
+
/*private*/
|
|
44
|
+
width: fit-content;
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
position: relative;
|
|
48
|
+
align-items: center;
|
|
49
|
+
align-self: center;
|
|
50
|
+
color: var(--lc__label--title--primary);
|
|
51
|
+
fill: var(--lc__label--title--primary);
|
|
52
|
+
border: var(--lc__border);
|
|
53
|
+
border-radius: var(--lc--border-radius);
|
|
54
|
+
border-color: var( --lc__border-color-strokes);
|
|
55
|
+
padding-right: var(--space--large, 12px);
|
|
56
|
+
padding-left: var(--space--large, 12px);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.label__container:hover {
|
|
60
|
+
border-color: var(--lc__label__default--border-color--hover);
|
|
61
|
+
background-color: var(--lc__label__default--background-color--hover);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.label__container--active {
|
|
65
|
+
/*private*/
|
|
66
|
+
width: fit-content;
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-wrap: wrap;
|
|
69
|
+
position: relative;
|
|
70
|
+
align-items: center;
|
|
71
|
+
align-self: center;
|
|
72
|
+
border: var(--lc__border);
|
|
73
|
+
border-radius: var(--lc--border-radius);
|
|
74
|
+
padding-right: var(--space--large, 12px);
|
|
75
|
+
padding-left: var(--space--large, 12px);
|
|
76
|
+
fill: var(--lc__label--color-primary);
|
|
77
|
+
color: var(--lc__label--color-primary);
|
|
78
|
+
border-color: var(--lc__label--background-color);
|
|
79
|
+
background-color: var(--lc__label--background-color);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
.label__container--disabled {
|
|
84
|
+
width: fit-content;
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-wrap: wrap;
|
|
87
|
+
position: relative;
|
|
88
|
+
align-items: center;
|
|
89
|
+
align-self: center;
|
|
90
|
+
border: var(--lc__border);
|
|
91
|
+
border-color: var(--lc__label-color--disable-secondary);
|
|
92
|
+
border-radius: var(--lc--border-radius);
|
|
93
|
+
padding-right: var(--space--large, 12px);
|
|
94
|
+
padding-left: var(--space--large, 12px);
|
|
95
|
+
fill: var(--lc__label--text--disabled);
|
|
96
|
+
color: var(--lc__label--text--disabled);
|
|
97
|
+
background-color: var(--lc__label-color--disable-secondary);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
label {
|
|
101
|
+
/*private*/
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
width: calc(100% - var(--lc__icon--width));
|
|
105
|
+
width: fit-content;
|
|
106
|
+
font-weight: var(--text-weight--large, 600);
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
/*public*/
|
|
109
|
+
height: var(--lc--height);
|
|
110
|
+
font-family: var(--lc--font-family);
|
|
111
|
+
font-size: var(--lc--font-size);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.label__icon {
|
|
115
|
+
display: flex;
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
}
|