@sankhyalabs/ezui 1.1.119 → 1.1.122
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-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +59 -15
- package/dist/cjs/ez-grid.cjs.entry.js +45 -12
- package/dist/cjs/ez-upload.cjs.entry.js +10 -3
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/test-du.cjs.entry.js +39 -46
- package/dist/collection/components/ez-button/ez-button.css +23 -1
- package/dist/collection/components/ez-form/DataBinder.js +59 -15
- package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +27 -9
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +6 -3
- package/dist/collection/components/ez-grid/ez-grid.js +47 -0
- package/dist/collection/components/ez-upload/ez-upload.js +29 -3
- package/dist/collection/components/test-du/test-du.js +47 -48
- package/dist/custom-elements/index.js +155 -79
- package/dist/esm/ez-button.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +60 -16
- package/dist/esm/ez-grid.entry.js +45 -12
- package/dist/esm/ez-upload.entry.js +10 -3
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/test-du.entry.js +40 -47
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-68c509a7.entry.js +1 -0
- package/dist/ezui/p-8793a124.entry.js +1 -0
- package/dist/ezui/p-a6e28794.entry.js +1 -0
- package/dist/ezui/{p-3cd17150.entry.js → p-c86cd69e.entry.js} +1 -1
- package/dist/ezui/p-cdafca02.entry.js +1 -0
- package/dist/types/components/ez-form/DataBinder.d.ts +2 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +6 -2
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +5 -2
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +8 -0
- package/dist/types/components/ez-upload/ez-upload.d.ts +5 -0
- package/dist/types/components/test-du/test-du.d.ts +2 -0
- package/dist/types/components.d.ts +13 -1
- package/package.json +3 -2
- package/dist/ezui/p-126d33e2.entry.js +0 -1
- package/dist/ezui/p-1339fde7.entry.js +0 -1
- package/dist/ezui/p-73d3f767.entry.js +0 -1
- package/dist/ezui/p-c13353f1.entry.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLElement as HTMLElement$1, createEvent, h, forceUpdate, Host, getAssetPath, setAssetPath, proxyCustomElement } from '@stencil/core/internal/client';
|
|
2
2
|
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
3
|
-
import { FloatingManager, DateUtils, TimeFormatter, UserInterface,
|
|
3
|
+
import { FloatingManager, DateUtils, TimeFormatter, UserInterface, Action, ApplicationContext, DataUnitAction, DataUnit, DataType, StringUtils, NumberUtils, MaskFormatter } from '@sankhyalabs/core';
|
|
4
4
|
import { UserInterface as UserInterface$1, SortMode } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
5
5
|
|
|
6
6
|
const ezActionChipCss = ":host{--ez-action-chip--height:36px;--ez-action-chip--border-radius:var(--border--radius-large, 24px);--ez-action-chip__border:1px solid;--ez-action-chip__border-color-strokes:var(--color--strokes, #DCE0E8);--ez-action-chip--font-size:var(--text--medium, 14px);--ez-action-chip--font-family:var(--font-pattern, Arial);--ez-action-chip--font-weight:var(--text-weight--large, 500);--ez-action-chip__label--title--primary:var(--title--primary, #919191);--ez-action-chip__label-color--disable-secondary:var(--color--disable-secondary, #F2F5F8);--ez-action-chip__label__default--background-color--hover:var(--color--primary-200, #f2faf8);--ez-action-chip__label__default--border-color--hover:var(--color--primary-600, #007a5a)}.label__container{width:fit-content;display:flex;flex-wrap:wrap;position:relative;background-color:#FFFFFF;align-items:center;align-self:center;cursor:pointer;color:var(--ez-action-chip__label--title--primary);fill:var(--ez-action-chip__label--title--primary);border:var(--ez-action-chip__border);border-radius:var(--ez-action-chip--border-radius);border-color:var(--ez-action-chip__border-color-strokes);padding-right:var(--space--medium, 12px);padding-left:var(--space--medium, 12px)}.label__container:hover{border-color:var(--ez-action-chip__label__default--border-color--hover);background-color:var(--ez-action-chip__label__default--background-color--hover)}label{display:flex;align-items:center;font-weight:var(--text-weight--large, 600);cursor:pointer;height:var(--ez-action-chip--height);font-family:var(--ez-action-chip--font-family);font-size:var(--ez-action-chip--font-size)}";
|
|
@@ -45,7 +45,7 @@ let EzApplication$1 = class extends HTMLElement$1 {
|
|
|
45
45
|
static get style() { return ezApplicationCss; }
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
const ezButtonCss = ":host{--ez-button--min-width:100px;--ez-button--height:42px;--ez-button__icon--width:18px;--ez-button__inline__icon--padding:12px;--ez-button--padding-top:var(--space--medium, 12px);--ez-button--padding-bottom:var(--space--medium, 12px);--ez-button--padding-right:var(--space--large, 24px);--ez-button--padding-left:var(--space--large, 24px);--ez-button--color:var(--
|
|
48
|
+
const ezButtonCss = ":host{--ez-button--min-width:100px;--ez-button--height:42px;--ez-button__icon--width:18px;--ez-button__inline__icon--padding:12px;--ez-button--padding-top:var(--space--medium, 12px);--ez-button--padding-bottom:var(--space--medium, 12px);--ez-button--padding-right:var(--space--large, 24px);--ez-button--padding-left:var(--space--large, 24px);--ez-button--color:var(--title--primary, #FFF);--ez-button--font-size:var(--text--medium, 14px);--ez-button--font-family:var(--font-pattern, Arial);--ez-button--font-weight:var(--text-weight--large);--ez-button--background-color:var(--background--medium, #c0c0c0);--ez-button--border-radius:var(--border--radius-large, 12px);--ez-button--border:none;--ez-button--hover--background-color:var(--background--strong, var(--ez-button--background-color));--ez-button--hover-color:var(--color--primary-600);--ez-button--active--background-color:var(--background--strong, --color--primary-700);--ez-button--active-color:var(--color--primary-700);--ez-button--disabled-color:var(--text--disable);--ez-button--disabled--background-color:var(--color--disable-secondary);--ez-button--focus--border:var(--border--xlarge, 4px solid) var(--color--primary-300);--ez-button--focus--box-shadow:none;--ez-button--link-color:var(--color--primary, '#008561');--ez-button--link--hover-color:var(--color--primary-700, '#1C1D22');--ez-button--link--small--font-size:var(--text--small, 12px);--ez-button--link--medium--font-size:var(--text--medium, 14px);--ez-button--link--large--font-size:var(--text--large, 16px)}ez-icon{--ez-icon--color:inherit}button{display:flex;align-items:center;justify-content:center;margin:0;cursor:pointer;transition:background-color 0.2s linear;min-width:var(--ez-button--min-width);height:var(--ez-button--height);font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);padding:var(--ez-button--padding-top) var(--ez-button--padding-right) var(--ez-button--padding-bottom) var(--ez-button--padding-left);border-radius:var(--ez-button--border-radius);background-color:var(--ez-button--background-color);color:var(--ez-button--color);fill:var(--ez-button--color);border:var(--ez-button--border);--ez-icon--color:var(--ez-button--color)}button:hover{outline:none;color:var(--ez-button--hover-color);fill:var(--ez-button--hover-color);background-color:var(--ez-button--hover--background-color);--ez-icon--color:var(--ez-button--hover-color)}button:focus{outline:none;outline:var(--ez-button--focus--border);box-shadow:var(--ez-button--focus--box-shadow)}button:active{outline:none;box-shadow:none;background-color:var(--ez-button--active--background-color);color:var(--ez-button--active-color);fill:var(--ez-button--active-color);--ez-icon--color:var(--ez-button--active-color)}button:disabled{background-color:var(--ez-button--disabled--background-color);color:var(--ez-button--disabled-color);fill:var(--ez-button--disabled-color);--ez-icon--color:var(--ez-button--disabled-color);border:none;cursor:no-drop}button.icon{padding:0px}button.small{width:32px;min-width:32px;height:32px}button.medium{width:42px;min-width:42px;height:42px}button.large{width:52px;min-width:52px;height:52px}.label-icon{display:flex;flex-direction:column;align-items:center;color:var(--ez-button--color)}.label-icon label{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight)}a{font-family:var(--ez-button--font-family);font-weight:var(--ez-button--font-weight);color:var(--ez-button--link-color);cursor:pointer;display:flex;align-items:center;justify-content:center;}a:hover{color:var(--ez-button--link--hover-color)}a.small{font-size:var(--ez-button--link--small--font-size);line-height:var(--ez-button--link--small--font-size)}a.medium{font-size:var(--ez-button--link--medium--font-size);line-height:var(--ez-button--link--medium--font-size)}a.large{font-size:var(--ez-button--link--large--font-size);line-height:var(--ez-button--link--large--font-size)}";
|
|
49
49
|
|
|
50
50
|
let EzButton$1 = class extends HTMLElement$1 {
|
|
51
51
|
constructor() {
|
|
@@ -1179,7 +1179,7 @@ const buildSearch = ({ name, label, readOnly, required }) => {
|
|
|
1179
1179
|
|
|
1180
1180
|
const buildFile = ({ name, label, readOnly }) => {
|
|
1181
1181
|
return (h("div", { class: "col col--sd-12 padding-horizontal--small" },
|
|
1182
|
-
h("ez-upload", { enabled: !readOnly, label: label,
|
|
1182
|
+
h("ez-upload", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
1183
1183
|
};
|
|
1184
1184
|
|
|
1185
1185
|
const buildDate = ({ name, label, readOnly }) => {
|
|
@@ -1733,30 +1733,56 @@ class DataBinder {
|
|
|
1733
1733
|
constructor(dataUnit) {
|
|
1734
1734
|
this._fields = new Map();
|
|
1735
1735
|
this._dataUnit = dataUnit;
|
|
1736
|
-
this._dataUnit.subscribe(
|
|
1736
|
+
this._dataUnit.subscribe(action => {
|
|
1737
1737
|
var _a;
|
|
1738
|
-
(
|
|
1739
|
-
|
|
1740
|
-
|
|
1738
|
+
switch (action.type) {
|
|
1739
|
+
case Action.DATA_LOADED:
|
|
1740
|
+
case Action.DATA_SAVED:
|
|
1741
|
+
case Action.RECORDS_REMOVED:
|
|
1742
|
+
case Action.RECORDS_ADDED:
|
|
1743
|
+
case Action.RECORDS_COPIED:
|
|
1744
|
+
case Action.DATA_CHANGED:
|
|
1745
|
+
case Action.EDITION_CANCELED:
|
|
1746
|
+
case Action.CHANGE_UNDONE:
|
|
1747
|
+
case Action.CHANGE_REDONE:
|
|
1748
|
+
case Action.SELECTION_CHANGED:
|
|
1749
|
+
case Action.NEXT_SELECTED:
|
|
1750
|
+
case Action.PREVIOUS_SELECTED:
|
|
1751
|
+
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
1752
|
+
this.updateValue(field.fieldName, field.field);
|
|
1753
|
+
});
|
|
1754
|
+
break;
|
|
1755
|
+
}
|
|
1741
1756
|
});
|
|
1742
1757
|
}
|
|
1743
1758
|
bind(fields) {
|
|
1744
1759
|
fields.forEach(fieldElement => {
|
|
1745
1760
|
const fieldName = fieldElement.dataset.fieldName;
|
|
1746
1761
|
this.updateBind(fieldName, fieldElement);
|
|
1747
|
-
this.updateValue(fieldName, fieldElement);
|
|
1748
1762
|
});
|
|
1749
1763
|
}
|
|
1750
1764
|
updateValue(fieldName, field) {
|
|
1751
|
-
field["value"]
|
|
1765
|
+
const oldValue = field["value"];
|
|
1766
|
+
const newValue = this._dataUnit.getFieldValue(fieldName);
|
|
1767
|
+
if (oldValue != newValue) {
|
|
1768
|
+
field["value"] = newValue;
|
|
1769
|
+
}
|
|
1752
1770
|
}
|
|
1753
1771
|
updateBind(fieldName, field) {
|
|
1754
1772
|
const oldBind = this._fields.get(fieldName);
|
|
1755
1773
|
if (oldBind) {
|
|
1756
1774
|
oldBind.destroy();
|
|
1757
1775
|
}
|
|
1758
|
-
|
|
1776
|
+
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
1777
|
+
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
1759
1778
|
this.bindSearchOptionsLoader(fieldName, field);
|
|
1779
|
+
this.applyEzUploadContext(fieldName, field);
|
|
1780
|
+
}
|
|
1781
|
+
changeStarted(fieldName, waitingChange) {
|
|
1782
|
+
if (this._dataUnit.records.length === 0) {
|
|
1783
|
+
this._dataUnit.addRecord();
|
|
1784
|
+
}
|
|
1785
|
+
this._dataUnit.startChange(fieldName, waitingChange);
|
|
1760
1786
|
}
|
|
1761
1787
|
setFieldValue(fieldName, newValue) {
|
|
1762
1788
|
if (this._dataUnit.records.length === 0) {
|
|
@@ -1774,19 +1800,37 @@ class DataBinder {
|
|
|
1774
1800
|
}
|
|
1775
1801
|
}
|
|
1776
1802
|
}
|
|
1803
|
+
applyEzUploadContext(fieldName, field) {
|
|
1804
|
+
var _a, _b;
|
|
1805
|
+
if (field.nodeName === "EZ-UPLOAD") {
|
|
1806
|
+
field["urlUpload"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__ADD__URL__");
|
|
1807
|
+
field["urlDelete"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__DEL__URL__");
|
|
1808
|
+
const descriptor = this._dataUnit.getField(fieldName);
|
|
1809
|
+
const destination = (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.DESTINATION;
|
|
1810
|
+
if (destination) {
|
|
1811
|
+
field["requestHeaders"] = { XTRAINF: `{"destination": "${destination}"}` };
|
|
1812
|
+
}
|
|
1813
|
+
field["maxFiles"] = ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.MAX_FILES) || 0;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1777
1816
|
}
|
|
1778
1817
|
class Bind {
|
|
1818
|
+
constructor() {
|
|
1819
|
+
this.startChangeEventName = "ezStartChange";
|
|
1820
|
+
this.changeEventName = "ezChange";
|
|
1821
|
+
}
|
|
1779
1822
|
destroy() {
|
|
1780
|
-
this.field.removeEventListener(this.
|
|
1823
|
+
this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
|
|
1824
|
+
this.field.removeEventListener(this.changeEventName, this.changeListener);
|
|
1781
1825
|
}
|
|
1782
|
-
static create(fieldName, field,
|
|
1826
|
+
static create(fieldName, field, startChangeCallback, changeCallback) {
|
|
1783
1827
|
const b = new Bind();
|
|
1784
|
-
b.fieldName = fieldName;
|
|
1785
1828
|
b.field = field;
|
|
1786
|
-
|
|
1787
|
-
b.
|
|
1788
|
-
b.
|
|
1789
|
-
b.
|
|
1829
|
+
b.fieldName = fieldName;
|
|
1830
|
+
b.startChangeListener = (evt) => { startChangeCallback(fieldName, evt.detail); };
|
|
1831
|
+
b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
|
|
1832
|
+
b.changeListener = (evt) => { changeCallback(fieldName, evt.detail); };
|
|
1833
|
+
b.field.addEventListener(b.changeEventName, b.changeListener);
|
|
1790
1834
|
return b;
|
|
1791
1835
|
}
|
|
1792
1836
|
}
|
|
@@ -111978,15 +112022,15 @@ class DataSource {
|
|
|
111978
112022
|
}
|
|
111979
112023
|
}
|
|
111980
112024
|
else {
|
|
111981
|
-
this.loadData()
|
|
112025
|
+
this.loadData({ limit: params.api.paginationGetPageSize(), offset: params.request.startRow, quickFilter: this._quickFilterTerm })
|
|
111982
112026
|
.then(data => params.success(data))
|
|
111983
112027
|
.catch(() => params.fail());
|
|
111984
112028
|
}
|
|
111985
112029
|
}
|
|
111986
|
-
loadData() {
|
|
112030
|
+
loadData(page) {
|
|
111987
112031
|
return new Promise((resolve, reject) => {
|
|
111988
112032
|
if (this._dataUnit) {
|
|
111989
|
-
this._dataUnit.loadData().then(
|
|
112033
|
+
this._dataUnit.loadData(page).then(pageRes => resolve({ rowData: this._dataUnit.records, rowCount: pageRes.total }));
|
|
111990
112034
|
}
|
|
111991
112035
|
else {
|
|
111992
112036
|
fetch(this._serverURL)
|
|
@@ -111997,6 +112041,9 @@ class DataSource {
|
|
|
111997
112041
|
}
|
|
111998
112042
|
});
|
|
111999
112043
|
}
|
|
112044
|
+
setQuickFilter(term) {
|
|
112045
|
+
this._quickFilterTerm = term;
|
|
112046
|
+
}
|
|
112000
112047
|
}
|
|
112001
112048
|
|
|
112002
112049
|
class AgGridController {
|
|
@@ -112031,11 +112078,13 @@ class AgGridController {
|
|
|
112031
112078
|
this._serverURL = options.serverURL;
|
|
112032
112079
|
this._dataUnit = options.dataUnit;
|
|
112033
112080
|
this._dataUnit.sortingProvider = this;
|
|
112081
|
+
this._dataSource = new DataSource(this._dataUnit, this._serverURL);
|
|
112034
112082
|
this._gridOptions = {
|
|
112035
112083
|
localeText: gridTerms,
|
|
112036
112084
|
rowModelType: "serverSide",
|
|
112085
|
+
serverSideStoreType: "partial",
|
|
112037
112086
|
rowSelection: this._multipleSelection ? "multiple" : "single",
|
|
112038
|
-
serverSideDatasource:
|
|
112087
|
+
serverSideDatasource: this._dataSource,
|
|
112039
112088
|
getRowNodeId: (params) => typeof params === "string" ? params : params[this._idAttribName],
|
|
112040
112089
|
getMainMenuItems: (params) => {
|
|
112041
112090
|
const column = params.column;
|
|
@@ -112046,10 +112095,13 @@ class AgGridController {
|
|
|
112046
112095
|
}));
|
|
112047
112096
|
return items;
|
|
112048
112097
|
},
|
|
112049
|
-
|
|
112050
|
-
|
|
112051
|
-
|
|
112052
|
-
|
|
112098
|
+
getRowHeight: () => {
|
|
112099
|
+
//FIXME: Existe um bug no PartialStore.prototype.destroyAllBlocks do ag-grid, pois
|
|
112100
|
+
//apesar de destruir os blocos, mantém a variável "blockHeights" com o tamanho antigo
|
|
112101
|
+
//dos blocos, então, quando removemos uma linha, a altura do bloco não é recalculada.
|
|
112102
|
+
//Descobri que setando manualmente a altura das linhas, apesar do bloco ficar com
|
|
112103
|
+
//tamanho errado, isso afeta menos o componente.
|
|
112104
|
+
return 25;
|
|
112053
112105
|
}
|
|
112054
112106
|
};
|
|
112055
112107
|
this.setOptionsEvents(this._gridOptions);
|
|
@@ -112072,6 +112124,11 @@ class AgGridController {
|
|
|
112072
112124
|
opt.onSelectionChanged = e => this.onSelectionChange(e);
|
|
112073
112125
|
opt.onPaginationChanged = () => this.onPaginationChange();
|
|
112074
112126
|
opt.onRowDoubleClicked = evt => this.onRowDoubleClick(evt);
|
|
112127
|
+
opt.onViewportChanged = () => {
|
|
112128
|
+
if (this._dataUnit) {
|
|
112129
|
+
this.selectRows(this._dataUnit.getSelection());
|
|
112130
|
+
}
|
|
112131
|
+
};
|
|
112075
112132
|
}
|
|
112076
112133
|
setOptionsPagination(opt) {
|
|
112077
112134
|
opt.pagination = (this._pageSize > -1);
|
|
@@ -112089,11 +112146,11 @@ class AgGridController {
|
|
|
112089
112146
|
}
|
|
112090
112147
|
this._gridOptions.api.setRowData(data);
|
|
112091
112148
|
}
|
|
112092
|
-
addRows(
|
|
112149
|
+
addRows() {
|
|
112093
112150
|
if (this._grid === undefined) {
|
|
112094
112151
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
112095
112152
|
}
|
|
112096
|
-
this._gridOptions.api.
|
|
112153
|
+
this._gridOptions.api.refreshServerSideStore({});
|
|
112097
112154
|
}
|
|
112098
112155
|
selectRows(rowIds) {
|
|
112099
112156
|
if (this._grid === undefined) {
|
|
@@ -112108,11 +112165,11 @@ class AgGridController {
|
|
|
112108
112165
|
});
|
|
112109
112166
|
}
|
|
112110
112167
|
}
|
|
112111
|
-
removeRows(
|
|
112168
|
+
removeRows() {
|
|
112112
112169
|
if (this._grid === undefined) {
|
|
112113
112170
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
112114
112171
|
}
|
|
112115
|
-
this._gridOptions.api.
|
|
112172
|
+
this._gridOptions.api.refreshServerSideStore({});
|
|
112116
112173
|
}
|
|
112117
112174
|
changeValues(changes, rowIds) {
|
|
112118
112175
|
if (this._grid === undefined) {
|
|
@@ -112229,6 +112286,14 @@ class AgGridController {
|
|
|
112229
112286
|
previousPage() {
|
|
112230
112287
|
this._gridOptions.api.paginationGoToPreviousPage();
|
|
112231
112288
|
}
|
|
112289
|
+
goToPage(page) {
|
|
112290
|
+
this._gridOptions.api.paginationGoToPage(page);
|
|
112291
|
+
}
|
|
112292
|
+
quickFilter(term) {
|
|
112293
|
+
this._dataSource.setQuickFilter(term);
|
|
112294
|
+
this.goToPage(0);
|
|
112295
|
+
this._gridOptions.api.refreshServerSideStore({ purge: true });
|
|
112296
|
+
}
|
|
112232
112297
|
buildColDef(source) {
|
|
112233
112298
|
return {
|
|
112234
112299
|
headerName: source.label,
|
|
@@ -112443,6 +112508,18 @@ let EzGrid$1 = class extends HTMLElement$1 {
|
|
|
112443
112508
|
async getColumns() {
|
|
112444
112509
|
return Promise.resolve(this._gridController.getColumnsDef());
|
|
112445
112510
|
}
|
|
112511
|
+
/**
|
|
112512
|
+
* Método para recarregar pagina atual da grid.
|
|
112513
|
+
*/
|
|
112514
|
+
async refresh() {
|
|
112515
|
+
this._gridController.refresh();
|
|
112516
|
+
}
|
|
112517
|
+
/**
|
|
112518
|
+
* Método para fazer um filtro rápido na grid.
|
|
112519
|
+
*/
|
|
112520
|
+
async quickFilter(term) {
|
|
112521
|
+
this._gridController.quickFilter(term);
|
|
112522
|
+
}
|
|
112446
112523
|
componentWillLoad() {
|
|
112447
112524
|
if (this.dataUnit) {
|
|
112448
112525
|
this._dataUnitBridge = new DataUnitBridge(this._gridController, this.dataUnit);
|
|
@@ -114352,6 +114429,7 @@ let EzUpload$1 = class extends HTMLElement$1 {
|
|
|
114352
114429
|
this.__registerHost();
|
|
114353
114430
|
this.__attachShadow();
|
|
114354
114431
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
114432
|
+
this.ezStartChange = createEvent(this, "ezStartChange", 7);
|
|
114355
114433
|
this._filePointers = new Map();
|
|
114356
114434
|
/**
|
|
114357
114435
|
* Deixa o campo disponível ou não para digitação.
|
|
@@ -114359,6 +114437,9 @@ let EzUpload$1 = class extends HTMLElement$1 {
|
|
|
114359
114437
|
this.enabled = true;
|
|
114360
114438
|
}
|
|
114361
114439
|
changeValue(newValue) {
|
|
114440
|
+
//Observamos o mundo externo, se um novo valor foi atribuído,
|
|
114441
|
+
//precisamos cancelar a alteração anterior, isso envolve, percorrer
|
|
114442
|
+
//a lista de ponteiros e cancelar todos os uploads em andamento.
|
|
114362
114443
|
if (newValue !== this._updatingValue) {
|
|
114363
114444
|
this._filePointers.forEach(f => {
|
|
114364
114445
|
if (this.isRemoteFile(f)) {
|
|
@@ -114367,8 +114448,8 @@ let EzUpload$1 = class extends HTMLElement$1 {
|
|
|
114367
114448
|
});
|
|
114368
114449
|
this._filePointers = new Map();
|
|
114369
114450
|
this.updateFilePointers();
|
|
114451
|
+
this._updatingValue = undefined;
|
|
114370
114452
|
}
|
|
114371
|
-
this._updatingValue = undefined;
|
|
114372
114453
|
}
|
|
114373
114454
|
updateFilePointers() {
|
|
114374
114455
|
if (this.value) {
|
|
@@ -114438,6 +114519,7 @@ let EzUpload$1 = class extends HTMLElement$1 {
|
|
|
114438
114519
|
}
|
|
114439
114520
|
async doAddFile(file) {
|
|
114440
114521
|
if (this.validateFile(file)) {
|
|
114522
|
+
this.ezStartChange.emit({ waitmessage: "Há arquivos sendo enviados. Por favor aguarde a conclusão ou cancele o envio." });
|
|
114441
114523
|
const uploadingFile = new RemoteFile(file);
|
|
114442
114524
|
this._filePointers.set(file.name, uploadingFile);
|
|
114443
114525
|
uploadingFile.upload(this.urlUpload, this._requestHeaders, (file) => this.updateFeedback(file))
|
|
@@ -114457,8 +114539,10 @@ let EzUpload$1 = class extends HTMLElement$1 {
|
|
|
114457
114539
|
this._updatingValue.push(f);
|
|
114458
114540
|
}
|
|
114459
114541
|
});
|
|
114460
|
-
this.
|
|
114461
|
-
|
|
114542
|
+
if (this._filePointers.size === this._updatingValue.length) {
|
|
114543
|
+
this.value = this._updatingValue;
|
|
114544
|
+
this.ezChange.emit(this.value);
|
|
114545
|
+
}
|
|
114462
114546
|
}
|
|
114463
114547
|
buildProgressId(uploading) {
|
|
114464
114548
|
let sanitizedName = uploading.name.replace(/[^a-z0-9_]/gi, "_");
|
|
@@ -114877,65 +114961,57 @@ let TestDu$1 = class extends HTMLElement$1 {
|
|
|
114877
114961
|
super();
|
|
114878
114962
|
this.__registerHost();
|
|
114879
114963
|
}
|
|
114880
|
-
/*private _ezButton// : HTMLEzButton;
|
|
114881
|
-
private _ezComboBox// : HTMLEzComboBox;
|
|
114882
|
-
private _ezDateInput// : HTMLEzDateInput;
|
|
114883
|
-
private _ezDateTimeInput// : HTMLEzDateTimeInput;
|
|
114884
|
-
private _ezNumberInput// : HTMLEzNumberInput
|
|
114885
|
-
private _ezSearch// : HTMLEzSearch
|
|
114886
|
-
private _ezUpload// : HTMLEzUpload
|
|
114887
|
-
private _ezFilterInput// : HTMLEzFilterInput*/
|
|
114888
114964
|
componentWillLoad() {
|
|
114965
|
+
ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", "http://localhost:8080/mge/ez.uploading");
|
|
114889
114966
|
this.dataUnit = new DataUnit("testes_com_formulario");
|
|
114967
|
+
this.dataUnit.subscribe(() => this.isDirty = this.dataUnit.isDirty());
|
|
114890
114968
|
this.dataUnit.metadata = {
|
|
114891
114969
|
name: "dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",
|
|
114892
114970
|
label: "Parceiro",
|
|
114893
114971
|
fields: [
|
|
114894
114972
|
{
|
|
114895
|
-
name: "
|
|
114896
|
-
label: "
|
|
114897
|
-
dataType: DataType.
|
|
114898
|
-
userInterface: UserInterface.
|
|
114899
|
-
|
|
114900
|
-
|
|
114901
|
-
|
|
114902
|
-
|
|
114903
|
-
name: "RECDESP",
|
|
114904
|
-
label: "Receita/Despesa",
|
|
114905
|
-
dataType: DataType.TEXT,
|
|
114906
|
-
userInterface: UserInterface.OPTIONSELECTOR,
|
|
114907
|
-
required: true,
|
|
114908
|
-
properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
|
|
114909
|
-
},
|
|
114910
|
-
{
|
|
114911
|
-
name: "P",
|
|
114912
|
-
label: "pera",
|
|
114913
|
-
dataType: DataType.TEXT,
|
|
114914
|
-
userInterface: UserInterface.OPTIONSELECTOR,
|
|
114915
|
-
properties: { options: `{"M": "Madura", "V": "Verde", "P": "Passada"}` }
|
|
114916
|
-
},
|
|
114917
|
-
{
|
|
114918
|
-
name: "ME",
|
|
114919
|
-
label: "ME",
|
|
114920
|
-
dataType: DataType.NUMBER,
|
|
114921
|
-
userInterface: UserInterface.DECIMALNUMBER,
|
|
114922
|
-
properties: { precision: 4, prettyPrecision: 1 }
|
|
114973
|
+
name: "ANEXO",
|
|
114974
|
+
label: "Anexo",
|
|
114975
|
+
dataType: DataType.OBJECT,
|
|
114976
|
+
userInterface: UserInterface.FILE,
|
|
114977
|
+
properties: {
|
|
114978
|
+
DESTINATION: "MULTIFILE",
|
|
114979
|
+
MAX_FILES: "2"
|
|
114980
|
+
}
|
|
114923
114981
|
}
|
|
114924
114982
|
]
|
|
114925
114983
|
};
|
|
114926
|
-
this.dataUnit.dataLoader = () => new Promise(accept => accept(
|
|
114927
|
-
{
|
|
114928
|
-
|
|
114929
|
-
|
|
114930
|
-
|
|
114931
|
-
|
|
114932
|
-
|
|
114933
|
-
|
|
114984
|
+
this.dataUnit.dataLoader = () => new Promise(accept => accept({
|
|
114985
|
+
records: [{
|
|
114986
|
+
__record__id__: "1321321321321321",
|
|
114987
|
+
CODPARC: 10,
|
|
114988
|
+
NOMEPARC: "Parceiro 10",
|
|
114989
|
+
P: "M",
|
|
114990
|
+
L: "Bagaço",
|
|
114991
|
+
LI: "Azedo"
|
|
114992
|
+
}],
|
|
114993
|
+
limit: 0,
|
|
114994
|
+
offset: 2,
|
|
114995
|
+
total: 100,
|
|
114996
|
+
hasMore: true
|
|
114997
|
+
}));
|
|
114998
|
+
this.dataUnit.saveLoader = (_dataUnit, changes) => {
|
|
114999
|
+
const savedRecords = [];
|
|
115000
|
+
changes.forEach(change => {
|
|
115001
|
+
savedRecords.push(Object.assign(Object.assign({}, change.record), change.updatingFields));
|
|
115002
|
+
});
|
|
115003
|
+
return Promise.resolve(savedRecords);
|
|
115004
|
+
};
|
|
115005
|
+
}
|
|
115006
|
+
save() {
|
|
115007
|
+
this.dataUnit.saveData().catch(e => {
|
|
115008
|
+
if (e.kind === "WAITING_CHANGE_ERROR") {
|
|
115009
|
+
ApplicationUtils.alert(`Alterando campo ${e.fieldName}`, e.message);
|
|
114934
115010
|
}
|
|
114935
|
-
|
|
115011
|
+
});
|
|
114936
115012
|
}
|
|
114937
115013
|
render() {
|
|
114938
|
-
return (h("ez-form", { dataUnit: this.dataUnit }));
|
|
115014
|
+
return (h("div", null, h("button", { onClick: () => this.dataUnit.loadData() }, "Carregar"), h("button", { onClick: () => this.save(), disabled: !this.isDirty }, "Salvar"), h("ez-form", { dataUnit: this.dataUnit })));
|
|
114939
115015
|
}
|
|
114940
115016
|
static get style() { return testDuCss; }
|
|
114941
115017
|
};
|
|
@@ -114969,7 +115045,7 @@ const EzToast = /*@__PURE__*/proxyCustomElement(EzToast$1, [1,"ez-toast",{"messa
|
|
|
114969
115045
|
const EzUpload = /*@__PURE__*/proxyCustomElement(EzUpload$1, [1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040]}]);
|
|
114970
115046
|
const GridConfig = /*@__PURE__*/proxyCustomElement(GridConfig$1, [2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]);
|
|
114971
115047
|
const SelectBox = /*@__PURE__*/proxyCustomElement(SelectBox$1, [1,"select-box",{"selectedOption":[1,"selected-option"]}]);
|
|
114972
|
-
const TestDu = /*@__PURE__*/proxyCustomElement(TestDu$1, [0,"test-du"]);
|
|
115048
|
+
const TestDu = /*@__PURE__*/proxyCustomElement(TestDu$1, [0,"test-du",{"isDirty":[32]}]);
|
|
114973
115049
|
const defineCustomElements = (opts) => {
|
|
114974
115050
|
if (typeof customElements !== 'undefined') {
|
|
114975
115051
|
[
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h } from './index-6b8bfbeb.js';
|
|
2
2
|
|
|
3
|
-
const ezButtonCss = ":host{--ez-button--min-width:100px;--ez-button--height:42px;--ez-button__icon--width:18px;--ez-button__inline__icon--padding:12px;--ez-button--padding-top:var(--space--medium, 12px);--ez-button--padding-bottom:var(--space--medium, 12px);--ez-button--padding-right:var(--space--large, 24px);--ez-button--padding-left:var(--space--large, 24px);--ez-button--color:var(--
|
|
3
|
+
const ezButtonCss = ":host{--ez-button--min-width:100px;--ez-button--height:42px;--ez-button__icon--width:18px;--ez-button__inline__icon--padding:12px;--ez-button--padding-top:var(--space--medium, 12px);--ez-button--padding-bottom:var(--space--medium, 12px);--ez-button--padding-right:var(--space--large, 24px);--ez-button--padding-left:var(--space--large, 24px);--ez-button--color:var(--title--primary, #FFF);--ez-button--font-size:var(--text--medium, 14px);--ez-button--font-family:var(--font-pattern, Arial);--ez-button--font-weight:var(--text-weight--large);--ez-button--background-color:var(--background--medium, #c0c0c0);--ez-button--border-radius:var(--border--radius-large, 12px);--ez-button--border:none;--ez-button--hover--background-color:var(--background--strong, var(--ez-button--background-color));--ez-button--hover-color:var(--color--primary-600);--ez-button--active--background-color:var(--background--strong, --color--primary-700);--ez-button--active-color:var(--color--primary-700);--ez-button--disabled-color:var(--text--disable);--ez-button--disabled--background-color:var(--color--disable-secondary);--ez-button--focus--border:var(--border--xlarge, 4px solid) var(--color--primary-300);--ez-button--focus--box-shadow:none;--ez-button--link-color:var(--color--primary, '#008561');--ez-button--link--hover-color:var(--color--primary-700, '#1C1D22');--ez-button--link--small--font-size:var(--text--small, 12px);--ez-button--link--medium--font-size:var(--text--medium, 14px);--ez-button--link--large--font-size:var(--text--large, 16px)}ez-icon{--ez-icon--color:inherit}button{display:flex;align-items:center;justify-content:center;margin:0;cursor:pointer;transition:background-color 0.2s linear;min-width:var(--ez-button--min-width);height:var(--ez-button--height);font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);padding:var(--ez-button--padding-top) var(--ez-button--padding-right) var(--ez-button--padding-bottom) var(--ez-button--padding-left);border-radius:var(--ez-button--border-radius);background-color:var(--ez-button--background-color);color:var(--ez-button--color);fill:var(--ez-button--color);border:var(--ez-button--border);--ez-icon--color:var(--ez-button--color)}button:hover{outline:none;color:var(--ez-button--hover-color);fill:var(--ez-button--hover-color);background-color:var(--ez-button--hover--background-color);--ez-icon--color:var(--ez-button--hover-color)}button:focus{outline:none;outline:var(--ez-button--focus--border);box-shadow:var(--ez-button--focus--box-shadow)}button:active{outline:none;box-shadow:none;background-color:var(--ez-button--active--background-color);color:var(--ez-button--active-color);fill:var(--ez-button--active-color);--ez-icon--color:var(--ez-button--active-color)}button:disabled{background-color:var(--ez-button--disabled--background-color);color:var(--ez-button--disabled-color);fill:var(--ez-button--disabled-color);--ez-icon--color:var(--ez-button--disabled-color);border:none;cursor:no-drop}button.icon{padding:0px}button.small{width:32px;min-width:32px;height:32px}button.medium{width:42px;min-width:42px;height:42px}button.large{width:52px;min-width:52px;height:52px}.label-icon{display:flex;flex-direction:column;align-items:center;color:var(--ez-button--color)}.label-icon label{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight)}a{font-family:var(--ez-button--font-family);font-weight:var(--ez-button--font-weight);color:var(--ez-button--link-color);cursor:pointer;display:flex;align-items:center;justify-content:center;}a:hover{color:var(--ez-button--link--hover-color)}a.small{font-size:var(--ez-button--link--small--font-size);line-height:var(--ez-button--link--small--font-size)}a.medium{font-size:var(--ez-button--link--medium--font-size);line-height:var(--ez-button--link--medium--font-size)}a.large{font-size:var(--ez-button--link--large--font-size);line-height:var(--ez-button--link--large--font-size)}";
|
|
4
4
|
|
|
5
5
|
let EzButton = class {
|
|
6
6
|
constructor(hostRef) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, r as registerInstance, f as forceUpdate, H as Host, g as getElement } from './index-6b8bfbeb.js';
|
|
2
|
-
import { UserInterface,
|
|
2
|
+
import { UserInterface, Action, ApplicationContext, DataUnitAction, DataUnit } from '@sankhyalabs/core';
|
|
3
3
|
import { A as ApplicationUtils } from './ApplicationUtils-3ca0e68d.js';
|
|
4
4
|
|
|
5
5
|
const buildTextArea = ({ name, label, readOnly }) => {
|
|
@@ -44,7 +44,7 @@ const buildSearch = ({ name, label, readOnly, required }) => {
|
|
|
44
44
|
|
|
45
45
|
const buildFile = ({ name, label, readOnly }) => {
|
|
46
46
|
return (h("div", { class: "col col--sd-12 padding-horizontal--small" },
|
|
47
|
-
h("ez-upload", { enabled: !readOnly, label: label,
|
|
47
|
+
h("ez-upload", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
const buildDate = ({ name, label, readOnly }) => {
|
|
@@ -598,30 +598,56 @@ class DataBinder {
|
|
|
598
598
|
constructor(dataUnit) {
|
|
599
599
|
this._fields = new Map();
|
|
600
600
|
this._dataUnit = dataUnit;
|
|
601
|
-
this._dataUnit.subscribe(
|
|
601
|
+
this._dataUnit.subscribe(action => {
|
|
602
602
|
var _a;
|
|
603
|
-
(
|
|
604
|
-
|
|
605
|
-
|
|
603
|
+
switch (action.type) {
|
|
604
|
+
case Action.DATA_LOADED:
|
|
605
|
+
case Action.DATA_SAVED:
|
|
606
|
+
case Action.RECORDS_REMOVED:
|
|
607
|
+
case Action.RECORDS_ADDED:
|
|
608
|
+
case Action.RECORDS_COPIED:
|
|
609
|
+
case Action.DATA_CHANGED:
|
|
610
|
+
case Action.EDITION_CANCELED:
|
|
611
|
+
case Action.CHANGE_UNDONE:
|
|
612
|
+
case Action.CHANGE_REDONE:
|
|
613
|
+
case Action.SELECTION_CHANGED:
|
|
614
|
+
case Action.NEXT_SELECTED:
|
|
615
|
+
case Action.PREVIOUS_SELECTED:
|
|
616
|
+
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
617
|
+
this.updateValue(field.fieldName, field.field);
|
|
618
|
+
});
|
|
619
|
+
break;
|
|
620
|
+
}
|
|
606
621
|
});
|
|
607
622
|
}
|
|
608
623
|
bind(fields) {
|
|
609
624
|
fields.forEach(fieldElement => {
|
|
610
625
|
const fieldName = fieldElement.dataset.fieldName;
|
|
611
626
|
this.updateBind(fieldName, fieldElement);
|
|
612
|
-
this.updateValue(fieldName, fieldElement);
|
|
613
627
|
});
|
|
614
628
|
}
|
|
615
629
|
updateValue(fieldName, field) {
|
|
616
|
-
field["value"]
|
|
630
|
+
const oldValue = field["value"];
|
|
631
|
+
const newValue = this._dataUnit.getFieldValue(fieldName);
|
|
632
|
+
if (oldValue != newValue) {
|
|
633
|
+
field["value"] = newValue;
|
|
634
|
+
}
|
|
617
635
|
}
|
|
618
636
|
updateBind(fieldName, field) {
|
|
619
637
|
const oldBind = this._fields.get(fieldName);
|
|
620
638
|
if (oldBind) {
|
|
621
639
|
oldBind.destroy();
|
|
622
640
|
}
|
|
623
|
-
|
|
641
|
+
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
642
|
+
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
624
643
|
this.bindSearchOptionsLoader(fieldName, field);
|
|
644
|
+
this.applyEzUploadContext(fieldName, field);
|
|
645
|
+
}
|
|
646
|
+
changeStarted(fieldName, waitingChange) {
|
|
647
|
+
if (this._dataUnit.records.length === 0) {
|
|
648
|
+
this._dataUnit.addRecord();
|
|
649
|
+
}
|
|
650
|
+
this._dataUnit.startChange(fieldName, waitingChange);
|
|
625
651
|
}
|
|
626
652
|
setFieldValue(fieldName, newValue) {
|
|
627
653
|
if (this._dataUnit.records.length === 0) {
|
|
@@ -639,19 +665,37 @@ class DataBinder {
|
|
|
639
665
|
}
|
|
640
666
|
}
|
|
641
667
|
}
|
|
668
|
+
applyEzUploadContext(fieldName, field) {
|
|
669
|
+
var _a, _b;
|
|
670
|
+
if (field.nodeName === "EZ-UPLOAD") {
|
|
671
|
+
field["urlUpload"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__ADD__URL__");
|
|
672
|
+
field["urlDelete"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__DEL__URL__");
|
|
673
|
+
const descriptor = this._dataUnit.getField(fieldName);
|
|
674
|
+
const destination = (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.DESTINATION;
|
|
675
|
+
if (destination) {
|
|
676
|
+
field["requestHeaders"] = { XTRAINF: `{"destination": "${destination}"}` };
|
|
677
|
+
}
|
|
678
|
+
field["maxFiles"] = ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.MAX_FILES) || 0;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
642
681
|
}
|
|
643
682
|
class Bind {
|
|
683
|
+
constructor() {
|
|
684
|
+
this.startChangeEventName = "ezStartChange";
|
|
685
|
+
this.changeEventName = "ezChange";
|
|
686
|
+
}
|
|
644
687
|
destroy() {
|
|
645
|
-
this.field.removeEventListener(this.
|
|
688
|
+
this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
|
|
689
|
+
this.field.removeEventListener(this.changeEventName, this.changeListener);
|
|
646
690
|
}
|
|
647
|
-
static create(fieldName, field,
|
|
691
|
+
static create(fieldName, field, startChangeCallback, changeCallback) {
|
|
648
692
|
const b = new Bind();
|
|
649
|
-
b.fieldName = fieldName;
|
|
650
693
|
b.field = field;
|
|
651
|
-
|
|
652
|
-
b.
|
|
653
|
-
b.
|
|
654
|
-
b.
|
|
694
|
+
b.fieldName = fieldName;
|
|
695
|
+
b.startChangeListener = (evt) => { startChangeCallback(fieldName, evt.detail); };
|
|
696
|
+
b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
|
|
697
|
+
b.changeListener = (evt) => { changeCallback(fieldName, evt.detail); };
|
|
698
|
+
b.field.addEventListener(b.changeEventName, b.changeListener);
|
|
655
699
|
return b;
|
|
656
700
|
}
|
|
657
701
|
}
|