@dlh.io/bideux 0.1.0

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 (90) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +90 -0
  3. package/dist/all.d.ts +14 -0
  4. package/dist/all.js +15 -0
  5. package/dist/all.js.map +1 -0
  6. package/dist/chunk-62IQGXLW.js +11470 -0
  7. package/dist/chunk-62IQGXLW.js.map +1 -0
  8. package/dist/chunk-75CRTQK7.js +315 -0
  9. package/dist/chunk-75CRTQK7.js.map +1 -0
  10. package/dist/chunk-FVO6E22Z.js +225 -0
  11. package/dist/chunk-FVO6E22Z.js.map +1 -0
  12. package/dist/chunk-GRITOB4M.js +337 -0
  13. package/dist/chunk-GRITOB4M.js.map +1 -0
  14. package/dist/chunk-HPFHIZWO.js +40 -0
  15. package/dist/chunk-HPFHIZWO.js.map +1 -0
  16. package/dist/chunk-IMNUQGHE.js +2864 -0
  17. package/dist/chunk-IMNUQGHE.js.map +1 -0
  18. package/dist/chunk-LHD445PJ.js +571 -0
  19. package/dist/chunk-LHD445PJ.js.map +1 -0
  20. package/dist/chunk-LPLBBHOW.js +386 -0
  21. package/dist/chunk-LPLBBHOW.js.map +1 -0
  22. package/dist/chunk-NGM5R3LW.js +881 -0
  23. package/dist/chunk-NGM5R3LW.js.map +1 -0
  24. package/dist/chunk-OMPR32AR.js +1320 -0
  25. package/dist/chunk-OMPR32AR.js.map +1 -0
  26. package/dist/chunk-QDQ5VVTC.js +255 -0
  27. package/dist/chunk-QDQ5VVTC.js.map +1 -0
  28. package/dist/chunk-RRWZKNDZ.js +1004 -0
  29. package/dist/chunk-RRWZKNDZ.js.map +1 -0
  30. package/dist/chunk-SRWIBMEB.js +178 -0
  31. package/dist/chunk-SRWIBMEB.js.map +1 -0
  32. package/dist/element/chunk-AOKCBPMV.js +1646 -0
  33. package/dist/element/chunk-AOKCBPMV.js.map +1 -0
  34. package/dist/element/chunk-B67SYRQP.js +281 -0
  35. package/dist/element/chunk-B67SYRQP.js.map +1 -0
  36. package/dist/element/chunk-FNRVFA2C.js +55 -0
  37. package/dist/element/chunk-FNRVFA2C.js.map +1 -0
  38. package/dist/element/chunk-G3C722QP.js +4707 -0
  39. package/dist/element/chunk-G3C722QP.js.map +1 -0
  40. package/dist/element/chunk-H5IFOSQP.js +346 -0
  41. package/dist/element/chunk-H5IFOSQP.js.map +1 -0
  42. package/dist/element/chunk-LXR3CLCN.js +30 -0
  43. package/dist/element/chunk-LXR3CLCN.js.map +1 -0
  44. package/dist/element/chunk-TFV4CJR4.js +183 -0
  45. package/dist/element/chunk-TFV4CJR4.js.map +1 -0
  46. package/dist/element/chunk-TXSK3CIN.js +859 -0
  47. package/dist/element/chunk-TXSK3CIN.js.map +1 -0
  48. package/dist/element/chunk-WDTTBY3S.js +45 -0
  49. package/dist/element/chunk-WDTTBY3S.js.map +1 -0
  50. package/dist/element/chunk-ZI3RYCAR.js +233 -0
  51. package/dist/element/chunk-ZI3RYCAR.js.map +1 -0
  52. package/dist/element/element.d.ts +3044 -0
  53. package/dist/element/element.js +146554 -0
  54. package/dist/element/element.js.map +1 -0
  55. package/dist/element/revo-grid.entry-7FHEBN3O.js +4817 -0
  56. package/dist/element/revo-grid.entry-7FHEBN3O.js.map +1 -0
  57. package/dist/element/revogr-attribution_7.entry-LSOFVZRA.js +1328 -0
  58. package/dist/element/revogr-attribution_7.entry-LSOFVZRA.js.map +1 -0
  59. package/dist/element/revogr-clipboard_3.entry-V74UIBPJ.js +494 -0
  60. package/dist/element/revogr-clipboard_3.entry-V74UIBPJ.js.map +1 -0
  61. package/dist/element/revogr-data_4.entry-2UBOKTFN.js +1041 -0
  62. package/dist/element/revogr-data_4.entry-2UBOKTFN.js.map +1 -0
  63. package/dist/element/revogr-filter-panel.entry-B24PLQU4.js +552 -0
  64. package/dist/element/revogr-filter-panel.entry-B24PLQU4.js.map +1 -0
  65. package/dist/index.d.ts +1041 -0
  66. package/dist/index.js +10 -0
  67. package/dist/index.js.map +1 -0
  68. package/dist/react.d.ts +1915 -0
  69. package/dist/react.js +14 -0
  70. package/dist/react.js.map +1 -0
  71. package/dist/renderers/echarts.d.ts +44 -0
  72. package/dist/renderers/echarts.js +6 -0
  73. package/dist/renderers/echarts.js.map +1 -0
  74. package/dist/renderers/index.d.ts +48 -0
  75. package/dist/renderers/index.js +12 -0
  76. package/dist/renderers/index.js.map +1 -0
  77. package/dist/renderers/revogrid.d.ts +76 -0
  78. package/dist/renderers/revogrid.js +6 -0
  79. package/dist/renderers/revogrid.js.map +1 -0
  80. package/dist/renderers/tabulator.d.ts +37 -0
  81. package/dist/renderers/tabulator.js +6 -0
  82. package/dist/renderers/tabulator.js.map +1 -0
  83. package/dist/result-table-CPls-277.d.ts +1885 -0
  84. package/dist/schema/dashboard.schema.json +4374 -0
  85. package/dist/schema/semantic-model.schema.json +1200 -0
  86. package/dist/schema/widget.schema.json +1793 -0
  87. package/dist/styles.css +156 -0
  88. package/dist/theme.css +1789 -0
  89. package/dist/types-CHFSsU_X.d.ts +1007 -0
  90. package/package.json +119 -0
