@sankhyalabs/sankhyablocks 2.1.2 → 2.1.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 (129) hide show
  1. package/dist/cjs/AuthorizationConfig-79ffae4b.js +7 -0
  2. package/dist/cjs/{form-config-fetcher-2de7c16a.js → ConfigStorage-c112de1d.js} +101 -1
  3. package/dist/cjs/{SnkMessageBuilder-89482d28.js → SnkMessageBuilder-61f00e7f.js} +33 -5
  4. package/dist/cjs/{constants-9056ca9e.js → constants-a47a5190.js} +15 -0
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  7. package/dist/cjs/snk-application.cjs.entry.js +32 -65
  8. package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
  9. package/dist/cjs/{snk-field-config_2.cjs.entry.js → snk-configurator_3.cjs.entry.js} +134 -13
  10. package/dist/cjs/snk-crud.cjs.entry.js +23 -6
  11. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  12. package/dist/cjs/{snk-configurator_6.cjs.entry.js → snk-filter-bar_7.cjs.entry.js} +528 -198
  13. package/dist/cjs/snk-form-config.cjs.entry.js +30 -24
  14. package/dist/cjs/snk-form.cjs.entry.js +30 -17
  15. package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
  16. package/dist/cjs/{taskbar-elements-90350a55.js → taskbar-elements-a0b857c0.js} +5 -9
  17. package/dist/collection/collection-manifest.json +3 -2
  18. package/dist/collection/components/snk-application/snk-application.js +4 -3
  19. package/dist/collection/components/snk-configurator/AuthorizationConfig.js +5 -0
  20. package/dist/collection/components/snk-configurator/snk-configurator.css +124 -0
  21. package/dist/collection/components/snk-configurator/snk-configurator.js +126 -181
  22. package/dist/collection/components/snk-crud/snk-crud.js +23 -5
  23. package/dist/collection/components/snk-form/snk-form.js +37 -54
  24. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +47 -28
  25. package/dist/collection/components/snk-grid/snk-grid.js +69 -20
  26. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.css +166 -0
  27. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +605 -0
  28. package/dist/collection/components/snk-grid/subcomponents/snk-select-box/snk-select-box.css +9 -0
  29. package/dist/collection/components/snk-grid/subcomponents/snk-select-box/snk-select-box.js +70 -0
  30. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +5 -9
  31. package/dist/collection/components/snk-taskbar/snk-taskbar.js +39 -11
  32. package/dist/collection/lib/configs/ConfigStorage.js +15 -15
  33. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +1 -0
  34. package/dist/collection/lib/message/SnkMessageBuilder.js +5 -3
  35. package/dist/collection/lib/message/resources/snk-configurator.msg.js +0 -3
  36. package/dist/collection/lib/message/resources/snk-form.msg.js +3 -0
  37. package/dist/collection/lib/message/resources/snk-grid.msg.js +26 -0
  38. package/dist/collection/lib/utils/constants.js +14 -0
  39. package/dist/components/AuthorizationConfig.js +7 -0
  40. package/dist/components/{form-config-fetcher.js → ConfigStorage.js} +100 -2
  41. package/dist/components/SnkMessageBuilder.js +33 -5
  42. package/dist/components/constants.js +15 -1
  43. package/dist/components/index.d.ts +2 -1
  44. package/dist/components/index.js +2 -1
  45. package/dist/components/snk-application2.js +4 -37
  46. package/dist/components/snk-configurator2.js +63 -165
  47. package/dist/components/snk-crud.js +53 -29
  48. package/dist/components/snk-form-config2.js +25 -19
  49. package/dist/components/snk-form2.js +33 -32
  50. package/dist/components/{snk-config-modal.d.ts → snk-grid-config.d.ts} +4 -4
  51. package/dist/components/snk-grid-config.js +6 -0
  52. package/dist/components/snk-grid-config2.js +497 -0
  53. package/dist/components/snk-grid2.js +65 -27
  54. package/dist/components/snk-select-box.d.ts +11 -0
  55. package/dist/components/snk-select-box.js +6 -0
  56. package/dist/components/snk-select-box2.js +38 -0
  57. package/dist/components/snk-taskbar2.js +45 -33
  58. package/dist/esm/AuthorizationConfig-dcbd207a.js +7 -0
  59. package/dist/esm/{form-config-fetcher-96c6c2dc.js → ConfigStorage-99025655.js} +100 -2
  60. package/dist/esm/{SnkMessageBuilder-a27fc561.js → SnkMessageBuilder-f5ef87df.js} +33 -5
  61. package/dist/esm/{constants-c6039d3d.js → constants-babe1a08.js} +15 -1
  62. package/dist/esm/loader.js +1 -1
  63. package/dist/esm/sankhyablocks.js +1 -1
  64. package/dist/esm/snk-application.entry.js +5 -38
  65. package/dist/esm/snk-config-options.entry.js +1 -1
  66. package/dist/esm/{snk-field-config_2.entry.js → snk-configurator_3.entry.js} +134 -14
  67. package/dist/esm/snk-crud.entry.js +23 -6
  68. package/dist/esm/snk-data-unit.entry.js +1 -1
  69. package/dist/esm/{snk-configurator_6.entry.js → snk-filter-bar_7.entry.js} +529 -200
  70. package/dist/esm/snk-form-config.entry.js +25 -19
  71. package/dist/esm/snk-form.entry.js +30 -17
  72. package/dist/esm/snk-tab-config.entry.js +1 -1
  73. package/dist/esm/{taskbar-elements-0f41cd77.js → taskbar-elements-4d6584cd.js} +5 -9
  74. package/dist/sankhyablocks/p-105cd4a8.entry.js +1 -0
  75. package/dist/sankhyablocks/p-4131d41e.entry.js +1 -0
  76. package/dist/sankhyablocks/{p-8706fe65.entry.js → p-43aff8f5.entry.js} +1 -1
  77. package/dist/sankhyablocks/p-53f33e9d.entry.js +1 -0
  78. package/dist/sankhyablocks/p-639b8f6e.entry.js +76 -0
  79. package/dist/sankhyablocks/{p-a5b26df2.js → p-6673c77c.js} +1 -1
  80. package/dist/sankhyablocks/p-6ba8f415.js +26 -0
  81. package/dist/sankhyablocks/{p-2517529d.js → p-877bd6cf.js} +1 -1
  82. package/dist/sankhyablocks/p-87896198.entry.js +1 -0
  83. package/dist/sankhyablocks/p-bd6d4a83.js +1 -0
  84. package/dist/sankhyablocks/p-cae38f51.entry.js +1 -0
  85. package/dist/sankhyablocks/{p-f37cdeb5.entry.js → p-cd03ea9e.entry.js} +1 -1
  86. package/dist/sankhyablocks/p-dc36cfbf.js +1 -0
  87. package/dist/sankhyablocks/{p-92782503.entry.js → p-eb94df0b.entry.js} +1 -1
  88. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  89. package/dist/types/components/snk-application/snk-application.d.ts +0 -1
  90. package/dist/types/components/snk-configurator/AuthorizationConfig.d.ts +4 -0
  91. package/dist/types/components/snk-configurator/snk-configurator.d.ts +21 -24
  92. package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
  93. package/dist/types/components/snk-form/snk-form.d.ts +6 -9
  94. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +7 -3
  95. package/dist/types/components/snk-grid/snk-grid.d.ts +13 -3
  96. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +66 -0
  97. package/dist/types/components/snk-grid/subcomponents/snk-select-box/snk-select-box.d.ts +7 -0
  98. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +3 -4
  99. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +3 -1
  100. package/dist/types/components.d.ts +104 -74
  101. package/dist/types/lib/configs/ConfigStorage.d.ts +3 -3
  102. package/dist/types/lib/message/resources/snk-configurator.msg.d.ts +0 -1
  103. package/dist/types/lib/message/resources/snk-grid.msg.d.ts +2 -0
  104. package/dist/types/lib/utils/constants.d.ts +14 -0
  105. package/package.json +1 -1
  106. package/react/components.d.ts +2 -1
  107. package/react/components.js +2 -1
  108. package/react/components.js.map +1 -1
  109. package/dist/cjs/configurableElementsStorage-93459c72.js +0 -20
  110. package/dist/cjs/snk-config-modal.cjs.entry.js +0 -62
  111. package/dist/collection/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.js +0 -16
  112. package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.css +0 -122
  113. package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.js +0 -137
  114. package/dist/components/snk-config-modal.js +0 -6
  115. package/dist/components/snk-config-modal2.js +0 -91
  116. package/dist/esm/configurableElementsStorage-cdc144b5.js +0 -18
  117. package/dist/esm/snk-config-modal.entry.js +0 -58
  118. package/dist/sankhyablocks/p-361299e8.js +0 -26
  119. package/dist/sankhyablocks/p-599846fb.entry.js +0 -75
  120. package/dist/sankhyablocks/p-59d8c47a.js +0 -1
  121. package/dist/sankhyablocks/p-60eef7cd.entry.js +0 -1
  122. package/dist/sankhyablocks/p-626cf022.entry.js +0 -1
  123. package/dist/sankhyablocks/p-6511d132.entry.js +0 -1
  124. package/dist/sankhyablocks/p-cb8d71ba.entry.js +0 -1
  125. package/dist/sankhyablocks/p-ce7c38a1.entry.js +0 -1
  126. package/dist/sankhyablocks/p-d50651a3.js +0 -1
  127. package/dist/sankhyablocks/p-e8591491.entry.js +0 -1
  128. package/dist/types/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.d.ts +0 -8
  129. package/dist/types/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.d.ts +0 -38
