@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
@@ -11,6 +11,7 @@ const FORM_MODE = 1;
11
11
  const SnkCrud = class {
12
12
  constructor(hostRef) {
13
13
  index.registerInstance(this, hostRef);
14
+ this.actionClick = index.createEvent(this, "actionClick", 7);
14
15
  }
15
16
  async gridToForm(keepFormMode = false) {
16
17
  this._backToGrid = !keepFormMode && await this._viewStack.getSelectedIndex() === GRID_MODE;
@@ -55,7 +56,7 @@ const SnkCrud = class {
55
56
  }
56
57
  }
57
58
  render() {
58
- return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, index.h("stack-item", null, index.h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList }, index.h("slot", { name: "SnkGridHeader" }), index.h("slot", { name: "SnkGridFooter" }))), index.h("stack-item", null, index.h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE), recordsValidator: this.recordsValidator, onActionClick: evt => this.executeAction(evt.detail) }))));
59
+ return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, index.h("stack-item", null, index.h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList }, index.h("slot", { name: "SnkGridHeader" }), index.h("slot", { name: "SnkGridFooter" }), index.h("slot", { name: "SnkGridTaskBar" }))), index.h("stack-item", null, index.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) }, index.h("slot", { name: "SnkFormTaskBar" })))));
59
60
  }
60
61
  get _element() { return index.getElement(this); }
61
62
  };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
6
  const index$1 = require('./index-02201bc9.js');
7
- const SnkMessageBuilder = require('./SnkMessageBuilder-cb132e6d.js');
7
+ const SnkMessageBuilder = require('./SnkMessageBuilder-02c2ca02.js');
8
8
 
9
9
  const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";
10
10
 
@@ -6,10 +6,11 @@ const index = require('./index-b0b676c5.js');
6
6
  const index$1 = require('./index-02201bc9.js');
7
7
  const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
8
8
 
9
- 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}";
9
+ 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%}";
10
10
 
11
11
  const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
12
12
  const DEFAULT_FILTER = "DEFAULT_FILTER";
