@mk-kit/ui 0.35.0 → 0.37.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.
- package/README.md +10 -9
- package/THIRD_PARTY_NOTICES.md +28 -0
- package/fesm2022/mk-kit-ui-chat.mjs +490 -0
- package/fesm2022/mk-kit-ui-chat.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-core.mjs +446 -1
- package/fesm2022/mk-kit-ui-core.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-feedback.mjs +400 -8
- package/fesm2022/mk-kit-ui-feedback.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-forms.mjs +816 -6
- package/fesm2022/mk-kit-ui-forms.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-icon.mjs +444 -117
- package/fesm2022/mk-kit-ui-icon.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-layout.mjs +401 -0
- package/fesm2022/mk-kit-ui-layout.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-navigation.mjs +2 -2
- package/fesm2022/mk-kit-ui-navigation.mjs.map +1 -1
- package/fesm2022/mk-kit-ui-query-builder.mjs +276 -0
- package/fesm2022/mk-kit-ui-query-builder.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-table.mjs +291 -20
- package/fesm2022/mk-kit-ui-table.mjs.map +1 -1
- package/fesm2022/mk-kit-ui.mjs +3 -0
- package/fesm2022/mk-kit-ui.mjs.map +1 -1
- package/package.json +13 -1
- package/styles/mk-kit.css +16 -0
- package/types/mk-kit-ui-chat.d.ts +288 -0
- package/types/mk-kit-ui-core.d.ts +228 -3
- package/types/mk-kit-ui-feedback.d.ts +111 -2
- package/types/mk-kit-ui-forms.d.ts +264 -3
- package/types/mk-kit-ui-icon.d.ts +6 -2
- package/types/mk-kit-ui-layout.d.ts +236 -0
- package/types/mk-kit-ui-query-builder.d.ts +98 -0
- package/types/mk-kit-ui-table.d.ts +145 -5
- package/types/mk-kit-ui.d.ts +3 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { MkResponsive, MkBreakpointService } from '@mk-kit/ui/core';
|
|
2
|
+
import * as _angular_core from '@angular/core';
|
|
3
|
+
import { InputSignal } from '@angular/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A spacing value: a step on the `--mk-space-*` scale (`0 1 2 3 4 5 6 8 10 12
|
|
7
|
+
* 16`, so `4` = `var(--mk-space-4)` = 16px and follows the density modes) or
|
|
8
|
+
* any CSS length such as `'1.5rem'` / `'clamp(1rem, 2vw, 2rem)'`.
|
|
9
|
+
*/
|
|
10
|
+
type MkSpace = number | string;
|
|
11
|
+
/** Per-breakpoint spacing, e.g. `{ xs: 2, md: 4 }`. */
|
|
12
|
+
type MkResponsiveSpace = MkResponsive<MkSpace>;
|
|
13
|
+
/**
|
|
14
|
+
* A number, or a numeric string as it arrives from a plain attribute
|
|
15
|
+
* (`gap="4"`, `colSpan="2"`), as a number; anything else unchanged.
|
|
16
|
+
*/
|
|
17
|
+
declare function mkNumeric<T>(value: T): T | number;
|
|
18
|
+
/** Translate a {@link MkSpace} into CSS (`null` when unset). */
|
|
19
|
+
declare function mkSpaceToCss(value: MkSpace | null | undefined): string | null;
|
|
20
|
+
/** Flex / grid main-axis distribution keywords, in plain words. */
|
|
21
|
+
type MkJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly' | 'stretch';
|
|
22
|
+
/** Cross-axis alignment keywords. */
|
|
23
|
+
type MkAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
24
|
+
/** `justify-content` value for a {@link MkJustify} keyword (`null` when unset). */
|
|
25
|
+
declare function mkJustifyToCss(value: MkJustify | null | undefined): string | null;
|
|
26
|
+
/** `align-items` / `align-self` value for a {@link MkAlign} keyword (`null` when unset). */
|
|
27
|
+
declare function mkAlignToCss(value: MkAlign | null | undefined): string | null;
|
|
28
|
+
|
|
29
|
+
/** Flex direction keywords. */
|
|
30
|
+
type MkFlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
31
|
+
/**
|
|
32
|
+
* Shared inputs and host style bindings of `mk-stack` and `mk-flex`.
|
|
33
|
+
* Responsive inputs re-resolve when the viewport crosses a breakpoint.
|
|
34
|
+
*/
|
|
35
|
+
declare abstract class MkFlexBase {
|
|
36
|
+
protected readonly bp: MkBreakpointService;
|
|
37
|
+
/** Space between children — a `--mk-space-*` step, a CSS length, or a per-breakpoint map. */
|
|
38
|
+
abstract readonly gap: InputSignal<MkResponsiveSpace>;
|
|
39
|
+
/** Main-axis direction; may be responsive, e.g. `{ xs: 'column', md: 'row' }`. */
|
|
40
|
+
abstract readonly direction: InputSignal<MkResponsive<MkFlexDirection>>;
|
|
41
|
+
/** Cross-axis alignment of children. */
|
|
42
|
+
readonly align: InputSignal<MkResponsive<MkAlign> | null>;
|
|
43
|
+
/** Main-axis distribution of children. */
|
|
44
|
+
readonly justify: InputSignal<MkResponsive<MkJustify> | null>;
|
|
45
|
+
/** Let children wrap onto new lines. */
|
|
46
|
+
readonly wrap: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
47
|
+
/** Render as `inline-flex` (sits in a line of text) instead of a block. */
|
|
48
|
+
readonly inline: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
49
|
+
protected readonly directionCss: _angular_core.Signal<MkFlexDirection | null>;
|
|
50
|
+
protected readonly gapCss: _angular_core.Signal<string | null>;
|
|
51
|
+
protected readonly alignCss: _angular_core.Signal<string | null>;
|
|
52
|
+
protected readonly justifyCss: _angular_core.Signal<string | null>;
|
|
53
|
+
protected readonly wrapCss: _angular_core.Signal<"wrap" | null>;
|
|
54
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkFlexBase, never>;
|
|
55
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkFlexBase, never, never, { "align": { "alias": "align"; "required": false; "isSignal": true; }; "justify": { "alias": "justify"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "inline": { "alias": "inline"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Stack — children laid out one after another with a consistent gap, vertical
|
|
60
|
+
* by default. The everyday layout primitive: form sections, card bodies,
|
|
61
|
+
* sidebars, a row of buttons (`direction="row"`).
|
|
62
|
+
*
|
|
63
|
+
* ```html
|
|
64
|
+
* <mk-stack gap="4">
|
|
65
|
+
* <mk-input … />
|
|
66
|
+
* <mk-input … />
|
|
67
|
+
* <mk-stack direction="row" gap="2" justify="end">
|
|
68
|
+
* <button mkButton variant="ghost">Cancel</button>
|
|
69
|
+
* <button mkButton>Save</button>
|
|
70
|
+
* </mk-stack>
|
|
71
|
+
* </mk-stack>
|
|
72
|
+
*
|
|
73
|
+
* <!-- Stack on phones, side by side from md up -->
|
|
74
|
+
* <mk-stack [direction]="{ xs: 'column', md: 'row' }" [gap]="{ xs: 3, md: 6 }">…</mk-stack>
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare class MkStack extends MkFlexBase {
|
|
78
|
+
/** Space between children (default `4` = 16px). */
|
|
79
|
+
readonly gap: _angular_core.InputSignal<MkResponsiveSpace>;
|
|
80
|
+
/** Direction (default `column`). */
|
|
81
|
+
readonly direction: _angular_core.InputSignal<MkResponsive<MkFlexDirection>>;
|
|
82
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkStack, never>;
|
|
83
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkStack, "mk-stack", never, { "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Flex — a flexbox container with its options as inputs, horizontal by default
|
|
88
|
+
* and no gap unless asked. Reach for it when a stack's "one after another"
|
|
89
|
+
* isn't the point: space-between toolbars, centring, wrapping tag clouds.
|
|
90
|
+
* Children can fine-tune themselves with `mkFlexItem`.
|
|
91
|
+
*
|
|
92
|
+
* ```html
|
|
93
|
+
* <mk-flex align="center" justify="between" gap="3">
|
|
94
|
+
* <h2>Orders</h2>
|
|
95
|
+
* <button mkButton>New order</button>
|
|
96
|
+
* </mk-flex>
|
|
97
|
+
* <mk-flex wrap gap="2">@for (tag of tags; track tag) { <mk-chip>{{ tag }}</mk-chip> }</mk-flex>
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
declare class MkFlex extends MkFlexBase {
|
|
101
|
+
/** Space between children (default none). */
|
|
102
|
+
readonly gap: _angular_core.InputSignal<MkResponsiveSpace>;
|
|
103
|
+
/** Direction (default `row`). */
|
|
104
|
+
readonly direction: _angular_core.InputSignal<MkResponsive<MkFlexDirection>>;
|
|
105
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkFlex, never>;
|
|
106
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkFlex, "mk-flex", never, { "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Per-child flex options inside `mk-flex` / `mk-stack` (or any flex parent).
|
|
111
|
+
*
|
|
112
|
+
* ```html
|
|
113
|
+
* <mk-flex gap="3">
|
|
114
|
+
* <mk-input mkFlexItem grow /> <!-- takes the remaining width -->
|
|
115
|
+
* <button mkButton>Search</button>
|
|
116
|
+
* </mk-flex>
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
declare class MkFlexItem {
|
|
120
|
+
private readonly bp;
|
|
121
|
+
/** `flex-grow`; a bare `grow` attribute means `1`. */
|
|
122
|
+
readonly grow: _angular_core.InputSignalWithTransform<number | null, unknown>;
|
|
123
|
+
/** `flex-shrink`; a bare `shrink` attribute means `1`, `[shrink]="0"` pins the size. */
|
|
124
|
+
readonly shrink: _angular_core.InputSignalWithTransform<number | null, unknown>;
|
|
125
|
+
/** `flex-basis` — any CSS length or `auto`; may be responsive. */
|
|
126
|
+
readonly basis: _angular_core.InputSignal<MkResponsive<string> | null>;
|
|
127
|
+
/** Override the parent's `align` for this child. */
|
|
128
|
+
readonly alignSelf: _angular_core.InputSignal<MkResponsive<MkAlign> | null>;
|
|
129
|
+
/** Visual order; may be responsive (e.g. move a sidebar first on phones). */
|
|
130
|
+
readonly order: _angular_core.InputSignal<MkResponsive<string | number> | null>;
|
|
131
|
+
protected readonly growCss: _angular_core.Signal<number | null>;
|
|
132
|
+
protected readonly shrinkCss: _angular_core.Signal<number | null>;
|
|
133
|
+
protected readonly basisCss: _angular_core.Signal<string | null>;
|
|
134
|
+
protected readonly alignSelfCss: _angular_core.Signal<string | null>;
|
|
135
|
+
protected readonly orderCss: _angular_core.Signal<string | number | null>;
|
|
136
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkFlexItem, never>;
|
|
137
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkFlexItem, "[mkFlexItem]", never, { "grow": { "alias": "grow"; "required": false; "isSignal": true; }; "shrink": { "alias": "shrink"; "required": false; "isSignal": true; }; "basis": { "alias": "basis"; "required": false; "isSignal": true; }; "alignSelf": { "alias": "alignSelf"; "required": false; "isSignal": true; }; "order": { "alias": "order"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** `justify-items` keywords. */
|
|
141
|
+
type MkGridJustify = 'start' | 'center' | 'end' | 'stretch';
|
|
142
|
+
/**
|
|
143
|
+
* Grid — a CSS grid with the common cases as inputs.
|
|
144
|
+
*
|
|
145
|
+
* - `columns` — a count (`3` → three equal tracks) or a raw
|
|
146
|
+
* `grid-template-columns` string (`'240px 1fr'`); responsive maps work for
|
|
147
|
+
* both: `[columns]="{ xs: 1, md: 2, xl: 4 }"`.
|
|
148
|
+
* - `minColumnWidth` — auto-responsive without breakpoints: as many
|
|
149
|
+
* `≥ 16rem` columns as fit (`auto-fill`; add `autoFit` to stretch the last
|
|
150
|
+
* row's items instead of leaving empty tracks). Wins over `columns`.
|
|
151
|
+
* - `gap`, `rowGap`, `columnGap` — `--mk-space-*` steps or CSS lengths.
|
|
152
|
+
*
|
|
153
|
+
* Children can span tracks with `mkGridItem`.
|
|
154
|
+
*
|
|
155
|
+
* ```html
|
|
156
|
+
* <mk-grid [columns]="{ xs: 1, md: 2, xl: 4 }" gap="4">
|
|
157
|
+
* @for (kpi of kpis; track kpi.id) { <mk-card>…</mk-card> }
|
|
158
|
+
* </mk-grid>
|
|
159
|
+
*
|
|
160
|
+
* <mk-grid minColumnWidth="16rem" gap="4">…cards…</mk-grid>
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
declare class MkGrid {
|
|
164
|
+
private readonly bp;
|
|
165
|
+
/** Column count or `grid-template-columns` value; responsive allowed (default `1`). */
|
|
166
|
+
readonly columns: _angular_core.InputSignal<MkResponsive<string | number>>;
|
|
167
|
+
/** Row count or `grid-template-rows` value; responsive allowed. */
|
|
168
|
+
readonly rows: _angular_core.InputSignal<MkResponsive<string | number> | null>;
|
|
169
|
+
/** Minimum column width for an auto-filling grid, e.g. `16rem`. Overrides `columns`. */
|
|
170
|
+
readonly minColumnWidth: _angular_core.InputSignal<MkResponsive<string> | null>;
|
|
171
|
+
/** With `minColumnWidth`: use `auto-fit` so items stretch when a row is short. */
|
|
172
|
+
readonly autoFit: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
173
|
+
/** Gap between both rows and columns (default `4` = 16px). */
|
|
174
|
+
readonly gap: _angular_core.InputSignal<MkResponsiveSpace>;
|
|
175
|
+
/** Row gap override. */
|
|
176
|
+
readonly rowGap: _angular_core.InputSignal<MkResponsiveSpace | null>;
|
|
177
|
+
/** Column gap override. */
|
|
178
|
+
readonly columnGap: _angular_core.InputSignal<MkResponsiveSpace | null>;
|
|
179
|
+
/** `align-items` for every cell. */
|
|
180
|
+
readonly align: _angular_core.InputSignal<MkResponsive<MkAlign> | null>;
|
|
181
|
+
/** `justify-items` for every cell. */
|
|
182
|
+
readonly justify: _angular_core.InputSignal<MkResponsive<MkGridJustify> | null>;
|
|
183
|
+
/** `grid-auto-flow` (e.g. `dense` to backfill holes left by spanning items). */
|
|
184
|
+
readonly flow: _angular_core.InputSignal<"row" | "column" | "dense" | "row dense" | "column dense" | null>;
|
|
185
|
+
/** Render as `inline-grid`. */
|
|
186
|
+
readonly inline: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
187
|
+
protected readonly columnsCss: _angular_core.Signal<string | null>;
|
|
188
|
+
protected readonly rowsCss: _angular_core.Signal<string | null>;
|
|
189
|
+
protected readonly rowGapCss: _angular_core.Signal<string | null>;
|
|
190
|
+
protected readonly columnGapCss: _angular_core.Signal<string | null>;
|
|
191
|
+
protected readonly alignCss: _angular_core.Signal<string | null>;
|
|
192
|
+
protected readonly justifyCss: _angular_core.Signal<MkGridJustify | null>;
|
|
193
|
+
protected readonly flowCss: _angular_core.Signal<"row" | "column" | "dense" | "row dense" | "column dense" | null>;
|
|
194
|
+
/** A track list: a count becomes `repeat(n, minmax(0, 1fr))` so long content cannot blow a column out. */
|
|
195
|
+
private static tracks;
|
|
196
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkGrid, never>;
|
|
197
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkGrid, "mk-grid", never, { "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "minColumnWidth": { "alias": "minColumnWidth"; "required": false; "isSignal": true; }; "autoFit": { "alias": "autoFit"; "required": false; "isSignal": true; }; "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "rowGap": { "alias": "rowGap"; "required": false; "isSignal": true; }; "columnGap": { "alias": "columnGap"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; "justify": { "alias": "justify"; "required": false; "isSignal": true; }; "flow": { "alias": "flow"; "required": false; "isSignal": true; }; "inline": { "alias": "inline"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Per-cell placement inside `mk-grid`: span several tracks, or pin a start
|
|
202
|
+
* line. All inputs accept responsive maps, so a hero card can span the full
|
|
203
|
+
* row on phones and two of four columns on desktop.
|
|
204
|
+
*
|
|
205
|
+
* ```html
|
|
206
|
+
* <mk-grid [columns]="{ xs: 1, lg: 4 }" gap="4">
|
|
207
|
+
* <mk-card mkGridItem [colSpan]="{ xs: 1, lg: 2 }">Revenue</mk-card>
|
|
208
|
+
* …
|
|
209
|
+
* </mk-grid>
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
declare class MkGridItem {
|
|
213
|
+
private readonly bp;
|
|
214
|
+
/** Number of columns to span (`'all'` = the full row). */
|
|
215
|
+
readonly colSpan: _angular_core.InputSignal<MkResponsive<string | number> | null>;
|
|
216
|
+
/** Number of rows to span. */
|
|
217
|
+
readonly rowSpan: _angular_core.InputSignal<MkResponsive<string | number> | null>;
|
|
218
|
+
/** Column line to start at (1-based). */
|
|
219
|
+
readonly colStart: _angular_core.InputSignal<MkResponsive<string | number> | null>;
|
|
220
|
+
/** Row line to start at (1-based). */
|
|
221
|
+
readonly rowStart: _angular_core.InputSignal<MkResponsive<string | number> | null>;
|
|
222
|
+
/** `align-self` for this cell. */
|
|
223
|
+
readonly alignSelf: _angular_core.InputSignal<MkResponsive<"start" | "center" | "end" | "stretch"> | null>;
|
|
224
|
+
/** `justify-self` for this cell. */
|
|
225
|
+
readonly justifySelf: _angular_core.InputSignal<MkResponsive<"start" | "center" | "end" | "stretch"> | null>;
|
|
226
|
+
protected readonly columnCss: _angular_core.Signal<string | null>;
|
|
227
|
+
protected readonly rowCss: _angular_core.Signal<string | null>;
|
|
228
|
+
protected readonly alignSelfCss: _angular_core.Signal<"start" | "center" | "end" | "stretch" | null>;
|
|
229
|
+
protected readonly justifySelfCss: _angular_core.Signal<"start" | "center" | "end" | "stretch" | null>;
|
|
230
|
+
private static line;
|
|
231
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkGridItem, never>;
|
|
232
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkGridItem, "[mkGridItem]", never, { "colSpan": { "alias": "colSpan"; "required": false; "isSignal": true; }; "rowSpan": { "alias": "rowSpan"; "required": false; "isSignal": true; }; "colStart": { "alias": "colStart"; "required": false; "isSignal": true; }; "rowStart": { "alias": "rowStart"; "required": false; "isSignal": true; }; "alignSelf": { "alias": "alignSelf"; "required": false; "isSignal": true; }; "justifySelf": { "alias": "justifySelf"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export { MkFlex, MkFlexBase, MkFlexItem, MkGrid, MkGridItem, MkStack, mkAlignToCss, mkJustifyToCss, mkNumeric, mkSpaceToCss };
|
|
236
|
+
export type { MkAlign, MkFlexDirection, MkGridJustify, MkJustify, MkResponsiveSpace, MkSpace };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import * as _mk_kit_ui_core from '@mk-kit/ui/core';
|
|
3
|
+
import { MkQueryField, MkQueryGroup, MkSize, mkIsQueryGroup, MkQueryRule, MkQueryCombinator, MkQueryNode } from '@mk-kit/ui/core';
|
|
4
|
+
import { MkSelectOption } from '@mk-kit/ui/forms';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* QueryBuilder — a rule / group tree the user assembles from your `fields`,
|
|
8
|
+
* held as plain JSON (`MkQueryGroup`) in the two-way `query` model. Pair it
|
|
9
|
+
* with `mkQueryToPredicate()` to filter rows in the browser, with
|
|
10
|
+
* `MkTableDataSource.setQuery()` to send it to the server, or with
|
|
11
|
+
* `mkQueryToText()` for a readable summary.
|
|
12
|
+
*
|
|
13
|
+
* ```html
|
|
14
|
+
* <mk-query-builder [fields]="fields" [(query)]="query" allowNot />
|
|
15
|
+
*
|
|
16
|
+
* fields: MkQueryField[] = [
|
|
17
|
+
* { key: 'name', label: 'Name' },
|
|
18
|
+
* { key: 'orders', label: 'Orders', type: 'number' },
|
|
19
|
+
* { key: 'status', label: 'Status', type: 'select', options: [{ label: 'Active', value: 'active' }, …] },
|
|
20
|
+
* { key: 'since', label: 'Customer since', type: 'date' },
|
|
21
|
+
* { key: 'vip', label: 'VIP', type: 'boolean' },
|
|
22
|
+
* ];
|
|
23
|
+
* rows = computed(() => this.all.filter(mkQueryToPredicate(this.query(), this.fields)));
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare class MkQueryBuilder {
|
|
27
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
28
|
+
/** The filterable fields, in picker order. */
|
|
29
|
+
readonly fields: _angular_core.InputSignal<readonly MkQueryField[]>;
|
|
30
|
+
/** The query tree (two-way). Starts as an empty `and` group. */
|
|
31
|
+
readonly query: _angular_core.ModelSignal<MkQueryGroup>;
|
|
32
|
+
/** How deep groups may nest (0 = rules only). */
|
|
33
|
+
readonly maxDepth: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
34
|
+
/** Offer a *Not* toggle on every group. */
|
|
35
|
+
readonly allowNot: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
36
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
37
|
+
/** Control size (default `sm`). */
|
|
38
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
39
|
+
readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
|
|
40
|
+
/** Reset to an empty group. */
|
|
41
|
+
clear(): void;
|
|
42
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkQueryBuilder, never>;
|
|
43
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkQueryBuilder, "mk-query-builder", never, { "fields": { "alias": "fields"; "required": true; "isSignal": true; }; "query": { "alias": "query"; "required": false; "isSignal": true; }; "maxDepth": { "alias": "maxDepth"; "required": false; "isSignal": true; }; "allowNot": { "alias": "allowNot"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, { "query": "queryChange"; }, never, never, true, never>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* One group of the builder — its combinator toggle, rules, nested groups and
|
|
48
|
+
* the add / remove actions. Used by `mk-query-builder`; every edit emits a
|
|
49
|
+
* new immutable group upward.
|
|
50
|
+
*/
|
|
51
|
+
declare class MkQueryGroupComponent {
|
|
52
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
53
|
+
readonly group: _angular_core.InputSignal<MkQueryGroup>;
|
|
54
|
+
readonly fields: _angular_core.InputSignal<readonly MkQueryField[]>;
|
|
55
|
+
readonly depth: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
56
|
+
readonly maxDepth: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
57
|
+
readonly allowNot: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
58
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
59
|
+
readonly root: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
60
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
61
|
+
/** A new version of this group after an edit. */
|
|
62
|
+
readonly groupChange: _angular_core.OutputEmitterRef<MkQueryGroup>;
|
|
63
|
+
/** The user removed this (non-root) group. */
|
|
64
|
+
readonly remove: _angular_core.OutputEmitterRef<void>;
|
|
65
|
+
protected readonly fieldOptions: _angular_core.Signal<MkSelectOption[]>;
|
|
66
|
+
protected readonly canNest: _angular_core.Signal<boolean>;
|
|
67
|
+
protected readonly booleanOptions: _angular_core.Signal<MkSelectOption[]>;
|
|
68
|
+
protected isGroup: typeof mkIsQueryGroup;
|
|
69
|
+
protected fieldOf(rule: MkQueryRule): MkQueryField | undefined;
|
|
70
|
+
protected typeOf(rule: MkQueryRule): string;
|
|
71
|
+
protected operatorOptions(rule: MkQueryRule): MkSelectOption[];
|
|
72
|
+
protected needsValue(rule: MkQueryRule): boolean;
|
|
73
|
+
protected selectOptions(rule: MkQueryRule): MkSelectOption[];
|
|
74
|
+
protected isList(rule: MkQueryRule): boolean;
|
|
75
|
+
protected isRange(rule: MkQueryRule): boolean;
|
|
76
|
+
protected asArray(value: unknown): unknown[];
|
|
77
|
+
protected rangePart(rule: MkQueryRule, index: 0 | 1): unknown;
|
|
78
|
+
protected dateValue(v: unknown): Date | null;
|
|
79
|
+
protected numberValue(v: unknown): number | null;
|
|
80
|
+
protected textValue(v: unknown): string;
|
|
81
|
+
protected setCombinator(combinator: MkQueryCombinator): void;
|
|
82
|
+
protected toggleNot(): void;
|
|
83
|
+
protected addRule(): void;
|
|
84
|
+
protected addGroup(): void;
|
|
85
|
+
protected removeAt(index: number): void;
|
|
86
|
+
protected replaceAt(index: number, node: MkQueryNode): void;
|
|
87
|
+
protected setField(index: number, rule: MkQueryRule, key: unknown): void;
|
|
88
|
+
protected setOperator(index: number, rule: MkQueryRule, op: unknown): void;
|
|
89
|
+
protected setValue(index: number, rule: MkQueryRule, value: unknown): void;
|
|
90
|
+
protected setRangePart(index: number, rule: MkQueryRule, part: 0 | 1, value: unknown): void;
|
|
91
|
+
protected setDate(index: number, rule: MkQueryRule, d: Date | null): void;
|
|
92
|
+
protected setDateRange(index: number, rule: MkQueryRule, part: 0 | 1, d: Date | null): void;
|
|
93
|
+
protected onTextInput(index: number, rule: MkQueryRule, event: Event): void;
|
|
94
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkQueryGroupComponent, never>;
|
|
95
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkQueryGroupComponent, "mk-query-group", never, { "group": { "alias": "group"; "required": true; "isSignal": true; }; "fields": { "alias": "fields"; "required": true; "isSignal": true; }; "depth": { "alias": "depth"; "required": false; "isSignal": true; }; "maxDepth": { "alias": "maxDepth"; "required": false; "isSignal": true; }; "allowNot": { "alias": "allowNot"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "root": { "alias": "root"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "groupChange": "groupChange"; "remove": "remove"; }, never, never, true, never>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export { MkQueryBuilder, MkQueryGroupComponent };
|
|
@@ -2,6 +2,7 @@ import * as _mk_kit_ui_table from '@mk-kit/ui/table';
|
|
|
2
2
|
import * as _angular_core from '@angular/core';
|
|
3
3
|
import { TemplateRef, Signal } from '@angular/core';
|
|
4
4
|
import * as _mk_kit_ui_core from '@mk-kit/ui/core';
|
|
5
|
+
import { MkQueryGroup } from '@mk-kit/ui/core';
|
|
5
6
|
import { Observable } from 'rxjs';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -26,6 +27,65 @@ declare class MkTableRowDetail<T = unknown> {
|
|
|
26
27
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkTableRowDetail<any>, "[mkTableRowDetail]", never, {}, {}, never, never, true, never>;
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* CSV export — turn rows into RFC 4180 text and hand it to the browser as a
|
|
32
|
+
* download. Framework-free so it also serves data that never touched a table.
|
|
33
|
+
*/
|
|
34
|
+
/** A column to export: the row property, its header, and an optional formatter. */
|
|
35
|
+
interface MkCsvColumn<T = Record<string, unknown>> {
|
|
36
|
+
/** Property key on each row object supplying the cell value. */
|
|
37
|
+
key: string;
|
|
38
|
+
/** Header text; defaults to `key`. */
|
|
39
|
+
header?: string;
|
|
40
|
+
/** Formatter turning the raw value into cell text (same shape as `MkTableColumn.format`). */
|
|
41
|
+
format?: (value: unknown, row: T) => string;
|
|
42
|
+
}
|
|
43
|
+
interface MkCsvOptions {
|
|
44
|
+
/** Field separator (default `,`; use `;` for locales whose Excel expects it). */
|
|
45
|
+
delimiter?: string;
|
|
46
|
+
/** Emit the header row first (default `true`). */
|
|
47
|
+
header?: boolean;
|
|
48
|
+
/** Line terminator (default `\r\n`, per RFC 4180). */
|
|
49
|
+
newline?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Prefix a UTF-8 byte-order mark (default `true`) so Excel reads accented
|
|
52
|
+
* characters correctly. Only affects the downloaded file / returned text.
|
|
53
|
+
*/
|
|
54
|
+
bom?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Neutralise spreadsheet formula injection (default `true`): a text cell
|
|
57
|
+
* starting with `=`, `+`, `-`, `@`, tab or CR is prefixed with `'` so a
|
|
58
|
+
* malicious value cannot execute when opened in Excel / Sheets. Numbers
|
|
59
|
+
* are never touched, so `-5` stays `-5`.
|
|
60
|
+
*/
|
|
61
|
+
sanitize?: boolean;
|
|
62
|
+
/** Property holding child rows; when set, trees are flattened depth-first. */
|
|
63
|
+
childrenKey?: string;
|
|
64
|
+
}
|
|
65
|
+
/** Options for {@link mkExportCsv}. */
|
|
66
|
+
interface MkCsvExportOptions extends MkCsvOptions {
|
|
67
|
+
/** File name for the download (default `export.csv`; `.csv` is appended if missing). */
|
|
68
|
+
filename?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Serialise `rows` as CSV text.
|
|
72
|
+
*
|
|
73
|
+
* Without `columns` every key of the first row is exported in its own order.
|
|
74
|
+
* Column formatters are applied, so what the user saw in the table is what
|
|
75
|
+
* lands in the file.
|
|
76
|
+
*/
|
|
77
|
+
declare function mkToCsv<T>(rows: readonly T[], columns?: readonly MkCsvColumn<T>[], options?: MkCsvOptions): string;
|
|
78
|
+
/**
|
|
79
|
+
* Trigger a browser download of `text` as a file. No-op outside a DOM
|
|
80
|
+
* (server-side rendering); returns whether a download was started.
|
|
81
|
+
*/
|
|
82
|
+
declare function mkDownloadText(text: string, filename: string, type?: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Serialise `rows` as CSV and download it. Returns the CSV text so callers
|
|
85
|
+
* can also keep it (tests, previews, uploads).
|
|
86
|
+
*/
|
|
87
|
+
declare function mkExportCsv<T>(rows: readonly T[], columns?: readonly MkCsvColumn<T>[], options?: MkCsvExportOptions): string;
|
|
88
|
+
|
|
29
89
|
/** Horizontal text alignment for a table column. */
|
|
30
90
|
type MkTableAlign = 'start' | 'center' | 'end';
|
|
31
91
|
/** Sort direction; `none` means unsorted. */
|
|
@@ -105,12 +165,28 @@ interface MkTableGroup<T = Record<string, unknown>> {
|
|
|
105
165
|
rows: T[];
|
|
106
166
|
}
|
|
107
167
|
/** Payload emitted by {@link MkTable.groupToggle}. */
|
|
168
|
+
/** Payload of `(treeToggle)`: a parent row was expanded or collapsed. */
|
|
169
|
+
interface MkTreeToggle<T = Record<string, unknown>> {
|
|
170
|
+
/** The parent row. */
|
|
171
|
+
row: T;
|
|
172
|
+
/** Whether its child rows are now shown. */
|
|
173
|
+
expanded: boolean;
|
|
174
|
+
}
|
|
108
175
|
interface MkGroupToggle {
|
|
109
176
|
/** The toggled group's value. */
|
|
110
177
|
key: unknown;
|
|
111
178
|
/** Whether the group is now collapsed. */
|
|
112
179
|
collapsed: boolean;
|
|
113
180
|
}
|
|
181
|
+
/** Options for {@link MkTable.exportCsv}. */
|
|
182
|
+
interface MkTableExportOptions extends MkCsvExportOptions {
|
|
183
|
+
/** Export only the selected rows (default: every row). */
|
|
184
|
+
selectedOnly?: boolean;
|
|
185
|
+
/** Restrict to these column keys, in table order (default: every column). */
|
|
186
|
+
columns?: readonly string[];
|
|
187
|
+
/** Start the browser download (default `true`); `false` just returns the text. */
|
|
188
|
+
download?: boolean;
|
|
189
|
+
}
|
|
114
190
|
/** One rendered tbody entry: either a group header or a data row. */
|
|
115
191
|
type MkTableItem<T> = {
|
|
116
192
|
kind: 'group';
|
|
@@ -118,6 +194,12 @@ type MkTableItem<T> = {
|
|
|
118
194
|
} | {
|
|
119
195
|
kind: 'row';
|
|
120
196
|
row: T;
|
|
197
|
+
/** Nesting depth in tree mode (0 for roots and for flat tables). */
|
|
198
|
+
depth: number;
|
|
199
|
+
/** Whether the row has child rows (tree mode). */
|
|
200
|
+
hasChildren: boolean;
|
|
201
|
+
/** Whether its children are currently shown (tree mode). */
|
|
202
|
+
expanded: boolean;
|
|
121
203
|
};
|
|
122
204
|
/**
|
|
123
205
|
* Table — a themed data table built on a native `<table>` for accessibility.
|
|
@@ -242,6 +324,15 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
242
324
|
readonly cellEdit: _angular_core.OutputEmitterRef<MkCellEdit<T>>;
|
|
243
325
|
/** Emitted when a group header is expanded or collapsed. */
|
|
244
326
|
readonly groupToggle: _angular_core.OutputEmitterRef<MkGroupToggle>;
|
|
327
|
+
/**
|
|
328
|
+
* Tree rows: the property on each row holding its child rows (`T[]`). When
|
|
329
|
+
* set, the table renders a tree grid — child rows are indented under their
|
|
330
|
+
* parent behind an expand toggle in the first column, sorting applies per
|
|
331
|
+
* sibling group, and ArrowRight / ArrowLeft on a row open / close it.
|
|
332
|
+
*/
|
|
333
|
+
readonly childrenKey: _angular_core.InputSignal<string | null>;
|
|
334
|
+
/** Emitted when a parent row is expanded or collapsed (tree mode). */
|
|
335
|
+
readonly treeToggle: _angular_core.OutputEmitterRef<MkTreeToggle<T>>;
|
|
245
336
|
/** User-set column widths (px), keyed by column key. */
|
|
246
337
|
private readonly colWidths;
|
|
247
338
|
/** User-set column order (keys); `null` = the input order. */
|
|
@@ -343,6 +434,8 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
343
434
|
private static readonly sortCollator;
|
|
344
435
|
/** Data sorted by the active column, or the input order when unsorted. */
|
|
345
436
|
protected readonly sortedData: _angular_core.Signal<T[]>;
|
|
437
|
+
/** Sort one sibling group by the active column (input order when unsorted). */
|
|
438
|
+
private sortRows;
|
|
346
439
|
/** `aria-sort` value for a header cell. */
|
|
347
440
|
protected ariaSort(col: MkTableColumn<T>): string | null;
|
|
348
441
|
/** Glyph indicating a column's sort state. */
|
|
@@ -353,7 +446,7 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
353
446
|
protected cellText(row: T, col: MkTableColumn<T>): string;
|
|
354
447
|
protected onSort(col: MkTableColumn<T>): void;
|
|
355
448
|
protected onRowClick(row: T): void;
|
|
356
|
-
/** Keyboard activation for clickable rows (Enter / Space). */
|
|
449
|
+
/** Keyboard activation for clickable rows (Enter / Space) and tree keys. */
|
|
357
450
|
protected onRowKeydown(event: KeyboardEvent, row: T): void;
|
|
358
451
|
/** Stable row identity for `@for` tracking (trackKey when set, else the row). */
|
|
359
452
|
protected trackRow: (row: T) => unknown;
|
|
@@ -364,6 +457,12 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
364
457
|
private readonly selectedKeys;
|
|
365
458
|
/** Whether `row` is currently selected. */
|
|
366
459
|
protected isSelected(row: T): boolean;
|
|
460
|
+
/**
|
|
461
|
+
* Every data row, in display order, ignoring tree expansion — what
|
|
462
|
+
* "select all" and the header checkbox reason about. Equals `sortedData`
|
|
463
|
+
* for flat tables.
|
|
464
|
+
*/
|
|
465
|
+
private readonly allRows;
|
|
367
466
|
/** True when every visible row is selected. */
|
|
368
467
|
protected readonly allSelected: _angular_core.Signal<boolean>;
|
|
369
468
|
/** True when some — but not all — visible rows are selected. */
|
|
@@ -371,7 +470,7 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
371
470
|
private commitSelection;
|
|
372
471
|
/** Toggle a single row's selection without triggering `rowClick`. */
|
|
373
472
|
protected toggleRow(row: T): void;
|
|
374
|
-
/** Select or deselect all
|
|
473
|
+
/** Select or deselect all rows (every tree row, expanded or not). */
|
|
375
474
|
protected toggleAll(): void;
|
|
376
475
|
/** Group values currently collapsed. */
|
|
377
476
|
private readonly collapsedGroups;
|
|
@@ -382,6 +481,36 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
382
481
|
* rows when grouping is on, else just the sorted rows.
|
|
383
482
|
*/
|
|
384
483
|
protected readonly displayItems: _angular_core.Signal<MkTableItem<T>[]>;
|
|
484
|
+
/**
|
|
485
|
+
* Append `rows` as render items. In tree mode each row is followed by its
|
|
486
|
+
* (sorted) children while it is expanded, one level deeper.
|
|
487
|
+
*/
|
|
488
|
+
private pushRows;
|
|
489
|
+
/** The child rows of `row` (tree mode), or an empty list. */
|
|
490
|
+
private childrenOf;
|
|
491
|
+
/** Keys of parent rows whose children are shown. */
|
|
492
|
+
private readonly treeExpanded;
|
|
493
|
+
/** Whether a parent row's children are currently shown (tree mode). */
|
|
494
|
+
isTreeExpanded(row: T): boolean;
|
|
495
|
+
/** Show or hide a parent row's children (tree mode). */
|
|
496
|
+
toggleTreeRow(row: T, event?: Event): void;
|
|
497
|
+
/** Expand every parent row (tree mode). */
|
|
498
|
+
expandAllRows(): void;
|
|
499
|
+
/** Collapse every parent row (tree mode). */
|
|
500
|
+
collapseAllRows(): void;
|
|
501
|
+
/**
|
|
502
|
+
* The table's rows as CSV: current column order, column formatters applied,
|
|
503
|
+
* sorted the way they are shown, tree children flattened under their parent
|
|
504
|
+
* whether or not they are expanded. Downloads the file (default name
|
|
505
|
+
* `table.csv`) and returns the text.
|
|
506
|
+
*/
|
|
507
|
+
exportCsv(options?: MkTableExportOptions): string;
|
|
508
|
+
private setTreeExpanded;
|
|
509
|
+
/**
|
|
510
|
+
* ArrowRight opens and ArrowLeft closes a parent row's children (swapped in
|
|
511
|
+
* RTL). Handled for keys pressed on the row itself or on its tree toggle.
|
|
512
|
+
*/
|
|
513
|
+
protected onTreeKeydown(event: KeyboardEvent, row: T): boolean;
|
|
385
514
|
/** `@for` identity: group headers by value, rows by {@link trackRow}. */
|
|
386
515
|
protected trackItem: (item: MkTableItem<T>) => unknown;
|
|
387
516
|
/** Whether a group is currently collapsed. */
|
|
@@ -400,7 +529,7 @@ declare class MkTable<T = Record<string, unknown>> {
|
|
|
400
529
|
/** Toggle a row's detail panel, honouring `singleExpand`. */
|
|
401
530
|
protected toggleExpand(row: T, event?: Event): void;
|
|
402
531
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkTable<any>, never>;
|
|
403
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkTable<any>, "mk-table", never, { "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "stickyHeader": { "alias": "stickyHeader"; "required": false; "isSignal": true; }; "zebra": { "alias": "zebra"; "required": false; "isSignal": true; }; "hover": { "alias": "hover"; "required": false; "isSignal": true; }; "density": { "alias": "density"; "required": false; "isSignal": true; }; "stackAt": { "alias": "stackAt"; "required": false; "isSignal": true; }; "clickableRows": { "alias": "clickableRows"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "trackKey": { "alias": "trackKey"; "required": false; "isSignal": true; }; "rowClass": { "alias": "rowClass"; "required": false; "isSignal": true; }; "expandable": { "alias": "expandable"; "required": false; "isSignal": true; }; "singleExpand": { "alias": "singleExpand"; "required": false; "isSignal": true; }; "resizableColumns": { "alias": "resizableColumns"; "required": false; "isSignal": true; }; "reorderableColumns": { "alias": "reorderableColumns"; "required": false; "isSignal": true; }; "groupBy": { "alias": "groupBy"; "required": false; "isSignal": true; }; "groupLabel": { "alias": "groupLabel"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; "sortChange": "sortChange"; "rowClick": "rowClick"; "selectionChange": "selectionChange"; "expandedChange": "expandedChange"; "columnResize": "columnResize"; "columnReorder": "columnReorder"; "cellEdit": "cellEdit"; "groupToggle": "groupToggle"; }, ["rowDetail", "cellTemplates"], ["[mkTableEmpty]"], true, never>;
|
|
532
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkTable<any>, "mk-table", never, { "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "stickyHeader": { "alias": "stickyHeader"; "required": false; "isSignal": true; }; "zebra": { "alias": "zebra"; "required": false; "isSignal": true; }; "hover": { "alias": "hover"; "required": false; "isSignal": true; }; "density": { "alias": "density"; "required": false; "isSignal": true; }; "stackAt": { "alias": "stackAt"; "required": false; "isSignal": true; }; "clickableRows": { "alias": "clickableRows"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "trackKey": { "alias": "trackKey"; "required": false; "isSignal": true; }; "rowClass": { "alias": "rowClass"; "required": false; "isSignal": true; }; "expandable": { "alias": "expandable"; "required": false; "isSignal": true; }; "singleExpand": { "alias": "singleExpand"; "required": false; "isSignal": true; }; "resizableColumns": { "alias": "resizableColumns"; "required": false; "isSignal": true; }; "reorderableColumns": { "alias": "reorderableColumns"; "required": false; "isSignal": true; }; "groupBy": { "alias": "groupBy"; "required": false; "isSignal": true; }; "groupLabel": { "alias": "groupLabel"; "required": false; "isSignal": true; }; "childrenKey": { "alias": "childrenKey"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; "sortChange": "sortChange"; "rowClick": "rowClick"; "selectionChange": "selectionChange"; "expandedChange": "expandedChange"; "columnResize": "columnResize"; "columnReorder": "columnReorder"; "cellEdit": "cellEdit"; "groupToggle": "groupToggle"; "treeToggle": "treeToggle"; }, ["rowDetail", "cellTemplates"], ["[mkTableEmpty]"], true, never>;
|
|
404
533
|
}
|
|
405
534
|
|
|
406
535
|
/** Context handed to an `[mkTableCell]` template. */
|
|
@@ -549,6 +678,8 @@ interface MkDataRequest {
|
|
|
549
678
|
sort: MkSortState | null;
|
|
550
679
|
/** Free-text filter query (`''` = none). */
|
|
551
680
|
filter: string;
|
|
681
|
+
/** Structured filter from `mk-query-builder` (`null` = none). Compacted: no empty groups or unfinished rules. */
|
|
682
|
+
query: MkQueryGroup | null;
|
|
552
683
|
}
|
|
553
684
|
/** One page of server data returned by a {@link MkDataFetcher}. */
|
|
554
685
|
interface MkDataPage<T> {
|
|
@@ -661,6 +792,7 @@ declare class MkTableDataSource<T> {
|
|
|
661
792
|
private readonly _pageSize;
|
|
662
793
|
private readonly _sort;
|
|
663
794
|
private readonly _filter;
|
|
795
|
+
private readonly _query;
|
|
664
796
|
/** Rows of the current page (`[]` until the first load lands). */
|
|
665
797
|
readonly rows: Signal<T[]>;
|
|
666
798
|
/** Total row count across all pages (feed to `mk-pagination`'s `total`). */
|
|
@@ -677,6 +809,8 @@ declare class MkTableDataSource<T> {
|
|
|
677
809
|
readonly sort: Signal<MkSortState | null>;
|
|
678
810
|
/** Current filter query (updates immediately, even while debouncing). */
|
|
679
811
|
readonly filter: Signal<string>;
|
|
812
|
+
/** Current structured query, or `null`. */
|
|
813
|
+
readonly query: Signal<MkQueryGroup | null>;
|
|
680
814
|
/** True when a settled load reported no rows at all. */
|
|
681
815
|
readonly empty: Signal<boolean>;
|
|
682
816
|
/** Monotonic request id — settles from older epochs are discarded. */
|
|
@@ -706,6 +840,12 @@ declare class MkTableDataSource<T> {
|
|
|
706
840
|
* flushes it early. A no-op when the query is unchanged.
|
|
707
841
|
*/
|
|
708
842
|
setFilter(query: string): void;
|
|
843
|
+
/**
|
|
844
|
+
* Set (or clear with `null`) the structured query from `mk-query-builder`.
|
|
845
|
+
* Empty groups and unfinished rules are dropped before the request; a query
|
|
846
|
+
* with nothing left is sent as `null`. Resets to page 1 and loads at once.
|
|
847
|
+
*/
|
|
848
|
+
setQuery(query: MkQueryGroup | null): void;
|
|
709
849
|
/**
|
|
710
850
|
* Re-run the current request immediately (e.g. after a mutation). Flushes a
|
|
711
851
|
* pending debounced filter, since the request reads the live filter value.
|
|
@@ -735,5 +875,5 @@ declare class MkTableDataSource<T> {
|
|
|
735
875
|
private clearSub;
|
|
736
876
|
}
|
|
737
877
|
|
|
738
|
-
export { MkSort, MkSortHeader, MkTable, MkTableCell, MkTableDataSource, MkTableRowDetail };
|
|
739
|
-
export type { MkCellEdit, MkColumnResize, MkDataFetcher, MkDataPage, MkDataRequest, MkGroupToggle, MkSortChange, MkSortDirection, MkSortState, MkSortable, MkTableAlign, MkTableCellContext, MkTableColumn, MkTableDataSourceOptions, MkTableDensity, MkTableGroup };
|
|
878
|
+
export { MkSort, MkSortHeader, MkTable, MkTableCell, MkTableDataSource, MkTableRowDetail, mkDownloadText, mkExportCsv, mkToCsv };
|
|
879
|
+
export type { MkCellEdit, MkColumnResize, MkCsvColumn, MkCsvExportOptions, MkCsvOptions, MkDataFetcher, MkDataPage, MkDataRequest, MkGroupToggle, MkSortChange, MkSortDirection, MkSortState, MkSortable, MkTableAlign, MkTableCellContext, MkTableColumn, MkTableDataSourceOptions, MkTableDensity, MkTableExportOptions, MkTableGroup, MkTreeToggle };
|
package/types/mk-kit-ui.d.ts
CHANGED
|
@@ -14,4 +14,7 @@ export * from '@mk-kit/ui/feedback';
|
|
|
14
14
|
export * from '@mk-kit/ui/rich-text';
|
|
15
15
|
export * from '@mk-kit/ui/block-editor';
|
|
16
16
|
export * from '@mk-kit/ui/context-menu';
|
|
17
|
+
export * from '@mk-kit/ui/layout';
|
|
18
|
+
export * from '@mk-kit/ui/chat';
|
|
19
|
+
export * from '@mk-kit/ui/query-builder';
|
|
17
20
|
export * from '@mk-kit/ui/media';
|