@@ -1,12 +1,13 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { T as TaskbarProcessor } from './taskbar-processor.js';
3
- import { C as ConfigurableElementsStorage, d as defineCustomElement$8 } from './snk-config-modal2.js';
4
- import { d as defineCustomElement$7 } from './snk-configurator2.js';
5
- import { d as defineCustomElement$6 } from './snk-filter-bar2.js';
6
- import { d as defineCustomElement$5 } from './snk-filter-detail2.js';
7
- import { d as defineCustomElement$4 } from './snk-filter-item2.js';
8
- import { d as defineCustomElement$3 } from './snk-filter-list2.js';
9
- import { d as defineCustomElement$2 } from './snk-filter-modal2.js';
3
+ import { C as ConfigStorage } from './ConfigStorage.js';
4
+ import { d as defineCustomElement$8 } from './snk-filter-bar2.js';
5
+ import { d as defineCustomElement$7 } from './snk-filter-detail2.js';
6
+ import { d as defineCustomElement$6 } from './snk-filter-item2.js';
7
+ import { d as defineCustomElement$5 } from './snk-filter-list2.js';
8
+ import { d as defineCustomElement$4 } from './snk-filter-modal2.js';
9
+ import { d as defineCustomElement$3 } from './snk-grid-config2.js';
10
+ import { d as defineCustomElement$2 } from './snk-select-box2.js';
10
11
  import { d as defineCustomElement$1 } from './snk-taskbar2.js';