13
+ const CLEAR_ALL_FILTERS = "CLEAR_ALL_FILTERS";
13
14
  const SnkFilterBar = class {
14
15
  constructor(hostRef) {
15
16
  index.registerInstance(this, hostRef);
@@ -56,6 +57,9 @@ const SnkFilterBar = class {
56
57
  //FIXME: ajustar o backend para não exigir parametros
57
58
  return { name: id, expression: selectedOption.expression, params: [] };
58
59
  }
60
+ if (type === filterItemType_enum.FilterItemType.MULTI_SELECT) {
61
+ return { name: id, expression: props.expression, params: [{ name: id, dataType: index$1.DataType.TEXT, value }] };
62
+ }
59
63
  if (type === filterItemType_enum.FilterItemType.PERIOD) {
60
64
  const { end, start } = value;
61
65
  const params = [];
@@ -127,11 +131,11 @@ const SnkFilterBar = class {
127
131
  getFilterItems() {
128
132
  const pinnedItems = [];
129
133
  const unpinnedItems = [];
130
- this._items = this.filterConfig
134
+ this.filterConfig
131
135
  .filter(item => item.visible)
132
136
  .sort((a, b) => this._filtersComparator(a, b))
133
- .map((item, index$1) => {
134
- const filterItem = (index.h("snk-filter-item", { config: item, class: index$1 > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
137
+ .forEach((item, index$1) => {
138
+ const filterItem = (index.h("snk-filter-item", { id: `filter-${item.id}`, config: this.normalizeItem(item), class: index$1 > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
135
139
  if (item.fixed || item.hardFixed) {
136
140
  pinnedItems.push(filterItem);
137
141
  }
@@ -149,25 +153,54 @@ const SnkFilterBar = class {
149
153
  return elements;
150
154
  }
151
155
  calculateUpdateSequence(item) {
152
- this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
153
- this._updateSequence.push(item.id);
156
+ if (item) {
157
+ this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
158
+ this._updateSequence.push(item.id);
159
+ }
154
160
  }
155
161
  filterChangeListener(evt) {
156
162
  this.updateFilter(evt.detail);
157
163
  }
158
- updateFilter(newItem) {
159
- this.calculateUpdateSequence(newItem);
160
- let needRefresh = false;
164
+ normalizeItem(item) {
165
+ const normalized = Object.assign({}, item);
166
+ const optionals = ["props", "value", "hardFixed", "fixed"];
167
+ optionals.forEach(prop => {
168
+ if (normalized[prop] == undefined) {
169
+ delete normalized[prop];
170
+ }
171
+ });
172
+ if (item.value === "") {
173
+ delete item.value;
174
+ }
175
+ return normalized;
176
+ }
177
+ updateFilter(newItem, clear = false) {
178
+ let upToDate = false;
161
179
  this.filterConfig = this.filterConfig.map(item => {
162
- if (item.id === newItem.id) {
163
- needRefresh = index$1.ObjectUtils.objectToString(item.value) !== index$1.ObjectUtils.objectToString(newItem.value);
164
- return newItem;
180
+ if (clear) {
181
+ if (item.value != undefined) {
182
+ this.calculateUpdateSequence(item);
183
+ upToDate = true;
184
+ }
185
+ return Object.assign(Object.assign({}, item), { value: undefined });
186
+ }
187
+ else {
188
+ if (item.id === newItem.id) {
189
+ const normalizedOne = this.normalizeItem(item);
190
+ const normalizedTwo = this.normalizeItem(newItem);
191
+ if (index$1.ObjectUtils.objectToString(normalizedOne) != index$1.ObjectUtils.objectToString(normalizedTwo)) {
192
+ this.calculateUpdateSequence(item);
193
+ }
194
+ upToDate = index$1.ObjectUtils.objectToString(normalizedOne.value) !== index$1.ObjectUtils.objectToString(normalizedTwo.value);
195
+ return newItem;
196
+ }
165
197
  }
166
198
  return item;
167
199
  });
168
- if (needRefresh) {
200
+ if (upToDate) {
169
201
  this.dataUnit.loadData();
170
202
  }
203
+ return upToDate;
171
204
  }
172
205
  getAddListItems() {
173
206
  const hiddenItems = this.filterConfig
@@ -180,17 +213,50 @@ const SnkFilterBar = class {
180
213
  { name: DEFAULT_FILTER, label: this.getMessage("snkFilterBar.defaultFilter"), iconName: "configuration", kind: "FOOTER" }
181
214
  ]);
182
215
  }
216
+ getActiveClass() {
217
+ const filterApplied = this.filterConfig.filter(item => item.value != undefined).length > 0;
218
+ return filterApplied ? "sc-snk-filter-bar snk-filter-bar__filter-list-items-button--active" : "";
219
+ }
220
+ getAppliedListItems() {
221
+ const appliedItems = this.filterConfig
222
+ .filter(item => item.value != undefined)
223
+ .sort(this._filtersComparator);
224
+ return appliedItems.map(filter => {
225
+ return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
226
+ }).concat([
227
+ { name: CLEAR_ALL_FILTERS, label: this.getMessage("snkFilterBar.clearAllFilters"), iconName: "cleaning", kind: "FOOTER" }
228
+ ]);
229
+ }
183
230
  addFilterHandler(itemName) {
184
231
  const filterItem = this.filterConfig.find(currentFilter => currentFilter.id === itemName);
185
232
  if (filterItem) {
186
233
  this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
234
+ window.requestAnimationFrame(() => {
235
+ const itemElement = this._element.querySelector("#filter-" + itemName);
236
+ if (itemElement) {
237
+ itemElement.showUp();
238
+ }
239
+ });
240
+ }
241
+ }
242
+ appliedFilterHandler(itemName) {
243
+ if (itemName === CLEAR_ALL_FILTERS) {
244
+ if (this.updateFilter(null, true)) {
245
+ this._application.info(this.getMessage("snkFilterBar.successfullyCleaned"), { iconName: "check" });
246
+ }
247
+ }
248
+ else {
249
+ const itemElement = this._element.querySelector("#filter-" + itemName);
250
+ if (itemElement) {
251
+ itemElement.showUp(true);
252
+ }
187
253
  }
188
254
  }
189
255
  render() {
190
256
  if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
191
257
  return undefined;
192
258
  }
193
- return (index.h(index.Host, null, index.h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), index.h("ez-button", { mode: "icon", size: "small", iconName: "filter", class: "ez-padding-left--medium" }), index.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) }, index.h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
259
+ return (index.h(index.Host, null, index.h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), index.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) }), index.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) }, index.h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
194
260
  }
195
261
  get _element() { return index.getElement(this); }
196
262
  };
@@ -10,7 +10,7 @@ const SnkFilterBinarySelect = class {
10
10
  index.registerInstance(this, hostRef);
11
11
  }
12
12
  isSelected(option) {
13
- return this.config.value == undefined || this.config.value === option;
13
+ return this.value == undefined || this.value === option;
14
14
  }
15
15
  ezChangeListener(evt) {
16
16
  if (!evt.detail) {
@@ -17,6 +17,8 @@ const SnkFilterDetail = class {
17
17
  switch (this.config.type) {
18
18
  case filterItemType_enum.FilterItemType.BINARY_SELECT:
19
19
  return "snk-filter-binary-select";
20
+ case filterItemType_enum.FilterItemType.MULTI_SELECT:
21
+ return "snk-filter-multi-select";
20
22
  case filterItemType_enum.FilterItemType.PERIOD:
21
23
  return "snk-filter-period";
22
24
  case filterItemType_enum.FilterItemType.SEARCH:
@@ -26,18 +28,21 @@ const SnkFilterDetail = class {
26
28
  }
27
29
  return "snk-filter-text";
28
30
  }
31
+ removeItem() {
32
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: undefined }));
33
+ }
29
34
  getPopUpHeaderButtons() {
30
35
  if (this.config.hardFixed) {
31
36
  return undefined;
32
37
  }
33
38
  return ([
34
- index.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 })) }),
39
+ index.h("ez-icon", { title: this.getMessage("snkFilterBar.removeFilter"), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: "delete", onClick: () => this.removeItem() }),
35
40
  index.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 })) })
36
41
  ]);
37
42
  }
