@sankhyalabs/sankhyablocks 1.3.31-beta.17 → 1.3.31-beta.19

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 (107) hide show
  1. package/dist/cjs/{SnkMessageBuilder-cb132e6d.js → SnkMessageBuilder-02c2ca02.js} +7 -3
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  4. package/dist/cjs/snk-application.cjs.entry.js +405 -265
  5. package/dist/cjs/snk-crud.cjs.entry.js +2 -1
  6. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  7. package/dist/cjs/snk-filter-bar.cjs.entry.js +80 -14
  8. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-filter-detail.cjs.entry.js +7 -2
  10. package/dist/cjs/snk-filter-item.cjs.entry.js +13 -1
  11. package/dist/cjs/snk-filter-list.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +23 -0
  13. package/dist/cjs/snk-filter-number.cjs.entry.js +2 -1
  14. package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
  15. package/dist/cjs/snk-form.cjs.entry.js +19 -1
  16. package/dist/cjs/snk-grid.cjs.entry.js +15 -5
  17. package/dist/cjs/snk-taskbar.cjs.entry.js +14 -11
  18. package/dist/cjs/{taskbar-elements-efa44ff1.js → taskbar-elements-283c737e.js} +36 -17
  19. package/dist/cjs/taskbar-processor-6bd0d35c.js +47 -0
  20. package/dist/collection/collection-manifest.json +1 -0
  21. package/dist/collection/components/snk-application/snk-application.js +23 -3
  22. package/dist/collection/components/snk-crud/snk-crud.js +41 -3
  23. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
  24. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +64 -0
  25. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +2 -1
  26. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +1 -1
  27. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +7 -2
  28. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +36 -1
  29. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +53 -2
  30. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +15 -0
  31. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +79 -13
  32. package/dist/collection/components/snk-form/snk-form.js +41 -1
  33. package/dist/collection/components/snk-grid/snk-grid.js +35 -3
  34. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +35 -17
  35. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +43 -0
  36. package/dist/collection/components/snk-taskbar/snk-taskbar.js +36 -11
  37. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +6 -6
  38. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +375 -255
  39. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +7 -3
  40. package/dist/components/SnkMessageBuilder.js +7 -3
  41. package/dist/components/index.d.ts +1 -0
  42. package/dist/components/index.js +1 -0
  43. package/dist/components/snk-application2.js +404 -264
  44. package/dist/components/snk-crud.js +4 -2
  45. package/dist/components/snk-filter-bar2.js +80 -14
  46. package/dist/components/snk-filter-binary-select.js +1 -1
  47. package/dist/components/snk-filter-detail2.js +7 -2
  48. package/dist/components/snk-filter-item2.js +15 -2
  49. package/dist/components/snk-filter-list2.js +5 -2
  50. package/dist/components/snk-filter-multi-select.d.ts +11 -0
  51. package/dist/components/snk-filter-multi-select.js +39 -0
  52. package/dist/components/snk-filter-number.js +2 -1
  53. package/dist/components/snk-filter-search.js +1 -1
  54. package/dist/components/snk-form2.js +20 -1
  55. package/dist/components/snk-grid2.js +15 -4
  56. package/dist/components/snk-taskbar2.js +49 -27
  57. package/dist/components/taskbar-processor.js +45 -0
  58. package/dist/{sankhyablocks/SnkMessageBuilder-cff80920.js → esm/SnkMessageBuilder-65d431bd.js} +7 -3
  59. package/dist/esm/loader.js +1 -1
  60. package/dist/esm/sankhyablocks.js +1 -1
  61. package/dist/esm/snk-application.entry.js +405 -265
  62. package/dist/esm/snk-crud.entry.js +3 -2
  63. package/dist/esm/snk-data-unit.entry.js +1 -1
  64. package/dist/esm/snk-filter-bar.entry.js +80 -14
  65. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  66. package/dist/esm/snk-filter-detail.entry.js +7 -2
  67. package/dist/esm/snk-filter-item.entry.js +13 -1
  68. package/dist/esm/snk-filter-list.entry.js +2 -2
  69. package/dist/esm/snk-filter-multi-select.entry.js +19 -0
  70. package/dist/esm/snk-filter-number.entry.js +2 -1
  71. package/dist/esm/snk-filter-search.entry.js +1 -1
  72. package/dist/esm/snk-form.entry.js +19 -1
  73. package/dist/esm/snk-grid.entry.js +15 -5
  74. package/dist/esm/snk-taskbar.entry.js +14 -11
  75. package/dist/esm/taskbar-elements-35d64ff9.js +90 -0
  76. package/dist/esm/taskbar-processor-aa6772c9.js +45 -0
  77. package/dist/{esm/SnkMessageBuilder-cff80920.js → sankhyablocks/SnkMessageBuilder-65d431bd.js} +7 -3
  78. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  79. package/dist/sankhyablocks/snk-application.entry.js +405 -265
  80. package/dist/sankhyablocks/snk-crud.entry.js +3 -2
  81. package/dist/sankhyablocks/snk-data-unit.entry.js +1 -1
  82. package/dist/sankhyablocks/snk-filter-bar.entry.js +80 -14
  83. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +1 -1
  84. package/dist/sankhyablocks/snk-filter-detail.entry.js +7 -2
  85. package/dist/sankhyablocks/snk-filter-item.entry.js +13 -1
  86. package/dist/sankhyablocks/snk-filter-list.entry.js +2 -2
  87. package/dist/sankhyablocks/snk-filter-multi-select.entry.js +19 -0
  88. package/dist/sankhyablocks/snk-filter-number.entry.js +2 -1
  89. package/dist/sankhyablocks/snk-filter-search.entry.js +1 -1
  90. package/dist/sankhyablocks/snk-form.entry.js +19 -1
  91. package/dist/sankhyablocks/snk-grid.entry.js +15 -5
  92. package/dist/sankhyablocks/snk-taskbar.entry.js +14 -11
  93. package/dist/sankhyablocks/taskbar-elements-35d64ff9.js +90 -0
  94. package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +45 -0
  95. package/dist/types/components/snk-application/snk-application.d.ts +5 -3
  96. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +7 -0
  97. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +1 -0
  98. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +3 -0
  99. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +6 -3
  100. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +3 -2
  101. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +12 -0
  102. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +17 -1
  103. package/dist/types/components.d.ts +78 -2
  104. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  105. package/package.json +1 -1
  106. package/dist/esm/taskbar-elements-c119510a.js +0 -72
  107. package/dist/sankhyablocks/taskbar-elements-c119510a.js +0 -72
