@sankhyalabs/sankhyablocks 1.4.0-beta.2 → 1.4.0-beta.4

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 (152) hide show
  1. package/dist/cjs/{index-b0b676c5.js → index-6fcf07f3.js} +159 -1515
  2. package/dist/cjs/loader.cjs.js +2 -18
  3. package/dist/cjs/sankhyablocks.cjs.js +4 -116
  4. package/dist/cjs/snk-application.cjs.entry.js +53 -217
  5. package/dist/cjs/snk-crud.cjs.entry.js +9 -3
  6. package/dist/cjs/snk-data-unit.cjs.entry.js +23 -23
  7. package/dist/cjs/snk-filter-bar_5.cjs.entry.js +883 -0
  8. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-filter-detail.cjs.entry.js +32 -21
  10. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  11. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  12. package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
  13. package/dist/cjs/snk-filter-personalized.cjs.entry.js +23 -31
  14. package/dist/cjs/snk-filter-search.cjs.entry.js +3 -12
  15. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  16. package/dist/cjs/{snk-form.cjs.entry.js → snk-form_2.cjs.entry.js} +119 -5
  17. package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
  18. package/dist/cjs/{taskbar-elements-283c737e.js → taskbar-elements-aedfeae6.js} +1 -1
  19. package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
  20. package/dist/collection/components/snk-crud/snk-crud.js +29 -0
  21. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +0 -39
  22. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +0 -39
  23. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +30 -36
  24. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +3 -14
  25. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +4 -12
  26. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +3 -3
  27. package/dist/components/index.js +0 -4
  28. package/dist/components/snk-application2.js +13 -177
  29. package/dist/components/snk-crud.js +9 -2
  30. package/dist/components/snk-data-unit.js +2 -2
  31. package/dist/components/snk-filter-bar2.js +4 -2
  32. package/dist/components/snk-filter-detail2.js +31 -21
  33. package/dist/components/snk-filter-item2.js +4 -15
  34. package/dist/components/snk-filter-list2.js +5 -13
  35. package/dist/components/snk-filter-modal2.js +4 -19
  36. package/dist/components/snk-filter-personalized.js +3 -13
  37. package/dist/components/snk-filter-search.js +2 -13
  38. package/dist/components/snk-form2.js +1 -1
  39. package/dist/components/snk-grid2.js +1 -1
  40. package/dist/components/snk-pesquisa2.js +1 -1
  41. package/dist/components/snk-taskbar2.js +1 -1
  42. package/dist/components/teste-pesquisa.js +1 -1
  43. package/dist/{sankhyablocks/index-2b4d2d14.js → esm/index-81dda3cf.js} +160 -1508
  44. package/dist/esm/loader.js +2 -18
  45. package/dist/esm/sankhyablocks.js +4 -116
  46. package/dist/esm/snk-application.entry.js +14 -178
  47. package/dist/esm/snk-crud.entry.js +8 -2
  48. package/dist/esm/snk-data-unit.entry.js +3 -3
  49. package/dist/esm/{snk-filter-bar.entry.js → snk-filter-bar_5.entry.js} +417 -4
  50. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  51. package/dist/esm/snk-filter-detail.entry.js +32 -21
  52. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  53. package/dist/esm/snk-filter-number.entry.js +1 -1
  54. package/dist/esm/snk-filter-period.entry.js +1 -1
  55. package/dist/esm/snk-filter-personalized.entry.js +3 -11
  56. package/dist/esm/snk-filter-search.entry.js +2 -11
  57. package/dist/esm/snk-filter-text.entry.js +1 -1
  58. package/dist/{sankhyablocks/snk-form.entry.js → esm/snk-form_2.entry.js} +117 -4
  59. package/dist/esm/snk-pesquisa.entry.js +2 -2
  60. package/dist/esm/{taskbar-elements-35d64ff9.js → taskbar-elements-38eb5d51.js} +1 -1
  61. package/dist/esm/teste-pesquisa.entry.js +2 -2
  62. package/dist/sankhyablocks/index.esm.js +0 -1
  63. package/dist/sankhyablocks/p-01823784.entry.js +1 -0
  64. package/dist/sankhyablocks/p-0352c0e2.entry.js +1 -0
  65. package/dist/sankhyablocks/p-07ebda01.entry.js +1 -0
  66. package/dist/sankhyablocks/p-46caa101.entry.js +1 -0
  67. package/dist/sankhyablocks/p-586e2522.js +1 -0
  68. package/dist/sankhyablocks/p-6f8303f3.entry.js +1 -0
  69. package/dist/sankhyablocks/p-746fc78b.entry.js +1 -0
  70. package/dist/sankhyablocks/p-77216252.entry.js +1 -0
  71. package/dist/sankhyablocks/p-86f15ffe.js +1 -0
  72. package/dist/sankhyablocks/p-8bbc0cbb.entry.js +74 -0
  73. package/dist/sankhyablocks/p-8f3c5709.entry.js +1 -0
  74. package/dist/sankhyablocks/p-97009a2c.entry.js +1 -0
  75. package/dist/sankhyablocks/p-9dd2b8cb.js +1 -0
  76. package/dist/sankhyablocks/p-aecf3e0a.entry.js +1 -0
  77. package/dist/sankhyablocks/p-c1c3b5d8.entry.js +1 -0
  78. package/dist/sankhyablocks/p-c9eec639.entry.js +1 -0
  79. package/dist/sankhyablocks/p-eea6444c.entry.js +1 -0
  80. package/dist/sankhyablocks/p-fac2b6a9.js +2 -0
  81. package/dist/sankhyablocks/p-fb705f81.entry.js +1 -0
  82. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -129
  83. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +0 -2
  84. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +0 -2
  85. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +1 -1
  86. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +1 -1
  87. package/dist/types/components.d.ts +4 -10
  88. package/package.json +1 -1
  89. package/react/components.d.ts +19 -0
  90. package/react/components.js +19 -0
  91. package/react/components.js.map +1 -1
  92. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  93. package/dist/cjs/css-shim-b8158822.js +0 -6
  94. package/dist/cjs/dom-36862b77.js +0 -75
  95. package/dist/cjs/index-84fe3b86.js +0 -20
  96. package/dist/cjs/index-93965c41.js +0 -141
  97. package/dist/cjs/index-e90ae303.js +0 -2408
  98. package/dist/cjs/shadow-css-346c0795.js +0 -389
  99. package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -466
  100. package/dist/cjs/snk-filter-item.cjs.entry.js +0 -177
  101. package/dist/cjs/snk-filter-list.cjs.entry.js +0 -91
  102. package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -37
  103. package/dist/cjs/snk-grid.cjs.entry.js +0 -79
  104. package/dist/cjs/snk-taskbar.cjs.entry.js +0 -160
  105. package/dist/cjs/taskbar-processor-6bd0d35c.js +0 -47
  106. package/dist/components/index2.js +0 -2394
  107. package/dist/components/index3.js +0 -139
  108. package/dist/esm/app-globals-0f993ce5.js +0 -3
  109. package/dist/esm/css-shim-b3f2ee8d.js +0 -4
  110. package/dist/esm/dom-665d6011.js +0 -73
  111. package/dist/esm/index-2b4d2d14.js +0 -3262
  112. package/dist/esm/index-5992b7e6.js +0 -139
  113. package/dist/esm/index-c683b2b0.js +0 -2394
  114. package/dist/esm/index-c71285cb.js +0 -17
  115. package/dist/esm/shadow-css-b18e99d7.js +0 -387
  116. package/dist/esm/snk-filter-item.entry.js +0 -173
  117. package/dist/esm/snk-filter-list.entry.js +0 -87
  118. package/dist/esm/snk-filter-modal.entry.js +0 -33
  119. package/dist/esm/snk-form.entry.js +0 -129
  120. package/dist/esm/snk-grid.entry.js +0 -75
  121. package/dist/esm/snk-taskbar.entry.js +0 -156
  122. package/dist/esm/taskbar-processor-aa6772c9.js +0 -45
  123. package/dist/sankhyablocks/SnkMessageBuilder-35a20271.js +0 -199
  124. package/dist/sankhyablocks/app-globals-0f993ce5.js +0 -3
  125. package/dist/sankhyablocks/css-shim-b3f2ee8d.js +0 -4
  126. package/dist/sankhyablocks/dom-665d6011.js +0 -73
  127. package/dist/sankhyablocks/filter-item-type.enum-a79b2fa8.js +0 -14
  128. package/dist/sankhyablocks/index-5992b7e6.js +0 -139
  129. package/dist/sankhyablocks/index-c683b2b0.js +0 -2394
  130. package/dist/sankhyablocks/index-c71285cb.js +0 -17
  131. package/dist/sankhyablocks/shadow-css-b18e99d7.js +0 -387
  132. package/dist/sankhyablocks/snk-application.entry.js +0 -8166
  133. package/dist/sankhyablocks/snk-crud.entry.js +0 -66
  134. package/dist/sankhyablocks/snk-data-unit.entry.js +0 -268
  135. package/dist/sankhyablocks/snk-filter-bar.entry.js +0 -462
  136. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +0 -43
  137. package/dist/sankhyablocks/snk-filter-detail.entry.js +0 -80
  138. package/dist/sankhyablocks/snk-filter-item.entry.js +0 -173
  139. package/dist/sankhyablocks/snk-filter-list.entry.js +0 -87
  140. package/dist/sankhyablocks/snk-filter-modal.entry.js +0 -33
  141. package/dist/sankhyablocks/snk-filter-multi-select.entry.js +0 -19
  142. package/dist/sankhyablocks/snk-filter-number.entry.js +0 -20
  143. package/dist/sankhyablocks/snk-filter-period.entry.js +0 -33
  144. package/dist/sankhyablocks/snk-filter-personalized.entry.js +0 -85
  145. package/dist/sankhyablocks/snk-filter-search.entry.js +0 -40
  146. package/dist/sankhyablocks/snk-filter-text.entry.js +0 -18
  147. package/dist/sankhyablocks/snk-grid.entry.js +0 -75
  148. package/dist/sankhyablocks/snk-pesquisa.entry.js +0 -311
  149. package/dist/sankhyablocks/snk-taskbar.entry.js +0 -156
  150. package/dist/sankhyablocks/taskbar-elements-35d64ff9.js +0 -90
  151. package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +0 -45
  152. package/dist/sankhyablocks/teste-pesquisa.entry.js +0 -33
