@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-75940.1 → 0.0.0-bugfix-dev-kb-84605.0
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-card-item_2.cjs.entry.js +8 -9
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-grid.cjs.entry.js +31 -59
- package/dist/cjs/ez-list.cjs.entry.js +2 -2
- package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover-plus_3.cjs.entry.js +16 -2
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +1 -1
- package/dist/collection/components/ez-date-input/ez-date-input.js +1 -1
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +1 -1
- package/dist/collection/components/ez-grid/ez-grid.js +6 -3
- package/dist/collection/components/ez-grid/utils/ColumnFilterManager.js +7 -54
- package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +20 -4
- package/dist/collection/components/ez-list/ez-list.js +2 -2
- package/dist/collection/components/ez-modal/ez-modal.js +1 -1
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +1 -1
- package/dist/collection/components/ez-popover-plus/ez-popover-plus.js +16 -2
- package/dist/collection/components/ez-popover-plus/subcomponent/ez-popover-core.js +9 -10
- package/dist/collection/components/ez-popup/ez-popup.js +1 -1
- package/dist/collection/components/ez-search/ez-search.js +1 -1
- package/dist/custom-elements/index.js +64 -79
- package/dist/esm/ez-card-item_2.entry.js +8 -9
- package/dist/esm/ez-date-input.entry.js +1 -1
- package/dist/esm/ez-date-time-input.entry.js +1 -1
- package/dist/esm/ez-grid.entry.js +32 -60
- package/dist/esm/ez-list.entry.js +2 -2
- package/dist/esm/ez-modal-container.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-popover-plus_3.entry.js +16 -2
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-17eabf46.entry.js +1 -0
- package/dist/ezui/p-1ad6c61b.entry.js +1 -0
- package/dist/ezui/p-3195a7a7.entry.js +1 -0
- package/dist/ezui/p-af1a478e.entry.js +1 -0
- package/dist/ezui/{p-d2bc2f06.entry.js → p-bbdc3996.entry.js} +1 -1
- package/dist/ezui/p-cb1535f7.entry.js +1 -0
- package/dist/ezui/{p-664b91e8.entry.js → p-cb5cd243.entry.js} +46 -46
- package/dist/ezui/p-cd07f8be.entry.js +1 -0
- package/dist/ezui/p-e3544d23.entry.js +1 -0
- package/dist/ezui/p-f5a30e35.entry.js +1 -0
- package/dist/types/components/ez-grid/utils/ColumnFilterManager.d.ts +1 -1
- package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +3 -0
- package/dist/types/components/ez-popover-plus/ez-popover-plus.d.ts +1 -0
- package/dist/types/components/ez-popover-plus/subcomponent/ez-popover-core.d.ts +1 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/dist/ezui/p-0bffeffc.entry.js +0 -1
- package/dist/ezui/p-23b6128c.entry.js +0 -1
- package/dist/ezui/p-248d4f54.entry.js +0 -1
- package/dist/ezui/p-4e0628a7.entry.js +0 -1
- package/dist/ezui/p-84b1c99e.entry.js +0 -1
- package/dist/ezui/p-b7706b43.entry.js +0 -1
- package/dist/ezui/p-dcf3c8e5.entry.js +0 -1
- package/dist/ezui/p-e5c3ed19.entry.js +0 -1
|
@@ -1375,6 +1375,7 @@ const EzPopoverCore = class {
|
|
|
1375
1375
|
return htmlElement;
|
|
1376
1376
|
}
|
|
1377
1377
|
}
|
|
1378
|
+
return this._host;
|
|
1378
1379
|
}
|
|
1379
1380
|
return this.getElement(this.anchorElement);
|
|
1380
1381
|
}
|
|
@@ -1410,17 +1411,15 @@ const EzPopoverCore = class {
|
|
|
1410
1411
|
this.ezVisibilityChange.emit(false);
|
|
1411
1412
|
}
|
|
1412
1413
|
async openPopover() {
|
|
1413
|
-
if (!this._box) {
|
|
1414
|
+
if (!this._box || !this.opened) {
|
|
1414
1415
|
return;
|
|
1415
1416
|
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
this._box.style.visibility = 'visible';
|
|
1423
|
-
}
|
|
1417
|
+
this._box.style.display = 'flex';
|
|
1418
|
+
this._box.style.visibility = 'hidden';
|
|
1419
|
+
await this.updatePositionPopover();
|
|
1420
|
+
this.openOverlay();
|
|
1421
|
+
this.ezVisibilityChange.emit(true);
|
|
1422
|
+
this._box.style.visibility = 'visible';
|
|
1424
1423
|
}
|
|
1425
1424
|
openOverlay() {
|
|
1426
1425
|
if (!this._overlay || !this._overlayIsActive) {
|
|
@@ -65897,82 +65897,51 @@ function getElementID(sufix) {
|
|
|
65897
65897
|
};
|
|
65898
65898
|
}
|
|
65899
65899
|
|
|
65900
|
-
const COLUMN_FILTER_PATTERN = /FILTRO_COLUNA_(.+)/;
|
|
65901
65900
|
class ColumnFilterManager {
|
|
65902
65901
|
static getColumnFilters(filters, fieldName) {
|
|
65903
|
-
|
|
65904
|
-
if (filters == undefined || filters.length == 0) {
|
|
65905
|
-
return columnFilters;
|
|
65906
|
-
}
|
|
65907
|
-
filters.forEach(filter => {
|
|
65908
|
-
const result = COLUMN_FILTER_PATTERN.exec(filter.name);
|
|
65909
|
-
if (result) {
|
|
65910
|
-
if (fieldName !== result[1]) {
|
|
65911
|
-
columnFilters.set(filter.name, Object.assign({ columnName: result[1] }, filter));
|
|
65912
|
-
}
|
|
65913
|
-
}
|
|
65914
|
-
});
|
|
65915
|
-
return columnFilters;
|
|
65902
|
+
return core.ColumnFilterManager.getColumnFilters(filters, fieldName);
|
|
65916
65903
|
}
|
|
65917
65904
|
static getFilterFunction(dataUnit, filters) {
|
|
65918
|
-
|
|
65919
|
-
return record => {
|
|
65920
|
-
for (const filter of filters) {
|
|
65921
|
-
if (!ColumnFilterManager.recordMatchesFilter(dataUnit, record, filter)) {
|
|
65922
|
-
return false;
|
|
65923
|
-
}
|
|
65924
|
-
}
|
|
65925
|
-
return true;
|
|
65926
|
-
};
|
|
65927
|
-
}
|
|
65928
|
-
return undefined;
|
|
65929
|
-
}
|
|
65930
|
-
static recordMatchesFilter(dataUnit, record, columnFilter) {
|
|
65931
|
-
const fieldValue = record[columnFilter.columnName];
|
|
65932
|
-
for (let param of columnFilter.params) {
|
|
65933
|
-
const paramValue = dataUnit.valueFromString(columnFilter.columnName, param.value);
|
|
65934
|
-
if (core.FieldComparator.compareValues(dataUnit.getField(columnFilter.columnName), fieldValue, paramValue) === 0) {
|
|
65935
|
-
return true;
|
|
65936
|
-
}
|
|
65937
|
-
}
|
|
65938
|
-
return false;
|
|
65905
|
+
return core.ColumnFilterManager.getFilterFunction(dataUnit, filters);
|
|
65939
65906
|
}
|
|
65940
65907
|
static compileDistinct(fieldName, dataUnit) {
|
|
65941
|
-
|
|
65942
|
-
|
|
65943
|
-
|
|
65944
|
-
|
|
65945
|
-
const filterFunciton = ColumnFilterManager.getFilterFunction(dataUnit, columnFilters);
|
|
65946
|
-
if (filterFunciton != undefined) {
|
|
65947
|
-
list = list.filter(filterFunciton);
|
|
65948
|
-
}
|
|
65949
|
-
}
|
|
65950
|
-
const distinct = new Map(list.map(record => {
|
|
65951
|
-
const fieldValue = record[fieldName];
|
|
65952
|
-
if (fieldValue == undefined) {
|
|
65953
|
-
return [null, { label: null, value: null, check: true }];
|
|
65954
|
-
}
|
|
65955
|
-
const item = { label: dataUnit.getFormattedValue(fieldName, fieldValue), value: fieldValue, check: true };
|
|
65956
|
-
return [item.label, item];
|
|
65957
|
-
}));
|
|
65958
|
-
return Array.from(distinct.values());
|
|
65908
|
+
return core.ColumnFilterManager.compileDistinct(fieldName, dataUnit);
|
|
65909
|
+
}
|
|
65910
|
+
static compileDistinctFromArray(fieldName, dataUnit, records) {
|
|
65911
|
+
return core.ColumnFilterManager.compileDistinctFromArray(fieldName, dataUnit, records);
|
|
65959
65912
|
}
|
|
65960
65913
|
}
|
|
65961
65914
|
|
|
65962
65915
|
class InMemoryFilterColumnDataSource {
|
|
65963
65916
|
constructor(dataUnit) {
|
|
65964
|
-
|
|
65917
|
+
this.lastAppliedFilters = [];
|
|
65918
|
+
this.FILTER_COLUMN_TERM = 'FILTRO_COLUNA_';
|
|
65965
65919
|
this.onDataUnitAction = (action) => {
|
|
65920
|
+
var _a, _b;
|
|
65966
65921
|
if (action.type === core.Action.DATA_SAVED || action.type === core.Action.RECORDS_REMOVED) {
|
|
65967
65922
|
this.originalRecords = this.dataUnit.records;
|
|
65923
|
+
return;
|
|
65968
65924
|
}
|
|
65925
|
+
if (action.type !== core.Action.DATA_LOADED)
|
|
65926
|
+
return;
|
|
65927
|
+
const appliedFilters = this.getAppliedFilterNames((_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.filters) !== null && _b !== void 0 ? _b : []);
|
|
65928
|
+
if (this.originalRecords && core.ObjectUtils.equals(appliedFilters, this.lastAppliedFilters))
|
|
65929
|
+
return;
|
|
65930
|
+
this.originalRecords = action.payload.records;
|
|
65931
|
+
this.lastAppliedFilters = appliedFilters;
|
|
65969
65932
|
};
|
|
65970
65933
|
this.dataUnit = dataUnit;
|
|
65971
|
-
|
|
65934
|
+
if (this.dataUnit.records.length > 0) {
|
|
65935
|
+
this.originalRecords = this.dataUnit.records;
|
|
65936
|
+
}
|
|
65972
65937
|
this.dataUnit.subscribe(this.onDataUnitAction);
|
|
65973
65938
|
}
|
|
65939
|
+
getAppliedFilterNames(filters) {
|
|
65940
|
+
const appliedFilters = filters.map(filter => filter.name);
|
|
65941
|
+
return appliedFilters.filter(filterName => !filterName.includes(this.FILTER_COLUMN_TERM));
|
|
65942
|
+
}
|
|
65974
65943
|
getStaticOptions(fieldName) {
|
|
65975
|
-
return Promise.resolve(ColumnFilterManager.
|
|
65944
|
+
return Promise.resolve(ColumnFilterManager.compileDistinctFromArray(fieldName, this.dataUnit, this.originalRecords));
|
|
65976
65945
|
}
|
|
65977
65946
|
fetchData(filterTerm, fieldName) {
|
|
65978
65947
|
return new Promise(resolve => {
|
|
@@ -66537,7 +66506,8 @@ const EzGrid = class {
|
|
|
66537
66506
|
return `${total == undefined ? ` de ${count + 1} ou mais` : ` de ${total}`}`;
|
|
66538
66507
|
}
|
|
66539
66508
|
_hasToShowCancelPagination() {
|
|
66540
|
-
|
|
66509
|
+
var _a;
|
|
66510
|
+
const { total, count } = (_a = this._paginationInfo) !== null && _a !== void 0 ? _a : {};
|
|
66541
66511
|
const hasMore = (total === undefined);
|
|
66542
66512
|
return !this.dataUnit.cancelPagination && hasMore && count > this.dataUnit.pageSize;
|
|
66543
66513
|
}
|
|
@@ -66608,8 +66578,10 @@ const EzGrid = class {
|
|
|
66608
66578
|
}
|
|
66609
66579
|
}
|
|
66610
66580
|
getDataSource() {
|
|
66611
|
-
|
|
66612
|
-
|
|
66581
|
+
if (!this.columnfilterDataSource) {
|
|
66582
|
+
this.columnfilterDataSource = new InMemoryFilterColumnDataSource(this.dataUnit);
|
|
66583
|
+
}
|
|
66584
|
+
return this.columnfilterDataSource;
|
|
66613
66585
|
}
|
|
66614
66586
|
hideHeader() {
|
|
66615
66587
|
return !this._hasLeftButtons && !this._paginationInfo;
|
|
@@ -589,7 +589,7 @@ const EzList = class {
|
|
|
589
589
|
return { id: item.id, label: item.label, check: evt.detail };
|
|
590
590
|
}
|
|
591
591
|
renderListWithGroups() {
|
|
592
|
-
return index.h("div", { class: 'group-container', ref: el => (this._groupContainer = el), tabIndex:
|
|
592
|
+
return index.h("div", { class: 'group-container', ref: el => (this._groupContainer = el), tabIndex: 0, onKeyDown: event => this.keyDownHandler(event) }, this._listGroupItems.map(group => {
|
|
593
593
|
return (index.h("div", { id: this.getDivGroupId(group.group), class: 'group', key: group.group + group.items.length, onDrop: () => this.onDropGroup(group) }, index.h("label", { draggable: false, class: 'group-name', title: group.group }, group.group), index.h("section", { class: 'section-container', onDragOver: ev => ev.preventDefault() }, index.h("div", { class: 'group-items-container' }, index.h("div", { class: 'draggable-list' }, group.items.map((item, index$1) => (index.h("li", Object.assign({ id: 'item_' + item.id, class: {
|
|
594
594
|
'selectable-container': this.ezSelectable,
|
|
595
595
|
'hover-feedback': this.hoverFeedback,
|
|
@@ -599,7 +599,7 @@ const EzList = class {
|
|
|
599
599
|
}));
|
|
600
600
|
}
|
|
601
601
|
renderList() {
|
|
602
|
-
return index.h("div", { class: 'items-container', ref: el => (this._itemContainer = el), tabIndex:
|
|
602
|
+
return index.h("div", { class: 'items-container', ref: el => (this._itemContainer = el), tabIndex: 0, onKeyDown: event => {
|
|
603
603
|
this.keyDownHandler(event);
|
|
604
604
|
} }, index.h("div", { class: 'draggable-list' }, this._listItems.map((item, index$1) => (index.h("li", Object.assign({ id: 'item_' + item.id, class: {
|
|
605
605
|
'selectable-container': this.ezSelectable,
|
|
@@ -72,7 +72,7 @@ const EzModalContainer = class {
|
|
|
72
72
|
this._closeButton.focus();
|
|
73
73
|
}
|
|
74
74
|
render() {
|
|
75
|
-
return (index.h(index.Host, null, index.h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), index.h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (index.h("div", { class: "ez-modal-container__header ez-margin-bottom--medium" }, index.h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, index.h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (index.h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), (this.showCloseButton && index.h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction$1.CLOSE) }, index.h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" })))))), index.h("div", {
|
|
75
|
+
return (index.h(index.Host, null, index.h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), index.h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (index.h("div", { class: "ez-modal-container__header ez-margin-bottom--medium" }, index.h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, index.h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (index.h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), (this.showCloseButton && index.h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction$1.CLOSE) }, index.h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" })))))), index.h("div", { class: "ez-modal-container__content" }, index.h("slot", null)), index.h("div", { class: "ez-modal-container__footer" }, this.cancelIsVisible() && (index.h("ez-button", { label: this.cancelButtonLabel, enabled: this.cancelButtonStatus !== ModalButtonStatus$1.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction$1.CANCEL) })), this.okIsVisible() && (index.h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel, enabled: this.okButtonStatus !== ModalButtonStatus$1.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction$1.OK) }))), index.h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusFirst() })));
|
|
76
76
|
}
|
|
77
77
|
get _element() { return index.getElement(this); }
|
|
78
78
|
};
|
|
@@ -36,7 +36,7 @@ const EzModal = class {
|
|
|
36
36
|
}
|
|
37
37
|
componentDidLoad() {
|
|
38
38
|
this.observeOpened();
|
|
39
|
-
new core.KeyboardManager({ propagate: false, element: this._element
|
|
39
|
+
new core.KeyboardManager({ propagate: false, element: this._element })
|
|
40
40
|
.bind("Enter", this.ezModalAction.emit.bind("OK"))
|
|
41
41
|
.bind("Escape", () => this.closeModal())
|
|
42
42
|
.bind("Esc", () => this.closeModal());
|
|
@@ -72,8 +72,19 @@ const EzPopoverPlus = class {
|
|
|
72
72
|
async setAnchorElement(anchor) {
|
|
73
73
|
var _a;
|
|
74
74
|
await ((_a = this._popOverCore) === null || _a === void 0 ? void 0 : _a.setAnchorElement(anchor));
|
|
75
|
+
this.anchorElement = anchor;
|
|
76
|
+
}
|
|
77
|
+
getFirstElement(collection) {
|
|
78
|
+
if (Array.isArray(collection) && collection.length) {
|
|
79
|
+
return collection[0];
|
|
80
|
+
}
|
|
81
|
+
if (!Array.isArray(collection) && collection.item) {
|
|
82
|
+
return collection.item(0);
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
75
85
|
}
|
|
76
86
|
renderPopoverCore() {
|
|
87
|
+
var _a;
|
|
77
88
|
this._popOverCore = document.createElement('ez-popover-core');
|
|
78
89
|
this._popOverCore.opened = this.opened;
|
|
79
90
|
this._popOverCore.anchorElement = this.anchorElement;
|
|
@@ -87,14 +98,17 @@ const EzPopoverPlus = class {
|
|
|
87
98
|
this.ezVisibilityChange.emit(detail);
|
|
88
99
|
this.opened = detail;
|
|
89
100
|
});
|
|
90
|
-
const firstChild = this._host.children
|
|
101
|
+
const firstChild = this.getFirstElement(this._host.children);
|
|
91
102
|
if (firstChild) {
|
|
92
103
|
this._popOverCore.appendChild(firstChild);
|
|
93
104
|
}
|
|
94
105
|
else {
|
|
95
106
|
console.warn('O slot do popover está vazio. Adicione conteúdo ao slot para exibição correta.');
|
|
96
107
|
}
|
|
97
|
-
document.body.
|
|
108
|
+
const root = document.body.querySelector("#root");
|
|
109
|
+
const firstDiv = this.getFirstElement(document.body.getElementsByTagName("div"));
|
|
110
|
+
const parentElement = (_a = root !== null && root !== void 0 ? root : firstDiv) !== null && _a !== void 0 ? _a : document.body;
|
|
111
|
+
parentElement.appendChild(this._popOverCore);
|
|
98
112
|
}
|
|
99
113
|
render() {
|
|
100
114
|
return (index.h(index.Host, null, index.h("slot", null)));
|
|
@@ -35,7 +35,7 @@ const EzPopup = class {
|
|
|
35
35
|
if (this.opened && this._popupRef) {
|
|
36
36
|
this._popupRef.focus();
|
|
37
37
|
}
|
|
38
|
-
new core.KeyboardManager({ propagate: false, element: this._element
|
|
38
|
+
new core.KeyboardManager({ propagate: false, element: this._element })
|
|
39
39
|
.bind("Enter", this.ezPopupAction.emit.bind("OK"))
|
|
40
40
|
.bind("Escape", () => this.closePopup())
|
|
41
41
|
.bind("Esc", () => this.closePopup());
|
|
@@ -308,7 +308,7 @@ const EzSearch = class {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
cancelPreselection() {
|
|
311
|
-
if (!this._textInput.value && this._currentValue) {
|
|
311
|
+
if (!this._textInput.value && this._currentValue && this._source.length > 0) {
|
|
312
312
|
this.selectOption(undefined);
|
|
313
313
|
}
|
|
314
314
|
else {
|
|
@@ -482,7 +482,8 @@ export class EzGrid {
|
|
|
482
482
|
return `${total == undefined ? ` de ${count + 1} ou mais` : ` de ${total}`}`;
|
|
483
483
|
}
|
|
484
484
|
_hasToShowCancelPagination() {
|
|
485
|
-
|
|
485
|
+
var _a;
|
|
486
|
+
const { total, count } = (_a = this._paginationInfo) !== null && _a !== void 0 ? _a : {};
|
|
486
487
|
const hasMore = (total === undefined);
|
|
487
488
|
return !this.dataUnit.cancelPagination && hasMore && count > this.dataUnit.pageSize;
|
|
488
489
|
}
|
|
@@ -553,8 +554,10 @@ export class EzGrid {
|
|
|
553
554
|
}
|
|
554
555
|
}
|
|
555
556
|
getDataSource() {
|
|
556
|
-
|
|
557
|
-
|
|
557
|
+
if (!this.columnfilterDataSource) {
|
|
558
|
+
this.columnfilterDataSource = new InMemoryFilterColumnDataSource(this.dataUnit);
|
|
559
|
+
}
|
|
560
|
+
return this.columnfilterDataSource;
|
|
558
561
|
}
|
|
559
562
|
hideHeader() {
|
|
560
563
|
return !this._hasLeftButtons && !this._paginationInfo;
|
|
@@ -1,62 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const COLUMN_FILTER_PATTERN = /FILTRO_COLUNA_(.+)/;
|
|
1
|
+
import { ColumnFilterManager as CoreColumnFilterManager } from "@sankhyalabs/core";
|
|
3
2
|
export class ColumnFilterManager {
|
|
4
3
|
static getColumnFilters(filters, fieldName) {
|
|
5
|
-
|
|
6
|
-
if (filters == undefined || filters.length == 0) {
|
|
7
|
-
return columnFilters;
|
|
8
|
-
}
|
|
9
|
-
filters.forEach(filter => {
|
|
10
|
-
const result = COLUMN_FILTER_PATTERN.exec(filter.name);
|
|
11
|
-
if (result) {
|
|
12
|
-
if (fieldName !== result[1]) {
|
|
13
|
-
columnFilters.set(filter.name, Object.assign({ columnName: result[1] }, filter));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return columnFilters;
|
|
4
|
+
return CoreColumnFilterManager.getColumnFilters(filters, fieldName);
|
|
18
5
|
}
|
|
19
6
|
static getFilterFunction(dataUnit, filters) {
|
|
20
|
-
|
|
21
|
-
return record => {
|
|
22
|
-
for (const filter of filters) {
|
|
23
|
-
if (!ColumnFilterManager.recordMatchesFilter(dataUnit, record, filter)) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return true;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
static recordMatchesFilter(dataUnit, record, columnFilter) {
|
|
33
|
-
const fieldValue = record[columnFilter.columnName];
|
|
34
|
-
for (let param of columnFilter.params) {
|
|
35
|
-
const paramValue = dataUnit.valueFromString(columnFilter.columnName, param.value);
|
|
36
|
-
if (FieldComparator.compareValues(dataUnit.getField(columnFilter.columnName), fieldValue, paramValue) === 0) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
7
|
+
return CoreColumnFilterManager.getFilterFunction(dataUnit, filters);
|
|
41
8
|
}
|
|
42
9
|
static compileDistinct(fieldName, dataUnit) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const filterFunciton = ColumnFilterManager.getFilterFunction(dataUnit, columnFilters);
|
|
48
|
-
if (filterFunciton != undefined) {
|
|
49
|
-
list = list.filter(filterFunciton);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const distinct = new Map(list.map(record => {
|
|
53
|
-
const fieldValue = record[fieldName];
|
|
54
|
-
if (fieldValue == undefined) {
|
|
55
|
-
return [null, { label: null, value: null, check: true }];
|
|
56
|
-
}
|
|
57
|
-
const item = { label: dataUnit.getFormattedValue(fieldName, fieldValue), value: fieldValue, check: true };
|
|
58
|
-
return [item.label, item];
|
|
59
|
-
}));
|
|
60
|
-
return Array.from(distinct.values());
|
|
10
|
+
return CoreColumnFilterManager.compileDistinct(fieldName, dataUnit);
|
|
11
|
+
}
|
|
12
|
+
static compileDistinctFromArray(fieldName, dataUnit, records) {
|
|
13
|
+
return CoreColumnFilterManager.compileDistinctFromArray(fieldName, dataUnit, records);
|
|
61
14
|
}
|
|
62
15
|
}
|
|
@@ -1,19 +1,35 @@
|
|
|
1
|
-
import { Action, ArrayUtils, DataType, DateUtils, FieldComparator, UserInterface } from '@sankhyalabs/core';
|
|
1
|
+
import { Action, ArrayUtils, DataType, DateUtils, FieldComparator, ObjectUtils, UserInterface, } from '@sankhyalabs/core';
|
|
2
2
|
import { ColumnFilterManager } from './ColumnFilterManager';
|
|
3
3
|
export default class InMemoryFilterColumnDataSource {
|
|
4
4
|
constructor(dataUnit) {
|
|
5
|
-
|
|
5
|
+
this.lastAppliedFilters = [];
|
|
6
|
+
this.FILTER_COLUMN_TERM = 'FILTRO_COLUNA_';
|
|
6
7
|
this.onDataUnitAction = (action) => {
|
|
8
|
+
var _a, _b;
|
|
7
9
|
if (action.type === Action.DATA_SAVED || action.type === Action.RECORDS_REMOVED) {
|
|
8
10
|
this.originalRecords = this.dataUnit.records;
|
|
11
|
+
return;
|
|
9
12
|
}
|
|
13
|
+
if (action.type !== Action.DATA_LOADED)
|
|
14
|
+
return;
|
|
15
|
+
const appliedFilters = this.getAppliedFilterNames((_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.filters) !== null && _b !== void 0 ? _b : []);
|
|
16
|
+
if (this.originalRecords && ObjectUtils.equals(appliedFilters, this.lastAppliedFilters))
|
|
17
|
+
return;
|
|
18
|
+
this.originalRecords = action.payload.records;
|
|
19
|
+
this.lastAppliedFilters = appliedFilters;
|
|
10
20
|
};
|
|
11
21
|
this.dataUnit = dataUnit;
|
|
12
|
-
|
|
22
|
+
if (this.dataUnit.records.length > 0) {
|
|
23
|
+
this.originalRecords = this.dataUnit.records;
|
|
24
|
+
}
|
|
13
25
|
this.dataUnit.subscribe(this.onDataUnitAction);
|
|
14
26
|
}
|
|
27
|
+
getAppliedFilterNames(filters) {
|
|
28
|
+
const appliedFilters = filters.map(filter => filter.name);
|
|
29
|
+
return appliedFilters.filter(filterName => !filterName.includes(this.FILTER_COLUMN_TERM));
|
|
30
|
+
}
|
|
15
31
|
getStaticOptions(fieldName) {
|
|
16
|
-
return Promise.resolve(ColumnFilterManager.
|
|
32
|
+
return Promise.resolve(ColumnFilterManager.compileDistinctFromArray(fieldName, this.dataUnit, this.originalRecords));
|
|
17
33
|
}
|
|
18
34
|
fetchData(filterTerm, fieldName) {
|
|
19
35
|
return new Promise(resolve => {
|
|
@@ -576,7 +576,7 @@ export class EzList {
|
|
|
576
576
|
return { id: item.id, label: item.label, check: evt.detail };
|
|
577
577
|
}
|
|
578
578
|
renderListWithGroups() {
|
|
579
|
-
return h("div", { class: 'group-container', ref: el => (this._groupContainer = el), tabIndex:
|
|
579
|
+
return h("div", { class: 'group-container', ref: el => (this._groupContainer = el), tabIndex: 0, onKeyDown: event => this.keyDownHandler(event) }, this._listGroupItems.map(group => {
|
|
580
580
|
return (h("div", { id: this.getDivGroupId(group.group), class: 'group', key: group.group + group.items.length, onDrop: () => this.onDropGroup(group) }, h("label", { draggable: false, class: 'group-name', title: group.group }, group.group), h("section", { class: 'section-container', onDragOver: ev => ev.preventDefault() }, h("div", { class: 'group-items-container' }, h("div", { class: 'draggable-list' }, group.items.map((item, index) => (h("li", Object.assign({ id: 'item_' + item.id, class: {
|
|
581
581
|
'selectable-container': this.ezSelectable,
|
|
582
582
|
'hover-feedback': this.hoverFeedback,
|
|
@@ -586,7 +586,7 @@ export class EzList {
|
|
|
586
586
|
}));
|
|
587
587
|
}
|
|
588
588
|
renderList() {
|
|
589
|
-
return h("div", { class: 'items-container', ref: el => (this._itemContainer = el), tabIndex:
|
|
589
|
+
return h("div", { class: 'items-container', ref: el => (this._itemContainer = el), tabIndex: 0, onKeyDown: event => {
|
|
590
590
|
this.keyDownHandler(event);
|
|
591
591
|
} }, h("div", { class: 'draggable-list' }, this._listItems.map((item, index) => (h("li", Object.assign({ id: 'item_' + item.id, class: {
|
|
592
592
|
'selectable-container': this.ezSelectable,
|
|
@@ -25,7 +25,7 @@ export class EzModal {
|
|
|
25
25
|
}
|
|
26
26
|
componentDidLoad() {
|
|
27
27
|
this.observeOpened();
|
|
28
|
-
new KeyboardManager({ propagate: false, element: this._element
|
|
28
|
+
new KeyboardManager({ propagate: false, element: this._element })
|
|
29
29
|
.bind("Enter", this.ezModalAction.emit.bind("OK"))
|
|
30
30
|
.bind("Escape", () => this.closeModal())
|
|
31
31
|
.bind("Esc", () => this.closeModal());
|
|
@@ -48,7 +48,7 @@ export class EzModalContainer {
|
|
|
48
48
|
this._closeButton.focus();
|
|
49
49
|
}
|
|
50
50
|
render() {
|
|
51
|
-
return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--medium" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), (this.showCloseButton && h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE) }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" })))))), h("div", {
|
|
51
|
+
return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--medium" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), (this.showCloseButton && h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE) }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" })))))), h("div", { class: "ez-modal-container__content" }, h("slot", null)), h("div", { class: "ez-modal-container__footer" }, this.cancelIsVisible() && (h("ez-button", { label: this.cancelButtonLabel, enabled: this.cancelButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.CANCEL) })), this.okIsVisible() && (h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel, enabled: this.okButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.OK) }))), h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusFirst() })));
|
|
52
52
|
}
|
|
53
53
|
static get is() { return "ez-modal-container"; }
|
|
54
54
|
static get encapsulation() { return "scoped"; }
|
|
@@ -61,8 +61,19 @@ export class EzPopoverPlus {
|
|
|
61
61
|
async setAnchorElement(anchor) {
|
|
62
62
|
var _a;
|
|
63
63
|
await ((_a = this._popOverCore) === null || _a === void 0 ? void 0 : _a.setAnchorElement(anchor));
|
|
64
|
+
this.anchorElement = anchor;
|
|
65
|
+
}
|
|
66
|
+
getFirstElement(collection) {
|
|
67
|
+
if (Array.isArray(collection) && collection.length) {
|
|
68
|
+
return collection[0];
|
|
69
|
+
}
|
|
70
|
+
if (!Array.isArray(collection) && collection.item) {
|
|
71
|
+
return collection.item(0);
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
64
74
|
}
|
|
65
75
|
renderPopoverCore() {
|
|
76
|
+
var _a;
|
|
66
77
|
this._popOverCore = document.createElement('ez-popover-core');
|
|
67
78
|
this._popOverCore.opened = this.opened;
|
|
68
79
|
this._popOverCore.anchorElement = this.anchorElement;
|
|
@@ -76,14 +87,17 @@ export class EzPopoverPlus {
|
|
|
76
87
|
this.ezVisibilityChange.emit(detail);
|
|
77
88
|
this.opened = detail;
|
|
78
89
|
});
|
|
79
|
-
const firstChild = this._host.children
|
|
90
|
+
const firstChild = this.getFirstElement(this._host.children);
|
|
80
91
|
if (firstChild) {
|
|
81
92
|
this._popOverCore.appendChild(firstChild);
|
|
82
93
|
}
|
|
83
94
|
else {
|
|
84
95
|
console.warn('O slot do popover está vazio. Adicione conteúdo ao slot para exibição correta.');
|
|
85
96
|
}
|
|
86
|
-
document.body.
|
|
97
|
+
const root = document.body.querySelector("#root");
|
|
98
|
+
const firstDiv = this.getFirstElement(document.body.getElementsByTagName("div"));
|
|
99
|
+
const parentElement = (_a = root !== null && root !== void 0 ? root : firstDiv) !== null && _a !== void 0 ? _a : document.body;
|
|
100
|
+
parentElement.appendChild(this._popOverCore);
|
|
87
101
|
}
|
|
88
102
|
render() {
|
|
89
103
|
return (h(Host, null, h("slot", null)));
|
|
@@ -97,6 +97,7 @@ export class EzPopoverCore {
|
|
|
97
97
|
return htmlElement;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
+
return this._host;
|
|
100
101
|
}
|
|
101
102
|
return this.getElement(this.anchorElement);
|
|
102
103
|
}
|
|
@@ -132,17 +133,15 @@ export class EzPopoverCore {
|
|
|
132
133
|
this.ezVisibilityChange.emit(false);
|
|
133
134
|
}
|
|
134
135
|
async openPopover() {
|
|
135
|
-
if (!this._box) {
|
|
136
|
+
if (!this._box || !this.opened) {
|
|
136
137
|
return;
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this._box.style.visibility = 'visible';
|
|
145
|
-
}
|
|
139
|
+
this._box.style.display = 'flex';
|
|
140
|
+
this._box.style.visibility = 'hidden';
|
|
141
|
+
await this.updatePositionPopover();
|
|
142
|
+
this.openOverlay();
|
|
143
|
+
this.ezVisibilityChange.emit(true);
|
|
144
|
+
this._box.style.visibility = 'visible';
|
|
146
145
|
}
|
|
147
146
|
openOverlay() {
|
|
148
147
|
if (!this._overlay || !this._overlayIsActive) {
|
|
@@ -222,7 +221,7 @@ export class EzPopoverCore {
|
|
|
222
221
|
"optional": false,
|
|
223
222
|
"docs": {
|
|
224
223
|
"tags": [],
|
|
225
|
-
"text": "Define
|
|
224
|
+
"text": "Define se ser\u00E1 fechado automaticamente quando o usu\u00E1rio clicar fora do conte\u00FAdo."
|
|
226
225
|
},
|
|
227
226
|
"attribute": "auto-close",
|
|
228
227
|
"reflect": true,
|
|
@@ -25,7 +25,7 @@ export class EzPopup {
|
|
|
25
25
|
if (this.opened && this._popupRef) {
|
|
26
26
|
this._popupRef.focus();
|
|
27
27
|
}
|
|
28
|
-
new KeyboardManager({ propagate: false, element: this._element
|
|
28
|
+
new KeyboardManager({ propagate: false, element: this._element })
|
|
29
29
|
.bind("Enter", this.ezPopupAction.emit.bind("OK"))
|
|
30
30
|
.bind("Escape", () => this.closePopup())
|
|
31
31
|
.bind("Esc", () => this.closePopup());
|
|
@@ -296,7 +296,7 @@ export class EzSearch {
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
cancelPreselection() {
|
|
299
|
-
if (!this._textInput.value && this._currentValue) {
|
|
299
|
+
if (!this._textInput.value && this._currentValue && this._source.length > 0) {
|
|
300
300
|
this.selectOption(undefined);
|
|
301
301
|
}
|
|
302
302
|
else {
|