38
43
  render() {
39
44
  const ContentEditor = this.getContentEditor();
40
- return (index.h(index.Host, null, index.h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, index.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()), index.h(ContentEditor, { ref: ref => this._editor = ref, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), index.h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), index.h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, index.h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined })) }), index.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" }))));
45
+ return (index.h(index.Host, null, index.h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, index.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()), index.h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), index.h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), index.h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, index.h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined })) }), index.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
46
  }
42
47
  };
43
48
 
@@ -29,6 +29,14 @@ const SnkFilterItem = class {
29
29
  return false;
30
30
  };
31
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
+ }
32
40
  showDetail() {
33
41
  this._floatingID = index$1.FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
34
42
  this.detailIsVisible = true;
@@ -83,6 +91,10 @@ const SnkFilterItem = class {
83
91
  return optTwo.label;
84
92
  }
85
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
+ }
86
98
  if (type === filterItemType_enum.FilterItemType.PERIOD) {
87
99
  const period = value;
88
100
  const dateFormater = new Intl.DateTimeFormat("pt-BR");
@@ -91,7 +103,7 @@ const SnkFilterItem = class {
91
103
  }
92
104
  else {
93
105
  if (period.start) {
94
- return `${label}: A partir de ${dateFormater.format(period.end)}`;
106
+ return `${label}: A partir de ${dateFormater.format(period.start)}`;
95
107
  }
96
108
  else {
97
109
  return `${label}: Até ${dateFormater.format(period.end)}`;
@@ -70,7 +70,7 @@ const SnkFilterList = class {
70
70
  getFilterItems() {
71
71
  const items = this.items ? index$1.ArrayUtils.applyStringFilter(this._filterArgument, this.items.filter(item => item.kind === "FILTER")) : [];
72
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.getMessage("snkFilterBar.emptyFilterList"));
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
74
  }
75
75
  const hideItems = !this._filterArgument && !this._showAll && (items.length > MAX_FILTERS + 1);
76
76
  if (hideItems) {
@@ -83,7 +83,7 @@ const SnkFilterList = class {
83
83
  return this.items.filter(item => item.kind === "FOOTER");
84
84
  }
85
85
  render() {
86
- return (index.h(index.Host, { class: "ez-flex ez-flex--column" }, index.h("ez-button", { 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.getMessage("snkFilterBar.findFilter"), 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))));
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
87
  }
88
88
  get _element() { return index.getElement(this); }
89
89
  };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-b0b676c5.js');
6
+ const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
7
+
8
+ const SnkFilterMultiSelect = class {
9
+ constructor(hostRef) {
10
+ index.registerInstance(this, hostRef);
11
+ }
12
+ ezChangeListener(evt) {
13
+ this.value = evt.detail.value;
14
+ }
15
+ render() {
16
+ if (!this.config || this.config.type !== filterItemType_enum.FilterItemType.MULTI_SELECT) {
17
+ return undefined;
18
+ }
19
+ return (index.h("ez-combo-box", { label: this.config.label, value: this.config.value, options: this.config.props.options }));
20
+ }
21
+ };
22
+
23
+ exports.snk_filter_multi_select = SnkFilterMultiSelect;
@@ -13,10 +13,11 @@ const SnkFilterPeriod = class {
13
13
  this.value = evt.detail;
14
14
  }
15
15
  render() {
16
+ var _a;
16
17
  if (!this.config || this.config.type !== filterItemType_enum.FilterItemType.NUMBER) {
17
18
  return undefined;
18
19
  }
19
- return (index.h("ez-number-input", { label: this.config.label, value: this.config.value }));
20
+ return (index.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 }));
20
21
  }
21
22
  };
