@mono-lit/helper 0.0.8 → 0.0.10
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.
- package/dist/accordion-core-DaNyPWRr.js +277 -0
- package/dist/alert-core-DWtHbX_-.js +134 -0
- package/dist/breadcrumb-list-core-Dh68T8Cf.js +747 -0
- package/dist/{mono-button-CLkHg3WW.js → button-core-DerXg84Q.js} +3 -276
- package/dist/button-dropdown-core-DKYEOyjy.js +654 -0
- package/dist/button-utils-D5-66M02.js +63 -0
- package/dist/card-utils-l80qAmrN.js +312 -0
- package/dist/chart-core-DV7hD3ZY.js +801 -0
- package/dist/checkbox-utils-DKdrhAzF.js +337 -0
- package/dist/chip-utils-DpRrd7Zj.js +403 -0
- package/dist/{data-source-controller-C6C4ej_M.js → data-source-controller-DS_JLrmS.js} +1 -1
- package/dist/{data-source-options-fxT5QIX4.js → data-source-options-DJUNU26C.js} +6 -6
- package/dist/{data-source-read-BL266IW0.js → data-source-read-uKJpRAzx.js} +2 -2
- package/dist/date-core-CyuSyvvG.js +734 -0
- package/dist/drawer-core-DbFWvNln.js +759 -0
- package/dist/dropdown-core-BCH1pK14.js +511 -0
- package/dist/dropdown-table-core-SfHUJVFq.js +1342 -0
- package/dist/export.js +1 -1
- package/dist/{field-path-BabiMrrA.js → field-path-DK2VBWHl.js} +1 -1
- package/dist/field-tooltip.css_raw-DVblekCl.js +5 -0
- package/dist/{field-validation.css_raw-Cx6SGrfP.js → field-validation.css_raw-BU7C6173.js} +1 -170
- package/dist/file-upload-core-Cz_dBQMx.js +624 -0
- package/dist/filter-builder-core-DyWjbBP7.js +381 -0
- package/dist/{filter-builder-B6Y2mmbM.js → filter-builder-vbqIuPhX.js} +1 -1
- package/dist/{filter-eval-ChDSaAUH.js → filter-eval-CqeBnMYh.js} +1 -1
- package/dist/{filter-odata-Bi27XUpQ.js → filter-odata-GsczYKNC.js} +1 -1
- package/dist/{hydration-flush-BaE9gN3C.js → hydration-flush-Volt9X7Q.js} +2 -1071
- package/dist/index.js +11 -11
- package/dist/{index.node-CLqE8F8P.js → index.node-Csy9zrr1.js} +4 -4
- package/dist/index.node.js +11 -11
- package/dist/input-utils-BglY-k0H.js +1145 -0
- package/dist/menu-core-DkAYuCZ2.js +831 -0
- package/dist/modal-core-CSBSPN_m.js +844 -0
- package/dist/mono-button-DVvZ03P-.js +280 -0
- package/dist/{mono-button.shadow-DqZMpcqY.js → mono-button.shadow-BANxMGln.js} +6 -594
- package/dist/{mono-data-chart-NKPdAgVq.js → mono-data-chart-ChF4J9RT.js} +6 -6
- package/dist/{mono-data-dropdown-DUXo_jxd.js → mono-data-dropdown-Bgj2PDfm.js} +1 -1
- package/dist/{mono-data-grid-Bb00QM72.js → mono-data-grid-DJkp96N-.js} +346 -51
- package/dist/{mono-event-BPku9HpS.js → mono-event-CAZf0F_k.js} +14 -9
- package/dist/{mono-form-controller-BrA10erm.js → mono-form-controller-DxZLvyg6.js} +2 -1
- package/dist/mono-table-checkbox-core-BKOMx8R5.js +5288 -0
- package/dist/nav-core-B5qU2dzn.js +225 -0
- package/dist/{normalize-error-D93O4q8g.js → normalize-error-BEcd1tmS.js} +2 -2
- package/dist/otp-core-DXg3vFLh.js +758 -0
- package/dist/radio-utils-Dk9Tl1jz.js +319 -0
- package/dist/rich-text-editor-core-Ddd_QaLn.js +1280 -0
- package/dist/select-utils-BgArYHk8.js +2140 -0
- package/dist/sidebar-core-CD6txDo3.js +583 -0
- package/dist/slider-core-vcWr321-.js +1014 -0
- package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +2 -2
- package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +1 -1
- package/dist/src/components/dropdown-table/index.d.ts +1 -1
- package/dist/src/components/dropdown-table/index.shadow.d.ts +1 -1
- package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +1 -1
- package/dist/src/components/form/form-types.d.ts +9 -3
- package/dist/src/components/input/input-core.d.ts +1 -1
- package/dist/src/components/input/input-types.d.ts +1 -1
- package/dist/src/components/otp/otp-core.d.ts +1 -1
- package/dist/src/components/select/select-core.d.ts +1 -1
- package/dist/src/components/select/select-types.d.ts +1 -1
- package/dist/src/components/slider/slider-core.d.ts +1 -1
- package/dist/src/components/slider/slider-types.d.ts +1 -1
- package/dist/src/components/table/filter-suggestion.d.ts +171 -0
- package/dist/src/components/table/index.d.ts +5 -4
- package/dist/src/components/table/index.shadow.d.ts +5 -4
- package/dist/src/components/table/mono-data-grid.d.ts +58 -3
- package/dist/src/components/table/mono-table-empty-core.d.ts +37 -0
- package/dist/src/components/table/mono-table-search-core.d.ts +22 -3
- package/dist/src/components/table/table-types.d.ts +74 -4
- package/dist/src/components/tag-input/tag-input-core.d.ts +1 -1
- package/dist/src/components/tag-input/tag-input-types.d.ts +1 -1
- package/dist/src/components/textarea/textarea-core.d.ts +1 -1
- package/dist/src/composables/mono-event.d.ts +7 -1
- package/dist/src/entries/index.d.ts +8 -6
- package/dist/src/entries/index.node.d.ts +8 -6
- package/dist/src/search/index.d.ts +1 -1
- package/dist/src/utils/group-count.d.ts +36 -0
- package/dist/switch-utils-CTZ4id2V.js +338 -0
- package/dist/tabs-core-r5-B8k_N.js +317 -0
- package/dist/tag-input-utils-D2JA90DQ.js +3060 -0
- package/dist/textarea-utils-VU1KeXm8.js +821 -0
- package/dist/ui/accordion.js +2 -274
- package/dist/ui/alert.js +2 -131
- package/dist/ui/breadcrumb.js +4 -745
- package/dist/ui/button-dropdown.js +4 -652
- package/dist/ui/button.js +2 -63
- package/dist/ui/card.js +2 -310
- package/dist/ui/chart.js +4 -800
- package/dist/ui/checkbox.js +4 -335
- package/dist/ui/chip.js +4 -402
- package/dist/ui/date.js +3 -732
- package/dist/ui/drawer.js +3 -757
- package/dist/ui/dropdown-table.js +5 -1341
- package/dist/ui/dropdown.js +4 -509
- package/dist/ui/file-upload.js +3 -622
- package/dist/ui/filter.js +5 -380
- package/dist/ui/form.js +1 -1
- package/dist/ui/index.css +130 -5
- package/dist/ui/input.js +3 -1141
- package/dist/ui/menu.js +4 -828
- package/dist/ui/modal.js +4 -843
- package/dist/ui/nav.js +4 -223
- package/dist/ui/otp.js +4 -756
- package/dist/ui/radio.js +4 -317
- package/dist/ui/rich-text-editor.js +4 -1278
- package/dist/ui/select.js +5 -2138
- package/dist/ui/shadow/accordion.js +4 -273
- package/dist/ui/shadow/alert.js +4 -130
- package/dist/ui/shadow/breadcrumb.js +5 -744
- package/dist/ui/shadow/button-dropdown.js +6 -652
- package/dist/ui/shadow/button.js +3 -63
- package/dist/ui/shadow/card.js +4 -309
- package/dist/ui/shadow/chart.js +6 -1576
- package/dist/ui/shadow/checkbox.js +4 -334
- package/dist/ui/shadow/chip.js +4 -396
- package/dist/ui/shadow/date.js +7 -731
- package/dist/ui/shadow/drawer.js +4 -756
- package/dist/ui/shadow/dropdown-table.js +8 -1762
- package/dist/ui/shadow/dropdown.js +4 -508
- package/dist/ui/shadow/file-upload.js +4 -620
- package/dist/ui/shadow/filter.js +7 -379
- package/dist/ui/shadow/input.js +6 -1140
- package/dist/ui/shadow/menu.js +5 -828
- package/dist/ui/shadow/modal.js +6 -1063
- package/dist/ui/shadow/nav.js +5 -223
- package/dist/ui/shadow/otp.js +6 -754
- package/dist/ui/shadow/radio.js +4 -316
- package/dist/ui/shadow/rich-text-editor.js +4 -1276
- package/dist/ui/shadow/select.js +6 -2136
- package/dist/ui/shadow/sidebar.js +5 -581
- package/dist/ui/shadow/slider.js +5 -1010
- package/dist/ui/shadow/switch.js +4 -335
- package/dist/ui/shadow/table.js +10 -4501
- package/dist/ui/shadow/tabs.js +6 -315
- package/dist/ui/shadow/tag-input.js +7 -3057
- package/dist/ui/shadow/textarea.js +6 -817
- package/dist/ui/sidebar.js +3 -581
- package/dist/ui/slider.js +4 -1012
- package/dist/ui/switch.js +4 -336
- package/dist/ui/table.js +9 -4502
- package/dist/ui/tabs.js +4 -315
- package/dist/ui/tag-input.js +5 -3058
- package/dist/ui/textarea.js +4 -819
- package/dist/vue.d.ts +3 -2
- package/package.json +3 -3
- package/dist/chip-strip-bNfLn52Z.js +0 -215
- package/dist/data-source-controller-Dx6IQ2CN.js +0 -243
- package/dist/data-source-options-BM4r4PRw.js +0 -558
- package/dist/data-source-read-HyBCRg1t.js +0 -242
- package/dist/excel-BXzr3uI1.js +0 -784
- package/dist/export-ixRdCS2y.js +0 -2388
- package/dist/field-tooltip-addon-CWCp19mJ.js +0 -702
- package/dist/field-tooltip.css_raw-U5UeTa2d.js +0 -269
- package/dist/filter-builder-C0T3pMx2.js +0 -208
- package/dist/form-control-core-BbiACMtL.js +0 -226
- package/dist/icon-ClxnYhBG.js +0 -19
- package/dist/import-Dc4eXC02.js +0 -612
- package/dist/light-slots-_no0r2Z-.js +0 -246
- package/dist/markdown-uGlE_OfJ.js +0 -20191
- package/dist/mono-data-grid-Bkr-e1-i.js +0 -4043
- package/dist/normalize-error-BmLbgANw.js +0 -1048
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { c as splitMulti, d as OPERATOR_ARITY, m as operatorsFor } from "./filter-odata-GsczYKNC.js";
|
|
2
|
+
import { d as buildSizeStyle } from "./mono-ui-kvLVIf1V.js";
|
|
3
|
+
import { n as detachEventHandlers, t as applyProps } from "./element-props-xvw0EB7H.js";
|
|
4
|
+
import { a as defineHybridPropAliases, i as defineHybridPropAlias, t as __decorate } from "./decorate-DbYFpi8R.js";
|
|
5
|
+
import { t as dispatchMonoEvent } from "./mono-event-CAZf0F_k.js";
|
|
6
|
+
import { html, isServer, nothing } from "lit";
|
|
7
|
+
import { property, state } from "lit/decorators.js";
|
|
8
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
9
|
+
|
|
10
|
+
//#region src/components/filter/filter-builder-core.ts
|
|
11
|
+
const GROUP_OPS = [
|
|
12
|
+
"and",
|
|
13
|
+
"or",
|
|
14
|
+
"notAnd",
|
|
15
|
+
"notOr"
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* `MonoFilterBuilderCore` — render-mode-agnostic logic for `mono-filter-builder`.
|
|
19
|
+
*
|
|
20
|
+
* Renders the controller's node tree as nested inline rows:
|
|
21
|
+
*
|
|
22
|
+
* ```
|
|
23
|
+
* Match [any ▾] of the following rules:
|
|
24
|
+
* | field ▾ | operator ▾ | value | ⑃ | 🗑 |
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Per repo convention it renders **native** `<select>` / `<input>` carrying
|
|
28
|
+
* its OWN control classes — no component here embeds another `mono-*`
|
|
29
|
+
* element (`mono-table-search` set that precedent), so the controls match the rest
|
|
30
|
+
* of the library without a cross-element dependency.
|
|
31
|
+
*/
|
|
32
|
+
const MonoFilterBuilderCore = (superClass) => {
|
|
33
|
+
class MonoFilterBuilderCoreClass extends superClass {
|
|
34
|
+
constructor(...args) {
|
|
35
|
+
super(...args);
|
|
36
|
+
this.size = "sm";
|
|
37
|
+
this._tick = 0;
|
|
38
|
+
this._applyQueued = false;
|
|
39
|
+
defineHybridPropAliases(this, [
|
|
40
|
+
"dataFilter",
|
|
41
|
+
"minWidth",
|
|
42
|
+
"maxWidth",
|
|
43
|
+
"minHeight",
|
|
44
|
+
"maxHeight"
|
|
45
|
+
]);
|
|
46
|
+
defineHybridPropAlias(this, "controlFilterBuilder", "dataFilter");
|
|
47
|
+
}
|
|
48
|
+
connectedCallback() {
|
|
49
|
+
super.connectedCallback();
|
|
50
|
+
this._subscribe();
|
|
51
|
+
}
|
|
52
|
+
disconnectedCallback() {
|
|
53
|
+
this._off?.();
|
|
54
|
+
this._off = void 0;
|
|
55
|
+
super.disconnectedCallback();
|
|
56
|
+
}
|
|
57
|
+
willUpdate(changed) {
|
|
58
|
+
if (changed.has("dataFilter")) this._subscribe();
|
|
59
|
+
super.willUpdate?.(changed);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Drive the apply from `update()` as well as `_subscribe()` — every render
|
|
63
|
+
* reaches here, so a controller that arrives late (or a `setProps` that
|
|
64
|
+
* lands between subscriptions) can't be missed. This is the lesson
|
|
65
|
+
* `table-controller-core` records: hanging the apply off `_subscribe` alone
|
|
66
|
+
* silently skips anything that overrides it.
|
|
67
|
+
*/
|
|
68
|
+
update(changed) {
|
|
69
|
+
this._scheduleApplyProps();
|
|
70
|
+
super.update(changed);
|
|
71
|
+
}
|
|
72
|
+
_subscribe() {
|
|
73
|
+
if (isServer) return;
|
|
74
|
+
this._off?.();
|
|
75
|
+
detachEventHandlers(this);
|
|
76
|
+
this._off = this.dataFilter?.subscribe(() => {
|
|
77
|
+
this._tick += 1;
|
|
78
|
+
this._scheduleApplyProps();
|
|
79
|
+
this._emitChange();
|
|
80
|
+
});
|
|
81
|
+
this._scheduleApplyProps();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Deferred + de-duplicated: the apply writes reactive props, and doing that
|
|
85
|
+
* inside the update cycle would trip Lit's change-in-update warning.
|
|
86
|
+
*/
|
|
87
|
+
_scheduleApplyProps() {
|
|
88
|
+
if (isServer) return;
|
|
89
|
+
if (this._applyQueued) return;
|
|
90
|
+
if (typeof queueMicrotask !== "function") {
|
|
91
|
+
this._applyControllerProps();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this._applyQueued = true;
|
|
95
|
+
queueMicrotask(() => {
|
|
96
|
+
this._applyQueued = false;
|
|
97
|
+
this._applyControllerProps();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Pull `controlMonoFilterBuilder({ props })` onto this element, so the
|
|
102
|
+
* template needs nothing but the controller binding.
|
|
103
|
+
*
|
|
104
|
+
* The CONTROLLER WINS for keys it declares (matching `monoDataGrid` and
|
|
105
|
+
* `monoForm`); keys it doesn't mention are left to whatever the template set.
|
|
106
|
+
* `applyProps` supplies the skip-undefined, read-only and equality guards, so
|
|
107
|
+
* a sync can neither throw nor schedule another update cycle.
|
|
108
|
+
*
|
|
109
|
+
* `?.props` is optional-called on purpose: a controller built before this
|
|
110
|
+
* option existed simply contributes nothing.
|
|
111
|
+
*/
|
|
112
|
+
_applyControllerProps() {
|
|
113
|
+
applyProps(this, this.dataFilter?.props?.());
|
|
114
|
+
}
|
|
115
|
+
_emitChange() {
|
|
116
|
+
const ctrl = this.dataFilter;
|
|
117
|
+
if (!ctrl) return;
|
|
118
|
+
dispatchMonoEvent(this, "change", {
|
|
119
|
+
filter: ctrl.changed(),
|
|
120
|
+
array: ctrl.changed({ type: "array" }),
|
|
121
|
+
string: ctrl.changed({ type: "string" })
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/** Internal icon — light: UnoCSS classes; shadow: inline SVG. */
|
|
125
|
+
renderIcon(_name) {
|
|
126
|
+
return html``;
|
|
127
|
+
}
|
|
128
|
+
get _texts() {
|
|
129
|
+
return this.dataFilter?.texts;
|
|
130
|
+
}
|
|
131
|
+
_dataType(field) {
|
|
132
|
+
return this.dataFilter?.fields.find((f) => f.field === field)?.dataType ?? "string";
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* One `<option>` whose selection is bound as a **property**.
|
|
136
|
+
*
|
|
137
|
+
* Binding `.value` on the `<select>` instead is unreliable here: an operator
|
|
138
|
+
* list changes in the SAME render as the value it should show (picking a number
|
|
139
|
+
* field swaps the whole option set), and the assignment lands before the new
|
|
140
|
+
* options exist — leaving the browser on a stale `selectedIndex`. Setting
|
|
141
|
+
* `.selected` per option moves `selectedIndex` after the options are in place.
|
|
142
|
+
*/
|
|
143
|
+
_option(value, label, current) {
|
|
144
|
+
return html`<option value=${value} .selected=${value === current}>${label}</option>`;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The value editor for a rule. Arity decides the shape: `0` disables the cell
|
|
148
|
+
* (the blank checks need no operand), `2` renders a from/to pair, `many` takes
|
|
149
|
+
* comma-separated entry, and a field with `values` renders a select.
|
|
150
|
+
*/
|
|
151
|
+
_renderValue(rule) {
|
|
152
|
+
const t = this._texts;
|
|
153
|
+
const arity = OPERATOR_ARITY[rule.operator];
|
|
154
|
+
const dt = this._dataType(rule.field);
|
|
155
|
+
const def = this.dataFilter?.fields.find((f) => f.field === rule.field);
|
|
156
|
+
const nativeType = dt === "number" ? "number" : dt === "date" ? "date" : dt === "datetime" ? "datetime-local" : "text";
|
|
157
|
+
const cls = "mono-filter-control mono-filter-value";
|
|
158
|
+
if (arity === 0) return html`<input class=${cls} mono-filter-control mono-filter-value disabled placeholder="—" aria-label="No value needed" />`;
|
|
159
|
+
if (def?.values?.length) return html`
|
|
160
|
+
<select
|
|
161
|
+
class=${cls} mono-filter-control mono-filter-value
|
|
162
|
+
@change=${(e) => this.dataFilter?.updateRule(rule.id, { value: e.target.value })}
|
|
163
|
+
>
|
|
164
|
+
${this._option("", t?.valuePlaceholder ?? "", String(rule.value ?? ""))}
|
|
165
|
+
${def.values.map((v) => this._option(String(v.value), v.label ?? String(v.value), String(rule.value ?? "")))}
|
|
166
|
+
</select>
|
|
167
|
+
`;
|
|
168
|
+
if (dt === "boolean") return html`
|
|
169
|
+
<select
|
|
170
|
+
class=${cls} mono-filter-control mono-filter-value
|
|
171
|
+
@change=${(e) => this.dataFilter?.updateRule(rule.id, { value: e.target.value })}
|
|
172
|
+
>
|
|
173
|
+
${this._option("", t?.valuePlaceholder ?? "", String(rule.value ?? ""))}
|
|
174
|
+
${this._option("true", "true", String(rule.value ?? ""))}
|
|
175
|
+
${this._option("false", "false", String(rule.value ?? ""))}
|
|
176
|
+
</select>
|
|
177
|
+
`;
|
|
178
|
+
if (arity === 2) {
|
|
179
|
+
const pair = Array.isArray(rule.value) ? rule.value : ["", ""];
|
|
180
|
+
const setAt = (idx, v) => {
|
|
181
|
+
const next = [pair[0] ?? "", pair[1] ?? ""];
|
|
182
|
+
next[idx] = v;
|
|
183
|
+
this.dataFilter?.updateRule(rule.id, { value: next });
|
|
184
|
+
};
|
|
185
|
+
return html`
|
|
186
|
+
<span class="mono-filter-range" mono-filter-range>
|
|
187
|
+
<input
|
|
188
|
+
class=${cls} mono-filter-control mono-filter-value
|
|
189
|
+
type=${nativeType}
|
|
190
|
+
.value=${String(pair[0] ?? "")}
|
|
191
|
+
@input=${(e) => setAt(0, e.target.value)}
|
|
192
|
+
/>
|
|
193
|
+
<input
|
|
194
|
+
class=${cls} mono-filter-control mono-filter-value
|
|
195
|
+
type=${nativeType}
|
|
196
|
+
.value=${String(pair[1] ?? "")}
|
|
197
|
+
@input=${(e) => setAt(1, e.target.value)}
|
|
198
|
+
/>
|
|
199
|
+
</span>
|
|
200
|
+
`;
|
|
201
|
+
}
|
|
202
|
+
const shown = Array.isArray(rule.value) ? rule.value.join(", ") : String(rule.value ?? "");
|
|
203
|
+
return html`
|
|
204
|
+
<input
|
|
205
|
+
class=${cls} mono-filter-control mono-filter-value
|
|
206
|
+
type=${arity === "many" ? "text" : nativeType}
|
|
207
|
+
.value=${shown}
|
|
208
|
+
placeholder=${arity === "many" ? t?.multiValuePlaceholder ?? "" : t?.valuePlaceholder ?? ""}
|
|
209
|
+
@input=${(e) => {
|
|
210
|
+
const raw = e.target.value;
|
|
211
|
+
this.dataFilter?.updateRule(rule.id, { value: arity === "many" ? splitMulti(raw) : raw });
|
|
212
|
+
}}
|
|
213
|
+
/>
|
|
214
|
+
`;
|
|
215
|
+
}
|
|
216
|
+
_renderRule(rule) {
|
|
217
|
+
const ctrl = this.dataFilter;
|
|
218
|
+
const t = this._texts;
|
|
219
|
+
const ops = operatorsFor(this._dataType(rule.field));
|
|
220
|
+
return html`
|
|
221
|
+
<div class="mono-filter-row" mono-filter-row data-rule=${rule.id}>
|
|
222
|
+
<select
|
|
223
|
+
class="mono-filter-control mono-filter-field" mono-filter-control mono-filter-field
|
|
224
|
+
@change=${(e) => ctrl?.updateRule(rule.id, { field: e.target.value })}
|
|
225
|
+
>
|
|
226
|
+
${ctrl?.fields.map((f) => this._option(f.field, f.caption ?? f.field, rule.field))}
|
|
227
|
+
</select>
|
|
228
|
+
|
|
229
|
+
<select
|
|
230
|
+
class="mono-filter-control mono-filter-op" mono-filter-control mono-filter-op
|
|
231
|
+
@change=${(e) => ctrl?.updateRule(rule.id, { operator: e.target.value })}
|
|
232
|
+
>
|
|
233
|
+
${ops.map((op) => this._option(op, t?.[op] ?? op, rule.operator))}
|
|
234
|
+
</select>
|
|
235
|
+
|
|
236
|
+
<span class="mono-filter-value-cell" mono-filter-value-cell>${this._renderValue(rule)}</span>
|
|
237
|
+
|
|
238
|
+
<button
|
|
239
|
+
type="button"
|
|
240
|
+
class="mono-filter-icon-btn" mono-filter-icon-btn
|
|
241
|
+
title=${t?.addNested ?? ""}
|
|
242
|
+
aria-label=${t?.addNested ?? ""}
|
|
243
|
+
@click=${() => ctrl?.nest(rule.id)}
|
|
244
|
+
>
|
|
245
|
+
${this.renderIcon("nested")}
|
|
246
|
+
</button>
|
|
247
|
+
<button
|
|
248
|
+
type="button"
|
|
249
|
+
class="mono-filter-icon-btn danger" mono-filter-icon-btn mono-danger
|
|
250
|
+
title=${t?.remove ?? ""}
|
|
251
|
+
aria-label=${t?.remove ?? ""}
|
|
252
|
+
@click=${() => ctrl?.remove(rule.id)}
|
|
253
|
+
>
|
|
254
|
+
${this.renderIcon("trash")}
|
|
255
|
+
</button>
|
|
256
|
+
</div>
|
|
257
|
+
`;
|
|
258
|
+
}
|
|
259
|
+
_renderGroup(group, level) {
|
|
260
|
+
const ctrl = this.dataFilter;
|
|
261
|
+
const t = this._texts;
|
|
262
|
+
const isRoot = level === 0;
|
|
263
|
+
return html`
|
|
264
|
+
<div class="mono-filter-group" mono-filter-group data-group=${group.id} style=${`--_mono-filter-level:${level}`}>
|
|
265
|
+
<div class="mono-filter-group-head" mono-filter-group-head>
|
|
266
|
+
<span class="mono-filter-match" mono-filter-match>${t?.matchPrefix}</span>
|
|
267
|
+
<select
|
|
268
|
+
class="mono-filter-control mono-filter-group-op" mono-filter-control mono-filter-group-op
|
|
269
|
+
@change=${(e) => ctrl?.setGroupOperator(group.id, e.target.value)}
|
|
270
|
+
>
|
|
271
|
+
${GROUP_OPS.map((op) => this._option(op, t?.[op] ?? op, group.operator))}
|
|
272
|
+
</select>
|
|
273
|
+
<span class="mono-filter-match" mono-filter-match>${t?.matchSuffix}</span>
|
|
274
|
+
${isRoot ? nothing : html`
|
|
275
|
+
<span class="mono-filter-group-actions" mono-filter-group-actions>
|
|
276
|
+
<button
|
|
277
|
+
type="button"
|
|
278
|
+
class="mono-filter-icon-btn" mono-filter-icon-btn
|
|
279
|
+
title=${t?.addRule ?? ""}
|
|
280
|
+
@click=${() => ctrl?.addRule(group.id)}
|
|
281
|
+
>
|
|
282
|
+
${this.renderIcon("plus")}
|
|
283
|
+
</button>
|
|
284
|
+
<button
|
|
285
|
+
type="button"
|
|
286
|
+
class="mono-filter-icon-btn danger" mono-filter-icon-btn mono-danger
|
|
287
|
+
title=${t?.remove ?? ""}
|
|
288
|
+
@click=${() => ctrl?.remove(group.id)}
|
|
289
|
+
>
|
|
290
|
+
${this.renderIcon("trash")}
|
|
291
|
+
</button>
|
|
292
|
+
</span>
|
|
293
|
+
`}
|
|
294
|
+
</div>
|
|
295
|
+
|
|
296
|
+
<div class="mono-filter-children" mono-filter-children>
|
|
297
|
+
${group.children.map((child) => this._renderNode(child, level + 1))}
|
|
298
|
+
${isRoot && !group.children.length ? html`<div class="mono-filter-empty" mono-filter-empty>${t?.emptyHint}</div>` : nothing}
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
`;
|
|
302
|
+
}
|
|
303
|
+
_renderNode(node, level) {
|
|
304
|
+
return node.kind === "group" ? this._renderGroup(node, level) : this._renderRule(node);
|
|
305
|
+
}
|
|
306
|
+
render() {
|
|
307
|
+
const ctrl = this.dataFilter;
|
|
308
|
+
if (!ctrl) return html``;
|
|
309
|
+
const t = ctrl.texts;
|
|
310
|
+
this._tick;
|
|
311
|
+
return html`
|
|
312
|
+
<div
|
|
313
|
+
class="mono-filter ${this.size}"
|
|
314
|
+
mono-filter-builder
|
|
315
|
+
mono-size=${this.size === "sm" ? nothing : this.size}
|
|
316
|
+
style=${styleMap(buildSizeStyle(this))}
|
|
317
|
+
>
|
|
318
|
+
${ctrl.actions ? html`
|
|
319
|
+
<div class="mono-filter-actions" mono-filter-actions>
|
|
320
|
+
<button
|
|
321
|
+
type="button"
|
|
322
|
+
class="mono-filter-btn primary" mono-filter-btn
|
|
323
|
+
@click=${() => dispatchMonoEvent(this, "apply", {
|
|
324
|
+
filter: ctrl.changed(),
|
|
325
|
+
array: ctrl.changed({ type: "array" }),
|
|
326
|
+
string: ctrl.changed({ type: "string" })
|
|
327
|
+
})}
|
|
328
|
+
>
|
|
329
|
+
${t.apply}
|
|
330
|
+
</button>
|
|
331
|
+
<button
|
|
332
|
+
type="button"
|
|
333
|
+
class="mono-filter-btn ghost" mono-filter-btn mono-variant="ghost"
|
|
334
|
+
@click=${() => {
|
|
335
|
+
ctrl.clear();
|
|
336
|
+
dispatchMonoEvent(this, "clear", { filter: null });
|
|
337
|
+
}}
|
|
338
|
+
>
|
|
339
|
+
${t.clear}
|
|
340
|
+
</button>
|
|
341
|
+
</div>
|
|
342
|
+
` : nothing}
|
|
343
|
+
${this._renderGroup(ctrl.tree, 0)}
|
|
344
|
+
<div class="mono-filter-add" mono-filter-add>
|
|
345
|
+
<button type="button" class="mono-filter-link" mono-filter-link @click=${() => ctrl.addRule()}>
|
|
346
|
+
${t.addRule}
|
|
347
|
+
</button>
|
|
348
|
+
<button type="button" class="mono-filter-link" mono-filter-link @click=${() => ctrl.addGroup()}>
|
|
349
|
+
${t.addGroup}
|
|
350
|
+
</button>
|
|
351
|
+
</div>
|
|
352
|
+
</div>
|
|
353
|
+
`;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
__decorate([property({ attribute: false })], MonoFilterBuilderCoreClass.prototype, "dataFilter", void 0);
|
|
357
|
+
__decorate([property({ type: String })], MonoFilterBuilderCoreClass.prototype, "size", void 0);
|
|
358
|
+
__decorate([property({ type: String })], MonoFilterBuilderCoreClass.prototype, "width", void 0);
|
|
359
|
+
__decorate([property({ type: String })], MonoFilterBuilderCoreClass.prototype, "height", void 0);
|
|
360
|
+
__decorate([property({
|
|
361
|
+
attribute: "min-width",
|
|
362
|
+
type: String
|
|
363
|
+
})], MonoFilterBuilderCoreClass.prototype, "minWidth", void 0);
|
|
364
|
+
__decorate([property({
|
|
365
|
+
attribute: "max-width",
|
|
366
|
+
type: String
|
|
367
|
+
})], MonoFilterBuilderCoreClass.prototype, "maxWidth", void 0);
|
|
368
|
+
__decorate([property({
|
|
369
|
+
attribute: "min-height",
|
|
370
|
+
type: String
|
|
371
|
+
})], MonoFilterBuilderCoreClass.prototype, "minHeight", void 0);
|
|
372
|
+
__decorate([property({
|
|
373
|
+
attribute: "max-height",
|
|
374
|
+
type: String
|
|
375
|
+
})], MonoFilterBuilderCoreClass.prototype, "maxHeight", void 0);
|
|
376
|
+
__decorate([state()], MonoFilterBuilderCoreClass.prototype, "_tick", void 0);
|
|
377
|
+
return MonoFilterBuilderCoreClass;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
//#endregion
|
|
381
|
+
export { MonoFilterBuilderCore as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
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-GsczYKNC.js";
|
|
1
2
|
import { t as createNotifier } from "./notifier-BIrqUzRh.js";
|
|
2
|
-
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";
|
|
3
3
|
|
|
4
4
|
//#region src/components/filter/filter-builder.ts
|
|
5
5
|
function monoFilterBuilder(opts = {}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as odataLiteral, l as toODataSelector, n as isPath } from "./field-path-
|
|
1
|
+
import { i as odataLiteral, l as toODataSelector, n as isPath } from "./field-path-DK2VBWHl.js";
|
|
2
2
|
|
|
3
3
|
//#region src/components/filter/filter-operators.ts
|
|
4
4
|
/** Value inputs required per operator — drives the value cell. */
|