@affino/datagrid-vue-app 0.1.39 → 0.1.41

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 CHANGED
@@ -708,7 +708,7 @@ Out of the box this wires:
708
708
  - sort ascending / descending / clear
709
709
  - group / ungroup for groupable columns
710
710
  - pin column submenu (`left`, `right`, `none`)
711
- - value-set filter picker with search + apply/clear
711
+ - value-set filter picker with search + apply/clear; server-backed row models may resolve values asynchronously through `api.columns.getHistogram(columnKey, { ignoreSelfFilter: true, search })`
712
712
  - column order / visibility popover
713
713
 
714
714
  Supported action keys for `actions` are:
@@ -1741,11 +1741,57 @@ The component emits:
1741
1741
 
1742
1742
  - When at least one filter is active, the `Advanced filter` toolbar button shows an active filter icon and active button styling.
1743
1743
  - Removing the only advanced-filter clause does not lock the UI; the builder keeps one empty clause row so the user can clear and rebuild the expression in place.
1744
+ - `advancedFilter.labels` customizes the toolbar text, panel headings, field labels, action labels, logical join labels, and operator labels. This is the supported localization path for built-in advanced-filter copy.
1745
+
1746
+ ```vue
1747
+ <DataGrid
1748
+ :rows="rows"
1749
+ :columns="columns"
1750
+ :advanced-filter="{
1751
+ labels: {
1752
+ buttonLabel: 'Расширенный фильтр',
1753
+ title: 'Условия отбора',
1754
+ joinLabel: 'Связь',
1755
+ columnLabel: 'Колонка',
1756
+ operatorLabel: 'Оператор',
1757
+ valueLabel: 'Значение',
1758
+ apply: 'Применить',
1759
+ cancel: 'Отмена',
1760
+ operators: {
1761
+ contains: 'содержит',
1762
+ equals: 'равно',
1763
+ 'not-equals': 'не равно',
1764
+ },
1765
+ joins: { and: 'И', or: 'ИЛИ' },
1766
+ },
1767
+ }"
1768
+ />
1769
+ ```
1744
1770
 
1745
1771
  ## Built-in Overlay Panels
1746
1772
 
1747
1773
  - The built-in `Column layout`, `Advanced filter`, and `Find / replace` toolbar panels render through the shared Affino overlay host rather than inline in the grid tree.
1748
1774
  - These built-in panels are draggable by their header title area and reopen at the last detached position for the current grid instance during the active page session.
1775
+ - `columnLayout.labels` customizes the built-in columns panel text, including the toolbar label, panel title, close/cancel/apply actions, and move-button accessible labels.
1776
+
1777
+ ```vue
1778
+ <DataGrid
1779
+ :rows="rows"
1780
+ :columns="columns"
1781
+ :column-layout="{
1782
+ labels: {
1783
+ buttonLabel: 'Колонки',
1784
+ eyebrow: 'Настройка колонок',
1785
+ title: 'Порядок и видимость',
1786
+ close: 'Закрыть',
1787
+ cancel: 'Отмена',
1788
+ apply: 'Применить',
1789
+ moveUp: 'Вверх',
1790
+ moveDown: 'Вниз',
1791
+ },
1792
+ }"
1793
+ />
1794
+ ```
1749
1795
 
1750
1796
  ## Column Reorder
1751
1797
 
@@ -1792,7 +1838,7 @@ If you need to ship the UI but keep row order locked, leave `rowReorder` unset o
1792
1838
  ### Runtime access
1793
1839
 
1794
1840
  - `getApi()`
1795
- - `getRuntime()`
1841
+ - `getRuntime()` returns the typed runtime bridge (`DataGridExposedRuntime`) for virtual-window and body-row APIs.
1796
1842
  - `getCore()`
1797
1843
 
1798
1844
  ### History
@@ -1,5 +1,5 @@
1
1
  import { type CSSProperties, type ExtractPublicPropTypes, type PropType, type VNode } from "vue";