@@ -10,6 +10,7 @@
10
10
  "./components/snk-filter-bar/snk-filter-bar.js",
11
11
  "./components/snk-filter-bar/filter-item/snk-filter-detail.js",
12
12
  "./components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js",
13
+ "./components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js",
13
14
  "./components/snk-filter-bar/filter-item/editors/snk-filter-number.js",
14
15
  "./components/snk-filter-bar/filter-item/editors/snk-filter-search.js",
15
16
  "./components/snk-filter-bar/filter-item/editors/snk-filter-text.js",
@@ -1332,17 +1332,24 @@ export class SnkApplication {
1332
1332
  class RequestListenerLoadingBar {
1333
1333
  constructor() {
1334
1334
  this._debounceTime = 1000;
1335
+ this._ignoredNameTypes = ["totals"];
1335
1336
  this._countRequest = 0;
1336
1337
  }
1337
- onRequestStart() {
1338
- this.loadingBar.show();
1338
+ onRequestStart(param) {
1339
+ if (this.isIgnoreLoadingOnRequest(param)) {
1340
+ return;
1341
+ }
1339
1342
  this._countRequest++;
1343
+ this.loadingBar.show();
1340
1344
  if (this._timerLoading) {
1341
1345
  clearTimeout(this._timerLoading);
1342
1346
  }
1343
1347
  }
1344
1348
  ;
1345
- onRequestEnd() {
1349
+ onRequestEnd(param) {
1350
+ if (this.isIgnoreLoadingOnRequest(param)) {
1351
+ return;
1352
+ }
1346
1353
  this._countRequest--;
1347
1354
  this._timerLoading = setTimeout(() => {
1348
1355
  if (this._countRequest <= 0) {
@@ -1351,6 +1358,19 @@ class RequestListenerLoadingBar {
1351
1358
  }, this._debounceTime);
1352
1359
  }
1353
1360
  ;
1361
+ isIgnoreLoadingOnRequest(param) {
1362
+ var _a;
1363
+ if (((_a = param === null || param === void 0 ? void 0 : param.requestBody) === null || _a === void 0 ? void 0 : _a.length) == 1) {
1364
+ const { name } = param.requestBody[0].variables;
1365
+ if (name) {
1366
+ const nameParts = name.split(":");
1367
+ const nameType = nameParts[0];
1368
+ return this._ignoredNameTypes.indexOf(nameType) >= 0;
1369
+ }
1370
+ }
1371
+ return false;
1372
+ }
1373
+ ;
1354
1374
  }
1355
1375
  class PendingPromise {
1356
1376
  constructor(resolve, reject) {
@@ -50,7 +50,7 @@ export class SnkCrud {
50
50
  }
51
51
  }
52
52
  render() {
53
- return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, h("stack-item", null, h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }))), h("stack-item", null, h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE), recordsValidator: this.recordsValidator, onActionClick: evt => this.executeAction(evt.detail) }))));
53
+ return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, h("stack-item", null, h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" })))));
54
54
  }