11
12
 
12
13
  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)}";
@@ -25,33 +26,67 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
25
26
  "snkGridHeaderTaskbar.unselected": ["REFRESH"],
26
27
  "snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
27
28
  });
29
+ this._popUpGridConfig = false;
28
30
  }
29
31
  /**
30
- * Método responsável em abrir ou fechar o modal de configurações da grade.
32
+ * Método responsável em abrir o modal de configurações da grade.
31
33
  */
32
- async setShowGridConfig(value) {
34
+ async showConfig() {
33
35
  if (this._grid == undefined) {
34
36
  return;
35
37
  }
36
- if (value === true) {
37
- this._grid.openGridConfig();
38
- }
39
- else {
40
- this._grid.closeGridConfig();
38
+ this.openGridConfig();
39
+ }
40
+ /**
41
+ * Método responsável em fechar o modal de configurações da grade.
42
+ */
43
+ async hideConfig() {
44
+ if (this._grid == undefined) {
45
+ return;
41
46
  }
47
+ this.closeGridConfig();
42
48
  }
43
49
  /**
44
50
  * Método responsável por setar as configurações da grade.
45
51
  */
46
52
  async setConfig(config) {
53
+ this.setGridConfig(config);
54
+ }
55
+ openGridConfig() {
56
+ this._grid.getColumnsState()
57
+ .then((gridColumns) => {
58
+ this._snkGridConfig.columns = gridColumns.filter(c => c.name);
59
+ this._snkGridConfig.selectedIndex = 0;
60
+ this._popUpGridConfig = true;
61
+ });
62
+ }
63
+ closeGridConfig() {
64
+ this._popUpGridConfig = false;
65
+ }
66
+ setGridConfig(config) {
47
67
  this._gridConfig = config;
48
68
  }
69
+ loadConfig() {
70
+ ConfigStorage.get()
71
+ .loadGridConfig(this.configName)
72
+ .then((config) => {
73
+ this.setGridConfig(config);
74
+ })
75
+ .catch((error) => {
76
+ console.warn(error);
77
+ });
78
+ }
79
+ saveConfig(config) {
80
+ this._snkGridConfig.saveConfig(config)
81
+ .then(() => {
82
+ this.changeConfig(config);
83
+ });
84
+ }
49
85
  changeConfig(config) {
86
+ this._grid.setColumnsState(config.columns);
87
+ this.closeGridConfig();
50
88
  this.configChanged.emit(config);
51
89
  }
52
- componentDidRender() {
53
- ConfigurableElementsStorage.setGrid(this.configName, this._element);
54
- }
55
90
  componentWillLoad() {
56
91
  let parent = this._element.parentElement;
57
92
  while (parent) {
@@ -70,6 +105,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
70
105
  }
71
106
  parent = parent.parentElement;
72
107
  }
108
+ this.loadConfig();
73
109
  }
74
110
  componentWillRender() {
75
111
  const headerTaskbarId = this._dataState && this._dataState.selectedRecords.length > 0 ? "snkGridHeaderTaskbar.selected" : "snkGridHeaderTaskbar.unselected";
@@ -80,7 +116,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
80
116
  if (!this._dataUnit) {
81
117
  return undefined;
82
118
  }
83
- 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", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), 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", key: "topTaskbar", configName: this.configName, 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.changeConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, 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" }))));
119
+ 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", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), 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", key: "topTaskbar", configName: this.configName, 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(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, 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" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, selectedIndex: 0, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigCancel: () => this.closeGridConfig() }))));
84
120
  }
85
121
  get _element() { return this; }
86
122
  static get style() { return snkGridCss; }
@@ -93,51 +129,53 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
93
129
  "_dataUnit": [32],
94
130
  "_dataState": [32],
95
131
  "_gridConfig": [32],
96
- "setShowGridConfig": [64],
132
+ "_popUpGridConfig": [32],
133
+ "showConfig": [64],
134
+ "hideConfig": [64],
97
135
  "setConfig": [64]
98
136
  }]);
