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

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 (120) hide show
  1. package/dist/cjs/{SnkMessageBuilder-7717f1e4.js → SnkMessageBuilder-d8215915.js} +14 -119
  2. package/dist/cjs/{filter-item-type.enum-e2e1bc5b.js → filter-item-type.enum-3daf58d3.js} +2 -0
  3. package/dist/cjs/index-84fe3b86.js +20 -0
  4. package/dist/cjs/index-93965c41.js +141 -0
  5. package/dist/cjs/{index-02201bc9.js → index-e90ae303.js} +11 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  8. package/dist/cjs/snk-application.cjs.entry.js +43 -25
  9. package/dist/cjs/snk-crud.cjs.entry.js +1 -1
  10. package/dist/cjs/snk-data-unit.cjs.entry.js +10 -18
  11. package/dist/cjs/snk-filter-bar.cjs.entry.js +334 -146
  12. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  13. package/dist/cjs/snk-filter-detail.cjs.entry.js +37 -2
  14. package/dist/cjs/snk-filter-item.cjs.entry.js +34 -11
  15. package/dist/cjs/snk-filter-list.cjs.entry.js +1 -1
  16. package/dist/cjs/snk-filter-modal.cjs.entry.js +37 -0
  17. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  18. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
  20. package/dist/cjs/snk-filter-personalized.cjs.entry.js +89 -0
  21. package/dist/cjs/snk-filter-search.cjs.entry.js +2 -2
  22. package/dist/cjs/snk-form.cjs.entry.js +1 -1
  23. package/dist/cjs/snk-grid.cjs.entry.js +1 -1
  24. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  25. package/dist/cjs/snk-taskbar.cjs.entry.js +1 -1
  26. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  27. package/dist/collection/collection-manifest.json +2 -0
  28. package/dist/collection/components/snk-application/snk-application.js +54 -7
  29. package/dist/collection/components/snk-crud/snk-crud.js +2 -4
  30. package/dist/collection/components/snk-data-unit/snk-data-unit.js +0 -27
  31. package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +100 -0
  32. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +161 -0
  33. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +2 -0
  34. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +36 -1
  35. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +32 -9
  36. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +196 -0
  37. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +22 -0
  38. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +238 -139
  39. package/dist/collection/components/snk-grid/snk-grid.js +2 -4
  40. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +18 -10
  41. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +14 -2
  42. package/dist/components/SnkMessageBuilder.js +15 -119
  43. package/dist/components/filter-item-type.enum.js +2 -0
  44. package/dist/components/index.d.ts +2 -0
  45. package/dist/components/index.js +2 -0
  46. package/dist/components/index2.js +11 -1
  47. package/dist/components/index3.js +139 -0
  48. package/dist/components/snk-application2.js +39 -19
  49. package/dist/components/snk-crud.js +15 -9
  50. package/dist/components/snk-data-unit.js +2 -11
  51. package/dist/components/snk-filter-bar2.js +340 -146
  52. package/dist/components/snk-filter-detail2.js +36 -1
  53. package/dist/components/snk-filter-item2.js +32 -9
  54. package/dist/components/snk-filter-list2.js +1 -1
  55. package/dist/components/snk-filter-modal.d.ts +11 -0
  56. package/dist/components/snk-filter-modal.js +6 -0
  57. package/dist/components/snk-filter-modal2.js +73 -0
  58. package/dist/components/snk-filter-personalized.d.ts +11 -0
  59. package/dist/components/snk-filter-personalized.js +107 -0
  60. package/dist/components/snk-grid2.js +15 -9
  61. package/dist/{sankhyablocks/SnkMessageBuilder-a7da466b.js → esm/SnkMessageBuilder-35a20271.js} +15 -119
  62. package/dist/esm/{filter-item-type.enum-61fbf80a.js → filter-item-type.enum-a79b2fa8.js} +2 -0
  63. package/dist/esm/index-5992b7e6.js +139 -0
  64. package/dist/esm/{index-f1d3e4da.js → index-c683b2b0.js} +11 -1
  65. package/dist/esm/index-c71285cb.js +17 -0
  66. package/dist/esm/loader.js +1 -1
  67. package/dist/esm/sankhyablocks.js +1 -1
  68. package/dist/esm/snk-application.entry.js +37 -19
  69. package/dist/esm/snk-crud.entry.js +1 -1
  70. package/dist/esm/snk-data-unit.entry.js +3 -11
  71. package/dist/esm/snk-filter-bar.entry.js +328 -140
  72. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  73. package/dist/esm/snk-filter-detail.entry.js +37 -2
  74. package/dist/esm/snk-filter-item.entry.js +34 -11
  75. package/dist/esm/snk-filter-list.entry.js +1 -1
  76. package/dist/esm/snk-filter-modal.entry.js +33 -0
  77. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  78. package/dist/esm/snk-filter-number.entry.js +1 -1
  79. package/dist/esm/snk-filter-period.entry.js +1 -1
  80. package/dist/esm/snk-filter-personalized.entry.js +85 -0
  81. package/dist/esm/snk-filter-search.entry.js +2 -2
  82. package/dist/esm/snk-form.entry.js +1 -1
  83. package/dist/esm/snk-grid.entry.js +1 -1
  84. package/dist/esm/snk-pesquisa.entry.js +1 -1
  85. package/dist/esm/snk-taskbar.entry.js +1 -1
  86. package/dist/esm/teste-pesquisa.entry.js +1 -1
  87. package/dist/{esm/SnkMessageBuilder-a7da466b.js → sankhyablocks/SnkMessageBuilder-35a20271.js} +15 -119
  88. package/dist/sankhyablocks/{filter-item-type.enum-61fbf80a.js → filter-item-type.enum-a79b2fa8.js} +2 -0
  89. package/dist/sankhyablocks/index-5992b7e6.js +139 -0
  90. package/dist/sankhyablocks/{index-f1d3e4da.js → index-c683b2b0.js} +11 -1
  91. package/dist/sankhyablocks/index-c71285cb.js +17 -0
  92. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  93. package/dist/sankhyablocks/snk-application.entry.js +37 -19
  94. package/dist/sankhyablocks/snk-crud.entry.js +1 -1
  95. package/dist/sankhyablocks/snk-data-unit.entry.js +3 -11
  96. package/dist/sankhyablocks/snk-filter-bar.entry.js +328 -140
  97. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +1 -1
  98. package/dist/sankhyablocks/snk-filter-detail.entry.js +37 -2
  99. package/dist/sankhyablocks/snk-filter-item.entry.js +34 -11
  100. package/dist/sankhyablocks/snk-filter-list.entry.js +1 -1
  101. package/dist/sankhyablocks/snk-filter-modal.entry.js +33 -0
  102. package/dist/sankhyablocks/snk-filter-multi-select.entry.js +1 -1
  103. package/dist/sankhyablocks/snk-filter-number.entry.js +1 -1
  104. package/dist/sankhyablocks/snk-filter-period.entry.js +1 -1
  105. package/dist/sankhyablocks/snk-filter-personalized.entry.js +85 -0
  106. package/dist/sankhyablocks/snk-filter-search.entry.js +2 -2
  107. package/dist/sankhyablocks/snk-form.entry.js +1 -1
  108. package/dist/sankhyablocks/snk-grid.entry.js +1 -1
  109. package/dist/sankhyablocks/snk-pesquisa.entry.js +1 -1
  110. package/dist/sankhyablocks/snk-taskbar.entry.js +1 -1
  111. package/dist/sankhyablocks/teste-pesquisa.entry.js +1 -1
  112. package/dist/types/components/snk-application/snk-application.d.ts +4 -1
  113. package/dist/types/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.d.ts +4 -0
  114. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +23 -0
  115. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +3 -1
  116. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +2 -0
  117. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +23 -0
  118. package/dist/types/components.d.ts +56 -8
  119. package/package.json +3 -3
  120. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -51
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-02201bc9.js');
7
- const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
6
+ const index$1 = require('./index-e90ae303.js');
7
+ const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
8
8
 
