@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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b0b676c5.js');
5
+ const index = require('./index-6fcf07f3.js');
6
6
  const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
7
 
8
8
  const SnkFilterBinarySelect = class {
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-93965c41.js');
5
+ const index = require('./index-6fcf07f3.js');
6
+ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
7
7
  const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
8
8
 
9
9
  const SnkFilterDetail = class {
@@ -45,39 +45,50 @@ const SnkFilterDetail = class {
45
45
  }
46
46
  apply() {
47
47
  var _a;
48
+ let value = this._editor["value"];
48
49
  let isValid = true;
49
- const value = this._editor["value"];
50
- /* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
51
- if (value != undefined && this.config.type === filterItemType_enum.FilterItemType.PERSONALIZED) {
50
+ if (this.config.type === filterItemType_enum.FilterItemType.PERSONALIZED) {
52
51
  const params = ((_a = this.config.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || [];
53
- if (params.length > 1) {
54
- if (params.length > value.length) {
55
- isValid = false;
56
- }
57
- else {
58
- value.forEach(item => {
59
- if (item == undefined) {
60
- isValid = false;
61
- }
62
- });
63
- }
52
+ const paramsCount = params.length;
53
+ if (paramsCount === 0) {
54
+ //Valor do filtro personalizado sem parametros deve ser um array vazio
55
+ value = [];
64
56
  }
65
- if (!isValid) {
66
- this.keepOpened = true;
67
- index$1.ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.").then(() => setTimeout(() => this.keepOpened = false, 1));
57
+ else {
58
+ isValid = this.validateAllFilled(paramsCount, value);
68
59
  }
69
60
  }
70
- /* WARNING: Temporário.*/
71
61
  if (isValid) {
72
62
  this.changeConfig(Object.assign(Object.assign({}, this.config), { value: value }));
73
63
  }
74
64
  }
65
+ /* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
66
+ validateAllFilled(paramsCount, value) {
67
+ let isValid = true;
68
+ if (value != undefined && paramsCount > 1) {
69
+ if (paramsCount > value.length) {
70
+ isValid = false;
71
+ }
72
+ else {
73
+ value.forEach(item => {
74
+ if (item == undefined) {
75
+ isValid = false;
76
+ }
77
+ });
78
+ }
79
+ }
80
+ if (!isValid) {
81
+ utils.ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.");
82
+ }
83
+ return isValid;
84
+ }
85
+ /* WARNING: Temporário.*/
75
86
  clear() {
76
87
  this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
77
88
  }
78
89
  render() {
79
90
  const ContentEditor = this.getContentEditor();
80
- return (index.h(index.Host, null, index.h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, index.h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), index.h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), index.h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), index.h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, index.h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), index.h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
91
+ return (index.h(index.Host, null, index.h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, index.h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), index.h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config }), index.h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), index.h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, index.h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), index.h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
81
92
  }
82
93
  };
83
94
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b0b676c5.js');
5
+ const index = require('./index-6fcf07f3.js');
6
6
  const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
7
 
