@sankhyalabs/sankhyablocks 1.3.31-beta.17 → 1.3.31-beta.19

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.
Files changed (107) hide show
  1. package/dist/cjs/{SnkMessageBuilder-cb132e6d.js → SnkMessageBuilder-02c2ca02.js} +7 -3
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  4. package/dist/cjs/snk-application.cjs.entry.js +405 -265
  5. package/dist/cjs/snk-crud.cjs.entry.js +2 -1
  6. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  7. package/dist/cjs/snk-filter-bar.cjs.entry.js +80 -14
  8. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-filter-detail.cjs.entry.js +7 -2
  10. package/dist/cjs/snk-filter-item.cjs.entry.js +13 -1
  11. package/dist/cjs/snk-filter-list.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +23 -0
  13. package/dist/cjs/snk-filter-number.cjs.entry.js +2 -1
  14. package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
  15. package/dist/cjs/snk-form.cjs.entry.js +19 -1
  16. package/dist/cjs/snk-grid.cjs.entry.js +15 -5
  17. package/dist/cjs/snk-taskbar.cjs.entry.js +14 -11
  18. package/dist/cjs/{taskbar-elements-efa44ff1.js → taskbar-elements-283c737e.js} +36 -17
  19. package/dist/cjs/taskbar-processor-6bd0d35c.js +47 -0
  20. package/dist/collection/collection-manifest.json +1 -0
  21. package/dist/collection/components/snk-application/snk-application.js +23 -3
  22. package/dist/collection/components/snk-crud/snk-crud.js +41 -3
  23. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
  24. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +64 -0
  25. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +2 -1
  26. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +1 -1
  27. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +7 -2
  28. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +36 -1
  29. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +53 -2
  30. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +15 -0
  31. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +79 -13
  32. package/dist/collection/components/snk-form/snk-form.js +41 -1
  33. package/dist/collection/components/snk-grid/snk-grid.js +35 -3
  34. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +35 -17
  35. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +43 -0
  36. package/dist/collection/components/snk-taskbar/snk-taskbar.js +36 -11
  37. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +6 -6
  38. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +375 -255
  39. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +7 -3
  40. package/dist/components/SnkMessageBuilder.js +7 -3
  41. package/dist/components/index.d.ts +1 -0
  42. package/dist/components/index.js +1 -0
  43. package/dist/components/snk-application2.js +404 -264
  44. package/dist/components/snk-crud.js +4 -2
  45. package/dist/components/snk-filter-bar2.js +80 -14
  46. package/dist/components/snk-filter-binary-select.js +1 -1
  47. package/dist/components/snk-filter-detail2.js +7 -2
  48. package/dist/components/snk-filter-item2.js +15 -2
  49. package/dist/components/snk-filter-list2.js +5 -2
  50. package/dist/components/snk-filter-multi-select.d.ts +11 -0
  51. package/dist/components/snk-filter-multi-select.js +39 -0
  52. package/dist/components/snk-filter-number.js +2 -1
  53. package/dist/components/snk-filter-search.js +1 -1
  54. package/dist/components/snk-form2.js +20 -1
  55. package/dist/components/snk-grid2.js +15 -4
  56. package/dist/components/snk-taskbar2.js +49 -27
  57. package/dist/components/taskbar-processor.js +45 -0
  58. package/dist/{sankhyablocks/SnkMessageBuilder-cff80920.js → esm/SnkMessageBuilder-65d431bd.js} +7 -3
  59. package/dist/esm/loader.js +1 -1
  60. package/dist/esm/sankhyablocks.js +1 -1
  61. package/dist/esm/snk-application.entry.js +405 -265
  62. package/dist/esm/snk-crud.entry.js +3 -2
  63. package/dist/esm/snk-data-unit.entry.js +1 -1
  64. package/dist/esm/snk-filter-bar.entry.js +80 -14
  65. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  66. package/dist/esm/snk-filter-detail.entry.js +7 -2
  67. package/dist/esm/snk-filter-item.entry.js +13 -1
  68. package/dist/esm/snk-filter-list.entry.js +2 -2
  69. package/dist/esm/snk-filter-multi-select.entry.js +19 -0
  70. package/dist/esm/snk-filter-number.entry.js +2 -1
  71. package/dist/esm/snk-filter-search.entry.js +1 -1
  72. package/dist/esm/snk-form.entry.js +19 -1
  73. package/dist/esm/snk-grid.entry.js +15 -5
  74. package/dist/esm/snk-taskbar.entry.js +14 -11
  75. package/dist/esm/taskbar-elements-35d64ff9.js +90 -0
  76. package/dist/esm/taskbar-processor-aa6772c9.js +45 -0
  77. package/dist/{esm/SnkMessageBuilder-cff80920.js → sankhyablocks/SnkMessageBuilder-65d431bd.js} +7 -3
  78. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  79. package/dist/sankhyablocks/snk-application.entry.js +405 -265
  80. package/dist/sankhyablocks/snk-crud.entry.js +3 -2
  81. package/dist/sankhyablocks/snk-data-unit.entry.js +1 -1
  82. package/dist/sankhyablocks/snk-filter-bar.entry.js +80 -14
  83. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +1 -1
  84. package/dist/sankhyablocks/snk-filter-detail.entry.js +7 -2
  85. package/dist/sankhyablocks/snk-filter-item.entry.js +13 -1
  86. package/dist/sankhyablocks/snk-filter-list.entry.js +2 -2
  87. package/dist/sankhyablocks/snk-filter-multi-select.entry.js +19 -0
  88. package/dist/sankhyablocks/snk-filter-number.entry.js +2 -1
  89. package/dist/sankhyablocks/snk-filter-search.entry.js +1 -1
  90. package/dist/sankhyablocks/snk-form.entry.js +19 -1
  91. package/dist/sankhyablocks/snk-grid.entry.js +15 -5
  92. package/dist/sankhyablocks/snk-taskbar.entry.js +14 -11
  93. package/dist/sankhyablocks/taskbar-elements-35d64ff9.js +90 -0
  94. package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +45 -0
  95. package/dist/types/components/snk-application/snk-application.d.ts +5 -3
  96. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +7 -0
  97. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +1 -0
  98. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +3 -0
  99. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +6 -3
  100. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +3 -2
  101. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +12 -0
  102. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +17 -1
  103. package/dist/types/components.d.ts +78 -2
  104. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  105. package/package.json +1 -1
  106. package/dist/esm/taskbar-elements-c119510a.js +0 -72
  107. package/dist/sankhyablocks/taskbar-elements-c119510a.js +0 -72
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h, g as getElement } from './index-2b4d2d14.js';
1
+ import { r as registerInstance, e as createEvent, h, g as getElement } from './index-2b4d2d14.js';
2
2
 
