@sankhyalabs/sankhyablocks 1.4.0-beta.5 → 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 (82) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  3. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  4. package/dist/cjs/snk-filter-bar_5.cjs.entry.js +122 -36
  5. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +3 -0
  6. package/dist/cjs/snk-filter-detail.cjs.entry.js +14 -3
  7. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +4 -1
  8. package/dist/cjs/snk-filter-number.cjs.entry.js +4 -1
  9. package/dist/cjs/snk-filter-period.cjs.entry.js +3 -0
  10. package/dist/cjs/snk-filter-personalized.cjs.entry.js +14 -7
  11. package/dist/cjs/snk-filter-search.cjs.entry.js +3 -0
  12. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  13. package/dist/collection/components/snk-application/snk-application.js +1 -1
  14. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +23 -0
  15. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +24 -1
  16. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +24 -1
  17. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +23 -0
  18. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +34 -7
  19. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +23 -0
  20. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -1
  21. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +34 -3
  22. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +37 -15
  23. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +82 -8
  24. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +30 -5
  25. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +17 -4
  26. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +18 -8
  27. package/dist/components/snk-application2.js +1 -1
  28. package/dist/components/snk-filter-bar2.js +19 -9
  29. package/dist/components/snk-filter-binary-select.js +5 -1
  30. package/dist/components/snk-filter-detail2.js +16 -4
  31. package/dist/components/snk-filter-item2.js +23 -16
  32. package/dist/components/snk-filter-list2.js +56 -10
  33. package/dist/components/snk-filter-modal2.js +30 -5
  34. package/dist/components/snk-filter-multi-select.js +6 -2
  35. package/dist/components/snk-filter-number.js +6 -2
  36. package/dist/components/snk-filter-period.js +5 -1
  37. package/dist/components/snk-filter-personalized.js +16 -8
  38. package/dist/components/snk-filter-search.js +5 -1
  39. package/dist/components/snk-filter-text.js +1 -1
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/sankhyablocks.js +1 -1
  42. package/dist/esm/snk-application.entry.js +1 -1
  43. package/dist/esm/snk-filter-bar_5.entry.js +122 -36
  44. package/dist/esm/snk-filter-binary-select.entry.js +3 -0
  45. package/dist/esm/snk-filter-detail.entry.js +14 -3
  46. package/dist/esm/snk-filter-multi-select.entry.js +4 -1
  47. package/dist/esm/snk-filter-number.entry.js +4 -1
  48. package/dist/esm/snk-filter-period.entry.js +3 -0
  49. package/dist/esm/snk-filter-personalized.entry.js +14 -7
  50. package/dist/esm/snk-filter-search.entry.js +3 -0
  51. package/dist/esm/snk-filter-text.entry.js +1 -1
  52. package/dist/sankhyablocks/{p-01823784.entry.js → p-0ea25487.entry.js} +1 -1
  53. package/dist/sankhyablocks/{p-c564f823.entry.js → p-1a58f45c.entry.js} +2 -2
  54. package/dist/sankhyablocks/p-21e940aa.entry.js +1 -0
  55. package/dist/sankhyablocks/p-40b27004.entry.js +1 -0
  56. package/dist/sankhyablocks/p-4574a955.entry.js +1 -0
  57. package/dist/sankhyablocks/p-49580cdd.entry.js +1 -0
  58. package/dist/sankhyablocks/p-5bdb8452.entry.js +1 -0
  59. package/dist/sankhyablocks/p-6386d720.entry.js +1 -0
  60. package/dist/sankhyablocks/p-a14c49db.entry.js +1 -0
  61. package/dist/sankhyablocks/p-ba426ea9.entry.js +1 -0
  62. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  63. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +1 -0
  64. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +2 -0
  65. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +2 -0
  66. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +1 -0
  67. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +1 -0
  68. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +1 -0
  69. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +1 -0
  70. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +4 -0
  71. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +7 -2
  72. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +5 -2
  73. package/dist/types/components.d.ts +9 -0
  74. package/package.json +1 -1
  75. package/dist/sankhyablocks/p-07ebda01.entry.js +0 -1
  76. package/dist/sankhyablocks/p-46caa101.entry.js +0 -1
  77. package/dist/sankhyablocks/p-6f8303f3.entry.js +0 -1
  78. package/dist/sankhyablocks/p-746fc78b.entry.js +0 -1
  79. package/dist/sankhyablocks/p-c1c3b5d8.entry.js +0 -1
  80. package/dist/sankhyablocks/p-c9eec639.entry.js +0 -1
  81. package/dist/sankhyablocks/p-eea6444c.entry.js +0 -1
  82. package/dist/sankhyablocks/p-fb705f81.entry.js +0 -1
@@ -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
  }
@@ -1,10 +1,13 @@
1
1
  import { h } from '@stencil/core';
2
- import { ModalButtonStatus } from "@sankhyalabs/ezui/dist/collection/components/ez-modal-container";
2
+ import { ModalAction, ModalButtonStatus } from "@sankhyalabs/ezui/dist/collection/components/ez-modal-container";
3
3
  import { ArrayUtils } from '@sankhyalabs/core';