99
137
  function defineCustomElement() {
100
138
  if (typeof customElements === "undefined") {
101
139
  return;
102
140
  }
103
- const components = ["snk-grid", "snk-config-modal", "snk-configurator", "snk-filter-bar", "snk-filter-detail", "snk-filter-item", "snk-filter-list", "snk-filter-modal", "snk-taskbar"];
141
+ const components = ["snk-grid", "snk-filter-bar", "snk-filter-detail", "snk-filter-item", "snk-filter-list", "snk-filter-modal", "snk-grid-config", "snk-select-box", "snk-taskbar"];
104
142
  components.forEach(tagName => { switch (tagName) {
105
143
  case "snk-grid":
106
144
  if (!customElements.get(tagName)) {
107
145
  customElements.define(tagName, SnkGrid);
108
146
  }
109
147
  break;
110
- case "snk-config-modal":
148
+ case "snk-filter-bar":
111
149
  if (!customElements.get(tagName)) {
112
150
  defineCustomElement$8();
113
151
  }
114
152
  break;
115
- case "snk-configurator":
153
+ case "snk-filter-detail":
116
154
  if (!customElements.get(tagName)) {
117
155
  defineCustomElement$7();
118
156
  }
119
157
  break;
120
- case "snk-filter-bar":
158
+ case "snk-filter-item":
121
159
  if (!customElements.get(tagName)) {
122
160
  defineCustomElement$6();
123
161
  }
124
162
  break;
125
- case "snk-filter-detail":
163
+ case "snk-filter-list":
126
164
  if (!customElements.get(tagName)) {
127
165
  defineCustomElement$5();
128
166
  }
129
167
  break;
130
- case "snk-filter-item":
168
+ case "snk-filter-modal":
131
169
  if (!customElements.get(tagName)) {
132
170
  defineCustomElement$4();
133
171
  }
134
172
  break;
135
- case "snk-filter-list":
173
+ case "snk-grid-config":
136
174
  if (!customElements.get(tagName)) {
137
175
  defineCustomElement$3();
138
176
  }
139
177
  break;
140
- case "snk-filter-modal":
178
+ case "snk-select-box":
141
179
  if (!customElements.get(tagName)) {
142
180
  defineCustomElement$2();
143
181
  }
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkSelectBox extends Components.SnkSelectBox, HTMLElement {}
4
+ export const SnkSelectBox: {
5
+ prototype: SnkSelectBox;
6
+ new (): SnkSelectBox;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { S as SelectBox, d as defineCustomElement$1 } from './snk-select-box2.js';
2
+
3
+ const SnkSelectBox = SelectBox;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SnkSelectBox, defineCustomElement };
@@ -0,0 +1,38 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { O as ORDER_VALUES } from './constants.js';
3
+
4
+ const snkSelectBoxCss = "ez-combo-box{width:100px}.grid-config-combo{--ez-text-input--height:28px;--ez-text-input__input--background-color:#fff;--ez-text-input__input--border-color:#dce0e8}";
5
+
6
+ const SelectBox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.__attachShadow();
11
+ this.ezChange = createEvent(this, "ezChange", 7);
12
+ this.selectedOption = ORDER_VALUES.none;
13
+ }
14
+ render() {
15
+ return (h("ez-combo-box", { class: "grid-config-combo ez-input--inverted", label: "", suppressSearch: true, value: this.selectedOption, enabled: true, canShowError: false, suppressEmptyOption: true }, Object.keys(ORDER_VALUES).map((key) => {
16
+ return h("option", { value: ORDER_VALUES[key].value }, ORDER_VALUES[key].label);
17
+ })));
18
+ }
19
+ static get assetsDirs() { return ["../assets"]; }
20
+ static get style() { return snkSelectBoxCss; }
21
+ }, [1, "snk-select-box", {
22
+ "selectedOption": [1, "selected-option"]
23
+ }]);
24
+ function defineCustomElement() {
25
+ if (typeof customElements === "undefined") {
26
+ return;
27
+ }
28
+ const components = ["snk-select-box"];
29
+ components.forEach(tagName => { switch (tagName) {
30
+ case "snk-select-box":
31
+ if (!customElements.get(tagName)) {
32
+ customElements.define(tagName, SelectBox);
33
+ }
34
+ break;
35
+ } });
36
+ }
37
+
38
+ export { SelectBox as S, defineCustomElement as d };
@@ -1,7 +1,6 @@
1
1
  import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
2
2
  import { ApplicationContext } from '@sankhyalabs/core';
3
- import { d as defineCustomElement$2 } from './snk-config-modal2.js';
4
- import { d as defineCustomElement$1 } from './snk-configurator2.js';
3
+ import { A as AuthorizationConfig } from './AuthorizationConfig.js';
5
4
 
6
5
  var TaskbarElement;
7
6
  (function (TaskbarElement) {
@@ -16,7 +15,6 @@ var TaskbarElement;
16
15
  TaskbarElement["SAVE"] = "SAVE";
17
16
  TaskbarElement["GRID_MODE"] = "GRID_MODE";
18
17
  TaskbarElement["FORM_MODE"] = "FORM_MODE";
19
- TaskbarElement["CONFIG_GRID"] = "CONFIG_GRID";
20
18
  TaskbarElement["MORE_OPTIONS"] = "MORE_OPTIONS";
21
19
  TaskbarElement["DIVIDER"] = "DIVIDER";
22
20
  TaskbarElement["CONFIGURATOR"] = "CONFIGURATOR";
@@ -27,11 +25,11 @@ var AuthorizationElements;
27
25
  AuthorizationElements["CLONE"] = "CLONE";
28
26
  AuthorizationElements["REMOVE"] = "REMOVE";
29
27
  AuthorizationElements["INSERT"] = "INSERT";
30
- AuthorizationElements["CONFIG_GRID"] = "CONFIG_GRID";
28
+ AuthorizationElements["CONFIGURATOR"] = "CONFIGURATOR";
31
29
  })(AuthorizationElements || (AuthorizationElements = {}));
32
30
  var VisibleWhenForbidden;
33
31
  (function (VisibleWhenForbidden) {
34
- VisibleWhenForbidden["CONFIG_GRID"] = "CONFIG_GRID";
32
+ VisibleWhenForbidden["CONFIGURATOR"] = "CONFIGURATOR";
35
33
  })(VisibleWhenForbidden || (VisibleWhenForbidden = {}));
36
34
  const buildCustomButton = (def, className, action, isEnabled) => {
37
35
  const { hint, text, iconName } = def;
@@ -47,7 +45,7 @@ const buildCustomButton = (def, className, action, isEnabled) => {
47
45
  return textButton(def.name, className, text, hint, action, isEnabled);
48
46
  }
49
47
  };
50
- const buildElem = (element, className, getTitle, action, isEnabled, actions, configName) => {
48
+ const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
51
49
  const title = getTitle(element);
52
50
  switch (element) {
53
51
  case TaskbarElement.PREVIOUS:
@@ -73,11 +71,11 @@ const buildElem = (element, className, getTitle, action, isEnabled, actions, con
73
71
  case TaskbarElement.FORM_MODE:
74
72
  return iconButton("list", element, className, title, action, isEnabled);
75
73
  case TaskbarElement.CONFIGURATOR:
76
- return configButton(element, className, getTitle, action, isEnabled, configName);
74
+ return iconButton("settings-inverted", element, className, title, action, isEnabled);
77
75
  case TaskbarElement.MORE_OPTIONS:
78
76
  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;
79
77
  case TaskbarElement.DIVIDER:
80
- return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium" });
78
+ return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium", "data-taskbar-divider": true });
81
79
  }
82
80
  };
83
81
  function textButton(name, className, text, title, action, isEnabled) {
@@ -90,9 +88,6 @@ function iconTextButton(iconName, name, className, text, title, action, isEnable
90
88
  return h("ez-button", { name: iconName, title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) },
91
89
  h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
92
90
  }
93
- function configButton(element, className, getTitle, action, isEnabled, configName) {
94
- return h("snk-configurator", { key: "configurator", configName: configName, title: getTitle(element), class: className, enabled: isEnabled(element), onChangeViewMode: (evt) => action(evt === null || evt === void 0 ? void 0 : evt.detail) });
95
- }
96
91
 
97
92
  const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
98
93
 
@@ -124,17 +119,24 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
124
119
  // Internal methods
125
120
  elementsFromString(strButtons) {
126
121
  const elements = [];
127
- if (strButtons) {
128
- strButtons.split(",").forEach(buttonName => {
129
- buttonName = buttonName.trim();
130
- if (VisibleWhenForbidden[buttonName] || this.isAllowed(buttonName)) {
131
- elements.push(buttonName.trim());
132
- }
133
- });
134
- }
122
+ if (strButtons == null)
123
+ return elements;
124
+ strButtons.split(",").forEach(buttonName => {
125
+ buttonName = buttonName.trim();
126
+ if (VisibleWhenForbidden[buttonName] || this.isAllowed(buttonName)) {
127
+ elements.push(buttonName.trim());
128
+ }
129
+ });
135
130
  return elements;
136
131
  }
137
132
  isAllowed(buttonName) {
133
+ if (buttonName === AuthorizationElements.CONFIGURATOR) {
134
+ return this._permissions
135
+ ? this._permissions.isSup
136
+ || this._permissions[AuthorizationConfig.CONFIG_GRID]
137
+ || this._permissions[AuthorizationConfig.CONFIG]
138
+ : false;
139
+ }
138
140
  if (AuthorizationElements[buttonName]) {
139
141
  return this._permissions ? this._permissions.isSup || this._permissions[buttonName] : false;
140
142
  }
@@ -199,7 +201,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
199
201
  className += "ez-padding-left--medium";
200
202
  }
201
203
  if (TaskbarElement[def.toString()]) {
202
- return buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList, this.configName);
204
+ return buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
203
205
  }
204
206
  else {
205
207
  return buildCustomButton(def, className, elem => this.elementClick(elem), elem => this.isEnabled(elem));
@@ -220,12 +222,32 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
220
222
  this._definitions = this.elementsFromString(this.buttons);
221
223
  }
222
224
  }
225
+ isDivider(element) {
226
+ var _a;
227
+ if (element === undefined) {
228
+ return false;
229
+ }
230
+ return (_a = element.$attrs$) === null || _a === void 0 ? void 0 : _a["data-taskbar-divider"];
231
+ }
232
+ removeEmpty(elements) {
233
+ let lastElem;
234
+ return elements.filter(elem => {
235
+ if (elem == undefined) {
236
+ return false;
237
+ }
238
+ if (this.isDivider(lastElem) && this.isDivider(elem)) {
239
+ return false;
240
+ }
241
+ lastElem = elem;
242
+ return true;
243
+ });
244
+ }
223
245
  render() {
224
246
  if (this._definitions === undefined) {
225
247
  return undefined;
226
248
  }
227
249
  let index = 0;
228
- return (h(Host, null, this._definitions.map((elem) => {
250
+ return (h(Host, null, this.removeEmpty(this._definitions.map((elem) => {
229
251
  if (elem === TaskbarElement.DIVIDER) {
230
252
  index = 0;
231
253
  }
@@ -239,7 +261,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
239
261
  return this.getElement(index, this.customButtons.get(elem));
240
262
  }
241
263
  return h("slot", { name: elem });
242
- })));
264
+ }))));
243
265
  }