2
- import { type CreateDataGridCoreOptions, type DataGridApi, type DataGridApiRowSelectionChangedEvent, type DataGridApiSelectionChangedEvent, type DataGridApiPluginDefinition, type DataGridAggregationModel, type DataGridColumnSnapshot, type DataGridColumnPin, type DataGridComputedFieldDefinition, type DataGridCoreServiceRegistry, type DataGridFilterSnapshot, type DataGridFormulaFieldDefinition, type DataGridFormulaFunctionRegistry, type DataGridGroupBySpec, type DataGridMigrateStateOptions, type DataGridRowNode, type DataGridRowSelectionSnapshot, type DataGridRowModel, type DataGridRowNodeInput, type DataGridSetStateOptions, type DataGridSortState, type DataGridUnifiedColumnState, type DataGridUnifiedState, type DataGridPivotSpec } from "@affino/datagrid-vue";
2
+ import { type CreateDataGridCoreOptions, type DataGridApi, type DataGridApiRowSelectionChangedEvent, type DataGridApiSelectionChangedEvent, type DataGridApiPluginDefinition, type DataGridAggregationModel, type DataGridColumnSnapshot, type DataGridColumnPin, type DataGridComputedFieldDefinition, type DataGridCoreServiceRegistry, type DataGridFilterSnapshot, type DataGridFormulaFieldDefinition, type DataGridFormulaFunctionRegistry, type DataGridGroupBySpec, type DataGridMigrateStateOptions, type DataGridRowNode, type DataGridRowSelectionSnapshot, type DataGridRowModel, type DataGridRowNodeInput, type DataGridSetStateOptions, type DataGridSortState, type DataGridUnifiedColumnState, type DataGridUnifiedState, type DataGridPivotSpec, type UseDataGridRuntimeResult } from "@affino/datagrid-vue";
3
3
  import { defineDataGridStructuralRowActionHandler, type DataGridStructuralRowActionHandler, type DataGridStructuralRowActionId } from "./dataGridStructuralRowActions";
4
4
  import type { DataGridBivariantCallback } from "./types/bivariance";
5
5
  import type { DataGridAppToolbarModule } from "./host/DataGridModuleHost";
@@ -58,6 +58,7 @@ export declare function defineDataGridFilterCellStyleReader<TRow = unknown>(): <
58
58
  export declare function defineDataGridCellClassResolver<TRow = unknown>(): <TResolver extends DataGridCellClassResolver<TRow>>(resolver: TResolver) => TResolver;
59
59
  export declare function defineDataGridCellStyleResolver<TRow = unknown>(): <TResolver extends DataGridCellStyleResolver<TRow>>(resolver: TResolver) => TResolver;
60
60
  export { defineDataGridStructuralRowActionHandler };
