@sankhyalabs/sankhyablocks 10.1.0-dev.35 → 10.1.0-dev.37

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 (102) hide show
  1. package/dist/cjs/{ConfigStorage-d9d24844.js → ConfigStorage-e384fb7b.js} +18 -1
  2. package/dist/cjs/{SnkFormConfigManager-c88cf1e9.js → SnkFormConfigManager-73df0f8b.js} +2 -2
  3. package/dist/cjs/{SnkMultiSelectionListDataSource-f53b60c4.js → SnkMultiSelectionListDataSource-016393f3.js} +1 -1
  4. package/dist/cjs/{auth-fetcher-faa61f64.js → auth-fetcher-80e608b0.js} +1 -1
  5. package/dist/cjs/fields-layout.cjs.entry.js +1 -1
  6. package/dist/cjs/fields-selector.cjs.entry.js +1 -1
  7. package/dist/cjs/{form-config-fetcher-72cf0e3d.js → form-config-fetcher-81cbd405.js} +18 -0
  8. package/dist/cjs/guides-configurator.cjs.entry.js +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +1 -1
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/snk-actions-button_8.cjs.entry.js +79 -34
  13. package/dist/cjs/snk-application.cjs.entry.js +3 -3
  14. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  15. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  16. package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
  17. package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
  18. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +2 -2
  19. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -2
  20. package/dist/cjs/snk-form_2.cjs.entry.js +3 -3
  21. package/dist/cjs/snk-grid.cjs.entry.js +5 -4
  22. package/dist/cjs/{snk-guides-viewer-c1040c2e.js → snk-guides-viewer-688c4398.js} +2 -2
  23. package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
  24. package/dist/cjs/snk-layout-form-config.cjs.entry.js +1 -1
  25. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -2
  26. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  27. package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -4
  28. package/dist/cjs/{sortable.esm-9a110bb7.js → sortable.esm-b87669ab.js} +76 -90
  29. package/dist/collection/components/snk-grid/snk-grid.js +2 -1
  30. package/dist/collection/components/snk-grid-config/snk-grid-config.js +98 -32
  31. package/dist/collection/lib/configs/ConfigStorage.js +5 -0
  32. package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +12 -0
  33. package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +18 -0
  34. package/dist/components/ConfigStorage.js +17 -0
  35. package/dist/components/form-config-fetcher.js +18 -0
  36. package/dist/components/snk-grid-config2.js +79 -32
  37. package/dist/components/snk-grid2.js +2 -1
  38. package/dist/components/sortable.esm.js +76 -90
  39. package/dist/esm/{ConfigStorage-d15d2014.js → ConfigStorage-82ff76fb.js} +18 -1
  40. package/dist/esm/{SnkFormConfigManager-86befa68.js → SnkFormConfigManager-e8ae1561.js} +2 -2
  41. package/dist/esm/{SnkMultiSelectionListDataSource-6e9496f0.js → SnkMultiSelectionListDataSource-ec783ded.js} +1 -1
  42. package/dist/esm/{auth-fetcher-69cbda8d.js → auth-fetcher-38a83f5e.js} +1 -1
  43. package/dist/esm/fields-layout.entry.js +1 -1
  44. package/dist/esm/fields-selector.entry.js +1 -1
  45. package/dist/esm/{form-config-fetcher-fcc7b62f.js → form-config-fetcher-24eb587c.js} +18 -0
  46. package/dist/esm/guides-configurator.entry.js +1 -1
  47. package/dist/esm/loader.js +1 -1
  48. package/dist/esm/pesquisa-grid_2.entry.js +1 -1
  49. package/dist/esm/sankhyablocks.js +1 -1
  50. package/dist/esm/snk-actions-button_8.entry.js +80 -35
  51. package/dist/esm/snk-application.entry.js +3 -3
  52. package/dist/esm/snk-attach.entry.js +2 -2
  53. package/dist/esm/snk-crud.entry.js +2 -2
  54. package/dist/esm/snk-data-exporter.entry.js +1 -1
  55. package/dist/esm/snk-detail-view.entry.js +4 -4
  56. package/dist/esm/snk-filter-bar_4.entry.js +2 -2
  57. package/dist/esm/snk-filter-modal-item.entry.js +2 -2
  58. package/dist/esm/snk-form_2.entry.js +3 -3
  59. package/dist/esm/snk-grid.entry.js +5 -4
  60. package/dist/esm/{snk-guides-viewer-f1e9d964.js → snk-guides-viewer-6ddc7e6a.js} +2 -2
  61. package/dist/esm/snk-guides-viewer.entry.js +4 -4
  62. package/dist/esm/snk-layout-form-config.entry.js +1 -1
  63. package/dist/esm/snk-personalized-filter.entry.js +2 -2
  64. package/dist/esm/snk-pesquisa.entry.js +1 -1
  65. package/dist/esm/snk-simple-crud.entry.js +4 -4
  66. package/dist/esm/{sortable.esm-842f85a3.js → sortable.esm-bc277c12.js} +76 -90
  67. package/dist/sankhyablocks/{p-73b455e1.entry.js → p-07aa8192.entry.js} +1 -1
  68. package/dist/sankhyablocks/{p-c860552e.entry.js → p-08415ef7.entry.js} +1 -1
  69. package/dist/sankhyablocks/{p-f2472d12.entry.js → p-27aea149.entry.js} +1 -1
  70. package/dist/sankhyablocks/p-2d606189.js +28 -0
  71. package/dist/sankhyablocks/{p-ebce5394.entry.js → p-3a98c337.entry.js} +1 -1
  72. package/dist/sankhyablocks/{p-0bd505e4.entry.js → p-449e36d2.entry.js} +1 -1
  73. package/dist/sankhyablocks/{p-4a8d0917.entry.js → p-54f5c36d.entry.js} +1 -1
  74. package/dist/sankhyablocks/{p-88b0797e.entry.js → p-605a2a99.entry.js} +1 -1
  75. package/dist/sankhyablocks/p-615655bd.entry.js +1 -0
  76. package/dist/sankhyablocks/{p-07619e85.entry.js → p-62e17eea.entry.js} +1 -1
  77. package/dist/sankhyablocks/{p-e0a6818c.js → p-6753f16e.js} +1 -1
  78. package/dist/sankhyablocks/{p-4cdfa0e4.entry.js → p-6e1a7929.entry.js} +1 -1
  79. package/dist/sankhyablocks/{p-e30acdca.entry.js → p-855ccf64.entry.js} +1 -1
  80. package/dist/sankhyablocks/{p-7150eacf.entry.js → p-9742ea0e.entry.js} +1 -1
  81. package/dist/sankhyablocks/{p-0c8419ec.entry.js → p-9e7dc97d.entry.js} +1 -1
  82. package/dist/sankhyablocks/{p-f1bf7248.entry.js → p-a8c5ebf1.entry.js} +1 -1
  83. package/dist/sankhyablocks/{p-bd1c1b49.entry.js → p-b6d47f08.entry.js} +1 -1
  84. package/dist/sankhyablocks/{p-f02b7963.js → p-b8453e18.js} +1 -1
  85. package/dist/sankhyablocks/p-cbb8e351.js +7 -0
  86. package/dist/sankhyablocks/{p-9114e869.js → p-e057ecb6.js} +2 -2
  87. package/dist/sankhyablocks/{p-48c580b9.entry.js → p-e484913b.entry.js} +1 -1
  88. package/dist/sankhyablocks/{p-7e9f8fa4.js → p-ef8cf0e2.js} +1 -1
  89. package/dist/sankhyablocks/{p-4abf2838.entry.js → p-f0c9969e.entry.js} +1 -1
  90. package/dist/sankhyablocks/{p-17653b22.entry.js → p-f208ec52.entry.js} +1 -1
  91. package/dist/sankhyablocks/{p-0d15b109.entry.js → p-f5b929c2.entry.js} +1 -1
  92. package/dist/sankhyablocks/{p-45a830d9.js → p-fc5938fb.js} +1 -1
  93. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  94. package/dist/types/components/snk-grid-config/snk-grid-config.d.ts +7 -0
  95. package/dist/types/components.d.ts +8 -0
  96. package/dist/types/lib/configs/ConfigStorage.d.ts +1 -0
  97. package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +1 -0
  98. package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
  99. package/package.json +1 -1
  100. package/dist/sankhyablocks/p-4fe8380b.entry.js +0 -1
  101. package/dist/sankhyablocks/p-51833248.js +0 -7
  102. package/dist/sankhyablocks/p-a9839628.js +0 -26