22
23
 
@@ -37,7 +37,7 @@ const SnkFilterSearch = class {
37
37
  if (!this.config || this.config.type !== filterItemType_enum.FilterItemType.SEARCH) {
38
38
  return undefined;
39
39
  }
40
- return (index.h("ez-search", { value: this.config.value, label: this.config.label, ref: ref => this._searchInput = ref, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument) }));
40
+ return (index.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) }));
41
41
  }
42
42
  };
43
43
 
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
6
  const index$1 = require('./index-02201bc9.js');
7
+ const taskbarProcessor = require('./taskbar-processor-6bd0d35c.js');
7
8
 
8
9
  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))}";
9
10
 
@@ -12,6 +13,10 @@ const SnkForm = class {
12
13
  index.registerInstance(this, hostRef);
13
14
  this.exit = index.createEvent(this, "exit", 7);
14
15
  this.actionClick = index.createEvent(this, "actionClick", 7);
16
+ this._taskbarProcessor = new taskbarProcessor.TaskbarProcessor({
17
+ "snkForm.regular": ["PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "GRID_MODE", "INSERT"],
18
+ "snkForm.finish_edition": ["CANCEL", "SAVE"]
19
+ });
15
20
  }
16
21
  getFormConfig() {
17
22
  return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
@@ -102,11 +107,24 @@ const SnkForm = class {
102
107
  parent = parent.parentElement;
103
108
  }
104
109
  }
110
+ componentWillRender() {
111
+ var _a;
112
+ const taskbarId = ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "snkForm.finish_edition" : "snkForm.regular";
113
+ const disabledButtons = [];
114
+ if (!this._dataState || !this._dataState.hasPrevious) {
115
+ disabledButtons.push("PREVIOUS");
116
+ }
117
+ if (!this._dataState || !this._dataState.hasNext) {
118
+ disabledButtons.push("NEXT");
119
+ }
120
+ this._taskbarProcessor.process(taskbarId, this.taskbarManager, this._dataState, disabledButtons);
121
+ }
105
122
  render() {
123
+ var _a;
106
124
  if (!this._configLoaded || !this._dataUnit || !this._dataState) {
107
125
  return undefined;
108
126
  }
109
- return (index.h("section", { class: "snk-form" }, index.h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, index.h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, index.h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), index.h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), index.h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, index.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 }))), index.h("section", null, index.h("div", { class: "ez-row" }, index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator }))))));
127
+ return (index.h("section", { class: "snk-form" }, index.h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, index.h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, index.h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), index.h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), index.h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, index.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 }))), index.h("section", null, index.h("div", { class: "ez-row" }, index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator }))))));
110
128
  }
111
129
  get _element() { return index.getElement(this); }
112
130
  };
@@ -4,7 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
6
  const index$1 = require('./index-02201bc9.js');
7
- const taskbarElements = require('./taskbar-elements-efa44ff1.js');
7
+ const taskbarElements = require('./taskbar-elements-283c737e.js');
8
+ const taskbarProcessor = require('./taskbar-processor-6bd0d35c.js');
8
9
 
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)}";
10
11
 