61
+ export type DataGridExposedRuntime<TRow = unknown> = Pick<UseDataGridRuntimeResult<TRow>, "api" | "syncBodyRowsInRange" | "setViewportRange" | "setVirtualWindowRange" | "setRows" | "rowPartition" | "virtualWindow" | "columnSnapshot" | "getBodyRowAtIndex" | "resolveBodyRowIndexById">;
61
62
  declare const dataGridProps: {
62
63
  readonly rows: {
63
64
  readonly type: PropType<readonly unknown[]>;
@@ -341,6 +342,7 @@ export interface DataGridExposed<TRow = unknown> {
341
342
  history: DataGridHistoryController;
342
343
  getHistory: () => DataGridHistoryController;
343
344
  getApi: () => DataGridApi<TRow> | null;
345
+ getRuntime: () => DataGridExposedRuntime<TRow> | null;
344
346
  getSelectionAggregatesLabel: () => string;
345
347
  runStructuralRowAction: (action: DataGridStructuralRowActionId, rowId: string | number) => Promise<boolean>;
346
348
  getState: () => DataGridUnifiedState<TRow> | null;
@@ -1,4 +1,4 @@
1
- import { _ as e } from "./chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-BUkG_Bz7.js";
1
+ import { _ as e } from "./chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DxZakgyj.js";
2
2
  export {
3
3
  e as DataGridAdvancedFilterPopover
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-BUkG_Bz7.js";
1
+ import { _ as f } from "./DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DxZakgyj.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -0,0 +1,263 @@
1
+ import { defineComponent as N, inject as z, ref as A, computed as c, watch as w, nextTick as O, openBlock as i, createElementBlock as u, Fragment as C, createElementVNode as a, mergeProps as F, unref as _, createCommentVNode as P, createTextVNode as K, toDisplayString as l, createBlock as M, Teleport as U, renderList as T, createVNode as k } from "vue";
2
+ import { usePopoverController as Z, useFloatingPopover as H } from "@affino/popover-vue";
3
+ import { _ as L } from "./DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-xry4J3Lx.js";
4
+ import { d as J, r as Q } from "./dataGridOverlayThemeVars-vzY74EIz.js";
5
+ import { D } from "./dataGridAdvancedFilter-xnME5bRa.js";
6
+ import { u as W } from "./useDataGridDraggableOverlaySurface-BgkSR_nl.js";
7
+ const X = ["data-datagrid-advanced-filter-active"], Y = {
8
+ key: 0,
9
+ class: "datagrid-app-toolbar__button-icon datagrid-app-toolbar__button-icon--advanced-filter",
10
+ "data-datagrid-advanced-filter-icon": "true",
11
+ "aria-hidden": "true"
12
+ }, x = /* @__PURE__ */ a("svg", {
13
+ viewBox: "0 0 16 16",
14
+ focusable: "false"
15
+ }, [
16
+ /* @__PURE__ */ a("path", {
17
+ d: "M2 3.5h12l-4.6 5.2v3.2l-2.8 1.6V8.7L2 3.5Z",
18
+ fill: "currentColor"
19
+ })
20
+ ], -1), ee = [
21
+ x
22
+ ], ae = ["data-datagrid-overlay-dragging"], te = { class: "datagrid-advanced-filter__header" }, le = { class: "datagrid-advanced-filter__eyebrow" }, oe = { class: "datagrid-advanced-filter__title" }, de = { class: "datagrid-advanced-filter__applied" }, re = { class: "datagrid-advanced-filter__applied-head" }, ie = { class: "datagrid-advanced-filter__eyebrow" }, ne = { class: "datagrid-advanced-filter__applied-title" }, se = ["disabled"], ce = {
23
+ key: 0,
24
+ class: "datagrid-advanced-filter__applied-list"
25
+ }, ue = {
26
+ key: 1,
27
+ class: "datagrid-advanced-filter__applied-empty"
28
+ }, ve = { class: "datagrid-advanced-filter__rows" }, pe = { class: "datagrid-advanced-filter__field datagrid-advanced-filter__field--join" }, _e = { class: "datagrid-advanced-filter__label" }, fe = { class: "datagrid-advanced-filter__field" }, ge = { class: "datagrid-advanced-filter__label" }, be = { class: "datagrid-advanced-filter__field" }, me = { class: "datagrid-advanced-filter__label" }, ye = { class: "datagrid-advanced-filter__field datagrid-advanced-filter__field--value" }, he = { class: "datagrid-advanced-filter__label" }, we = ["name", "value", "placeholder", "aria-label", "onInput"], Ce = { class: "datagrid-advanced-filter__row-actions" }, ke = ["onClick"], Le = { class: "datagrid-advanced-filter__footer" }, Ae = { class: "datagrid-advanced-filter__footer-actions" }, je = /* @__PURE__ */ N({
29
+ __name: "DataGridAdvancedFilterPopover",
30
+ props: {
31
+ isOpen: { type: Boolean },
32
+ clauses: {},
33
+ columns: {},
34
+ appliedFilterSummaryItems: { default: () => [] },
35
+ hasAnyFilters: { type: Boolean, default: !1 },
36
+ buttonLabel: {},
37
+ labels: { default: () => D },
38
+ active: { type: Boolean, default: !1 },
39
+ showActiveIcon: { type: Boolean, default: !1 }
40
+ },
41
+ emits: ["open", "add", "remove", "apply", "cancel", "reset-all", "update-clause"],
42
+ setup(I, { emit: j }) {
43
+ const n = I, s = j, m = z(J, A(null)), y = A({}), r = Z(
44
+ {
45
+ id: "advanced-filter",
46
+ role: "dialog",
47
+ closeOnEscape: !0,
48
+ closeOnInteractOutside: !0
49
+ },
50
+ {
51
+ onOpen: () => {
52
+ n.isOpen || s("open"), h();
53
+ },
54
+ onClose: () => {
55
+ n.isOpen && s("cancel");
56
+ }
57
+ }
58
+ ), p = H(r, {
59
+ placement: "bottom",
60
+ align: "start",
61
+ gutter: 10,
62
+ viewportPadding: 12,
63
+ zIndex: 180,
64
+ lockScroll: !1,
65
+ returnFocus: !0
66
+ }), f = W({
67
+ surfaceId: "advanced-filter",
68
+ rootElementRef: m,
69
+ floating: p
70
+ }), B = c(() => r.getTriggerProps({ role: "dialog" })), E = c(() => r.getContentProps({ role: "dialog", tabIndex: -1 })), S = c(() => r.state.value.open), V = c(() => p.teleportTarget.value), e = c(() => n.labels ?? D), $ = c(() => typeof n.buttonLabel == "string" && n.buttonLabel.trim().length > 0 ? n.buttonLabel.trim() : e.value.buttonLabel), R = c(() => Object.freeze([
71
+ { value: "and", label: e.value.joins.and },
72
+ { value: "or", label: e.value.joins.or }
73
+ ])), q = c(() => Object.freeze([
74
+ { value: "contains", label: e.value.operators.contains },
75
+ { value: "in", label: e.value.operators.in },
76
+ { value: "equals", label: e.value.operators.equals },
77
+ { value: "not-equals", label: e.value.operators["not-equals"] },
78
+ { value: "starts-with", label: e.value.operators["starts-with"] },
79
+ { value: "ends-with", label: e.value.operators["ends-with"] },
80
+ { value: "gt", label: e.value.operators.gt },
81
+ { value: "gte", label: e.value.operators.gte },
82
+ { value: "lt", label: e.value.operators.lt },
83
+ { value: "lte", label: e.value.operators.lte }
84
+ ])), G = c(() => n.columns.map((o) => ({
85
+ value: o.key,
86
+ label: o.label
87
+ })));
88
+ w(
89
+ () => n.isOpen,
90
+ async (o) => {
91
+ if (o) {
92
+ h(), r.state.value.open || r.open("programmatic"), await O(), p.contentRef.value?.querySelector('[data-advanced-filter-autofocus="true"]')?.focus({ preventScroll: !0 }), await p.updatePosition();
93
+ return;
94
+ }
95
+ r.state.value.open && r.close("programmatic");
96
+ },
97
+ { immediate: !0 }
98
+ ), w(m, () => {
99
+ r.state.value.open && h();
100
+ }), w(
101
+ () => n.clauses.length,
102
+ async () => {
103
+ r.state.value.open && (await O(), await p.updatePosition());
104
+ }
105
+ );
106
+ function h() {
107
+ y.value = Q(m.value);
108
+ }
109
+ function g(o, d, t) {
110
+ s("update-clause", { clauseId: o, field: d, value: t });
111
+ }
112
+ return (o, d) => (i(), u(C, null, [
113
+ a("button", F({
114
+ ref: _(p).triggerRef,
115
+ type: "button",
116
+ class: ["datagrid-app-toolbar__button", { "datagrid-app-toolbar__button--active": o.active }],
117
+ "data-datagrid-toolbar-action": "advanced-filter",
118
+ "data-datagrid-advanced-filter-active": o.showActiveIcon ? "true" : "false",
119
+ style: y.value
120
+ }, B.value), [
121
+ o.showActiveIcon ? (i(), u("span", Y, ee)) : P("", !0),
122
+ K(" " + l($.value), 1)
123
+ ], 16, X),
124
+ (i(), M(U, { to: V.value }, [
125
+ S.value ? (i(), u("section", F({
126
+ key: 0,
127
+ ref: _(p).contentRef,
128
+ class: "datagrid-advanced-filter",
129
+ "data-datagrid-overlay-surface": "true",
130
+ "data-datagrid-overlay-surface-id": "advanced-filter",
131
+ "data-datagrid-overlay-dragging": _(f).dragging.value ? "true" : "false",
132
+ style: [_(f).surfaceStyle.value, y.value]
133
+ }, E.value), [
134
+ a("header", te, [
135
+ a("div", {
136
+ class: "datagrid-overlay-drag-handle",
137
+ "data-datagrid-overlay-drag-handle": "true",
138
+ onPointerdown: d[0] || (d[0] = //@ts-ignore
139
+ (...t) => _(f).handlePointerDown && _(f).handlePointerDown(...t))
140
+ }, [
141
+ a("div", le, l(e.value.eyebrow), 1),
142
+ a("h3", oe, l(e.value.title), 1)
143
+ ], 32),
144
+ a("button", {
145
+ type: "button",
146
+ class: "datagrid-advanced-filter__ghost",
147
+ onClick: d[1] || (d[1] = (t) => s("cancel"))
148
+ }, l(e.value.close), 1)
149
+ ]),
150
+ a("section", de, [
151
+ a("div", re, [
152
+ a("div", null, [
153
+ a("div", ie, l(e.value.appliedEyebrow), 1),
154
+ a("div", ne, l(e.value.appliedTitle), 1)
155
+ ]),
156
+ a("button", {
157
+ type: "button",
158
+ class: "datagrid-advanced-filter__ghost",
159
+ disabled: !o.hasAnyFilters,
160
+ "data-datagrid-advanced-filter-action": "reset-all",
161
+ onClick: d[2] || (d[2] = (t) => s("reset-all"))
162
+ }, l(e.value.resetAllFilters), 9, se)
163
+ ]),
164
+ o.appliedFilterSummaryItems.length > 0 ? (i(), u("div", ce, [
165
+ (i(!0), u(C, null, T(o.appliedFilterSummaryItems, (t, b) => (i(), u("span", {
166
+ key: `applied-filter-${b}`,
167
+ class: "datagrid-advanced-filter__applied-chip"
168
+ }, l(t), 1))), 128))
169
+ ])) : (i(), u("div", ue, l(e.value.noFiltersApplied), 1))
170
+ ]),
171
+ a("div", ve, [
172
+ (i(!0), u(C, null, T(o.clauses, (t, b) => (i(), u("div", {
173
+ key: t.id,
174
+ class: "datagrid-advanced-filter__row"
175
+ }, [
176
+ a("label", pe, [
177
+ a("span", _e, l(e.value.joinLabel), 1),
178
+ k(L, {
179
+ class: "datagrid-advanced-filter__select",
180
+ value: t.join,
181
+ options: R.value,
182
+ "open-on-mount": !1,
183
+ "open-on-focus": !1,
184
+ "sticky-popover-id": "advanced-filter",
185
+ disabled: b === 0,
186
+ "aria-label": e.value.joinAriaLabel,
187
+ onCommit: (v) => g(t.id, "join", v)
188
+ }, null, 8, ["value", "options", "disabled", "aria-label", "onCommit"])
189
+ ]),
190
+ a("label", fe, [
191
+ a("span", ge, l(e.value.columnLabel), 1),
192
+ k(L, {
193
+ class: "datagrid-advanced-filter__select",
194
+ value: t.columnKey,
195
+ options: G.value,
196
+ "open-on-mount": !1,
197
+ "open-on-focus": !1,
198
+ "sticky-popover-id": "advanced-filter",
199
+ "data-advanced-filter-autofocus": b === 0 ? "true" : null,
200
+ "aria-label": e.value.columnAriaLabel,
201
+ onCommit: (v) => g(t.id, "columnKey", v)
202
+ }, null, 8, ["value", "options", "data-advanced-filter-autofocus", "aria-label", "onCommit"])
203
+ ]),
204
+ a("label", be, [
205
+ a("span", me, l(e.value.operatorLabel), 1),
206
+ k(L, {
207
+ class: "datagrid-advanced-filter__select",
208
+ value: t.operator,
209
+ options: q.value,
210
+ "open-on-mount": !1,
211
+ "open-on-focus": !1,
212
+ "sticky-popover-id": "advanced-filter",
213
+ "aria-label": e.value.operatorAriaLabel,
214
+ onCommit: (v) => g(t.id, "operator", v)
215
+ }, null, 8, ["value", "options", "aria-label", "onCommit"])
216
+ ]),
217
+ a("label", ye, [
218
+ a("span", he, l(e.value.valueLabel), 1),
219
+ a("input", {
220
+ name: `datagrid-advanced-filter-value-${t.id}`,
221
+ value: t.value,
222
+ type: "text",
223
+ placeholder: e.value.valuePlaceholder,
224
+ "aria-label": e.value.valueAriaLabel,
225
+ onInput: (v) => g(t.id, "value", v.target.value)
226
+ }, null, 40, we)
227
+ ]),
228
+ a("div", Ce, [
229
+ a("button", {
230
+ type: "button",
231
+ class: "datagrid-advanced-filter__ghost datagrid-advanced-filter__ghost--danger",
232
+ onClick: (v) => s("remove", t.id)
233
+ }, l(o.clauses.length <= 1 ? e.value.clearClause : e.value.removeClause), 9, ke)
234
+ ])
235
+ ]))), 128))
236
+ ]),
237
+ a("footer", Le, [
238
+ a("button", {
239
+ type: "button",
240
+ class: "datagrid-advanced-filter__secondary",
241
+ onClick: d[3] || (d[3] = (t) => s("add"))
242
+ }, l(e.value.addClause), 1),
243
+ a("div", Ae, [
244
+ a("button", {
245
+ type: "button",
246
+ class: "datagrid-advanced-filter__secondary",
247
+ onClick: d[4] || (d[4] = (t) => s("cancel"))
248
+ }, l(e.value.cancel), 1),
249
+ a("button", {
250
+ type: "button",
251
+ class: "datagrid-advanced-filter__primary",
252
+ onClick: d[5] || (d[5] = (t) => s("apply"))
253
+ }, l(e.value.apply), 1)
254
+ ])
255
+ ])
256
+ ], 16, ae)) : P("", !0)
257
+ ], 8, ["to"]))
258
+ ], 64));
259
+ }
260
+ });
261
+ export {
262
+ je as _
263
+ };