9
9
  const SnkFilterItem = class {
10
10
  constructor(hostRef) {
@@ -26,16 +26,20 @@ const SnkFilterItem = class {
26
26
  } while ((current = current.offsetParent) != null);
27
27
  }
28
28
  this.detailIsVisible = false;
29
+ this.executeCloseCallback();
29
30
  return false;
30
31
  };
31
32
  }
32
33
  async showUp(open = false) {
33
- this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
34
- if (open) {
35
- window.requestAnimationFrame(() => {
36
- this.showDetail();
37
- });
38
- }
34
+ return new Promise(resolve => {
35
+ this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
36
+ if (open) {
37
+ window.requestAnimationFrame(() => {
38
+ this._closeCallback = resolve;
39
+ this.showDetail();
40
+ });
41
+ }
42
+ });
39
43
  }
40
44
  showDetail() {
41
45
  this._floatingID = index$1.FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
@@ -50,6 +54,13 @@ const SnkFilterItem = class {
50
54
  }
51
55
  this._floatingID = undefined;
52
56
  this.detailIsVisible = false;
57
+ this.executeCloseCallback();
58
+ }
59
+ executeCloseCallback() {
60
+ if (this._closeCallback) {
61
+ this._closeCallback();
62
+ this._closeCallback = undefined;
63
+ }
53
64
  }