@@ -13,9 +14,13 @@ const SnkGrid = class {
13
14
  index.registerInstance(this, hostRef);
14
15
  this.actionClick = index.createEvent(this, "actionClick", 7);
15
16
  this.gridDoubleClick = index.createEvent(this, "gridDoubleClick", 7);
16
- }
17
- getHeaderButtons() {
18
- return this._dataState && this._dataState.selectedRecords.length > 0 ? "UPDATE,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,REFRESH" : "REFRESH";
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
+ });
19
24
  }
20
25
  actionClickHandler(evt) {
21
26
  if (evt.detail === taskbarElements.TaskbarElement.CONFIG_GRID && this._grid) {
@@ -56,11 +61,16 @@ const SnkGrid = class {
56
61
  parent = parent.parentElement;
57
62
  }
58
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
+ }
59
69
  render() {
60
70
  if (!this._configLoaded || !this._dataUnit) {
61
71
  return undefined;
62
72
  }
63
- 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", { class: "snk-grid__filter-bar ez-align--top" }), 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: "FORM_MODE,CONFIG_GRID,INSERT", 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() }, index.h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this.getHeaderButtons(), slot: "leftButtons", actionsList: this.actionsList })), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" }))));
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", { class: "snk-grid__filter-bar ez-align--top" }), 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() }, 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" }))));
64
74
  }
65
75
  get _element() { return index.getElement(this); }
66
76
  };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
6
  const index$1 = require('./index-02201bc9.js');
7
- const taskbarElements = require('./taskbar-elements-efa44ff1.js');
7
+ const taskbarElements = require('./taskbar-elements-283c737e.js');
8
8
 
9
9
  const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
10
10
 
@@ -104,13 +104,16 @@ const SnkTaskbar = class {
104
104
  return !(this.disabledButtons && this.disabledButtons.includes(elem));
105
105
  }
106
106
  getElement(index, def) {
107
- let element;
108
107
  let className = def === this.primaryButton ? "ez-button--primary " : "";
109
108
  if (index > 1) {
110
109
  className += "ez-padding-left--medium";
111
110
  }
112
- element = taskbarElements.buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
113
- return element;
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
+ }
114
117
  }
115
118
  // Lifecycle
