@sankhyalabs/ezui 5.20.0-dev.13 → 5.20.0-dev.15
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-combo-box.cjs.entry.js +6 -5
- package/dist/cjs/ez-form-view.cjs.entry.js +30 -13
- package/dist/cjs/ez-grid.cjs.entry.js +1 -1
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +1 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +6 -5
- package/dist/collection/components/ez-form-view/ez-form-view.css +17 -1
- package/dist/collection/components/ez-form-view/ez-form-view.js +22 -5
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +3 -3
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
- package/dist/custom-elements/index.js +37 -19
- package/dist/esm/ez-combo-box.entry.js +6 -5
- package/dist/esm/ez-form-view.entry.js +31 -14
- package/dist/esm/ez-grid.entry.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-661f6820.entry.js → p-ac8c4e70.entry.js} +1 -1
- package/dist/ezui/p-c64f5363.entry.js +1 -0
- package/dist/ezui/p-db77a984.entry.js +1 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -0
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +3 -0
- package/package.json +1 -1
- package/dist/ezui/p-60848ef6.entry.js +0 -1
- package/dist/ezui/p-e562d05e.entry.js +0 -1
|
@@ -222,14 +222,15 @@ const EzComboBox = class {
|
|
|
222
222
|
const upperCriteria = this._criteria.toUpperCase();
|
|
223
223
|
opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(upperCriteria) > -1);
|
|
224
224
|
}
|
|
225
|
-
if (this.
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
this._visibleOptions = [{ value: undefined, label: "" }].concat(opts);
|
|
225
|
+
if (this.hasToAddEmptyoption(opts)) {
|
|
226
|
+
opts = [{ value: undefined, label: "" }].concat(opts);
|
|
230
227
|
}
|
|
228
|
+
this._visibleOptions = opts;
|
|
231
229
|
this._maxWidthValue = this.getMaxWidthValue();
|
|
232
230
|
}
|
|
231
|
+
hasToAddEmptyoption(opts) {
|
|
232
|
+
return !this.suppressEmptyOption && !opts.filter(opt => !opt.value).length;
|
|
233
|
+
}
|
|
233
234
|
getMaxWidthValue() {
|
|
234
235
|
var _a;
|
|
235
236
|
if (this.showOptionValue) {
|
|
@@ -14,7 +14,7 @@ const buildCheckBox = (field) => {
|
|
|
14
14
|
return buildField(field.name, field.label, field.readOnly, field.contextName, false);
|
|
15
15
|
};
|
|
16
16
|
function buildField(fieldName, fieldLabel, readOnly, contextName, switchMode) {
|
|
17
|
-
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
17
|
+
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-align--middle ez-padding-horizontal--small ez-padding-bottom--large" },
|
|
18
18
|
index.h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? CheckMode.CheckMode.SWITCH : CheckMode.CheckMode.REGULAR, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName })));
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -28,20 +28,20 @@ const buildComboBox = ({ name, label, readOnly, required, props, contextName, ca
|
|
|
28
28
|
else {
|
|
29
29
|
options = prop;
|
|
30
30
|
}
|
|
31
|
-
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
31
|
+
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
32
32
|
index.h("ez-combo-box", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, options: options, canShowError: canShowError })));
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const buildDate = ({ name, label, readOnly, canShowError }) => {
|
|
36
|
-
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
36
|
+
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
37
37
|
index.h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError })));
|
|
38
38
|
};
|
|
39
39
|
const buildTime = ({ name, label, readOnly, canShowError }) => {
|
|
40
|
-
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
40
|
+
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
41
41
|
index.h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError })));
|
|
42
42
|
};
|
|
43
43
|
const buildDateTime = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
44
|
-
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
44
|
+
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
45
45
|
index.h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError })));
|
|
46
46
|
};
|
|
47
47
|
|
|
@@ -67,12 +67,12 @@ const buildInteger = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
|
67
67
|
return buildNumeric(name, label, readOnly, 0, 0, contextName, canShowError);
|
|
68
68
|
};
|
|
69
69
|
function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecision, contextName, canShowError) {
|
|
70
|
-
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
70
|
+
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
71
71
|
index.h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName, canShowError: canShowError })));
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
const buildSearch = ({ name, label, readOnly, required, contextName, canShowError, optionLoader }) => {
|
|
75
|
-
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
75
|
+
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
76
76
|
index.h("ez-search", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError, optionLoader: optionLoader })));
|
|
77
77
|
};
|
|
78
78
|
|
|
@@ -82,7 +82,7 @@ const buildTextArea = ({ name, label, readOnly, contextName, rows, canShowError
|
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
const buildTextInput = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
85
|
-
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
85
|
+
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
86
86
|
index.h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly, canShowError: canShowError })));
|
|
87
87
|
};
|
|
88
88
|
|
|
@@ -142,7 +142,7 @@ class FormItems {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
const ezFormViewCss = ".sc-ez-form-view-h{display:flex;flex-
|
|
145
|
+
const ezFormViewCss = ".sc-ez-form-view-h{display:flex;flex-wrap:wrap;width:100%;--ez-form-view__item--min-width:220px;--ez-form-view__item--sapce-width:5px}.form-view__content.sc-ez-form-view{display:grid;grid-template-columns:repeat(auto-fill, minmax(var(--ez-form-view__item--min-width), 1fr));gap:var(--ez-form-view__item--sapce-width);width:100%}.input-full_width.sc-ez-form-view{grid-column:1 / -1;width:100%}";
|
|
146
146
|
|
|
147
147
|
const EzFormView = class {
|
|
148
148
|
constructor(hostRef) {
|
|
@@ -177,19 +177,36 @@ const EzFormView = class {
|
|
|
177
177
|
const formItems = new FormItems(Array.from(this._element.querySelectorAll("[data-form-item]")));
|
|
178
178
|
this.formItemsReady.emit(formItems);
|
|
179
179
|
}
|
|
180
|
+
isItemFullWidth(userInterface) {
|
|
181
|
+
return [
|
|
182
|
+
core.UserInterface.FILE,
|
|
183
|
+
core.UserInterface.LONGTEXT
|
|
184
|
+
].includes(userInterface);
|
|
185
|
+
}
|
|
186
|
+
buildFormItemElement(item, classItem = "") {
|
|
187
|
+
if (this.isItemFullWidth(item.userInterface)) {
|
|
188
|
+
classItem += " input-full_width";
|
|
189
|
+
}
|
|
190
|
+
return index.h("div", { class: classItem }, fieldBuilder(item));
|
|
191
|
+
}
|
|
180
192
|
render() {
|
|
181
193
|
core.ElementIDUtils.addIDInfoIfNotExists(this._element, 'ezFormView');
|
|
182
194
|
if (this.fields == undefined) {
|
|
183
195
|
return;
|
|
184
196
|
}
|
|
185
|
-
|
|
197
|
+
let nonArrayGrup = [];
|
|
198
|
+
let formContent = Array.from(this.groupFields(this.fields).entries()).map(([label, value]) => {
|
|
186
199
|
if (Array.isArray(value)) {
|
|
187
|
-
return (index.h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, value.map(fi =>
|
|
200
|
+
return (index.h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, index.h("div", { class: "form-view__content" }, value.map(fi => (this.buildFormItemElement(fi))))));
|
|
188
201
|
}
|
|
189
202
|
else {
|
|
190
|
-
|
|
203
|
+
nonArrayGrup.push(value);
|
|
191
204
|
}
|
|
192
|
-
})
|
|
205
|
+
});
|
|
206
|
+
// Filtra os elementos que não são arrays e os coloca dentro de uma única div
|
|
207
|
+
let nonArrayElements = nonArrayGrup.map((value) => this.buildFormItemElement(value));
|
|
208
|
+
let groupedNonArrayElements = index.h("div", { class: "form-view__content" }, nonArrayElements);
|
|
209
|
+
return (index.h(index.Host, null, groupedNonArrayElements, formContent));
|
|
193
210
|
}
|
|
194
211
|
get _element() { return index.getElement(this); }
|
|
195
212
|
};
|
|
@@ -120255,7 +120255,7 @@ class AgGridController {
|
|
|
120255
120255
|
showColumnFilter: (leftPosition) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name), fromIcon: true }),
|
|
120256
120256
|
},
|
|
120257
120257
|
valueFormatter: params => {
|
|
120258
|
-
if (params.value
|
|
120258
|
+
if (params.value === undefined) {
|
|
120259
120259
|
return "";
|
|
120260
120260
|
}
|
|
120261
120261
|
if (params.value instanceof Promise) {
|
|
@@ -210,14 +210,15 @@ export class EzComboBox {
|
|
|
210
210
|
const upperCriteria = this._criteria.toUpperCase();
|
|
211
211
|
opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(upperCriteria) > -1);
|
|
212
212
|
}
|
|
213
|
-
if (this.
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
this._visibleOptions = [{ value: undefined, label: "" }].concat(opts);
|
|
213
|
+
if (this.hasToAddEmptyoption(opts)) {
|
|
214
|
+
opts = [{ value: undefined, label: "" }].concat(opts);
|
|
218
215
|
}
|
|
216
|
+
this._visibleOptions = opts;
|
|
219
217
|
this._maxWidthValue = this.getMaxWidthValue();
|
|
220
218
|
}
|
|
219
|
+
hasToAddEmptyoption(opts) {
|
|
220
|
+
return !this.suppressEmptyOption && !opts.filter(opt => !opt.value).length;
|
|
221
|
+
}
|
|
221
222
|
getMaxWidthValue() {
|
|
222
223
|
var _a;
|
|
223
224
|
if (this.showOptionValue) {
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: flex;
|
|
3
|
-
flex-direction: row;
|
|
4
3
|
flex-wrap: wrap;
|
|
5
4
|
width: 100%;
|
|
5
|
+
|
|
6
|
+
/*@doc Define o tamanho mínimo dos itens do formulário.*/
|
|
7
|
+
--ez-form-view__item--min-width: 220px;
|
|
8
|
+
/*@doc Define o espaçamento entre itens do formulário.*/
|
|
9
|
+
--ez-form-view__item--sapce-width: 5px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.form-view__content{
|
|
13
|
+
display: grid;
|
|
14
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--ez-form-view__item--min-width), 1fr));
|
|
15
|
+
gap: var(--ez-form-view__item--sapce-width);
|
|
16
|
+
width: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.input-full_width {
|
|
20
|
+
grid-column: 1 / -1;
|
|
21
|
+
width: 100%;
|
|
6
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
|
2
2
|
import { fieldBuilder } from './fieldbuilder/FieldBuilder';
|
|
3
|
-
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { ElementIDUtils, UserInterface } from '@sankhyalabs/core';
|
|
4
4
|
import { FormItems } from './structure';
|
|
5
5
|
export class EzFormView {
|
|
6
6
|
constructor() {
|
|
@@ -32,19 +32,36 @@ export class EzFormView {
|
|
|
32
32
|
const formItems = new FormItems(Array.from(this._element.querySelectorAll("[data-form-item]")));
|
|
33
33
|
this.formItemsReady.emit(formItems);
|
|
34
34
|
}
|
|
35
|
+
isItemFullWidth(userInterface) {
|
|
36
|
+
return [
|
|
37
|
+
UserInterface.FILE,
|
|
38
|
+
UserInterface.LONGTEXT
|
|
39
|
+
].includes(userInterface);
|
|
40
|
+
}
|
|
41
|
+
buildFormItemElement(item, classItem = "") {
|
|
42
|
+
if (this.isItemFullWidth(item.userInterface)) {
|
|
43
|
+
classItem += " input-full_width";
|
|
44
|
+
}
|
|
45
|
+
return h("div", { class: classItem }, fieldBuilder(item));
|
|
46
|
+
}
|
|
35
47
|
render() {
|
|
36
48
|
ElementIDUtils.addIDInfoIfNotExists(this._element, 'ezFormView');
|
|
37
49
|
if (this.fields == undefined) {
|
|
38
50
|
return;
|
|
39
51
|
}
|
|
40
|
-
|
|
52
|
+
let nonArrayGrup = [];
|
|
53
|
+
let formContent = Array.from(this.groupFields(this.fields).entries()).map(([label, value]) => {
|
|
41
54
|
if (Array.isArray(value)) {
|
|
42
|
-
return (h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, value.map(fi =>
|
|
55
|
+
return (h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, h("div", { class: "form-view__content" }, value.map(fi => (this.buildFormItemElement(fi))))));
|
|
43
56
|
}
|
|
44
57
|
else {
|
|
45
|
-
|
|
58
|
+
nonArrayGrup.push(value);
|
|
46
59
|
}
|
|
47
|
-
})
|
|
60
|
+
});
|
|
61
|
+
// Filtra os elementos que não são arrays e os coloca dentro de uma única div
|
|
62
|
+
let nonArrayElements = nonArrayGrup.map((value) => this.buildFormItemElement(value));
|
|
63
|
+
let groupedNonArrayElements = h("div", { class: "form-view__content" }, nonArrayElements);
|
|
64
|
+
return (h(Host, null, groupedNonArrayElements, formContent));
|
|
48
65
|
}
|
|
49
66
|
static get is() { return "ez-form-view"; }
|
|
50
67
|
static get encapsulation() { return "scoped"; }
|
|
@@ -7,5 +7,5 @@ export const buildCheckBox = (field) => {
|
|
|
7
7
|
return buildField(field.name, field.label, field.readOnly, field.contextName, false);
|
|
8
8
|
};
|
|
9
9
|
function buildField(fieldName, fieldLabel, readOnly, contextName, switchMode) {
|
|
10
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
10
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-align--middle ez-padding-horizontal--small ez-padding-bottom--large" }, h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? CheckMode.SWITCH : CheckMode.REGULAR, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName })));
|
|
11
11
|
}
|
|
@@ -9,5 +9,5 @@ export const buildComboBox = ({ name, label, readOnly, required, props, contextN
|
|
|
9
9
|
else {
|
|
10
10
|
options = prop;
|
|
11
11
|
}
|
|
12
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
12
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-combo-box", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, options: options, canShowError: canShowError })));
|
|
13
13
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
export const buildDate = ({ name, label, readOnly, canShowError }) => {
|
|
3
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
3
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError })));
|
|
4
4
|
};
|
|
5
5
|
export const buildTime = ({ name, label, readOnly, canShowError }) => {
|
|
6
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
6
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError })));
|
|
7
7
|
};
|
|
8
8
|
export const buildDateTime = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
9
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
9
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError })));
|
|
10
10
|
};
|
|
@@ -8,5 +8,5 @@ export const buildInteger = ({ name, label, readOnly, contextName, canShowError
|
|
|
8
8
|
return buildNumeric(name, label, readOnly, 0, 0, contextName, canShowError);
|
|
9
9
|
};
|
|
10
10
|
function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecision, contextName, canShowError) {
|
|
11
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
11
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName, canShowError: canShowError })));
|
|
12
12
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
export const buildSearch = ({ name, label, readOnly, required, contextName, canShowError, optionLoader }) => {
|
|
3
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
3
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-search", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError, optionLoader: optionLoader })));
|
|
4
4
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
export const buildTextInput = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
3
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
3
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly, canShowError: canShowError })));
|
|
4
4
|
};
|
|
@@ -612,7 +612,7 @@ export default class AgGridController {
|
|
|
612
612
|
showColumnFilter: (leftPosition) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name), fromIcon: true }),
|
|
613
613
|
},
|
|
614
614
|
valueFormatter: params => {
|
|
615
|
-
if (params.value
|
|
615
|
+
if (params.value === undefined) {
|
|
616
616
|
return "";
|
|
617
617
|
}
|
|
618
618
|
if (params.value instanceof Promise) {
|
|
@@ -2568,14 +2568,15 @@ const EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
2568
2568
|
const upperCriteria = this._criteria.toUpperCase();
|
|
2569
2569
|
opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(upperCriteria) > -1);
|
|
2570
2570
|
}
|
|
2571
|
-
if (this.
|
|
2572
|
-
|
|
2573
|
-
}
|
|
2574
|
-
else {
|
|
2575
|
-
this._visibleOptions = [{ value: undefined, label: "" }].concat(opts);
|
|
2571
|
+
if (this.hasToAddEmptyoption(opts)) {
|
|
2572
|
+
opts = [{ value: undefined, label: "" }].concat(opts);
|
|
2576
2573
|
}
|
|
2574
|
+
this._visibleOptions = opts;
|
|
2577
2575
|
this._maxWidthValue = this.getMaxWidthValue();
|
|
2578
2576
|
}
|
|
2577
|
+
hasToAddEmptyoption(opts) {
|
|
2578
|
+
return !this.suppressEmptyOption && !opts.filter(opt => !opt.value).length;
|
|
2579
|
+
}
|
|
2579
2580
|
getMaxWidthValue() {
|
|
2580
2581
|
var _a;
|
|
2581
2582
|
if (this.showOptionValue) {
|
|
@@ -4709,7 +4710,7 @@ const buildCheckBox = (field) => {
|
|
|
4709
4710
|
return buildField(field.name, field.label, field.readOnly, field.contextName, false);
|
|
4710
4711
|
};
|
|
4711
4712
|
function buildField(fieldName, fieldLabel, readOnly, contextName, switchMode) {
|
|
4712
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
4713
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-align--middle ez-padding-horizontal--small ez-padding-bottom--large" },
|
|
4713
4714
|
h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? CheckMode.SWITCH : CheckMode.REGULAR, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName })));
|
|
4714
4715
|
}
|
|
4715
4716
|
|
|
@@ -4723,20 +4724,20 @@ const buildComboBox$1 = ({ name, label, readOnly, required, props, contextName,
|
|
|
4723
4724
|
else {
|
|
4724
4725
|
options = prop;
|
|
4725
4726
|
}
|
|
4726
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
4727
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
4727
4728
|
h("ez-combo-box", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, options: options, canShowError: canShowError })));
|
|
4728
4729
|
};
|
|
4729
4730
|
|
|
4730
4731
|
const buildDate$1 = ({ name, label, readOnly, canShowError }) => {
|
|
4731
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
4732
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
4732
4733
|
h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError })));
|
|
4733
4734
|
};
|
|
4734
4735
|
const buildTime$1 = ({ name, label, readOnly, canShowError }) => {
|
|
4735
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
4736
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
4736
4737
|
h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError })));
|
|
4737
4738
|
};
|
|
4738
4739
|
const buildDateTime$1 = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
4739
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
4740
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
4740
4741
|
h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError })));
|
|
4741
4742
|
};
|
|
4742
4743
|
|
|
@@ -4762,12 +4763,12 @@ const buildInteger$1 = ({ name, label, readOnly, contextName, canShowError }) =>
|
|
|
4762
4763
|
return buildNumeric$1(name, label, readOnly, 0, 0, contextName, canShowError);
|
|
4763
4764
|
};
|
|
4764
4765
|
function buildNumeric$1(fieldName, fieldLabel, readOnly, precision, prettyPrecision, contextName, canShowError) {
|
|
4765
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
4766
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
4766
4767
|
h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName, canShowError: canShowError })));
|
|
4767
4768
|
}
|
|
4768
4769
|
|
|
4769
4770
|
const buildSearch$1 = ({ name, label, readOnly, required, contextName, canShowError, optionLoader }) => {
|
|
4770
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
4771
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
4771
4772
|
h("ez-search", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError, optionLoader: optionLoader })));
|
|
4772
4773
|
};
|
|
4773
4774
|
|
|
@@ -4777,7 +4778,7 @@ const buildTextArea = ({ name, label, readOnly, contextName, rows, canShowError
|
|
|
4777
4778
|
};
|
|
4778
4779
|
|
|
4779
4780
|
const buildTextInput$1 = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
4780
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
4781
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
4781
4782
|
h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly, canShowError: canShowError })));
|
|
4782
4783
|
};
|
|
4783
4784
|
|
|
@@ -4837,7 +4838,7 @@ class FormItems {
|
|
|
4837
4838
|
}
|
|
4838
4839
|
}
|
|
4839
4840
|
|
|
4840
|
-
const ezFormViewCss = ".sc-ez-form-view-h{display:flex;flex-
|
|
4841
|
+
const ezFormViewCss = ".sc-ez-form-view-h{display:flex;flex-wrap:wrap;width:100%;--ez-form-view__item--min-width:220px;--ez-form-view__item--sapce-width:5px}.form-view__content.sc-ez-form-view{display:grid;grid-template-columns:repeat(auto-fill, minmax(var(--ez-form-view__item--min-width), 1fr));gap:var(--ez-form-view__item--sapce-width);width:100%}.input-full_width.sc-ez-form-view{grid-column:1 / -1;width:100%}";
|
|
4841
4842
|
|
|
4842
4843
|
const EzFormView$1 = class extends HTMLElement$1 {
|
|
4843
4844
|
constructor() {
|
|
@@ -4873,19 +4874,36 @@ const EzFormView$1 = class extends HTMLElement$1 {
|
|
|
4873
4874
|
const formItems = new FormItems(Array.from(this._element.querySelectorAll("[data-form-item]")));
|
|
4874
4875
|
this.formItemsReady.emit(formItems);
|
|
4875
4876
|
}
|
|
4877
|
+
isItemFullWidth(userInterface) {
|
|
4878
|
+
return [
|
|
4879
|
+
UserInterface.FILE,
|
|
4880
|
+
UserInterface.LONGTEXT
|
|
4881
|
+
].includes(userInterface);
|
|
4882
|
+
}
|
|
4883
|
+
buildFormItemElement(item, classItem = "") {
|
|
4884
|
+
if (this.isItemFullWidth(item.userInterface)) {
|
|
4885
|
+
classItem += " input-full_width";
|
|
4886
|
+
}
|
|
4887
|
+
return h("div", { class: classItem }, fieldBuilder(item));
|
|
4888
|
+
}
|
|
4876
4889
|
render() {
|
|
4877
4890
|
ElementIDUtils.addIDInfoIfNotExists(this._element, 'ezFormView');
|
|
4878
4891
|
if (this.fields == undefined) {
|
|
4879
4892
|
return;
|
|
4880
4893
|
}
|
|
4881
|
-
|
|
4894
|
+
let nonArrayGrup = [];
|
|
4895
|
+
let formContent = Array.from(this.groupFields(this.fields).entries()).map(([label, value]) => {
|
|
4882
4896
|
if (Array.isArray(value)) {
|
|
4883
|
-
return (h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, value.map(fi =>
|
|
4897
|
+
return (h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, h("div", { class: "form-view__content" }, value.map(fi => (this.buildFormItemElement(fi))))));
|
|
4884
4898
|
}
|
|
4885
4899
|
else {
|
|
4886
|
-
|
|
4900
|
+
nonArrayGrup.push(value);
|
|
4887
4901
|
}
|
|
4888
|
-
})
|
|
4902
|
+
});
|
|
4903
|
+
// Filtra os elementos que não são arrays e os coloca dentro de uma única div
|
|
4904
|
+
let nonArrayElements = nonArrayGrup.map((value) => this.buildFormItemElement(value));
|
|
4905
|
+
let groupedNonArrayElements = h("div", { class: "form-view__content" }, nonArrayElements);
|
|
4906
|
+
return (h(Host, null, groupedNonArrayElements, formContent));
|
|
4889
4907
|
}
|
|
4890
4908
|
get _element() { return this; }
|
|
4891
4909
|
static get style() { return ezFormViewCss; }
|
|
@@ -125135,7 +125153,7 @@ class AgGridController {
|
|
|
125135
125153
|
showColumnFilter: (leftPosition) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name), fromIcon: true }),
|
|
125136
125154
|
},
|
|
125137
125155
|
valueFormatter: params => {
|
|
125138
|
-
if (params.value
|
|
125156
|
+
if (params.value === undefined) {
|
|
125139
125157
|
return "";
|
|
125140
125158
|
}
|
|
125141
125159
|
if (params.value instanceof Promise) {
|
|
@@ -218,14 +218,15 @@ const EzComboBox = class {
|
|
|
218
218
|
const upperCriteria = this._criteria.toUpperCase();
|
|
219
219
|
opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(upperCriteria) > -1);
|
|
220
220
|
}
|
|
221
|
-
if (this.
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
this._visibleOptions = [{ value: undefined, label: "" }].concat(opts);
|
|
221
|
+
if (this.hasToAddEmptyoption(opts)) {
|
|
222
|
+
opts = [{ value: undefined, label: "" }].concat(opts);
|
|
226
223
|
}
|
|
224
|
+
this._visibleOptions = opts;
|
|
227
225
|
this._maxWidthValue = this.getMaxWidthValue();
|
|
228
226
|
}
|
|
227
|
+
hasToAddEmptyoption(opts) {
|
|
228
|
+
return !this.suppressEmptyOption && !opts.filter(opt => !opt.value).length;
|
|
229
|
+
}
|
|
229
230
|
getMaxWidthValue() {
|
|
230
231
|
var _a;
|
|
231
232
|
if (this.showOptionValue) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, r as registerInstance, c as createEvent,
|
|
1
|
+
import { h, r as registerInstance, c as createEvent, g as getElement, H as Host } from './index-baa5e267.js';
|
|
2
2
|
import { ObjectUtils, UserInterface, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { R as REQUIRED_INFO } from './constants-4e0d35b7.js';
|
|
4
4
|
import { C as CheckMode } from './CheckMode-bdb2ec19.js';
|
|
@@ -10,7 +10,7 @@ const buildCheckBox = (field) => {
|
|
|
10
10
|
return buildField(field.name, field.label, field.readOnly, field.contextName, false);
|
|
11
11
|
};
|
|
12
12
|
function buildField(fieldName, fieldLabel, readOnly, contextName, switchMode) {
|
|
13
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
13
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-align--middle ez-padding-horizontal--small ez-padding-bottom--large" },
|
|
14
14
|
h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? CheckMode.SWITCH : CheckMode.REGULAR, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName })));
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -24,20 +24,20 @@ const buildComboBox = ({ name, label, readOnly, required, props, contextName, ca
|
|
|
24
24
|
else {
|
|
25
25
|
options = prop;
|
|
26
26
|
}
|
|
27
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
27
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
28
28
|
h("ez-combo-box", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, options: options, canShowError: canShowError })));
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const buildDate = ({ name, label, readOnly, canShowError }) => {
|
|
32
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
32
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
33
33
|
h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError })));
|
|
34
34
|
};
|
|
35
35
|
const buildTime = ({ name, label, readOnly, canShowError }) => {
|
|
36
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
36
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
37
37
|
h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError })));
|
|
38
38
|
};
|
|
39
39
|
const buildDateTime = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
40
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
40
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
41
41
|
h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError })));
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -63,12 +63,12 @@ const buildInteger = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
|
63
63
|
return buildNumeric(name, label, readOnly, 0, 0, contextName, canShowError);
|
|
64
64
|
};
|
|
65
65
|
function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecision, contextName, canShowError) {
|
|
66
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
66
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
67
67
|
h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName, canShowError: canShowError })));
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
const buildSearch = ({ name, label, readOnly, required, contextName, canShowError, optionLoader }) => {
|
|
71
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
71
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
72
72
|
h("ez-search", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError, optionLoader: optionLoader })));
|
|
73
73
|
};
|
|
74
74
|
|
|
@@ -78,7 +78,7 @@ const buildTextArea = ({ name, label, readOnly, contextName, rows, canShowError
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
const buildTextInput = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
81
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
81
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
82
82
|
h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly, canShowError: canShowError })));
|
|
83
83
|
};
|
|
84
84
|
|
|
@@ -138,7 +138,7 @@ class FormItems {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
const ezFormViewCss = ".sc-ez-form-view-h{display:flex;flex-
|
|
141
|
+
const ezFormViewCss = ".sc-ez-form-view-h{display:flex;flex-wrap:wrap;width:100%;--ez-form-view__item--min-width:220px;--ez-form-view__item--sapce-width:5px}.form-view__content.sc-ez-form-view{display:grid;grid-template-columns:repeat(auto-fill, minmax(var(--ez-form-view__item--min-width), 1fr));gap:var(--ez-form-view__item--sapce-width);width:100%}.input-full_width.sc-ez-form-view{grid-column:1 / -1;width:100%}";
|
|
142
142
|
|
|
143
143
|
const EzFormView = class {
|
|
144
144
|
constructor(hostRef) {
|
|
@@ -173,19 +173,36 @@ const EzFormView = class {
|
|
|
173
173
|
const formItems = new FormItems(Array.from(this._element.querySelectorAll("[data-form-item]")));
|
|
174
174
|
this.formItemsReady.emit(formItems);
|
|
175
175
|
}
|
|
176
|
+
isItemFullWidth(userInterface) {
|
|
177
|
+
return [
|
|
178
|
+
UserInterface.FILE,
|
|
179
|
+
UserInterface.LONGTEXT
|
|
180
|
+
].includes(userInterface);
|
|
181
|
+
}
|
|
182
|
+
buildFormItemElement(item, classItem = "") {
|
|
183
|
+
if (this.isItemFullWidth(item.userInterface)) {
|
|
184
|
+
classItem += " input-full_width";
|
|
185
|
+
}
|
|
186
|
+
return h("div", { class: classItem }, fieldBuilder(item));
|
|
187
|
+
}
|
|
176
188
|
render() {
|
|
177
189
|
ElementIDUtils.addIDInfoIfNotExists(this._element, 'ezFormView');
|
|
178
190
|
if (this.fields == undefined) {
|
|
179
191
|
return;
|
|
180
192
|
}
|
|
181
|
-
|
|
193
|
+
let nonArrayGrup = [];
|
|
194
|
+
let formContent = Array.from(this.groupFields(this.fields).entries()).map(([label, value]) => {
|
|
182
195
|
if (Array.isArray(value)) {
|
|
183
|
-
return (h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, value.map(fi =>
|
|
196
|
+
return (h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, h("div", { class: "form-view__content" }, value.map(fi => (this.buildFormItemElement(fi))))));
|
|
184
197
|
}
|
|
185
198
|
else {
|
|
186
|
-
|
|
199
|
+
nonArrayGrup.push(value);
|
|
187
200
|
}
|
|
188
|
-
})
|
|
201
|
+
});
|
|
202
|
+
// Filtra os elementos que não são arrays e os coloca dentro de uma única div
|
|
203
|
+
let nonArrayElements = nonArrayGrup.map((value) => this.buildFormItemElement(value));
|
|
204
|
+
let groupedNonArrayElements = h("div", { class: "form-view__content" }, nonArrayElements);
|
|
205
|
+
return (h(Host, null, groupedNonArrayElements, formContent));
|
|
189
206
|
}
|
|
190
207
|
get _element() { return getElement(this); }
|
|
191
208
|
};
|
|
@@ -120251,7 +120251,7 @@ class AgGridController {
|
|
|
120251
120251
|
showColumnFilter: (leftPosition) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name), fromIcon: true }),
|
|
120252
120252
|
},
|
|
120253
120253
|
valueFormatter: params => {
|
|
120254
|
-
if (params.value
|
|
120254
|
+
if (params.value === undefined) {
|
|
120255
120255
|
return "";
|
|
120256
120256
|
}
|
|
120257
120257
|
if (params.value instanceof Promise) {
|