54
65
  //---------------------------------------------
55
66
  // Event handlers
@@ -124,6 +135,9 @@ const SnkFilterItem = class {
124
135
  if (type === filterItemType_enum.FilterItemType.SEARCH) {
125
136
  return `${label}: ${value.value} - ${value.label}`;
126
137
  }
138
+ if (type === filterItemType_enum.FilterItemType.PERSONALIZED) {
139
+ return label;
140
+ }
127
141
  return `${label}: ${value}`;
128
142
  }
129
143
  return label;
@@ -138,15 +152,24 @@ const SnkFilterItem = class {
138
152
  filterChangeListener() {
139
153
  this.hideDetail();
140
154
  }
141
- getIconName() {
155
+ getRightIconName() {
142
156
  if (this.config.value != undefined) {
143
157
  return "close";
144
158
  }
145
159
  return this.detailIsVisible ? "chevron-up" : "chevron-down";
146
160
  }
161
+ getLeftIconName() {
162
+ switch (this.config.type) {
163
+ case filterItemType_enum.FilterItemType.PERIOD:
164
+ return "calendar";
165
+ case filterItemType_enum.FilterItemType.PERSONALIZED:
166
+ return "tune";
167
+ }
168
+ return undefined;
169
+ }
147
170
  render() {
148
- const leftIcon = this.config.type === filterItemType_enum.FilterItemType.PERIOD ? "calendar" : undefined;
149
- return (index.h(index.Host, null, index.h("ez-chip", { ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined }, leftIcon ? index.h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, index.h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getIconName(), class: "ez-padding-left--small", slot: "rightIcon" })), index.h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, index.h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id }))));
171
+ const leftIcon = this.getLeftIconName();
172
+ return (index.h(index.Host, null, index.h("ez-chip", { ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined }, leftIcon ? index.h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, index.h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon" })), index.h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, index.h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id }))));
150
173
  }
151
174
  get _filterItemElement() { return index.getElement(this); }
152
175
  };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-02201bc9.js');
6
+ const index$1 = require('./index-e90ae303.js');
7
7
 
8
8
  const SHOW_MORE_ITEM_NAME = "__SHOWMORE__";
9
9
  const MAX_FILTERS = 5;
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-b0b676c5.js');
6
+ const index$2 = require('./index-84fe3b86.js');
7
+ const index$1 = require('./index-e90ae303.js');
8
+
9
+ const SnkFilterModal = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ }
13
+ updateValue(id, value) {
14
+ this.items = this.items.map(item => {
15
+ if (item.id === id) {
16
+ return Object.assign(Object.assign({}, item), { active: value });
17
+ }
18
+ return item;
19
+ });
20
+ }
21
+ getActiveFiltersMsg() {
22
+ const activeFilters = this.items.filter(item => item.active).length;
23
+ if (activeFilters === 0) {
24
+ return this.getMessage("snkFilterBar.noActiveFilters");
25
+ }
26
+ return this.getMessage(activeFilters > 1 ? "snkFilterBar.activeFilters" : "snkFilterBar.activeFilter", { ACTIVE_FILTERS: activeFilters });
27
+ }
28
+ getFilteredItems() {
29
+ return this.items ? index$1.ArrayUtils.applyStringFilter(this._filterArgument, this.items) : [];
30
+ }
31
+ render() {
32
+ const allowCancel = this.items.filter(item => item.active).length > 0;
33
+ return (index.h("ez-modal-container", { modalTitle: this.modalTitle, modalSubTitle: this.modalSubTitle, cancelButtonLabel: this.cancelButtonLabel, okButtonLabel: this.okButtonLabel, onEzModalAction: evt => this.processModalAction(evt.detail), cancelButtonStatus: allowCancel ? index$2.ModalButtonStatus.ENABLED : index$2.ModalButtonStatus.DISABLED }, index.h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-content" }, index.h("div", null, this.useSearch ? index.h("ez-filter-input", { label: this.getMessage("snkFilterBar.modalFindFilter"), onEzChange: (evt) => this._filterArgument = evt.detail }) : undefined), this.getFilteredItems().length > 0 ? index.h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding-bottom--small" }, this.getActiveFiltersMsg()) : undefined, index.h("div", null, this.getFilteredItems().map(item => index.h("div", { class: "ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small" }, index.h("ez-check", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-item__check", onEzChange: evt => this.updateValue(item.id, evt.detail), enabled: item.enabled, value: item.active, mode: "switch" }), index.h("div", { class: "ez-text ez-title--primary ez-text--medium ez-margin-left--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item__label" }, item.label)))), index.h("div", { class: "ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large" }, this.infoText))));
34
+ }
35
+ };
36
+
37
+ exports.snk_filter_modal = SnkFilterModal;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
- const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
6
+ const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
7
 
8
8
  const SnkFilterMultiSelect = class {
9
9
  constructor(hostRef) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
- const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
6
+ const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
7
 
8
8
  const SnkFilterPeriod = class {
9
9
  constructor(hostRef) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
- const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
6
+ const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
7
 
8
8
  const SnkFilterPeriod = class {
9
9
  constructor(hostRef) {
@@ -0,0 +1,89 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-b0b676c5.js');
6
+ const index$1 = require('./index-e90ae303.js');
7
+ const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
8
+
9
+ const SnkFilterPersonalized = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ }
13
+ getValue(param, index) {
14
+ if (this.value && index >= 0 && index < this.value.length) {
15
+ const rawValue = this.value[index];
16
+ if (param.type === index$1.UserInterface.SEARCH) {
17
+ return rawValue;
18
+ }
19
+ return index$1.convertType(param.dataType, rawValue);
20
+ }
21
+ return undefined;
22
+ }
23
+ setValue(index, value) {
24
+ if (this.value == undefined) {
25
+ this.value = Array(index).fill(null);
26
+ }
27
+ else {
28
+ this.value = [...this.value];
29
+ }
30
+ this.value[index] = value;
31
+ if (this.value.filter(item => item != undefined).length == 0) {
32
+ this.value = null;
33
+ }
34
+ }
35
+ doSearch(mode, argument, param) {
36
+ const application = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
37
+ if (this.fix) {
38
+ this.fix();
39
+ }
40
+ return new Promise((resolve, reject) => {
41
+ application.executePreparedSearch(mode, argument, param.searchContext)
42
+ .then(result => {
43
+ resolve(result);
44
+ if (this.unfix) {
45
+ this.unfix();
46
+ }
47
+ }).catch(reason => {
48
+ reject(reason);
49
+ if (this.unfix) {
50
+ this.unfix();
51
+ }
52
+ });
53
+ });
54
+ }
55
+ getParamsInterface() {
56
+ var _a, _b, _c;
57
+ 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) => {
59
+ var _a;
60
+ 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) });
76
+ 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) });
78
+ }
79
+ });
80
+ }
81
+ render() {
82
+ if (!this.config || this.config.type !== filterItemType_enum.FilterItemType.PERSONALIZED) {
83
+ return undefined;
84
+ }
85
+ return (index.h(index.Host, null, this.getParamsInterface()));
86
+ }
87
+ };
88
+
89
+ exports.snk_filter_personalized = SnkFilterPersonalized;
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-02201bc9.js');
7
- const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
6
+ const index$1 = require('./index-e90ae303.js');
7
+ const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
8
8
 