3
3
  const snkCrudCss = ".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";
4
4
 
@@ -7,6 +7,7 @@ const FORM_MODE = 1;
7
7
  const SnkCrud = class {
8
8
  constructor(hostRef) {
9
9
  registerInstance(this, hostRef);
10
+ this.actionClick = createEvent(this, "actionClick", 7);
10
11
  }
11
12
  async gridToForm(keepFormMode = false) {
12
13
  this._backToGrid = !keepFormMode && await this._viewStack.getSelectedIndex() === GRID_MODE;
@@ -51,7 +52,7 @@ const SnkCrud = class {
51
52
  }
52
53
  }
53
54
  render() {
54
- return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, h("stack-item", null, h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }))), h("stack-item", null, h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE), recordsValidator: this.recordsValidator, onActionClick: evt => this.executeAction(evt.detail) }))));
55
+ return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, h("stack-item", null, h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" })))));
55
56
  }
56
57
  get _element() { return getElement(this); }
57
58
  };
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-2b4d2d14.js';
2
2
  import { A as Action, a as ApplicationContext } from './index-e5b61043.js';
3
- import { A as ApplicationUtils, D as DialogType, O as OperationMap } from './SnkMessageBuilder-cff80920.js';
3
+ import { A as ApplicationUtils, D as DialogType, O as OperationMap } from './SnkMessageBuilder-65d431bd.js';
4
4
 
5
5
  const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";
6
6
 
@@ -2,10 +2,11 @@ import { r as registerInstance, h, f as Host, g as getElement } from './index-2b
2
2
  import { b as DataType, t as toString, a as ApplicationContext, E as ErrorException, O as ObjectUtils } from './index-e5b61043.js';
3
3
  import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.js';
4
4
 
5
- const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 1);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;flex-grow:0}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px)}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.preselected.sc-snk-filter-bar{background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}";
5
+ const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 1);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;flex-grow:0}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px)}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.preselected.sc-snk-filter-bar{background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}";
6
6
 
7
7
  const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
8
8
  const DEFAULT_FILTER = "DEFAULT_FILTER";
