@sankhyalabs/sankhyablocks 1.4.0-beta.1 → 1.4.0-beta.3
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/{SnkMessageBuilder-7717f1e4.js → SnkMessageBuilder-d8215915.js} +14 -119
- package/dist/cjs/{filter-item-type.enum-e2e1bc5b.js → filter-item-type.enum-3daf58d3.js} +2 -0
- package/dist/cjs/{index-b0b676c5.js → index-6fcf07f3.js} +159 -1515
- package/dist/cjs/loader.cjs.js +2 -18
- package/dist/cjs/sankhyablocks.cjs.js +4 -116
- package/dist/cjs/snk-application.cjs.entry.js +84 -230
- package/dist/cjs/snk-crud.cjs.entry.js +3 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +24 -32
- package/dist/cjs/snk-filter-bar_5.cjs.entry.js +902 -0
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-detail.cjs.entry.js +38 -3
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-number.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-period.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-personalized.cjs.entry.js +90 -0
- package/dist/cjs/snk-filter-search.cjs.entry.js +4 -4
- package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
- package/dist/cjs/{snk-form.cjs.entry.js → snk-form_2.cjs.entry.js} +119 -5
- package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
- package/dist/cjs/{taskbar-elements-283c737e.js → taskbar-elements-aedfeae6.js} +1 -1
- package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/snk-application/snk-application.js +54 -7
- package/dist/collection/components/snk-crud/snk-crud.js +2 -4
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +0 -27
- package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +100 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +161 -0
- package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +2 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +36 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +32 -9
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +196 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +22 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +238 -139
- package/dist/collection/components/snk-grid/snk-grid.js +2 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +18 -10
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +14 -2
- package/dist/components/SnkMessageBuilder.js +15 -119
- package/dist/components/filter-item-type.enum.js +2 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -4
- package/dist/components/snk-application2.js +47 -191
- package/dist/components/snk-crud.js +16 -10
- package/dist/components/snk-data-unit.js +3 -12
- package/dist/components/snk-filter-bar2.js +342 -146
- package/dist/components/snk-filter-detail2.js +36 -1
- package/dist/components/snk-filter-item2.js +33 -10
- package/dist/components/snk-filter-list2.js +1 -1
- package/dist/components/snk-filter-modal.d.ts +11 -0
- package/dist/components/snk-filter-modal.js +6 -0
- package/dist/components/snk-filter-modal2.js +58 -0
- package/dist/components/snk-filter-personalized.d.ts +11 -0
- package/dist/components/snk-filter-personalized.js +108 -0
- package/dist/components/snk-filter-search.js +1 -1
- package/dist/components/snk-form2.js +1 -1
- package/dist/components/snk-grid2.js +16 -10
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/snk-taskbar2.js +1 -1
- package/dist/components/teste-pesquisa.js +1 -1
- package/dist/{sankhyablocks/SnkMessageBuilder-a7da466b.js → esm/SnkMessageBuilder-35a20271.js} +15 -119
- package/dist/esm/{filter-item-type.enum-61fbf80a.js → filter-item-type.enum-a79b2fa8.js} +2 -0
- package/dist/{sankhyablocks/index-2b4d2d14.js → esm/index-81dda3cf.js} +160 -1508
- package/dist/esm/loader.js +2 -18
- package/dist/esm/sankhyablocks.js +4 -116
- package/dist/esm/snk-application.entry.js +46 -192
- package/dist/esm/snk-crud.entry.js +2 -2
- package/dist/esm/snk-data-unit.entry.js +4 -12
- package/dist/esm/snk-filter-bar_5.entry.js +894 -0
- package/dist/esm/snk-filter-binary-select.entry.js +2 -2
- package/dist/esm/snk-filter-detail.entry.js +38 -3
- package/dist/esm/snk-filter-multi-select.entry.js +2 -2
- package/dist/esm/snk-filter-number.entry.js +2 -2
- package/dist/esm/snk-filter-period.entry.js +2 -2
- package/dist/esm/snk-filter-personalized.entry.js +86 -0
- package/dist/esm/snk-filter-search.entry.js +3 -3
- package/dist/esm/snk-filter-text.entry.js +1 -1
- package/dist/esm/{snk-form.entry.js → snk-form_2.entry.js} +117 -4
- package/dist/esm/snk-pesquisa.entry.js +2 -2
- package/dist/{sankhyablocks/taskbar-elements-35d64ff9.js → esm/taskbar-elements-38eb5d51.js} +1 -1
- package/dist/esm/teste-pesquisa.entry.js +2 -2
- package/dist/sankhyablocks/index.esm.js +0 -1
- package/dist/sankhyablocks/p-0352c0e2.entry.js +1 -0
- package/dist/sankhyablocks/p-07ebda01.entry.js +1 -0
- package/dist/sankhyablocks/p-322c0df2.entry.js +1 -0
- package/dist/sankhyablocks/p-46caa101.entry.js +1 -0
- package/dist/sankhyablocks/p-473cedf9.entry.js +1 -0
- package/dist/sankhyablocks/p-586e2522.js +1 -0
- package/dist/sankhyablocks/p-86f15ffe.js +1 -0
- package/dist/sankhyablocks/p-8f3c5709.entry.js +1 -0
- package/dist/sankhyablocks/p-97009a2c.entry.js +1 -0
- package/dist/sankhyablocks/p-9be74b46.entry.js +74 -0
- package/dist/sankhyablocks/p-9dd2b8cb.js +1 -0
- package/dist/sankhyablocks/p-a8b59c61.entry.js +1 -0
- package/dist/sankhyablocks/p-aecf3e0a.entry.js +1 -0
- package/dist/sankhyablocks/p-c1c3b5d8.entry.js +1 -0
- package/dist/sankhyablocks/p-c78cb79a.entry.js +1 -0
- package/dist/sankhyablocks/p-c9eec639.entry.js +1 -0
- package/dist/sankhyablocks/p-dc482a42.entry.js +1 -0
- package/dist/sankhyablocks/p-fac2b6a9.js +2 -0
- package/dist/sankhyablocks/p-fb705f81.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -129
- package/dist/types/components/snk-application/snk-application.d.ts +4 -1
- package/dist/types/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +23 -0
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +3 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +23 -0
- package/dist/types/components.d.ts +56 -8
- package/package.json +3 -3
- package/react/components.d.ts +19 -0
- package/react/components.js +19 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/app-globals-3a1e7e63.js +0 -5
- package/dist/cjs/css-shim-b8158822.js +0 -6
- package/dist/cjs/dom-36862b77.js +0 -75
- package/dist/cjs/index-02201bc9.js +0 -2397
- package/dist/cjs/shadow-css-346c0795.js +0 -389
- package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -278
- package/dist/cjs/snk-filter-item.cjs.entry.js +0 -154
- package/dist/cjs/snk-filter-list.cjs.entry.js +0 -91
- package/dist/cjs/snk-grid.cjs.entry.js +0 -79
- package/dist/cjs/snk-taskbar.cjs.entry.js +0 -160
- package/dist/cjs/taskbar-processor-6bd0d35c.js +0 -47
- package/dist/components/index2.js +0 -2384
- package/dist/esm/SnkMessageBuilder-a7da466b.js +0 -303
- package/dist/esm/app-globals-0f993ce5.js +0 -3
- package/dist/esm/css-shim-b3f2ee8d.js +0 -4
- package/dist/esm/dom-665d6011.js +0 -73
- package/dist/esm/index-2b4d2d14.js +0 -3262
- package/dist/esm/index-f1d3e4da.js +0 -2384
- package/dist/esm/shadow-css-b18e99d7.js +0 -387
- package/dist/esm/snk-filter-bar.entry.js +0 -274
- package/dist/esm/snk-filter-item.entry.js +0 -150
- package/dist/esm/snk-filter-list.entry.js +0 -87
- package/dist/esm/snk-grid.entry.js +0 -75
- package/dist/esm/snk-taskbar.entry.js +0 -156
- package/dist/esm/taskbar-elements-35d64ff9.js +0 -90
- package/dist/esm/taskbar-processor-aa6772c9.js +0 -45
- package/dist/sankhyablocks/app-globals-0f993ce5.js +0 -3
- package/dist/sankhyablocks/css-shim-b3f2ee8d.js +0 -4
- package/dist/sankhyablocks/dom-665d6011.js +0 -73
- package/dist/sankhyablocks/filter-item-type.enum-61fbf80a.js +0 -12
- package/dist/sankhyablocks/index-f1d3e4da.js +0 -2384
- package/dist/sankhyablocks/shadow-css-b18e99d7.js +0 -387
- package/dist/sankhyablocks/snk-application.entry.js +0 -8148
- package/dist/sankhyablocks/snk-crud.entry.js +0 -66
- package/dist/sankhyablocks/snk-data-unit.entry.js +0 -276
- package/dist/sankhyablocks/snk-filter-bar.entry.js +0 -274
- package/dist/sankhyablocks/snk-filter-binary-select.entry.js +0 -43
- package/dist/sankhyablocks/snk-filter-detail.entry.js +0 -45
- package/dist/sankhyablocks/snk-filter-item.entry.js +0 -150
- package/dist/sankhyablocks/snk-filter-list.entry.js +0 -87
- package/dist/sankhyablocks/snk-filter-multi-select.entry.js +0 -19
- package/dist/sankhyablocks/snk-filter-number.entry.js +0 -20
- package/dist/sankhyablocks/snk-filter-period.entry.js +0 -33
- package/dist/sankhyablocks/snk-filter-search.entry.js +0 -40
- package/dist/sankhyablocks/snk-filter-text.entry.js +0 -18
- package/dist/sankhyablocks/snk-form.entry.js +0 -129
- package/dist/sankhyablocks/snk-grid.entry.js +0 -75
- package/dist/sankhyablocks/snk-pesquisa.entry.js +0 -311
- package/dist/sankhyablocks/snk-taskbar.entry.js +0 -156
- package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +0 -45
- package/dist/sankhyablocks/teste-pesquisa.entry.js +0 -33
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -51
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-b0b676c5.js');
|
|
6
|
-
const index$1 = require('./index-02201bc9.js');
|
|
7
|
-
const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
|
|
8
|
-
|
|
9
|
-
const SnkFilterItem = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
index.registerInstance(this, hostRef);
|
|
12
|
-
this.filterChange = index.createEvent(this, "filterChange", 7);
|
|
13
|
-
this.innerClickCheck = (floatingContainer, node) => {
|
|
14
|
-
if (this._popover.keepOpened) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
if (node && floatingContainer) {
|
|
18
|
-
if (!node.offsetParent) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
let current = node;
|
|
22
|
-
do {
|
|
23
|
-
if (current === floatingContainer) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
} while ((current = current.offsetParent) != null);
|
|
27
|
-
}
|
|
28
|
-
this.detailIsVisible = false;
|
|
29
|
-
return false;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
async showUp(open = false) {
|
|
33
|
-
this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
|
|
34
|
-
if (open) {
|
|
35
|
-
window.requestAnimationFrame(() => {
|
|
36
|
-
this.showDetail();
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
showDetail() {
|
|
41
|
-
this._floatingID = index$1.FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
|
|
42
|
-
this.detailIsVisible = true;
|
|
43
|
-
}
|
|
44
|
-
getScrollOffset() {
|
|
45
|
-
return `${this._filterItemElement.getBoundingClientRect().left + 12}px`;
|
|
46
|
-
}
|
|
47
|
-
hideDetail() {
|
|
48
|
-
if (this._floatingID != undefined) {
|
|
49
|
-
index$1.FloatingManager.close(this._floatingID);
|
|
50
|
-
}
|
|
51
|
-
this._floatingID = undefined;
|
|
52
|
-
this.detailIsVisible = false;
|
|
53
|
-
}
|
|
54
|
-
//---------------------------------------------
|
|
55
|
-
// Event handlers
|
|
56
|
-
//---------------------------------------------
|
|
57
|
-
clickListener(evt) {
|
|
58
|
-
if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
|
|
59
|
-
if (evt.target === this._rightIconElement && this.config.value != undefined) {
|
|
60
|
-
this.filterChange.emit(Object.assign(Object.assign({}, this.config), { value: undefined }));
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
if (this.detailIsVisible) {
|
|
64
|
-
this.hideDetail();
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
this.showDetail();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
evt.preventDefault();
|
|
71
|
-
evt.stopImmediatePropagation();
|
|
72
|
-
evt.stopPropagation();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
mouseDownListener(evt) {
|
|
76
|
-
if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
|
|
77
|
-
evt.preventDefault();
|
|
78
|
-
evt.stopImmediatePropagation();
|
|
79
|
-
evt.stopPropagation();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
getLabel() {
|
|
83
|
-
const { type, value, label, props } = this.config;
|
|
84
|
-
if (value) {
|
|
85
|
-
if (type === filterItemType_enum.FilterItemType.BINARY_SELECT) {
|
|
86
|
-
const [optOne, optTwo] = props.options;
|
|
87
|
-
if (optOne.name === value) {
|
|
88
|
-
return optOne.label;
|
|
89
|
-
}
|
|
90
|
-
if (optTwo.name === value) {
|
|
91
|
-
return optTwo.label;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (type === filterItemType_enum.FilterItemType.MULTI_SELECT) {
|
|
95
|
-
const opt = props.options.find(opt => opt.value === value);
|
|
96
|
-
return `${label}: ${opt.label}`;
|
|
97
|
-
}
|
|
98
|
-
if (type === filterItemType_enum.FilterItemType.PERIOD) {
|
|
99
|
-
let { end, start } = value;
|
|
100
|
-
if (typeof end === "string") {
|
|
101
|
-
end = new Date(end);
|
|
102
|
-
end.setMinutes(end.getMinutes() + end.getTimezoneOffset());
|
|
103
|
-
}
|
|
104
|
-
if (typeof start === "string") {
|
|
105
|
-
start = new Date(start);
|
|
106
|
-
start.setMinutes(start.getMinutes() + start.getTimezoneOffset());
|
|
107
|
-
}
|
|
108
|
-
const dateFormater = new Intl.DateTimeFormat("pt-BR");
|
|
109
|
-
if (end && start) {
|
|
110
|
-
return `${label}: ${dateFormater.format(start)} a ${dateFormater.format(end)}`;
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
if (start) {
|
|
114
|
-
return `${label}: A partir de ${dateFormater.format(start)}`;
|
|
115
|
-
}
|
|
116
|
-
else if (end) {
|
|
117
|
-
return `${label}: Até ${dateFormater.format(end)}`;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
return label;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (type === filterItemType_enum.FilterItemType.SEARCH) {
|
|
125
|
-
return `${label}: ${value.value} - ${value.label}`;
|
|
126
|
-
}
|
|
127
|
-
return `${label}: ${value}`;
|
|
128
|
-
}
|
|
129
|
-
return label;
|
|
130
|
-
}
|
|
131
|
-
componentDidRender() {
|
|
132
|
-
if (this._floatingID == undefined) {
|
|
133
|
-
if (this._popover) {
|
|
134
|
-
this._popover.remove();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
filterChangeListener() {
|
|
139
|
-
this.hideDetail();
|
|
140
|
-
}
|
|
141
|
-
getIconName() {
|
|
142
|
-
if (this.config.value != undefined) {
|
|
143
|
-
return "close";
|
|
144
|
-
}
|
|
145
|
-
return this.detailIsVisible ? "chevron-up" : "chevron-down";
|
|
146
|
-
}
|
|
147
|
-
render() {
|
|
148
|
-
const leftIcon = this.config.type === filterItemType_enum.FilterItemType.PERIOD ? "calendar" : undefined;
|
|
149
|
-
return (index.h(index.Host, null, index.h("ez-chip", { ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined }, leftIcon ? index.h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, index.h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getIconName(), class: "ez-padding-left--small", slot: "rightIcon" })), index.h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, index.h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id }))));
|
|
150
|
-
}
|
|
151
|
-
get _filterItemElement() { return index.getElement(this); }
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
exports.snk_filter_item = SnkFilterItem;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-b0b676c5.js');
|
|
6
|
-
const index$1 = require('./index-02201bc9.js');
|
|
7
|
-
|
|
8
|
-
const SHOW_MORE_ITEM_NAME = "__SHOWMORE__";
|
|
9
|
-
const MAX_FILTERS = 5;
|
|
10
|
-
const SnkFilterList = class {
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
index.registerInstance(this, hostRef);
|
|
13
|
-
this.snkItemSelected = index.createEvent(this, "snkItemSelected", 7);
|
|
14
|
-
this.innerClickCheck = (floatingContainer, node) => {
|
|
15
|
-
if (node && floatingContainer) {
|
|
16
|
-
if (!node.offsetParent) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
let current = node;
|
|
20
|
-
do {
|
|
21
|
-
if (current === floatingContainer || current === this._element) {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
} while ((current = current.offsetParent) != null);
|
|
25
|
-
}
|
|
26
|
-
this._detailIsVisible = false;
|
|
27
|
-
return false;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
showList() {
|
|
31
|
-
this._floatingID = index$1.FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck });
|
|
32
|
-
this._detailIsVisible = true;
|
|
33
|
-
this._showAll = false;
|
|
34
|
-
this._filterArgument = "";
|
|
35
|
-
}
|
|
36
|
-
hideList() {
|
|
37
|
-
if (this._floatingID != undefined) {
|
|
38
|
-
index$1.FloatingManager.close(this._floatingID);
|
|
39
|
-
}
|
|
40
|
-
this._floatingID = undefined;
|
|
41
|
-
this._detailIsVisible = false;
|
|
42
|
-
}
|
|
43
|
-
buttonClick() {
|
|
44
|
-
if (this._detailIsVisible) {
|
|
45
|
-
this.hideList();
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
this.showList();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
componentDidRender() {
|
|
52
|
-
if (this._floatingID == undefined) {
|
|
53
|
-
if (this._popover) {
|
|
54
|
-
this._popover.remove();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
buildItemElement(item) {
|
|
59
|
-
return (index.h("div", { class: "ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item", onClick: () => this.itemSelected(item.name) }, item.iconName ? index.h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, index.h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
|
|
60
|
-
}
|
|
61
|
-
itemSelected(itemName) {
|
|
62
|
-
if (itemName === SHOW_MORE_ITEM_NAME) {
|
|
63
|
-
this._showAll = true;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
this.hideList();
|
|
67
|
-
this.snkItemSelected.emit(itemName);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
getFilterItems() {
|
|
71
|
-
const items = this.items ? index$1.ArrayUtils.applyStringFilter(this._filterArgument, this.items.filter(item => item.kind === "FILTER")) : [];
|
|
72
|
-
if (items.length === 0) {
|
|
73
|
-
return index.h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty" }, this.emptyText);
|
|
74
|
-
}
|
|
75
|
-
const hideItems = !this._filterArgument && !this._showAll && (items.length > MAX_FILTERS + 1);
|
|
76
|
-
if (hideItems) {
|
|
77
|
-
items.splice(MAX_FILTERS);
|
|
78
|
-
items.push({ kind: "INTERNAL", label: "Mostrar mais", iconName: "dots-horizontal", name: SHOW_MORE_ITEM_NAME, iconClass: "snk-filter-bar__filter-list-item__icon--secondary", labelClass: "snk-filter-bar__filter-list-item__label--secondary" });
|
|
79
|
-
}
|
|
80
|
-
return index.h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
|
|
81
|
-
}
|
|
82
|
-
getFooterItems() {
|
|
83
|
-
return this.items.filter(item => item.kind === "FOOTER");
|
|
84
|
-
}
|
|
85
|
-
render() {
|
|
86
|
-
return (index.h(index.Host, { class: "ez-flex ez-flex--column" }, index.h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, index.h("slot", { name: "leftIcon" })), index.h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, index.h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, index.h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail }), this.getFilterItems(), index.h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
|
|
87
|
-
}
|
|
88
|
-
get _element() { return index.getElement(this); }
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
exports.snk_filter_list = SnkFilterList;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-b0b676c5.js');
|
|
6
|
-
const index$1 = require('./index-02201bc9.js');
|
|
7
|
-
const taskbarElements = require('./taskbar-elements-283c737e.js');
|
|
8
|
-
const taskbarProcessor = require('./taskbar-processor-6bd0d35c.js');
|
|
9
|
-
|
|
10
|
-
const snkGridCss = ".snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{display:flex;flex-wrap:nowrap;width:100%}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--small)}";
|
|
11
|
-
|
|
12
|
-
const SnkGrid = class {
|
|
13
|
-
constructor(hostRef) {
|
|
14
|
-
index.registerInstance(this, hostRef);
|
|
15
|
-
this.actionClick = index.createEvent(this, "actionClick", 7);
|
|
16
|
-
this.gridDoubleClick = index.createEvent(this, "gridDoubleClick", 7);
|
|
17
|
-
this._topTaskbarProcessor = new taskbarProcessor.TaskbarProcessor({
|
|
18
|
-
"snkGridTopTaskbar": ["FORM_MODE", "CONFIG_GRID", "INSERT"]
|
|
19
|
-
});
|
|
20
|
-
this._headerTaskbarProcessor = new taskbarProcessor.TaskbarProcessor({
|
|
21
|
-
"snkGridHeaderTaskbar.unselected": ["REFRESH"],
|
|
22
|
-
"snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
actionClickHandler(evt) {
|
|
26
|
-
if (evt.detail === taskbarElements.TaskbarElement.CONFIG_GRID && this._grid) {
|
|
27
|
-
this._grid.openGridConfig();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
saveConfig(config) {
|
|
31
|
-
const snkApplication = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
32
|
-
if (snkApplication) {
|
|
33
|
-
snkApplication.saveGridConfig(config);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
componentWillLoad() {
|
|
37
|
-
const snkApplication = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
38
|
-
if (snkApplication) {
|
|
39
|
-
snkApplication.loadGridConfig(this.configName).then(cfg => {
|
|
40
|
-
this._gridConfig = cfg;
|
|
41
|
-
this._configLoaded = true;
|
|
42
|
-
});
|
|
43
|
-
//Forçamos a carga dos acessos pra aproveitar a request inicial.
|
|
44
|
-
snkApplication.getAllAccess();
|
|
45
|
-
}
|
|
46
|
-
let parent = this._element.parentElement;
|
|
47
|
-
while (parent) {
|
|
48
|
-
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
49
|
-
this._snkDataUnit = parent;
|
|
50
|
-
this._dataUnit = this._snkDataUnit.dataUnit;
|
|
51
|
-
if (!this._dataUnit) {
|
|
52
|
-
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
53
|
-
this._dataUnit = evt.detail;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
|
|
57
|
-
this._dataState = evt.detail;
|
|
58
|
-
});
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
parent = parent.parentElement;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
componentWillRender() {
|
|
65
|
-
const headerTaskbarId = this._dataState && this._dataState.selectedRecords.length > 0 ? "snkGridHeaderTaskbar.selected" : "snkGridHeaderTaskbar.unselected";
|
|
66
|
-
this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState);
|
|
67
|
-
this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState);
|
|
68
|
-
}
|
|
69
|
-
render() {
|
|
70
|
-
if (!this._configLoaded || !this._dataUnit) {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, index.h("snk-filter-bar", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), index.h("snk-taskbar", { class: "ez-padding-left--medium", onActionClick: evt => this.actionClickHandler(evt), key: "topTaskbar", dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), index.h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: evt => { this.saveConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver }, index.h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" }))));
|
|
74
|
-
}
|
|
75
|
-
get _element() { return index.getElement(this); }
|
|
76
|
-
};
|
|
77
|
-
SnkGrid.style = snkGridCss;
|
|
78
|
-
|
|
79
|
-
exports.snk_grid = SnkGrid;
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-b0b676c5.js');
|
|
6
|
-
const index$1 = require('./index-02201bc9.js');
|
|
7
|
-
const taskbarElements = require('./taskbar-elements-283c737e.js');
|
|
8
|
-
|
|
9
|
-
const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
|
|
10
|
-
|
|
11
|
-
const SnkTaskbar = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
index.registerInstance(this, hostRef);
|
|
14
|
-
this.actionClick = index.createEvent(this, "actionClick", 7);
|
|
15
|
-
this._titleKeyByElement = {
|
|
16
|
-
[taskbarElements.TaskbarElement.UPDATE]: "snkTaskbar.titleUpdate",
|
|
17
|
-
[taskbarElements.TaskbarElement.PREVIOUS]: "snkTaskbar.titlePrevious",
|
|
18
|
-
[taskbarElements.TaskbarElement.NEXT]: "snkTaskbar.titleNext",
|
|
19
|
-
[taskbarElements.TaskbarElement.REFRESH]: "snkTaskbar.titleRefresh",
|
|
20
|
-
[taskbarElements.TaskbarElement.CLONE]: "snkTaskbar.titleClone",
|
|
21
|
-
[taskbarElements.TaskbarElement.REMOVE]: "snkTaskbar.titleRemove",
|
|
22
|
-
[taskbarElements.TaskbarElement.MORE_OPTIONS]: "snkTaskbar.titleMoreOptions",
|
|
23
|
-
[taskbarElements.TaskbarElement.INSERT]: "snkTaskbar.titleInsert",
|
|
24
|
-
[taskbarElements.TaskbarElement.CANCEL]: "snkTaskbar.titleCancel",
|
|
25
|
-
[taskbarElements.TaskbarElement.SAVE]: "snkTaskbar.titleSave",
|
|
26
|
-
[taskbarElements.TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
|
|
27
|
-
[taskbarElements.TaskbarElement.CONFIG_GRID]: "snkTaskbar.titleConfigGrid",
|
|
28
|
-
[taskbarElements.TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode"
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
observeButtons() {
|
|
32
|
-
this._definitions = undefined;
|
|
33
|
-
}
|
|
34
|
-
// Internal methods
|
|
35
|
-
elementsFromString(strButtons) {
|
|
36
|
-
const elements = [];
|
|
37
|
-
if (strButtons) {
|
|
38
|
-
strButtons.split(",").forEach(buttonName => {
|
|
39
|
-
buttonName = buttonName.trim();
|
|
40
|
-
if (taskbarElements.VisibleWhenForbidden[buttonName] || this.isAllowed(buttonName)) {
|
|
41
|
-
elements.push(buttonName.trim());
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return elements;
|
|
46
|
-
}
|
|
47
|
-
isAllowed(buttonName) {
|
|
48
|
-
if (taskbarElements.AuthorizationElements[buttonName]) {
|
|
49
|
-
return this._permissions ? this._permissions.isSup || this._permissions[buttonName] : false;
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
55
|
-
* através de um pequeno modulo na estrutura da aplicação:
|
|
56
|
-
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
57
|
-
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-taskbar.msg.ts"
|
|
58
|
-
*/
|
|
59
|
-
getTitle(element) {
|
|
60
|
-
let key;
|
|
61
|
-
if (this.isAllowed(element)) {
|
|
62
|
-
key = this._titleKeyByElement[element];
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
key = "snkTaskbar.forbidden";
|
|
66
|
-
}
|
|
67
|
-
return key ? this._application.messagesBuilder.getMessage(key, {}) : "";
|
|
68
|
-
}
|
|
69
|
-
elementClick(elem) {
|
|
70
|
-
if (this.dataUnit) {
|
|
71
|
-
switch (elem) {
|
|
72
|
-
case taskbarElements.TaskbarElement.PREVIOUS:
|
|
73
|
-
this.dataUnit.previousRecord();
|
|
74
|
-
break;
|
|
75
|
-
case taskbarElements.TaskbarElement.NEXT:
|
|
76
|
-
this.dataUnit.nextRecord();
|
|
77
|
-
break;
|
|
78
|
-
case taskbarElements.TaskbarElement.REFRESH:
|
|
79
|
-
this.dataUnit.loadData();
|
|
80
|
-
break;
|
|
81
|
-
case taskbarElements.TaskbarElement.CLONE:
|
|
82
|
-
this.dataUnit.copySelected();
|
|
83
|
-
break;
|
|
84
|
-
case taskbarElements.TaskbarElement.REMOVE:
|
|
85
|
-
this.dataUnit.removeSelectedRecords();
|
|
86
|
-
break;
|
|
87
|
-
case taskbarElements.TaskbarElement.INSERT:
|
|
88
|
-
this.dataUnit.addRecord();
|
|
89
|
-
break;
|
|
90
|
-
case taskbarElements.TaskbarElement.CANCEL:
|
|
91
|
-
this.dataUnit.cancelEdition();
|
|
92
|
-
break;
|
|
93
|
-
case taskbarElements.TaskbarElement.SAVE:
|
|
94
|
-
this.dataUnit.saveData();
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
this.actionClick.emit(elem);
|
|
99
|
-
}
|
|
100
|
-
isEnabled(elem) {
|
|
101
|
-
if (!this.isAllowed(elem)) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
return !(this.disabledButtons && this.disabledButtons.includes(elem));
|
|
105
|
-
}
|
|
106
|
-
getElement(index, def) {
|
|
107
|
-
let className = def === this.primaryButton ? "ez-button--primary " : "";
|
|
108
|
-
if (index > 1) {
|
|
109
|
-
className += "ez-padding-left--medium";
|
|
110
|
-
}
|
|
111
|
-
if (taskbarElements.TaskbarElement[def.toString()]) {
|
|
112
|
-
return taskbarElements.buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
return taskbarElements.buildCustomButton(def, className, elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
// Lifecycle
|
|
119
|
-
componentWillLoad() {
|
|
120
|
-
this._application = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
121
|
-
if (this._application) {
|
|
122
|
-
this._application.getAllAccess().then(access => this._permissions = access);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
this._permissions = {};
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
componentWillRender() {
|
|
129
|
-
if (this._definitions == undefined && this._permissions) {
|
|
130
|
-
this._definitions = this.elementsFromString(this.buttons);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
render() {
|
|
134
|
-
if (this._definitions === undefined) {
|
|
135
|
-
return undefined;
|
|
136
|
-
}
|
|
137
|
-
let index$1 = 0;
|
|
138
|
-
return (index.h(index.Host, null, this._definitions.map((elem) => {
|
|
139
|
-
if (elem === taskbarElements.TaskbarElement.DIVIDER) {
|
|
140
|
-
index$1 = 0;
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
index$1++;
|
|
144
|
-
}
|
|
145
|
-
if (taskbarElements.TaskbarElement[elem]) {
|
|
146
|
-
return this.getElement(index$1, taskbarElements.TaskbarElement[elem]);
|
|
147
|
-
}
|
|
148
|
-
if (this.customButtons.has(elem)) {
|
|
149
|
-
return this.getElement(index$1, this.customButtons.get(elem));
|
|
150
|
-
}
|
|
151
|
-
return index.h("slot", { name: elem });
|
|
152
|
-
})));
|
|
153
|
-
}
|
|
154
|
-
static get watchers() { return {
|
|
155
|
-
"buttons": ["observeButtons"]
|
|
156
|
-
}; }
|
|
157
|
-
};
|
|
158
|
-
SnkTaskbar.style = snkTaskbarCss;
|
|
159
|
-
|
|
160
|
-
exports.snk_taskbar = SnkTaskbar;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
class TaskbarProcessor {
|
|
4
|
-
constructor(defaultButtons) {
|
|
5
|
-
this._defaultButtons = defaultButtons;
|
|
6
|
-
}
|
|
7
|
-
process(taskbarId, taskbarManager, dataState, disabledButtons = []) {
|
|
8
|
-
var _a;
|
|
9
|
-
this.customButtons = new Map();
|
|
10
|
-
this.buttons = "";
|
|
11
|
-
this.disabledButtons = [];
|
|
12
|
-
(_a = this.getButtonsArray(taskbarId, taskbarManager, dataState)) === null || _a === void 0 ? void 0 : _a.forEach(btnDef => {
|
|
13
|
-
let buttonName;
|
|
14
|
-
if (typeof btnDef === "string") {
|
|
15
|
-
buttonName = btnDef;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
const customBtn = btnDef;
|
|
19
|
-
this.customButtons.set(customBtn.name, customBtn);
|
|
20
|
-
buttonName = customBtn.name;
|
|
21
|
-
}
|
|
22
|
-
if (!this.isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabledButtons)) {
|
|
23
|
-
this.disabledButtons.push(buttonName);
|
|
24
|
-
}
|
|
25
|
-
if (this.buttons.length > 0) {
|
|
26
|
-
this.buttons += ",";
|
|
27
|
-
}
|
|
28
|
-
this.buttons += buttonName;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
getButtonsArray(taskbarId, taskbarManager, dataState) {
|
|
32
|
-
const defaults = this._defaultButtons[taskbarId];
|
|
33
|
-
if (taskbarManager) {
|
|
34
|
-
return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
|
|
35
|
-
}
|
|
36
|
-
return defaults;
|
|
37
|
-
}
|
|
38
|
-
isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
|
|
39
|
-
const originalValue = disabled.includes(buttonName) ? false : true;
|
|
40
|
-
if (taskbarManager && taskbarManager.isEnabled) {
|
|
41
|
-
return taskbarManager.isEnabled(taskbarId, dataState, buttonName, originalValue);
|
|
42
|
-
}
|
|
43
|
-
return originalValue;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
exports.TaskbarProcessor = TaskbarProcessor;
|