@mono-lit/helper 0.0.9 → 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 (164) hide show
  1. package/dist/accordion-core-DaNyPWRr.js +277 -0
  2. package/dist/alert-core-DWtHbX_-.js +134 -0
  3. package/dist/breadcrumb-list-core-Dh68T8Cf.js +747 -0
  4. package/dist/{mono-button-CLkHg3WW.js → button-core-DerXg84Q.js} +3 -276
  5. package/dist/button-dropdown-core-DKYEOyjy.js +654 -0
  6. package/dist/button-utils-D5-66M02.js +63 -0
  7. package/dist/card-utils-l80qAmrN.js +312 -0
  8. package/dist/chart-core-DV7hD3ZY.js +801 -0
  9. package/dist/checkbox-utils-DKdrhAzF.js +337 -0
  10. package/dist/chip-utils-DpRrd7Zj.js +403 -0
  11. package/dist/{data-source-controller-C6C4ej_M.js → data-source-controller-DS_JLrmS.js} +1 -1
  12. package/dist/{data-source-options-fxT5QIX4.js → data-source-options-DJUNU26C.js} +6 -6
  13. package/dist/{data-source-read-BL266IW0.js → data-source-read-uKJpRAzx.js} +2 -2
  14. package/dist/date-core-CyuSyvvG.js +734 -0
  15. package/dist/drawer-core-DbFWvNln.js +759 -0
  16. package/dist/dropdown-core-BCH1pK14.js +511 -0
  17. package/dist/dropdown-table-core-SfHUJVFq.js +1342 -0
  18. package/dist/export.js +1 -1
  19. package/dist/{field-path-BabiMrrA.js → field-path-DK2VBWHl.js} +1 -1
  20. package/dist/field-tooltip.css_raw-DVblekCl.js +5 -0
  21. package/dist/{field-validation.css_raw-Cx6SGrfP.js → field-validation.css_raw-BU7C6173.js} +1 -170
  22. package/dist/file-upload-core-Cz_dBQMx.js +624 -0
  23. package/dist/filter-builder-core-DyWjbBP7.js +381 -0
  24. package/dist/{filter-builder-B6Y2mmbM.js → filter-builder-vbqIuPhX.js} +1 -1
  25. package/dist/{filter-eval-ChDSaAUH.js → filter-eval-CqeBnMYh.js} +1 -1
  26. package/dist/{filter-odata-Bi27XUpQ.js → filter-odata-GsczYKNC.js} +1 -1
  27. package/dist/{hydration-flush-BaE9gN3C.js → hydration-flush-Volt9X7Q.js} +2 -1071
  28. package/dist/index.js +11 -11
  29. package/dist/{index.node-DTqDBca7.js → index.node-Csy9zrr1.js} +4 -4
  30. package/dist/index.node.js +11 -11
  31. package/dist/input-utils-BglY-k0H.js +1145 -0
  32. package/dist/menu-core-DkAYuCZ2.js +831 -0
  33. package/dist/modal-core-CSBSPN_m.js +844 -0
  34. package/dist/mono-button-DVvZ03P-.js +280 -0
  35. package/dist/{mono-button.shadow-DqZMpcqY.js → mono-button.shadow-BANxMGln.js} +6 -594
  36. package/dist/{mono-data-chart-NKPdAgVq.js → mono-data-chart-ChF4J9RT.js} +6 -6
  37. package/dist/{mono-data-dropdown-B2iRpJuI.js → mono-data-dropdown-Bgj2PDfm.js} +1 -1
  38. package/dist/{mono-data-grid-llJCX9MC.js → mono-data-grid-DJkp96N-.js} +144 -46
  39. package/dist/{mono-event-BPku9HpS.js → mono-event-CAZf0F_k.js} +14 -9
  40. package/dist/{mono-form-controller-BrA10erm.js → mono-form-controller-DxZLvyg6.js} +2 -1
  41. package/dist/mono-table-checkbox-core-BKOMx8R5.js +5288 -0
  42. package/dist/nav-core-B5qU2dzn.js +225 -0
  43. package/dist/{normalize-error-D93O4q8g.js → normalize-error-BEcd1tmS.js} +2 -2
  44. package/dist/nuxt.js +1 -1
  45. package/dist/otp-core-DXg3vFLh.js +758 -0
  46. package/dist/radio-utils-Dk9Tl1jz.js +319 -0
  47. package/dist/rich-text-editor-core-Ddd_QaLn.js +1280 -0
  48. package/dist/select-utils-BgArYHk8.js +2140 -0
  49. package/dist/sidebar-core-CD6txDo3.js +583 -0
  50. package/dist/slider-core-vcWr321-.js +1014 -0
  51. package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +2 -2
  52. package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +1 -1
  53. package/dist/src/components/dropdown-table/index.d.ts +1 -1
  54. package/dist/src/components/dropdown-table/index.shadow.d.ts +1 -1
  55. package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +1 -1
  56. package/dist/src/components/form/form-types.d.ts +9 -3
  57. package/dist/src/components/input/input-core.d.ts +1 -1
  58. package/dist/src/components/input/input-types.d.ts +1 -1
  59. package/dist/src/components/otp/otp-core.d.ts +1 -1
  60. package/dist/src/components/select/select-core.d.ts +1 -1
  61. package/dist/src/components/select/select-types.d.ts +1 -1
  62. package/dist/src/components/slider/slider-core.d.ts +1 -1
  63. package/dist/src/components/slider/slider-types.d.ts +1 -1
  64. package/dist/src/components/table/filter-suggestion.d.ts +171 -0
  65. package/dist/src/components/table/index.d.ts +5 -4
  66. package/dist/src/components/table/index.shadow.d.ts +5 -4
  67. package/dist/src/components/table/mono-data-grid.d.ts +22 -3
  68. package/dist/src/components/table/mono-table-empty-core.d.ts +37 -0
  69. package/dist/src/components/table/mono-table-search-core.d.ts +22 -3
  70. package/dist/src/components/table/table-types.d.ts +74 -4
  71. package/dist/src/components/tag-input/tag-input-core.d.ts +1 -1
  72. package/dist/src/components/tag-input/tag-input-types.d.ts +1 -1
  73. package/dist/src/components/textarea/textarea-core.d.ts +1 -1
  74. package/dist/src/composables/mono-event.d.ts +7 -1
  75. package/dist/src/entries/index.d.ts +8 -6
  76. package/dist/src/entries/index.node.d.ts +8 -6
  77. package/dist/src/search/index.d.ts +1 -1
  78. package/dist/src/utils/group-count.d.ts +36 -0
  79. package/dist/switch-utils-CTZ4id2V.js +338 -0
  80. package/dist/tabs-core-r5-B8k_N.js +317 -0
  81. package/dist/tag-input-utils-D2JA90DQ.js +3060 -0
  82. package/dist/textarea-utils-VU1KeXm8.js +821 -0
  83. package/dist/ui/accordion.js +2 -274
  84. package/dist/ui/alert.js +2 -131
  85. package/dist/ui/breadcrumb.js +4 -745
  86. package/dist/ui/button-dropdown.js +4 -652
  87. package/dist/ui/button.js +2 -63
  88. package/dist/ui/card.js +2 -310
  89. package/dist/ui/chart.js +4 -800
  90. package/dist/ui/checkbox.js +4 -335
  91. package/dist/ui/chip.js +4 -402
  92. package/dist/ui/date.js +3 -732
  93. package/dist/ui/drawer.js +3 -757
  94. package/dist/ui/dropdown-table.js +5 -1341
  95. package/dist/ui/dropdown.js +4 -509
  96. package/dist/ui/file-upload.js +3 -622
  97. package/dist/ui/filter.js +5 -380
  98. package/dist/ui/form.js +1 -1
  99. package/dist/ui/index.css +118 -1
  100. package/dist/ui/input.js +3 -1141
  101. package/dist/ui/menu.js +4 -828
  102. package/dist/ui/modal.js +4 -843
  103. package/dist/ui/nav.js +4 -223
  104. package/dist/ui/otp.js +4 -756
  105. package/dist/ui/radio.js +4 -317
  106. package/dist/ui/rich-text-editor.js +4 -1278
  107. package/dist/ui/select.js +5 -2138
  108. package/dist/ui/shadow/accordion.js +4 -273
  109. package/dist/ui/shadow/alert.js +4 -130
  110. package/dist/ui/shadow/breadcrumb.js +5 -744
  111. package/dist/ui/shadow/button-dropdown.js +6 -652
  112. package/dist/ui/shadow/button.js +3 -63
  113. package/dist/ui/shadow/card.js +4 -309
  114. package/dist/ui/shadow/chart.js +6 -1576
  115. package/dist/ui/shadow/checkbox.js +4 -334
  116. package/dist/ui/shadow/chip.js +4 -396
  117. package/dist/ui/shadow/date.js +7 -731
  118. package/dist/ui/shadow/drawer.js +4 -756
  119. package/dist/ui/shadow/dropdown-table.js +8 -1762
  120. package/dist/ui/shadow/dropdown.js +4 -508
  121. package/dist/ui/shadow/file-upload.js +4 -620
  122. package/dist/ui/shadow/filter.js +7 -379
  123. package/dist/ui/shadow/input.js +6 -1140
  124. package/dist/ui/shadow/menu.js +5 -828
  125. package/dist/ui/shadow/modal.js +6 -1063
  126. package/dist/ui/shadow/nav.js +5 -223
  127. package/dist/ui/shadow/otp.js +6 -754
  128. package/dist/ui/shadow/radio.js +4 -316
  129. package/dist/ui/shadow/rich-text-editor.js +4 -1276
  130. package/dist/ui/shadow/select.js +6 -2136
  131. package/dist/ui/shadow/sidebar.js +5 -581
  132. package/dist/ui/shadow/slider.js +5 -1010
  133. package/dist/ui/shadow/switch.js +4 -335
  134. package/dist/ui/shadow/table.js +10 -4501
  135. package/dist/ui/shadow/tabs.js +6 -315
  136. package/dist/ui/shadow/tag-input.js +7 -3057
  137. package/dist/ui/shadow/textarea.js +6 -817
  138. package/dist/ui/sidebar.js +3 -581
  139. package/dist/ui/slider.js +4 -1012
  140. package/dist/ui/switch.js +4 -336
  141. package/dist/ui/table.js +9 -4502
  142. package/dist/ui/tabs.js +4 -315
  143. package/dist/ui/tag-input.js +5 -3058
  144. package/dist/ui/textarea.js +4 -819
  145. package/dist/{vite-CivRCJaf.js → vite-CfW7z2wn.js} +21 -14
  146. package/dist/vite.js +1 -1
  147. package/dist/vue.d.ts +3 -2
  148. package/package.json +10 -11
  149. package/dist/chip-strip-bNfLn52Z.js +0 -215
  150. package/dist/data-source-controller-Dx6IQ2CN.js +0 -243
  151. package/dist/data-source-options-BM4r4PRw.js +0 -558
  152. package/dist/data-source-read-HyBCRg1t.js +0 -242
  153. package/dist/excel-BXzr3uI1.js +0 -784
  154. package/dist/export-ixRdCS2y.js +0 -2388
  155. package/dist/field-tooltip-addon-CWCp19mJ.js +0 -702
  156. package/dist/field-tooltip.css_raw-U5UeTa2d.js +0 -269
  157. package/dist/filter-builder-C0T3pMx2.js +0 -208
  158. package/dist/form-control-core-BbiACMtL.js +0 -226
  159. package/dist/icon-ClxnYhBG.js +0 -19
  160. package/dist/import-Dc4eXC02.js +0 -612
  161. package/dist/light-slots-_no0r2Z-.js +0 -246
  162. package/dist/markdown-uGlE_OfJ.js +0 -20191
  163. package/dist/mono-data-grid-e9ZVBlNN.js +0 -4240
  164. package/dist/normalize-error-BmLbgANw.js +0 -1048