55
55
  static get is() { return "snk-crud"; }
56
56
  static get encapsulation() { return "scoped"; }
@@ -78,7 +78,7 @@ export class SnkCrud {
78
78
  "optional": false,
79
79
  "docs": {
80
80
  "tags": [],
81
- "text": ""
81
+ "text": "Usado para salvar as configura\u00E7\u00F5es dos blocos de constru\u00E7\u00E3o."
82
82
  },
83
83
  "attribute": "config-name",
84
84
  "reflect": false
@@ -103,7 +103,27 @@ export class SnkCrud {
103
103
  "optional": false,
104
104
  "docs": {
105
105
  "tags": [],
106
- "text": ""
106
+ "text": "A\u00E7\u00F5es a serem colocadas no bot\u00E3o \"Mais op\u00E7\u00F5es\"."
107
+ }
108
+ },
109
+ "taskbarManager": {
110
+ "type": "unknown",
111
+ "mutable": false,
112
+ "complexType": {
113
+ "original": "TaskbarManager",
114
+ "resolved": "TaskbarManager",
115
+ "references": {
116
+ "TaskbarManager": {
117
+ "location": "import",
118
+ "path": "../snk-taskbar/snk-taskbar"
119
+ }
120
+ }
121
+ },
122
+ "required": false,
123
+ "optional": false,
124
+ "docs": {
125
+ "tags": [],
126
+ "text": "Gerenciador das barras de tarefas. \u00C9 poss\u00EDvel determinar bot\u00F5es espec\u00EDficos\nou mesmo gerenciar o estado dos bot\u00F5es."
107
127
  }
108
128
  },
109
129
  "recordsValidator": {
@@ -134,5 +154,23 @@ export class SnkCrud {
134
154
  "_dataState": {}
135
155
  };
136
156
  }
157
+ static get events() {
158
+ return [{
159
+ "method": "actionClick",
160
+ "name": "actionClick",
161
+ "bubbles": true,
162
+ "cancelable": true,
163
+ "composed": true,
164
+ "docs": {
165
+ "tags": [],
166
+ "text": "Emitido pela taskbar sempre que houver click de bot\u00E3o ou a\u00E7\u00E3o"
167
+ },
168
+ "complexType": {
169
+ "original": "string",
170
+ "resolved": "string",
171
+ "references": {}
172
+ }
173
+ }];
174
+ }
137
175
  static get elementRef() { return "_element"; }
138
176
  }
@@ -2,7 +2,7 @@ import { h, Host } from '@stencil/core';
2
2
  import FilterItemType from '../filter-item-type.enum';
