@sankhyalabs/ezui 5.20.0-dev.4 → 5.20.0-dev.41
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/{CSSVarsUtils-b136a156.js → CSSVarsUtils-10c9d5b4.js} +13 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item_3.cjs.entry.js +183 -0
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +20 -163
- package/dist/cjs/ez-date-input.cjs.entry.js +4 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +4 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +30 -13
- package/dist/cjs/ez-grid.cjs.entry.js +169 -62
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +6 -0
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +2 -10
- package/dist/cjs/ez-number-input.cjs.entry.js +4 -1
- package/dist/cjs/ez-popup.cjs.entry.js +8 -1
- package/dist/cjs/ez-scroller_3.cjs.entry.js +18 -4
- package/dist/cjs/ez-search.cjs.entry.js +611 -32
- package/dist/cjs/ez-split-button.cjs.entry.js +166 -0
- package/dist/cjs/ez-split-item.cjs.entry.js +20 -2
- package/dist/cjs/ez-split-panel.cjs.entry.js +52 -15
- package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/filter-column.cjs.entry.js +16 -5
- package/dist/cjs/index-a7b0c73d.js +10 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +4 -3
- package/dist/collection/components/ez-alert-list/ez-alert-list.css +1 -1
- package/dist/collection/components/ez-card-item/ez-card-item.css +52 -3
- package/dist/collection/components/ez-card-item/ez-card-item.js +22 -3
- package/dist/collection/components/ez-check/ez-check.css +1 -0
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +1 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +20 -180
- package/dist/collection/components/ez-date-input/ez-date-input.js +3 -0
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +3 -0
- package/dist/collection/components/ez-form-view/ez-form-view.css +17 -1
- package/dist/collection/components/ez-form-view/ez-form-view.js +22 -5
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +3 -3
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +34 -18
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +15 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSourceInterceptor.js +21 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +5 -7
- package/dist/collection/components/ez-grid/ez-grid.css +25 -2
- package/dist/collection/components/ez-grid/ez-grid.js +100 -30
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +16 -5
- package/dist/collection/components/ez-icon/ez-icon.css +118 -116
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +15 -0
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +2 -10
- package/dist/collection/components/ez-number-input/ez-number-input.js +3 -0
- package/dist/collection/components/ez-popup/ez-popup.css +2 -5
- package/dist/collection/components/ez-popup/ez-popup.js +31 -1
- package/dist/collection/components/ez-search/ez-search.css +331 -0
- package/dist/collection/components/ez-search/ez-search.js +688 -55
- package/dist/collection/components/ez-split-button/ez-split-button.css +229 -0
- package/dist/collection/components/ez-split-button/ez-split-button.js +455 -0
- package/dist/collection/components/ez-split-button/test/dropdownItems.js +42 -0
- package/dist/collection/components/ez-split-panel/ez-split-panel.css +6 -14
- package/dist/collection/components/ez-split-panel/ez-split-panel.js +77 -23
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +66 -12
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.js +82 -2
- package/dist/collection/components/ez-toast/ez-toast.css +1 -1
- package/dist/collection/components/ez-tree/ez-tree.css +26 -0
- package/dist/collection/components/ez-tree/interfaces/ITreeItemBadge.js +1 -0
- package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +15 -2
- package/dist/collection/utils/CSSVarsUtils.js +13 -0
- package/dist/collection/utils/form/test/DataBinder.test.js +9 -0
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +1148 -326
- package/dist/esm/{CSSVarsUtils-a97cfa29.js → CSSVarsUtils-71ce76be.js} +13 -0
- package/dist/esm/ez-actions-button.entry.js +1 -1
- package/dist/esm/ez-alert-list.entry.js +1 -1
- package/dist/esm/ez-card-item_3.entry.js +177 -0
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +21 -164
- package/dist/esm/ez-date-input.entry.js +4 -1
- package/dist/esm/ez-date-time-input.entry.js +4 -1
- package/dist/esm/ez-form-view.entry.js +31 -14
- package/dist/esm/ez-grid.entry.js +170 -63
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +6 -0
- package/dist/esm/ez-multi-selection-list.entry.js +2 -10
- package/dist/esm/ez-number-input.entry.js +4 -1
- package/dist/esm/ez-popup.entry.js +8 -1
- package/dist/esm/ez-scroller_3.entry.js +18 -4
- package/dist/esm/ez-search.entry.js +613 -34
- package/dist/esm/ez-split-button.entry.js +162 -0
- package/dist/esm/ez-split-item.entry.js +20 -2
- package/dist/esm/ez-split-panel.entry.js +52 -15
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/filter-column.entry.js +16 -5
- package/dist/esm/index-baa5e267.js +10 -10
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-2eb8f73b.entry.js +1 -0
- package/dist/ezui/p-3faa2b46.entry.js +1 -0
- package/dist/ezui/p-58fae29b.entry.js +1 -0
- package/dist/ezui/{p-40f72de4.entry.js → p-784fe207.entry.js} +1 -1
- package/dist/ezui/p-7a636dfc.entry.js +1 -0
- package/dist/ezui/p-7af81663.entry.js +1 -0
- package/dist/ezui/p-7bc07c31.entry.js +1 -0
- package/dist/ezui/p-8c82374d.entry.js +1 -0
- package/dist/ezui/{p-8becebf8.entry.js → p-8df1ca33.entry.js} +1 -1
- package/dist/ezui/{p-940ed30b.entry.js → p-8e7031a0.entry.js} +1 -1
- package/dist/ezui/p-91f626d3.entry.js +1 -0
- package/dist/ezui/{p-eb36f072.entry.js → p-99ead599.entry.js} +1 -1
- package/dist/ezui/{p-7eb3e1a5.js → p-9e11fc7b.js} +1 -1
- package/dist/ezui/p-9f1e89c9.entry.js +1 -0
- package/dist/ezui/p-af95cd16.entry.js +1 -0
- package/dist/ezui/{p-c0f1715f.entry.js → p-b567fa8c.entry.js} +1 -1
- package/dist/ezui/p-bae3d0aa.entry.js +1 -0
- package/dist/ezui/p-baf80b13.entry.js +1 -0
- package/dist/ezui/p-bf79aaa1.entry.js +1 -0
- package/dist/ezui/{p-93c3df4f.entry.js → p-d7d7423a.entry.js} +1 -1
- package/dist/ezui/p-db77a984.entry.js +1 -0
- package/dist/ezui/{p-9cad9b6e.entry.js → p-e85c48d7.entry.js} +1 -1
- package/dist/ezui/{p-844ee673.entry.js → p-fb5adf9e.entry.js} +2 -2
- package/dist/types/components/ez-card-item/ez-card-item.d.ts +4 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -15
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +3 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -0
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -1
- package/dist/types/components/ez-grid/controller/ag-grid/DataSourceInterceptor.d.ts +8 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +17 -2
- package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +4 -1
- package/dist/types/components/ez-guide-navigator/interfaces/IGuideItem.d.ts +0 -1
- package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +1 -0
- package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +0 -1
- package/dist/types/components/ez-popup/ez-popup.d.ts +6 -1
- package/dist/types/components/ez-search/ez-search.d.ts +100 -10
- package/dist/types/components/ez-split-button/ez-split-button.d.ts +92 -0
- package/dist/types/components/ez-split-button/test/dropdownItems.d.ts +2 -0
- package/dist/types/components/ez-split-panel/ez-split-panel.d.ts +28 -0
- package/dist/types/components/ez-split-panel/structure/item/ez-split-item.d.ts +27 -0
- package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +3 -1
- package/dist/types/components/ez-tree/interfaces/ITreeItemBadge.d.ts +6 -0
- package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +0 -1
- package/dist/types/components.d.ts +182 -21
- package/dist/types/utils/CSSVarsUtils.d.ts +1 -0
- package/dist/types/utils/form/test/DataBinder.test.d.ts +1 -0
- package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +2 -1
- package/package.json +5 -5
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/ez-card-item.cjs.entry.js +0 -52
- package/dist/cjs/ez-filter-input_2.cjs.entry.js +0 -137
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridUtils.js +0 -8
- package/dist/esm/ez-card-item.entry.js +0 -48
- package/dist/esm/ez-filter-input_2.entry.js +0 -132
- package/dist/ezui/p-05f5a778.entry.js +0 -1
- package/dist/ezui/p-13dbad96.entry.js +0 -1
- package/dist/ezui/p-24d3fede.entry.js +0 -1
- package/dist/ezui/p-51c5e071.entry.js +0 -1
- package/dist/ezui/p-5613fe63.entry.js +0 -1
- package/dist/ezui/p-596634e9.entry.js +0 -1
- package/dist/ezui/p-5d692ed1.entry.js +0 -1
- package/dist/ezui/p-5d86cca9.entry.js +0 -1
- package/dist/ezui/p-60848ef6.entry.js +0 -1
- package/dist/ezui/p-a08b309b.entry.js +0 -1
- package/dist/ezui/p-a32aaac6.entry.js +0 -1
- package/dist/ezui/p-a5ac7151.entry.js +0 -1
- package/dist/ezui/p-af15c277.entry.js +0 -1
- package/dist/ezui/p-d6ffe679.entry.js +0 -1
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridUtils.d.ts +0 -1
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: flex;
|
|
3
|
-
flex-direction: row;
|
|
4
3
|
flex-wrap: wrap;
|
|
5
4
|
width: 100%;
|
|
5
|
+
|
|
6
|
+
/*@doc Define o tamanho mínimo dos itens do formulário.*/
|
|
7
|
+
--ez-form-view__item--min-width: 220px;
|
|
8
|
+
/*@doc Define o espaçamento entre itens do formulário.*/
|
|
9
|
+
--ez-form-view__item--sapce-width: 5px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.form-view__content{
|
|
13
|
+
display: grid;
|
|
14
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--ez-form-view__item--min-width), 1fr));
|
|
15
|
+
gap: var(--ez-form-view__item--sapce-width);
|
|
16
|
+
width: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.input-full_width {
|
|
20
|
+
grid-column: 1 / -1;
|
|
21
|
+
width: 100%;
|
|
6
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
|
2
2
|
import { fieldBuilder } from './fieldbuilder/FieldBuilder';
|
|
3
|
-
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { ElementIDUtils, UserInterface } from '@sankhyalabs/core';
|
|
4
4
|
import { FormItems } from './structure';
|
|
5
5
|
export class EzFormView {
|
|
6
6
|
constructor() {
|
|
@@ -32,19 +32,36 @@ export class EzFormView {
|
|
|
32
32
|
const formItems = new FormItems(Array.from(this._element.querySelectorAll("[data-form-item]")));
|
|
33
33
|
this.formItemsReady.emit(formItems);
|
|
34
34
|
}
|
|
35
|
+
isItemFullWidth(userInterface) {
|
|
36
|
+
return [
|
|
37
|
+
UserInterface.FILE,
|
|
38
|
+
UserInterface.LONGTEXT
|
|
39
|
+
].includes(userInterface);
|
|
40
|
+
}
|
|
41
|
+
buildFormItemElement(item, classItem = "") {
|
|
42
|
+
if (this.isItemFullWidth(item.userInterface)) {
|
|
43
|
+
classItem += " input-full_width";
|
|
44
|
+
}
|
|
45
|
+
return h("div", { class: classItem }, fieldBuilder(item));
|
|
46
|
+
}
|
|
35
47
|
render() {
|
|
36
48
|
ElementIDUtils.addIDInfoIfNotExists(this._element, 'ezFormView');
|
|
37
49
|
if (this.fields == undefined) {
|
|
38
50
|
return;
|
|
39
51
|
}
|
|
40
|
-
|
|
52
|
+
let nonArrayGrup = [];
|
|
53
|
+
let formContent = Array.from(this.groupFields(this.fields).entries()).map(([label, value]) => {
|
|
41
54
|
if (Array.isArray(value)) {
|
|
42
|
-
return (h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, value.map(fi =>
|
|
55
|
+
return (h("ez-collapsible-box", { id: `group-${label}`, label: label, "header-size": "large", key: label }, h("div", { class: "form-view__content" }, value.map(fi => (this.buildFormItemElement(fi))))));
|
|
43
56
|
}
|
|
44
57
|
else {
|
|
45
|
-
|
|
58
|
+
nonArrayGrup.push(value);
|
|
46
59
|
}
|
|
47
|
-
})
|
|
60
|
+
});
|
|
61
|
+
// Filtra os elementos que não são arrays e os coloca dentro de uma única div
|
|
62
|
+
let nonArrayElements = nonArrayGrup.map((value) => this.buildFormItemElement(value));
|
|
63
|
+
let groupedNonArrayElements = h("div", { class: "form-view__content" }, nonArrayElements);
|
|
64
|
+
return (h(Host, null, groupedNonArrayElements, formContent));
|
|
48
65
|
}
|
|
49
66
|
static get is() { return "ez-form-view"; }
|
|
50
67
|
static get encapsulation() { return "scoped"; }
|
|
@@ -7,5 +7,5 @@ export const buildCheckBox = (field) => {
|
|
|
7
7
|
return buildField(field.name, field.label, field.readOnly, field.contextName, false);
|
|
8
8
|
};
|
|
9
9
|
function buildField(fieldName, fieldLabel, readOnly, contextName, switchMode) {
|
|
10
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
10
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-align--middle ez-padding-horizontal--small ez-padding-bottom--large" }, h("ez-check", { enabled: !readOnly, label: fieldLabel, mode: switchMode ? CheckMode.SWITCH : CheckMode.REGULAR, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName })));
|
|
11
11
|
}
|
|
@@ -9,5 +9,5 @@ export const buildComboBox = ({ name, label, readOnly, required, props, contextN
|
|
|
9
9
|
else {
|
|
10
10
|
options = prop;
|
|
11
11
|
}
|
|
12
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
12
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-combo-box", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, options: options, canShowError: canShowError })));
|
|
13
13
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
export const buildDate = ({ name, label, readOnly, canShowError }) => {
|
|
3
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
3
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError })));
|
|
4
4
|
};
|
|
5
5
|
export const buildTime = ({ name, label, readOnly, canShowError }) => {
|
|
6
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
6
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name, canShowError: canShowError })));
|
|
7
7
|
};
|
|
8
8
|
export const buildDateTime = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
9
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
9
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError })));
|
|
10
10
|
};
|
|
@@ -8,5 +8,5 @@ export const buildInteger = ({ name, label, readOnly, contextName, canShowError
|
|
|
8
8
|
return buildNumeric(name, label, readOnly, 0, 0, contextName, canShowError);
|
|
9
9
|
};
|
|
10
10
|
function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecision, contextName, canShowError) {
|
|
11
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
11
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName, canShowError: canShowError })));
|
|
12
12
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
export const buildSearch = ({ name, label, readOnly, required, contextName, canShowError, optionLoader }) => {
|
|
3
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
3
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-search", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError, optionLoader: optionLoader })));
|
|
4
4
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
export const buildTextInput = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
3
|
-
return (h("div", { class: "ez-col ez-col--sd-12 ez-
|
|
3
|
+
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" }, h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly, canShowError: canShowError })));
|
|
4
4
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationContext, DataType, MaskFormatter, NumberUtils, SortMode, StringUtils, UserInterface } from '@sankhyalabs/core';
|
|
1
|
+
import { ApplicationContext, DataType, MaskFormatter, NumberUtils, SortMode, StringUtils, UserInterface, } from '@sankhyalabs/core';
|
|
2
2
|
import { Grid, } from 'ag-grid-community';
|
|
3
3
|
import { Grid as EnterpriseGrid, LicenseManager } from 'ag-grid-enterprise';
|
|
4
4
|
import DataSource from './DataSource';
|
|
@@ -6,8 +6,7 @@ import { EzGridCustomHeader } from './components/EzGridCustomHeader';
|
|
|
6
6
|
import { CellRendererStatus } from './components/cellRendererStatus';
|
|
7
7
|
import SelectionHeader from './components/selectionHeader';
|
|
8
8
|
import gridTerms from './i18n/pt-BR.js';
|
|
9
|
-
import {
|
|
10
|
-
import { calcFilterColumnLeftPosition } from './AgGridUtils';
|
|
9
|
+
import { DISTINCT_FILTER_NAME_PREFIX, EZ_GRID_LOADING_SOURCE } from '../../../../utils/constants';
|
|
11
10
|
import GridEditionManager from './GridEditionManager';
|
|
12
11
|
export default class AgGridController {
|
|
13
12
|
configFilterColumn(filterColumn) {
|
|
@@ -20,6 +19,10 @@ export default class AgGridController {
|
|
|
20
19
|
this._gridOptions.api.refreshHeader();
|
|
21
20
|
this._dataUnit.loadData(undefined, undefined, undefined, EZ_GRID_LOADING_SOURCE);
|
|
22
21
|
}
|
|
22
|
+
clearFilter() {
|
|
23
|
+
this._filteredColumns.clear();
|
|
24
|
+
this._gridOptions.api.refreshHeader();
|
|
25
|
+
}
|
|
23
26
|
showFilterColumn(configs) {
|
|
24
27
|
var _a;
|
|
25
28
|
(_a = this._filterColumn) === null || _a === void 0 ? void 0 : _a.show(configs);
|
|
@@ -38,7 +41,7 @@ export default class AgGridController {
|
|
|
38
41
|
this._idAttribName = '__record__id__';
|
|
39
42
|
this._gridConfig = [];
|
|
40
43
|
this._filteredColumns = new Map();
|
|
41
|
-
this._filterColumnleftPosition =
|
|
44
|
+
this._filterColumnleftPosition = 0;
|
|
42
45
|
this._enterprise = enterprise;
|
|
43
46
|
}
|
|
44
47
|
getGridConfig() {
|
|
@@ -75,22 +78,27 @@ export default class AgGridController {
|
|
|
75
78
|
const dataType = (_a = fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.dataType) !== null && _a !== void 0 ? _a : DataType.TEXT;
|
|
76
79
|
let placeholders = '';
|
|
77
80
|
const params = [];
|
|
81
|
+
let isNullIncluded;
|
|
78
82
|
checkedOptions.forEach(option => {
|
|
79
|
-
if (placeholders.length > 0) {
|
|
80
|
-
placeholders = placeholders + ',';
|
|
81
|
-
}
|
|
82
83
|
const paramName = `PARAM_${column}_${params.length + 1}`;
|
|
83
|
-
placeholders = `${placeholders}:${paramName}`; //FIXME: trocar por ? quando o backend estiver funcionando
|
|
84
84
|
params.push({
|
|
85
85
|
dataType: dataType === DataType.OBJECT ? DataType.TEXT : dataType,
|
|
86
86
|
name: paramName,
|
|
87
87
|
value: option.value,
|
|
88
88
|
});
|
|
89
|
+
if (option.value == undefined) {
|
|
90
|
+
isNullIncluded = true;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (placeholders.length > 0) {
|
|
94
|
+
placeholders = placeholders + ',';
|
|
95
|
+
}
|
|
96
|
+
placeholders = `${placeholders}:${paramName}`;
|
|
97
|
+
}
|
|
89
98
|
});
|
|
90
|
-
const columnExpression = dataType === DataType.DATE ? `onlydate(this.${column})` : `this.${column}`;
|
|
91
99
|
return {
|
|
92
100
|
name: `${DISTINCT_FILTER_NAME_PREFIX}${column}`,
|
|
93
|
-
expression:
|
|
101
|
+
expression: this.getExpression(dataType, column, placeholders, isNullIncluded),
|
|
94
102
|
params,
|
|
95
103
|
};
|
|
96
104
|
}
|
|
@@ -98,6 +106,16 @@ export default class AgGridController {
|
|
|
98
106
|
})
|
|
99
107
|
.filter(item => item != undefined);
|
|
100
108
|
}
|
|
109
|
+
getExpression(dataType, columnName, placeholders, isNullIncluded) {
|
|
110
|
+
const columnExpression = dataType === DataType.DATE ? `onlydate(this.${columnName})` : `this.${columnName}`;
|
|
111
|
+
if (placeholders.length > 0 && isNullIncluded) {
|
|
112
|
+
return `(${columnExpression} in (${placeholders}) OR ${columnName} IS NULL)`;
|
|
113
|
+
}
|
|
114
|
+
if (isNullIncluded) {
|
|
115
|
+
return `${columnName} IS NULL`;
|
|
116
|
+
}
|
|
117
|
+
return `${columnExpression} in (${placeholders})`;
|
|
118
|
+
}
|
|
101
119
|
initDatagrid(container, options) {
|
|
102
120
|
var _a;
|
|
103
121
|
if (this._grid === undefined) {
|
|
@@ -164,11 +182,9 @@ export default class AgGridController {
|
|
|
164
182
|
this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
|
|
165
183
|
}
|
|
166
184
|
}
|
|
167
|
-
setFilterColumnLeftPosition(
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
const leftString = ePopup.style.left.replace('px', '');
|
|
171
|
-
this._filterColumnleftPosition = `${calcFilterColumnLeftPosition(parseInt(leftString))}px`;
|
|
185
|
+
setFilterColumnLeftPosition({ type, ePopup }) {
|
|
186
|
+
if (type === 'columnMenu') {
|
|
187
|
+
this._filterColumnleftPosition = ePopup.getBoundingClientRect().left;
|
|
172
188
|
return;
|
|
173
189
|
}
|
|
174
190
|
}
|
|
@@ -190,7 +206,7 @@ export default class AgGridController {
|
|
|
190
206
|
}
|
|
191
207
|
buildMenuItemOptionSort(params, sortOrder) {
|
|
192
208
|
return {
|
|
193
|
-
icon: `<i class='ez-icon-
|
|
209
|
+
icon: sortOrder === 'asc' ? `<i class='ez-icon-ordem-ascendente'></i>` : `<i class='ez-icon-ordem-descendente'></i>`,
|
|
194
210
|
name: sortOrder === 'asc' ? 'Ordenar Ascendente' : 'Ordenar Descendente',
|
|
195
211
|
action: () => this.sortDataByColumn(params, sortOrder),
|
|
196
212
|
};
|
|
@@ -608,10 +624,10 @@ export default class AgGridController {
|
|
|
608
624
|
tooltip: tooltip,
|
|
609
625
|
isSortable: propSortable,
|
|
610
626
|
hasFilter: () => this.hasFilterColumn(source.name),
|
|
611
|
-
showColumnFilter: (leftPosition
|
|
627
|
+
showColumnFilter: (leftPosition) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name), fromIcon: true }),
|
|
612
628
|
},
|
|
613
629
|
valueFormatter: params => {
|
|
614
|
-
if (params.value
|
|
630
|
+
if (params.value === undefined) {
|
|
615
631
|
return "";
|
|
616
632
|
}
|
|
617
633
|
if (params.value instanceof Promise) {
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { Action, ObjectUtils } from
|
|
1
|
+
import { Action, ObjectUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { EZ_GRID_LOADING_SOURCE } from "../../../../utils/constants";
|
|
3
|
+
import { DataSourceInterceptor } from "./DataSourceInterceptor";
|
|
3
4
|
export default class DataSource {
|
|
5
|
+
updateLoadedRecords(action) {
|
|
6
|
+
const records = action.payload;
|
|
7
|
+
if ((records === null || records === void 0 ? void 0 : records.length) > 0) {
|
|
8
|
+
records.forEach(record => {
|
|
9
|
+
this._controller.changeValues(record, [record.__record__id__]);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
4
13
|
isSilentChange(action) {
|
|
5
14
|
//TODO: Provisorio p/ não atualizar a grade quando a alteração for apenas de campos transisntes
|
|
6
15
|
var _a, _b;
|
|
@@ -29,7 +38,7 @@ export default class DataSource {
|
|
|
29
38
|
this._waitingForLoad = false;
|
|
30
39
|
this.callbackGetRows(this._lastLoadingParams);
|
|
31
40
|
if (this._options) {
|
|
32
|
-
this._options.onPaginationChange(this._dataUnit.getPaginationInfo());
|
|
41
|
+
this._options.onPaginationChange(this._dataUnit.getPaginationInfo(), action.payload.selectFirstRecord);
|
|
33
42
|
}
|
|
34
43
|
this.updateSelection();
|
|
35
44
|
break;
|
|
@@ -53,6 +62,9 @@ export default class DataSource {
|
|
|
53
62
|
case Action.PREVIOUS_SELECTED:
|
|
54
63
|
this.updateSelection();
|
|
55
64
|
break;
|
|
65
|
+
case Action.RECORD_LOADED:
|
|
66
|
+
this.updateLoadedRecords(action);
|
|
67
|
+
break;
|
|
56
68
|
}
|
|
57
69
|
};
|
|
58
70
|
this._dataUnit = dataUnit;
|
|
@@ -60,6 +72,7 @@ export default class DataSource {
|
|
|
60
72
|
this._controller.setColumnsDef(this.buildColumnDefs());
|
|
61
73
|
this._options = options;
|
|
62
74
|
this._dataUnit.subscribe(this.duObserver);
|
|
75
|
+
this._dataUnit.addInterceptor(new DataSourceInterceptor(this._controller));
|
|
63
76
|
}
|
|
64
77
|
updateSelection() {
|
|
65
78
|
const selectionInfo = this._dataUnit.getSelectionInfo();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Action } from "@sankhyalabs/core";
|
|
2
|
+
import { DISTINCT_FILTER_NAME_PREFIX, EZ_GRID_LOADING_SOURCE } from "../../../../utils/constants";
|
|
3
|
+
export class DataSourceInterceptor {
|
|
4
|
+
constructor(controller) {
|
|
5
|
+
this._controller = controller;
|
|
6
|
+
}
|
|
7
|
+
clearColumnFilter(filters) {
|
|
8
|
+
var _a;
|
|
9
|
+
return (_a = filters.filter(filter => !filter.name.startsWith(DISTINCT_FILTER_NAME_PREFIX))) !== null && _a !== void 0 ? _a : [];
|
|
10
|
+
}
|
|
11
|
+
interceptAction(action) {
|
|
12
|
+
var _a;
|
|
13
|
+
if (action.type === Action.LOADING_DATA) {
|
|
14
|
+
if (EZ_GRID_LOADING_SOURCE !== action.payload.source) {
|
|
15
|
+
action.payload.filters = ((_a = action.payload) === null || _a === void 0 ? void 0 : _a.filters) !== undefined ? this.clearColumnFilter(action.payload.filters) : action.payload.filters;
|
|
16
|
+
this._controller.clearFilter();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return action;
|
|
20
|
+
}
|
|
21
|
+
}
|
package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { calcFilterColumnLeftPosition } from '../AgGridUtils';
|
|
2
1
|
export class EzGridCustomHeader {
|
|
3
2
|
init(agParams) {
|
|
4
3
|
var _a;
|
|
@@ -13,8 +12,8 @@ export class EzGridCustomHeader {
|
|
|
13
12
|
</div>
|
|
14
13
|
<div id='ez-header-container' class='ez-flex ez-flex--justify-between ag-header-cell-text'>
|
|
15
14
|
<span class='ag-header-cell-text'>${this.params.displayName}</span>
|
|
16
|
-
<i id='ez-grid-sort-icon-
|
|
17
|
-
<i id='ez-grid-sort-icon-
|
|
15
|
+
<i id='ez-grid-sort-icon-descendente' class='ez-icon-ordem-descendente' style='display: none;font-weight: 100;margin-left: 4px;font-size: var(--text--large, 14px);align-self: center;'></i>
|
|
16
|
+
<i id='ez-grid-sort-icon-ascendente' class='ez-icon-ordem-ascendente' style='display: none;font-weight: 100;margin-left: 4px;font-size: var(--text--large, 14px);align-self: center;'></i>
|
|
18
17
|
</div>
|
|
19
18
|
`;
|
|
20
19
|
this.configMenuClick();
|
|
@@ -35,8 +34,7 @@ export class EzGridCustomHeader {
|
|
|
35
34
|
}
|
|
36
35
|
onClickFilter() {
|
|
37
36
|
var _a;
|
|
38
|
-
|
|
39
|
-
this.params.showColumnFilter(`${calcFilterColumnLeftPosition(iconLeft)}px`, true);
|
|
37
|
+
this.params.showColumnFilter((_a = this.filterButton) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().left);
|
|
40
38
|
}
|
|
41
39
|
configSortIcon() {
|
|
42
40
|
this.sortDownIcon.style.display = this.params.column.isSortDescending() ? 'flex' : 'none';
|
|
@@ -44,8 +42,8 @@ export class EzGridCustomHeader {
|
|
|
44
42
|
}
|
|
45
43
|
configSortListener() {
|
|
46
44
|
if (this.params.enableSorting) {
|
|
47
|
-
this.sortUpIcon = this.element.querySelector('#ez-grid-sort-icon-
|
|
48
|
-
this.sortDownIcon = this.element.querySelector('#ez-grid-sort-icon-
|
|
45
|
+
this.sortUpIcon = this.element.querySelector('#ez-grid-sort-icon-ascendente');
|
|
46
|
+
this.sortDownIcon = this.element.querySelector('#ez-grid-sort-icon-descendente');
|
|
49
47
|
this.onSortChangedListener = this.configSortIcon.bind(this);
|
|
50
48
|
this.params.column.addEventListener('sortChanged', this.onSortChangedListener);
|
|
51
49
|
this.configSortIcon();
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
grid-template-rows: auto 1fr auto;
|
|
5
5
|
height: 100%;
|
|
6
6
|
width: 100%;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
|
|
9
8
|
/*public*/
|
|
10
9
|
/*@doc Define a cor de fundo do header do componente.*/
|
|
11
10
|
--ez-grid__header--background-color: var(--background--xlight, #FFF);
|
|
@@ -13,6 +12,10 @@
|
|
|
13
12
|
--ez-grid__selection-counter--z-index: var(--visible, 1);
|
|
14
13
|
/*@doc Define o sombreamento usado como borda.*/
|
|
15
14
|
--ez-grid__container--shadow: 0 0 16px 0 rgb(0 38 111 / 12%);
|
|
15
|
+
/*@doc Define altura mínima da grid */
|
|
16
|
+
--ez-grid--min-height: 300px;
|
|
17
|
+
|
|
18
|
+
min-height: var(--ez-grid--min-height);
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
.grid-header {
|
|
@@ -93,3 +96,23 @@
|
|
|
93
96
|
height: 0;
|
|
94
97
|
padding: 0;
|
|
95
98
|
}
|
|
99
|
+
|
|
100
|
+
.grid-header__pagination{
|
|
101
|
+
width: 30%;
|
|
102
|
+
min-width: 100px;
|
|
103
|
+
justify-content: flex-end;
|
|
104
|
+
flex-wrap: wrap;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.grid-header__left-container{
|
|
108
|
+
width: 70%
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.grid-header__pagination-label {
|
|
112
|
+
width: 100%;
|
|
113
|
+
white-space: nowrap
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.overflowed {
|
|
117
|
+
display: none;
|
|
118
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ElementIDUtils, JSUtils, StringUtils, } from '@sankhyalabs/core';
|
|
1
|
+
import { ElementIDUtils, JSUtils, OverflowWatcher, OVERFLOWED_CLASS_NAME, StringUtils, } from '@sankhyalabs/core';
|
|
2
2
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
3
|
-
import {
|
|
3
|
+
import { Host, h } from '@stencil/core';
|
|
4
|
+
import { ApplicationUtils } from '../../utils';
|
|
4
5
|
import AgGridController from './controller/ag-grid/AgGridController';
|
|
5
6
|
import { SelectionCounter } from './subcomponents/selection-counter';
|
|
6
|
-
import { ApplicationUtils } from '../../utils';
|
|
7
7
|
import InMemoryFilterColumnDataSource from './utils/InMemoryFilterColumnDataSource';
|
|
8
8
|
const windowInstace = window;
|
|
9
9
|
const matches = (text, filter) => {
|
|
@@ -96,6 +96,14 @@ export class EzGrid {
|
|
|
96
96
|
observeConfig(config) {
|
|
97
97
|
this._gridController.setColumnsState(config.columns);
|
|
98
98
|
}
|
|
99
|
+
updatePaginationTooltip() {
|
|
100
|
+
if (!this._refPaginationLabelTooltip)
|
|
101
|
+
return;
|
|
102
|
+
const alreadyDefined = this._refPaginationLabelTooltip.getAttribute('data-tooltip');
|
|
103
|
+
if (alreadyDefined) {
|
|
104
|
+
this._refPaginationLabelTooltip.setAttribute('data-tooltip', this._getPaginationTooltip());
|
|
105
|
+
}
|
|
106
|
+
}
|
|
99
107
|
onSelectionChange(evt) {
|
|
100
108
|
this._currentPageSelected = evt.detail.selectionHeaderStatus === true;
|
|
101
109
|
if (this.dataUnit) {
|
|
@@ -144,21 +152,29 @@ export class EzGrid {
|
|
|
144
152
|
return newConfig;
|
|
145
153
|
}
|
|
146
154
|
positionSelectionCounter() {
|
|
147
|
-
var _a;
|
|
148
|
-
if (this._gridSelectionCounter
|
|
155
|
+
var _a, _b;
|
|
156
|
+
if (!this._gridSelectionCounter)
|
|
149
157
|
return;
|
|
150
|
-
|
|
151
|
-
if (this._showSelectionCounter) {
|
|
152
|
-
const boundingContainer = (_a = this._container) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
153
|
-
if (boundingContainer == undefined) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
const limitBottom = boundingContainer.bottom - 30;
|
|
157
|
-
this._gridSelectionCounter.style.bottom = document.body.clientHeight - limitBottom + 'px';
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
158
|
+
if (!this._showSelectionCounter) {
|
|
160
159
|
this._gridSelectionCounter.style.bottom = '';
|
|
160
|
+
return;
|
|
161
161
|
}
|
|
162
|
+
const containerRect = (_a = this._container) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
163
|
+
const selectionRect = (_b = this._gridSelectionCounter) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
164
|
+
if (!containerRect || !selectionRect)
|
|
165
|
+
return;
|
|
166
|
+
const positionBottom = containerRect.bottom - 30;
|
|
167
|
+
this._gridSelectionCounter.style.bottom = document.body.clientHeight - positionBottom + 'px';
|
|
168
|
+
this._gridSelectionCounter.style.left = this.calculatePositionLeft(containerRect, selectionRect);
|
|
169
|
+
}
|
|
170
|
+
calculatePositionLeft(containerRect, selectionRect) {
|
|
171
|
+
let selectionStart = containerRect.left + (containerRect.width / 2);
|
|
172
|
+
const containerRightEdge = containerRect.left + this._container.clientWidth;
|
|
173
|
+
const selectionEnd = (selectionStart - (selectionRect.width / 2)) + selectionRect.width;
|
|
174
|
+
if (selectionEnd > containerRightEdge) {
|
|
175
|
+
selectionStart = containerRightEdge - (selectionRect.width / 2);
|
|
176
|
+
}
|
|
177
|
+
return `${selectionStart}px`;
|
|
162
178
|
}
|
|
163
179
|
setEvents() {
|
|
164
180
|
window.removeEventListener('scroll', this.positionSelectionCounter.bind(this));
|
|
@@ -251,11 +267,10 @@ export class EzGrid {
|
|
|
251
267
|
}
|
|
252
268
|
getPaginationControl() {
|
|
253
269
|
if (this._paginationInfo) {
|
|
254
|
-
const {
|
|
270
|
+
const { currentPage, hasMore } = this._paginationInfo;
|
|
255
271
|
return [
|
|
256
|
-
h("div", { class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium" }, h("strong", { class: "ez-text ez-text--primary ez-text--medium" },
|
|
257
|
-
h("
|
|
258
|
-
h("ez-button", { size: "small", iconName: "chevron-right", class: "ez-margin-right--medium", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" }),
|
|
272
|
+
h("div", { class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium", ref: (element) => (this._refPaginationLabel = element) }, h("span", { class: "grid-header__pagination-label" }, h("strong", { class: "ez-text ez-text--primary ez-text--medium" }, this._getActualPageLabel()), this._getRemainingPageLabel())),
|
|
273
|
+
h("div", { id: "grid-pagination-tooltip", ref: (element) => (this._refPaginationLabelTooltip = element), class: "ez-flex ez-margin-right--medium" }, h("ez-button", { size: "small", class: "ez-margin-right--medium", iconName: "chevron-left", mode: "icon", enabled: currentPage > 0, onClick: () => this.previousPage(), label: "P\u00E1gina anterior" }), h("ez-button", { size: "small", iconName: "chevron-right", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })),
|
|
259
274
|
];
|
|
260
275
|
}
|
|
261
276
|
return null;
|
|
@@ -264,16 +279,8 @@ export class EzGrid {
|
|
|
264
279
|
this._gridController.initDatagrid(this._container, {
|
|
265
280
|
onColumnStateChange: (type, state, info) => this.onColumnStateChange(type, state, info),
|
|
266
281
|
onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
|
|
267
|
-
onPaginationChange: (paginationInfo) => {
|
|
268
|
-
|
|
269
|
-
if (((_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) > (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.currentPage) && this._paginationChangedByKeyboard) {
|
|
270
|
-
this._gridController.setFocusLastRow();
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
this._gridController.setFocusFirstRow();
|
|
274
|
-
this._paginationChangedByKeyboard = true;
|
|
275
|
-
}
|
|
276
|
-
this._paginationInfo = paginationInfo;
|
|
282
|
+
onPaginationChange: (paginationInfo, selectFirstRecord) => {
|
|
283
|
+
this.handlePaginationChange(selectFirstRecord, paginationInfo);
|
|
277
284
|
},
|
|
278
285
|
onPaginationUpdate: (paginationInfo) => {
|
|
279
286
|
this._paginationInfo = paginationInfo;
|
|
@@ -299,6 +306,66 @@ export class EzGrid {
|
|
|
299
306
|
this.setEvents();
|
|
300
307
|
this.componentReady.emit();
|
|
301
308
|
this._gridController.configFilterColumn(this._filterColumn);
|
|
309
|
+
this._initHeaderOverflowWatcher();
|
|
310
|
+
}
|
|
311
|
+
handlePaginationChange(selectFirstRecord, paginationInfo) {
|
|
312
|
+
var _a;
|
|
313
|
+
if (selectFirstRecord !== false) {
|
|
314
|
+
if (((_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) > (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.currentPage) && this._paginationChangedByKeyboard) {
|
|
315
|
+
this._gridController.setFocusLastRow();
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
this._gridController.setFocusFirstRow();
|
|
319
|
+
this._paginationChangedByKeyboard = true;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
this._paginationInfo = paginationInfo;
|
|
323
|
+
}
|
|
324
|
+
_getActualPageLabel() {
|
|
325
|
+
const { firstRecord, lastRecord } = this._paginationInfo;
|
|
326
|
+
return `${firstRecord}-${lastRecord}`;
|
|
327
|
+
}
|
|
328
|
+
_getRemainingPageLabel() {
|
|
329
|
+
const { total, count } = this._paginationInfo;
|
|
330
|
+
return `${total == undefined ? ` de ${count + 1} ou mais` : ` de ${total}`}`;
|
|
331
|
+
}
|
|
332
|
+
_getPaginationTooltip() {
|
|
333
|
+
return this._getActualPageLabel() + this._getRemainingPageLabel();
|
|
334
|
+
}
|
|
335
|
+
_initHeaderOverflowWatcher() {
|
|
336
|
+
this._headerOverflowWatcher = new OverflowWatcher(this.buildOverFlowWatcherParams());
|
|
337
|
+
}
|
|
338
|
+
buildOverFlowWatcherParams() {
|
|
339
|
+
return {
|
|
340
|
+
element: this._refPaginationControl,
|
|
341
|
+
callback: this.handleOverFlow.bind(this),
|
|
342
|
+
notOverFlow: ["grid-pagination-tooltip"]
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
handleOverFlow(elementsOverflow) {
|
|
346
|
+
if (!this._refPaginationLabel)
|
|
347
|
+
return;
|
|
348
|
+
if (elementsOverflow.length > 0) {
|
|
349
|
+
this._hidePaginationDescription();
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
this._showPaginationDescription();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
_hidePaginationDescription() {
|
|
356
|
+
this._refPaginationLabel.classList.add(OVERFLOWED_CLASS_NAME);
|
|
357
|
+
this._refPaginationLabelTooltip.setAttribute('data-flow', 'bottom');
|
|
358
|
+
this._refPaginationLabelTooltip.setAttribute('data-tooltip', this._getPaginationTooltip());
|
|
359
|
+
}
|
|
360
|
+
;
|
|
361
|
+
_showPaginationDescription() {
|
|
362
|
+
this._refPaginationLabel.classList.remove(OVERFLOWED_CLASS_NAME);
|
|
363
|
+
this._refPaginationLabelTooltip.removeAttribute('data-flow');
|
|
364
|
+
this._refPaginationLabelTooltip.removeAttribute('data-tooltip');
|
|
365
|
+
}
|
|
366
|
+
disconnectedCallback() {
|
|
367
|
+
var _a;
|
|
368
|
+
(_a = this._headerOverflowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
302
369
|
}
|
|
303
370
|
componentWillRender() {
|
|
304
371
|
this.configSelectionCounter();
|
|
@@ -322,7 +389,7 @@ export class EzGrid {
|
|
|
322
389
|
}
|
|
323
390
|
render() {
|
|
324
391
|
var _a;
|
|
325
|
-
return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: "grid__container ez-grid", ref: elem => (this._container = elem) }), h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter ez-elevation--4
|
|
392
|
+
return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: "grid__container ez-grid", ref: elem => (this._container = elem) }), h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container grid-header__left-container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container grid-header__pagination", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter ez-elevation--4
|
|
326
393
|
${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
|
|
327
394
|
` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, paginationInfo: this._paginationInfo, canSelectAll: (_a = this.selectionToastConfig) === null || _a === void 0 ? void 0 : _a.canSelectAll, allRecordSelected: this._isAllSelection, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => (this._showSelectionCounter = false) })), h("div", { class: "grid__footer" }, h("slot", { name: "footer" }))));
|
|
328
395
|
}
|
|
@@ -887,6 +954,9 @@ export class EzGrid {
|
|
|
887
954
|
return [{
|
|
888
955
|
"propName": "config",
|
|
889
956
|
"methodName": "observeConfig"
|
|
957
|
+
}, {
|
|
958
|
+
"propName": "_paginationInfo",
|
|
959
|
+
"methodName": "updatePaginationTooltip"
|
|
890
960
|
}];
|
|
891
961
|
}
|
|
892
962
|
static get listeners() {
|
|
@@ -13,6 +13,8 @@ export class FilterColumn {
|
|
|
13
13
|
this.TOP_POSITION_NO_TASKBAR = '32';
|
|
14
14
|
this.TOP_POSITION_NO_TASKBAR_HEADER_HIDDEN = '20';
|
|
15
15
|
this.DEFAULT_HEIGHT = 430;
|
|
16
|
+
this.FIX_MARGIN = 60;
|
|
17
|
+
this.FILTER_COLUMN_WIDTH = 330;
|
|
16
18
|
this.opened = true;
|
|
17
19
|
this.columnName = undefined;
|
|
18
20
|
this.columnLabel = undefined;
|
|
@@ -45,15 +47,24 @@ export class FilterColumn {
|
|
|
45
47
|
await this.ezPopoverElement.show(this.calcTopPosition(), this.calculateLeftPosition(configs));
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
calculateLeftPosition(
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
calculateLeftPosition({ leftPosition, fromIcon }) {
|
|
51
|
+
const leftPositionCalculated = this.calcFilterColumnLeftPosition(leftPosition);
|
|
52
|
+
if (!fromIcon) {
|
|
53
|
+
return `${leftPositionCalculated}px`;
|
|
51
54
|
}
|
|
52
55
|
const difference = this.ezPopoverElement.getBoundingClientRect().left;
|
|
53
|
-
const
|
|
54
|
-
const leftResolved = (leftReference + 16) - difference;
|
|
56
|
+
const leftResolved = (leftPositionCalculated + 16) - difference;
|
|
55
57
|
return `${(leftResolved > 0 ? leftResolved : 0)}px`;
|
|
56
58
|
}
|
|
59
|
+
calcFilterColumnLeftPosition(leftReference) {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
const gridReference = this.ezPopoverElement.closest("ez-grid");
|
|
62
|
+
const gridLimit = (_a = gridReference.getBoundingClientRect()) === null || _a === void 0 ? void 0 : _a.right;
|
|
63
|
+
const popoverDiff = (_b = this.ezPopoverElement.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.left;
|
|
64
|
+
const maxLeft = gridLimit - (this.FILTER_COLUMN_WIDTH + popoverDiff);
|
|
65
|
+
const leftInt = leftReference - (this.FIX_MARGIN + popoverDiff);
|
|
66
|
+
return leftInt > maxLeft ? maxLeft : leftInt;
|
|
67
|
+
}
|
|
57
68
|
buildIsTextSearch() {
|
|
58
69
|
var _a, _b;
|
|
59
70
|
const userInterface = (_b = (_a = this.fieldDescriptor) === null || _a === void 0 ? void 0 : _a.userInterface) !== null && _b !== void 0 ? _b : UserInterface.SHORTTEXT;
|