@sankhyalabs/ezui 1.1.75 → 1.1.78
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/ApplicationUtils-d1c1db56.js +35 -0
- package/dist/cjs/AssetsUtils-dd585fba.js +24 -0
- package/dist/cjs/CSSVarsUtils-66e86394.js +18 -0
- package/dist/cjs/DataUnit-fdd7c70e.js +474 -0
- package/dist/cjs/DateUtils-716769e0.js +46 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +26 -0
- package/dist/cjs/ez-button_11.cjs.entry.js +111771 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +217 -0
- package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +634 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +254 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +133 -0
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +1838 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +36 -212
- package/dist/cjs/ez-popover.cjs.entry.js +3 -3
- package/dist/cjs/ez-popup.cjs.entry.js +2 -2
- package/dist/cjs/ez-time-input.cjs.entry.js +10 -9
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +3 -3
- package/dist/cjs/form-metadata.cjs.entry.js +129 -0
- package/dist/cjs/index-40ebb2be.js +7422 -0
- package/dist/cjs/{index-4d2896bb.js → index-4e4bae01.js} +3 -5
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +8 -3
- package/dist/collection/components/ez-application/ez-application.css +3 -0
- package/dist/collection/components/ez-application/ez-application.js +35 -0
- package/dist/collection/components/ez-button/ez-button.css +78 -44
- package/dist/collection/components/ez-button/ez-button.js +36 -4
- package/dist/collection/components/ez-calendar/ez-calendar.css +70 -3
- package/dist/collection/components/ez-calendar/ez-calendar.js +173 -24
- package/dist/collection/components/ez-check/ez-check.css +78 -78
- package/dist/collection/components/ez-check/ez-check.js +3 -3
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +34 -34
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +12 -12
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +65 -54
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +5 -0
- package/dist/collection/components/ez-date-input/ez-date-input.css +17 -3
- package/dist/collection/components/ez-date-input/ez-date-input.js +3 -3
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +243 -0
- package/dist/collection/components/ez-form/ez-form.js +37 -35
- package/dist/collection/components/ez-form/store/Form.actions.js +16 -16
- package/dist/collection/components/ez-form/store/Form.reducer.js +17 -17
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +11 -11
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +12 -12
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +1 -1
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +21 -21
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +1 -1
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +9 -9
- package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +21 -0
- package/dist/collection/components/ez-grid/controller/EzGridController.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +203 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +41 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/i18n/pt-BR.js +75 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/mock/Server.js +69 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/template/HeaderColumnTemplate.js +12 -0
- package/dist/collection/components/ez-grid/ez-grid.css +15 -0
- package/dist/collection/components/ez-grid/ez-grid.js +414 -0
- package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +105 -0
- package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +354 -0
- package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +7 -0
- package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.js +66 -0
- package/dist/collection/components/ez-icon/ez-icon.css +1 -1
- package/dist/collection/components/ez-list/ez-list.css +227 -44
- package/dist/collection/components/ez-list/ez-list.js +529 -149
- package/dist/collection/components/ez-modal/ez-modal.css +4 -4
- package/dist/collection/components/ez-modal/ez-modal.js +1 -1
- package/dist/collection/components/ez-number-input/ez-number-input.css +1 -165
- package/dist/collection/components/ez-number-input/ez-number-input.js +53 -339
- package/dist/collection/components/ez-popover/ez-popover.css +10 -6
- package/dist/collection/components/ez-popup/ez-popup.css +25 -27
- package/dist/collection/components/ez-search/ez-search.js +6 -1
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +0 -1
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +3 -3
- package/dist/collection/components/ez-text-area/ez-text-area.js +1 -0
- package/dist/collection/components/ez-text-input/ez-text-input.css +60 -60
- package/dist/collection/components/ez-text-input/ez-text-input.js +17 -16
- package/dist/collection/components/ez-time-input/ez-time-input.js +3 -2
- package/dist/collection/components/ez-upload/ez-upload.js +3 -3
- package/dist/collection/components/test-du/test-du.css +3 -0
- package/dist/collection/components/test-du/test-du.js +45 -0
- package/dist/collection/servidor.js +94 -94
- package/dist/collection/utils/{Application.js → ApplicationUtils.js} +4 -4
- package/dist/collection/utils/AssetsUtils.js +19 -0
- package/dist/collection/utils/CSSVarsUtils.js +6 -6
- package/dist/custom-elements/index.d.ts +36 -6
- package/dist/custom-elements/index.js +120886 -2964
- package/dist/esm/ApplicationUtils-01280a9d.js +33 -0
- package/dist/esm/AssetsUtils-3803e935.js +22 -0
- package/dist/esm/CSSVarsUtils-aeee9825.js +16 -0
- package/dist/esm/DataUnit-1cd45202.js +464 -0
- package/dist/esm/DateUtils-0a1bbd7a.js +44 -0
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +22 -0
- package/dist/esm/ez-button_11.entry.js +111757 -0
- package/dist/esm/ez-calendar.entry.js +213 -0
- package/dist/esm/ez-collapsible-box_6.entry.js +625 -0
- package/dist/esm/ez-combo-box.entry.js +250 -0
- package/dist/esm/ez-date-time-input.entry.js +129 -0
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +1834 -0
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +36 -212
- package/dist/esm/ez-popover.entry.js +3 -3
- package/dist/esm/ez-popup.entry.js +2 -2
- package/dist/esm/ez-time-input.entry.js +5 -4
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/form-metadata.entry.js +125 -0
- package/dist/esm/{index-33153059.js → index-1dacecd3.js} +3 -6
- package/dist/esm/index-ca8700cb.js +7414 -0
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-14bee38e.entry.js +1 -0
- package/dist/ezui/p-37a611ea.js +1 -0
- package/dist/ezui/p-3a09c678.entry.js +1 -0
- package/dist/ezui/p-43c15c94.entry.js +1 -0
- package/dist/ezui/{p-34d288d0.entry.js → p-516d0e0f.entry.js} +1 -1
- package/dist/ezui/{p-0d476efb.entry.js → p-5a86e18a.entry.js} +1 -1
- package/dist/ezui/{p-47406a6e.entry.js → p-5da66d3e.entry.js} +1 -1
- package/dist/ezui/p-7107d7ef.js +1 -0
- package/dist/ezui/p-72ff3c95.entry.js +1 -0
- package/dist/ezui/p-74f978db.entry.js +369 -0
- package/dist/ezui/p-88f45a83.entry.js +1 -0
- package/dist/ezui/p-8b099482.js +1 -0
- package/dist/ezui/p-8d6cdd3e.entry.js +1 -0
- package/dist/ezui/p-8f4851a6.js +1 -0
- package/dist/ezui/p-9dfd537e.js +1 -0
- package/dist/ezui/p-a0331955.entry.js +1 -0
- package/dist/ezui/p-a15093e3.entry.js +1 -0
- package/dist/ezui/{p-8818da66.entry.js → p-a18a2d7b.entry.js} +1 -1
- package/dist/ezui/p-a19f2af3.entry.js +1 -0
- package/dist/ezui/p-c6d469fc.entry.js +1 -0
- package/dist/ezui/p-c89629eb.js +1 -0
- package/dist/ezui/p-da929c01.js +1 -0
- package/dist/ezui/p-f3c5f27e.entry.js +1 -0
- package/dist/types/components/ez-application/ez-application.d.ts +10 -0
- package/dist/types/components/ez-button/ez-button.d.ts +5 -0
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +21 -0
- package/dist/types/components/ez-check/ez-check.d.ts +1 -1
- package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +3 -3
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -0
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +42 -0
- package/dist/types/components/ez-form/ez-form.d.ts +9 -9
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +1 -1
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/DataUnitBridge.d.ts +8 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +195 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +34 -0
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/i18n/pt-BR.d.ts +2 -0
- package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +8 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +78 -0
- package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +30 -0
- package/dist/types/components/ez-grid/subcomponents/select-box/select-box.d.ts +9 -0
- package/dist/types/components/ez-list/ez-list.d.ts +70 -17
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +29 -63
- package/dist/types/components/ez-search/ez-search.d.ts +2 -0
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +1 -1
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +1 -1
- package/dist/types/components/test-du/test-du.d.ts +6 -0
- package/dist/types/components.d.ts +289 -139
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/dist/types/utils/{Application.d.ts → ApplicationUtils.d.ts} +1 -1
- package/dist/types/utils/AssetsUtils.d.ts +1 -0
- package/dist/types/utils/CSSVarsUtils.d.ts +1 -1
- package/package.json +10 -8
- package/react/components.d.ts +6 -1
- package/react/components.js +6 -1
- package/react/components.js.map +1 -1
- package/dist/cjs/CSSVarsUtils-f8827674.js +0 -18
- package/dist/cjs/RequestMetadata-2cd01e8a.js +0 -531
- package/dist/cjs/ez-button_16.cjs.entry.js +0 -4071
- package/dist/cjs/ez-list.cjs.entry.js +0 -174
- package/dist/cjs/ez-modal.cjs.entry.js +0 -65
- package/dist/collection/components/ez-numeric-input/ez-numeric-input.css +0 -13
- package/dist/collection/components/ez-numeric-input/ez-numeric-input.js +0 -185
- package/dist/esm/CSSVarsUtils-e0128b01.js +0 -16
- package/dist/esm/RequestMetadata-c265c9d5.js +0 -527
- package/dist/esm/ez-button_16.entry.js +0 -4052
- package/dist/esm/ez-list.entry.js +0 -170
- package/dist/esm/ez-modal.entry.js +0 -61
- package/dist/ezui/p-061d21ba.entry.js +0 -1
- package/dist/ezui/p-15743b09.entry.js +0 -1
- package/dist/ezui/p-46d07e59.entry.js +0 -1
- package/dist/ezui/p-4df6f855.js +0 -1
- package/dist/ezui/p-50464bdf.entry.js +0 -1
- package/dist/ezui/p-67410dfa.entry.js +0 -1
- package/dist/ezui/p-7be54779.entry.js +0 -1
- package/dist/ezui/p-7f3bc6d9.entry.js +0 -1
- package/dist/ezui/p-9dfccb16.js +0 -1
- package/dist/ezui/p-d1889704.js +0 -1
- package/dist/types/components/ez-numeric-input/ez-numeric-input.d.ts +0 -45
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { changeFieldValue, changesSaved, clearEdition, dataLoaded, dataLoading, insertRecord, nextRecord, previousRecord, recordRemoved, removingRecord, savingChanges } from
|
|
2
|
-
import { selectRecordChanges, selectCurrentRecordIndex, selectLoadingData, selectNewRecordIndex, selectDataUnitChanges, selectErrorMessage } from
|
|
3
|
-
import
|
|
1
|
+
import { changeFieldValue, changesSaved, clearEdition, dataLoaded, dataLoading, insertRecord, nextRecord, previousRecord, recordRemoved, removingRecord, savingChanges } from "../store/Form.actions";
|
|
2
|
+
import { selectRecordChanges, selectCurrentRecordIndex, selectLoadingData, selectNewRecordIndex, selectDataUnitChanges, selectErrorMessage } from "../store/Form.selectors";
|
|
3
|
+
import ApplicationUtils from "../../../utils/ApplicationUtils";
|
|
4
4
|
export default class DataUnit {
|
|
5
|
-
constructor(name, unitLabel, cardinality =
|
|
5
|
+
constructor(name, unitLabel, cardinality = "1", parentDU = null) {
|
|
6
6
|
this.name = name;
|
|
7
7
|
this.unitLabel = unitLabel;
|
|
8
8
|
this.cardinality = cardinality;
|
|
@@ -85,13 +85,13 @@ export default class DataUnit {
|
|
|
85
85
|
}, 100);
|
|
86
86
|
}
|
|
87
87
|
cancel() {
|
|
88
|
-
this.records = this.records.filter(r => !r.record__id.startsWith(
|
|
88
|
+
this.records = this.records.filter(r => !r.record__id.startsWith("NEW_"));
|
|
89
89
|
this._store.dispatch(clearEdition(this.name, this.records.length - 1));
|
|
90
90
|
}
|
|
91
91
|
insert() {
|
|
92
92
|
const insertionIndex = this.records.length;
|
|
93
93
|
const newRecordIndex = selectNewRecordIndex(this._store.getState(), this.name);
|
|
94
|
-
const newRecord = { record__id:
|
|
94
|
+
const newRecord = { record__id: "NEW_" + (newRecordIndex + 1) };
|
|
95
95
|
this.bindToParent(newRecord);
|
|
96
96
|
this.records.push(newRecord);
|
|
97
97
|
this._store.dispatch(insertRecord(this.name, insertionIndex));
|
|
@@ -113,7 +113,7 @@ export default class DataUnit {
|
|
|
113
113
|
"__sub__changes": subChanges
|
|
114
114
|
};
|
|
115
115
|
if (recordChanges) {
|
|
116
|
-
Object.keys(recordChanges).forEach(fieldName => {
|
|
116
|
+
Object.keys(recordChanges).forEach(fieldName => { [fieldName] = recordChanges[fieldName]; });
|
|
117
117
|
}
|
|
118
118
|
return change;
|
|
119
119
|
}
|
|
@@ -157,7 +157,7 @@ export default class DataUnit {
|
|
|
157
157
|
.then(r => this.processSaveResult(r))
|
|
158
158
|
.catch(e => {
|
|
159
159
|
this._store.dispatch(dataLoaded(this.name));
|
|
160
|
-
|
|
160
|
+
ApplicationUtils.error("Falha ao tentar salvar", e);
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
else {
|
|
@@ -204,7 +204,7 @@ export default class DataUnit {
|
|
|
204
204
|
}
|
|
205
205
|
else {
|
|
206
206
|
if (result.__data__unit === this.name) {
|
|
207
|
-
if (this.cardinality ===
|
|
207
|
+
if (this.cardinality === "1") {
|
|
208
208
|
this.records = [this.buildRecordFromSaveResult(this.records[0], result)];
|
|
209
209
|
}
|
|
210
210
|
else {
|
|
@@ -218,7 +218,7 @@ export default class DataUnit {
|
|
|
218
218
|
this._store.dispatch(changesSaved(this.name));
|
|
219
219
|
}
|
|
220
220
|
buildRecordFromSaveResult(baseRecord, saveResult) {
|
|
221
|
-
const newRecord = baseRecord ? Object.assign({}, baseRecord) : { record__id:
|
|
221
|
+
const newRecord = baseRecord ? Object.assign({}, baseRecord) : { record__id: "" };
|
|
222
222
|
Object.keys(saveResult).forEach(attrib => {
|
|
223
223
|
if (!attrib.startsWith("__")) {
|
|
224
224
|
newRecord[attrib] = saveResult[attrib];
|
|
@@ -282,7 +282,7 @@ export default class DataUnit {
|
|
|
282
282
|
});
|
|
283
283
|
const result = this.recordsValidator.validateRecords(this, recordsToValidate, triggedBy);
|
|
284
284
|
if (result.message) {
|
|
285
|
-
|
|
285
|
+
ApplicationUtils.info(result.message);
|
|
286
286
|
}
|
|
287
287
|
return result.isValid;
|
|
288
288
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Component, Host, h, Element, Prop } from
|
|
2
|
-
import DataUnit from
|
|
1
|
+
import { Component, Host, h, Element, Prop } from "@stencil/core";
|
|
2
|
+
import DataUnit from "./DataUnit";
|
|
3
3
|
export class FormMetadata {
|
|
4
4
|
buildField(element) {
|
|
5
5
|
let label = element.getAttribute("label");
|
|
@@ -11,7 +11,7 @@ export class FormMetadata {
|
|
|
11
11
|
label = "Selecione uma das opções:";
|
|
12
12
|
}
|
|
13
13
|
const objOpts = {};
|
|
14
|
-
Array.from(element.getElementsByTagName(
|
|
14
|
+
Array.from(element.getElementsByTagName("OPTION")).forEach((optElem, index) => {
|
|
15
15
|
const optValue = optElem.getAttribute("value") || index;
|
|
16
16
|
const optLabel = optElem.textContent;
|
|
17
17
|
objOpts[optValue] = optLabel;
|
|
@@ -19,15 +19,15 @@ export class FormMetadata {
|
|
|
19
19
|
properties.push({ name: "options", value: JSON.stringify(objOpts) });
|
|
20
20
|
}
|
|
21
21
|
else if (userInterface === "FILE") {
|
|
22
|
-
const urlElement = element.querySelector(
|
|
23
|
-
const headersElement = element.querySelectorAll(
|
|
22
|
+
const urlElement = element.querySelector("URL");
|
|
23
|
+
const headersElement = element.querySelectorAll("HEADERS>HEADER");
|
|
24
24
|
if (urlElement) {
|
|
25
25
|
properties.push({ name: "URL", value: urlElement.textContent });
|
|
26
26
|
}
|
|
27
27
|
if (headersElement && headersElement.length > 0) {
|
|
28
28
|
const headers = {};
|
|
29
29
|
headersElement.forEach(header => {
|
|
30
|
-
headers[header.getAttribute(
|
|
30
|
+
headers[header.getAttribute("name")] = header.textContent;
|
|
31
31
|
});
|
|
32
32
|
properties.push({ name: "HEADERS", value: JSON.stringify(headers) });
|
|
33
33
|
}
|
|
@@ -53,7 +53,7 @@ export class FormMetadata {
|
|
|
53
53
|
}
|
|
54
54
|
buildFieldSet(dataUnit, element) {
|
|
55
55
|
const label = element.getAttribute("label");
|
|
56
|
-
const fields = Array.from(element.getElementsByTagName(
|
|
56
|
+
const fields = Array.from(element.getElementsByTagName("FIELD")).map(f => {
|
|
57
57
|
const field = this.buildField(f);
|
|
58
58
|
dataUnit.addFieldMetadata(field);
|
|
59
59
|
return { name: field.name };
|
|
@@ -70,7 +70,7 @@ export class FormMetadata {
|
|
|
70
70
|
Array.from(elements).forEach(child => {
|
|
71
71
|
const tagName = child.tagName.toUpperCase();
|
|
72
72
|
switch (tagName) {
|
|
73
|
-
case
|
|
73
|
+
case "FIELD":
|
|
74
74
|
if (!form.items) {
|
|
75
75
|
form.items = [];
|
|
76
76
|
}
|
|
@@ -78,13 +78,13 @@ export class FormMetadata {
|
|
|
78
78
|
dataUnit.addFieldMetadata(f);
|
|
79
79
|
form.items.push({ name: f.name });
|
|
80
80
|
break;
|
|
81
|
-
case
|
|
81
|
+
case "FIELD-SET":
|
|
82
82
|
if (!form.items) {
|
|
83
83
|
form.items = [];
|
|
84
84
|
}
|
|
85
85
|
form.items.push(this.buildFieldSet(dataUnit, child));
|
|
86
86
|
break;
|
|
87
|
-
case
|
|
87
|
+
case "SUB-FORM":
|
|
88
88
|
if (!form.subForms) {
|
|
89
89
|
form.subForms = [];
|
|
90
90
|
}
|
|
@@ -93,7 +93,7 @@ export class FormMetadata {
|
|
|
93
93
|
const subDuName = child.getAttribute("dataunit");
|
|
94
94
|
let subDu;
|
|
95
95
|
if (subDuName) {
|
|
96
|
-
subDu = new DataUnit(subDuName,
|
|
96
|
+
subDu = new DataUnit(subDuName, "noname", child.hasAttribute("many") ? "N" : "1");
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
99
|
subDu = dataUnit;
|
|
@@ -108,7 +108,7 @@ export class FormMetadata {
|
|
|
108
108
|
if (!this.dataunit) {
|
|
109
109
|
this.dataunit = "dataunit_" + (this.name || this.label || new Date().getTime());
|
|
110
110
|
}
|
|
111
|
-
const du = new DataUnit(this.dataunit,
|
|
111
|
+
const du = new DataUnit(this.dataunit, "noname", this.many ? "N" : "1");
|
|
112
112
|
this.metadata = this.fromElements(this._host.children, this.label, this.name, du, this.autoload);
|
|
113
113
|
}
|
|
114
114
|
render() {
|
|
@@ -19,19 +19,19 @@ export const Field = ({ dataUnit, field, forceScroll, enabled }) => {
|
|
|
19
19
|
dataUnit.changeValue(name, newValue);
|
|
20
20
|
};
|
|
21
21
|
switch (userInterface) {
|
|
22
|
-
case
|
|
22
|
+
case "LONGTEXT":
|
|
23
23
|
return h("div", { class: "col col--sd-12 padding--small" }, loadingData ? h("place-holder", null) :
|
|
24
|
-
h("ez-text-area", { value: value ||
|
|
25
|
-
case
|
|
26
|
-
case
|
|
24
|
+
h("ez-text-area", { value: value || "", label: formattedLabel, onEzChange: evt => changeFieldHandler(evt.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key, enabled: isEnabled }));
|
|
25
|
+
case "CHECKBOX":
|
|
26
|
+
case "SWITCH":
|
|
27
27
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small align--middle padding-bottom--large" }, loadingData ? h("place-holder", null) :
|
|
28
|
-
h("ez-check", { value: value, label: label, enabled: isEnabled, mode: userInterface === "CHECKBOX" ? "regular" : "switch", onEzChange: (event) => changeFieldHandler(event.target[
|
|
29
|
-
case
|
|
30
|
-
const optsObj = properties ? JSON.parse(getProp(properties,
|
|
28
|
+
h("ez-check", { value: value, label: label, enabled: isEnabled, mode: userInterface === "CHECKBOX" ? "regular" : "switch", onEzChange: (event) => changeFieldHandler(event.target["value"]), ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
29
|
+
case "OPTIONSELECTOR":
|
|
30
|
+
const optsObj = properties ? JSON.parse(getProp(properties, "options")) : {};
|
|
31
31
|
const normalized = Object.keys(optsObj).map(key => { return { value: key, label: optsObj[key] }; });
|
|
32
32
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
33
|
-
h("ez-combo-box", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target[
|
|
34
|
-
case
|
|
33
|
+
h("ez-combo-box", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key, options: normalized }));
|
|
34
|
+
case "SEARCH":
|
|
35
35
|
const context = {
|
|
36
36
|
__MAIN_FORM: form,
|
|
37
37
|
__DATA_UNIT: dataUnit.name,
|
|
@@ -55,38 +55,38 @@ export const Field = ({ dataUnit, field, forceScroll, enabled }) => {
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
if (criteriaList.length > 0) {
|
|
58
|
-
context[
|
|
58
|
+
context["CRITERIA"] = criteriaList;
|
|
59
59
|
}
|
|
60
60
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
61
|
-
h("ez-search", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target[
|
|
61
|
+
h("ez-search", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, optionLoader: (argument) => {
|
|
62
62
|
if (form) {
|
|
63
63
|
return form.loadSearch(argument, context);
|
|
64
64
|
}
|
|
65
65
|
}, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
66
|
-
case
|
|
67
|
-
const target = getProp(properties,
|
|
68
|
-
const strHeaders = getProp(properties,
|
|
66
|
+
case "FILE":
|
|
67
|
+
const target = getProp(properties, "URL");
|
|
68
|
+
const strHeaders = getProp(properties, "HEADERS");
|
|
69
69
|
const headers = strHeaders ? JSON.parse(strHeaders) : {};
|
|
70
70
|
const maxfiles = Number(getProp(properties, "maxfiles") || 0);
|
|
71
71
|
return (h("div", { class: "col col--sd-12 padding--small" }, loadingData ? h("place-holder", null) :
|
|
72
72
|
h("ez-upload", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.detail), urlUpload: target, requestHeaders: headers, maxFiles: maxfiles })));
|
|
73
|
-
case
|
|
73
|
+
case "DATE":
|
|
74
74
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
75
|
-
h("ez-date-input", { value: !value ? null : DateUtils.clearTime(value), label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target[
|
|
76
|
-
case
|
|
77
|
-
case
|
|
75
|
+
h("ez-date-input", { value: !value ? null : DateUtils.clearTime(value), label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
76
|
+
case "DECIMALNUMBER":
|
|
77
|
+
case "INTEGERNUMBER":
|
|
78
78
|
let precision = 0;
|
|
79
79
|
let prettyPrecision = 0;
|
|
80
|
-
if (userInterface ===
|
|
80
|
+
if (userInterface === "DECIMALNUMBER") {
|
|
81
81
|
precision = Number(getProp(properties, "precision") || 2);
|
|
82
82
|
prettyPrecision = Number(getProp(properties, "prettyprecision") || precision);
|
|
83
83
|
}
|
|
84
84
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
85
|
-
h("ez-numeric-input", { value: !value ? null : value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target[
|
|
85
|
+
h("ez-numeric-input", { value: !value ? null : value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, precision: precision, prettyprecision: prettyPrecision, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
86
86
|
//IMAGE, DATETIME, ELAPSEDTIME, PASSWORD, MASKEDTEXT, HTML
|
|
87
87
|
default:
|
|
88
88
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
89
|
-
h("ez-text-input", { value: value, label: formattedLabel, enabled: isEnabled, loading: loadingData, onInput: (event) => changeFieldHandler(event.target[
|
|
89
|
+
h("ez-text-input", { value: value, label: formattedLabel, enabled: isEnabled, loading: loadingData, onInput: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
function getProp(properties, name) {
|
|
@@ -33,7 +33,7 @@ export const FormSheet = ({ store, parentName, source, parentDataUnit, dataUnitB
|
|
|
33
33
|
buttons.previousVisible = false;
|
|
34
34
|
}
|
|
35
35
|
return h("div", { class: "form-sheet" },
|
|
36
|
-
tabs ? h("ez-tabselector", { selectedIndex: selectedTab, selectedTab: name,
|
|
36
|
+
tabs ? h("ez-tabselector", { selectedIndex: selectedTab, selectedTab: name, onEzChange: (evt) => changeTabHandler(evt.target.selectedindex) }, tabs) : null,
|
|
37
37
|
dataUnit ? h(NavigationBar, { enabled: enabled, dataUnit: dataUnit, buttonProps: buttons }) : null,
|
|
38
38
|
h("div", { class: "tab__container" },
|
|
39
39
|
items ? items.map(item => buildFormItem(item, name, store, currentDU, enabled)) : null,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import
|
|
2
|
+
import ApplicationUtils from "../../../../utils/ApplicationUtils";
|
|
3
3
|
function removeHandler(dataUnit) {
|
|
4
|
-
|
|
4
|
+
ApplicationUtils.confirm("Exclusão de registro", "Tem certeza que deseja Remover?", null, true).then(ok => {
|
|
5
5
|
if (ok) {
|
|
6
6
|
dataUnit.remove();
|
|
7
7
|
}
|
|
@@ -23,13 +23,13 @@ export const NavigationBar = ({ dataUnit: du, buttonProps, enabled }) => {
|
|
|
23
23
|
|| buttonProps.cancelVisible
|
|
24
24
|
|| buttonProps.reloadVisible) {
|
|
25
25
|
return h("div", { class: "col col--sd-12 align--right" },
|
|
26
|
-
buttonProps.previousVisible ? h("ez-button", { key: du.name +
|
|
27
|
-
buttonProps.nextVisible ? h("ez-button", { key: du.name +
|
|
28
|
-
buttonProps.removeVisible ? h("ez-button", { key: du.name +
|
|
29
|
-
buttonProps.addVisible ? h("ez-button", { key: du.name +
|
|
30
|
-
buttonProps.reloadVisible ? h("ez-button", { key: du.name +
|
|
31
|
-
buttonProps.cancelVisible ? h("ez-button", { key: du.name +
|
|
32
|
-
buttonProps.saveVisible ? h("ez-button", { key: du.name +
|
|
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
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
return null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from "@sankhyalabs/core";
|
|
2
|
+
export default class DataUnitBridge {
|
|
3
|
+
constructor(gridController, dataUnit) {
|
|
4
|
+
this._gridController = gridController;
|
|
5
|
+
this._dataUnit = dataUnit;
|
|
6
|
+
this._dataUnit.subscribe(action => this.processAction(action));
|
|
7
|
+
}
|
|
8
|
+
processAction(action) {
|
|
9
|
+
switch (action.type) {
|
|
10
|
+
case Action.METADATA_LOADED:
|
|
11
|
+
const columnDefs = [];
|
|
12
|
+
this._dataUnit.metadata.fields.forEach(f => {
|
|
13
|
+
if (f.visible !== false) {
|
|
14
|
+
columnDefs.push({ label: f.label, name: f.name });
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
this._gridController.setColumnsDef(columnDefs, true);
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { Grid as EnterpriseGrid } from "ag-grid-enterprise";
|
|
2
|
+
import { Grid } from "ag-grid-community";
|
|
3
|
+
import gridTerms from "./i18n/pt-BR.js";
|
|
4
|
+
import HeaderColumnTemplate from "./template/HeaderColumnTemplate.js";
|
|
5
|
+
import DataSource from "./DataSource";
|
|
6
|
+
export default class AgGridController {
|
|
7
|
+
constructor(enterprise) {
|
|
8
|
+
this._menuItems = [];
|
|
9
|
+
this._enterprise = enterprise;
|
|
10
|
+
}
|
|
11
|
+
initDatagrid(container, options) {
|
|
12
|
+
if (this._grid === undefined) {
|
|
13
|
+
this._columnStateChangeCallback = options.onColumnStateChange;
|
|
14
|
+
this._selectionChangeCallback = options.onSelectionChange;
|
|
15
|
+
this._paginationChangeCallback = options.onPaginationChange;
|
|
16
|
+
this._multipleSelection = options.allowMultipleSelection;
|
|
17
|
+
this._pageSize = options.pageSize;
|
|
18
|
+
this._serverURL = options.serverURL;
|
|
19
|
+
this._dataUnit = options.dataUnit;
|
|
20
|
+
this._gridOptions = {
|
|
21
|
+
localeText: gridTerms,
|
|
22
|
+
rowModelType: "serverSide",
|
|
23
|
+
serverSideStoreType: "partial",
|
|
24
|
+
rowSelection: this._multipleSelection ? "multiple" : "single",
|
|
25
|
+
serverSideDatasource: new DataSource(this._dataUnit, this._serverURL),
|
|
26
|
+
getMainMenuItems: (params) => {
|
|
27
|
+
const column = params.column;
|
|
28
|
+
const items = [column.isPinned() ? "clearPinned" : "pinLeft", "separator"];
|
|
29
|
+
this._menuItems.forEach(m => items.push({
|
|
30
|
+
name: m.label,
|
|
31
|
+
action: () => m.action(column.getColId(), m.name)
|
|
32
|
+
}));
|
|
33
|
+
return items;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
this.setOptionsEvents(this._gridOptions);
|
|
37
|
+
this.setOptionsPagination(this._gridOptions);
|
|
38
|
+
this.setOptionsSupress(this._gridOptions);
|
|
39
|
+
if (this._enterprise) {
|
|
40
|
+
this._grid = new EnterpriseGrid(container, this._gridOptions);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this._grid = new Grid(container, this._gridOptions);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
setOptionsEvents(opt) {
|
|
48
|
+
opt.onSortChanged = e => this.onCallStateChange("sort", e);
|
|
49
|
+
opt.onColumnResized = e => this.onCallStateChange("columnResize", e);
|
|
50
|
+
opt.onColumnPinned = e => this.onCallStateChange("columnPinned", e);
|
|
51
|
+
opt.onColumnMoved = e => this.onCallStateChange("columnMoved", e);
|
|
52
|
+
opt.onColumnVisible = e => this.onCallStateChange("visibleChange", e);
|
|
53
|
+
opt.onSelectionChanged = e => this.onSelectionChange(e);
|
|
54
|
+
opt.onPaginationChanged = () => this.onPaginationChange();
|
|
55
|
+
}
|
|
56
|
+
setOptionsPagination(opt) {
|
|
57
|
+
opt.pagination = (this._pageSize > -1);
|
|
58
|
+
opt.paginationPageSize = this._pageSize;
|
|
59
|
+
opt.cacheBlockSize = this._pageSize;
|
|
60
|
+
}
|
|
61
|
+
setOptionsSupress(opt) {
|
|
62
|
+
opt.suppressDragLeaveHidesColumns = true;
|
|
63
|
+
opt.suppressPaginationPanel = true;
|
|
64
|
+
opt.suppressMenuHide = true;
|
|
65
|
+
}
|
|
66
|
+
setData(data) {
|
|
67
|
+
if (this._grid === undefined) {
|
|
68
|
+
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
69
|
+
}
|
|
70
|
+
this._gridOptions.api.setRowData(data);
|
|
71
|
+
}
|
|
72
|
+
setColumnsDef(cols, showCheckSelection) {
|
|
73
|
+
if (this._grid === undefined) {
|
|
74
|
+
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
75
|
+
}
|
|
76
|
+
const colDefs = [];
|
|
77
|
+
if (showCheckSelection) {
|
|
78
|
+
colDefs.push({
|
|
79
|
+
headerName: "",
|
|
80
|
+
checkboxSelection: true,
|
|
81
|
+
headerCheckboxSelection: false,
|
|
82
|
+
width: 100,
|
|
83
|
+
suppressMovable: true
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
cols.forEach(c => {
|
|
87
|
+
colDefs.push(this.buildColDef(c));
|
|
88
|
+
});
|
|
89
|
+
this._gridOptions.api.setColumnDefs(colDefs);
|
|
90
|
+
}
|
|
91
|
+
getColumnsDef() {
|
|
92
|
+
if (this._grid === undefined) {
|
|
93
|
+
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
94
|
+
}
|
|
95
|
+
const colDef = this._gridOptions.columnApi.getAllColumns();
|
|
96
|
+
return colDef.map(c => {
|
|
97
|
+
const def = c.getColDef();
|
|
98
|
+
const colDef = { name: def.field, label: def.headerName };
|
|
99
|
+
this.conditionalSet(colDef, "sortable", def.sortable);
|
|
100
|
+
this.conditionalSet(colDef, "resizable", def.resizable);
|
|
101
|
+
this.conditionalSet(colDef, "sort", def.sort);
|
|
102
|
+
this.conditionalSet(colDef, "sortIndex", def.sortIndex);
|
|
103
|
+
this.conditionalSet(colDef, "width", def.width);
|
|
104
|
+
this.conditionalSet(colDef, "pinned", def.pinned !== null);
|
|
105
|
+
this.conditionalSet(colDef, "hidden", def.hide);
|
|
106
|
+
return colDef;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
setColumnsState(state) {
|
|
110
|
+
if (this._grid === undefined) {
|
|
111
|
+
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
112
|
+
}
|
|
113
|
+
this._gridOptions.columnApi.applyColumnState({ state: state.map(s => this.buildColState(s)) });
|
|
114
|
+
}
|
|
115
|
+
getColumnsState() {
|
|
116
|
+
if (this._grid === undefined) {
|
|
117
|
+
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
118
|
+
}
|
|
119
|
+
const colState = this._gridOptions.columnApi.getColumnState();
|
|
120
|
+
return colState.map(s => {
|
|
121
|
+
const def = this._gridOptions.columnApi.getColumn(s.colId).getColDef();
|
|
122
|
+
const label = def.headerName;
|
|
123
|
+
const name = def.checkboxSelection ? "__SELECTION__" : s.colId;
|
|
124
|
+
const colState = { label, name };
|
|
125
|
+
this.conditionalSet(colState, "sort", s.sort);
|
|
126
|
+
this.conditionalSet(colState, "sortIndex", s.sortIndex);
|
|
127
|
+
this.conditionalSet(colState, "width", s.width);
|
|
128
|
+
this.conditionalSet(colState, "pinned", s.pinned !== null);
|
|
129
|
+
this.conditionalSet(colState, "hidden", s.hide);
|
|
130
|
+
return colState;
|
|
131
|
+
}).filter(c => c.name !== "__SELECTION__");
|
|
132
|
+
}
|
|
133
|
+
getSelection() {
|
|
134
|
+
return this._gridOptions.api.getSelectedRows();
|
|
135
|
+
}
|
|
136
|
+
addColumnMenuItem(item) {
|
|
137
|
+
this._menuItems.push(item);
|
|
138
|
+
}
|
|
139
|
+
nextPage() {
|
|
140
|
+
this._gridOptions.api.paginationGoToNextPage();
|
|
141
|
+
}
|
|
142
|
+
previousPage() {
|
|
143
|
+
this._gridOptions.api.paginationGoToPreviousPage();
|
|
144
|
+
}
|
|
145
|
+
buildColDef(source) {
|
|
146
|
+
return {
|
|
147
|
+
headerName: source.label,
|
|
148
|
+
field: source.name,
|
|
149
|
+
sortable: true,
|
|
150
|
+
resizable: true,
|
|
151
|
+
headerComponentParams: {
|
|
152
|
+
template: HeaderColumnTemplate
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
buildColState(source) {
|
|
157
|
+
return {
|
|
158
|
+
colId: source.name,
|
|
159
|
+
sort: source.sort,
|
|
160
|
+
sortIndex: source.sortIndex,
|
|
161
|
+
width: source.width,
|
|
162
|
+
pinned: source.pinned ? "left" : null,
|
|
163
|
+
hide: source.hidden
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
onCallStateChange(type, e) {
|
|
167
|
+
const finished = !("finished" in e) || e["finished"];
|
|
168
|
+
if (finished && this._columnStateChangeCallback) {
|
|
169
|
+
this._columnStateChangeCallback(type, this.getColumnsState());
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
onSelectionChange(e) {
|
|
173
|
+
if (this._selectionChangeCallback) {
|
|
174
|
+
this._selectionChangeCallback(e.api.getSelectedRows());
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
onPaginationChange() {
|
|
178
|
+
if (this._paginationChangeCallback) {
|
|
179
|
+
if (this._gridOptions.api) {
|
|
180
|
+
const api = this._gridOptions.api;
|
|
181
|
+
const currentPage = api.paginationGetCurrentPage();
|
|
182
|
+
const isLastPage = api.paginationGetTotalPages() === (currentPage + 1);
|
|
183
|
+
const pageSize = api.paginationGetPageSize();
|
|
184
|
+
const totalRows = api.paginationGetRowCount();
|
|
185
|
+
const pageStart = currentPage * pageSize + 1;
|
|
186
|
+
const pageEnd = Math.min(totalRows, (currentPage + 1) * pageSize);
|
|
187
|
+
this._paginationChangeCallback({
|
|
188
|
+
hasPrevious: currentPage > 0,
|
|
189
|
+
hasNext: !isLastPage,
|
|
190
|
+
currentPage: currentPage + 1,
|
|
191
|
+
pageStart,
|
|
192
|
+
pageEnd,
|
|
193
|
+
totalRows
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
conditionalSet(host, attribute, value) {
|
|
199
|
+
if (value !== null && value !== undefined && value !== false) {
|
|
200
|
+
host[attribute] = value;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Server from "./mock/Server";
|
|
2
|
+
export default class DataSource {
|
|
3
|
+
constructor(dataUnit, serverURL) {
|
|
4
|
+
this._dataUnit = dataUnit;
|
|
5
|
+
this._serverURL = serverURL;
|
|
6
|
+
}
|
|
7
|
+
getRows(params) {
|
|
8
|
+
if (this._useMockedServer) {
|
|
9
|
+
if (this._mockedServer === undefined) {
|
|
10
|
+
this.loadData()
|
|
11
|
+
.then(data => {
|
|
12
|
+
this._mockedServer = new Server(data.rowData);
|
|
13
|
+
params.success(this._mockedServer.getData(params.request));
|
|
14
|
+
})
|
|
15
|
+
.catch(() => params.fail());
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
params.success(this._mockedServer.getData(params.request));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.loadData()
|
|
23
|
+
.then(data => params.success(data))
|
|
24
|
+
.catch(() => params.fail());
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
loadData() {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
if (this._dataUnit) {
|
|
30
|
+
this._dataUnit.loadData().then(rowData => resolve({ rowData, rowCount: rowData.length }));
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
fetch(this._serverURL)
|
|
34
|
+
.then(response => {
|
|
35
|
+
response.json().then(rowData => resolve({ rowData }));
|
|
36
|
+
})
|
|
37
|
+
.catch(() => reject());
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const gridTerms = {
|
|
2
|
+
// for filter panel
|
|
3
|
+
page: "Página",
|
|
4
|
+
more: "mais",
|
|
5
|
+
to: "para",
|
|
6
|
+
of: "de",
|
|
7
|
+
next: "Próximo",
|
|
8
|
+
last: "Último",
|
|
9
|
+
first: "Primeiro",
|
|
10
|
+
previous: "Anterior",
|
|
11
|
+
loadingOoo: "Carregar",
|
|
12
|
+
// for set filter
|
|
13
|
+
selectAll: "Selecionar tudo",
|
|
14
|
+
searchOoo: "Procurar",
|
|
15
|
+
blanks: "Vazio",
|
|
16
|
+
// for number filter and text filter
|
|
17
|
+
filterOoo: "Filtrar",
|
|
18
|
+
applyFilter: "Aplicar filtro",
|
|
19
|
+
// for number filter
|
|
20
|
+
equals: "Igual",
|
|
21
|
+
lessThan: "Menor que",
|
|
22
|
+
greaterThan: "Maior que",
|
|
23
|
+
// for text filter
|
|
24
|
+
contains: "Contém",
|
|
25
|
+
startsWith: "Começa com",
|
|
26
|
+
endsWith: "Termina com",
|
|
27
|
+
// the header of the default group column
|
|
28
|
+
group: "Grupo",
|
|
29
|
+
// tool panel
|
|
30
|
+
columns: "Colunas",
|
|
31
|
+
rowGroupColumns: "Colunas do grupo de linhas",
|
|
32
|
+
rowGroupColumnsEmptyMessage: "Colunas do grupo de linhas vazias",
|
|
33
|
+
valueColumns: "Valores das colunas",
|
|
34
|
+
pivotMode: "Modo pivô",
|
|
35
|
+
groups: "Grupos",
|
|
36
|
+
values: "Valores",
|
|
37
|
+
pivots: "Pivôs",
|
|
38
|
+
valueColumnsEmptyMessage: "Valores de colunas vazias",
|
|
39
|
+
pivotColumnsEmptyMessage: "Pivôs de colunas vazias",
|
|
40
|
+
toolPanelButton: "Botão de painel de ferramentas",
|
|
41
|
+
// other
|
|
42
|
+
noRowsToShow: "Não há registros para mostrar.",
|
|
43
|
+
// enterprise menu
|
|
44
|
+
pinColumn: "Fixar coluna",
|
|
45
|
+
valueAggregation: "Agregar valor",
|
|
46
|
+
autosizeThiscolumn: "Redimensionar esta coluna",
|
|
47
|
+
autosizeAllColumns: "Redimensionar todas colunas",
|
|
48
|
+
groupBy: "Agrupar por",
|
|
49
|
+
ungroupBy: "Desagrupar por",
|
|
50
|
+
resetColumns: "Resetar colunas",
|
|
51
|
+
expandAll: "Expandir tudo",
|
|
52
|
+
collapseAll: "Contrair tudo",
|
|
53
|
+
toolPanel: "Painel de ferramentas",
|
|
54
|
+
export: "Exportar",
|
|
55
|
+
csvExport: "Exportar para CSV",
|
|
56
|
+
excelExport: "Exportar para Excel",
|
|
57
|
+
// enterprise menu pinning
|
|
58
|
+
pinLeft: "Fixar coluna",
|
|
59
|
+
pinRight: "Fixar a direita",
|
|
60
|
+
noPin: "Desfixar coluna",
|
|
61
|
+
// enterprise menu aggregation and status panel
|
|
62
|
+
sum: "Soma",
|
|
63
|
+
min: "Mínimo",
|
|
64
|
+
max: "Máximo",
|
|
65
|
+
none: "Nenhum",
|
|
66
|
+
count: "Contagem",
|
|
67
|
+
average: "Média",
|
|
68
|
+
// standard menu
|
|
69
|
+
copy: "Copiar",
|
|
70
|
+
copyWithHeaders: "Copiar com cabeçalho",
|
|
71
|
+
ctrlC: "Ctrl+C",
|
|
72
|
+
paste: "Colar",
|
|
73
|
+
ctrlV: "Ctrl+V"
|
|
74
|
+
};
|
|
75
|
+
export default gridTerms;
|