3
3
  export class SnkFilterBinarySelect {
4
4
  isSelected(option) {
5
- return this.config.value == undefined || this.config.value === option;
5
+ return this.value == undefined || this.value === option;
6
6
  }
7
7
  ezChangeListener(evt) {
8
8
  if (!evt.detail) {
@@ -0,0 +1,64 @@
1
+ import { h } from '@stencil/core';
2
+ import FilterItemType from '../filter-item-type.enum';
3
+ export class SnkFilterMultiSelect {
4
+ ezChangeListener(evt) {
5
+ this.value = evt.detail.value;
6
+ }
7
+ render() {
8
+ if (!this.config || this.config.type !== FilterItemType.MULTI_SELECT) {
9
+ return undefined;
10
+ }
11
+ return (h("ez-combo-box", { label: this.config.label, value: this.config.value, options: this.config.props.options }));
12
+ }
13
+ static get is() { return "snk-filter-multi-select"; }
14
+ static get properties() {
15
+ return {
16
+ "value": {
17
+ "type": "any",
18
+ "mutable": true,
19
+ "complexType": {
20
+ "original": "any",
21
+ "resolved": "any",
22
+ "references": {}
23
+ },
24
+ "required": false,
25
+ "optional": false,
26
+ "docs": {
27
+ "tags": [],
28
+ "text": ""
29
+ },
30
+ "attribute": "value",
31
+ "reflect": true
32
+ },
33
+ "config": {
34
+ "type": "unknown",
35
+ "mutable": false,
36
+ "complexType": {
37
+ "original": "SnkFilterItemConfig",
38
+ "resolved": "SnkFilterItemConfig",
39
+ "references": {
40
+ "SnkFilterItemConfig": {
41
+ "location": "import",
42
+ "path": "../snk-filter-item"
43
+ }
44
+ }
45
+ },
46
+ "required": false,
47
+ "optional": false,
48
+ "docs": {
49
+ "tags": [],
50
+ "text": ""
51
+ }
52
+ }
53
+ };
54
+ }
55
+ static get listeners() {
56
+ return [{
57
+ "name": "ezChange",
58
+ "method": "ezChangeListener",
59
+ "target": undefined,
60
+ "capture": false,
61
+ "passive": false
62
+ }];
63
+ }
64
+ }
@@ -5,10 +5,11 @@ export class SnkFilterPeriod {
5
5
  this.value = evt.detail;
6
6
  }
7
7
  render() {
8
+ var _a;
8
9
  if (!this.config || this.config.type !== FilterItemType.NUMBER) {
9
10
  return undefined;
10
11
  }
11
- return (h("ez-number-input", { label: this.config.label, value: this.config.value }));
12
+ return (h("ez-number-input", { label: this.config.label, value: this.config.value, precision: (_a = this.config.props) === null || _a === void 0 ? void 0 : _a.precision }));
12
13
  }
13
14
  static get is() { return "snk-filter-number"; }
14
15
  static get properties() {
@@ -29,7 +29,7 @@ export class SnkFilterSearch {
29
29
  if (!this.config || this.config.type !== FilterItemType.SEARCH) {
30
30
  return undefined;
31
31
  }
32
- return (h("ez-search", { value: this.config.value, label: this.config.label, ref: ref => this._searchInput = ref, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument) }));
32
+ return (h("ez-search", { suppressEmptyOption: true, value: this.config.value, label: this.config.label, ref: ref => this._searchInput = ref, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument) }));
33
33
  }
34
34
  static get is() { return "snk-filter-search"; }
35
35
  static get properties() {
@@ -8,6 +8,8 @@ export class SnkFilterDetail {
8
8
  switch (this.config.type) {
9
9
  case FilterItemType.BINARY_SELECT:
10
10
  return "snk-filter-binary-select";
11
+ case FilterItemType.MULTI_SELECT:
12
+ return "snk-filter-multi-select";
11
13
  case FilterItemType.PERIOD:
12
14
  return "snk-filter-period";
13
15
  case FilterItemType.SEARCH:
@@ -17,18 +19,21 @@ export class SnkFilterDetail {
17
19
  }
18
20
  return "snk-filter-text";
19
21
  }
22
+ removeItem() {
23
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: undefined }));
24
+ }
20
25
  getPopUpHeaderButtons() {
21
26
  if (this.config.hardFixed) {
22
27
  return undefined;
23
28
  }
24
29
  return ([
25
- h("ez-icon", { title: this.getMessage("snkFilterBar.removeFilter"), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: "delete", onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false })) }),
30
+ h("ez-icon", { title: this.getMessage("snkFilterBar.removeFilter"), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: "delete", onClick: () => this.removeItem() }),
26
31
  h("ez-icon", { title: this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), class: "ez-margin-left--small sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: this.config.fixed ? "un-pin" : "push-pin", onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })) })
27
32
  ]);