244
266
  static get watchers() { return {
245
267
  "buttons": ["observeButtons"]
@@ -259,23 +281,13 @@ function defineCustomElement() {
259
281
  if (typeof customElements === "undefined") {
260
282
  return;
261
283
  }
262
- const components = ["snk-taskbar", "snk-config-modal", "snk-configurator"];
284
+ const components = ["snk-taskbar"];
263
285
  components.forEach(tagName => { switch (tagName) {
264
286
  case "snk-taskbar":
265
287
  if (!customElements.get(tagName)) {
266
288
  customElements.define(tagName, SnkTaskbar);
267
289
  }
268
290
  break;
269
- case "snk-config-modal":
270
- if (!customElements.get(tagName)) {
271
- defineCustomElement$2();
272
- }
273
- break;
274
- case "snk-configurator":
275
- if (!customElements.get(tagName)) {
276
- defineCustomElement$1();
277
- }
278
- break;
279
291
  } });
280
292
  }
281
293
 
@@ -0,0 +1,7 @@
1
+ var AuthorizationConfig;
2
+ (function (AuthorizationConfig) {
3
+ AuthorizationConfig["CONFIG_GRID"] = "CONFIG_GRID";
4
+ AuthorizationConfig["CONFIG"] = "CONFIG";
5
+ })(AuthorizationConfig || (AuthorizationConfig = {}));
6
+
7
+ export { AuthorizationConfig as A };
@@ -1,5 +1,5 @@
1
+ import { ErrorException, WarningException, StringUtils, ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
1
2
  import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-9943807e.js';
2
- import { ErrorException, WarningException, StringUtils, ObjectUtils } from '@sankhyalabs/core';
3
3
 
4
4
  var browserPonyfill = createCommonjsModule(function (module, exports) {
5
5
  var global = typeof self !== 'undefined' ? self : commonjsGlobal;
@@ -6886,4 +6886,102 @@ var UserConfigType;
6886
6886
  UserConfigType["SHARED"] = "SHARED";
6887
6887
  })(UserConfigType || (UserConfigType = {}));
6888
6888
 
6889
- export { DataFetcher as D, FormConfigFetcher as F, ResourceFetcher as R, UrlUtils as U, UserConfigType as a, dist as d };
6889
+ class GridConfigFetcher extends ResourceFetcher {
6890
+ constructor() {
6891
+ super(...arguments);
6892
+ this.GRID_CONFIG_VERSION = "V3:";
6893
+ }
6894
+ getConfig(_gridName, resourceID) {
6895
+ const completePath = `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}`;
6896
+ return new Promise((resolve, reject) => {
6897
+ this.loadResource(completePath)
6898
+ .then(loadedResource => {
6899
+ let config = undefined;
6900
+ if (loadedResource) {
6901
+ config = JSON.parse(loadedResource);
6902
+ }
6903
+ resolve(config);
6904
+ }).catch((error) => {
6905
+ reject(error);
6906
+ });
6907
+ });
6908
+ }
6909
+ saveConfig(config, resourceID) {
6910
+ const completePath = `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}`;
6911
+ return new Promise((resolve, reject) => {
6912
+ this.saveResource(config, completePath)
6913
+ .then((resp) => {
6914
+ resolve(resp);
6915
+ })
6916
+ .catch((error) => {
6917
+ reject(error);
6918
+ });
6919
+ });
6920
+ }
6921
+ }
6922
+
6923
+ const CONFIG_SOURCE = {
6924
+ form: "form",
6925
+ grid: "grid"
6926
+ };
6927
+ class ConfigStorage {
6928
+ static get() {
6929
+ if (!ConfigStorage.instance) {
6930
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
6931
+ if (application != undefined) {
6932
+ ConfigStorage.instance = new ConfigStorage();
6933
+ application.getResourceID().then((resourceID) => {
6934
+ const configName = application.configName;
6935
+ ConfigStorage.resourceID = resourceID;
6936
+ ConfigStorage.instance.loadFormConfig(configName);
6937
+ ConfigStorage.instance.loadGridConfig(configName);
6938
+ });
6939
+ }
6940
+ }
6941
+ return this.instance;
6942
+ }
6943
+ async loadFormConfig(name) {
6944
+ if (name == undefined) {
6945
+ return;
6946
+ }
6947
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
6948
+ if (!ConfigStorage.configById.has(cacheID)) {
6949
+ ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, ConfigStorage.resourceID));
6950
+ }
6951
+ return ConfigStorage.configById.get(cacheID);
6952
+ }
6953
+ async loadGridConfig(name) {
6954
+ if (name == undefined) {
6955
+ return;
6956
+ }
6957
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
6958
+ if (!ConfigStorage.configById.has(cacheID)) {
6959
+ ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, ConfigStorage.resourceID));
6960
+ }
6961
+ return ConfigStorage.configById.get(cacheID);
6962
+ }
6963
+ static async saveFormConfig(config, name) {
6964
+ if (config == undefined || name == undefined) {
6965
+ return;
6966
+ }
6967
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
6968
+ this.configById.delete(cacheID);
6969
+ return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
6970
+ }
6971
+ static async saveGridConfig(config, name) {
6972
+ if (config == undefined || name == undefined) {
6973
+ return;
6974
+ }
6975
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
6976
+ this.configById.delete(cacheID);
6977
+ return this.gridConfigFetcher.saveConfig(config, this.resourceID);
6978
+ }
6979
+ static buildCacheID(name, source) {
6980
+ return `req_${source}_${name}_${this.resourceID}`;
6981
+ }
6982
+ }
6983
+ ConfigStorage.configById = new Map();
6984
+ ConfigStorage.formConfigFetcher = new FormConfigFetcher();
6985
+ ConfigStorage.gridConfigFetcher = new GridConfigFetcher();
6986
+
6987
+ export { ConfigStorage as C, DataFetcher as D, FormConfigFetcher as F, GridConfigFetcher as G, ResourceFetcher as R, UrlUtils as U, UserConfigType as a, dist as d };
@@ -130,6 +130,9 @@ const snkFormConfigMessages = {
130
130
  titleGroupExists: "Já existe um grupo com título",
131
131
  infoValidTitle: "Por favor, digite um título válido.",
132
132
  inTab: "na aba"
133
+ },
134
+ info: {
135
+ successfullyConfigSaved: "As configurações foram salvas com sucesso!"
133
136
  }