9
+ const CLEAR_ALL_FILTERS = "CLEAR_ALL_FILTERS";
9
10
  const SnkFilterBar = class {
10
11
  constructor(hostRef) {
11
12
  registerInstance(this, hostRef);
@@ -52,6 +53,9 @@ const SnkFilterBar = class {
52
53
  //FIXME: ajustar o backend para não exigir parametros
53
54
  return { name: id, expression: selectedOption.expression, params: [] };
54
55
  }
56
+ if (type === FilterItemType.MULTI_SELECT) {
57
+ return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
58
+ }
55
59
  if (type === FilterItemType.PERIOD) {
56
60
  const { end, start } = value;
57
61
  const params = [];
@@ -123,11 +127,11 @@ const SnkFilterBar = class {
123
127
  getFilterItems() {
124
128
  const pinnedItems = [];
125
129
  const unpinnedItems = [];
126
- this._items = this.filterConfig
130
+ this.filterConfig
127
131
  .filter(item => item.visible)
128
132
  .sort((a, b) => this._filtersComparator(a, b))
129
- .map((item, index) => {
130
- const filterItem = (h("snk-filter-item", { config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
133
+ .forEach((item, index) => {
134
+ const filterItem = (h("snk-filter-item", { id: `filter-${item.id}`, config: this.normalizeItem(item), class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
131
135
  if (item.fixed || item.hardFixed) {
132
136
  pinnedItems.push(filterItem);
133
137
  }
@@ -145,25 +149,54 @@ const SnkFilterBar = class {
145
149
  return elements;
146
150
  }
147
151
  calculateUpdateSequence(item) {
148
- this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
149
- this._updateSequence.push(item.id);
152
+ if (item) {
153
+ this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
154
+ this._updateSequence.push(item.id);
155
+ }
150
156
  }
151
157
  filterChangeListener(evt) {
152
158
  this.updateFilter(evt.detail);
153
159
  }
154
- updateFilter(newItem) {
155
- this.calculateUpdateSequence(newItem);
156
- let needRefresh = false;
160
+ normalizeItem(item) {
161
+ const normalized = Object.assign({}, item);
162
+ const optionals = ["props", "value", "hardFixed", "fixed"];
163
+ optionals.forEach(prop => {
164
+ if (normalized[prop] == undefined) {
165
+ delete normalized[prop];
166
+ }
167
+ });
168
+ if (item.value === "") {
169
+ delete item.value;
170
+ }
171
+ return normalized;
172
+ }
173
+ updateFilter(newItem, clear = false) {
174
+ let upToDate = false;
157
175
  this.filterConfig = this.filterConfig.map(item => {
158
- if (item.id === newItem.id) {
159
- needRefresh = ObjectUtils.objectToString(item.value) !== ObjectUtils.objectToString(newItem.value);
160
- return newItem;
176
+ if (clear) {
177
+ if (item.value != undefined) {
178
+ this.calculateUpdateSequence(item);
179
+ upToDate = true;
180
+ }
181
+ return Object.assign(Object.assign({}, item), { value: undefined });
182
+ }
183
+ else {
184
+ if (item.id === newItem.id) {
185
+ const normalizedOne = this.normalizeItem(item);
186
+ const normalizedTwo = this.normalizeItem(newItem);
187
+ if (ObjectUtils.objectToString(normalizedOne) != ObjectUtils.objectToString(normalizedTwo)) {
188
+ this.calculateUpdateSequence(item);
189
+ }
190
+ upToDate = ObjectUtils.objectToString(normalizedOne.value) !== ObjectUtils.objectToString(normalizedTwo.value);
191
+ return newItem;
192
+ }
161
193
  }
162
194
  return item;
163
195
  });
164
- if (needRefresh) {
196
+ if (upToDate) {
165
197
  this.dataUnit.loadData();
166
198
  }
199
+ return upToDate;
167
200
  }
168
201
  getAddListItems() {
169
202
  const hiddenItems = this.filterConfig
@@ -176,17 +209,50 @@ const SnkFilterBar = class {
176
209
  { name: DEFAULT_FILTER, label: this.getMessage("snkFilterBar.defaultFilter"), iconName: "configuration", kind: "FOOTER" }
177
210
  ]);
178
211
  }
212
+ getActiveClass() {
213
+ const filterApplied = this.filterConfig.filter(item => item.value != undefined).length > 0;
214
+ return filterApplied ? "sc-snk-filter-bar snk-filter-bar__filter-list-items-button--active" : "";
215
+ }
216
+ getAppliedListItems() {
217
+ const appliedItems = this.filterConfig
218
+ .filter(item => item.value != undefined)
219
+ .sort(this._filtersComparator);
220
+ return appliedItems.map(filter => {
221
+ return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
222
+ }).concat([
223
+ { name: CLEAR_ALL_FILTERS, label: this.getMessage("snkFilterBar.clearAllFilters"), iconName: "cleaning", kind: "FOOTER" }
224
+ ]);
225
+ }
179
226
  addFilterHandler(itemName) {
180
227
  const filterItem = this.filterConfig.find(currentFilter => currentFilter.id === itemName);
181
228
  if (filterItem) {
182
229
  this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
230
+ window.requestAnimationFrame(() => {
231
+ const itemElement = this._element.querySelector("#filter-" + itemName);
232
+ if (itemElement) {
233
+ itemElement.showUp();
234
+ }
235
+ });
236
+ }
237
+ }
238
+ appliedFilterHandler(itemName) {
239
+ if (itemName === CLEAR_ALL_FILTERS) {
240
+ if (this.updateFilter(null, true)) {
241
+ this._application.info(this.getMessage("snkFilterBar.successfullyCleaned"), { iconName: "check" });
242
+ }
243
+ }
244
+ else {
245
+ const itemElement = this._element.querySelector("#filter-" + itemName);
246
+ if (itemElement) {
247
+ itemElement.showUp(true);
248
+ }
183
249
  }
184
250
  }
185
251
  render() {
186
252
  if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
187
253
  return undefined;
188
254
  }
189
- return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("ez-button", { mode: "icon", size: "small", iconName: "filter", class: "ez-padding-left--medium" }), h("snk-filter-list", { items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
255
+ return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("snk-filter-list", { items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail) }), h("snk-filter-list", { items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
190
256
  }
191
257
  get _element() { return getElement(this); }
192
258
  };
@@ -6,7 +6,7 @@ const SnkFilterBinarySelect = class {
6
6
  registerInstance(this, hostRef);
7
7
  }
8
8
  isSelected(option) {
9
- return this.config.value == undefined || this.config.value === option;
9
+ return this.value == undefined || this.value === option;
10
10
  }
11
11
  ezChangeListener(evt) {
12
12
  if (!evt.detail) {
@@ -13,6 +13,8 @@ const SnkFilterDetail = class {
13
13
  switch (this.config.type) {
14
14
  case FilterItemType.BINARY_SELECT:
15
15
  return "snk-filter-binary-select";
16
+ case FilterItemType.MULTI_SELECT:
17
+ return "snk-filter-multi-select";
16
18
  case FilterItemType.PERIOD:
17
19
  return "snk-filter-period";
18
20
  case FilterItemType.SEARCH:
@@ -22,18 +24,21 @@ const SnkFilterDetail = class {
22
24
  }
23
25
  return "snk-filter-text";
24
26
  }
27
+ removeItem() {
28
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: undefined }));
29
+ }
25
30
  getPopUpHeaderButtons() {
26
31
  if (this.config.hardFixed) {
27
32
  return undefined;
28
33
  }
29
34
  return ([
30
- h("ez-icon", { title: this.getMessage("snkFilterBar.removeFilter"), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: "delete", onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false })) }),
35
+ h("ez-icon", { title: this.getMessage("snkFilterBar.removeFilter"), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: "delete", onClick: () => this.removeItem() }),
31
36
  h("ez-icon", { title: this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), class: "ez-margin-left--small sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: this.config.fixed ? "un-pin" : "push-pin", onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })) })
32
37
  ]);
33
38
  }
34
39
  render() {
35
40
  const ContentEditor = this.getContentEditor();
36
- return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined })) }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: this._editor["value"] })), class: "ez-button--primary ez-padding-left--medium" }))));
41
+ return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined })) }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: this._editor["value"] })), class: "ez-button--primary ez-padding-left--medium" }))));
37
42
  }
