@revolist/revogrid 3.2.0 → 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/dist/revo-grid/_baseIteratee-af30b221.js +2070 -0
  2. package/dist/{collection/global/global.js → revo-grid/app-globals-7e6866ba.js} +11 -2
  3. package/dist/{collection/components/data/columnService.js → revo-grid/columnService-91e552ba.js} +11 -6
  4. package/dist/revo-grid/consts-ef824e6f.js +46 -0
  5. package/dist/revo-grid/css-shim-5387c708.js +7 -0
  6. package/dist/revo-grid/data.store-3263fff9.js +557 -0
  7. package/dist/revo-grid/debounce-aaa4b4da.js +217 -0
  8. package/dist/revo-grid/dimension.helpers-a7944fc4.js +340 -0
  9. package/dist/{collection/plugins/dispatcher.js → revo-grid/dispatcher-891af82e.js} +7 -2
  10. package/dist/{cjs/dom-c8b6d1a7.js → revo-grid/dom-21bd1807.js} +4 -3
  11. package/dist/revo-grid/each-0378e5a3.js +180 -0
  12. package/dist/{collection/plugins/filter/filter.button.js → revo-grid/filter.button-74c1cd9c.js} +16 -10
  13. package/dist/revo-grid/identity-c8c7d3d8.js +26 -0
  14. package/dist/revo-grid/index-8a604c17.js +3067 -0
  15. package/dist/revo-grid/index.esm.js +3 -0
  16. package/dist/revo-grid/isString-a51066b5.js +34 -0
  17. package/dist/revo-grid/isSymbol-e4b5dafe.js +247 -0
  18. package/dist/revo-grid/keyCodes.utils-bd06e3ba.js +299 -0
  19. package/dist/revo-grid/keys-70b7c240.js +561 -0
  20. package/dist/{collection/services/localScrollService.js → revo-grid/localScrollService-e9b73323.js} +8 -2
  21. package/dist/{esm/revo-grid_11.entry.js → revo-grid/lodash-a0ab4cdd.js} +13773 -24835
  22. package/dist/{cjs/resize-observer-8dc80084.js → revo-grid/resize-observer-00c48d78.js} +25 -14
  23. package/dist/revo-grid/revo-grid.entry.js +3484 -0
  24. package/dist/revo-grid/revo-grid.esm.js +133 -1
  25. package/dist/revo-grid/revogr-clipboard.entry.js +52 -1
  26. package/dist/revo-grid/revogr-data.entry.js +152 -0
  27. package/dist/revo-grid/revogr-edit.entry.js +105 -0
  28. package/dist/revo-grid/revogr-filter-panel.entry.js +277 -1
  29. package/dist/revo-grid/revogr-focus.entry.js +41 -0
  30. package/dist/revo-grid/revogr-header.entry.js +560 -0
  31. package/dist/revo-grid/revogr-order-editor.entry.js +175 -0
  32. package/dist/revo-grid/revogr-overlay-selection.entry.js +711 -0
  33. package/dist/revo-grid/revogr-row-headers.entry.js +73 -0
  34. package/dist/revo-grid/revogr-scroll-virtual.entry.js +114 -0
  35. package/dist/revo-grid/revogr-temp-range.entry.js +73 -0
  36. package/dist/revo-grid/revogr-viewport-scroll.entry.js +340 -0
  37. package/dist/revo-grid/selection.store.connector-2b613fd0.js +503 -0
  38. package/dist/{collection/components/overlay/selection.utils.js → revo-grid/selection.utils-a9932db6.js} +15 -9
  39. package/dist/revo-grid/shadow-css-602a09db.js +390 -0
  40. package/dist/{collection/themeManager/themeService.js → revo-grid/themeService-ddaaa364.js} +26 -6
  41. package/dist/revo-grid/toInteger-9e6cbfd2.js +107 -0
  42. package/dist/revo-grid/toNumber-913b0b72.js +105 -0
  43. package/dist/{collection/utils/utils.js → revo-grid/utils-2c3b3857.js} +13 -8
  44. package/dist/revo-grid/viewport.helpers-49d3f031.js +16 -0
  45. package/dist/{collection/store/viewPort/viewport.helpers.js → revo-grid/viewport.store-ffaaab6d.js} +135 -9
  46. package/dist/types/components.d.ts +100 -56
  47. package/dist/types/stencil-public-runtime.d.ts +189 -186
  48. package/package.json +22 -20
  49. package/custom-element/index.js +0 -29210
  50. package/custom-element/resize-observer.js +0 -489
  51. package/dist/cjs/css-shim-e33df79c.js +0 -6
  52. package/dist/cjs/debounce-e9b040d9.js +0 -575
  53. package/dist/cjs/index-d3f67f2e.js +0 -1729
  54. package/dist/cjs/index.cjs.js +0 -2
  55. package/dist/cjs/loader.cjs.js +0 -35
  56. package/dist/cjs/revo-grid.cjs.js +0 -73
  57. package/dist/cjs/revo-grid_11.cjs.entry.js +0 -28294
  58. package/dist/cjs/revogr-clipboard.cjs.entry.js +0 -53
  59. package/dist/cjs/revogr-filter-panel.cjs.entry.js +0 -275
  60. package/dist/collection/collection-manifest.json +0 -25
  61. package/dist/collection/components/button/button.js +0 -4
  62. package/dist/collection/components/clipboard/revogr-clipboard.js +0 -121
  63. package/dist/collection/components/data/cellRenderer.js +0 -24
  64. package/dist/collection/components/data/revogr-data-style.css +0 -135
  65. package/dist/collection/components/data/revogr-data.js +0 -322
  66. package/dist/collection/components/data/rowRenderer.js +0 -6
  67. package/dist/collection/components/header/headerCellRenderer.js +0 -26
  68. package/dist/collection/components/header/headerRenderer.js +0 -45
  69. package/dist/collection/components/header/revogr-header-style.css +0 -198
  70. package/dist/collection/components/header/revogr-header.js +0 -297
  71. package/dist/collection/components/order/orderRenderer.js +0 -50
  72. package/dist/collection/components/order/revogr-order-editor.js +0 -358
  73. package/dist/collection/components/order/rowOrderService.js +0 -68
  74. package/dist/collection/components/overlay/autofill.service.js +0 -182
  75. package/dist/collection/components/overlay/clipboard.service.js +0 -39
  76. package/dist/collection/components/overlay/editors/edit.utils.js +0 -5
  77. package/dist/collection/components/overlay/editors/text.js +0 -35
  78. package/dist/collection/components/overlay/keyboard.service.js +0 -128
  79. package/dist/collection/components/overlay/revogr-edit-style.css +0 -86
  80. package/dist/collection/components/overlay/revogr-edit.js +0 -159
  81. package/dist/collection/components/overlay/revogr-overlay-selection.js +0 -726
  82. package/dist/collection/components/overlay/revogr-overlay-style.css +0 -98
  83. package/dist/collection/components/revo-grid/revo-grid-style.css +0 -544
  84. package/dist/collection/components/revo-grid/revo-grid.js +0 -2224
  85. package/dist/collection/components/revo-grid/viewport.helpers.js +0 -11
  86. package/dist/collection/components/revo-grid/viewport.interfaces.js +0 -1
  87. package/dist/collection/components/revo-grid/viewport.js +0 -18
  88. package/dist/collection/components/revo-grid/viewport.resize.service.js +0 -21
  89. package/dist/collection/components/revo-grid/viewport.scrolling.service.js +0 -60
  90. package/dist/collection/components/revo-grid/viewport.section.js +0 -28
  91. package/dist/collection/components/revo-grid/viewport.service.js +0 -209
  92. package/dist/collection/components/rowHeaders/revogr-row-headers.js +0 -210
  93. package/dist/collection/components/rowHeaders/row-header-render.js +0 -1
  94. package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +0 -137
  95. package/dist/collection/components/scroll/revogr-viewport-scroll.js +0 -399
  96. package/dist/collection/components/scrollable/revogr-scroll-style.css +0 -104
  97. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +0 -253
  98. package/dist/collection/components/selection-focus/revogr-focus-style.css +0 -77
  99. package/dist/collection/components/selection-focus/revogr-focus.js +0 -103
  100. package/dist/collection/components/selection-temp-range/revogr-temp-range-style.css +0 -98
  101. package/dist/collection/components/selection-temp-range/revogr-temp-range.js +0 -138
  102. package/dist/collection/index.js +0 -1
  103. package/dist/collection/plugins/autoSizeColumn.js +0 -230
  104. package/dist/collection/plugins/basePlugin.js +0 -27
  105. package/dist/collection/plugins/export/csv.js +0 -68
  106. package/dist/collection/plugins/export/export.plugin.js +0 -165
  107. package/dist/collection/plugins/export/types.js +0 -1
  108. package/dist/collection/plugins/filter/conditions/equal.js +0 -17
  109. package/dist/collection/plugins/filter/conditions/number/greaterThan.js +0 -10
  110. package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +0 -7
  111. package/dist/collection/plugins/filter/conditions/number/lessThan.js +0 -12
  112. package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +0 -7
  113. package/dist/collection/plugins/filter/conditions/set.js +0 -3
  114. package/dist/collection/plugins/filter/conditions/string/beginswith.js +0 -17
  115. package/dist/collection/plugins/filter/conditions/string/contains.js +0 -18
  116. package/dist/collection/plugins/filter/filter.plugin.js +0 -256
  117. package/dist/collection/plugins/filter/filter.pop.js +0 -485
  118. package/dist/collection/plugins/filter/filter.service.js +0 -44
  119. package/dist/collection/plugins/filter/filter.style.css +0 -239
  120. package/dist/collection/plugins/filter/filter.types.js +0 -1
  121. package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +0 -30
  122. package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js +0 -36
  123. package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +0 -21
  124. package/dist/collection/plugins/groupingRow/grouping.const.js +0 -10
  125. package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +0 -76
  126. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +0 -258
  127. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +0 -29
  128. package/dist/collection/plugins/groupingRow/grouping.row.types.js +0 -1
  129. package/dist/collection/plugins/groupingRow/grouping.service.js +0 -155
  130. package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +0 -57
  131. package/dist/collection/plugins/moveColumn/columnDragPlugin.js +0 -145
  132. package/dist/collection/plugins/moveColumn/columnOrderHandler.js +0 -60
  133. package/dist/collection/plugins/sorting/sorting.plugin.js +0 -181
  134. package/dist/collection/plugins/sorting/sorting.sign.js +0 -6
  135. package/dist/collection/plugins/stretchPlugin.js +0 -68
  136. package/dist/collection/plugins/trimmed/trimmed.plugin.js +0 -32
  137. package/dist/collection/services/cell.helpers.js +0 -7
  138. package/dist/collection/services/column.data.provider.js +0 -188
  139. package/dist/collection/services/data.provider.js +0 -47
  140. package/dist/collection/services/dimension.provider.js +0 -78
  141. package/dist/collection/services/resizable.directive.js +0 -250
  142. package/dist/collection/services/selection.store.connector.js +0 -213
  143. package/dist/collection/services/viewport.provider.js +0 -14
  144. package/dist/collection/store/dataSource/data.proxy.js +0 -34
  145. package/dist/collection/store/dataSource/data.store.js +0 -127
  146. package/dist/collection/store/dimension/dimension.helpers.js +0 -107
  147. package/dist/collection/store/dimension/dimension.store.js +0 -59
  148. package/dist/collection/store/selection/selection.helpers.js +0 -53
  149. package/dist/collection/store/selection/selection.store.js +0 -68
  150. package/dist/collection/store/selection/selection.store.service.js +0 -35
  151. package/dist/collection/store/storeTypes.js +0 -5
  152. package/dist/collection/store/viewPort/viewport.store.js +0 -121
  153. package/dist/collection/themeManager/theme.compact.js +0 -5
  154. package/dist/collection/themeManager/theme.default.js +0 -5
  155. package/dist/collection/themeManager/theme.material.js +0 -5
  156. package/dist/collection/utils/closestPolifill.js +0 -18
  157. package/dist/collection/utils/consts.js +0 -19
  158. package/dist/collection/utils/generateAlphabetHeader.js +0 -20
  159. package/dist/collection/utils/keyCodes.js +0 -70
  160. package/dist/collection/utils/keyCodes.utils.js +0 -64
  161. package/dist/collection/utils/platform.js +0 -5
  162. package/dist/collection/utils/resizeObserver.js +0 -6
  163. package/dist/collection/utils/store.utils.js +0 -7
  164. package/dist/collection/utilsExternal/generate-data.js +0 -132
  165. package/dist/esm/css-shim-8d75038b.js +0 -4
  166. package/dist/esm/debounce-45985ae0.js +0 -558
  167. package/dist/esm/dom-1b195079.js +0 -73
  168. package/dist/esm/index-42c84e7c.js +0 -1694
  169. package/dist/esm/index.js +0 -1
  170. package/dist/esm/loader.js +0 -31
  171. package/dist/esm/polyfills/core-js.js +0 -11
  172. package/dist/esm/polyfills/css-shim.js +0 -1
  173. package/dist/esm/polyfills/dom.js +0 -79
  174. package/dist/esm/polyfills/es5-html-element.js +0 -1
  175. package/dist/esm/polyfills/index.js +0 -34
  176. package/dist/esm/polyfills/system.js +0 -6
  177. package/dist/esm/resize-observer-56b7b34f.js +0 -489
  178. package/dist/esm/revo-grid.js +0 -71
  179. package/dist/esm/revogr-clipboard.entry.js +0 -49
  180. package/dist/esm/revogr-filter-panel.entry.js +0 -271
  181. package/dist/esm-es5/css-shim-8d75038b.js +0 -1
  182. package/dist/esm-es5/debounce-45985ae0.js +0 -1
  183. package/dist/esm-es5/dom-1b195079.js +0 -21
  184. package/dist/esm-es5/index-42c84e7c.js +0 -1
  185. package/dist/esm-es5/index.js +0 -0
  186. package/dist/esm-es5/loader.js +0 -1
  187. package/dist/esm-es5/resize-observer-56b7b34f.js +0 -1
  188. package/dist/esm-es5/revo-grid.js +0 -1
  189. package/dist/esm-es5/revo-grid_11.entry.js +0 -1
  190. package/dist/esm-es5/revogr-clipboard.entry.js +0 -1
  191. package/dist/esm-es5/revogr-filter-panel.entry.js +0 -1
  192. package/dist/index.cjs.js +0 -1
  193. package/dist/index.js +0 -1
  194. package/dist/revo-grid/css-shim-88bfb262.system.js +0 -1
  195. package/dist/revo-grid/css-shim-8d75038b.js +0 -1
  196. package/dist/revo-grid/debounce-6c911037.js +0 -1
  197. package/dist/revo-grid/debounce-a345f98e.system.js +0 -1
  198. package/dist/revo-grid/dom-1b195079.js +0 -19
  199. package/dist/revo-grid/dom-ee2dd1b3.system.js +0 -21
  200. package/dist/revo-grid/index-a15e7527.system.js +0 -1
  201. package/dist/revo-grid/index-a7f99799.js +0 -1
  202. package/dist/revo-grid/index.system.js +0 -1
  203. package/dist/revo-grid/resize-observer-56b7b34f.js +0 -1
  204. package/dist/revo-grid/resize-observer-7a7b9757.system.js +0 -1
  205. package/dist/revo-grid/revo-grid.js +0 -132
  206. package/dist/revo-grid/revo-grid.system.js +0 -1
  207. package/dist/revo-grid/revo-grid_11.entry.js +0 -1
  208. package/dist/revo-grid/revo-grid_11.system.entry.js +0 -1
  209. package/dist/revo-grid/revogr-clipboard.system.entry.js +0 -1
  210. package/dist/revo-grid/revogr-filter-panel.system.entry.js +0 -1