116
119
  componentWillLoad() {
@@ -132,20 +135,20 @@ const SnkTaskbar = class {
132
135
  return undefined;
133
136
  }
134
137
  let index$1 = 0;
135
- return (index.h(index.Host, null, this._definitions.map((btn) => {
136
- if (btn === taskbarElements.TaskbarElement.DIVIDER) {
138
+ return (index.h(index.Host, null, this._definitions.map((elem) => {
139
+ if (elem === taskbarElements.TaskbarElement.DIVIDER) {
137
140
  index$1 = 0;
138
141
  }
139
142
  else {
140
143
  index$1++;
141
144
  }
142
- if (taskbarElements.TaskbarElement[btn]) {
143
- return this.getElement(index$1, taskbarElements.TaskbarElement[btn]);
145
+ if (taskbarElements.TaskbarElement[elem]) {
146
+ return this.getElement(index$1, taskbarElements.TaskbarElement[elem]);
144
147
  }
145
- else {
146
- index$1;
147
- return index.h("slot", { name: btn });
148
+ if (this.customButtons.has(elem)) {
149
+ return this.getElement(index$1, this.customButtons.get(elem));
148
150
  }
151
+ return index.h("slot", { name: elem });
149
152
  })));
150
153
  }
151
154
  static get watchers() { return {
@@ -31,44 +31,63 @@ exports.VisibleWhenForbidden = void 0;
31
31
  (function (VisibleWhenForbidden) {
32
32
  VisibleWhenForbidden["CONFIG_GRID"] = "CONFIG_GRID";
33
33
  })(exports.VisibleWhenForbidden || (exports.VisibleWhenForbidden = {}));
34
+ const buildCustomButton = (def, className, action, isEnabled) => {
35
+ const { hint, text, iconName } = def;
36
+ if (iconName) {
37
+ if (text) {
38
+ return iconTextButton(iconName, def.name, className, hint, text, action, isEnabled);
39
+ }
40
+ else {
41
+ return iconButton(iconName, def.name, className, hint, action, isEnabled);
42
+ }
43
+ }
44
+ else {
45
+ return textButton(def.name, className, text, hint, action, isEnabled);
46
+ }
47
+ };
34
48
  const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
49
+ const title = getTitle(element);
35
50
  switch (element) {
36
51
  case exports.TaskbarElement.PREVIOUS:
37
- return iconButton("chevron-left", element, className, getTitle, action, isEnabled);
52
+ return iconButton("chevron-left", element, className, title, action, isEnabled);
38
53
  case exports.TaskbarElement.NEXT:
39
- return iconButton("chevron-right", element, className, getTitle, action, isEnabled);
54
+ return iconButton("chevron-right", element, className, title, action, isEnabled);
40
55
  case exports.TaskbarElement.REFRESH:
41
- return iconButton("sync", element, className, getTitle, action, isEnabled);
56
+ return iconButton("sync", element, className, title, action, isEnabled);
42
57
  case exports.TaskbarElement.UPDATE:
43
- return iconButton("edit", element, className, getTitle, action, isEnabled);
58
+ return iconButton("edit", element, className, title, action, isEnabled);
44
59
  case exports.TaskbarElement.CLONE:
45
- return iconButton("copy", element, className, getTitle, action, isEnabled);
60
+ return iconButton("copy", element, className, title, action, isEnabled);
46
61
  case exports.TaskbarElement.REMOVE:
47
- return iconButton("delete", element, className, getTitle, action, isEnabled);
62
+ return iconButton("delete", element, className, title, action, isEnabled);
48
63
  case exports.TaskbarElement.INSERT:
49
- return iconTextButton("plus", element, className, getTitle, action, isEnabled);
64
+ return iconTextButton("plus", element, className, title, title, action, isEnabled);
50
65
  case exports.TaskbarElement.CANCEL:
51
- return index.h("ez-button", { title: getTitle(element), label: getTitle(element), size: "small", enabled: isEnabled(element), onClick: () => action(element) });
66
+ return textButton(element, className, title, title, action, isEnabled);
52
67
  case exports.TaskbarElement.SAVE:
53
- return iconTextButton("save", element, className, getTitle, action, isEnabled);
68
+ return iconTextButton("save", element, className, title, title, action, isEnabled);
54
69
  case exports.TaskbarElement.GRID_MODE:
55
- return iconButton("table", element, className, getTitle, action, isEnabled);
70
+ return iconButton("table", element, className, title, action, isEnabled);
56
71
  case exports.TaskbarElement.FORM_MODE:
57
- return iconButton("list", element, className, getTitle, action, isEnabled);
72
+ return iconButton("list", element, className, title, action, isEnabled);
58
73
  case exports.TaskbarElement.CONFIG_GRID:
59
- return iconButton("settings-inverted", element, className, getTitle, action, isEnabled);
74
+ return iconButton("settings-inverted", element, className, title, action, isEnabled);
60
75
  case exports.TaskbarElement.MORE_OPTIONS:
61
- return actions && actions.length > 0 ? index.h("ez-actions-button", { title: getTitle(element), size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions }) : undefined;
76
+ return actions && actions.length > 0 ? index.h("ez-actions-button", { title: title, size: "small", class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions }) : undefined;
62
77
  case exports.TaskbarElement.DIVIDER:
63
78
  return index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium" });
64
79
  }
65
80
  };
66
- function iconButton(iconName, element, className, getTitle, action, isEnabled) {
67
- return index.h("ez-button", { key: iconName, title: getTitle(element), mode: "icon", size: "small", class: className, iconName: iconName, enabled: isEnabled(element), onClick: () => action(element) });
81
+ function textButton(name, className, text, title, action, isEnabled) {
82
+ return index.h("ez-button", { title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) });
83
+ }
84
+ function iconButton(iconName, name, className, title, action, isEnabled) {
85
+ return index.h("ez-button", { name: iconName, title: title, mode: "icon", size: "small", class: className, iconName: iconName, enabled: isEnabled(name), onClick: () => action(name) });
68
86
  }
69
- function iconTextButton(iconName, element, className, getTitle, action, isEnabled) {
70
- return index.h("ez-button", { key: iconName, title: getTitle(element), label: getTitle(element), size: "small", class: className, enabled: isEnabled(element), onClick: () => action(element) },
87
+ function iconTextButton(iconName, name, className, text, title, action, isEnabled) {
88
+ return index.h("ez-button", { name: iconName, title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) },
71
89
  index.h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
72
90
  }
73
91
 
92
+ exports.buildCustomButton = buildCustomButton;
74
93
  exports.buildElem = buildElem;
@@ -0,0 +1,47 @@
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;