38
43
  };
39
44
 
@@ -25,6 +25,14 @@ const SnkFilterItem = class {
25
25
  return false;
26
26
  };
27
27
  }
28
+ async showUp(open = false) {
29
+ this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
30
+ if (open) {
31
+ window.requestAnimationFrame(() => {
32
+ this.showDetail();
33
+ });
34
+ }
35
+ }
28
36
  showDetail() {
29
37
  this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
30
38
  this.detailIsVisible = true;
@@ -79,6 +87,10 @@ const SnkFilterItem = class {
79
87
  return optTwo.label;
80
88
  }
81
89
  }
90
+ if (type === FilterItemType.MULTI_SELECT) {
91
+ const opt = props.options.find(opt => opt.value === value);
92
+ return `${label}: ${opt.label}`;
93
+ }
82
94
  if (type === FilterItemType.PERIOD) {
83
95
  const period = value;
84
96
  const dateFormater = new Intl.DateTimeFormat("pt-BR");
@@ -87,7 +99,7 @@ const SnkFilterItem = class {
87
99
  }
88
100
  else {
89
101
  if (period.start) {
90
- return `${label}: A partir de ${dateFormater.format(period.end)}`;
102
+ return `${label}: A partir de ${dateFormater.format(period.start)}`;
91
103
  }
92
104
  else {
93
105
  return `${label}: Até ${dateFormater.format(period.end)}`;
@@ -66,7 +66,7 @@ const SnkFilterList = class {
66
66
  getFilterItems() {
67
67
  const items = this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items.filter(item => item.kind === "FILTER")) : [];
68
68
  if (items.length === 0) {
69
- return 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.getMessage("snkFilterBar.emptyFilterList"));
69
+ return 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);
70
70
  }
71
71
  const hideItems = !this._filterArgument && !this._showAll && (items.length > MAX_FILTERS + 1);
72
72
  if (hideItems) {
@@ -79,7 +79,7 @@ const SnkFilterList = class {
79
79
  return this.items.filter(item => item.kind === "FOOTER");
80
80
  }
81
81
  render() {
82
- return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.getMessage("snkFilterBar.findFilter"), value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
82
+ return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, 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(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
83
83
  }
84
84
  get _element() { return getElement(this); }
85
85
  };
@@ -0,0 +1,19 @@
1
+ import { r as registerInstance, h } from './index-2b4d2d14.js';
2
+ import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.js';
3
+
4
+ const SnkFilterMultiSelect = class {
5
+ constructor(hostRef) {
6
+ registerInstance(this, hostRef);
7
+ }
8
+ ezChangeListener(evt) {
9
+ this.value = evt.detail.value;
10
+ }
11
+ render() {
12
+ if (!this.config || this.config.type !== FilterItemType.MULTI_SELECT) {
13
+ return undefined;
14
+ }
15
+ return (h("ez-combo-box", { label: this.config.label, value: this.config.value, options: this.config.props.options }));
16
+ }
17
+ };
18
+
19
+ export { SnkFilterMultiSelect as snk_filter_multi_select };
@@ -9,10 +9,11 @@ const SnkFilterPeriod = class {
9
9
  this.value = evt.detail;
10
10
  }
11
11
  render() {
12
+ var _a;
12
13
  if (!this.config || this.config.type !== FilterItemType.NUMBER) {
13
14
  return undefined;
14
15
  }
15
- return (h("ez-number-input", { label: this.config.label, value: this.config.value }));
16
+ return (h("ez-number-input", { label: this.config.label, value: this.config.value, precision: (_a = this.config.props) === null || _a === void 0 ? void 0 : _a.precision }));
16
17
  }
17
18
  };
18
19
 
@@ -33,7 +33,7 @@ const SnkFilterSearch = class {
33
33
  if (!this.config || this.config.type !== FilterItemType.SEARCH) {
34
34
  return undefined;
35
35
  }
36
- return (h("ez-search", { value: this.config.value, label: this.config.label, ref: ref => this._searchInput = ref, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument) }));
36
+ return (h("ez-search", { suppressEmptyOption: true, value: this.config.value, label: this.config.label, ref: ref => this._searchInput = ref, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument) }));
37
37
  }