28
33
  }
29
34
  render() {
30
35
  const ContentEditor = this.getContentEditor();
31
- return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, 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()), h(ContentEditor, { ref: ref => this._editor = ref, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined })) }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: this._editor["value"] })), class: "ez-button--primary ez-padding-left--medium" }))));
36
+ return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, 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()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined })) }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: this._editor["value"] })), class: "ez-button--primary ez-padding-left--medium" }))));
32
37
  }
33
38
  static get is() { return "snk-filter-detail"; }
34
39
  static get properties() {
@@ -22,6 +22,14 @@ export class SnkFilterItem {
22
22
  return false;
23
23
  };
24
24
  }
25
+ async showUp(open = false) {
26
+ this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
27
+ if (open) {
28
+ window.requestAnimationFrame(() => {
29
+ this.showDetail();
30
+ });
31
+ }
32
+ }
25
33
  showDetail() {
26
34
  this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
27
35
  this.detailIsVisible = true;
@@ -76,6 +84,10 @@ export class SnkFilterItem {
76
84
  return optTwo.label;
77
85
  }
78
86
  }
87
+ if (type === FilterItemType.MULTI_SELECT) {
88
+ const opt = props.options.find(opt => opt.value === value);
89
+ return `${label}: ${opt.label}`;
90
+ }
79
91
  if (type === FilterItemType.PERIOD) {
80
92
  const period = value;
81
93
  const dateFormater = new Intl.DateTimeFormat("pt-BR");
@@ -84,7 +96,7 @@ export class SnkFilterItem {
84
96
  }
85
97
  else {
86
98
  if (period.start) {
87
- return `${label}: A partir de ${dateFormater.format(period.end)}`;
99
+ return `${label}: A partir de ${dateFormater.format(period.start)}`;
88
100
  }
89
101
  else {
90
102
  return `${label}: Até ${dateFormater.format(period.end)}`;
@@ -184,6 +196,29 @@ export class SnkFilterItem {
184
196
  }
185
197
  }];
186
198
  }
199
+ static get methods() {
200
+ return {
201
+ "showUp": {
202
+ "complexType": {
203
+ "signature": "(open?: boolean) => Promise<void>",
204
+ "parameters": [{
205
+ "tags": [],
206
+ "text": ""
207
+ }],
208
+ "references": {
209
+ "Promise": {
210
+ "location": "global"
211
+ }
212
+ },
213
+ "return": "Promise<void>"
214
+ },
215
+ "docs": {
216
+ "text": "",
217
+ "tags": []
218
+ }
219
+ }
220
+ };
221
+ }
187
222
  static get elementRef() { return "_filterItemElement"; }