@@ -0,0 +1,552 @@
1
+ import { AndOrButton, ReorderButton, TrashButton, isFilterBtn } from './chunk-WDTTBY3S.js';
2
+ import { debounce } from './chunk-TFV4CJR4.js';
3
+ import { registerInstance, createEvent, h, Host, getElement } from './chunk-G3C722QP.js';
4
+
5
+ // ../../node_modules/.pnpm/@revolist+revogrid@4.25.2/node_modules/@revolist/revogrid/dist/esm/revogr-filter-panel.entry.js
6
+ (function closest() {
7
+ if (!Element.prototype.matches) {
8
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
9
+ }
10
+ if (!Element.prototype.closest) {
11
+ Element.prototype.closest = function(s) {
12
+ let el = this;
13
+ do {
14
+ if (Element.prototype.matches.call(el, s)) {
15
+ return el;
16
+ }
17
+ el = el.parentElement || el.parentNode;
18
+ } while (el !== null && el.nodeType === 1);
19
+ return null;
20
+ };
21
+ }
22
+ })();
23
+ var FILTER_REORDER_MIME = "text/revogrid-filter-id";
24
+ function setFilterReorderData(dataTransfer, id) {
25
+ if (!dataTransfer) {
26
+ return;
27
+ }
28
+ dataTransfer.effectAllowed = "move";
29
+ dataTransfer.setData(FILTER_REORDER_MIME, String(id));
30
+ dataTransfer.setData("text/plain", String(id));
31
+ }
32
+ function getFilterReorderId(dataTransfer) {
33
+ if (!dataTransfer) {
34
+ return;
35
+ }
36
+ const rawId = dataTransfer.getData(FILTER_REORDER_MIME) || dataTransfer.getData("text/plain");
37
+ const normalizedId = rawId.trim();
38
+ if (!normalizedId) {
39
+ return;
40
+ }
41
+ const id = Number(normalizedId);
42
+ return Number.isFinite(id) ? id : void 0;
43
+ }
44
+ function moveFilterItem(items, sourceId, targetId) {
45
+ if (sourceId === targetId) {
46
+ return false;
47
+ }
48
+ const sourceIndex = items.findIndex((item) => item.id === sourceId);
49
+ const targetIndex = items.findIndex((item) => item.id === targetId);
50
+ if (sourceIndex === -1 || targetIndex === -1 || sourceIndex === targetIndex) {
51
+ return false;
52
+ }
53
+ const relationsByPosition = items.map((item) => {
54
+ var _a;
55
+ return (_a = item.relation) !== null && _a !== void 0 ? _a : "and";
56
+ });
57
+ const [movedItem] = items.splice(sourceIndex, 1);
58
+ items.splice(targetIndex, 0, movedItem);
59
+ items.forEach((item, index) => {
60
+ var _a;
61
+ item.relation = index === items.length - 1 ? "and" : (_a = relationsByPosition[index]) !== null && _a !== void 0 ? _a : "and";
62
+ });
63
+ return true;
64
+ }
65
+ var filterStyleCss = () => `.revo-button{position:relative;overflow:hidden;color:var(--rg-theme-button-text);background-color:var(--rg-theme-button-bg);height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:var(--rg-theme-button-success-bg)}.revo-button.red{background-color:var(--rg-theme-button-danger-bg)}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid var(--rg-theme-button-outline-border);line-height:30px;background:none;color:var(--rg-theme-button-outline-text);box-shadow:none}revogr-filter-panel{display:block}revogr-filter-panel .filter-panel-dialog{position:fixed;top:0;left:0;z-index:100;max-height:calc(100vh - 16px);overflow:auto;opacity:1;transform:none;color:var(--rg-theme-filter-panel-text);background-color:var(--rg-theme-filter-panel-bg);border:1px solid var(--rg-theme-filter-panel-border);transform-origin:62px 0px;box-shadow:0 5px 18px -2px var(--rg-theme-filter-panel-shadow);box-sizing:border-box;padding:10px;border-radius:8px;margin:0;min-width:220px;text-align:left;animation:revogr-filter-panel-open 140ms cubic-bezier(0.2, 0, 0, 1)}revogr-filter-panel .filter-panel-dialog .filter-holder>div{display:flex;flex-direction:column}revogr-filter-panel .filter-panel-dialog label{font-size:13px;display:block;padding:8px 0}revogr-filter-panel .filter-panel-dialog select{width:100%}revogr-filter-panel .filter-panel-dialog input[type=text]{border:0;min-height:34px;margin:5px 0;color:var(--rg-theme-filter-panel-text);background:var(--rg-theme-filter-panel-input-bg);border-radius:5px;padding:0 10px;box-sizing:border-box;width:100%}revogr-filter-panel .filter-panel-dialog .filter-actions{position:sticky;right:0;bottom:-10px;left:0;z-index:1;text-align:right;margin:10px -10px -10px;padding:0 5px 10px 10px;background:var(--rg-theme-filter-panel-bg);border-top:1px solid var(--rg-theme-filter-panel-divider)}revogr-filter-panel .filter-panel-dialog .filter-actions button{margin-top:10px;margin-right:5px}@keyframes revogr-filter-panel-open{from{opacity:0;transform:translateY(-4px) scale(0.98)}to{opacity:1;transform:none}}@media (prefers-reduced-motion: reduce){revogr-filter-panel .filter-panel-dialog{animation:none}}.rgHeaderCell:hover .rv-filter{transition:opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms}.rgHeaderCell:hover .rv-filter,.rgHeaderCell .rv-filter.active{opacity:1}.rgHeaderCell .rv-filter{height:24px;width:24px;background:none;border:0;opacity:0;visibility:visible;cursor:pointer;border-radius:4px}.rgHeaderCell .rv-filter.active{color:var(--rg-theme-filter-panel-icon-active)}.rgHeaderCell .rv-filter .filter-img{color:var(--rg-theme-filter-panel-icon);width:11px}.select-css{display:block;font-family:sans-serif;line-height:1.3;padding:0.6em 1.4em 0.5em 0.8em;width:100%;max-width:100%;box-sizing:border-box;margin:0;color:var(--rg-theme-filter-panel-text);border:1px solid var(--rg-theme-filter-panel-select-border);box-shadow:transparent;border-radius:0.5em;appearance:none;background-color:var(--rg-theme-filter-panel-input-bg);background-image:var(--revo-grid-filter-panel-select-arrow, url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E"));background-repeat:no-repeat, repeat;background-position:right 0.7em top 50%, 0 0;background-size:0.65em auto, 100%;}.select-css::-ms-expand{display:none}.select-css{}.select-css:hover{border-color:var(--rg-theme-filter-panel-select-border)}.select-css{}.select-css:focus{border-color:var(--rg-theme-filter-panel-select-border-hover);box-shadow:var(--rg-theme-filter-panel-focus-ring);outline:none}.select-css{}.select-css option{font-weight:normal}.select-css{}.select-css:disabled,.select-css[aria-disabled=true]{color:var(--rg-theme-filter-panel-muted-text);background-image:var(--revo-grid-filter-panel-select-arrow-disabled, url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22graytext%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E"))}.select-css:disabled:hover,.select-css[aria-disabled=true]{border-color:var(--rg-theme-filter-panel-select-border)}.multi-filter-list{margin-top:5px;margin-bottom:5px}.multi-filter-list div{white-space:nowrap}.multi-filter-list .multi-filter-list-row{display:flex;align-items:center;gap:6px;position:relative}.multi-filter-list .multi-filter-list-row.filter-row-dragging{opacity:0.65}.multi-filter-list .multi-filter-list-row.filter-row-drag-over::before{content:"";position:absolute;top:-4px;right:0;left:0;z-index:2;height:2px;background:var(--rg-theme-filter-panel-reorder-accent);border-radius:999px;box-shadow:0 0 0 2px var(--rg-theme-filter-panel-bg)}.multi-filter-list .multi-filter-list-row.filter-row-drop-active .filter-row-drop-target{pointer-events:auto}.multi-filter-list .filter-row-drop-target{position:absolute;inset:0;z-index:1;padding:0;pointer-events:none;background:transparent;border:0}.multi-filter-list .multi-filter-list-action{display:flex;align-self:stretch;flex:0 0 auto;justify-content:flex-end;align-items:center}.multi-filter-list .and-or-button{margin:0 0 0 10px;min-width:58px;cursor:pointer}.multi-filter-list .trash-button{margin:0 0 -2px 6px;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;width:22px;height:100%;font-size:16px}.multi-filter-list .trash-button .trash-img{width:1em}.multi-filter-list .reorder-button{border:0;background:transparent;color:var(--rg-theme-filter-panel-reorder-color);cursor:grab;font-family:monospace;font-size:12px;letter-spacing:0;line-height:1;padding:6px 2px;transform:scaleX(0.8);width:16px}.multi-filter-list .reorder-button.filter-row-drag-over{color:var(--rg-theme-filter-panel-reorder-accent)}.multi-filter-list .reorder-button:active{cursor:grabbing}.multi-filter-list-container{padding:0;margin:0;list-style:none}.add-filter-divider{display:block;margin:0 -10px 10px -10px;border-bottom:1px solid var(--rg-theme-filter-panel-divider);height:10px}.select-input{display:flex;align-items:center;flex:1 1 auto;gap:6px;min-width:0}.select-input .select-filter,.select-input .filter-extra{flex:1 1 0;min-width:0}.select-input .select-filter{width:auto}.select-input .filter-extra{display:flex}.select-input .filter-extra>*{width:100%}.select-input input[type=text],.select-input input[type=date]{margin:0}`;
66
+ var defaultType = "none";
67
+ var FILTER_LIST_CLASS = "multi-filter-list";
68
+ var FILTER_LIST_CLASS_ACTION = "multi-filter-list-action";
69
+ var FILTER_ID = "add-filter";
70
+ var VIEWPORT_PADDING = 8;
71
+ var FilterPanel = class {
72
+ constructor(hostRef) {
73
+ registerInstance(this, hostRef);
74
+ this.filterChange = createEvent(this, "filterChange", 7);
75
+ this.resetChange = createEvent(this, "resetChange", 7);
76
+ this.filterCaptionsInternal = {
77
+ title: "Filter by",
78
+ ok: "Close",
79
+ save: "Save",
80
+ // drops the filter
81
+ reset: "Reset",
82
+ cancel: "Cancel",
83
+ add: "Add condition",
84
+ placeholder: "Enter value...",
85
+ and: "and",
86
+ or: "or",
87
+ filterCondition: "Filter condition",
88
+ removeFilter: "Remove filter",
89
+ reorderFilter: "Reorder filter"
90
+ };
91
+ this.isFilterIdSet = false;
92
+ this.filterId = 0;
93
+ this.currentFilterId = -1;
94
+ this.currentFilterType = defaultType;
95
+ this.filterItems = {};
96
+ this.filterNames = {};
97
+ this.filterEntities = {};
98
+ this.disableDynamicFiltering = false;
99
+ this.closeOnOutsideClick = true;
100
+ this.allowDuplicateOperators = true;
101
+ this.debouncedApplyFilter = debounce(() => {
102
+ this.filterChange.emit(this.filterItems);
103
+ }, 400);
104
+ }
105
+ onMouseDown(e) {
106
+ if (!this.changes) {
107
+ return;
108
+ }
109
+ const path = e.composedPath();
110
+ const select = this.getAddFilterSelect();
111
+ if (select instanceof HTMLSelectElement) {
112
+ if (path.includes(select)) {
113
+ return;
114
+ }
115
+ select.value = defaultType;
116
+ }
117
+ this.currentFilterType = defaultType;
118
+ if (this.changes) {
119
+ this.changes.type = defaultType;
120
+ }
121
+ this.currentFilterId = -1;
122
+ const isOutside = !path.includes(this.element);
123
+ if (isOutside && !this.isOwnFilterButton(e.target) && this.closeOnOutsideClick) {
124
+ this.changes = void 0;
125
+ }
126
+ }
127
+ async show(newEntity) {
128
+ this.changes = newEntity;
129
+ this.filterItems = (newEntity === null || newEntity === void 0 ? void 0 : newEntity.filterItems) || {};
130
+ if (this.changes) {
131
+ this.changes.type = this.changes.type || defaultType;
132
+ }
133
+ }
134
+ async getChanges() {
135
+ return this.changes;
136
+ }
137
+ componentWillRender() {
138
+ if (!this.isFilterIdSet) {
139
+ this.isFilterIdSet = true;
140
+ const filterItems = Object.keys(this.filterItems);
141
+ for (const prop of filterItems) {
142
+ this.filterId += this.filterItems[prop].length;
143
+ }
144
+ }
145
+ }
146
+ getFilterItemsList() {
147
+ var _a, _b;
148
+ const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
149
+ if (typeof prop === "undefined")
150
+ return "";
151
+ const propFilters = (_b = this.filterItems[prop]) !== null && _b !== void 0 ? _b : [];
152
+ const visibleFilterCount = propFilters.filter((filter) => !filter.hidden).length;
153
+ const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
154
+ return h("div", { key: this.filterId }, h("ul", { class: "multi-filter-list-container" }, propFilters.map((filter, index) => {
155
+ let andOrButton;
156
+ if (filter.hidden) {
157
+ return;
158
+ }
159
+ if (index !== this.filterItems[prop].length - 1) {
160
+ andOrButton = h(AndOrButton, { text: filter.relation === "and" ? capts.and : capts.or, onClick: () => this.toggleFilterAndOr(filter.id) });
161
+ }
162
+ const extra = this.renderExtra(prop, index);
163
+ const isDragging = this.draggedFilterId === filter.id;
164
+ const isDragOver = this.dragOverFilterId === filter.id && !isDragging;
165
+ const canReorder = visibleFilterCount > 1;
166
+ return h("li", { key: filter.id, class: FILTER_LIST_CLASS, "aria-label": `${capts.filterCondition} ${index + 1}` }, h("div", { class: {
167
+ "multi-filter-list-row": true,
168
+ "filter-row-drop-active": this.draggedFilterId !== void 0 && !isDragging,
169
+ "filter-row-dragging": isDragging,
170
+ "filter-row-drag-over": isDragOver
171
+ } }, canReorder ? h("button", { type: "button", class: "filter-row-drop-target", tabIndex: -1, "aria-label": `${capts.filterCondition} ${index + 1}`, onDragOver: (e) => this.onFilterDragOver(e, filter.id), onDragLeave: () => this.onFilterDragLeave(filter.id), onDrop: (e) => this.onFilterDrop(e, prop, filter.id) }) : "", canReorder ? h(ReorderButton, { ariaLabel: capts.reorderFilter, dragging: isDragging, dragOver: isDragOver, onDragStart: (e) => this.onFilterDragStart(e, filter.id), onDragEnd: () => this.onFilterDragEnd(), onKeyDown: (e) => this.onFilterReorderKeyDown(e, prop, filter.id) }) : "", h("div", { class: { "select-input": true } }, h("select", { class: "select-css select-filter", onChange: (e) => this.onFilterTypeChange(e, prop, index) }, this.renderSelectOptions(this.filterItems[prop][index].type, true)), extra ? h("div", { class: "filter-extra" }, extra) : ""), h("div", { class: FILTER_LIST_CLASS_ACTION }, andOrButton, h(TrashButton, { ariaLabel: capts.removeFilter, onClick: () => this.onRemoveFilter(filter.id) }))));
172
+ })), propFilters.filter((f) => !f.hidden).length > 0 ? h("div", { class: "add-filter-divider" }) : "");
173
+ }
174
+ componentDidRender() {
175
+ this.syncDialog();
176
+ }
177
+ syncDialog() {
178
+ if (!this.dialog) {
179
+ return;
180
+ }
181
+ if (!this.changes) {
182
+ if (this.dialog.open) {
183
+ this.dialog.close();
184
+ }
185
+ return;
186
+ }
187
+ if (!this.dialog.open) {
188
+ this.dialog.show();
189
+ }
190
+ if (this.changes.autoCorrect !== false) {
191
+ this.autoCorrect(this.dialog);
192
+ requestAnimationFrame(() => this.autoCorrect(this.dialog));
193
+ }
194
+ }
195
+ autoCorrect(el) {
196
+ var _a;
197
+ if (!el || !this.changes) {
198
+ return;
199
+ }
200
+ el.style.maxHeight = "";
201
+ el.style.left = `${this.changes.x}px`;
202
+ el.style.top = `${this.changes.y}px`;
203
+ const pos = el.getBoundingClientRect();
204
+ const anchorTop = (_a = this.changes.anchorY) !== null && _a !== void 0 ? _a : this.changes.y;
205
+ const anchorBottom = this.changes.y;
206
+ const spaceAbove = Math.max(0, anchorTop - VIEWPORT_PADDING);
207
+ const spaceBelow = Math.max(0, window.innerHeight - anchorBottom - VIEWPORT_PADDING);
208
+ const openAbove = pos.height > spaceBelow && spaceAbove > spaceBelow;
209
+ const availableHeight = Math.max(VIEWPORT_PADDING, openAbove ? spaceAbove : spaceBelow);
210
+ el.style.maxHeight = `${availableHeight}px`;
211
+ const adjustedPos = el.getBoundingClientRect();
212
+ const maxLeft = Math.max(VIEWPORT_PADDING, window.innerWidth - adjustedPos.width - VIEWPORT_PADDING);
213
+ const maxTop = Math.max(VIEWPORT_PADDING, window.innerHeight - adjustedPos.height - VIEWPORT_PADDING);
214
+ const left = Math.min(Math.max(VIEWPORT_PADDING, this.changes.x), maxLeft);
215
+ const top = openAbove ? Math.min(Math.max(VIEWPORT_PADDING, anchorTop - adjustedPos.height), maxTop) : Math.min(Math.max(VIEWPORT_PADDING, anchorBottom), maxTop);
216
+ el.style.left = `${left}px`;
217
+ el.style.top = `${top}px`;
218
+ }
219
+ onFilterTypeChange(e, prop, index) {
220
+ if (!(e.target instanceof HTMLSelectElement)) {
221
+ return;
222
+ }
223
+ this.filterItems[prop][index].type = e.target.value;
224
+ this.filterId++;
225
+ setTimeout(() => {
226
+ const input = document.getElementById("filter-input-" + this.filterItems[prop][index].id);
227
+ if (input instanceof HTMLInputElement) {
228
+ input.focus();
229
+ }
230
+ }, 0);
231
+ if (!this.disableDynamicFiltering) {
232
+ this.debouncedApplyFilter();
233
+ }
234
+ }
235
+ onAddNewFilter(e) {
236
+ const el = e.target;
237
+ this.currentFilterType = el.value;
238
+ this.addNewFilterToProp();
239
+ const select = this.getAddFilterSelect();
240
+ if (select) {
241
+ select.value = defaultType;
242
+ this.currentFilterType = defaultType;
243
+ }
244
+ if (!this.disableDynamicFiltering) {
245
+ this.debouncedApplyFilter();
246
+ }
247
+ }
248
+ addNewFilterToProp() {
249
+ var _a;
250
+ const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
251
+ if (!(prop || prop === 0))
252
+ return;
253
+ if (!this.filterItems[prop]) {
254
+ this.filterItems[prop] = [];
255
+ }
256
+ if (this.currentFilterType === "none")
257
+ return;
258
+ this.filterId++;
259
+ this.currentFilterId = this.filterId;
260
+ this.filterItems[prop].push({
261
+ id: this.currentFilterId,
262
+ type: this.currentFilterType,
263
+ value: "",
264
+ relation: "and"
265
+ });
266
+ setTimeout(() => {
267
+ const input = document.getElementById("filter-input-" + this.currentFilterId);
268
+ if (input)
269
+ input.focus();
270
+ }, 0);
271
+ }
272
+ onSave() {
273
+ this.filterChange.emit(this.filterItems);
274
+ }
275
+ onCancel() {
276
+ this.changes = void 0;
277
+ }
278
+ onReset() {
279
+ var _a;
280
+ this.assertChanges();
281
+ this.resetChange.emit((_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop);
282
+ this.filterId++;
283
+ }
284
+ onRemoveFilter(id) {
285
+ var _a;
286
+ this.assertChanges();
287
+ this.filterId++;
288
+ const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
289
+ const items = this.filterItems[prop !== null && prop !== void 0 ? prop : ""];
290
+ if (!items)
291
+ return;
292
+ const index = items.findIndex((d) => d.id === id);
293
+ if (index === -1)
294
+ return;
295
+ items.splice(index, 1);
296
+ if (items.length === 0)
297
+ delete this.filterItems[prop !== null && prop !== void 0 ? prop : ""];
298
+ if (!this.disableDynamicFiltering) {
299
+ this.debouncedApplyFilter();
300
+ }
301
+ }
302
+ onFilterDragStart(e, id) {
303
+ this.draggedFilterId = id;
304
+ setFilterReorderData(e.dataTransfer, id);
305
+ }
306
+ onFilterDragOver(e, id) {
307
+ if (this.draggedFilterId === void 0 || this.draggedFilterId === id) {
308
+ return;
309
+ }
310
+ e.preventDefault();
311
+ if (e.dataTransfer) {
312
+ e.dataTransfer.dropEffect = "move";
313
+ }
314
+ this.dragOverFilterId = id;
315
+ }
316
+ onFilterDragLeave(id) {
317
+ if (this.dragOverFilterId === id) {
318
+ this.dragOverFilterId = void 0;
319
+ }
320
+ }
321
+ onFilterDrop(e, prop, targetId) {
322
+ var _a;
323
+ e.preventDefault();
324
+ const sourceId = (_a = this.draggedFilterId) !== null && _a !== void 0 ? _a : getFilterReorderId(e.dataTransfer);
325
+ this.onFilterDragEnd();
326
+ if (sourceId === void 0) {
327
+ return;
328
+ }
329
+ const items = this.filterItems[prop];
330
+ if (!items) {
331
+ return;
332
+ }
333
+ if (!moveFilterItem(items, sourceId, targetId)) {
334
+ return;
335
+ }
336
+ this.filterId++;
337
+ if (!this.disableDynamicFiltering) {
338
+ this.debouncedApplyFilter();
339
+ }
340
+ }
341
+ onFilterDragEnd() {
342
+ this.draggedFilterId = void 0;
343
+ this.dragOverFilterId = void 0;
344
+ }
345
+ onFilterReorderKeyDown(e, prop, sourceId) {
346
+ let direction = 0;
347
+ if (e.key === "ArrowUp") {
348
+ direction = -1;
349
+ } else if (e.key === "ArrowDown") {
350
+ direction = 1;
351
+ } else {
352
+ return;
353
+ }
354
+ const items = this.filterItems[prop];
355
+ if (!items) {
356
+ return;
357
+ }
358
+ const visibleItems = items.filter((item) => !item.hidden);
359
+ const sourceIndex = visibleItems.findIndex((item) => item.id === sourceId);
360
+ if (sourceIndex === -1) {
361
+ return;
362
+ }
363
+ e.preventDefault();
364
+ e.stopPropagation();
365
+ const target = visibleItems[sourceIndex + direction];
366
+ if (!target || !moveFilterItem(items, sourceId, target.id)) {
367
+ return;
368
+ }
369
+ this.filterId++;
370
+ if (!this.disableDynamicFiltering) {
371
+ this.debouncedApplyFilter();
372
+ }
373
+ }
374
+ toggleFilterAndOr(id) {
375
+ var _a;
376
+ this.assertChanges();
377
+ this.filterId++;
378
+ const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
379
+ const items = this.filterItems[prop !== null && prop !== void 0 ? prop : ""];
380
+ if (!items)
381
+ return;
382
+ const index = items.findIndex((d) => d.id === id);
383
+ if (index === -1)
384
+ return;
385
+ items[index].relation = items[index].relation === "and" ? "or" : "and";
386
+ if (!this.disableDynamicFiltering) {
387
+ this.debouncedApplyFilter();
388
+ }
389
+ }
390
+ assertChanges() {
391
+ if (!this.changes) {
392
+ throw new Error("Changes required per edit");
393
+ }
394
+ }
395
+ renderSelectOptions(type, isDefaultTypeRemoved = false) {
396
+ var _a;
397
+ if (!this.changes) {
398
+ return;
399
+ }
400
+ const options = [];
401
+ const prop = this.changes.prop;
402
+ if (prop === void 0) {
403
+ return;
404
+ }
405
+ const hidden = /* @__PURE__ */ new Set();
406
+ Object.keys(this.filterItems).forEach((prop2) => {
407
+ const values = this.filterItems[prop2];
408
+ values.forEach((filter) => {
409
+ if (filter.hidden) {
410
+ hidden.add(filter.type);
411
+ }
412
+ });
413
+ });
414
+ const selectedTypes = new Set(((_a = this.filterItems[prop]) !== null && _a !== void 0 ? _a : []).filter((filter) => !filter.hidden).map((filter) => filter.type));
415
+ if (!isDefaultTypeRemoved) {
416
+ const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
417
+ options.push(h("option", { selected: this.currentFilterType === defaultType, value: defaultType }, prop && this.filterItems[prop] && this.filterItems[prop].length > 0 ? capts.add : this.filterNames[defaultType]));
418
+ }
419
+ for (let gIndex in this.changes.filterTypes) {
420
+ const group = this.changes.filterTypes[gIndex].filter((k) => !hidden.has(k) && (this.allowDuplicateOperators || !selectedTypes.has(k) || isDefaultTypeRemoved && type === k));
421
+ if (group.length) {
422
+ options.push(...group.map((k) => h("option", { value: k, selected: type === k }, this.filterNames[k])));
423
+ options.push(h("option", { disabled: true }));
424
+ }
425
+ }
426
+ return options;
427
+ }
428
+ renderExtra(prop, index) {
429
+ const currentFilter = this.filterItems[prop];
430
+ if (!currentFilter)
431
+ return "";
432
+ const applyFilter = (value) => {
433
+ this.filterItems[prop][index].value = value;
434
+ if (!this.disableDynamicFiltering) {
435
+ this.debouncedApplyFilter();
436
+ }
437
+ };
438
+ const focusNext = () => {
439
+ const select = this.getAddFilterSelect();
440
+ if (select) {
441
+ select.value = defaultType;
442
+ this.currentFilterType = defaultType;
443
+ this.addNewFilterToProp();
444
+ select.focus();
445
+ }
446
+ };
447
+ const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
448
+ const extra = this.filterEntities[currentFilter[index].type].extra;
449
+ if (typeof extra === "function") {
450
+ return extra(h, {
451
+ value: currentFilter[index].value,
452
+ filter: currentFilter[index],
453
+ prop,
454
+ index,
455
+ placeholder: capts.placeholder,
456
+ onInput: (value) => {
457
+ applyFilter(value);
458
+ },
459
+ onFocus: () => {
460
+ focusNext();
461
+ }
462
+ });
463
+ }
464
+ if (extra !== "input" && extra !== "datepicker") {
465
+ return "";
466
+ }
467
+ return h("input", { id: `filter-input-${currentFilter[index].id}`, placeholder: capts.placeholder, type: extra === "datepicker" ? "date" : "text", value: currentFilter[index].value, onInput: (e) => {
468
+ if (e.target instanceof HTMLInputElement) {
469
+ applyFilter(e.target.value);
470
+ }
471
+ }, onKeyDown: (e) => {
472
+ if (e.key.toLowerCase() === "enter") {
473
+ const select = this.getAddFilterSelect();
474
+ if (select) {
475
+ focusNext();
476
+ }
477
+ return;
478
+ }
479
+ e.stopPropagation();
480
+ } });
481
+ }
482
+ getAddFilterSelect() {
483
+ return this.element.querySelector(`#${FILTER_ID}`);
484
+ }
485
+ isOwnFilterButton(target) {
486
+ if (!(target instanceof Element)) {
487
+ return false;
488
+ }
489
+ if (!isFilterBtn(target)) {
490
+ return false;
491
+ }
492
+ const panelGrid = this.getOwningGrid(this.element);
493
+ const targetGrid = this.getOwningGrid(target);
494
+ return !!panelGrid && panelGrid === targetGrid;
495
+ }
496
+ getOwningGrid(element) {
497
+ const grid = element.closest("revo-grid");
498
+ if (grid) {
499
+ return grid;
500
+ }
501
+ const root = element.getRootNode();
502
+ if (root instanceof ShadowRoot && root.host.localName === "revo-grid") {
503
+ return root.host;
504
+ }
505
+ return void 0;
506
+ }
507
+ render() {
508
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
509
+ const style = {
510
+ left: `${(_b = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0}px`,
511
+ top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`
512
+ };
513
+ const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
514
+ return h(Host, { key: "8859c452eb08838f65f18efecbdde7f65fda2b49" }, h("dialog", { key: "f603067ff0986a9f344cbbf816388d2bbac198bb", class: "filter-panel-dialog", style, ref: (el) => this.dialog = el, onCancel: (e) => {
515
+ e.preventDefault();
516
+ this.onCancel();
517
+ } }, this.changes && [
518
+ h("slot", { key: "header-slot", slot: "header" }),
519
+ ((_f = (_e = this.changes).extraContent) === null || _f === void 0 ? void 0 : _f.call(_e, this.changes)) || "",
520
+ ((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
521
+ h("label", { key: "filter-title" }, capts.title),
522
+ h("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
523
+ h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: "2ec0a66918edf91bdde3962b6ec84c89f6f1c8f1", id: FILTER_ID, class: "select-css", onChange: (e) => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType)))
524
+ ],
525
+ h("slot", { key: "default-slot" }),
526
+ ((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || "",
527
+ h("div", { key: "filter-actions", class: "filter-actions" }, this.disableDynamicFiltering && [
528
+ h("button", { key: "save", id: "revo-button-save", "aria-label": "save", class: "revo-button green", onClick: () => this.onSave() }, capts.save),
529
+ h("button", { key: "cancel", id: "revo-button-ok", "aria-label": "ok", class: "revo-button green", onClick: () => this.onCancel() }, capts.cancel)
530
+ ], !this.disableDynamicFiltering && [
531
+ h("button", { key: "ok", id: "revo-button-ok", "aria-label": "ok", class: "revo-button green", onClick: () => this.onCancel() }, capts.ok),
532
+ h("button", { key: "reset", id: "revo-button-reset", "aria-label": "reset", class: "revo-button outline", onClick: () => this.onReset() }, capts.reset)
533
+ ]),
534
+ h("slot", { key: "footer-slot", slot: "footer" })
535
+ ]));
536
+ }
537
+ get element() {
538
+ return getElement(this);
539
+ }
540
+ };
541
+ FilterPanel.style = filterStyleCss();
542
+ /*! Bundled license information:
543
+
544
+ @revolist/revogrid/dist/esm/revogr-filter-panel.entry.js:
545
+ (*!
546
+ * Built by Revolist OU ❤️
547
+ *)
548
+ */
549
+
550
+ export { FilterPanel as revogr_filter_panel };
551
+ //# sourceMappingURL=revogr-filter-panel.entry-B24PLQU4.js.map
552
+ //# sourceMappingURL=revogr-filter-panel.entry-B24PLQU4.js.map