@@ -1,111 +1,94 @@
1
1
  'use strict';
2
2
 
3
3
  /**!
4
- * Sortable 1.15.6
4
+ * Sortable 1.15.7
5
5
  * @author RubaXa <trash@rubaxa.org>
6
6
  * @author owenm <owen23355@gmail.com>
7
7
  * @license MIT
8
8
  */
9
- function ownKeys(object, enumerableOnly) {
10
- var keys = Object.keys(object);
11
- if (Object.getOwnPropertySymbols) {
12
- var symbols = Object.getOwnPropertySymbols(object);
13
- if (enumerableOnly) {
14
- symbols = symbols.filter(function (sym) {
15
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
16
- });
17
- }
18
- keys.push.apply(keys, symbols);
19
- }
20
- return keys;
9
+ function _defineProperty(e, r, t) {
10
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
11
+ value: t,
12
+ enumerable: !0,
13
+ configurable: !0,
14
+ writable: !0
15
+ }) : e[r] = t, e;
21
16
  }
22
- function _objectSpread2(target) {
23
- for (var i = 1; i < arguments.length; i++) {
24
- var source = arguments[i] != null ? arguments[i] : {};
25
- if (i % 2) {
26
- ownKeys(Object(source), true).forEach(function (key) {
27
- _defineProperty(target, key, source[key]);
28
- });
29
- } else if (Object.getOwnPropertyDescriptors) {
30
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
31
- } else {
32
- ownKeys(Object(source)).forEach(function (key) {
33
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
34
- });
17
+ function _extends() {
18
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
19
+ for (var e = 1; e < arguments.length; e++) {
20
+ var t = arguments[e];
21
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
35
22
  }
36
- }
37
- return target;
23
+ return n;
24
+ }, _extends.apply(null, arguments);
38
25
  }
39
- function _typeof(obj) {
40
- "@babel/helpers - typeof";
41
-
42
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
43
- _typeof = function (obj) {
44
- return typeof obj;
45
- };
46
- } else {
47
- _typeof = function (obj) {
48
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
49
- };
26
+ function ownKeys(e, r) {
27
+ var t = Object.keys(e);
28
+ if (Object.getOwnPropertySymbols) {
29
+ var o = Object.getOwnPropertySymbols(e);
30
+ r && (o = o.filter(function (r) {
31
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
32
+ })), t.push.apply(t, o);
50
33
  }
51
- return _typeof(obj);
34
+ return t;
52
35
  }
53
- function _defineProperty(obj, key, value) {
54
- if (key in obj) {
55
- Object.defineProperty(obj, key, {
56
- value: value,
57
- enumerable: true,
58
- configurable: true,
59
- writable: true
36
+ function _objectSpread2(e) {
37
+ for (var r = 1; r < arguments.length; r++) {
38
+ var t = null != arguments[r] ? arguments[r] : {};
39
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
40
+ _defineProperty(e, r, t[r]);
41
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
42
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
60
43
  });
61
- } else {
62
- obj[key] = value;
63
44
  }
64
- return obj;
45
+ return e;
65
46
  }
66
- function _extends() {
67
- _extends = Object.assign || function (target) {
68
- for (var i = 1; i < arguments.length; i++) {
69
- var source = arguments[i];
70
- for (var key in source) {
71
- if (Object.prototype.hasOwnProperty.call(source, key)) {
72
- target[key] = source[key];
73
- }
74
- }
75
- }
76
- return target;
77
- };
78
- return _extends.apply(this, arguments);
47
+ function _objectWithoutProperties(e, t) {
48
+ if (null == e) return {};
49
+ var o,
50
+ r,
51
+ i = _objectWithoutPropertiesLoose(e, t);
52
+ if (Object.getOwnPropertySymbols) {
53
+ var n = Object.getOwnPropertySymbols(e);
54
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
55
+ }
56
+ return i;
79
57
  }
80
- function _objectWithoutPropertiesLoose(source, excluded) {
81
- if (source == null) return {};
82
- var target = {};
83
- var sourceKeys = Object.keys(source);
84
- var key, i;
85
- for (i = 0; i < sourceKeys.length; i++) {
86
- key = sourceKeys[i];
87
- if (excluded.indexOf(key) >= 0) continue;
88
- target[key] = source[key];
58
+ function _objectWithoutPropertiesLoose(r, e) {
59
+ if (null == r) return {};
60
+ var t = {};
61
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
62
+ if (-1 !== e.indexOf(n)) continue;
63
+ t[n] = r[n];
89
64
  }
90
- return target;
65
+ return t;
91
66
  }
92
- function _objectWithoutProperties(source, excluded) {
93
- if (source == null) return {};
94
- var target = _objectWithoutPropertiesLoose(source, excluded);
95
- var key, i;
96
- if (Object.getOwnPropertySymbols) {
97
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
98
- for (i = 0; i < sourceSymbolKeys.length; i++) {
99
- key = sourceSymbolKeys[i];
100
- if (excluded.indexOf(key) >= 0) continue;
101
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
102
- target[key] = source[key];
103
- }
67
+ function _toPrimitive(t, r) {
68
+ if ("object" != typeof t || !t) return t;
69
+ var e = t[Symbol.toPrimitive];
70
+ if (void 0 !== e) {
71
+ var i = e.call(t, r || "default");
72
+ if ("object" != typeof i) return i;
73
+ throw new TypeError("@@toPrimitive must return a primitive value.");
104
74
  }
105
- return target;
75
+ return ("string" === r ? String : Number)(t);
76
+ }
77
+ function _toPropertyKey(t) {
78
+ var i = _toPrimitive(t, "string");
79
+ return "symbol" == typeof i ? i : i + "";
106
80
  }
81
+ function _typeof(o) {
82
+ "@babel/helpers - typeof";
107
83
 
108
- var version = "1.15.6";
84
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
85
+ return typeof o;
86
+ } : function (o) {
87
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
88
+ }, _typeof(o);
89
+ }
90
+
91
+ var version = "1.15.7";
109
92
 
110
93
  function userAgent(pattern) {
111
94
  if (typeof window !== 'undefined' && window.navigator) {
@@ -148,7 +131,7 @@ function matches( /**HTMLElement*/el, /**String*/selector) {
148
131
  return false;
149
132
  }
150
133
  function getParentOrHost(el) {
151
- return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
134
+ return el.host && el !== document && el.host.nodeType && el.host !== el ? el.host : el.parentNode;
152
135
  }
153
136
  function closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
154
137
  if (el) {
@@ -2018,8 +2001,11 @@ Sortable.prototype = /** @lends Sortable.prototype */{
2018
2001
  _nulling: function _nulling() {
2019
2002
  pluginEvent('nulling', this);
2020
2003
  rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
2021
- savedInputChecked.forEach(function (el) {
2022
- el.checked = true;
2004
+ var el = this.el;
2005
+ savedInputChecked.forEach(function (checkEl) {
2006
+ if (el.contains(checkEl)) {
2007
+ checkEl.checked = true;
2008
+ }
2023
2009
  });
2024
2010
  savedInputChecked.length = lastDx = lastDy = 0;
2025
2011
  },
@@ -597,13 +597,14 @@ export class SnkGrid {
597
597
  return this.enableGridInsert && this._dataUnit.hasNewRecord();
598
598
  }
599
599
  render() {
600
+ var _a;
600
601
  if (!this._dataUnit) {
601
602
  return undefined;
602
603
  }
603
604
  return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large ez-box--no-outline", tabindex: "0" }, h("div", { class: "snk-grid__header" }, this._showSnkFilterBar &&
604
605
  h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, filterCustomConfig: this.filterCustomConfig, filterCustomConfigInterceptor: this.filterCustomConfigInterceptor, mode: this._filterMode }), 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 ez-padding-top--extra-small", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none', actionsSettingsList: this.getActionsSettingsList() }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? 'snk-grid-container__without-shadow ' : '') + 'snk-grid__table', "data-element-id": "embedded", dataUnit: this._dataUnit, key: 'grid-' + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => {
605
606
  this.gridConfigChangeHandler(evt);
606
- }, onEzColumnFilterChanged: async () => await this.dataExporterProviderStore(), onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode, useSearchColumn: this.useSearchColumn, suppressHorizontalScroll: this.suppressHorizontalScroll, paginationCounterMode: this.paginationCounterMode, suppressCheckboxColumn: this.suppressCheckboxColumn, suppressFilterColumn: this.suppressFilterColumn, compact: this.compact }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId, additionalSlotId: this.gridHeaderDynamicSearchSlotId, actionsSettingsList: this.getActionsSettingsList() }, h("slot", { name: this.gridHeaderCustomSlotId }), h("slot", { name: this.gridHeaderDynamicSearchSlotId }))), h("div", { class: "ez-col ez-col--sd-12 snk-grid-container__footer" }, h("slot", { name: "SnkGridFooter" })), h("ez-popup", { size: "medium", heightMode: "auto", useHeader: false, opened: this._popUpGridConfig, onEzClosePopup: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
607
+ }, onEzColumnFilterChanged: async () => await this.dataExporterProviderStore(), onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode, useSearchColumn: this.useSearchColumn, suppressHorizontalScroll: this.suppressHorizontalScroll, paginationCounterMode: this.paginationCounterMode, suppressCheckboxColumn: this.suppressCheckboxColumn, suppressFilterColumn: this.suppressFilterColumn, compact: this.compact }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId, additionalSlotId: this.gridHeaderDynamicSearchSlotId, actionsSettingsList: this.getActionsSettingsList() }, h("slot", { name: this.gridHeaderCustomSlotId }), h("slot", { name: this.gridHeaderDynamicSearchSlotId }))), h("div", { class: "ez-col ez-col--sd-12 snk-grid-container__footer" }, h("slot", { name: "SnkGridFooter" })), h("ez-popup", { size: "medium", heightMode: "auto", useHeader: false, opened: this._popUpGridConfig, onEzClosePopup: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID, metadata: (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.metadata }))));
607
608
  }
608
609
  static get is() { return "snk-grid"; }
609
610
  static get encapsulation() { return "scoped"; }
@@ -1,8 +1,9 @@
1
- import { ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
1
+ import { ApplicationContext, ElementIDUtils, StringUtils, UserInterface } from '@sankhyalabs/core';
2
2
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
3
3
  import { h, Host } from '@stencil/core';
4
4
  import { ConfigStorage } from '../../lib/configs/ConfigStorage';
5
5
  import { ORDER_VALUES } from '../../lib/utils/constants';
6
+ import { GRID_COLUMN_DEFAULT_WIDTHS } from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
6
7
  export class SnkGridConfig {
7
8
  constructor() {
8
9
  this._orderListItems = [];
@@ -18,6 +19,7 @@ export class SnkGridConfig {
18
19
  this.config = undefined;
19
20
  this.configName = undefined;
20
21
  this.resourceID = undefined;
22
+ this.metadata = undefined;
21
23
  this._collapsibleBoxListOrder = true;
22
24
  this._collapsibleBoxListSelect = false;
23
25
  }
@@ -49,31 +51,49 @@ export class SnkGridConfig {
49
51
  return newList;
50
52
  }
51
53
  createOrderList() {
54
+ var _a;
52
55
  let newSortableList = this.getSortableColumns();
53
- newSortableList.sort((a, b) => {
54
- //OS dois tem order index 0 e pelo menos um deles tem orientação de ordenação.
55
- if (a.orderIndex == 0 && b.orderIndex == 0 && (a.ascending != undefined || b.ascending != undefined)) {
56
- if (a.ascending != undefined)
57
- return -1;
58
- if (b.ascending != undefined)
59
- return 1;
60
- return 0;
61
- //Pelo menos um deles tem order index diferente de 0 e os dois tem orientação de ordenação.
62
- }
63
- else if (a.ascending != undefined && b.ascending != undefined) {
56
+ if (((_a = this._orderPriorityList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
57
+ const orderedList = [];
58
+ this._orderPriorityList.forEach((priorityItem) => {
59
+ const item = newSortableList.find(col => col.label === priorityItem.label);
60
+ if (item) {
61
+ orderedList.push(item);
62
+ }
63
+ });
64
+ newSortableList.forEach(item => {
65
+ if (!orderedList.find(o => o.label === item.label)) {
66
+ orderedList.push(item);
67
+ }
68
+ });
69
+ this._orderListItems = orderedList;
70
+ }
71
+ else {
72
+ newSortableList.sort((a, b) => {
73
+ //OS dois tem order index 0 e pelo menos um deles tem orientação de ordenação.
74
+ if (a.orderIndex == 0 && b.orderIndex == 0 && (a.ascending != undefined || b.ascending != undefined)) {
75
+ if (a.ascending != undefined)
76
+ return -1;
77
+ if (b.ascending != undefined)
78
+ return 1;
79
+ return 0;
80
+ //Pelo menos um deles tem order index diferente de 0 e os dois tem orientação de ordenação.
81
+ }
82
+ else if (a.ascending != undefined && b.ascending != undefined) {
83
+ return (a.orderIndex - b.orderIndex);
84
+ //Pelo menos um deles tem order index diferente de 0 e pelo menos um deles tem orientação de ordenação.
85
+ }
86
+ else if (a.ascending != undefined || b.ascending != undefined) {
87
+ if (a.ascending != undefined)
88
+ return -1;
89
+ if (b.ascending != undefined)
90
+ return 1;
91
+ return 0;
92
+ }
64
93
  return (a.orderIndex - b.orderIndex);
65
- //Pelo menos um deles tem order index diferente de 0 e pelo menos um deles tem orientação de ordenação.
66
- }
67
- else if (a.ascending != undefined || b.ascending != undefined) {
68
- if (a.ascending != undefined)
69
- return -1;
70
- if (b.ascending != undefined)
71
- return 1;
72
- return 0;
73
- }
74
- return (a.orderIndex - b.orderIndex);
75
- });
76
- this._orderListItems = newSortableList;
94
+ });
95
+ this._orderListItems = newSortableList;
96
+ }
77
97
  }
78
98
  createColumnList() {
79
99
  const visibleGroup = this.buildVisibleGroup();
@@ -129,8 +149,11 @@ export class SnkGridConfig {
129
149
  }
130
150
  let orderArray;
131
151
  if (((_a = this._orderPriorityList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
132
- this._orderPriorityList.find((item) => item.label === newItem.label).sort = sortOrder;
133
- this._orderPriorityList.filter((item) => item.sort).forEach((item, index) => {
152
+ const priorityItem = this._orderPriorityList.find((item) => item.label === newItem.label);
153
+ if (priorityItem) {
154
+ priorityItem.sort = sortOrder.value === ORDER_VALUES.none.value ? undefined : sortOrder.value;
155
+ }
156
+ this._orderPriorityList.filter((item) => item.sort != undefined).forEach((item, index) => {
134
157
  if (item.label === newItem.label) {
135
158
  newItem.sortIndex = index;
136
159
  }
@@ -156,6 +179,7 @@ export class SnkGridConfig {
156
179
  this._dataChanged = false;
157
180
  this.closeConfig();
158
181
  this.save();
182
+ this._orderPriorityList = [];
159
183
  }
160
184
  updateColumns() {
161
185
  this.columns = this._columListItems.flatMap((group) => group.items.map((item) => this.buildColumnFromListItem(item, group)));
@@ -213,11 +237,8 @@ export class SnkGridConfig {
213
237
  let _newColumnConfig = _newConfig.columns.find((_newColumnConfig) => column.name === _newColumnConfig.name);
214
238
  if (column.hidden === true && _newColumnConfig)
215
239
  return;
216
- if (_newColumnConfig) {
217
- _newColumnConfig.width = column.width;
218
- }
219
- else if (column.hidden === false) {
220
- _newColumnConfig = { name: column.name, width: column.width, orderIndex: 0 };
240
+ if (!_newColumnConfig && column.hidden === false) {
241
+ _newColumnConfig = { name: column.name, orderIndex: 0 };
221
242
  }
222
243
  if (_newColumnConfig) {
223
244
  if (column.sort) {
@@ -282,6 +303,7 @@ export class SnkGridConfig {
282
303
  .then((response) => {
283
304
  if (!response) {
284
305
  this._dataChanged = false;
306
+ this._orderPriorityList = [];
285
307
  this.configCancel.emit();
286
308
  this._componenteInternalKey = Date.now();
287
309
  }
@@ -346,6 +368,7 @@ export class SnkGridConfig {
346
368
  if (!this.resourceID)
347
369
  return;
348
370
  this._dataChanged = true;
371
+ this._orderPriorityList = [];
349
372
  const config = await ConfigStorage.getDefaultGridConfig(this.resourceID);
350
373
  const defaultVisibleCols = (_a = config === null || config === void 0 ? void 0 : config.columns.map(col => col.name)) !== null && _a !== void 0 ? _a : [];
351
374
  const isEmptyConfig = defaultVisibleCols.length === 0;
@@ -356,6 +379,7 @@ export class SnkGridConfig {
356
379
  columnsToIterate.forEach(column => {
357
380
  const item = this.buildListItemFromColumn(column);
358
381
  if (isEmptyConfig || defaultVisibleCols.includes(column.name)) {
382
+ item['width'] = this.getDefaultWidthBasedOnMetadata(column.name);
359
383
  visibleItemsMap.set(column.name, item);
360
384
  }
361
385
  else {
@@ -375,9 +399,30 @@ export class SnkGridConfig {
375
399
  this._columListItems = [visibleGroup, hiddenGroup];
376
400
  this._visibleList = visibleGroup.items;
377
401
  this._hiddenList = hiddenGroup.items;
402
+ if (this.config) {
403
+ this.config['columns'] = this.transformListToConfig(visibleGroup.items);
404
+ }
378
405
  this.updateColumns();
379
406
  this.createOrderList();
380
407
  }
408
+ transformListToConfig(list) {
409
+ return list.map((item, index) => {
410
+ return {
411
+ name: item.id,
412
+ hidden: false,
413
+ orderIndex: Number(item.sort) || index,
414
+ width: item.width,
415
+ };
416
+ });
417
+ }
418
+ getDefaultWidthBasedOnMetadata(columnName) {
419
+ var _a, _b;
420
+ if (!this.metadata) {
421
+ return undefined;
422
+ }
423
+ const columnMetadata = (_b = (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.find(col => col.name === columnName);
424
+ return GRID_COLUMN_DEFAULT_WIDTHS[columnMetadata === null || columnMetadata === void 0 ? void 0 : columnMetadata.userInterface] || GRID_COLUMN_DEFAULT_WIDTHS[UserInterface.SHORTTEXT];
425
+ }
381
426
  buildListItemFromColumn(column) {
382
427
  var _a;
383
428
  return {
@@ -385,13 +430,14 @@ export class SnkGridConfig {
385
430
  selected: false,
386
431
  sort: (_a = column === null || column === void 0 ? void 0 : column.sort) !== null && _a !== void 0 ? _a : ORDER_VALUES.asc.value,
387
432
  id: column.name,
433
+ width: column.width,
388
434
  };
389
435
  }
390
436
  render() {
391
437
  return (h(Host, null, h("div", { class: "grid-config__header" }, h("div", { class: "title-container" }, h("div", { class: "ez-margin-bottom--medium" }, h("label", { class: "title" }, this.getMessage('snkGridConfig.gridConfiguration')), h("label", { class: "subtitle" }, this.getMessage('snkGridConfig.columnVisibilityOrder'))), h("div", { class: "button-close" }, h("ez-button", { mode: "icon", iconName: "close", size: "medium", class: "ez-button--tertiary", onClick: () => this.closeConfig() })))), h("div", { class: 'grid-config__body' }, h("ez-collapsible-box", { id: 'group-select-columns', label: this.getMessage('snkGridConfig.columnsSelection'), "header-size": "medium", key: 'key_group-select-columns', value: this._collapsibleBoxListSelect, onEzChange: ({ detail }) => this._collapsibleBoxListOrder = !detail }, h("div", { class: "grid-config__main" }, h("ez-double-list", { leftList: this._hiddenList, leftTitle: this.getMessage('snkGridConfig.availableColumns'), rightList: this._visibleList, rightTitle: this.getMessage('snkGridConfig.selectedColumns'), onEzRightListChanged: ({ detail }) => this.handleRightListChange(detail), emptyMessage: {
392
438
  LEFT_LIST: this.getMessage('snkGridConfig.emptyMensage.left'),
393
439
  RIGHT_LIST: this.getMessage('snkGridConfig.emptyMensage.right'),
394
- }, entityLabel: 'coluna', entityLabelPlural: 'colunas' }))), h("ez-collapsible-box", { id: 'ID_group-order-columns', label: this.getMessage('snkGridConfig.dataOrdering'), "header-size": "medium", key: 'KEY_group-order-columns', value: this._collapsibleBoxListOrder, onEzChange: ({ detail }) => this._collapsibleBoxListSelect = !detail }, h("div", { class: "grid-config__main" }, h("ez-double-list", { rightList: this._orderListItems, rightTitle: this.getMessage('snkGridConfig.selectedColumns'), useOnlyRightList: true, slotsListBuilder: this.getListSlots(), emptyMessage: {
440
+ }, entityLabel: 'coluna', entityLabelPlural: 'colunas' }))), h("ez-collapsible-box", { id: 'ID_group-order-columns', label: this.getMessage('snkGridConfig.dataOrdering'), "header-size": "medium", key: 'KEY_group-order-columns', value: this._collapsibleBoxListOrder, onEzChange: ({ detail }) => this._collapsibleBoxListSelect = !detail }, h("div", { class: "grid-config__main" }, h("ez-double-list", { rightList: this._orderListItems, rightTitle: this.getMessage('snkGridConfig.selectedColumns'), useOnlyRightList: true, slotsListBuilder: this.getListSlots(), onEzRightListChanged: (evt) => this.handleOrderListChange(evt), emptyMessage: {
395
441
  RIGHT_LIST: this.getMessage('snkGridConfig.emptyMensage.right'),
396
442
  }, entityLabel: 'coluna', entityLabelPlural: 'colunas' })))), h("div", { class: "grid-config__footer" }, this.renderResetConfigBtn(), h("ez-button", { class: "padding-right--medium", label: this.getMessage('snkGridConfig.cancel'), onClick: () => this.closeConfig() }), h("ez-button", { label: this.getMessage('snkGridConfig.complete'), class: "ez-button--primary", onClick: () => this.finish() }))));
397
443
  }
@@ -529,6 +575,26 @@ export class SnkGridConfig {
529
575
  },
530
576
  "attribute": "resource-i-d",
531
577
  "reflect": false
578
+ },
579
+ "metadata": {
580
+ "type": "unknown",
581
+ "mutable": false,
582
+ "complexType": {
583
+ "original": "UnitMetadata",
584
+ "resolved": "UnitMetadata",
585
+ "references": {
586
+ "UnitMetadata": {
587
+ "location": "import",
588
+ "path": "@sankhyalabs/core"
589
+ }
590
+ }
591
+ },
592
+ "required": false,
593
+ "optional": false,
594
+ "docs": {
595
+ "tags": [],
596
+ "text": "Define a propriedade metadata da inst\u00E2ncia"
597
+ }
532
598
  }
533
599
  };
534
600
  }
@@ -78,6 +78,11 @@ export class ConfigStorage {
78
78
  await this.deleteGridConfigCache(name, resourceID);
79
79
  return this.gridConfigFetcher.saveConfig(config, name, resourceID);
80
80
  }
81
+ static async deleteGridConfig(name, resourceID) {
82
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
83
+ await this.deleteGridConfigCache(name, resourceID);
84
+ return this.gridConfigFetcher.deleteConfig(name, resourceID);
85
+ }
81
86
  static async loadDefaultFilter(filterId, resourceID, configName) {
82
87
  const legacyConfigName = this.filterBarLegacyConfig.get(configName);
83
88
  return this.personalizedFilterFetcher.loadDefaultFilter(resourceID, filterId, configName, legacyConfigName);
@@ -39,6 +39,18 @@ export default class GridConfigFetcher extends ResourceFetcher {
39
39
  });
40
40
  });
41
41
  }
42
+ deleteConfig(gridName, resourceID) {
43
+ const completePath = this.getPath(resourceID, gridName);
44
+ return new Promise((resolve, reject) => {
45
+ this.deleteResource(completePath)
46
+ .then(() => {
47
+ resolve();
48
+ })
49
+ .catch((error) => {
50
+ reject(error);
51
+ });
52
+ });
53
+ }
42
54
  getPath(resourceID, name) {
43
55
  if (name) {
44
56
  return `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}/${name}`;
@@ -17,6 +17,9 @@ export class ResourceFetcher {
17
17
  resource
18
18
  }
19
19
  }`);
20
+ this.templateByQuery.set("deleteResource", gql `mutation($name: String!) {
21
+ $queryAlias$: deleteResource(name: $name)
22
+ }`);
20
23
  }
21
24
  loadResource(name) {
22
25
  if (ResourceFetcher._loadingResource.has(name)) {
@@ -60,5 +63,20 @@ export class ResourceFetcher {
60
63
  });
61
64
  });
62
65
  }
66
+ deleteResource(name) {
67
+ return new Promise((resolve, reject) => {
68
+ DataFetcher.get()
69
+ .callGraphQL({
70
+ values: { name },
71
+ query: this.templateByQuery.get("deleteResource")
72
+ })
73
+ .then(() => {
74
+ resolve();
75
+ })
76
+ .catch((error) => {
77
+ reject(error);
78
+ });
79
+ });
80
+ }
63
81
  }
64
82
  ResourceFetcher._loadingResource = new Map();
@@ -179,6 +179,18 @@ class GridConfigFetcher extends ResourceFetcher {
179
179
  });
180
180
  });
181
181
  }
182
+ deleteConfig(gridName, resourceID) {
183
+ const completePath = this.getPath(resourceID, gridName);
184
+ return new Promise((resolve, reject) => {
185
+ this.deleteResource(completePath)
186
+ .then(() => {
187
+ resolve();
188
+ })
189
+ .catch((error) => {
190
+ reject(error);
191
+ });
192
+ });
193
+ }
182
194
  getPath(resourceID, name) {
183
195
  if (name) {
184
196
  return `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}/${name}`;
@@ -457,6 +469,11 @@ class ConfigStorage {
457
469
  await this.deleteGridConfigCache(name, resourceID);
458
470
  return this.gridConfigFetcher.saveConfig(config, name, resourceID);
459
471
  }
472
+ static async deleteGridConfig(name, resourceID) {
473
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
474
+ await this.deleteGridConfigCache(name, resourceID);
475
+ return this.gridConfigFetcher.deleteConfig(name, resourceID);
476
+ }
460
477
  static async loadDefaultFilter(filterId, resourceID, configName) {
461
478
  const legacyConfigName = this.filterBarLegacyConfig.get(configName);
462
479
  return this.personalizedFilterFetcher.loadDefaultFilter(resourceID, filterId, configName, legacyConfigName);
@@ -18,6 +18,9 @@ class ResourceFetcher {
18
18
  resource
19
19
  }
20
20
  }`);
21
+ this.templateByQuery.set("deleteResource", dist.gql `mutation($name: String!) {
22
+ $queryAlias$: deleteResource(name: $name)
23
+ }`);
21
24
  }
22
25
  loadResource(name) {
23
26
  if (ResourceFetcher._loadingResource.has(name)) {
@@ -61,6 +64,21 @@ class ResourceFetcher {
61
64
  });
62
65
  });
63
66
  }
67
+ deleteResource(name) {
68
+ return new Promise((resolve, reject) => {
69
+ DataFetcher.get()
70
+ .callGraphQL({
71
+ values: { name },
72
+ query: this.templateByQuery.get("deleteResource")
73
+ })
74
+ .then(() => {
75
+ resolve();
76
+ })
77
+ .catch((error) => {
78
+ reject(error);
79
+ });
80
+ });
81
+ }
64
82
  }
65
83
  ResourceFetcher._loadingResource = new Map();
66
84