@sankhyalabs/sankhyablocks 1.4.0-beta.4 → 1.4.0-beta.6

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 (97) hide show
  1. package/dist/cjs/{SnkMessageBuilder-d8215915.js → SnkMessageBuilder-b54dfb89.js} +6 -1
  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 +9 -3
  5. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  6. package/dist/cjs/snk-filter-bar_5.cjs.entry.js +122 -36
  7. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +3 -0
  8. package/dist/cjs/snk-filter-detail.cjs.entry.js +14 -3
  9. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +4 -1
  10. package/dist/cjs/snk-filter-number.cjs.entry.js +4 -1
  11. package/dist/cjs/snk-filter-period.cjs.entry.js +3 -0
  12. package/dist/cjs/snk-filter-personalized.cjs.entry.js +14 -7
  13. package/dist/cjs/snk-filter-search.cjs.entry.js +3 -0
  14. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  15. package/dist/collection/components/snk-application/snk-application.js +12 -3
  16. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +23 -0
  17. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +24 -1
  18. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +24 -1
  19. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +23 -0
  20. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +34 -7
  21. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +23 -0
  22. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -1
  23. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +34 -3
  24. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +37 -15
  25. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +82 -8
  26. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +30 -5
  27. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +17 -4
  28. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +18 -8
  29. package/dist/collection/lib/index.js +1 -0
  30. package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
  31. package/dist/collection/lib/message/resources/crud-utils.msg.js +4 -0
  32. package/dist/collection/lib/utils/CrudUtils.js +73 -0
  33. package/dist/components/SnkMessageBuilder.js +6 -1
  34. package/dist/components/snk-application2.js +8 -2
  35. package/dist/components/snk-filter-bar2.js +19 -9
  36. package/dist/components/snk-filter-binary-select.js +5 -1
  37. package/dist/components/snk-filter-detail2.js +16 -4
  38. package/dist/components/snk-filter-item2.js +23 -16
  39. package/dist/components/snk-filter-list2.js +56 -10
  40. package/dist/components/snk-filter-modal2.js +30 -5
  41. package/dist/components/snk-filter-multi-select.js +6 -2
  42. package/dist/components/snk-filter-number.js +6 -2
  43. package/dist/components/snk-filter-period.js +5 -1
  44. package/dist/components/snk-filter-personalized.js +16 -8
  45. package/dist/components/snk-filter-search.js +5 -1
  46. package/dist/components/snk-filter-text.js +1 -1
  47. package/dist/esm/{SnkMessageBuilder-35a20271.js → SnkMessageBuilder-d440381c.js} +6 -1
  48. package/dist/esm/loader.js +1 -1
  49. package/dist/esm/sankhyablocks.js +1 -1
  50. package/dist/esm/snk-application.entry.js +9 -3
  51. package/dist/esm/snk-data-unit.entry.js +1 -1
  52. package/dist/esm/snk-filter-bar_5.entry.js +122 -36
  53. package/dist/esm/snk-filter-binary-select.entry.js +3 -0
  54. package/dist/esm/snk-filter-detail.entry.js +14 -3
  55. package/dist/esm/snk-filter-multi-select.entry.js +4 -1
  56. package/dist/esm/snk-filter-number.entry.js +4 -1
  57. package/dist/esm/snk-filter-period.entry.js +3 -0
  58. package/dist/esm/snk-filter-personalized.entry.js +14 -7
  59. package/dist/esm/snk-filter-search.entry.js +3 -0
  60. package/dist/esm/snk-filter-text.entry.js +1 -1
  61. package/dist/sankhyablocks/{p-01823784.entry.js → p-0ea25487.entry.js} +1 -1
  62. package/dist/sankhyablocks/{p-8bbc0cbb.entry.js → p-1a58f45c.entry.js} +2 -2
  63. package/dist/sankhyablocks/p-21e940aa.entry.js +1 -0
  64. package/dist/sankhyablocks/{p-8f3c5709.entry.js → p-2e49afef.entry.js} +1 -1
  65. package/dist/sankhyablocks/{p-586e2522.js → p-2eea7eea.js} +1 -1
  66. package/dist/sankhyablocks/p-40b27004.entry.js +1 -0
  67. package/dist/sankhyablocks/p-4574a955.entry.js +1 -0
  68. package/dist/sankhyablocks/p-49580cdd.entry.js +1 -0
  69. package/dist/sankhyablocks/p-5bdb8452.entry.js +1 -0
  70. package/dist/sankhyablocks/p-6386d720.entry.js +1 -0
  71. package/dist/sankhyablocks/p-a14c49db.entry.js +1 -0
  72. package/dist/sankhyablocks/p-ba426ea9.entry.js +1 -0
  73. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  74. package/dist/types/components/snk-application/snk-application.d.ts +1 -1
  75. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +1 -0
  76. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +2 -0
  77. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +2 -0
  78. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +1 -0
  79. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +1 -0
  80. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +1 -0
  81. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +1 -0
  82. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +4 -0
  83. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +7 -2
  84. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +5 -2
  85. package/dist/types/components.d.ts +10 -1
  86. package/dist/types/lib/index.d.ts +1 -0
  87. package/dist/types/lib/message/resources/crud-utils.msg.d.ts +2 -0
  88. package/dist/types/lib/utils/CrudUtils.d.ts +6 -0
  89. package/package.json +1 -1
  90. package/dist/sankhyablocks/p-07ebda01.entry.js +0 -1
  91. package/dist/sankhyablocks/p-46caa101.entry.js +0 -1
  92. package/dist/sankhyablocks/p-6f8303f3.entry.js +0 -1
  93. package/dist/sankhyablocks/p-746fc78b.entry.js +0 -1
  94. package/dist/sankhyablocks/p-c1c3b5d8.entry.js +0 -1
  95. package/dist/sankhyablocks/p-c9eec639.entry.js +0 -1
  96. package/dist/sankhyablocks/p-eea6444c.entry.js +0 -1
  97. package/dist/sankhyablocks/p-fb705f81.entry.js +0 -1