4
4
  export class SnkFilterModal {
5
- updateValue(id, value) {
5
+ updateValue(id, value = undefined) {
6
6
  this.items = this.items.map(item => {
7
7
  if (item.id === id) {
8
+ if (value == undefined) {
9
+ value = !item.active;
10
+ }
8
11
  return Object.assign(Object.assign({}, item), { active: value });
9
12
  }
10
13
  return item;
@@ -17,12 +20,34 @@ export class SnkFilterModal {
17
20
  }
18
21
  return this.getMessage(activeFilters > 1 ? "snkFilterBar.activeFilters" : "snkFilterBar.activeFilter", { ACTIVE_FILTERS: activeFilters });
19
22
  }
20
- getFilteredItems() {
21
- return this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items) : [];
23
+ buildItems(list) {
24
+ return list.map(item => {
25
+ return (h("button", { onClick: () => this.updateValue(item.id), class: "ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small" }, h("ez-check", { id: `checkbox_${item.id}`, tabIndex: "-1", 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" }), 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)));
26
+ });
27
+ }
28
+ itemKeyBoardSelect(event, item) {
29
+ if (event.key === "Enter" || event.key === " ") {
30
+ this.updateValue(item.id);
31
+ }
32
+ }
33
+ modalActionListener(evt) {
34
+ const modalAction = evt.detail;
35
+ if (modalAction === ModalAction.LOAD) {
36
+ if (this._filterInput) {
37
+ this._filterInput.setFocus();
38
+ }
39
+ }
40
+ else {
41
+ this.processModalAction(modalAction);
42
+ }
22
43
  }
23
44
  render() {
24
45
  const allowCancel = this.items.filter(item => item.active).length > 0;
25
- return (h("ez-modal-container", { modalTitle: this.modalTitle, modalSubTitle: this.modalSubTitle, cancelButtonLabel: this.cancelButtonLabel, okButtonLabel: this.okButtonLabel, onEzModalAction: evt => this.processModalAction(evt.detail), cancelButtonStatus: allowCancel ? ModalButtonStatus.ENABLED : ModalButtonStatus.DISABLED }, h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-content" }, h("div", null, this.useSearch ? h("ez-filter-input", { label: this.getMessage("snkFilterBar.modalFindFilter"), onEzChange: (evt) => this._filterArgument = evt.detail }) : undefined), this.getFilteredItems().length > 0 ? h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding-bottom--small" }, this.getActiveFiltersMsg()) : undefined, h("div", null, this.getFilteredItems().map(item => h("div", { class: "ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small" }, 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" }), 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)))), h("div", { class: "ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large" }, this.infoText))));
46
+ const items = (this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items) : []);
47
+ return (h("ez-modal-container", { modalTitle: this.modalTitle, modalSubTitle: this.modalSubTitle, cancelButtonLabel: this.cancelButtonLabel, okButtonLabel: this.okButtonLabel, onEzModalAction: evt => this.modalActionListener(evt), cancelButtonStatus: allowCancel ? ModalButtonStatus.ENABLED : ModalButtonStatus.DISABLED }, h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-content" }, h("div", null, this.useSearch ?
48
+ h("ez-filter-input", { ref: ref => this._filterInput = ref, label: this.getMessage("snkFilterBar.modalFindFilter"), onEzChange: (evt) => this._filterArgument = evt.detail })
49
+ :
50
+ undefined), items.length > 0 ? h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding-bottom--small" }, this.getActiveFiltersMsg()) : undefined, h("div", null, this.buildItems(items)), h("div", { class: "ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large" }, this.infoText))));
26
51
  }
27
52
  static get is() { return "snk-filter-modal"; }
28
53
  static get properties() {
@@ -46,7 +46,10 @@
46
46
 
47
47
  .snk-filter-item__editor-header-button{
48
48
  cursor: pointer;
49
- flex-grow: 0;
49
+ background-color: transparent;
50
+ border: none;
51
+ padding: 3px;
52
+ outline-color: var(--color--primary);
50
53
  }
51
54
 
52
55
  .snk-filter-bar__divider{
@@ -62,6 +65,8 @@
62
65
  .snk-filter-bar__filter-list-item{
63
66
  cursor: pointer;
64
67
  border-radius: var(--border--radius-small, 6px);
68
+ border: none;
69
+ background-color: transparent;
65
70
  }
66
71
 
67
72
  .snk-filter-bar__filter-list-item__label{
@@ -80,8 +85,8 @@
80
85
  --ez-icon--color: var(--text--secondary);
81
86
  }
82
87
 
83
- .snk-filter-bar__filter-list-item.preselected {
84
-
88
+ .snk-filter-bar__filter-list-item:focus-visible {
89
+ outline: none;
85
90
  background-color: var(--background--medium);
86
91
  }
87
92
 
@@ -114,10 +119,19 @@
114
119
  }
115
120
 
116
121
  .snk-filter-bar__filter-modal-item{
122
+ --modal-item-border-width: 2px;
117
123
  display: flex;
118
124
  flex-direction: row;
125
+ margin-left: var(--modal-item-border-width);
119
126
  border-radius: var(--border--radius-medium, 12px);
120
127
  background-color: var(--background--medium, #f0f3f7);
128
+ border: none;
129
+ width: 100%;
130
+
131
+ }
132
+
133
+ .snk-filter-bar__filter-modal-item:focus-visible{
134
+ outline: var(--color--primary) solid var(--modal-item-border-width);
121
135
  }
122
136
 
123
137
  .snk-filter-bar__filter-modal-item__check{
@@ -125,7 +139,6 @@
125
139
  }
126
140
  .snk-filter-bar__filter-modal-item__label{
127
141
  font-weight: var(--text-weight--medium);
128
- width: 100%;
129
142
  }
130
143
 
131
144
  .snk-filter-bar__filter-modal-content{