8
8
  const SnkFilterMultiSelect = class {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b0b676c5.js');
5
+ const index = require('./index-6fcf07f3.js');
6
6
  const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
7
 
8
8
  const SnkFilterPeriod = class {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b0b676c5.js');
5
+ const index = require('./index-6fcf07f3.js');
6
6
  const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
7
 
8
8
  const SnkFilterPeriod = class {
@@ -2,8 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-e90ae303.js');
5
+ const index = require('./index-6fcf07f3.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
7
8
  const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
8
9
 
9
10
  const SnkFilterPersonalized = class {
@@ -13,10 +14,10 @@ const SnkFilterPersonalized = class {
13
14
  getValue(param, index) {
14
15
  if (this.value && index >= 0 && index < this.value.length) {
15
16
  const rawValue = this.value[index];
16
- if (param.type === index$1.UserInterface.SEARCH) {
17
+ if (param.type === core.UserInterface.SEARCH) {
17
18
  return rawValue;
18
19
  }
19
- return index$1.convertType(param.dataType, rawValue);
20
+ return DataType.convertType(param.dataType, rawValue);
20
21
  }
21
22
  return undefined;
22
23
  }
@@ -33,48 +34,39 @@ const SnkFilterPersonalized = class {
33
34
  }
34
35
  }
35
36
  doSearch(mode, argument, param) {
36
- const application = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
37
- if (this.fix) {
38
- this.fix();
39
- }
37
+ const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
40
38
  return new Promise((resolve, reject) => {
41
39
  application.executePreparedSearch(mode, argument, param.searchContext)
42
40
  .then(result => {
43
41
  resolve(result);
44
- if (this.unfix) {
45
- this.unfix();
46
- }
47
42
  }).catch(reason => {
48
43
  reject(reason);
49
- if (this.unfix) {
50
- this.unfix();
51
- }
52
44
  });
53
45
  });
54
46
  }
55
47
  getParamsInterface() {
56
48
  var _a, _b, _c;
57
49
  const params = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.personalizedFilter) === null || _c === void 0 ? void 0 : _c.parameters;
58
- return params.map((param, index$2) => {
50
+ return params.map((param, index$1) => {
59
51
  var _a;
60
52
  switch (param.type) {
61
- case index$1.UserInterface.SEARCH:
62
- return index.h("ez-search", { suppressEmptyOption: true, value: this.getValue(param, index$2), onEzChange: evt => this.setValue(index$2, evt.detail), label: param.label, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument, param) });
63
- case index$1.UserInterface.SWITCH:
64
- case index$1.UserInterface.CHECKBOX:
65
- const mode = index$1.UserInterface.SWITCH === param.type ? "switch" : "regular";
66
- return index.h("ez-check", { class: "ez-padding-bottom--medium", mode: mode, value: this.getValue(param, index$2), label: param.label, onEzChange: evt => this.setValue(index$2, evt.detail) });
67
- case index$1.UserInterface.DECIMALNUMBER:
68
- case index$1.UserInterface.INTEGERNUMBER:
69
- return index.h("ez-number-input", { label: param.label, value: this.getValue(param, index$2), precision: (_a = param.props) === null || _a === void 0 ? void 0 : _a.precision, onEzChange: evt => this.setValue(index$2, evt.detail) });
70
- case index$1.UserInterface.OPTIONSELECTOR:
71
- return index.h("ez-combo-box", { label: param.label, value: this.getValue(param, index$2), options: param.options, onEzChange: evt => { var _a; return this.setValue(index$2, (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); } });
72
- case index$1.UserInterface.DATE:
73
- return index.h("ez-date-input", { label: param.label, value: this.getValue(param, index$2), onEzChange: evt => this.setValue(index$2, evt.detail) });
74
- case index$1.UserInterface.DATETIME:
75
- return index.h("ez-date-time-input", { label: param.label, value: this.getValue(param, index$2), onEzChange: evt => this.setValue(index$2, evt.detail) });
53
+ case core.UserInterface.SEARCH:
54
+ return index.h("ez-search", { suppressEmptyOption: true, value: this.getValue(param, index$1), onEzChange: evt => this.setValue(index$1, evt.detail), label: param.label, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument, param) });
55
+ case core.UserInterface.SWITCH:
56
+ case core.UserInterface.CHECKBOX:
57
+ const mode = core.UserInterface.SWITCH === param.type ? "switch" : "regular";
58
+ return index.h("ez-check", { class: "ez-padding-bottom--medium", mode: mode, value: this.getValue(param, index$1), label: param.label, onEzChange: evt => this.setValue(index$1, evt.detail) });
59
+ case core.UserInterface.DECIMALNUMBER:
60
+ case core.UserInterface.INTEGERNUMBER:
61
+ return index.h("ez-number-input", { label: param.label, value: this.getValue(param, index$1), precision: (_a = param.props) === null || _a === void 0 ? void 0 : _a.precision, onEzChange: evt => this.setValue(index$1, evt.detail) });
62
+ case core.UserInterface.OPTIONSELECTOR:
63
+ return index.h("ez-combo-box", { label: param.label, value: this.getValue(param, index$1), options: param.options, onEzChange: evt => { var _a; return this.setValue(index$1, (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); } });
64
+ case core.UserInterface.DATE:
65
+ return index.h("ez-date-input", { label: param.label, value: this.getValue(param, index$1), onEzChange: evt => this.setValue(index$1, evt.detail) });
66
+ case core.UserInterface.DATETIME:
67
+ return index.h("ez-date-time-input", { label: param.label, value: this.getValue(param, index$1), onEzChange: evt => this.setValue(index$1, evt.detail) });
76
68
  default:
77
- return index.h("ez-text-input", { label: param.label, value: this.getValue(param, index$2), onEzChange: evt => this.setValue(index$2, evt.detail) });
69
+ return index.h("ez-text-input", { label: param.label, value: this.getValue(param, index$1), onEzChange: evt => this.setValue(index$1, evt.detail) });
78
70
  }
79
71
  });
80
72
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-e90ae303.js');
5
+ const index = require('./index-6fcf07f3.js');
6
+ const core = require('@sankhyalabs/core');
7
7
  const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
8
8
 
9
9
  const SnkFilterSearch = class {
@@ -14,22 +14,13 @@ const SnkFilterSearch = class {
14
14
  this.value = this._searchInput.value;
15
15
  }
16
16
  doSearch(mode, argument) {
17
- const application = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
18
- if (this.fix) {
19
- this.fix();
20
- }
17
+ const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
21
18
  return new Promise((resolve, reject) => {
22
19
  application.executePreparedSearch(mode, argument, this.config.props.searchContext)
23
20
  .then(result => {
24
21
  resolve(result);
25
- if (this.unfix) {
26
- this.unfix();
27
- }
28
22
  }).catch(reason => {
29
23
  reject(reason);
30
- if (this.unfix) {
31
- this.unfix();
32
- }
33
24
  });
34
25
  });
35
26
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b0b676c5.js');
5
+ const index = require('./index-6fcf07f3.js');
6
6
 
7
7
  const SnkFilterText = class {
8
8
  constructor(hostRef) {
@@ -2,9 +2,53 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-e90ae303.js');
7
- const taskbarProcessor = require('./taskbar-processor-6bd0d35c.js');
5
+ const index = require('./index-6fcf07f3.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const taskbarElements = require('./taskbar-elements-aedfeae6.js');
8
+
9
+ class TaskbarProcessor {
10
+ constructor(defaultButtons) {
11
+ this._defaultButtons = defaultButtons;
12
+ }
13
+ process(taskbarId, taskbarManager, dataState, disabledButtons = []) {
14
+ var _a;
15
+ this.customButtons = new Map();
16
+ this.buttons = "";
17
+ this.disabledButtons = [];
18
+ (_a = this.getButtonsArray(taskbarId, taskbarManager, dataState)) === null || _a === void 0 ? void 0 : _a.forEach(btnDef => {
19
+ let buttonName;
20
+ if (typeof btnDef === "string") {
21
+ buttonName = btnDef;
22
+ }
23
+ else {
24
+ const customBtn = btnDef;
25
+ this.customButtons.set(customBtn.name, customBtn);
26
+ buttonName = customBtn.name;
27
+ }
28
+ if (!this.isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabledButtons)) {
29
+ this.disabledButtons.push(buttonName);
30
+ }
31
+ if (this.buttons.length > 0) {
32
+ this.buttons += ",";
33
+ }
34
+ this.buttons += buttonName;
35
+ });
36
+ }
37
+ getButtonsArray(taskbarId, taskbarManager, dataState) {
38
+ const defaults = this._defaultButtons[taskbarId];
39
+ if (taskbarManager) {
40
+ return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
41
+ }
42
+ return defaults;
43
+ }
44
+ isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
45
+ const originalValue = disabled.includes(buttonName) ? false : true;
46
+ if (taskbarManager && taskbarManager.isEnabled) {
47
+ return taskbarManager.isEnabled(taskbarId, dataState, buttonName, originalValue);
48
+ }
49
+ return originalValue;
50
+ }
51
+ }
8
52
 
9
53
  const snkFormCss = ".sc-snk-form-h{display:block}.snk-form.sc-snk-form{position:relative;padding:var(--space--large);padding-top:var(--space--medium)}.snk-form__header.sc-snk-form{position:relative;padding-top:var(--space--medium);padding-bottom:var(--space--medium);margin-bottom:var(--space--medium)}.snk-form__header--fixed.sc-snk-form{position:sticky;top:0;background:var(--background--body);z-index:var(--more-visible, 2);padding-left:var(--space--large);padding-right:var(--space--large);margin-left:calc(var(--space--large) * -1);margin-right:calc(var(--space--large) * -1);width:calc(100% + (var(--space--large) * 2))}";
10
54
 
@@ -13,7 +57,7 @@ const SnkForm = class {
13
57
  index.registerInstance(this, hostRef);
14
58
  this.exit = index.createEvent(this, "exit", 7);
15
59
  this.actionClick = index.createEvent(this, "actionClick", 7);
16
- this._taskbarProcessor = new taskbarProcessor.TaskbarProcessor({
60
+ this._taskbarProcessor = new TaskbarProcessor({
17
61
  "snkForm.regular": ["PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "GRID_MODE", "INSERT"],
18
62
  "snkForm.finish_edition": ["CANCEL", "SAVE"]
19
63
  });
@@ -74,7 +118,7 @@ const SnkForm = class {
74
118
  return ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectedRecords) ? this._dataState.selectedRecords[0] : undefined;
75
119
  }
76
120
  componentWillLoad() {
77
- this._application = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
121
+ this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
78
122
  if (this._application) {
79
123
  this._application.loadFormConfig(this.configName).then(cfg => {
80
124
  this._configLoaded = true;
@@ -130,4 +174,74 @@ const SnkForm = class {
130
174
  };
131
175
  SnkForm.style = snkFormCss;
132
176
 
177
+ 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)}";
178
+
179
+ const SnkGrid = class {
180
+ constructor(hostRef) {
181
+ index.registerInstance(this, hostRef);
182
+ this.actionClick = index.createEvent(this, "actionClick", 7);
183
+ this.gridDoubleClick = index.createEvent(this, "gridDoubleClick", 7);
184
+ this._topTaskbarProcessor = new TaskbarProcessor({
185
+ "snkGridTopTaskbar": ["FORM_MODE", "CONFIG_GRID", "INSERT"]
186
+ });
187
+ this._headerTaskbarProcessor = new TaskbarProcessor({
188
+ "snkGridHeaderTaskbar.unselected": ["REFRESH"],
189
+ "snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
190
+ });
191
+ }
192
+ actionClickHandler(evt) {
193
+ if (evt.detail === taskbarElements.TaskbarElement.CONFIG_GRID && this._grid) {
194
+ this._grid.openGridConfig();
195
+ }
196
+ }
197
+ saveConfig(config) {
198
+ const snkApplication = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
199
+ if (snkApplication) {
200
+ snkApplication.saveGridConfig(config);
201
+ }
202
+ }
203
+ componentWillLoad() {
204
+ const snkApplication = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
205
+ if (snkApplication) {
206
+ snkApplication.loadGridConfig(this.configName).then(cfg => {
207
+ this._gridConfig = cfg;
208
+ this._configLoaded = true;
209
+ });
210
+ //Forçamos a carga dos acessos pra aproveitar a request inicial.
211
+ snkApplication.getAllAccess();
212
+ }
213
+ let parent = this._element.parentElement;
214
+ while (parent) {
215
+ if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
216
+ this._snkDataUnit = parent;
217
+ this._dataUnit = this._snkDataUnit.dataUnit;
218
+ if (!this._dataUnit) {
219
+ this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
220
+ this._dataUnit = evt.detail;
221
+ });
222
+ }
223
+ this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
224
+ this._dataState = evt.detail;
225
+ });
226
+ break;
227
+ }
228
+ parent = parent.parentElement;
229
+ }
230
+ }
231
+ componentWillRender() {
232
+ const headerTaskbarId = this._dataState && this._dataState.selectedRecords.length > 0 ? "snkGridHeaderTaskbar.selected" : "snkGridHeaderTaskbar.unselected";
233
+ this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState);
234
+ this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState);
235
+ }
236
+ render() {
237
+ if (!this._configLoaded || !this._dataUnit) {
238
+ return undefined;
239
+ }
240
+ 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" }))));
241
+ }
242
+ get _element() { return index.getElement(this); }
243
+ };
244
+ SnkGrid.style = snkGridCss;
245
+
133
246
  exports.snk_form = SnkForm;
247
+ exports.snk_grid = SnkGrid;
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-e90ae303.js');
5
+ const index = require('./index-6fcf07f3.js');
6
+ const core = require('@sankhyalabs/core');
7
7
 
8
8
  const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color-primary:var(--scrollbar--primary, #2B3A54);--snk-pesquisa__content-scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-pesquisa__content-scrollbar--background-color-primary) var(--snk-pesquisa__content-scrollbar--background-color-secondary);padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:var(--snk-pesquisa__content-scrollbar--background-color-secondary);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color-primary);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:var(--snk-pesquisa__content-scrollbar--background-color-secondary);width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
9
9
 
@@ -59,7 +59,7 @@ const SnkPesquisa = class {
59
59
  .then((resp) => {
60
60
  this._startLoading = false;
61
61
  if (resp) {
62
- resp = index$1.ObjectUtils.stringToObject(resp.json.$);
62
+ resp = core.ObjectUtils.stringToObject(resp.json.$);
63
63
  let descriptionField = resp.descriptionField;
64
64
  let pkField = resp.pkField;
65
65
  if (descriptionField && pkField) {
@@ -87,7 +87,7 @@ const SnkPesquisa = class {
87
87
  }
88
88
  filterFieldsMetadata(resp, item) {
89
89
  let fieldsMetadata = resp.fieldsMetadata.filter((field) => {
90
- let accept = !index$1.StringUtils.isEmpty(item[field.fieldName]) &&
90
+ let accept = !core.StringUtils.isEmpty(item[field.fieldName]) &&
91
91
  field.visible !== false &&
92
92
  field.type !== 'B' &&
93
93
  resp.pkField !== field.fieldName &&
@@ -125,7 +125,7 @@ const SnkPesquisa = class {
125
125
  return index;
126
126
  }
127
127
  equals(obj1, obj2) {
128
- return index$1.ObjectUtils.objectToString(obj1) === index$1.ObjectUtils.objectToString(obj2);
128
+ return core.ObjectUtils.objectToString(obj1) === core.ObjectUtils.objectToString(obj2);
129
129
  }
130
130
  find(arr, checkerFn) {
131
131
  if (arr) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-b0b676c5.js');
3
+ const index = require('./index-6fcf07f3.js');
4
4
 
5
5
  exports.TaskbarElement = void 0;
6
6
  (function (TaskbarElement) {
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-e90ae303.js');
5
+ const index = require('./index-6fcf07f3.js');
6
+ const core = require('@sankhyalabs/core');
7
7
 
8
8
  const testePesquisaCss = ":host{display:block}";
9
9
 
@@ -12,7 +12,7 @@ const TestePesquisa = class {
12
12
  index.registerInstance(this, hostRef);
13
13
  }
14
14
  componentWillLoad() {
15
- this.dataUnit = new index$1.DataUnit("testes_com_formulario");
15
+ this.dataUnit = new core.DataUnit("testes_com_formulario");
16
16
  this.dataUnit.metadata = {
17
17
  name: "dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",
18
18
  label: "Parceiro",
@@ -20,8 +20,8 @@ const TestePesquisa = class {
20
20
  {
21
21
  name: "CODPARC",
22
22
  label: "Parceiro",
23
- dataType: index$1.DataType.NUMBER,
24
- userInterface: index$1.UserInterface.SEARCH,
23
+ dataType: core.DataType.NUMBER,
24
+ userInterface: core.UserInterface.SEARCH,
25
25
  required: true,
26
26
  properties: { ENTITYNAME: "Parceiro" }
27
27
  }
@@ -8,6 +8,12 @@ const FORM_MODE = 1;
8
8
  * Para conhecer os detalhes do módulo, vide os arquivos neste projeto "/src/lib/message/resources/*.msg.ts"
9
9
  */
10
10
  export class SnkCrud {
11
+ /**
12
+ * Usado para alternar a visão entre GRID e FORM externamente.
13
+ */
14
+ async goToView(mode) {
15
+ this.executeAction(mode);
16
+ }
11
17
  async gridToForm(keepFormMode = false) {
12
18
  this._backToGrid = !keepFormMode && await this._viewStack.getSelectedIndex() === GRID_MODE;
13
19
  this._viewStack.show(FORM_MODE);
@@ -197,5 +203,28 @@ export class SnkCrud {
197
203
  }
198
204
  }];
199
205
  }
206
+ static get methods() {
207
+ return {
208
+ "goToView": {
209
+ "complexType": {
210
+ "signature": "(mode: string) => Promise<void>",
211
+ "parameters": [{
212
+ "tags": [],
213
+ "text": ""
214
+ }],
215
+ "references": {
216
+ "Promise": {
217
+ "location": "global"
218
+ }
219
+ },
220
+ "return": "Promise<void>"
221
+ },
222
+ "docs": {
223
+ "text": "Usado para alternar a vis\u00E3o entre GRID e FORM externamente.",
224
+ "tags": []
225
+ }
226
+ }
227
+ };
228
+ }
200
229
  static get elementRef() { return "_element"; }
201
230
  }
@@ -27,21 +27,12 @@ export class SnkFilterPersonalized {
27
27
  }
28
28
  doSearch(mode, argument, param) {
29
29
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
30
- if (this.fix) {
31
- this.fix();
32
- }
33
30
  return new Promise((resolve, reject) => {
34
31
  application.executePreparedSearch(mode, argument, param.searchContext)
35
32
  .then(result => {
36
33
  resolve(result);
37
- if (this.unfix) {
38
- this.unfix();
39
- }
40
34
  }).catch(reason => {
41
35
  reject(reason);
42
- if (this.unfix) {
43
- this.unfix();
44
- }
45
36
  });
46
37
  });
47
38
  }
@@ -125,36 +116,6 @@ export class SnkFilterPersonalized {
125
116
  "tags": [],
126
117
  "text": ""
127
118
  }
128
- },
129
- "fix": {
130
- "type": "unknown",
131
- "mutable": false,
132
- "complexType": {
133
- "original": "()=>void",
134
- "resolved": "() => void",
135
- "references": {}
136
- },
137
- "required": false,
138
- "optional": false,
139
- "docs": {
140
- "tags": [],
141
- "text": ""
142
- }
143
- },
144
- "unfix": {
145
- "type": "unknown",
146
- "mutable": false,
147
- "complexType": {
148
- "original": "()=>void",
149
- "resolved": "() => void",
150
- "references": {}
151
- },
152
- "required": false,
153
- "optional": false,
154
- "docs": {
155
- "tags": [],
156
- "text": ""
157
- }
158
119
  }
159
120
  };
160
121
  }
@@ -7,21 +7,12 @@ export class SnkFilterSearch {
7
7
  }
8
8
  doSearch(mode, argument) {
9
9
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
10
- if (this.fix) {
11
- this.fix();
12
- }
13
10
  return new Promise((resolve, reject) => {
14
11
  application.executePreparedSearch(mode, argument, this.config.props.searchContext)
15
12
  .then(result => {
16
13
  resolve(result);
17
- if (this.unfix) {
18
- this.unfix();
19
- }
20
14
  }).catch(reason => {
21
15
  reject(reason);
22
- if (this.unfix) {
23
- this.unfix();
24
- }
25
16
  });
26
17
  });
27
18
  }
@@ -73,36 +64,6 @@ export class SnkFilterSearch {
73
64
  "tags": [],
74
65
  "text": ""
75
66
  }
76
- },
77
- "fix": {
78
- "type": "unknown",
79
- "mutable": false,
80
- "complexType": {
81
- "original": "()=>void",
82
- "resolved": "() => void",
83
- "references": {}
84
- },
85
- "required": false,
86
- "optional": false,
87
- "docs": {
88
- "tags": [],
89
- "text": ""
90
- }
91
- },
92
- "unfix": {
93
- "type": "unknown",
94
- "mutable": false,
95
- "complexType": {
96
- "original": "()=>void",
97
- "resolved": "() => void",
98
- "references": {}
99
- },
100
- "required": false,
101
- "optional": false,
102
- "docs": {
103
- "tags": [],
104
- "text": ""
105
- }
106
67
  }
107
68
  };
108
69
  }