@@ -1,91 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-e90ae303.js');
7
-
8
- const SHOW_MORE_ITEM_NAME = "__SHOWMORE__";
9
- const MAX_FILTERS = 5;
10
- const SnkFilterList = class {
11
- constructor(hostRef) {
12
- index.registerInstance(this, hostRef);
13
- this.snkItemSelected = index.createEvent(this, "snkItemSelected", 7);
14
- this.innerClickCheck = (floatingContainer, node) => {
15
- if (node && floatingContainer) {
16
- if (!node.offsetParent) {
17
- return true;
18
- }
19
- let current = node;
20
- do {
21
- if (current === floatingContainer || current === this._element) {
22
- return true;
23
- }
24
- } while ((current = current.offsetParent) != null);
25
- }
26
- this._detailIsVisible = false;
27
- return false;
28
- };
29
- }
30
- showList() {
31
- this._floatingID = index$1.FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck });
32
- this._detailIsVisible = true;
33
- this._showAll = false;
34
- this._filterArgument = "";
35
- }
36
- hideList() {
37
- if (this._floatingID != undefined) {
38
- index$1.FloatingManager.close(this._floatingID);
39
- }
40
- this._floatingID = undefined;
41
- this._detailIsVisible = false;
42
- }
43
- buttonClick() {
44
- if (this._detailIsVisible) {
45
- this.hideList();
46
- }
47
- else {
48
- this.showList();
49
- }
50
- }
51
- componentDidRender() {
52
- if (this._floatingID == undefined) {
53
- if (this._popover) {
54
- this._popover.remove();
55
- }
56
- }
57
- }
58
- buildItemElement(item) {
59
- return (index.h("div", { class: "ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item", onClick: () => this.itemSelected(item.name) }, item.iconName ? index.h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, index.h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
60
- }
61
- itemSelected(itemName) {
62
- if (itemName === SHOW_MORE_ITEM_NAME) {
63
- this._showAll = true;
64
- }
65
- else {
66
- this.hideList();
67
- this.snkItemSelected.emit(itemName);
68
- }
69
- }
70
- getFilterItems() {
71
- const items = this.items ? index$1.ArrayUtils.applyStringFilter(this._filterArgument, this.items.filter(item => item.kind === "FILTER")) : [];
72
- if (items.length === 0) {
73
- return index.h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty" }, this.emptyText);
74
- }
75
- const hideItems = !this._filterArgument && !this._showAll && (items.length > MAX_FILTERS + 1);
76
- if (hideItems) {
77
- items.splice(MAX_FILTERS);
78
- items.push({ kind: "INTERNAL", label: "Mostrar mais", iconName: "dots-horizontal", name: SHOW_MORE_ITEM_NAME, iconClass: "snk-filter-bar__filter-list-item__icon--secondary", labelClass: "snk-filter-bar__filter-list-item__label--secondary" });
79
- }
80
- return index.h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
81
- }
82
- getFooterItems() {
83
- return this.items.filter(item => item.kind === "FOOTER");
84
- }
85
- render() {
86
- return (index.h(index.Host, { class: "ez-flex ez-flex--column" }, index.h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, index.h("slot", { name: "leftIcon" })), index.h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, index.h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, index.h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail }), this.getFilterItems(), index.h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
87
- }
88
- get _element() { return index.getElement(this); }
89
- };
90
-
91
- exports.snk_filter_list = SnkFilterList;
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-b0b676c5.js');
6
- const index$2 = require('./index-84fe3b86.js');
7
- const index$1 = require('./index-e90ae303.js');
8
-
9
- const SnkFilterModal = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- }
13
- updateValue(id, value) {
14
- this.items = this.items.map(item => {
15
- if (item.id === id) {
16
- return Object.assign(Object.assign({}, item), { active: value });
17
- }
18
- return item;
19
- });
20
- }
21
- getActiveFiltersMsg() {
22
- const activeFilters = this.items.filter(item => item.active).length;
23
- if (activeFilters === 0) {
24
- return this.getMessage("snkFilterBar.noActiveFilters");
25
- }
26
- return this.getMessage(activeFilters > 1 ? "snkFilterBar.activeFilters" : "snkFilterBar.activeFilter", { ACTIVE_FILTERS: activeFilters });
27
- }
28
- getFilteredItems() {
29
- return this.items ? index$1.ArrayUtils.applyStringFilter(this._filterArgument, this.items) : [];
30
- }
31
- render() {
32
- const allowCancel = this.items.filter(item => item.active).length > 0;
33
- return (index.h("ez-modal-container", { modalTitle: this.modalTitle, modalSubTitle: this.modalSubTitle, cancelButtonLabel: this.cancelButtonLabel, okButtonLabel: this.okButtonLabel, onEzModalAction: evt => this.processModalAction(evt.detail), cancelButtonStatus: allowCancel ? index$2.ModalButtonStatus.ENABLED : index$2.ModalButtonStatus.DISABLED }, index.h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-content" }, index.h("div", null, this.useSearch ? index.h("ez-filter-input", { label: this.getMessage("snkFilterBar.modalFindFilter"), onEzChange: (evt) => this._filterArgument = evt.detail }) : undefined), this.getFilteredItems().length > 0 ? index.h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding-bottom--small" }, this.getActiveFiltersMsg()) : undefined, index.h("div", null, this.getFilteredItems().map(item => index.h("div", { class: "ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small" }, index.h("ez-check", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-item__check", onEzChange: evt => this.updateValue(item.id, evt.detail), enabled: item.enabled, value: item.active, mode: "switch" }), index.h("div", { class: "ez-text ez-title--primary ez-text--medium ez-margin-left--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item__label" }, item.label)))), index.h("div", { class: "ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large" }, this.infoText))));
34
- }
35
- };
36
-
37
- exports.snk_filter_modal = SnkFilterModal;
@@ -1,79 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-e90ae303.js');
7
- const taskbarElements = require('./taskbar-elements-283c737e.js');
8
- const taskbarProcessor = require('./taskbar-processor-6bd0d35c.js');
9
-
10
- const snkGridCss = ".snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{display:flex;flex-wrap:nowrap;width:100%}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--small)}";
11
-
12
- const SnkGrid = class {
13
- constructor(hostRef) {
14
- index.registerInstance(this, hostRef);
15
- this.actionClick = index.createEvent(this, "actionClick", 7);
16
- this.gridDoubleClick = index.createEvent(this, "gridDoubleClick", 7);
17
- this._topTaskbarProcessor = new taskbarProcessor.TaskbarProcessor({
18
- "snkGridTopTaskbar": ["FORM_MODE", "CONFIG_GRID", "INSERT"]
19
- });
20
- this._headerTaskbarProcessor = new taskbarProcessor.TaskbarProcessor({
21
- "snkGridHeaderTaskbar.unselected": ["REFRESH"],
22
- "snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
23
- });
24
- }
25
- actionClickHandler(evt) {
26
- if (evt.detail === taskbarElements.TaskbarElement.CONFIG_GRID && this._grid) {
27
- this._grid.openGridConfig();
28
- }
29
- }
30
- saveConfig(config) {
31
- const snkApplication = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
32
- if (snkApplication) {
33
- snkApplication.saveGridConfig(config);
34
- }
35
- }
36
- componentWillLoad() {
37
- const snkApplication = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
38
- if (snkApplication) {
39
- snkApplication.loadGridConfig(this.configName).then(cfg => {
40
- this._gridConfig = cfg;
41
- this._configLoaded = true;
42
- });
43
- //Forçamos a carga dos acessos pra aproveitar a request inicial.
44
- snkApplication.getAllAccess();
45
- }
46
- let parent = this._element.parentElement;
47
- while (parent) {
48
- if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
49
- this._snkDataUnit = parent;
50
- this._dataUnit = this._snkDataUnit.dataUnit;
51
- if (!this._dataUnit) {
52
- this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
53
- this._dataUnit = evt.detail;
54
- });
55
- }
56
- this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
57
- this._dataState = evt.detail;
58
- });
59
- break;
60
- }
61
- parent = parent.parentElement;
62
- }
63
- }
64
- componentWillRender() {
65
- const headerTaskbarId = this._dataState && this._dataState.selectedRecords.length > 0 ? "snkGridHeaderTaskbar.selected" : "snkGridHeaderTaskbar.unselected";
66
- this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState);
67
- this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState);
68
- }
69
- render() {
70
- if (!this._configLoaded || !this._dataUnit) {
71
- return undefined;
72
- }
73
- return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, index.h("snk-filter-bar", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), index.h("snk-taskbar", { class: "ez-padding-left--medium", onActionClick: evt => this.actionClickHandler(evt), key: "topTaskbar", dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), index.h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: evt => { this.saveConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver }, index.h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" }))));
74
- }
75
- get _element() { return index.getElement(this); }
76
- };
77
- SnkGrid.style = snkGridCss;
78
-
79
- exports.snk_grid = SnkGrid;
@@ -1,160 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-e90ae303.js');
7
- const taskbarElements = require('./taskbar-elements-283c737e.js');
8
-
9
- const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
10
-
11
- const SnkTaskbar = class {
12
- constructor(hostRef) {
13
- index.registerInstance(this, hostRef);
14
- this.actionClick = index.createEvent(this, "actionClick", 7);
15
- this._titleKeyByElement = {
16
- [taskbarElements.TaskbarElement.UPDATE]: "snkTaskbar.titleUpdate",
17
- [taskbarElements.TaskbarElement.PREVIOUS]: "snkTaskbar.titlePrevious",
18
- [taskbarElements.TaskbarElement.NEXT]: "snkTaskbar.titleNext",
19
- [taskbarElements.TaskbarElement.REFRESH]: "snkTaskbar.titleRefresh",
20
- [taskbarElements.TaskbarElement.CLONE]: "snkTaskbar.titleClone",
21
- [taskbarElements.TaskbarElement.REMOVE]: "snkTaskbar.titleRemove",
22
- [taskbarElements.TaskbarElement.MORE_OPTIONS]: "snkTaskbar.titleMoreOptions",
23
- [taskbarElements.TaskbarElement.INSERT]: "snkTaskbar.titleInsert",
24
- [taskbarElements.TaskbarElement.CANCEL]: "snkTaskbar.titleCancel",
25
- [taskbarElements.TaskbarElement.SAVE]: "snkTaskbar.titleSave",
26
- [taskbarElements.TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
27
- [taskbarElements.TaskbarElement.CONFIG_GRID]: "snkTaskbar.titleConfigGrid",
28
- [taskbarElements.TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode"
29
- };
30
- }
31
- observeButtons() {
32
- this._definitions = undefined;
33
- }
34
- // Internal methods
35
- elementsFromString(strButtons) {
36
- const elements = [];
37
- if (strButtons) {
38
- strButtons.split(",").forEach(buttonName => {
39
- buttonName = buttonName.trim();
40
- if (taskbarElements.VisibleWhenForbidden[buttonName] || this.isAllowed(buttonName)) {
41
- elements.push(buttonName.trim());
42
- }
43
- });
44
- }
45
- return elements;
46
- }
47
- isAllowed(buttonName) {
48
- if (taskbarElements.AuthorizationElements[buttonName]) {
49
- return this._permissions ? this._permissions.isSup || this._permissions[buttonName] : false;
50
- }
51
- return true;
52
- }
53
- /**
54
- * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
55
- * através de um pequeno modulo na estrutura da aplicação:
56
- * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
57
- * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-taskbar.msg.ts"
58
- */
59
- getTitle(element) {
60
- let key;
61
- if (this.isAllowed(element)) {
62
- key = this._titleKeyByElement[element];
63
- }
64
- else {
65
- key = "snkTaskbar.forbidden";
66
- }
67
- return key ? this._application.messagesBuilder.getMessage(key, {}) : "";
68
- }
69
- elementClick(elem) {
70
- if (this.dataUnit) {
71
- switch (elem) {
72
- case taskbarElements.TaskbarElement.PREVIOUS:
73
- this.dataUnit.previousRecord();
74
- break;
75
- case taskbarElements.TaskbarElement.NEXT:
76
- this.dataUnit.nextRecord();
77
- break;
78
- case taskbarElements.TaskbarElement.REFRESH:
79
- this.dataUnit.loadData();
80
- break;
81
- case taskbarElements.TaskbarElement.CLONE:
82
- this.dataUnit.copySelected();
83
- break;
84
- case taskbarElements.TaskbarElement.REMOVE:
85
- this.dataUnit.removeSelectedRecords();
86
- break;
87
- case taskbarElements.TaskbarElement.INSERT:
88
- this.dataUnit.addRecord();
89
- break;
90
- case taskbarElements.TaskbarElement.CANCEL:
91
- this.dataUnit.cancelEdition();
92
- break;
93
- case taskbarElements.TaskbarElement.SAVE:
94
- this.dataUnit.saveData();
95
- break;
96
- }
97
- }
98
- this.actionClick.emit(elem);
99
- }
100
- isEnabled(elem) {
101
- if (!this.isAllowed(elem)) {
102
- return false;
103
- }
104
- return !(this.disabledButtons && this.disabledButtons.includes(elem));
105
- }
106
- getElement(index, def) {
107
- let className = def === this.primaryButton ? "ez-button--primary " : "";
108
- if (index > 1) {
109
- className += "ez-padding-left--medium";
110
- }
111
- if (taskbarElements.TaskbarElement[def.toString()]) {
112
- return taskbarElements.buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
113
- }
114
- else {
115
- return taskbarElements.buildCustomButton(def, className, elem => this.elementClick(elem), elem => this.isEnabled(elem));
116
- }
117
- }
118
- // Lifecycle
119
- componentWillLoad() {
120
- this._application = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
121
- if (this._application) {
122
- this._application.getAllAccess().then(access => this._permissions = access);
123
- }
124
- else {
125
- this._permissions = {};
126
- }
127
- }
128
- componentWillRender() {
129
- if (this._definitions == undefined && this._permissions) {
130
- this._definitions = this.elementsFromString(this.buttons);
131
- }
132
- }
133
- render() {
134
- if (this._definitions === undefined) {
135
- return undefined;
136
- }
137
- let index$1 = 0;
138
- return (index.h(index.Host, null, this._definitions.map((elem) => {
139
- if (elem === taskbarElements.TaskbarElement.DIVIDER) {
140
- index$1 = 0;
141
- }
142
- else {
143
- index$1++;
144
- }
145
- if (taskbarElements.TaskbarElement[elem]) {
146
- return this.getElement(index$1, taskbarElements.TaskbarElement[elem]);
147
- }
148
- if (this.customButtons.has(elem)) {
149
- return this.getElement(index$1, this.customButtons.get(elem));
150
- }
151
- return index.h("slot", { name: elem });
152
- })));
153
- }
154
- static get watchers() { return {
155
- "buttons": ["observeButtons"]
156
- }; }
157
- };
158
- SnkTaskbar.style = snkTaskbarCss;
159
-
160
- exports.snk_taskbar = SnkTaskbar;
@@ -1,47 +0,0 @@
1
- 'use strict';
2
-
3
- class TaskbarProcessor {
4
- constructor(defaultButtons) {
5
- this._defaultButtons = defaultButtons;
6
- }
7
- process(taskbarId, taskbarManager, dataState, disabledButtons = []) {
8
- var _a;
9
- this.customButtons = new Map();
10
- this.buttons = "";
11
- this.disabledButtons = [];
12
- (_a = this.getButtonsArray(taskbarId, taskbarManager, dataState)) === null || _a === void 0 ? void 0 : _a.forEach(btnDef => {
13
- let buttonName;
14
- if (typeof btnDef === "string") {
15
- buttonName = btnDef;
16
- }
17
- else {
18
- const customBtn = btnDef;
19
- this.customButtons.set(customBtn.name, customBtn);
20
- buttonName = customBtn.name;
21
- }
22
- if (!this.isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabledButtons)) {
23
- this.disabledButtons.push(buttonName);
24
- }
25
- if (this.buttons.length > 0) {
26
- this.buttons += ",";
27
- }
28
- this.buttons += buttonName;
29
- });
30
- }
31
- getButtonsArray(taskbarId, taskbarManager, dataState) {
32
- const defaults = this._defaultButtons[taskbarId];
33
- if (taskbarManager) {
34
- return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
35
- }
36
- return defaults;
37
- }
38
- isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
39
- const originalValue = disabled.includes(buttonName) ? false : true;
40
- if (taskbarManager && taskbarManager.isEnabled) {
41
- return taskbarManager.isEnabled(taskbarId, dataState, buttonName, originalValue);
42
- }
43
- return originalValue;
44
- }
45
- }
46
-
47
- exports.TaskbarProcessor = TaskbarProcessor;