@@ -1,269 +0,0 @@
1
- import { o as infoIcon } from "./field-icons-t8rXRCKs.js";
2
- import { html, nothing } from "lit";
3
- import { ref } from "lit/directives/ref.js";
4
-
5
- //#region src/composables/field-bubble.ts
6
- /** Gap between anchor and bubble, and the bubble's minimum distance to the viewport edge. */
7
- const GAP = 8;
8
- const EDGE = 8;
9
- /** Grace period for moving the pointer from the anchor onto the bubble. */
10
- const HIDE_DELAY = 120;
11
- let _uid = 0;
12
- var FieldBubble = class {
13
- constructor(options = {}) {
14
- this.id = `mono-field-bubble-${++_uid}`;
15
- this._anchor = null;
16
- this._bubble = null;
17
- this._open = false;
18
- this.setAnchor = (el) => {
19
- this._anchor = el ?? null;
20
- };
21
- this.setBubble = (el) => {
22
- if ((el ?? null) !== this._bubble) this.hide();
23
- this._bubble = el ?? null;
24
- };
25
- this.show = () => {
26
- this.cancelHide();
27
- const bubble = this._bubble;
28
- if (!bubble || !bubble.isConnected || !this._anchor) return;
29
- if (!this._open) {
30
- this._open = true;
31
- bubble.setAttribute("mono-open", "");
32
- try {
33
- if (typeof bubble.showPopover === "function" && !bubble.matches(":popover-open")) bubble.showPopover();
34
- } catch {}
35
- window.addEventListener("scroll", this.place, true);
36
- window.addEventListener("resize", this.place);
37
- }
38
- this.place();
39
- };
40
- this.hide = () => {
41
- this.cancelHide();
42
- if (!this._open) return;
43
- this._open = false;
44
- window.removeEventListener("scroll", this.place, true);
45
- window.removeEventListener("resize", this.place);
46
- const bubble = this._bubble;
47
- if (!bubble) return;
48
- bubble.removeAttribute("mono-open");
49
- try {
50
- if (typeof bubble.hidePopover === "function" && bubble.matches(":popover-open")) bubble.hidePopover();
51
- } catch {}
52
- };
53
- this.scheduleHide = () => {
54
- this.cancelHide();
55
- this._hideTimer = setTimeout(this.hide, HIDE_DELAY);
56
- };
57
- this.cancelHide = () => {
58
- if (this._hideTimer !== void 0) clearTimeout(this._hideTimer);
59
- this._hideTimer = void 0;
60
- };
61
- this.onPointerLeave = (e) => {
62
- if (e.pointerType === "touch") return;
63
- this.scheduleHide();
64
- };
65
- this.onKeydown = (e) => {
66
- if (e.key === "Escape" && this._open) {
67
- e.stopPropagation();
68
- this.hide();
69
- }
70
- };
71
- this.place = () => {
72
- const anchor = this._anchor;
73
- const bubble = this._bubble;
74
- if (!this._open || !anchor || !bubble) return;
75
- const r = anchor.getBoundingClientRect();
76
- const vw = document.documentElement.clientWidth || window.innerWidth;
77
- const vh = window.innerHeight;
78
- const bw = bubble.offsetWidth;
79
- const bh = bubble.offsetHeight;
80
- const above = r.top - GAP - bh;
81
- const below = r.bottom + GAP;
82
- const fitsAbove = above >= EDGE;
83
- const fitsBelow = below + bh <= vh - EDGE;
84
- const side = this._side === "top" ? fitsAbove || !fitsBelow ? "top" : "bottom" : fitsBelow || !fitsAbove ? "bottom" : "top";
85
- const top = side === "top" ? above : below;
86
- const target = this._align === "center" ? r.left + r.width / 2 : r.left + Math.min(16, r.width / 2);
87
- const ideal = this._align === "center" ? target - bw / 2 : r.left;
88
- const left = Math.min(Math.max(ideal, EDGE), Math.max(EDGE, vw - EDGE - bw));
89
- bubble.style.top = `${Math.round(top)}px`;
90
- bubble.style.left = `${Math.round(left)}px`;
91
- bubble.style.setProperty("--_mono-field-tip-arrow-x", `${Math.round(target - left)}px`);
92
- bubble.setAttribute("mono-side", side);
93
- };
94
- this._side = options.side ?? "top";
95
- this._align = options.align ?? "center";
96
- }
97
- get isOpen() {
98
- return this._open;
99
- }
100
- };
101
-
102
- //#endregion
103
- //#region src/composables/field-tooltip.ts
104
- /** `controlMonoTooltip` once floating-ui is known to load, else `null`. Probed once per page. */
105
- let _probe = null;
106
- function probeTooltip() {
107
- _probe ??= (async () => {
108
- try {
109
- const { loadFieldTooltipAddon } = await import("./field-tooltip-addon-CWCp19mJ.js");
110
- return await loadFieldTooltipAddon();
111
- } catch {
112
- return null;
113
- }
114
- })();
115
- return _probe;
116
- }
117
- /** `string` → `{ content }`; anything without content → `null` (renders nothing). */
118
- function normalizeFieldTooltip(value) {
119
- if (!value) return null;
120
- if (typeof value === "string") return value.trim() ? { content: value } : null;
121
- if (typeof value !== "object") return null;
122
- const { content } = value;
123
- if (content === void 0 || content === null || content === "") return null;
124
- return value;
125
- }
126
- /** Which bubble a prop value gets: the built-in one, the floating-ui addon, or none. */
127
- function tooltipMode(value) {
128
- if (!normalizeFieldTooltip(value)) return null;
129
- return typeof value === "string" ? "simple" : "floating";
130
- }
131
- /** A click on the bubble is still inside the `<label>` and the icon: neither should react. */
132
- const stopBubbleClick = (e) => {
133
- e.preventDefault();
134
- e.stopPropagation();
135
- };
136
- const stopLabelActivation = (e) => {
137
- e.preventDefault();
138
- };
139
- var FieldTooltipController = class {
140
- constructor(host, read) {
141
- this.host = host;
142
- this.read = read;
143
- this._fn = null;
144
- this._ctrl = null;
145
- this._el = null;
146
- this._applied = null;
147
- this._raw = null;
148
- this._connected = false;
149
- this._bubble = new FieldBubble({
150
- side: "top",
151
- align: "center"
152
- });
153
- this._setEl = (el) => {
154
- if ((el ?? null) !== this._el) this._unbind();
155
- this._el = el ?? null;
156
- this._bubble.setAnchor(this._el);
157
- };
158
- this._onIconClick = (e) => {
159
- stopLabelActivation(e);
160
- this._bubble.show();
161
- };
162
- host.addController(this);
163
- }
164
- hostConnected() {
165
- this._connected = true;
166
- }
167
- hostDisconnected() {
168
- this._connected = false;
169
- this._bubble.hide();
170
- this._unbind();
171
- }
172
- hostUpdated() {
173
- if (tooltipMode(this.read()) === "floating") this._ensureProbe();
174
- this._sync();
175
- }
176
- /** The ⓘ for the end of the label row, or `nothing`. */
177
- render() {
178
- const raw = this.read();
179
- const mode = tooltipMode(raw);
180
- if (mode === "simple") return this._renderSimple(raw);
181
- if (mode !== "floating" || !this._fn) return nothing;
182
- return html`<span
183
- mono-label-tooltip
184
- tabindex="0"
185
- role="img"
186
- aria-label="More information"
187
- @click=${stopLabelActivation}
188
- ${ref(this._setEl)}
189
- >${this._icon()}</span>`;
190
- }
191
- /**
192
- * Plain text: the icon carries its own bubble. `aria-describedby` reads the
193
- * text to screen readers on focus; hover, focus or a tap shows it, Escape
194
- * dismisses it, and the pointer may move onto it without it closing.
195
- */
196
- _renderSimple(text) {
197
- return html`<span
198
- mono-label-tooltip
199
- tabindex="0"
200
- role="img"
201
- aria-label="More information"
202
- aria-describedby=${this._bubble.id}
203
- @click=${this._onIconClick}
204
- @pointerenter=${this._bubble.show}
205
- @pointerleave=${this._bubble.onPointerLeave}
206
- @focus=${this._bubble.show}
207
- @blur=${this._bubble.hide}
208
- @keydown=${this._bubble.onKeydown}
209
- ${ref(this._setEl)}
210
- >${this._icon()}<span
211
- mono-field-bubble
212
- mono-label-tooltip-bubble
213
- id=${this._bubble.id}
214
- role="tooltip"
215
- popover="manual"
216
- @pointerenter=${this._bubble.cancelHide}
217
- @pointerleave=${this._bubble.onPointerLeave}
218
- @click=${stopBubbleClick}
219
- ${ref(this._bubble.setBubble)}
220
- >${text}</span></span>`;
221
- }
222
- /**
223
- * Light build: the UnoCSS `i-mdi-information-outline` mask (shipped in
224
- * `ui/index.css`). Shadow build: the same path inline — the page's icon CSS
225
- * cannot reach a shadow root.
226
- */
227
- _icon() {
228
- if (this.host.renderRoot instanceof ShadowRoot) return infoIcon();
229
- return html`<span class="mono-icon i-mdi-information-outline" mono-icon aria-hidden="true"></span>`;
230
- }
231
- _ensureProbe() {
232
- if (this._fn || typeof document === "undefined") return;
233
- probeTooltip().then((fn) => {
234
- if (!fn || this._fn) return;
235
- this._fn = fn;
236
- this.host.requestUpdate();
237
- });
238
- }
239
- _sync() {
240
- const raw = this.read();
241
- if (tooltipMode(raw) !== "floating") return this._unbind();
242
- if (this._ctrl && this._raw === raw) return;
243
- const options = normalizeFieldTooltip(raw);
244
- if (!this._fn || !this._connected || !this._el || !options) return this._unbind();
245
- if (this._ctrl) {
246
- const blanked = {};
247
- for (const key of Object.keys(this._applied ?? {})) blanked[key] = void 0;
248
- this._ctrl.update({
249
- ...blanked,
250
- ...options
251
- });
252
- } else this._ctrl = this._fn(this._el, options);
253
- this._applied = options;
254
- this._raw = raw;
255
- }
256
- _unbind() {
257
- this._ctrl?.destroy();
258
- this._ctrl = null;
259
- this._applied = null;
260
- this._raw = null;
261
- }
262
- };
263
-
264
- //#endregion
265
- //#region \0raw:C:\Users\VCT-DEV\Desktop\libs\packages\helper\src\components\form\field-tooltip.css?raw.js
266
- var field_tooltip_css_raw_default = "/* =========================================\r\n Field tooltip — the BUILT-IN bubble behind a plain-text `tooltip=\"…\"` on\r\n every field control (input, select, tag-input, date, textarea,\r\n dropdown-table, slider). No floating-ui: composables/field-tooltip.ts\r\n shows it in the top layer (Popover API) and writes its fixed `top` /\r\n `left`, `mono-side` (top|bottom) and the arrow's x. The object form\r\n (`.tooltip=${{…}}`) is the tooltip addon instead and never reaches here.\r\n\r\n Looks like the addon's default `mono-tooltip`, and reads its public knobs:\r\n --mono-tooltip-bg / -color / -radius / -max-width / -font-size /\r\n -line-height / -padding-x / -padding-y.\r\n\r\n Light: imported once by entries/index.css. Shadow: appended to each\r\n control's shadow sheet.\r\n ========================================= */\r\n\r\n[mono-field-bubble] {\r\n --_mono-field-tip-bg: var(--mono-tooltip-bg, var(--foreground));\r\n --_mono-field-tip-arrow: calc(var(--mono-spacing) * 2);\r\n\r\n /* undo the [popover] UA box (inset:0; margin:auto; border; Canvas …) */\r\n position: fixed;\r\n inset: auto;\r\n top: 0;\r\n left: 0;\r\n z-index: var(--mono-popup-z, 1000);\r\n display: none;\r\n box-sizing: border-box;\r\n width: max-content;\r\n max-width: min(var(--mono-tooltip-max-width, 20rem), calc(100vw - 16px));\r\n height: auto;\r\n margin: 0;\r\n overflow: visible;\r\n padding: var(--mono-tooltip-padding-y, calc(var(--mono-spacing) * 1.5)) var(--mono-tooltip-padding-x, calc(var(--mono-spacing) * 3));\r\n border: 0;\r\n border-radius: var(--mono-tooltip-radius, var(--mono-radius-md));\r\n background: var(--_mono-field-tip-bg);\r\n color: var(--mono-tooltip-color, var(--background));\r\n box-shadow: var(--mono-tooltip-shadow, 0 0 0 0 transparent);\r\n\r\n /* it sits inside the label — drop everything the label row set */\r\n font-family: inherit;\r\n font-size: var(--mono-tooltip-font-size, var(--mono-text-xs));\r\n font-weight: var(--mono-font-weight-normal, 400);\r\n font-style: normal;\r\n line-height: var(--mono-tooltip-line-height, var(--mono-text-xs--lh));\r\n letter-spacing: normal;\r\n text-transform: none;\r\n text-align: start;\r\n white-space: normal;\r\n overflow-wrap: break-word;\r\n cursor: default;\r\n user-select: text;\r\n pointer-events: auto;\r\n}\r\n\r\n[mono-field-bubble][mono-open] {\r\n display: block;\r\n animation: mono-field-tip-in var(--mono-duration, 150ms) var(--mono-ease, ease) both;\r\n}\r\n\r\n/* The arrow, plus (::before) an invisible bridge over the gap so the pointer\r\n can travel from the icon onto the bubble without it closing. */\r\n[mono-field-bubble]::after {\r\n content: '';\r\n position: absolute;\r\n left: var(--_mono-field-tip-arrow-x, 50%);\r\n width: var(--_mono-field-tip-arrow);\r\n height: var(--_mono-field-tip-arrow);\r\n background: inherit;\r\n border-radius: 2px;\r\n translate: -50% 0;\r\n rotate: 45deg;\r\n}\r\n\r\n[mono-field-bubble]::before {\r\n content: '';\r\n position: absolute;\r\n inset-inline: 0;\r\n height: 8px;\r\n}\r\n\r\n[mono-field-bubble]:not([mono-side=\"bottom\"])::after {\r\n bottom: calc(var(--_mono-field-tip-arrow) / -2 + 1px);\r\n}\r\n[mono-field-bubble]:not([mono-side=\"bottom\"])::before {\r\n top: 100%;\r\n}\r\n[mono-field-bubble][mono-side=\"bottom\"]::after {\r\n top: calc(var(--_mono-field-tip-arrow) / -2 + 1px);\r\n}\r\n[mono-field-bubble][mono-side=\"bottom\"]::before {\r\n bottom: 100%;\r\n}\r\n\r\n@keyframes mono-field-tip-in {\r\n from {\r\n opacity: 0;\r\n }\r\n}\r\n\r\n@media (prefers-reduced-motion: reduce) {\r\n [mono-field-bubble][mono-open] {\r\n animation: none;\r\n }\r\n}\r\n";
267
-
268
- //#endregion
269
- export { FieldTooltipController as n, FieldBubble as r, field_tooltip_css_raw_default as t };
@@ -1,208 +0,0 @@
1
- import { a as flattenTree, f as coerceValue, h as resolveTexts, i as emptyGroup, l as treeToArray, n as arrayToTree, o as nextId, p as defaultOperator, r as asRootGroup, s as odataStringToArray, t as arrayToODataString } from "./filter-odata-Bi27XUpQ.js";
2
- import { t as createNotifier } from "./notifier-BIrqUzRh.js";
3
-
4
- //#region src/components/filter/filter-builder.ts
5
- function monoFilterBuilder(opts = {}) {
6
- const texts = resolveTexts(opts.texts);
7
- const actions = opts.actions !== false;
8
- const serialize = opts.toODataString ?? ((f) => arrayToODataString(f));
9
- /** Which shape the caller supplied, so `type`-less reads return the same. */
10
- const inputType = typeof opts.filter === "string" ? "string" : "array";
11
- let warnedUnparseable = false;
12
- /**
13
- * Normalise either shape into a devextreme expression. A string outside the
14
- * parser's subset warns ONCE and yields `null` — an empty builder is safer than
15
- * a filter that silently means something else.
16
- */
17
- function toExpression(filter) {
18
- if (filter === null || filter === void 0 || filter === "") return null;
19
- if (typeof filter !== "string") return Array.isArray(filter) ? filter : null;
20
- try {
21
- return odataStringToArray(filter);
22
- } catch (err) {
23
- if (!warnedUnparseable) {
24
- warnedUnparseable = true;
25
- console.warn(`[monoFilterBuilder] could not parse the OData filter string — starting empty. Only the subset this builder emits is supported (comparisons, contains/startswith/endswith, in, and/or/not, parentheses). Reason: ${err.message}`);
26
- }
27
- return null;
28
- }
29
- }
30
- const originalExpression = toExpression(opts.filter);
31
- function buildTree(expr) {
32
- const node = arrayToTree(expr);
33
- return asRootGroup(node ? flattenTree(node) : null);
34
- }
35
- let tree = buildTree(originalExpression);
36
- const notifier = createNotifier();
37
- const notify = notifier.notify;
38
- const elementProps = { ...opts.props ?? {} };
39
- /**
40
- * Explicit `fields` win; a `dataGrid` only contributes columns not already
41
- * listed, so a table dialog can pass both and override just what it needs.
42
- */
43
- function fields() {
44
- const explicit = opts.fields ?? [];
45
- const grid = opts.dataGrid;
46
- if (!grid) return explicit;
47
- const seen = new Set(explicit.map((f) => f.field));
48
- const derived = [];
49
- for (const col of grid.props?.().th ?? []) {
50
- if (!col?.field || seen.has(col.field)) continue;
51
- derived.push({
52
- field: col.field,
53
- caption: col.caption ?? col.field
54
- });
55
- }
56
- return [...explicit, ...derived];
57
- }
58
- function fieldDef(field) {
59
- return fields().find((f) => f.field === field);
60
- }
61
- function findNode(id, node = tree) {
62
- if (node.id === id) return node;
63
- if (node.kind !== "group") return null;
64
- for (const c of node.children) {
65
- const hit = findNode(id, c);
66
- if (hit) return hit;
67
- }
68
- return null;
69
- }
70
- function findParent(id, node = tree) {
71
- for (const c of node.children) {
72
- if (c.id === id) return node;
73
- if (c.kind === "group") {
74
- const hit = findParent(id, c);
75
- if (hit) return hit;
76
- }
77
- }
78
- return null;
79
- }
80
- function groupById(id) {
81
- if (!id) return tree;
82
- const node = findNode(id);
83
- return node && node.kind === "group" ? node : tree;
84
- }
85
- function newRule() {
86
- const first = fields()[0];
87
- const dataType = first?.dataType ?? "string";
88
- return {
89
- kind: "rule",
90
- id: nextId("r"),
91
- field: first?.field ?? "",
92
- operator: defaultOperator(dataType),
93
- value: ""
94
- };
95
- }
96
- function read(expr, options) {
97
- return (options?.type ?? inputType) === "string" ? serialize(expr) : expr;
98
- }
99
- const controller = {
100
- get tree() {
101
- return tree;
102
- },
103
- get fields() {
104
- return fields();
105
- },
106
- get texts() {
107
- return texts;
108
- },
109
- get actions() {
110
- return actions;
111
- },
112
- props: () => elementProps,
113
- /**
114
- * Merge, not replace — a partial patch leaves everything else alone, matching
115
- * `updateRule`. `undefined` values are passed straight through: `applyProps`
116
- * skips them on the write side, so "not declared" can never clobber a value
117
- * the template set.
118
- */
119
- setProps: (patch) => {
120
- if (!patch) return;
121
- Object.assign(elementProps, patch);
122
- notify();
123
- },
124
- original: (options) => read(originalExpression, options),
125
- changed: (options) => read(treeToArray(tree), options),
126
- setFilter: (filter) => {
127
- tree = buildTree(toExpression(filter));
128
- notify();
129
- },
130
- reset: () => {
131
- tree = buildTree(originalExpression);
132
- notify();
133
- },
134
- clear: () => {
135
- tree = emptyGroup(tree.operator);
136
- notify();
137
- },
138
- addRule: (groupId) => {
139
- groupById(groupId).children.push(newRule());
140
- notify();
141
- },
142
- addGroup: (groupId) => {
143
- const g = emptyGroup("and");
144
- g.children.push(newRule());
145
- groupById(groupId).children.push(g);
146
- notify();
147
- },
148
- /**
149
- * Nest a rule: replace it in place with a group holding it plus a fresh
150
- * sibling, which is what the row's nested-rule button means. Nesting a group
151
- * just adds a child group to it.
152
- */
153
- nest: (nodeId) => {
154
- const node = findNode(nodeId);
155
- if (!node) return;
156
- if (node.kind === "group") {
157
- const g = emptyGroup("and");
158
- g.children.push(newRule());
159
- node.children.push(g);
160
- notify();
161
- return;
162
- }
163
- const parent = findParent(nodeId);
164
- if (!parent) return;
165
- const at = parent.children.indexOf(node);
166
- const g = emptyGroup(parent.operator === "or" ? "and" : "or");
167
- g.children.push(node, newRule());
168
- parent.children.splice(at, 1, g);
169
- notify();
170
- },
171
- remove: (nodeId) => {
172
- const parent = findParent(nodeId);
173
- if (!parent) return;
174
- parent.children = parent.children.filter((c) => c.id !== nodeId);
175
- if (!parent.children.length && parent !== tree) controller.remove(parent.id);
176
- else notify();
177
- },
178
- updateRule: (ruleId, patch) => {
179
- const node = findNode(ruleId);
180
- if (!node || node.kind !== "rule") return;
181
- if (patch.field !== void 0 && patch.field !== node.field) {
182
- node.field = patch.field;
183
- const dt = fieldDef(node.field)?.dataType ?? "string";
184
- node.operator = defaultOperator(dt);
185
- node.value = "";
186
- }
187
- if (patch.operator !== void 0) node.operator = patch.operator;
188
- if (patch.value !== void 0) {
189
- const dt = fieldDef(node.field)?.dataType ?? "string";
190
- node.value = Array.isArray(patch.value) ? patch.value.map((v) => coerceValue(v, dt)) : coerceValue(patch.value, dt);
191
- }
192
- notify();
193
- },
194
- setGroupOperator: (groupId, operator) => {
195
- const node = findNode(groupId);
196
- if (node?.kind === "group") {
197
- node.operator = operator;
198
- notify();
199
- }
200
- },
201
- subscribe: (cb) => notifier.subscribe(cb),
202
- dispose: () => notifier.clear()
203
- };
204
- return controller;
205
- }
206
-
207
- //#endregion
208
- export { monoFilterBuilder as t };