38
38
  };
39
39
 
@@ -1,5 +1,6 @@
1
1
  import { r as registerInstance, e as createEvent, h, g as getElement } from './index-2b4d2d14.js';
2
2
  import { a as ApplicationContext } from './index-e5b61043.js';
3
+ import { T as TaskbarProcessor } from './taskbar-processor-aa6772c9.js';
3
4
 
4
5
  const snkFormCss = ".sc-snk-form-h{display:block}.snk-form.sc-snk-form{position:relative;padding:var(--space--large);padding-top:var(--space--medium)}.snk-form__header.sc-snk-form{position:relative;padding-top:var(--space--medium);padding-bottom:var(--space--medium);margin-bottom:var(--space--medium)}.snk-form__header--fixed.sc-snk-form{position:sticky;top:0;background:var(--background--body);z-index:var(--more-visible, 2);padding-left:var(--space--large);padding-right:var(--space--large);margin-left:calc(var(--space--large) * -1);margin-right:calc(var(--space--large) * -1);width:calc(100% + (var(--space--large) * 2))}";
5
6
 
@@ -8,6 +9,10 @@ const SnkForm = class {
8
9
  registerInstance(this, hostRef);
9
10
  this.exit = createEvent(this, "exit", 7);
10
11
  this.actionClick = createEvent(this, "actionClick", 7);
12
+ this._taskbarProcessor = new TaskbarProcessor({
13
+ "snkForm.regular": ["PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "GRID_MODE", "INSERT"],
14
+ "snkForm.finish_edition": ["CANCEL", "SAVE"]
15
+ });
11
16
  }
12
17
  getFormConfig() {
13
18
  return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
@@ -98,11 +103,24 @@ const SnkForm = class {
98
103
  parent = parent.parentElement;
99
104
  }
100
105
  }
106
+ componentWillRender() {
107
+ var _a;
108
+ const taskbarId = ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "snkForm.finish_edition" : "snkForm.regular";
109
+ const disabledButtons = [];
110
+ if (!this._dataState || !this._dataState.hasPrevious) {
111
+ disabledButtons.push("PREVIOUS");
112
+ }
113
+ if (!this._dataState || !this._dataState.hasNext) {
114
+ disabledButtons.push("NEXT");
115
+ }
116
+ this._taskbarProcessor.process(taskbarId, this.taskbarManager, this._dataState, disabledButtons);
117
+ }
101
118
  render() {
119
+ var _a;
102
120
  if (!this._configLoaded || !this._dataUnit || !this._dataState) {
103
121
  return undefined;
104
122
  }
105
- return (h("section", { class: "snk-form" }, h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, h("snk-taskbar", { key: "formTaskbar", buttons: this._dataState.isDirty ? "CANCEL,SAVE" : "PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,INSERT", primaryButton: this._dataState.isDirty ? "SAVE" : "INSERT", disabledButtons: this.getDisabledButtons(), actionsList: this.actionsList, dataUnit: this._dataUnit }))), h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator }))))));
123
+ return (h("section", { class: "snk-form" }, h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, h("snk-taskbar", { key: "formTaskbar", buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, primaryButton: ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", dataUnit: this._dataUnit }))), h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator }))))));
106
124
  }
107
125
  get _element() { return getElement(this); }
108
126
  };
@@ -1,6 +1,7 @@
1
1
  import { r as registerInstance, e as createEvent, h, g as getElement } from './index-2b4d2d14.js';
2
2
  import { a as ApplicationContext } from './index-e5b61043.js';
3
- import { T as TaskbarElement } from './taskbar-elements-c119510a.js';
3
+ import { T as TaskbarElement } from './taskbar-elements-35d64ff9.js';
4
+ import { T as TaskbarProcessor } from './taskbar-processor-aa6772c9.js';
4
5
 
5
6
  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)}";
