@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-71072.0 → 0.0.0-bugfix-dev-KB-76362.1
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-bae64d0d.js → SnkMessageBuilder-7691a2c1.js} +10 -0
- package/dist/cjs/index-f9e81701.js +8 -0
- package/dist/cjs/input-distinct-search_2.cjs.entry.js +471 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +22 -25
- package/dist/cjs/snk-application.cjs.entry.js +2 -18
- package/dist/cjs/snk-config-options_3.cjs.entry.js +5 -17
- package/dist/cjs/snk-crud.cjs.entry.js +2 -8
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
- package/dist/cjs/{snk-data-unit-3d9b6ed4.js → snk-data-unit-7dbdad0e.js} +14 -26
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
- package/dist/cjs/snk-distinct-search.cjs.entry.js +123 -0
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +0 -9
- package/dist/cjs/snk-filter-text.cjs.entry.js +1 -2
- package/dist/cjs/snk-grid.cjs.entry.js +2 -10
- package/dist/cjs/{snk-guides-viewer-2139481c.js → snk-guides-viewer-eee43c8b.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -7
- package/dist/cjs/snk-taskbar.cjs.entry.js +37 -40
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +26 -27
- package/dist/collection/components/snk-application/snk-application.js +1 -41
- package/dist/collection/components/snk-crud/snk-crud.js +2 -26
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +1 -1
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +3 -3
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +13 -25
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +4 -0
- package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +372 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +110 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +544 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +28 -0
- package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +593 -0
- package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +15 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -2
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +1 -5
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +0 -20
- package/dist/collection/components/snk-form-config/snk-form-config.js +5 -17
- package/dist/collection/components/snk-grid/snk-grid.js +2 -28
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +4 -25
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +38 -41
- package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +25 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +1 -7
- package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
- package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +9 -0
- package/dist/components/SnkMessageBuilder.js +10 -0
- package/dist/components/filter-distinct-search.js +17 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/input-distinct-search.d.ts +11 -0
- package/dist/components/input-distinct-search.js +6 -0
- package/dist/components/input-distinct-search2.js +264 -0
- package/dist/components/search-modal.d.ts +11 -0
- package/dist/components/search-modal.js +6 -0
- package/dist/components/search-modal2.js +264 -0
- package/dist/components/snk-actions-button2.js +26 -27
- package/dist/components/snk-application2.js +2 -19
- package/dist/components/snk-crud.js +2 -9
- package/dist/components/snk-data-exporter2.js +3 -3
- package/dist/components/snk-data-unit2.js +13 -25
- package/dist/components/snk-detail-view2.js +1 -1
- package/dist/components/snk-distinct-search.d.ts +11 -0
- package/dist/components/snk-distinct-search.js +163 -0
- package/dist/components/snk-filter-bar2.js +0 -6
- package/dist/components/snk-filter-item2.js +1 -5
- package/dist/components/snk-filter-text.js +1 -2
- package/dist/components/snk-form-config2.js +5 -17
- package/dist/components/snk-grid2.js +2 -11
- package/dist/components/snk-simple-crud2.js +4 -8
- package/dist/components/snk-taskbar2.js +38 -41
- package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-7ace6803.js} +10 -0
- package/dist/esm/index-a7d3d3f1.js +8 -0
- package/dist/esm/input-distinct-search_2.entry.js +466 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +23 -26
- package/dist/esm/snk-application.entry.js +3 -19
- package/dist/esm/snk-config-options_3.entry.js +5 -17
- package/dist/esm/snk-crud.entry.js +2 -8
- package/dist/esm/snk-data-exporter.entry.js +5 -5
- package/dist/esm/{snk-data-unit-9fa7d2b9.js → snk-data-unit-7a579dbd.js} +14 -26
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +2 -2
- package/dist/esm/snk-distinct-search.entry.js +119 -0
- package/dist/esm/snk-filter-bar_4.entry.js +1 -10
- package/dist/esm/snk-filter-text.entry.js +1 -2
- package/dist/esm/snk-grid.entry.js +2 -10
- package/dist/esm/{snk-guides-viewer-b7ed39eb.js → snk-guides-viewer-e8ca764a.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +4 -7
- package/dist/esm/snk-taskbar.entry.js +38 -41
- package/dist/sankhyablocks/{p-483ef1fa.entry.js → p-00f9fe5c.entry.js} +1 -1
- package/dist/sankhyablocks/p-0e250436.entry.js +1 -0
- package/dist/sankhyablocks/p-154aa2a6.entry.js +11 -0
- package/dist/sankhyablocks/p-18cb1acb.entry.js +1 -0
- package/dist/sankhyablocks/p-1dbd5c18.entry.js +1 -0
- package/dist/sankhyablocks/p-2aae03a1.entry.js +1 -0
- package/dist/sankhyablocks/p-30ebcbe0.entry.js +1 -0
- package/dist/sankhyablocks/p-3858a2e4.entry.js +1 -0
- package/dist/sankhyablocks/{p-4138da61.entry.js → p-42130213.entry.js} +1 -1
- package/dist/sankhyablocks/p-563b7c28.entry.js +1 -0
- package/dist/sankhyablocks/p-96a89d58.entry.js +1 -0
- package/dist/sankhyablocks/p-987c7328.entry.js +1 -0
- package/dist/sankhyablocks/{p-e390641b.entry.js → p-b389ed49.entry.js} +1 -1
- package/dist/sankhyablocks/p-c75fae8e.js +1 -0
- package/dist/sankhyablocks/p-d8665750.js +1 -0
- package/dist/sankhyablocks/{p-e97be1c8.js → p-e3a285a2.js} +1 -1
- package/dist/sankhyablocks/p-f0aaad2b.entry.js +1 -0
- package/dist/sankhyablocks/{p-0d2a2e9e.entry.js → p-f4e221b2.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +2 -3
- package/dist/types/components/snk-application/snk-application.d.ts +1 -6
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -4
- package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +83 -0
- package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +105 -0
- package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +127 -0
- package/dist/types/components/snk-distinct-search/types/index.d.ts +12 -0
- package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +0 -2
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -4
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -2
- package/dist/types/components.d.ts +393 -31
- package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +0 -1
- package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +2 -0
- package/package.json +1 -1
- package/react/components.d.ts +3 -0
- package/react/components.js +3 -0
- package/react/components.js.map +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.js +0 -8
- package/dist/sankhyablocks/p-0387d9d7.entry.js +0 -1
- package/dist/sankhyablocks/p-17425c72.js +0 -1
- package/dist/sankhyablocks/p-1d3ce0d9.entry.js +0 -1
- package/dist/sankhyablocks/p-342eeb3b.js +0 -1
- package/dist/sankhyablocks/p-3728d2aa.entry.js +0 -11
- package/dist/sankhyablocks/p-4e1f992e.entry.js +0 -1
- package/dist/sankhyablocks/p-619aeac8.entry.js +0 -1
- package/dist/sankhyablocks/p-89c92727.entry.js +0 -1
- package/dist/sankhyablocks/p-a3fadd0b.entry.js +0 -1
- package/dist/sankhyablocks/p-af7f7b3e.entry.js +0 -1
- package/dist/sankhyablocks/p-ec43fcc8.entry.js +0 -1
- package/dist/types/components/snk-actions-button/interfaces/index.d.ts +0 -3
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.d.ts +0 -7
- /package/dist/collection/components/{snk-actions-button/interfaces → snk-distinct-search/types}/index.js +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { KeyboardManager } from '@sankhyalabs/core';
|
|
3
|
+
import { f as filterItems, n as normalizeString, g as getMatchOption } from './filter-distinct-search.js';
|
|
4
|
+
|
|
5
|
+
const inputDistinctSearchCss = ":host{--max-height-popover:180px;--scrollbar--color-default:var(--scrollbar--default, #626e82);--scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--scrollbar--border-radius:var(--border--radius-small, 6px);--scrollbar--width:var(--space--medium, 12px)}.divider{margin:var(--space--extra-small, 3px) 0;border:var(--border--small, 1px solid) var(--color--disable-secondary, #F2F5F8)}.new-value{color:var(--text--primary, #626e82);padding:var(--space--2xs, 8px) var(--space--3xs, 4px);font-size:var(--text--medium, 14px);font-family:var(--font-pattern, Roboto);cursor:pointer;border-radius:var(--border--radius-small, 6px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:none;background:none;width:100%;display:flex;min-height:max-content}.new-value-selected{background-color:var(--color--primary-300, #E2F4EF)}.new-value:hover{background-color:var(--background--medium, #e0e0e0)}.popover-content{margin:var(--space--small, 6px);max-height:calc(var(--max-height-popover) - (2 * var(--space--small, 6px)));display:flex;flex-direction:column}.list-container{overflow:auto;scrollbar-width:thin;scrollbar-color:var(--scrollbar--color-clicked) var(--scrollbar--color-background);padding-right:var(--space--small, 6px)}.list-container::-webkit-scrollbar{background-color:var(--scrollbar--color-background);width:var(--scrollbar--width);max-width:var(--scrollbar--width);min-width:var(--scrollbar--width)}.list-container::-webkit-scrollbar-track{background-color:var(--scrollbar--color-background);border-radius:var(--scrollbar--border-radius)}.list-container::-webkit-scrollbar-thumb{background-color:var(--scrollbar--color-default);border-radius:var(--scrollbar--border-radius)}.list-container::-webkit-scrollbar-thumb:vertical:hover,.list-container::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--scrollbar--color-hover)}.list-container::-webkit-scrollbar-thumb:vertical:active,.list-container::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--scrollbar--color-clicked)}ez-popover{--ez-popover__box--z-index:15}.space-error{--ez-popover__margin:-19px 0 0 0}ez-list{--ez-list__item--margin:0}ez-text-input{--ez-text-input__icon--margin:var(--space--xs, 12px)}.badge-primary{--ez-badge--background-color:var(--color--primary-300);--ez-badge--color:var(--color--primary)}";
|
|
6
|
+
|
|
7
|
+
const InputDistinctSearch = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.changeValue = createEvent(this, "changeValue", 7);
|
|
13
|
+
this.iconClick = createEvent(this, "iconClick", 7);
|
|
14
|
+
this.textValue = "";
|
|
15
|
+
this.isNewItem = false;
|
|
16
|
+
this.filteredItems = [];
|
|
17
|
+
this.isNewItemSelected = false;
|
|
18
|
+
this.application = undefined;
|
|
19
|
+
this.distinctItems = [];
|
|
20
|
+
this.label = "";
|
|
21
|
+
this.value = "";
|
|
22
|
+
this.maxItems = 100;
|
|
23
|
+
this.debounceTime = 300;
|
|
24
|
+
this.canShowError = false;
|
|
25
|
+
this.mode = 'regular';
|
|
26
|
+
this.restrict = undefined;
|
|
27
|
+
this.errorMessage = undefined;
|
|
28
|
+
}
|
|
29
|
+
async observerValue(newValue) {
|
|
30
|
+
await this.selectedNewItem(newValue, true);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Seleciona um item
|
|
34
|
+
*/
|
|
35
|
+
async selectValue(value, isNewItem = false) {
|
|
36
|
+
this.isNewItem = isNewItem;
|
|
37
|
+
this.textValue = value;
|
|
38
|
+
await this._refFilterInput.setValue(value);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Método para limpa o campo de entrada de pesquisa
|
|
42
|
+
*/
|
|
43
|
+
clearInput() {
|
|
44
|
+
this._refFilterInput.setValue("");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Retorna se o conteúdo é inválido.
|
|
48
|
+
*/
|
|
49
|
+
isInvalid() {
|
|
50
|
+
return this._refFilterInput.isInvalid();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Remove o foco do campo
|
|
54
|
+
*/
|
|
55
|
+
setBlur() {
|
|
56
|
+
this._refFilterInput.setBlur();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Aplica o foco do campo
|
|
60
|
+
*/
|
|
61
|
+
setFocus() {
|
|
62
|
+
this._refFilterInput.setFocus();
|
|
63
|
+
}
|
|
64
|
+
getMessage(key) {
|
|
65
|
+
return this.application.messagesBuilder.getMessage(key, null);
|
|
66
|
+
}
|
|
67
|
+
async optionLoader(searchArgument) {
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
if (this._debounceTimeout) {
|
|
70
|
+
clearTimeout(this._debounceTimeout);
|
|
71
|
+
}
|
|
72
|
+
this._debounceTimeout = setTimeout(() => {
|
|
73
|
+
const { items } = filterItems(searchArgument, this.distinctItems, this.maxItems);
|
|
74
|
+
this.filteredItems = items;
|
|
75
|
+
resolve();
|
|
76
|
+
}, this.debounceTime);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async openPopOver() {
|
|
80
|
+
var _a;
|
|
81
|
+
await ((_a = this._refPopOver) === null || _a === void 0 ? void 0 : _a.showUnder(this._refFilterInput));
|
|
82
|
+
}
|
|
83
|
+
async closePopOver() {
|
|
84
|
+
var _a;
|
|
85
|
+
this.isNewItemSelected = false;
|
|
86
|
+
await ((_a = this._refPopOver) === null || _a === void 0 ? void 0 : _a.hide());
|
|
87
|
+
await this._refList.removeSelection();
|
|
88
|
+
}
|
|
89
|
+
async onTextChange(event) {
|
|
90
|
+
this.textValue = event.detail;
|
|
91
|
+
await this.optionLoader(event.detail);
|
|
92
|
+
await this.selectFirstItem();
|
|
93
|
+
}
|
|
94
|
+
onIconClick() {
|
|
95
|
+
this.iconClick.emit();
|
|
96
|
+
}
|
|
97
|
+
buidItems() {
|
|
98
|
+
var _a;
|
|
99
|
+
const items = (_a = this.filteredItems) === null || _a === void 0 ? void 0 : _a.map((item) => ({
|
|
100
|
+
label: item,
|
|
101
|
+
id: normalizeString(item),
|
|
102
|
+
}));
|
|
103
|
+
return items;
|
|
104
|
+
}
|
|
105
|
+
async setValue(value, isNewItem = false, preventEventEmit = false) {
|
|
106
|
+
this.isNewItem = isNewItem;
|
|
107
|
+
this.textValue = value;
|
|
108
|
+
await this._refFilterInput.setValue(value);
|
|
109
|
+
await this.closePopOver();
|
|
110
|
+
if (!preventEventEmit) {
|
|
111
|
+
this.changeValue.emit({
|
|
112
|
+
value,
|
|
113
|
+
isNewItem,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async selectedNewItem(value, preventEventEmit = false) {
|
|
118
|
+
if (!this.textValue && !value) {
|
|
119
|
+
await this.setValue("", false, preventEventEmit);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const item = getMatchOption(value !== null && value !== void 0 ? value : this.textValue, this.distinctItems);
|
|
123
|
+
if (item) {
|
|
124
|
+
await this.setValue(item, false, preventEventEmit);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
await this.setValue(this.textValue || value, true, preventEventEmit);
|
|
128
|
+
}
|
|
129
|
+
async setSelectedValue() {
|
|
130
|
+
const selectedValue = await this._refList.getSelection();
|
|
131
|
+
await this.selectedNewItem((selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label) || this.textValue, true);
|
|
132
|
+
await this._refFilterInput.setBlur();
|
|
133
|
+
this._element.focus();
|
|
134
|
+
}
|
|
135
|
+
async selectNextItem() {
|
|
136
|
+
if (this.isNewItemSelected) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const itemSelected = await this._refList.getSelection();
|
|
140
|
+
const itemsAmount = this.filteredItems.length;
|
|
141
|
+
const indexSelected = this.filteredItems.findIndex((item) => item === (itemSelected === null || itemSelected === void 0 ? void 0 : itemSelected.label));
|
|
142
|
+
const isLastItemSelected = indexSelected === (itemsAmount - 1);
|
|
143
|
+
const optionNewItemIsAvailable = !!this.textValue;
|
|
144
|
+
if (!isLastItemSelected || !optionNewItemIsAvailable) {
|
|
145
|
+
this.isNewItemSelected = false;
|
|
146
|
+
await this._refList.selectNextItem();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
this.isNewItemSelected = true;
|
|
150
|
+
await this._refList.removeSelection();
|
|
151
|
+
}
|
|
152
|
+
async selectPreviousItem() {
|
|
153
|
+
const itemsAmount = this.filteredItems.length;
|
|
154
|
+
const lastItem = this.filteredItems[itemsAmount - 1];
|
|
155
|
+
if (this.isNewItemSelected && lastItem) {
|
|
156
|
+
this.isNewItemSelected = false;
|
|
157
|
+
await this._refList.setSelection({
|
|
158
|
+
id: normalizeString(lastItem),
|
|
159
|
+
label: lastItem
|
|
160
|
+
});
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
await this._refList.selectPreviousItem();
|
|
164
|
+
}
|
|
165
|
+
bindKeyboardManager() {
|
|
166
|
+
this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
|
|
167
|
+
this._keyboardManager
|
|
168
|
+
.bind("ArrowDown", () => { this.selectNextItem(); })
|
|
169
|
+
.bind("ArrowUp", () => { this.selectPreviousItem(); })
|
|
170
|
+
.bind("Enter", () => { this.setSelectedValue(); })
|
|
171
|
+
.bind("Tab", () => { this.setSelectedValue(); });
|
|
172
|
+
}
|
|
173
|
+
unbindKeyboardManager() {
|
|
174
|
+
this._keyboardManager
|
|
175
|
+
.unbind("ArrowDown")
|
|
176
|
+
.unbind("ArrowUp")
|
|
177
|
+
.unbind("Enter")
|
|
178
|
+
.unbind("Tab");
|
|
179
|
+
}
|
|
180
|
+
async selectFirstItem() {
|
|
181
|
+
if (!this.filteredItems.length) {
|
|
182
|
+
await this._refList.removeSelection();
|
|
183
|
+
this.isNewItemSelected = true;
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const firstItem = this.filteredItems[0];
|
|
187
|
+
this.isNewItemSelected = false;
|
|
188
|
+
await this._refList.setSelection({
|
|
189
|
+
id: normalizeString(firstItem),
|
|
190
|
+
label: firstItem,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
initializeComponent() {
|
|
194
|
+
const { items } = filterItems("", this.distinctItems, this.maxItems);
|
|
195
|
+
this.filteredItems = items;
|
|
196
|
+
}
|
|
197
|
+
componentWillLoad() {
|
|
198
|
+
this.initializeComponent();
|
|
199
|
+
}
|
|
200
|
+
async componentDidLoad() {
|
|
201
|
+
this.bindKeyboardManager();
|
|
202
|
+
this.selectFirstItem();
|
|
203
|
+
await this.selectedNewItem(this.value, true);
|
|
204
|
+
}
|
|
205
|
+
disconnectedCallback() {
|
|
206
|
+
this.unbindKeyboardManager();
|
|
207
|
+
}
|
|
208
|
+
buildNewItemOption() {
|
|
209
|
+
if (!this.textValue) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
return (h(Fragment, null, !!this.filteredItems.length &&
|
|
213
|
+
h("hr", { class: "divider" }), h("button", { slot: "bottomSlot", class: {
|
|
214
|
+
"new-value": true,
|
|
215
|
+
"new-value-selected": this.isNewItemSelected,
|
|
216
|
+
}, title: `${this.getMessage("snkDistinctSearch.titleAdd")} '${this.textValue}'`, onClick: () => this.selectedNewItem.bind(this)(undefined, true) }, this.getMessage("snkDistinctSearch.titleAdd"), " '", this.textValue, "'")));
|
|
217
|
+
}
|
|
218
|
+
render() {
|
|
219
|
+
return (h(Host, { onBlur: () => this.selectedNewItem.bind(this)() }, h("ez-filter-input", { ref: (ref) => this._refFilterInput = ref, label: this.label, value: this.textValue, onEzChange: this.onTextChange.bind(this), onEzIconClick: this.onIconClick.bind(this), onEzFocusIn: this.openPopOver.bind(this), canShowError: this.canShowError, mode: this.mode, restrict: this.restrict, errorMessage: this.errorMessage, enabledIconClick: true }, this.isNewItem &&
|
|
220
|
+
h("ez-badge", { slot: "right", label: this.getMessage("snkDistinctSearch.titleBadgeNew"), size: "small-medium", class: "badge-primary" })), h("ez-popover", { ref: (ref) => this._refPopOver = ref, boxWidth: "full-width", autoClose: false, overlayType: "none", class: {
|
|
221
|
+
'space-error': this.canShowError,
|
|
222
|
+
} }, h("div", { class: "popover-content" }, h("section", { class: "list-container" }, h("ez-list", { ref: (ref) => this._refList = ref, dataSource: this.buidItems(), onEzClickItem: ({ detail }) => this.setValue.bind(this)(detail.label, false, true), ezSelectable: true, hoverFeedback: true, disableShortcuts: true })), this.buildNewItemOption()))));
|
|
223
|
+
}
|
|
224
|
+
get _element() { return this; }
|
|
225
|
+
static get watchers() { return {
|
|
226
|
+
"value": ["observerValue"]
|
|
227
|
+
}; }
|
|
228
|
+
static get style() { return inputDistinctSearchCss; }
|
|
229
|
+
}, [1, "input-distinct-search", {
|
|
230
|
+
"application": [16],
|
|
231
|
+
"distinctItems": [16],
|
|
232
|
+
"label": [1],
|
|
233
|
+
"value": [1],
|
|
234
|
+
"maxItems": [2, "max-items"],
|
|
235
|
+
"debounceTime": [2, "debounce-time"],
|
|
236
|
+
"canShowError": [4, "can-show-error"],
|
|
237
|
+
"mode": [1],
|
|
238
|
+
"restrict": [1],
|
|
239
|
+
"errorMessage": [1, "error-message"],
|
|
240
|
+
"textValue": [32],
|
|
241
|
+
"isNewItem": [32],
|
|
242
|
+
"filteredItems": [32],
|
|
243
|
+
"isNewItemSelected": [32],
|
|
244
|
+
"selectValue": [64],
|
|
245
|
+
"clearInput": [64],
|
|
246
|
+
"isInvalid": [64],
|
|
247
|
+
"setBlur": [64],
|
|
248
|
+
"setFocus": [64]
|
|
249
|
+
}]);
|
|
250
|
+
function defineCustomElement() {
|
|
251
|
+
if (typeof customElements === "undefined") {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const components = ["input-distinct-search"];
|
|
255
|
+
components.forEach(tagName => { switch (tagName) {
|
|
256
|
+
case "input-distinct-search":
|
|
257
|
+
if (!customElements.get(tagName)) {
|
|
258
|
+
customElements.define(tagName, InputDistinctSearch);
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
} });
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export { InputDistinctSearch as I, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SearchModal extends Components.SearchModal, HTMLElement {}
|
|
4
|
+
export const SearchModal: {
|
|
5
|
+
prototype: SearchModal;
|
|
6
|
+
new (): SearchModal;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
|
|
3
|
+
import { KeyboardManager } from '@sankhyalabs/core';
|
|
4
|
+
import { f as filterItems, n as normalizeString, g as getMatchOption } from './filter-distinct-search.js';
|
|
5
|
+
|
|
6
|
+
const searchModalCss = ".sc-search-modal-h{display:block}ez-popup.sc-search-modal{--ez-popup__title--font-size:var(--title--large, 20px);--ez-popup__container--height:380px}.search-modal-scroller.sc-search-modal{height:174px}.search-modal-text.sc-search-modal{font-family:var(--font-pattern);color:var(--text--primary);font-size:var(--text--medium)}ez-filter-input.sc-search-modal>input.sc-search-modal{text-overflow:ellipsis}.ez-content.sc-search-modal{height:190px;display:flex;align-items:center;justify-content:center}";
|
|
7
|
+
|
|
8
|
+
const SearchModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.__registerHost();
|
|
12
|
+
this.popupClose = createEvent(this, "popupClose", 7);
|
|
13
|
+
this.changeValue = createEvent(this, "changeValue", 7);
|
|
14
|
+
this.debounceTimeout = null;
|
|
15
|
+
this.filteredItems = [];
|
|
16
|
+
this.searchFocus = false;
|
|
17
|
+
this.isLimited = false;
|
|
18
|
+
this.application = undefined;
|
|
19
|
+
this.listItens = [];
|
|
20
|
+
this.opened = false;
|
|
21
|
+
this.value = undefined;
|
|
22
|
+
this.canShowError = false;
|
|
23
|
+
this.emptyMessage = undefined;
|
|
24
|
+
this.debounceTime = 300;
|
|
25
|
+
this.maxItens = 100;
|
|
26
|
+
this.label = 'Pesquisar';
|
|
27
|
+
this.mode = 'regular';
|
|
28
|
+
this.restrict = undefined;
|
|
29
|
+
this.errorMessage = undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Método para adicionar a nova palavra e chamar o método closeModal() para fechar o modal
|
|
33
|
+
*/
|
|
34
|
+
addNewItem() {
|
|
35
|
+
this.closeModal();
|
|
36
|
+
this.changeValue.emit({ isNewItem: true, value: this.value });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Método para limpa o campo de entrada de pesquisa
|
|
40
|
+
*/
|
|
41
|
+
clearInput() {
|
|
42
|
+
this._refFilterInput.setValue("");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Método para fechar o modal
|
|
46
|
+
*/
|
|
47
|
+
closeModal() {
|
|
48
|
+
this._popupElement.opened = false;
|
|
49
|
+
this.popupClose.emit(false);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Método para abrir o modal
|
|
53
|
+
*/
|
|
54
|
+
openModal() {
|
|
55
|
+
this._popupElement.opened = true;
|
|
56
|
+
setTimeout(() => this.setFocus(), 100);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Retorna se o conteúdo é inválido.
|
|
60
|
+
*/
|
|
61
|
+
isInvalid() {
|
|
62
|
+
this._refFilterInput.isInvalid();
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Remove o foco do campo
|
|
66
|
+
*/
|
|
67
|
+
setBlur() {
|
|
68
|
+
this._refFilterInput.setBlur();
|
|
69
|
+
this.searchFocus = false;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Aplica o foco do campo
|
|
73
|
+
*/
|
|
74
|
+
setFocus() {
|
|
75
|
+
this._refFilterInput.setFocus();
|
|
76
|
+
this.searchFocus = true;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Método para tratar a mensagem de erro
|
|
80
|
+
*/
|
|
81
|
+
watchPropErrorMessage() {
|
|
82
|
+
this._refFilterInput.errorMessage = this.errorMessage;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Método para tratar o value do input
|
|
86
|
+
*/
|
|
87
|
+
watchPropValue() {
|
|
88
|
+
this._refFilterInput.value = this.value;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Atualiza a lista de itens à medida que o usuário digita no campo de pesquisa.
|
|
92
|
+
*/
|
|
93
|
+
async handleInput(event) {
|
|
94
|
+
if (this.debounceTimeout) {
|
|
95
|
+
clearTimeout(this.debounceTimeout);
|
|
96
|
+
}
|
|
97
|
+
this.value = event.detail;
|
|
98
|
+
this.debounceTimeout = setTimeout(async () => {
|
|
99
|
+
var _a;
|
|
100
|
+
const { isLimited, items } = filterItems(event.detail, this.listItens, this.maxItens);
|
|
101
|
+
this.filteredItems = items;
|
|
102
|
+
this.isLimited = isLimited;
|
|
103
|
+
await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.removeSelection());
|
|
104
|
+
}, this.debounceTime);
|
|
105
|
+
}
|
|
106
|
+
initializeComponent() {
|
|
107
|
+
this.filteredItems = this.listItens;
|
|
108
|
+
}
|
|
109
|
+
getMessage(key) {
|
|
110
|
+
return this.application.messagesBuilder.getMessage(key, null);
|
|
111
|
+
}
|
|
112
|
+
componentWillLoad() {
|
|
113
|
+
this.initializeComponent();
|
|
114
|
+
}
|
|
115
|
+
componentDidLoad() {
|
|
116
|
+
this.bindKeyboardManager();
|
|
117
|
+
this._refFilterInput.value = this.value;
|
|
118
|
+
const { isLimited, items } = filterItems(this.value, this.listItens, this.maxItens);
|
|
119
|
+
this.filteredItems = items;
|
|
120
|
+
this.isLimited = isLimited;
|
|
121
|
+
}
|
|
122
|
+
disconnectedCallback() {
|
|
123
|
+
this.unbindKeyboardManager();
|
|
124
|
+
}
|
|
125
|
+
buildItems() {
|
|
126
|
+
var _a;
|
|
127
|
+
const items = (_a = this.filteredItems) === null || _a === void 0 ? void 0 : _a.map((item) => ({
|
|
128
|
+
label: item,
|
|
129
|
+
id: normalizeString(item),
|
|
130
|
+
}));
|
|
131
|
+
return items;
|
|
132
|
+
}
|
|
133
|
+
async tabSelect() {
|
|
134
|
+
var _a;
|
|
135
|
+
const selectedValue = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
|
|
136
|
+
if (this.searchFocus && this._refList) {
|
|
137
|
+
this.searchFocus = false;
|
|
138
|
+
this._refList.focus();
|
|
139
|
+
await this.selectFirstItem();
|
|
140
|
+
}
|
|
141
|
+
else if (selectedValue) {
|
|
142
|
+
await this._refList.removeSelection();
|
|
143
|
+
await this._refButton.setFocus();
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
await this._refButton.setBlur();
|
|
147
|
+
this.setFocus();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
bindKeyboardManager() {
|
|
151
|
+
this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
|
|
152
|
+
this._keyboardManager
|
|
153
|
+
.bind("ArrowDown", () => { this.selectNextItem(); })
|
|
154
|
+
.bind("ArrowUp", () => { this.selectPreviousItem(); })
|
|
155
|
+
.bind("Enter", () => { this.setSelectedValue(); })
|
|
156
|
+
.bind("Tab", () => { this.tabSelect(); });
|
|
157
|
+
}
|
|
158
|
+
unbindKeyboardManager() {
|
|
159
|
+
this._keyboardManager
|
|
160
|
+
.unbind("ArrowDown")
|
|
161
|
+
.unbind("ArrowUp")
|
|
162
|
+
.unbind("Enter")
|
|
163
|
+
.unbind("Tab");
|
|
164
|
+
}
|
|
165
|
+
async setSelectedValue() {
|
|
166
|
+
var _a;
|
|
167
|
+
const selectedValue = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
|
|
168
|
+
if (selectedValue) {
|
|
169
|
+
this.changeValue.emit({ isNewItem: false, value: selectedValue.label });
|
|
170
|
+
this.closeModal();
|
|
171
|
+
}
|
|
172
|
+
else if (this.searchFocus && this.enabledButtonNewItem()) {
|
|
173
|
+
this.addNewItem();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
async selectNextItem() {
|
|
177
|
+
var _a;
|
|
178
|
+
const itemSelected = await ((_a = this._refList) === null || _a === void 0 ? void 0 : _a.getSelection());
|
|
179
|
+
if (this.searchFocus && !itemSelected) {
|
|
180
|
+
this.setBlur();
|
|
181
|
+
await this.selectFirstItem();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
await this._refList.selectNextItem();
|
|
185
|
+
}
|
|
186
|
+
async selectPreviousItem() {
|
|
187
|
+
const itemSelected = await this._refList.getSelection();
|
|
188
|
+
if (itemSelected === undefined)
|
|
189
|
+
return;
|
|
190
|
+
await this._refList.selectPreviousItem();
|
|
191
|
+
}
|
|
192
|
+
async selectFirstItem() {
|
|
193
|
+
if (!this.filteredItems.length) {
|
|
194
|
+
await this._refList.removeSelection();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const firstItem = this.filteredItems[0];
|
|
198
|
+
await this._refList.setSelection({
|
|
199
|
+
id: normalizeString(firstItem),
|
|
200
|
+
label: firstItem,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
enabledButtonNewItem() {
|
|
204
|
+
if (this.value === undefined)
|
|
205
|
+
return false;
|
|
206
|
+
if (getMatchOption(this.value, this.listItens))
|
|
207
|
+
return false;
|
|
208
|
+
return this.value.trim().length === 0 ? false : true;
|
|
209
|
+
}
|
|
210
|
+
buildMessage() {
|
|
211
|
+
if (this.isLimited) {
|
|
212
|
+
return this.getMessage("snkDistinctSearch.limitResult");
|
|
213
|
+
}
|
|
214
|
+
return `${this.filteredItems.length} ${this.filteredItems.length > 1 ? this.getMessage("snkDistinctSearch.availableResults") : this.getMessage("snkDistinctSearch.availableResult")}`;
|
|
215
|
+
}
|
|
216
|
+
render() {
|
|
217
|
+
var _a;
|
|
218
|
+
return (h(Host, null, h("ez-popup", { ref: (ref) => this._popupElement = ref, size: "x-small", "ez-title": this.label, onEzClosePopup: () => this.popupClose.emit(false), "height-mode": "auto" }, h("div", null, h("ez-filter-input", { ref: (ref) => this._refFilterInput = ref, label: "Pesquisar", onEzChange: this.handleInput.bind(this), onBlur: () => this.searchFocus = false, onEzFocusIn: () => this.searchFocus = true, errorMessage: this.errorMessage, canShowError: this.canShowError, mode: this.mode, value: this.value, restrict: this.restrict }), this.filteredItems.length === 0 ? (h("div", { class: "ez-content" }, h("div", { class: "ez-text--center search-modal-text" }, this.emptyMessage))) : (h("div", null, h("div", { class: "search-modal-text ez-padding-vertical--medium" }, this.buildMessage()), h("ez-scroller", { class: "search-modal-scroller", direction: EzScrollDirection.VERTICAL }, h("ez-list", { ref: (ref) => this._refList = ref, dataSource: this.buildItems(), onEzClickItem: ({ label }) => this.setSelectedValue.bind(this)(label), ezSelectable: true, hoverFeedback: true, disableShortcuts: true })))), h("div", { class: "ez-flex ez-flex--justify-end" }, h("ez-button", { ref: (ref) => this._refButton = ref, class: "ez-button--tertiary", enabled: this.enabledButtonNewItem(), label: `${this.getMessage("snkDistinctSearch.titleAdd")} ${(_a = this.label) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()}`, onClick: () => this.addNewItem() }))))));
|
|
219
|
+
}
|
|
220
|
+
get _element() { return this; }
|
|
221
|
+
static get watchers() { return {
|
|
222
|
+
"errorMessage": ["watchPropErrorMessage"],
|
|
223
|
+
"value": ["watchPropValue"]
|
|
224
|
+
}; }
|
|
225
|
+
static get style() { return searchModalCss; }
|
|
226
|
+
}, [2, "search-modal", {
|
|
227
|
+
"application": [16],
|
|
228
|
+
"listItens": [1040],
|
|
229
|
+
"opened": [1540],
|
|
230
|
+
"value": [1],
|
|
231
|
+
"canShowError": [4, "can-show-error"],
|
|
232
|
+
"emptyMessage": [1, "empty-message"],
|
|
233
|
+
"debounceTime": [2, "debounce-time"],
|
|
234
|
+
"maxItens": [2, "max-itens"],
|
|
235
|
+
"label": [1],
|
|
236
|
+
"mode": [1],
|
|
237
|
+
"restrict": [1],
|
|
238
|
+
"errorMessage": [1, "error-message"],
|
|
239
|
+
"filteredItems": [32],
|
|
240
|
+
"searchFocus": [32],
|
|
241
|
+
"isLimited": [32],
|
|
242
|
+
"addNewItem": [64],
|
|
243
|
+
"clearInput": [64],
|
|
244
|
+
"closeModal": [64],
|
|
245
|
+
"openModal": [64],
|
|
246
|
+
"isInvalid": [64],
|
|
247
|
+
"setBlur": [64],
|
|
248
|
+
"setFocus": [64]
|
|
249
|
+
}]);
|
|
250
|
+
function defineCustomElement() {
|
|
251
|
+
if (typeof customElements === "undefined") {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const components = ["search-modal"];
|
|
255
|
+
components.forEach(tagName => { switch (tagName) {
|
|
256
|
+
case "search-modal":
|
|
257
|
+
if (!customElements.get(tagName)) {
|
|
258
|
+
customElements.define(tagName, SearchModal);
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
} });
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export { SearchModal as S, defineCustomElement as d };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils,
|
|
2
|
+
import { ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils, DateUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { D as DataFetcher } from './DataFetcher.js';
|
|
4
4
|
import { P as ParamType } from './ParamType.js';
|
|
5
5
|
import './pesquisa-fetcher.js';
|
|
@@ -598,7 +598,6 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
598
598
|
super();
|
|
599
599
|
this.__registerHost();
|
|
600
600
|
this.CLIENT_EVENT_CONFIRM_NAME = "br.com.sankhya.actionbutton.clientconfirm";
|
|
601
|
-
this._actions = [];
|
|
602
601
|
this.handleClick = (evt) => {
|
|
603
602
|
const selectedAction = this._actions.find((action) => action.actionID == evt.detail.id);
|
|
604
603
|
const executor = new ExecutorFactory(selectedAction.type).executor;
|
|
@@ -608,22 +607,27 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
608
607
|
};
|
|
609
608
|
this._items = [];
|
|
610
609
|
this._showDropdown = false;
|
|
610
|
+
this._actions = [];
|
|
611
|
+
this._isOrderActions = false;
|
|
611
612
|
}
|
|
612
613
|
async getActions() {
|
|
613
|
-
|
|
614
|
+
let param = {
|
|
615
|
+
param: {
|
|
616
|
+
entityName: this._entityName,
|
|
617
|
+
resourceID: this._resourceID
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
return DataFetcher.get().callServiceBroker('ActionButtonsSP.getActions', param).then((result) => {
|
|
614
621
|
var _a;
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
624
|
-
this._actions = SnkActionsButton.parameters.isOrderActions
|
|
625
|
-
? ArrayUtils.sortAlphabetically(actions, 'description')
|
|
626
|
-
: actions;
|
|
622
|
+
if (!((_a = result.actions) === null || _a === void 0 ? void 0 : _a.action))
|
|
623
|
+
return;
|
|
624
|
+
if (this._isOrderActions) {
|
|
625
|
+
this._actions = ArrayUtils.sortAlphabetically(result.actions.action, 'description');
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
this._actions = result.actions.action;
|
|
629
|
+
}
|
|
630
|
+
});
|
|
627
631
|
}
|
|
628
632
|
controlDropdown() {
|
|
629
633
|
this._showDropdown = !this._showDropdown;
|
|
@@ -656,7 +660,7 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
656
660
|
}
|
|
657
661
|
async componentWillLoad() {
|
|
658
662
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
659
|
-
await this.
|
|
663
|
+
this._isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
|
|
660
664
|
const snkDataUnit = this._element.parentElement;
|
|
661
665
|
this._dataUnit = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.dataUnit;
|
|
662
666
|
this._resourceID = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.resourceID;
|
|
@@ -665,8 +669,9 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
665
669
|
this._resourceID = await ResourceIDUtils.getResourceID();
|
|
666
670
|
}
|
|
667
671
|
this.setEvents();
|
|
668
|
-
|
|
669
|
-
|
|
672
|
+
this.getActions().then(() => {
|
|
673
|
+
this.loadItems();
|
|
674
|
+
});
|
|
670
675
|
}
|
|
671
676
|
async componentDidLoad() {
|
|
672
677
|
if (!this._element)
|
|
@@ -693,11 +698,6 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
693
698
|
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
|
|
694
699
|
};
|
|
695
700
|
}
|
|
696
|
-
async loadParameters() {
|
|
697
|
-
if (SnkActionsButton.parameters.isOrderActions != null)
|
|
698
|
-
return;
|
|
699
|
-
SnkActionsButton.parameters.isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
|
|
700
|
-
}
|
|
701
701
|
render() {
|
|
702
702
|
return (h(Host, null, (this._actions && this._actions.length > 0) &&
|
|
703
703
|
(h("div", { class: `ez-padding-left--medium snk-actions-button
|
|
@@ -713,11 +713,10 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
713
713
|
static get style() { return snkActionsButtonCss; }
|
|
714
714
|
}, [2, "snk-actions-button", {
|
|
715
715
|
"_items": [32],
|
|
716
|
-
"_showDropdown": [32]
|
|
716
|
+
"_showDropdown": [32],
|
|
717
|
+
"_actions": [32],
|
|
718
|
+
"_isOrderActions": [32]
|
|
717
719
|
}]);
|
|
718
|
-
SnkActionsButton.parameters = {
|
|
719
|
-
isOrderActions: null
|
|
720
|
-
};
|
|
721
720
|
function defineCustomElement() {
|
|
722
721
|
if (typeof customElements === "undefined") {
|
|
723
722
|
return;
|