9
9
  const SnkFilterSearch = class {
10
10
  constructor(hostRef) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-02201bc9.js');
6
+ const index$1 = require('./index-e90ae303.js');
7
7
  const taskbarProcessor = require('./taskbar-processor-6bd0d35c.js');
8
8
 
9
9
  const snkFormCss = ".sc-snk-form-h{display:block}.snk-form.sc-snk-form{position:relative;padding:var(--space--large);padding-top:var(--space--medium)}.snk-form__header.sc-snk-form{position:relative;padding-top:var(--space--medium);padding-bottom:var(--space--medium);margin-bottom:var(--space--medium)}.snk-form__header--fixed.sc-snk-form{position:sticky;top:0;background:var(--background--body);z-index:var(--more-visible, 2);padding-left:var(--space--large);padding-right:var(--space--large);margin-left:calc(var(--space--large) * -1);margin-right:calc(var(--space--large) * -1);width:calc(100% + (var(--space--large) * 2))}";
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-02201bc9.js');
6
+ const index$1 = require('./index-e90ae303.js');
7
7
  const taskbarElements = require('./taskbar-elements-283c737e.js');
8
8
  const taskbarProcessor = require('./taskbar-processor-6bd0d35c.js');
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-02201bc9.js');
6
+ const index$1 = require('./index-e90ae303.js');
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
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-02201bc9.js');
6
+ const index$1 = require('./index-e90ae303.js');
7
7
  const taskbarElements = require('./taskbar-elements-283c737e.js');
8
8
 
9
9
  const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-02201bc9.js');
6
+ const index$1 = require('./index-e90ae303.js');
7
7
 
8
8
  const testePesquisaCss = ":host{display:block}";
9
9
 
@@ -6,6 +6,8 @@
6
6
  "./components/snk-taskbar/snk-taskbar.js",
7
7
  "./components/snk-crud/snk-crud.js",
8
8
  "./components/snk-filter-bar/filter-list/snk-filter-list.js",
9
+ "./components/snk-filter-bar/filter-modal/snk-filter-modal.js",
10
+ "./components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js",
9
11
  "./components/snk-filter-bar/snk-filter-bar.js",
10
12
  "./components/snk-filter-bar/filter-item/snk-filter-detail.js",
11
13
  "./components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js",
@@ -143,15 +143,24 @@ export class SnkApplication {
143
143
  * Mostra o conteúdo passado em um Popup
144
144
  */
145
145
  async showPopUp(content) {
146
- this.clearPopUpContent();
146
+ this.clearContent(this._popUp);
147
147
  this._popUp.appendChild(content);
148
148
  this._popUp.opened = true;
149
149
  }
150
+ async showModal(content) {
151
+ this.clearContent(this._rightModal);
152
+ this._rightModal.appendChild(content);
153
+ this._rightModal.opened = true;
154
+ }
155
+ async closeModal() {
156
+ this.clearContent(this._rightModal);
157
+ this._rightModal.opened = false;
158
+ }
150
159
  /**
151
160
  * Fecha o popup, liberando o conteúdo.
152
161
  */
153
162
  async closePopUp() {
154
- this.clearPopUpContent();
163
+ this.clearContent(this._popUp);
155
164
  this._popUp.opened = false;
156
165
  }
157
166
  /**
@@ -494,10 +503,10 @@ export class SnkApplication {
494
503
  accept(window['isDebugMode']);
495
504
  });
496
505
  }
497
- clearPopUpContent() {
498
- if (this._popUp) {
499
- Array.from(this._popUp.children).forEach(c => {
500
- this._popUp.removeChild(c);
506
+ clearContent(container) {
507
+ if (container) {
508
+ Array.from(container.children).forEach(child => {
509
+ container.removeChild(child);
501
510
  });
502
511
  }
503
512
  }
@@ -541,7 +550,7 @@ export class SnkApplication {
541
550
  });
542
551
  }
543
552
  render() {
544
- return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() })));
553
+ return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "col col--sd-3", closeOutsideClick: true })));
545
554
  }
546
555
  static get is() { return "snk-application"; }
547
556
  static get encapsulation() { return "scoped"; }
@@ -806,6 +815,44 @@ export class SnkApplication {
806
815
  "tags": []
807
816
  }
808
817
  },
818
+ "showModal": {
819
+ "complexType": {
820
+ "signature": "(content: HTMLElement) => Promise<void>",
821
+ "parameters": [{
822
+ "tags": [],
823
+ "text": ""
824
+ }],
825
+ "references": {
826
+ "Promise": {
827
+ "location": "global"
828
+ },
829
+ "HTMLElement": {
830
+ "location": "global"
831
+ }
832
+ },
833
+ "return": "Promise<void>"
834
+ },
835
+ "docs": {
836
+ "text": "",
837
+ "tags": []
838
+ }
839
+ },
840
+ "closeModal": {
841
+ "complexType": {
842
+ "signature": "() => Promise<void>",
843
+ "parameters": [],
844
+ "references": {
845
+ "Promise": {
846
+ "location": "global"
847
+ }
848
+ },
849
+ "return": "Promise<void>"
850
+ },
851
+ "docs": {
852
+ "text": "",
853
+ "tags": []
854
+ }
855
+ },
809
856
  "closePopUp": {
810
857
  "complexType": {
811
858
  "signature": "() => Promise<void>",
@@ -152,7 +152,7 @@ export class SnkCrud {
152
152
  }
153
153
  },
154
154
  "statusResolver": {
155
- "type": "any",
155
+ "type": "unknown",
156
156
  "mutable": false,
157
157
  "complexType": {
158
158
  "original": "IStatusResolver",
@@ -169,9 +169,7 @@ export class SnkCrud {
169
169
  "docs": {
170
170
  "tags": [],
171
171
  "text": "Configura\u00E7\u00E3o do valor da coluna de status.\nExemplo: { \"RECDESP\": { \"-1\" : \"#BD0025\", \"1\" : \"#157A00\" } }"
172
- },
173
- "attribute": "status-resolver",
174
- "reflect": false
172
+ }
175
173
  }
176
174
  };
177
175
  }
@@ -9,10 +9,6 @@ export class SnkDataUnit {
9
9
  * Determina quantas linhas são retornadas por página
10
10
  */
11
11
  this.pageSize = 150;
12
- /**
13
- * Quando ativada essa propriedade faz com que haja uma carga imediata no DataUnit
14
- */
15
- this.autoLoad = true;
16
12
  this._dataUnitObserver = (action) => {
17
13
  const duState = {
18
14
  insertionMode: false,
@@ -234,11 +230,6 @@ export class SnkDataUnit {
234
230
  while (resolver = this._onDataUnitResolve.pop()) {
235
231
  resolver(this.dataUnit);
236
232
  }
237
- if (this.autoLoad) {
238
- setTimeout(() => {
239
- this.dataUnit.loadData();
240
- }, 500); //TODO: Ajustar para aguardar filterProvider do dataunit estar pronto.
241
- }
242
233
  }
243
234
  }
244
235
  }
@@ -402,24 +393,6 @@ export class SnkDataUnit {
402
393
  "tags": [],
403
394
  "text": "Executado ap\u00F3s a a\u00E7\u00E3o de salvar"
404
395
  }
405
- },
406
- "autoLoad": {
407
- "type": "boolean",
408
- "mutable": false,
409
- "complexType": {
410
- "original": "boolean",
411
- "resolved": "boolean",
412
- "references": {}
413
- },
414
- "required": false,
415
- "optional": false,
416
- "docs": {
417
- "tags": [],
418
- "text": "Quando ativada essa propriedade faz com que haja uma carga imediata no DataUnit"
419
- },
420
- "attribute": "auto-load",
421
- "reflect": false,
422
- "defaultValue": "true"
423
396
  }
424
397
  };