6
7
 
@@ -9,9 +10,13 @@ const SnkGrid = class {
9
10
  registerInstance(this, hostRef);
10
11
  this.actionClick = createEvent(this, "actionClick", 7);
11
12
  this.gridDoubleClick = createEvent(this, "gridDoubleClick", 7);
12
- }
13
- getHeaderButtons() {
14
- return this._dataState && this._dataState.selectedRecords.length > 0 ? "UPDATE,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,REFRESH" : "REFRESH";
13
+ this._topTaskbarProcessor = new TaskbarProcessor({
14
+ "snkGridTopTaskbar": ["FORM_MODE", "CONFIG_GRID", "INSERT"]
15
+ });
16
+ this._headerTaskbarProcessor = new TaskbarProcessor({
17
+ "snkGridHeaderTaskbar.unselected": ["REFRESH"],
18
+ "snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
19
+ });
15
20
  }
16
21
  actionClickHandler(evt) {
17
22
  if (evt.detail === TaskbarElement.CONFIG_GRID && this._grid) {
@@ -52,11 +57,16 @@ const SnkGrid = class {
52
57
  parent = parent.parentElement;
53
58
  }
54
59
  }
60
+ componentWillRender() {
61
+ const headerTaskbarId = this._dataState && this._dataState.selectedRecords.length > 0 ? "snkGridHeaderTaskbar.selected" : "snkGridHeaderTaskbar.unselected";
62
+ this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState);
63
+ this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState);
64
+ }
55
65
  render() {
56
66
  if (!this._configLoaded || !this._dataUnit) {
57
67
  return undefined;
58
68
  }
59
- return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, h("snk-filter-bar", { class: "snk-grid__filter-bar ez-align--top" }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", onActionClick: evt => this.actionClickHandler(evt), key: "topTaskbar", dataUnit: this._dataUnit, buttons: "FORM_MODE,CONFIG_GRID,INSERT", primaryButton: "INSERT" })), 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() }, h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this.getHeaderButtons(), slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" }))));
69
+ return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, h("snk-filter-bar", { class: "snk-grid__filter-bar ez-align--top" }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), 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" })), 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() }, h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" }))));
60
70
  }
61
71
  get _element() { return getElement(this); }