@@ -142,10 +142,14 @@ export class SnkApplication {
142
142
  /**
143
143
  * Mostra o conteúdo passado em um Popup
144
144
  */
145
- async showPopUp(content) {
145
+ async showPopUp(content, size = "full") {
146
146
  this.clearContent(this._popUp);
147
+ if (content.tagName === 'EZ-MODAL-CONTAINER') {
148
+ this._popUp.useHeader = false;
149
+ }
147
150
  this._popUp.appendChild(content);
148
151
  this._popUp.opened = true;
152
+ this._popUp.heightMode = size;
149
153
  }
150
154
  async showModal(content) {
151
155
  this.clearContent(this._rightModal);
@@ -162,6 +166,8 @@ export class SnkApplication {
162
166
  async closePopUp() {
163
167
  this.clearContent(this._popUp);
164
168
  this._popUp.opened = false;
169
+ this._popUp.useHeader = true;
170
+ this._popUp.heightMode = "full";
165
171
  }
166
172
  /**
167
173
  * Verifica se a licença do cliente tem determinado opcional (produto)
@@ -550,7 +556,7 @@ export class SnkApplication {
550
556
  });
551
557
  }
552
558
  render() {
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 })));
559
+ 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, closeEsc: true })));
554
560
  }
555
561
  static get is() { return "snk-application"; }
556
562
  static get encapsulation() { return "scoped"; }
@@ -795,10 +801,13 @@ export class SnkApplication {
795
801
  },
796
802
  "showPopUp": {
797
803
  "complexType": {
798
- "signature": "(content: HTMLElement) => Promise<void>",
804
+ "signature": "(content: HTMLElement, size?: string) => Promise<void>",
799
805
  "parameters": [{
800
806
  "tags": [],
801
807
  "text": ""
808
+ }, {
809
+ "tags": [],
810
+ "text": ""
802
811
  }],
803
812
  "references": {
804
813
  "Promise": {
@@ -27,6 +27,9 @@ export class SnkFilterBinarySelect {
27
27
  this.value = undefined;
28
28
  }
29
29
  }
30
+ async show() {
31
+ this._checkOne.setFocus();
32
+ }
30
33
  render() {
31
34
  if (!this.config || this.config.type !== FilterItemType.BINARY_SELECT) {
32
35
  return undefined;
@@ -76,6 +79,26 @@ export class SnkFilterBinarySelect {
76
79
  }
77
80
  };
78
81
  }
82
+ static get methods() {
83
+ return {
84
+ "show": {
85
+ "complexType": {
86
+ "signature": "() => Promise<void>",
87
+ "parameters": [],
88
+ "references": {
89
+ "Promise": {
90
+ "location": "global"
91
+ }
92
+ },
93
+ "return": "Promise<void>"
94
+ },
95
+ "docs": {
96
+ "text": "",
97
+ "tags": []
98
+ }
99
+ }
100
+ };
101
+ }
79
102
  static get listeners() {
80
103
  return [{
81
104
  "name": "ezChange",
@@ -4,11 +4,14 @@ export class SnkFilterMultiSelect {
4
4
  ezChangeListener(evt) {
5
5
  this.value = evt.detail.value;
6
6
  }
7
+ async show() {
8
+ this._comboElement.setFocus();
9
+ }
7
10
  render() {
8
11
  if (!this.config || this.config.type !== FilterItemType.MULTI_SELECT) {
9
12
  return undefined;
10
13
  }
11
- return (h("ez-combo-box", { label: this.config.label, value: this.config.value, options: this.config.props.options }));
14
+ return (h("ez-combo-box", { ref: ref => this._comboElement = ref, label: this.config.label, value: this.config.value, options: this.config.props.options }));
12
15
  }
13
16
  static get is() { return "snk-filter-multi-select"; }
14
17
  static get properties() {
@@ -52,6 +55,26 @@ export class SnkFilterMultiSelect {
52
55
  }
53
56
  };
54
57
  }
58
+ static get methods() {
59
+ return {
60
+ "show": {
61
+ "complexType": {
62
+ "signature": "() => Promise<void>",
63
+ "parameters": [],
64
+ "references": {
65
+ "Promise": {
66
+ "location": "global"
67
+ }
68
+ },
69
+ "return": "Promise<void>"
70
+ },
71
+ "docs": {
72
+ "text": "",
73
+ "tags": []
74
+ }
75
+ }
76
+ };
77
+ }
55
78
  static get listeners() {
56
79
  return [{
57
80
  "name": "ezChange",
@@ -4,12 +4,15 @@ export class SnkFilterPeriod {
4
4
  ezChangeListener(evt) {
5
5
  this.value = evt.detail;
6
6
  }
7
+ async show() {
8
+ this._numberElement.setFocus();
9
+ }
7
10
  render() {
8
11
  var _a;
9
12
  if (!this.config || this.config.type !== FilterItemType.NUMBER) {
10
13
  return undefined;
11
14
  }
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 }));
15
+ return (h("ez-number-input", { ref: ref => this._numberElement = ref, label: this.config.label, value: this.config.value, precision: (_a = this.config.props) === null || _a === void 0 ? void 0 : _a.precision }));
13
16
  }
14
17
  static get is() { return "snk-filter-number"; }
15
18
  static get properties() {
@@ -53,6 +56,26 @@ export class SnkFilterPeriod {
53
56
  }
54
57
  };
55
58
  }
59
+ static get methods() {
60
+ return {
61
+ "show": {
62
+ "complexType": {
63
+ "signature": "() => Promise<void>",
64
+ "parameters": [],
65
+ "references": {
66
+ "Promise": {
67
+ "location": "global"
68
+ }
69
+ },
70
+ "return": "Promise<void>"
71
+ },
72
+ "docs": {
73
+ "text": "",
74
+ "tags": []
75
+ }
76
+ }
77
+ };
78
+ }
56
79
  static get listeners() {
57
80
  return [{
58
81
  "name": "ezChange",
@@ -18,6 +18,9 @@ export class SnkFilterPeriod {
18
18
  }
19
19
  return null;
20
20
  }
21
+ async show() {
22
+ this._startDate.setFocus();
23
+ }
21
24
  render() {
22
25
  if (!this.config || this.config.type !== FilterItemType.PERIOD) {
23
26
  return undefined;
@@ -66,6 +69,26 @@ export class SnkFilterPeriod {
66
69
  }
67
70
  };
68
71
  }
72
+ static get methods() {
73
+ return {
74
+ "show": {
75
+ "complexType": {
76
+ "signature": "() => Promise<void>",
77
+ "parameters": [],
78
+ "references": {
79
+ "Promise": {
80
+ "location": "global"
81
+ }
82
+ },
83
+ "return": "Promise<void>"
84
+ },
85
+ "docs": {
86
+ "text": "",
87
+ "tags": []
88
+ }
89
+ }
90
+ };
91
+ }
69
92
  static get listeners() {
70
93
  return [{
71
94
  "name": "ezChange",
@@ -41,27 +41,34 @@ export class SnkFilterPersonalized {
41
41
  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;
42
42
  return params.map((param, index) => {
43
43
  var _a;
44
+ const elemId = 'param_' + index;
44
45
  switch (param.type) {
45
46
  case UserInterface.SEARCH:
46
- return h("ez-search", { suppressEmptyOption: true, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail), label: param.label, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument, param) });
47
+ return h("ez-search", { id: elemId, suppressEmptyOption: true, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail), label: param.label, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument, param) });
47
48
  case UserInterface.SWITCH:
48
49
  case UserInterface.CHECKBOX:
49
50
  const mode = UserInterface.SWITCH === param.type ? "switch" : "regular";
50
- return h("ez-check", { class: "ez-padding-bottom--medium", mode: mode, value: this.getValue(param, index), label: param.label, onEzChange: evt => this.setValue(index, evt.detail) });
51
+ return h("ez-check", { id: elemId, class: "ez-padding-bottom--medium", mode: mode, value: this.getValue(param, index), label: param.label, onEzChange: evt => this.setValue(index, evt.detail) });
51
52
  case UserInterface.DECIMALNUMBER:
52
53
  case UserInterface.INTEGERNUMBER:
53
- return h("ez-number-input", { label: param.label, value: this.getValue(param, index), precision: (_a = param.props) === null || _a === void 0 ? void 0 : _a.precision, onEzChange: evt => this.setValue(index, evt.detail) });
54
+ return h("ez-number-input", { id: elemId, label: param.label, value: this.getValue(param, index), precision: (_a = param.props) === null || _a === void 0 ? void 0 : _a.precision, onEzChange: evt => this.setValue(index, evt.detail) });
54
55
  case UserInterface.OPTIONSELECTOR:
55
- return h("ez-combo-box", { label: param.label, value: this.getValue(param, index), options: param.options, onEzChange: evt => { var _a; return this.setValue(index, (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); } });
56
+ return h("ez-combo-box", { id: elemId, label: param.label, value: this.getValue(param, index), options: param.options, onEzChange: evt => { var _a; return this.setValue(index, (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); } });
56
57
  case UserInterface.DATE:
57
- return h("ez-date-input", { label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
58
+ return h("ez-date-input", { id: elemId, label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
58
59
  case UserInterface.DATETIME:
59
- return h("ez-date-time-input", { label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
60
+ return h("ez-date-time-input", { id: elemId, label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
60
61
  default:
61
- return h("ez-text-input", { label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
62
+ return h("ez-text-input", { id: elemId, label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
62
63
  }
63
64
  });
64
65
  }
66
+ async show() {
67
+ const elem = document.querySelector("#param_0");
68
+ if (elem) {
69
+ elem["setFocus"]();
70
+ }
71
+ }
65
72
  render() {
66
73
  if (!this.config || this.config.type !== FilterItemType.PERSONALIZED) {
67
74
  return undefined;
@@ -119,4 +126,24 @@ export class SnkFilterPersonalized {
119
126
  }
120
127
  };
121
128
  }
129
+ static get methods() {
130
+ return {
131
+ "show": {
132
+ "complexType": {
133
+ "signature": "() => Promise<void>",
134
+ "parameters": [],
135
+ "references": {
136
+ "Promise": {
137
+ "location": "global"
138
+ }
139
+ },
140
+ "return": "Promise<void>"
141
+ },
142
+ "docs": {
143
+ "text": "",
144
+ "tags": []
145
+ }
146
+ }
147
+ };
148
+ }
122
149
  }
@@ -16,6 +16,9 @@ export class SnkFilterSearch {
16
16
  });
17
17
  });
18
18
  }
19
+ async show() {
20
+ this._searchInput.setFocus();
21
+ }
19
22
  render() {
20
23
  if (!this.config || this.config.type !== FilterItemType.SEARCH) {
21
24
  return undefined;
@@ -67,6 +70,26 @@ export class SnkFilterSearch {
67
70
  }
68
71
  };
69
72
  }
73
+ static get methods() {
74
+ return {
75
+ "show": {
76
+ "complexType": {
77
+ "signature": "() => Promise<void>",
78
+ "parameters": [],
79
+ "references": {
80
+ "Promise": {
81
+ "location": "global"
82
+ }
83
+ },
84
+ "return": "Promise<void>"
85
+ },
86
+ "docs": {
87
+ "text": "",
88
+ "tags": []
89
+ }
90
+ }
91
+ };
92
+ }
70
93
  static get listeners() {
71
94
  return [{
72
95
  "name": "ezChange",
@@ -7,7 +7,7 @@ export class SnkFilterText {
7
7
  if (!this.config) {
8
8
  return undefined;
9
9
  }
10
- return (h("ez-text-input", { label: this.config.label, value: this.config.value }));
10
+ return (h("ez-text-input", { ref: ref => this._textInputElement = ref, label: this.config.label, value: this.config.value }));
11
11
  }
12
12
  static get is() { return "snk-filter-text"; }
13
13
  static get properties() {
@@ -2,6 +2,9 @@ import { h, Host } from '@stencil/core';
2
2
  import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
3
3
  import FilterItemType from './filter-item-type.enum';
4
4
  export class SnkFilterDetail {
5
+ async show() {
6
+ this._editor["show"]();
7
+ }
5
8
  changeConfig(newConfig) {
6
9
  this.filterChange.emit(newConfig);
7
10
  }
@@ -30,10 +33,13 @@ export class SnkFilterDetail {
30
33
  return undefined;
31
34
  }
32
35
  return ([
33
- h("ez-icon", { title: this.getMessage("snkFilterBar.removeFilter"), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: "delete", onClick: () => this.removeItem() }),
34
- 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 })) })
36
+ this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()),
37
+ this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))
35
38
  ]);
36
39
  }
40
+ buildIcon(title, iconName, action) {
41
+ return (h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button" }, h("ez-icon", { title: title, iconName: iconName })));
42
+ }
37
43
  apply() {
38
44
  var _a;
39
45
  let value = this._editor["value"];
@@ -77,9 +83,14 @@ export class SnkFilterDetail {
77
83
  clear() {
78
84
  this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
79
85
  }
86
+ onKeyDonwListener(event) {
87
+ if (event.key === "Enter") {
88
+ this._applyButton.setFocus().then(() => this.apply());
89
+ }
90
+ }
80
91
  render() {
81
92
  const ContentEditor = this.getContentEditor();
82
- 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 }), 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.clear(), size: "small" }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
93
+ 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, onKeyDown: evt => this.onKeyDonwListener(evt) }), 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.clear(), size: "small" }), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
83
94
  }
84
95
  static get is() { return "snk-filter-detail"; }
85
96
  static get properties() {
@@ -144,4 +155,24 @@ export class SnkFilterDetail {
144
155
  }
145
156
  }];
146
157
  }
158
+ static get methods() {
159
+ return {
160
+ "show": {
161
+ "complexType": {
162
+ "signature": "() => Promise<void>",
163
+ "parameters": [],
164
+ "references": {
165
+ "Promise": {
166
+ "location": "global"
167
+ }
168
+ },
169
+ "return": "Promise<void>"
170
+ },
171
+ "docs": {
172
+ "text": "",
173
+ "tags": []
174
+ }
175
+ }
176
+ };
177
+ }
147
178
  }
@@ -8,7 +8,6 @@ export class SnkFilterItem {
8
8
  return true;
9
9
  }
10
10
  this.detailIsVisible = false;
11
- this.executeCloseCallback();
12
11
  return false;
13
12
  };
14
13
  }
@@ -16,29 +15,36 @@ export class SnkFilterItem {
16
15
  return new Promise(resolve => {
17
16
  this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
18
17
  if (open) {
18
+ this._closeCallback = resolve;
19
19
  window.requestAnimationFrame(() => {
20
- this._closeCallback = resolve;
21
- this.showDetail();
20
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, {
21
+ autoClose: true,
22
+ innerClickTest: this.innerClickCheck,
23
+ backClickListener: () => this.onDetailCloseCallback(),
24
+ left: this.getScrollOffset(),
25
+ useOverlay: true
26
+ });
27
+ this._popover.show();
28
+ this.detailIsVisible = true;
22
29
  });
23
30
  }
24
31
  });
25
32
  }
26
- showDetail() {
27
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset(), useOverlay: true });
28
- this.detailIsVisible = true;
29
- }
30
33
  getScrollOffset() {
31
- return `${this._filterItemElement.getBoundingClientRect().left + 12}px`;
34
+ const padding = getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");
35
+ const rect = this._filterItemElement.getBoundingClientRect();
36
+ return `calc(${rect.left}px + ${padding})`;
32
37
  }
33
- hideDetail() {
34
- if (this._floatingID != undefined) {
35
- FloatingManager.close(this._floatingID);
38
+ async hideDetail() {
39
+ if (this.detailIsVisible) {
40
+ if (this._floatingID != undefined) {
41
+ FloatingManager.close(this._floatingID);
42
+ }
36
43
  }
44
+ }
45
+ onDetailCloseCallback() {
37
46
  this._floatingID = undefined;
38
47
  this.detailIsVisible = false;
39
- this.executeCloseCallback();
40
- }
41
- executeCloseCallback() {
42
48
  if (this._closeCallback) {
43
49
  this._closeCallback();
44
50
  this._closeCallback = undefined;
@@ -57,7 +63,7 @@ export class SnkFilterItem {
57
63
  this.hideDetail();
58
64
  }
59
65
  else {
60
- this.showDetail();
66
+ this.showUp(true);
61
67
  }
62
68
  }
63
69
  evt.preventDefault();
@@ -239,6 +245,22 @@ export class SnkFilterItem {
239
245
  "text": "",
240
246
  "tags": []
241
247
  }
248
+ },
249
+ "hideDetail": {
250
+ "complexType": {
251
+ "signature": "() => Promise<void>",
252
+ "parameters": [],
253
+ "references": {
254
+ "Promise": {
255
+ "location": "global"
256
+ }
257
+ },
258
+ "return": "Promise<void>"
259
+ },
260
+ "docs": {
261
+ "text": "",
262
+ "tags": []
263
+ }
242
264
  }
243
265
  };
244
266
  }
@@ -4,6 +4,7 @@ const SHOW_MORE_ITEM_NAME = "__SHOWMORE__";
4
4
  const MAX_FILTERS = 5;
5
5
  export class SnkFilterList {
6
6
  constructor() {
7
+ this._preselection = -1;
7
8
  this.innerClickCheck = (_floatingContainer, node) => {
8
9
  if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
9
10
  return true;
@@ -12,25 +13,34 @@ export class SnkFilterList {
12
13
  return false;
13
14
  };
14
15
  }
15
- showList() {
16
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, useOverlay: true });
16
+ showDetail() {
17
+ this._preselection = -1;
18
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, {
19
+ autoClose: true,
20
+ innerClickTest: this.innerClickCheck,
21
+ backClickListener: () => this.onListCloseCallback(),
22
+ useOverlay: true
23
+ });
17
24
  this._detailIsVisible = true;
18
25
  this._showAll = false;
19
26
  this._filterArgument = "";
27
+ this._filterInput.setFocus();
20
28
  }
21
- hideList() {
29
+ async hideDetail() {
22
30
  if (this._floatingID != undefined) {
23
31
  FloatingManager.close(this._floatingID);
24
32
  }
33
+ }
34
+ onListCloseCallback() {
25
35
  this._floatingID = undefined;
26
36
  this._detailIsVisible = false;
27
37
  }
28
38
  buttonClick() {
29
39
  if (this._detailIsVisible) {
30
- this.hideList();
40
+ this.hideDetail();
31
41
  }
32
42
  else {
33
- this.showList();
43
+ this.showDetail();
34
44
  }
35
45
  }
36
46
  componentDidRender() {
@@ -41,14 +51,15 @@ export class SnkFilterList {
41
51
  }
42
52
  }
43
53
  buildItemElement(item) {
44
- return (h("div", { class: "ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item", onClick: () => this.itemSelected(item.name) }, item.iconName ? h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
54
+ const itemId = ++this._selectableItemsCount;
55
+ return (h("button", { id: `filter-item${itemId}`, onFocusin: () => this._preselection = itemId, class: `ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item`, onClick: () => this.itemSelected(item.name) }, item.iconName ? h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
45
56
  }
46
57
  itemSelected(itemName) {
47
58
  if (itemName === SHOW_MORE_ITEM_NAME) {
48
59
  this._showAll = true;
49
60
  }
50
61
  else {
51
- this.hideList();
62
+ this.hideDetail();
52
63
  this.snkItemSelected.emit(itemName);
53
64
  }
54
65
  }
@@ -62,13 +73,47 @@ export class SnkFilterList {
62
73
  items.splice(MAX_FILTERS);
63
74
  items.push({ kind: "INTERNAL", label: "Mostrar mais", iconName: "dots-horizontal", name: SHOW_MORE_ITEM_NAME, iconClass: "snk-filter-bar__filter-list-item__icon--secondary", labelClass: "snk-filter-bar__filter-list-item__label--secondary" });
64
75
  }
76
+ this._selectableItemsCount = 0;
65
77
  return h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
66
78
  }
67
79
  getFooterItems() {
68
80
  return this.items.filter(item => item.kind === "FOOTER");
69
81
  }
82
+ keyDownHandler(event) {
83
+ switch (event.key) {
84
+ case "ArrowDown":
85
+ this.changePreselection(this._preselection + 1);
86
+ //Paramos a propagação do evento para evitar scroll indesejado
87
+ event.stopImmediatePropagation();
88
+ event.stopPropagation();
89
+ event.preventDefault();
90
+ break;
91
+ case "ArrowUp":
92
+ this.changePreselection(this._preselection - 1);
93
+ //Paramos a propagação do evento para evitar scroll indesejado
94
+ event.stopImmediatePropagation();
95
+ event.stopPropagation();
96
+ event.preventDefault();
97
+ break;
98
+ }
99
+ }
100
+ changePreselection(newSelection) {
101
+ if (newSelection < 0) {
102
+ newSelection = this._selectableItemsCount;
103
+ }
104
+ this._preselection = newSelection > this._selectableItemsCount ? 0 : newSelection;
105
+ if (this._preselection === 0) {
106
+ this._filterInput.setFocus();
107
+ }
108
+ else {
109
+ const item = this._element.querySelector(`#filter-item${this._preselection}`);
110
+ if (item) {
111
+ item.focus();
112
+ }
113
+ }
114
+ }
70
115
  render() {
71
- 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))));
116
+ 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, onFocus: () => this._preselection = 0 }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
72
117
  }
73
118
  static get is() { return "snk-filter-list"; }
74
119
  static get properties() {
@@ -221,5 +266,34 @@ export class SnkFilterList {
221
266
  }
222
267
  }];
223
268
  }
269
+ static get methods() {
270
+ return {
271
+ "hideDetail": {
272
+ "complexType": {
273
+ "signature": "() => Promise<void>",
274
+ "parameters": [],
275
+ "references": {
276
+ "Promise": {
277
+ "location": "global"
278
+ }
279
+ },
280
+ "return": "Promise<void>"
281
+ },
282
+ "docs": {
283
+ "text": "",
284
+ "tags": []
285
+ }
286
+ }
287
+ };
288
+ }
224
289
  static get elementRef() { return "_element"; }
290
+ static get listeners() {
291
+ return [{
292
+ "name": "keydown",
293
+ "method": "keyDownHandler",
294
+ "target": undefined,
295
+ "capture": true,
296
+ "passive": false
297
+ }];
298
+ }
225
299
  }