@sankhyalabs/ezui 1.1.74 → 1.1.77
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/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 +28 -0
- package/dist/cjs/ez-button_11.cjs.entry.js +111771 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +212 -0
- package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +630 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +250 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +144 -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 +61 -190
- 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 +9 -8
- 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-262d703b.js +7442 -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 +37 -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 +132 -65
- package/dist/collection/components/ez-calendar/ez-calendar.js +180 -33
- 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 +67 -51
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +1 -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 +2 -2
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +49 -0
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +254 -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 +22 -22
- 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 +7 -162
- package/dist/collection/components/ez-number-input/ez-number-input.js +90 -281
- 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-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.css +41 -41
- package/dist/collection/components/ez-upload/ez-upload.js +55 -52
- 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/custom-elements/index.d.ts +36 -6
- package/dist/custom-elements/index.js +121017 -3022
- package/dist/esm/ApplicationUtils-01280a9d.js +33 -0
- package/dist/esm/AssetsUtils-3803e935.js +22 -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 +24 -0
- package/dist/esm/ez-button_11.entry.js +111757 -0
- package/dist/esm/ez-calendar.entry.js +208 -0
- package/dist/esm/ez-collapsible-box_6.entry.js +621 -0
- package/dist/esm/ez-combo-box.entry.js +246 -0
- package/dist/esm/ez-date-time-input.entry.js +140 -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 +61 -190
- 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 +4 -3
- 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-cfd5e193.js +7433 -0
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-1ea8187e.entry.js +369 -0
- package/dist/ezui/p-37a611ea.js +1 -0
- package/dist/ezui/p-45689464.entry.js +1 -0
- package/dist/ezui/{p-34d288d0.entry.js → p-516d0e0f.entry.js} +1 -1
- package/dist/ezui/p-57291f97.entry.js +1 -0
- 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-69416bec.entry.js +1 -0
- package/dist/ezui/p-7107d7ef.js +1 -0
- package/dist/ezui/p-7ef97c5f.entry.js +1 -0
- package/dist/ezui/p-88f45a83.entry.js +1 -0
- package/dist/ezui/p-8c51a6aa.entry.js +1 -0
- package/dist/ezui/p-8f4851a6.js +1 -0
- package/dist/ezui/p-9dfd537e.js +1 -0
- package/dist/ezui/{p-8818da66.entry.js → p-a18a2d7b.entry.js} +1 -1
- package/dist/ezui/p-a223eed8.entry.js +1 -0
- package/dist/ezui/p-b36308e7.js +1 -0
- package/dist/ezui/p-c0af195b.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-e7ee2836.entry.js +1 -0
- package/dist/ezui/p-f7b835cf.entry.js +1 -0
- package/dist/types/components/ez-application/ez-application.d.ts +12 -0
- package/dist/types/components/ez-button/ez-button.d.ts +5 -0
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +25 -1
- 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-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 +33 -50
- 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/ez-upload/ez-upload.d.ts +10 -7
- package/dist/types/components/test-du/test-du.d.ts +6 -0
- package/dist/types/components.d.ts +321 -149
- 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/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/RequestMetadata-2cd01e8a.js +0 -531
- package/dist/cjs/ez-button_16.cjs.entry.js +0 -4065
- 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/RequestMetadata-c265c9d5.js +0 -527
- package/dist/esm/ez-button_16.entry.js +0 -4046
- 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-25953d44.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-7f3bc6d9.entry.js +0 -1
- package/dist/ezui/p-907de194.entry.js +0 -1
- package/dist/ezui/p-9dfccb16.js +0 -1
- package/dist/types/components/ez-numeric-input/ez-numeric-input.d.ts +0 -45
|
@@ -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;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export default class Server {
|
|
2
|
+
constructor(data) {
|
|
3
|
+
this._data = data;
|
|
4
|
+
}
|
|
5
|
+
getData(request) {
|
|
6
|
+
const finalArray = this.sort(this.filter(this._data, request), request);
|
|
7
|
+
return { rowData: finalArray.slice(request.startRow, request.endRow), rowCount: finalArray.length };
|
|
8
|
+
}
|
|
9
|
+
filter(data, _request) {
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
sort(data, _request) {
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/* alasql.options.cache = false;
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
getData: function (request) {
|
|
20
|
+
var results = executeQuery(request);
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
success: true,
|
|
24
|
+
rows: results,
|
|
25
|
+
lastRow: getLastRowIndex(request, results),
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function executeQuery(request) {
|
|
31
|
+
var sql = buildSql(request);
|
|
32
|
+
|
|
33
|
+
console.log("[FakeServer] - about to execute query:", sql);
|
|
34
|
+
|
|
35
|
+
return alasql(sql, [allData]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function buildSql(request) {
|
|
39
|
+
return "SELECT * FROM ?" + orderBySql(request) + limitSql(request);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function orderBySql(request) {
|
|
43
|
+
var sortModel = request.sortModel;
|
|
44
|
+
|
|
45
|
+
if (sortModel.length === 0) return "";
|
|
46
|
+
|
|
47
|
+
var sorts = sortModel.map(function (s) {
|
|
48
|
+
return s.colId + " " + s.sort.toUpperCase();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return " ORDER BY " + sorts.join(", ");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function limitSql(request) {
|
|
55
|
+
var blockSize = request.endRow - request.startRow;
|
|
56
|
+
|
|
57
|
+
return " LIMIT " + (blockSize + 1) + " OFFSET " + request.startRow;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function getLastRowIndex(request, results) {
|
|
61
|
+
if (!results || results.length === 0) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var currentLastRow = request.startRow + results.length;
|
|
66
|
+
|
|
67
|
+
return currentLastRow <= request.endRow ? currentLastRow : -1;
|
|
68
|
+
}
|
|
69
|
+
}*/
|
package/dist/collection/components/ez-grid/controller/ag-grid/template/HeaderColumnTemplate.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const HeaderColumnTemplate = `<div class="ag-cell-label-container" role="presentation">
|
|
2
|
+
<span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>
|
|
3
|
+
<div ref="eLabel" class="ag-header-cell-label" role="presentation" unselectable="on">
|
|
4
|
+
<span ref="eText" class="ag-header-cell-text" unselectable="on"></span>
|
|
5
|
+
<span ref="eFilter" class="ag-header-icon ag-header-label-icon ag-filter-icon" aria-hidden="true"></span>
|
|
6
|
+
<span ref="eSortAsc" class="ag-header-icon ag-header-label-icon ag-sort-ascending-icon" aria-hidden="true"></span>
|
|
7
|
+
<span ref="eSortDesc" class="ag-header-icon ag-header-label-icon ag-sort-descending-icon" aria-hidden="true"></span>
|
|
8
|
+
<span ref="eSortNone" class="ag-header-icon ag-header-label-icon ag-sort-none-icon" aria-hidden="true"></span>
|
|
9
|
+
</div>
|
|
10
|
+
</div>`;
|
|
11
|
+
|
|
12
|
+
export default HeaderColumnTemplate;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
|
|
3
|
+
/*@doc Define a cor de fundo do header do componente.*/
|
|
4
|
+
--ezgrid__header--background-color: var(--background--xlight, #FFF)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.grid__header {
|
|
8
|
+
/*private*/
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: flex-end;
|
|
11
|
+
align-items: center;
|
|
12
|
+
|
|
13
|
+
/*public*/
|
|
14
|
+
background-color: var(--ezgrid__header--background-color);
|
|
15
|
+
}
|