62
72
  };
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, e as createEvent, h, f as Host } from './index-2b4d2d14.js';
2
2
  import { a as ApplicationContext } from './index-e5b61043.js';
3
- import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem } from './taskbar-elements-c119510a.js';
3
+ import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-35d64ff9.js';
4
4
 
5
5
  const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
6
6
 
@@ -100,13 +100,16 @@ const SnkTaskbar = class {
100
100
  return !(this.disabledButtons && this.disabledButtons.includes(elem));
101
101
  }
102
102
  getElement(index, def) {
103
- let element;
104
103
  let className = def === this.primaryButton ? "ez-button--primary " : "";
105
104
  if (index > 1) {
106
105
  className += "ez-padding-left--medium";
107
106
  }
108
- element = buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
109
- return element;
107
+ if (TaskbarElement[def.toString()]) {
108
+ return buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
109
+ }
110
+ else {
111
+ return buildCustomButton(def, className, elem => this.elementClick(elem), elem => this.isEnabled(elem));
112
+ }
110
113
  }
111
114
  // Lifecycle
112
115
  componentWillLoad() {
@@ -128,20 +131,20 @@ const SnkTaskbar = class {
128
131
  return undefined;
129
132
  }
130
133
  let index = 0;
131
- return (h(Host, null, this._definitions.map((btn) => {
132
- if (btn === TaskbarElement.DIVIDER) {
134
+ return (h(Host, null, this._definitions.map((elem) => {
135
+ if (elem === TaskbarElement.DIVIDER) {
133
136
  index = 0;
134
137
  }
135
138
  else {
136
139
  index++;
137
140
  }
138
- if (TaskbarElement[btn]) {
139
- return this.getElement(index, TaskbarElement[btn]);
141
+ if (TaskbarElement[elem]) {
142
+ return this.getElement(index, TaskbarElement[elem]);
140
143
  }
141
- else {
142
- index;
143
- return h("slot", { name: btn });
144
+ if (this.customButtons.has(elem)) {
145
+ return this.getElement(index, this.customButtons.get(elem));
144
146
  }
147
+ return h("slot", { name: elem });
145
148
  })));
146
149
  }
147
150
  static get watchers() { return {
@@ -0,0 +1,90 @@
1
+ import { h } from './index-2b4d2d14.js';
2
+
3
+ var TaskbarElement;
4
+ (function (TaskbarElement) {
5
+ TaskbarElement["PREVIOUS"] = "PREVIOUS";
6
+ TaskbarElement["NEXT"] = "NEXT";
7
+ TaskbarElement["REFRESH"] = "REFRESH";
8
+ TaskbarElement["UPDATE"] = "UPDATE";
9
+ TaskbarElement["CLONE"] = "CLONE";
10
+ TaskbarElement["REMOVE"] = "REMOVE";
11
+ TaskbarElement["INSERT"] = "INSERT";
12
+ TaskbarElement["CANCEL"] = "CANCEL";
13
+ TaskbarElement["SAVE"] = "SAVE";
14
+ TaskbarElement["GRID_MODE"] = "GRID_MODE";
15
+ TaskbarElement["FORM_MODE"] = "FORM_MODE";
16
+ TaskbarElement["CONFIG_GRID"] = "CONFIG_GRID";
17
+ TaskbarElement["MORE_OPTIONS"] = "MORE_OPTIONS";
18
+ TaskbarElement["DIVIDER"] = "DIVIDER";
19
+ })(TaskbarElement || (TaskbarElement = {}));
20
+ var AuthorizationElements;
21
+ (function (AuthorizationElements) {
22
+ AuthorizationElements["UPDATE"] = "UPDATE";
23
+ AuthorizationElements["CLONE"] = "CLONE";
24
+ AuthorizationElements["REMOVE"] = "REMOVE";
25
+ AuthorizationElements["INSERT"] = "INSERT";
26
+ AuthorizationElements["CONFIG_GRID"] = "CONFIG_GRID";
27
+ })(AuthorizationElements || (AuthorizationElements = {}));
28
+ var VisibleWhenForbidden;
29
+ (function (VisibleWhenForbidden) {
30
+ VisibleWhenForbidden["CONFIG_GRID"] = "CONFIG_GRID";
31
+ })(VisibleWhenForbidden || (VisibleWhenForbidden = {}));
32
+ const buildCustomButton = (def, className, action, isEnabled) => {
33
+ const { hint, text, iconName } = def;
34
+ if (iconName) {
35
+ if (text) {
36
+ return iconTextButton(iconName, def.name, className, hint, text, action, isEnabled);
37
+ }
38
+ else {
39
+ return iconButton(iconName, def.name, className, hint, action, isEnabled);
40
+ }
41
+ }
42
+ else {
43
+ return textButton(def.name, className, text, hint, action, isEnabled);
44
+ }
45
+ };
46
+ const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
47
+ const title = getTitle(element);
48
+ switch (element) {
49
+ case TaskbarElement.PREVIOUS:
50
+ return iconButton("chevron-left", element, className, title, action, isEnabled);
51
+ case TaskbarElement.NEXT:
52
+ return iconButton("chevron-right", element, className, title, action, isEnabled);
53
+ case TaskbarElement.REFRESH:
54
+ return iconButton("sync", element, className, title, action, isEnabled);
55
+ case TaskbarElement.UPDATE:
56
+ return iconButton("edit", element, className, title, action, isEnabled);
57
+ case TaskbarElement.CLONE:
58
+ return iconButton("copy", element, className, title, action, isEnabled);
59
+ case TaskbarElement.REMOVE:
60
+ return iconButton("delete", element, className, title, action, isEnabled);
61
+ case TaskbarElement.INSERT:
62
+ return iconTextButton("plus", element, className, title, title, action, isEnabled);
63
+ case TaskbarElement.CANCEL:
64
+ return textButton(element, className, title, title, action, isEnabled);
65
+ case TaskbarElement.SAVE:
66
+ return iconTextButton("save", element, className, title, title, action, isEnabled);
67
+ case TaskbarElement.GRID_MODE:
68
+ return iconButton("table", element, className, title, action, isEnabled);
69
+ case TaskbarElement.FORM_MODE:
70
+ return iconButton("list", element, className, title, action, isEnabled);
71
+ case TaskbarElement.CONFIG_GRID:
72
+ return iconButton("settings-inverted", element, className, title, action, isEnabled);
73
+ case TaskbarElement.MORE_OPTIONS:
74
+ return actions && actions.length > 0 ? h("ez-actions-button", { title: title, size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions }) : undefined;
75
+ case TaskbarElement.DIVIDER:
76
+ return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium" });
77
+ }
78
+ };
79
+ function textButton(name, className, text, title, action, isEnabled) {
80
+ return h("ez-button", { title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) });
81
+ }
82
+ function iconButton(iconName, name, className, title, action, isEnabled) {
83
+ return h("ez-button", { name: iconName, title: title, mode: "icon", size: "small", class: className, iconName: iconName, enabled: isEnabled(name), onClick: () => action(name) });
84
+ }
85
+ function iconTextButton(iconName, name, className, text, title, action, isEnabled) {
86
+ return h("ez-button", { name: iconName, title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) },
87
+ h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
88
+ }
89
+
90
+ export { AuthorizationElements as A, TaskbarElement as T, VisibleWhenForbidden as V, buildCustomButton as a, buildElem as b };
@@ -0,0 +1,45 @@
1
+ class TaskbarProcessor {
2
+ constructor(defaultButtons) {
3
+ this._defaultButtons = defaultButtons;
4
+ }
5
+ process(taskbarId, taskbarManager, dataState, disabledButtons = []) {
6
+ var _a;
7
+ this.customButtons = new Map();
8
+ this.buttons = "";
9
+ this.disabledButtons = [];
10
+ (_a = this.getButtonsArray(taskbarId, taskbarManager, dataState)) === null || _a === void 0 ? void 0 : _a.forEach(btnDef => {
11
+ let buttonName;
12
+ if (typeof btnDef === "string") {
13
+ buttonName = btnDef;
14
+ }
15
+ else {
16
+ const customBtn = btnDef;
17
+ this.customButtons.set(customBtn.name, customBtn);
18
+ buttonName = customBtn.name;
19
+ }
20
+ if (!this.isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabledButtons)) {
21
+ this.disabledButtons.push(buttonName);
22
+ }
23
+ if (this.buttons.length > 0) {
24
+ this.buttons += ",";
25
+ }
26
+ this.buttons += buttonName;
27
+ });
28
+ }
29
+ getButtonsArray(taskbarId, taskbarManager, dataState) {
30
+ const defaults = this._defaultButtons[taskbarId];
31
+ if (taskbarManager) {
32
+ return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
33
+ }
34
+ return defaults;
35
+ }
36
+ isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
37
+ const originalValue = disabled.includes(buttonName) ? false : true;
38
+ if (taskbarManager && taskbarManager.isEnabled) {
39
+ return taskbarManager.isEnabled(taskbarId, dataState, buttonName, originalValue);
40
+ }
41
+ return originalValue;
42
+ }
43
+ }
44
+
45
+ export { TaskbarProcessor as T };