134
137
  };
135
138
  const snkFieldConfigMessages = {
@@ -145,9 +148,6 @@ const snkTabConfigMessages = {
145
148
  };
146
149
 
147
150
  const snkConfiguratorMessages = {
148
- msgSaveSuccessfully: "As configurações foram salvas com sucesso!"
149
- };
150
- const snkConfigModalMessages = {
151
151
  titleConfigurations: "Configurações",
152
152
  subTitleModeConfig: "Modo de visualização",
153
153
  labelConfigGrid: "Configurar grade",
@@ -156,6 +156,33 @@ const snkConfigModalMessages = {
156
156
  labelForm: "Formulário"
157
157
  };
158
158
 
159
+ const snkGridMessages = {};
160
+ const snkGridConfigMessages = {
161
+ gridConfiguration: "Configuração da Grade",
162
+ columnVisibilityOrder: "Defina visibilidade e ordem das colunas.",
163
+ sortingSequence: "Sequência da ordenação",
164
+ findColumn: "Localizar coluna",
165
+ cancel: "Cancelar",
166
+ complete: "Concluir",
167
+ tab: {
168
+ columns: "Colunas",
169
+ lineOrdering: "Ordenação das linhas",
170
+ },
171
+ info: {
172
+ successfullyConfigSaved: "As configurações foram salvas com sucesso!"
173
+ },
174
+ confirm: {
175
+ cancel: "Descartar",
176
+ save: "Salvar",
177
+ alert: "Aviso",
178
+ msgCancel: "As alterações realizadas serão descartadas. Gostaria de salvar antes de sair?"
179
+ },
180
+ group: {
181
+ visible: "Visíveis",
182
+ hidden: "Ocultas"
183
+ }
184
+ };
185
+
159
186
  class SnkMessageBuilder {
160
187
  constructor() {
161
188
  this._defaults = {
@@ -164,12 +191,13 @@ class SnkMessageBuilder {
164
191
  snkFormConfig: snkFormConfigMessages,
165
192
  snkConfigOptions: snkConfigOptionsMessages,
166
193
  snkTaskbar: snkTaskbarMessages,
167
- snkConfigModal: snkConfigModalMessages,
168
194
  snkFieldConfig: snkFieldConfigMessages,
169
195
  snkFilterBar: snkFilterBarMessages,
170
196
  snkConfigurator: snkConfiguratorMessages,
171
197
  snkTabConfig: snkTabConfigMessages,
172
- crudUtils: crudUtilsMessages
198
+ crudUtils: crudUtilsMessages,
199
+ snkGrid: snkGridMessages,
200
+ snkGridConfig: snkGridConfigMessages
173
201
  };
174
202
  this._currentOperation = OperationMap.CLEAN;
175
203
  this.loadAppMessages().then((msgs) => {
@@ -70,5 +70,19 @@ const TAGS_BY_TYPE = {
70
70
  INTEGERNUMBER: "ez-number-input",
71
71
  DECIMALNUMBER: "ez-number-input"
72
72
  };
73
+ const ORDER_VALUES = {
74
+ none: {
75
+ value: "NA",
76
+ label: "N/A",
77
+ },
78
+ asc: {
79
+ value: "ASC",
80
+ label: "A-Z"
81
+ },
82
+ desc: {
83
+ value: "DESC",
84
+ label: "Z-A"
85
+ }
86
+ };
73
87
 
74
- export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_EVENTS as K, TAB_NAMES as T, VARS_BY_TYPE as V, TAGS_BY_TYPE as a, TYPE_ACTIONS as b, VIEW_MODE as c };
88
+ export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_EVENTS as K, ORDER_VALUES as O, TAB_NAMES as T, VARS_BY_TYPE as V, TAGS_BY_TYPE as a, TYPE_ACTIONS as b, VIEW_MODE as c };