425
398
  }
@@ -0,0 +1,100 @@
1
+ import { DataType } from "@sankhyalabs/core";
2
+ import { toString } from "@sankhyalabs/core/dist/dataunit/metadata/DataType";
3
+ import FilterItemType from "../filter-item-type.enum";
4
+ const buildFilter = (item) => {
5
+ switch (item.type) {
6
+ case FilterItemType.DEFAULT_FILTER:
7
+ return buildDefault(item);
8
+ case FilterItemType.BINARY_SELECT:
9
+ return buildBinary(item);
10
+ case FilterItemType.MULTI_SELECT:
11
+ return buildMultSelect(item);
12
+ case FilterItemType.PERIOD:
13
+ return buildPeriod(item);
14
+ case FilterItemType.SEARCH:
15
+ return buildSearch(item);
16
+ case FilterItemType.TEXT:
17
+ return buildText(item);
18
+ case FilterItemType.NUMBER:
19
+ return buildNumber(item);
20
+ case FilterItemType.PERSONALIZED:
21
+ return buildPersonalized(item);
22
+ default:
23
+ return undefined;
24
+ }
25
+ };
26
+ export default buildFilter;
27
+ function buildDefault(item) {
28
+ return { name: item.id, expression: item.props.expression, params: [] };
29
+ }
30
+ function buildBinary(item) {
31
+ const { id, value, props } = item;
32
+ const options = props.options;
33
+ const selectedOption = options.find(opt => opt.name === value);
34
+ return { name: id, expression: selectedOption.expression, params: [] };
35
+ }
36
+ function buildMultSelect(item) {
37
+ const { id, value, props } = item;
38
+ return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
39
+ }
40
+ function buildPeriod(item) {
41
+ const { id, value, props } = item;
42
+ let { end, start } = value;
43
+ if (typeof end === "string") {
44
+ end = new Date(end);
45
+ }
46
+ if (typeof start === "string") {
47
+ start = new Date(start);
48
+ }
49
+ const params = [];
50
+ let expression;
51
+ if (end && start) {
52
+ expression = props.expression.fullfill;
53
+ params.push({ name: `${id}.START`, dataType: DataType.DATE, value: toString(DataType.DATE, start) }, { name: `${id}.END`, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
54
+ }
55
+ else {
56
+ if (start) {
57
+ expression = props.expression.onlystart;
58
+ params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, start) });
59
+ }
60
+ else {
61
+ expression = props.expression.onlyend;
62
+ params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
63
+ }
64
+ }
65
+ return { name: id, expression, params };
66
+ }
67
+ function buildSearch(item) {
68
+ const { id, value, props } = item;
69
+ const expression = props.expression;
70
+ return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value.value) }] };
71
+ }
72
+ function buildText(item) {
73
+ const { id, value, props } = item;
74
+ const expression = props.expression;
75
+ return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value) }] };
76
+ }
77
+ function buildNumber(item) {
78
+ const { id, value, props } = item;
79
+ const expression = props.expression;
80
+ return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
81
+ }
82
+ function buildPersonalized(item) {
83
+ var _a;
84
+ const { id, value, props } = item;
85
+ const expression = props.expression;
86
+ return {
87
+ name: id, expression, params: (((_a = props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || []).map((param, index) => {
88
+ const valuesArray = Array.from(value);
89
+ const dataType = param.dataType;
90
+ let paramValue = (index >= 0 && index < valuesArray.length ? valuesArray[index] : null);
91
+ if (paramValue != undefined && typeof paramValue === "object" && "value" in paramValue) {
92
+ paramValue = paramValue["value"];
93
+ }
94
+ if (paramValue == undefined && dataType === DataType.BOOLEAN) {
95
+ paramValue = false;
96
+ }
97
+ return { name: param.name, dataType, value: typeof paramValue === "string" ? paramValue : toString(dataType, paramValue) };
98
+ })
99
+ };
100
+ }