188
223
  static get listeners() {
189
224
  return [{
@@ -63,7 +63,7 @@ export class SnkFilterList {
63
63
  getFilterItems() {
64
64
  const items = this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items.filter(item => item.kind === "FILTER")) : [];
65
65
  if (items.length === 0) {
66
- return h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty" }, this.getMessage("snkFilterBar.emptyFilterList"));
66
+ return h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty" }, this.emptyText);
67
67
  }
68
68
  const hideItems = !this._filterArgument && !this._showAll && (items.length > MAX_FILTERS + 1);
69
69
  if (hideItems) {
@@ -76,7 +76,7 @@ export class SnkFilterList {
76
76
  return this.items.filter(item => item.kind === "FOOTER");
77
77
  }
78
78
  render() {
79
- return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.getMessage("snkFilterBar.findFilter"), value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
79
+ return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
80
80
  }
81
81
  static get is() { return "snk-filter-list"; }
82
82
  static get properties() {
@@ -151,6 +151,57 @@ export class SnkFilterList {
151
151
  "tags": [],
152
152
  "text": ""
153
153
  }
154
+ },
155
+ "emptyText": {
156
+ "type": "string",
157
+ "mutable": false,
158
+ "complexType": {
159
+ "original": "string",
160
+ "resolved": "string",
161
+ "references": {}
162
+ },
163
+ "required": false,
164
+ "optional": false,
165
+ "docs": {
166
+ "tags": [],
167
+ "text": ""
168
+ },
169
+ "attribute": "empty-text",
170
+ "reflect": false
171
+ },
172
+ "findFilterText": {
173
+ "type": "string",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "string",
177
+ "resolved": "string",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": ""
185
+ },
186
+ "attribute": "find-filter-text",
187
+ "reflect": false
188
+ },
189
+ "buttonClass": {
190
+ "type": "string",
191
+ "mutable": false,
192
+ "complexType": {
193
+ "original": "string",
194
+ "resolved": "string",
195
+ "references": {}
196
+ },
197
+ "required": false,
198
+ "optional": false,
199
+ "docs": {
200
+ "tags": [],
201
+ "text": ""
202
+ },
203
+ "attribute": "button-class",
204
+ "reflect": false
154
205
  }
155
206
  };
156
207
  }
@@ -96,4 +96,19 @@
96
96
  justify-content: center;
97
97
  align-self: center;
98
98
  align-items: center;
99
+ }
100
+
101
+ .snk-filter-bar__filter-list-items-button--active{
102
+ position: relative;
103
+ }
104
+ .snk-filter-bar__filter-list-items-button--active::after{
105
+ display: flex;
106
+ position: absolute;
107
+ content: "";
108
+ width: 8px;
109
+ height: 8px;
110
+ top: 7px;
111
+ left: 17px;
112
+ background-color: var(--icon--alert--color, #008561);
113
+ border-radius: 50%;
99
114
  }
@@ -4,6 +4,7 @@ import FilterItemType from './filter-item/filter-item-type.enum';
4
4
  import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
5
5
  const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
6
6
  const DEFAULT_FILTER = "DEFAULT_FILTER";
7
+ const CLEAR_ALL_FILTERS = "CLEAR_ALL_FILTERS";
7
8
  export class SnkFilterBar {
8
9
  constructor() {
9
10
  this._updateSequence = [];
@@ -49,6 +50,9 @@ export class SnkFilterBar {
49
50
  //FIXME: ajustar o backend para não exigir parametros
50
51
  return { name: id, expression: selectedOption.expression, params: [] };
51
52
  }
53
+ if (type === FilterItemType.MULTI_SELECT) {
54
+ return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
55
+ }
52
56
  if (type === FilterItemType.PERIOD) {
53
57
  const { end, start } = value;
54
58
  const params = [];
@@ -120,11 +124,11 @@ export class SnkFilterBar {
120
124
  getFilterItems() {
121
125
  const pinnedItems = [];
122
126
  const unpinnedItems = [];
123
- this._items = this.filterConfig
127
+ this.filterConfig
124
128
  .filter(item => item.visible)
125
129
  .sort((a, b) => this._filtersComparator(a, b))
126
- .map((item, index) => {
127
- const filterItem = (h("snk-filter-item", { config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
130
+ .forEach((item, index) => {
131
+ const filterItem = (h("snk-filter-item", { id: `filter-${item.id}`, config: this.normalizeItem(item), class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
128
132
  if (item.fixed || item.hardFixed) {
129
133
  pinnedItems.push(filterItem);
130
134
  }
@@ -142,25 +146,54 @@ export class SnkFilterBar {
142
146
  return elements;
143
147
  }
144
148
  calculateUpdateSequence(item) {
145
- this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
146
- this._updateSequence.push(item.id);
149
+ if (item) {
150
+ this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
151
+ this._updateSequence.push(item.id);
152
+ }
147
153
  }
148
154
  filterChangeListener(evt) {
149
155
  this.updateFilter(evt.detail);
150
156
  }
151
- updateFilter(newItem) {
152
- this.calculateUpdateSequence(newItem);
153
- let needRefresh = false;
157
+ normalizeItem(item) {
158
+ const normalized = Object.assign({}, item);
159
+ const optionals = ["props", "value", "hardFixed", "fixed"];
160
+ optionals.forEach(prop => {
161
+ if (normalized[prop] == undefined) {
162
+ delete normalized[prop];
163
+ }
164
+ });
165
+ if (item.value === "") {
166
+ delete item.value;
167
+ }
168
+ return normalized;
169
+ }
170
+ updateFilter(newItem, clear = false) {
171
+ let upToDate = false;
154
172
  this.filterConfig = this.filterConfig.map(item => {
155
- if (item.id === newItem.id) {
156
- needRefresh = ObjectUtils.objectToString(item.value) !== ObjectUtils.objectToString(newItem.value);
157
- return newItem;
173
+ if (clear) {
174
+ if (item.value != undefined) {
175
+ this.calculateUpdateSequence(item);
176
+ upToDate = true;
177
+ }
178
+ return Object.assign(Object.assign({}, item), { value: undefined });
179
+ }
180
+ else {
181
+ if (item.id === newItem.id) {
182
+ const normalizedOne = this.normalizeItem(item);
183
+ const normalizedTwo = this.normalizeItem(newItem);
184
+ if (ObjectUtils.objectToString(normalizedOne) != ObjectUtils.objectToString(normalizedTwo)) {
185
+ this.calculateUpdateSequence(item);
186
+ }
187
+ upToDate = ObjectUtils.objectToString(normalizedOne.value) !== ObjectUtils.objectToString(normalizedTwo.value);
188
+ return newItem;
189
+ }
158
190
  }
159
191
  return item;
160
192
  });
161
- if (needRefresh) {
193
+ if (upToDate) {
162
194
  this.dataUnit.loadData();
163
195
  }
196
+ return upToDate;
164
197
  }
165
198
  getAddListItems() {
166
199
  const hiddenItems = this.filterConfig
@@ -173,17 +206,50 @@ export class SnkFilterBar {
173
206
  { name: DEFAULT_FILTER, label: this.getMessage("snkFilterBar.defaultFilter"), iconName: "configuration", kind: "FOOTER" }
174
207
  ]);
175
208
  }
209
+ getActiveClass() {
210
+ const filterApplied = this.filterConfig.filter(item => item.value != undefined).length > 0;
211
+ return filterApplied ? "sc-snk-filter-bar snk-filter-bar__filter-list-items-button--active" : "";
212
+ }
213
+ getAppliedListItems() {
214
+ const appliedItems = this.filterConfig
215
+ .filter(item => item.value != undefined)
216
+ .sort(this._filtersComparator);
217
+ return appliedItems.map(filter => {
218
+ return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
219
+ }).concat([
220
+ { name: CLEAR_ALL_FILTERS, label: this.getMessage("snkFilterBar.clearAllFilters"), iconName: "cleaning", kind: "FOOTER" }
221
+ ]);
222
+ }
176
223
  addFilterHandler(itemName) {
177
224
  const filterItem = this.filterConfig.find(currentFilter => currentFilter.id === itemName);
178
225
  if (filterItem) {
179
226
  this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
227
+ window.requestAnimationFrame(() => {
228
+ const itemElement = this._element.querySelector("#filter-" + itemName);
229
+ if (itemElement) {
230
+ itemElement.showUp();
231
+ }
232
+ });
233
+ }
234
+ }
235
+ appliedFilterHandler(itemName) {
236
+ if (itemName === CLEAR_ALL_FILTERS) {
237
+ if (this.updateFilter(null, true)) {
238
+ this._application.info(this.getMessage("snkFilterBar.successfullyCleaned"), { iconName: "check" });
239
+ }
240
+ }
241
+ else {
242
+ const itemElement = this._element.querySelector("#filter-" + itemName);
243
+ if (itemElement) {
244
+ itemElement.showUp(true);
245
+ }
180
246
  }
181
247
  }
182
248
  render() {
183
249
  if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
184
250
  return undefined;
185
251
  }
186
- return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("ez-button", { mode: "icon", size: "small", iconName: "filter", class: "ez-padding-left--medium" }), h("snk-filter-list", { items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
252
+ return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("snk-filter-list", { items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail) }), h("snk-filter-list", { items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
187
253
  }
188
254
  static get is() { return "snk-filter-bar"; }
189
255
  static get encapsulation() { return "scoped"; }
@@ -1,6 +1,13 @@
1
1
  import { ApplicationContext } from '@sankhyalabs/core';
2
2
  import { h } from '@stencil/core';
3
+ import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
3
4
  export class SnkForm {
5
+ constructor() {
6
+ this._taskbarProcessor = new TaskbarProcessor({
7
+ "snkForm.regular": ["PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "GRID_MODE", "INSERT"],
8
+ "snkForm.finish_edition": ["CANCEL", "SAVE"]
9
+ });
10
+ }
4
11
  getFormConfig() {
5
12
  return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
6
13
  }
@@ -90,11 +97,24 @@ export class SnkForm {
90
97
  parent = parent.parentElement;
91
98
  }
92
99
  }
100
+ componentWillRender() {
101
+ var _a;
102
+ const taskbarId = ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "snkForm.finish_edition" : "snkForm.regular";
103
+ const disabledButtons = [];
104
+ if (!this._dataState || !this._dataState.hasPrevious) {
105
+ disabledButtons.push("PREVIOUS");
106
+ }
107
+ if (!this._dataState || !this._dataState.hasNext) {
108
+ disabledButtons.push("NEXT");
109
+ }
110
+ this._taskbarProcessor.process(taskbarId, this.taskbarManager, this._dataState, disabledButtons);
111
+ }
93
112
  render() {
113
+ var _a;
94
114
  if (!this._configLoaded || !this._dataUnit || !this._dataState) {
95
115
  return undefined;
96
116
  }
97
- return (h("section", { class: "snk-form" }, h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, h("snk-taskbar", { key: "formTaskbar", buttons: this._dataState.isDirty ? "CANCEL,SAVE" : "PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,INSERT", primaryButton: this._dataState.isDirty ? "SAVE" : "INSERT", disabledButtons: this.getDisabledButtons(), actionsList: this.actionsList, dataUnit: this._dataUnit }))), h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator }))))));
117
+ return (h("section", { class: "snk-form" }, h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, h("snk-taskbar", { key: "formTaskbar", buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, primaryButton: ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", dataUnit: this._dataUnit }))), h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator }))))));
98
118
  }
99
119
  static get is() { return "snk-form"; }
100
120
  static get encapsulation() { return "scoped"; }
@@ -169,6 +189,26 @@ export class SnkForm {
169
189
  "tags": [],
170
190
  "text": "Lista de a\u00E7\u00F5es que devem ser usadas no bot\u00E3o \"Mais op\u00E7\u00F5es\""
171
191
  }
192
+ },
193
+ "taskbarManager": {
194
+ "type": "unknown",
195
+ "mutable": false,
196
+ "complexType": {
197
+ "original": "TaskbarManager",
198
+ "resolved": "TaskbarManager",
199
+ "references": {
200
+ "TaskbarManager": {
201
+ "location": "import",
202
+ "path": "../snk-taskbar/snk-taskbar"
203
+ }
204
+ }
205
+ },
206
+ "required": false,
207
+ "optional": false,
208
+ "docs": {
209
+ "tags": [],
210
+ "text": "Gerenciador das barras de tarefas. \u00C9 poss\u00EDvel determinar bot\u00F5es espec\u00EDficos\nou mesmo gerenciar o estado dos bot\u00F5es."
211
+ }
172
212
  }
173
213
  };
174
214
  }