@@ -1,485 +0,0 @@
1
- import { Component, h, Host, Listen, Prop, State, Event, Method } from '@stencil/core';
2
- import { AndOrButton, isFilterBtn, TrashButton } from './filter.button';
3
- import { RevoButton } from '../../components/button/button';
4
- import '../../utils/closestPolifill';
5
- import debounce from 'lodash/debounce';
6
- const defaultType = 'none';
7
- const FILTER_LIST_CLASS = 'multi-filter-list';
8
- const FILTER_LIST_CLASS_ACTION = 'multi-filter-list-action';
9
- export class FilterPanel {
10
- constructor() {
11
- this.filterCaptionsInternal = {
12
- title: 'Filter by condition',
13
- save: 'Save',
14
- reset: 'Reset',
15
- cancel: 'Close',
16
- };
17
- this.isFilterIdSet = false;
18
- this.filterId = 0;
19
- this.currentFilterId = -1;
20
- this.currentFilterType = defaultType;
21
- this.filterItems = {};
22
- this.filterTypes = {};
23
- this.filterNames = {};
24
- this.filterEntities = {};
25
- this.disableDynamicFiltering = false;
26
- this.debouncedApplyFilter = debounce(() => {
27
- this.filterChange.emit(this.filterItems);
28
- }, 400);
29
- }
30
- onMouseDown(e) {
31
- if (this.changes && !e.defaultPrevented) {
32
- const el = e.target;
33
- if (this.isOutside(el) && !isFilterBtn(el)) {
34
- this.changes = undefined;
35
- }
36
- }
37
- }
38
- async show(newEntity) {
39
- this.changes = newEntity;
40
- if (this.changes) {
41
- this.changes.type = this.changes.type || defaultType;
42
- }
43
- }
44
- async getChanges() {
45
- return this.changes;
46
- }
47
- componentWillRender() {
48
- if (!this.isFilterIdSet) {
49
- this.isFilterIdSet = true;
50
- const filterItems = Object.keys(this.filterItems);
51
- for (const prop of filterItems) {
52
- // we set the proper filterId so there won't be any conflict when removing filters
53
- this.filterId += this.filterItems[prop].length;
54
- }
55
- }
56
- }
57
- renderSelectOptions(type, isDefaultTypeRemoved = false) {
58
- var _a;
59
- const options = [];
60
- const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
61
- if (!isDefaultTypeRemoved) {
62
- options.push(h("option", { selected: this.currentFilterType === defaultType, value: defaultType }, prop && this.filterItems[prop] && this.filterItems[prop].length > 0 ? 'Add more condition...' : this.filterNames[defaultType]));
63
- }
64
- for (let gIndex in this.filterTypes) {
65
- options.push(...this.filterTypes[gIndex].map(k => (h("option", { value: k, selected: type === k }, this.filterNames[k]))));
66
- options.push(h("option", { disabled: true }));
67
- }
68
- return options;
69
- }
70
- renderExtra(prop, index) {
71
- const currentFilter = this.filterItems[prop];
72
- if (!currentFilter)
73
- return '';
74
- if (this.filterEntities[currentFilter[index].type].extra !== 'input')
75
- return '';
76
- return (h("input", { id: `filter-input-${currentFilter[index].id}`, placeholder: "Enter value...", type: "text", value: currentFilter[index].value, onInput: this.onUserInput.bind(this, index, prop), onKeyDown: e => this.onKeyDown(e) }));
77
- }
78
- getFilterItemsList() {
79
- var _a;
80
- const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
81
- if (!(prop || prop === 0))
82
- return '';
83
- const propFilters = this.filterItems[prop] || [];
84
- return (h("div", { key: this.filterId },
85
- propFilters.map((d, index) => {
86
- let andOrButton;
87
- // hide toggle button if there is only one filter and the last one
88
- if (index !== this.filterItems[prop].length - 1) {
89
- andOrButton = (h("div", { onClick: () => this.toggleFilterAndOr(d.id) },
90
- h(AndOrButton, { isAnd: d.relation === 'and' })));
91
- }
92
- return (h("div", { key: d.id, class: FILTER_LIST_CLASS },
93
- h("div", { class: { 'select-input': true } },
94
- h("select", { class: "select-css select-filter", onChange: e => this.onFilterTypeChange(e, prop, index) }, this.renderSelectOptions(this.filterItems[prop][index].type, true)),
95
- h("div", { class: FILTER_LIST_CLASS_ACTION }, andOrButton),
96
- h("div", { onClick: () => this.onRemoveFilter(d.id) },
97
- h(TrashButton, null))),
98
- h("div", null, this.renderExtra(prop, index))));
99
- }),
100
- propFilters.length > 0 ? h("div", { class: "add-filter-divider" }) : ''));
101
- }
102
- render() {
103
- if (!this.changes) {
104
- return h(Host, { style: { display: 'none' } });
105
- }
106
- const style = {
107
- display: 'block',
108
- left: `${this.changes.x}px`,
109
- top: `${this.changes.y}px`,
110
- };
111
- const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
112
- return (h(Host, { style: style },
113
- h("label", null, capts.title),
114
- h("div", { class: "filter-holder" }, this.getFilterItemsList()),
115
- h("div", { class: "add-filter" },
116
- h("select", { id: "add-filter", class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
117
- h("div", { class: "filter-actions" },
118
- this.disableDynamicFiltering &&
119
- h(RevoButton, { class: { red: true, save: true }, onClick: () => this.onSave() }, capts.save),
120
- h(RevoButton, { class: { red: true, reset: true }, onClick: () => this.onReset() }, capts.reset),
121
- h(RevoButton, { class: { light: true, cancel: true }, onClick: () => this.onCancel() }, capts.cancel))));
122
- }
123
- onFilterTypeChange(e, prop, index) {
124
- const el = e.target;
125
- const type = el.value;
126
- this.filterItems[prop][index].type = type;
127
- // this re-renders the input to know if we need extra input
128
- this.filterId++;
129
- // adding setTimeout will wait for the next tick DOM update then focus on input
130
- setTimeout(() => {
131
- const input = document.getElementById('filter-input-' + this.filterItems[prop][index].id);
132
- if (input)
133
- input.focus();
134
- }, 0);
135
- if (!this.disableDynamicFiltering)
136
- this.debouncedApplyFilter();
137
- }
138
- onAddNewFilter(e) {
139
- const el = e.target;
140
- const type = el.value;
141
- this.currentFilterType = type;
142
- this.addNewFilterToProp();
143
- // reset value after adding new filter
144
- const select = document.getElementById('add-filter');
145
- if (select) {
146
- select.value = defaultType;
147
- this.currentFilterType = defaultType;
148
- }
149
- if (!this.disableDynamicFiltering)
150
- this.debouncedApplyFilter();
151
- }
152
- addNewFilterToProp() {
153
- var _a;
154
- const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
155
- if (!(prop || prop === 0))
156
- return;
157
- if (!this.filterItems[prop]) {
158
- this.filterItems[prop] = [];
159
- }
160
- if (this.currentFilterType === 'none')
161
- return;
162
- this.filterId++;
163
- this.currentFilterId = this.filterId;
164
- this.filterItems[prop].push({
165
- id: this.currentFilterId,
166
- type: this.currentFilterType,
167
- value: '',
168
- relation: 'and',
169
- });
170
- // adding setTimeout will wait for the next tick DOM update then focus on input
171
- setTimeout(() => {
172
- const input = document.getElementById('filter-input-' + this.currentFilterId);
173
- if (input)
174
- input.focus();
175
- }, 0);
176
- }
177
- onUserInput(index, prop, event) {
178
- // update the value of the filter item
179
- this.filterItems[prop][index].value = event.target.value;
180
- if (!this.disableDynamicFiltering)
181
- this.debouncedApplyFilter();
182
- }
183
- onKeyDown(e) {
184
- if (e.key.toLowerCase() === 'enter') {
185
- const select = document.getElementById('add-filter');
186
- if (select) {
187
- select.value = defaultType;
188
- this.currentFilterType = defaultType;
189
- this.addNewFilterToProp();
190
- select.focus();
191
- }
192
- return;
193
- }
194
- // keep event local, don't escalate farther to dom
195
- e.stopPropagation();
196
- }
197
- onSave() {
198
- this.filterChange.emit(this.filterItems);
199
- }
200
- onCancel() {
201
- this.changes = undefined;
202
- }
203
- onReset() {
204
- this.assertChanges();
205
- delete this.filterItems[this.changes.prop];
206
- // this updates the DOM which is used by getFilterItemsList() key
207
- this.filterId++;
208
- this.filterChange.emit(this.filterItems);
209
- }
210
- onRemoveFilter(id) {
211
- this.assertChanges();
212
- // this is for reactivity issues for getFilterItemsList()
213
- this.filterId++;
214
- const prop = this.changes.prop;
215
- const items = this.filterItems[prop];
216
- if (!items)
217
- return;
218
- const index = items.findIndex(d => d.id === id);
219
- if (index === -1)
220
- return;
221
- items.splice(index, 1);
222
- // let's remove the prop if no more filters so the filter icon will be removed
223
- if (items.length === 0)
224
- delete this.filterItems[prop];
225
- if (!this.disableDynamicFiltering)
226
- this.debouncedApplyFilter();
227
- }
228
- toggleFilterAndOr(id) {
229
- this.assertChanges();
230
- // this is for reactivity issues for getFilterItemsList()
231
- this.filterId++;
232
- const prop = this.changes.prop;
233
- const items = this.filterItems[prop];
234
- if (!items)
235
- return;
236
- const index = items.findIndex(d => d.id === id);
237
- if (index === -1)
238
- return;
239
- items[index].relation = items[index].relation === 'and' ? 'or' : 'and';
240
- if (!this.disableDynamicFiltering)
241
- this.debouncedApplyFilter();
242
- }
243
- assertChanges() {
244
- if (!this.changes) {
245
- throw new Error('Changes required per edit');
246
- }
247
- }
248
- isOutside(e) {
249
- const select = document.getElementById('add-filter');
250
- if (select)
251
- select.value = defaultType;
252
- this.currentFilterType = defaultType;
253
- this.changes.type = defaultType;
254
- this.currentFilterId = -1;
255
- if (e.classList.contains(`[uuid="${this.uuid}"]`)) {
256
- return false;
257
- }
258
- return !(e === null || e === void 0 ? void 0 : e.closest(`[uuid="${this.uuid}"]`));
259
- }
260
- static get is() { return "revogr-filter-panel"; }
261
- static get originalStyleUrls() { return {
262
- "$": ["filter.style.scss"]
263
- }; }
264
- static get styleUrls() { return {
265
- "$": ["filter.style.css"]
266
- }; }
267
- static get properties() { return {
268
- "uuid": {
269
- "type": "string",
270
- "mutable": true,
271
- "complexType": {
272
- "original": "string",
273
- "resolved": "string",
274
- "references": {}
275
- },
276
- "required": false,
277
- "optional": false,
278
- "docs": {
279
- "tags": [],
280
- "text": ""
281
- },
282
- "attribute": "uuid",
283
- "reflect": true
284
- },
285
- "filterItems": {
286
- "type": "unknown",
287
- "mutable": false,
288
- "complexType": {
289
- "original": "MultiFilterItem",
290
- "resolved": "{ [prop: string]: FilterData[]; }",
291
- "references": {
292
- "MultiFilterItem": {
293
- "location": "local"
294
- }
295
- }
296
- },
297
- "required": false,
298
- "optional": false,
299
- "docs": {
300
- "tags": [],
301
- "text": ""
302
- },
303
- "defaultValue": "{}"
304
- },
305
- "filterTypes": {
306
- "type": "unknown",
307
- "mutable": false,
308
- "complexType": {
309
- "original": "Record<string, string[]>",
310
- "resolved": "{ [x: string]: string[]; }",
311
- "references": {
312
- "Record": {
313
- "location": "global"
314
- }
315
- }
316
- },
317
- "required": false,
318
- "optional": false,
319
- "docs": {
320
- "tags": [],
321
- "text": ""
322
- },
323
- "defaultValue": "{}"
324
- },
325
- "filterNames": {
326
- "type": "unknown",
327
- "mutable": false,
328
- "complexType": {
329
- "original": "Record<string, string>",
330
- "resolved": "{ [x: string]: string; }",
331
- "references": {
332
- "Record": {
333
- "location": "global"
334
- }
335
- }
336
- },
337
- "required": false,
338
- "optional": false,
339
- "docs": {
340
- "tags": [],
341
- "text": ""
342
- },
343
- "defaultValue": "{}"
344
- },
345
- "filterEntities": {
346
- "type": "unknown",
347
- "mutable": false,
348
- "complexType": {
349
- "original": "Record<string, LogicFunction>",
350
- "resolved": "{ [x: string]: LogicFunction; }",
351
- "references": {
352
- "Record": {
353
- "location": "global"
354
- },
355
- "LogicFunction": {
356
- "location": "import",
357
- "path": "./filter.types"
358
- }
359
- }
360
- },
361
- "required": false,
362
- "optional": false,
363
- "docs": {
364
- "tags": [],
365
- "text": ""
366
- },
367
- "defaultValue": "{}"
368
- },
369
- "filterCaptions": {
370
- "type": "unknown",
371
- "mutable": false,
372
- "complexType": {
373
- "original": "FilterCaptions | undefined",
374
- "resolved": "{ title: string; save: string; reset: string; cancel: string; }",
375
- "references": {
376
- "FilterCaptions": {
377
- "location": "import",
378
- "path": "./filter.plugin"
379
- }
380
- }
381
- },
382
- "required": false,
383
- "optional": false,
384
- "docs": {
385
- "tags": [],
386
- "text": ""
387
- }
388
- },
389
- "disableDynamicFiltering": {
390
- "type": "boolean",
391
- "mutable": false,
392
- "complexType": {
393
- "original": "boolean",
394
- "resolved": "boolean",
395
- "references": {}
396
- },
397
- "required": false,
398
- "optional": false,
399
- "docs": {
400
- "tags": [],
401
- "text": ""
402
- },
403
- "attribute": "disable-dynamic-filtering",
404
- "reflect": false,
405
- "defaultValue": "false"
406
- }
407
- }; }
408
- static get states() { return {
409
- "isFilterIdSet": {},
410
- "filterId": {},
411
- "currentFilterId": {},
412
- "currentFilterType": {},
413
- "changes": {}
414
- }; }
415
- static get events() { return [{
416
- "method": "filterChange",
417
- "name": "filterChange",
418
- "bubbles": true,
419
- "cancelable": true,
420
- "composed": true,
421
- "docs": {
422
- "tags": [],
423
- "text": ""
424
- },
425
- "complexType": {
426
- "original": "MultiFilterItem",
427
- "resolved": "{ [prop: string]: FilterData[]; }",
428
- "references": {
429
- "MultiFilterItem": {
430
- "location": "local"
431
- }
432
- }
433
- }
434
- }]; }
435
- static get methods() { return {
436
- "show": {
437
- "complexType": {
438
- "signature": "(newEntity?: ShowData) => Promise<void>",
439
- "parameters": [{
440
- "tags": [],
441
- "text": ""
442
- }],
443
- "references": {
444
- "Promise": {
445
- "location": "global"
446
- },
447
- "ShowData": {
448
- "location": "local"
449
- }
450
- },
451
- "return": "Promise<void>"
452
- },
453
- "docs": {
454
- "text": "",
455
- "tags": []
456
- }
457
- },
458
- "getChanges": {
459
- "complexType": {
460
- "signature": "() => Promise<ShowData>",
461
- "parameters": [],
462
- "references": {
463
- "Promise": {
464
- "location": "global"
465
- },
466
- "ShowData": {
467
- "location": "local"
468
- }
469
- },
470
- "return": "Promise<ShowData>"
471
- },
472
- "docs": {
473
- "text": "",
474
- "tags": []
475
- }
476
- }
477
- }; }
478
- static get listeners() { return [{
479
- "name": "mousedown",
480
- "method": "onMouseDown",
481
- "target": "document",
482
- "capture": false,
483
- "passive": true
484
- }]; }
485
- }
@@ -1,44 +0,0 @@
1
- import eq, { notEq } from './conditions/equal';
2
- import gtThan from './conditions/number/greaterThan';
3
- import gtThanEq from './conditions/number/greaterThanOrEqual';
4
- import lt from './conditions/number/lessThan';
5
- import lsEq from './conditions/number/lessThanOrEqual';
6
- import set, { notSet } from './conditions/set';
7
- import beginsWith from './conditions/string/beginswith';
8
- import contains, { notContains } from './conditions/string/contains';
9
- export const filterNames = {
10
- none: 'None',
11
- empty: 'Not set',
12
- notEmpty: 'Set',
13
- eq: 'Equal',
14
- notEq: 'Not equal',
15
- begins: 'Begins with',
16
- contains: 'Contains',
17
- notContains: 'Does not contain',
18
- eqN: '=',
19
- neqN: '!=',
20
- gt: '>',
21
- gte: '>=',
22
- lt: '<',
23
- lte: '<=',
24
- };
25
- export const filterEntities = {
26
- none: () => true,
27
- empty: notSet,
28
- notEmpty: set,
29
- eq: eq,
30
- notEq: notEq,
31
- begins: beginsWith,
32
- contains: contains,
33
- notContains: notContains,
34
- eqN: eq,
35
- neqN: notEq,
36
- gt: gtThan,
37
- gte: gtThanEq,
38
- lt: lt,
39
- lte: lsEq,
40
- };
41
- export const filterTypes = {
42
- string: ['notEmpty', 'empty', 'eq', 'notEq', 'begins', 'contains', 'notContains'],
43
- number: ['notEmpty', 'empty', 'eqN', 'neqN', 'gt', 'gte', 'lt', 'lte'],
44
- };