@affino/datagrid-vue-app 0.1.38 → 0.1.40
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 +48 -2
- package/dist/DataGrid.d.ts +3 -1
- package/dist/advanced-filter.js +1 -1
- package/dist/aggregations.js +1 -1
- package/dist/chunks/{DataGridAdvancedFilterPopover-JFXqnOOj.js → DataGridAdvancedFilterPopover-C_MjEKFo.js} +1 -1
- package/dist/chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DxZakgyj.js +263 -0
- package/dist/chunks/{DataGridAggregationsPopover-DS5swHvj.js → DataGridAggregationsPopover-C8kdwv0O.js} +1 -1
- package/dist/chunks/{DataGridAggregationsPopover.vue_vue_type_script_setup_true_lang-Ct7ZV2zk.js → DataGridAggregationsPopover.vue_vue_type_script_setup_true_lang-t6v8MqIT.js} +1 -1
- package/dist/chunks/{DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-DOWIAEUl.js → DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-xry4J3Lx.js} +30 -28
- package/dist/chunks/{DataGridGanttStageEntry-jFh25aC1.js → DataGridGanttStageEntry-BhNAeUxC.js} +2974 -2898
- package/dist/chunks/dataGridAdvancedFilter-xnME5bRa.js +150 -0
- package/dist/chunks/useDataGridAppRowModel-C-OPUq4R.js +4458 -0
- package/dist/config/dataGridAdvancedFilter.d.ts +69 -0
- package/dist/config/dataGridColumnLayout.d.ts +23 -0
- package/dist/gantt.js +1 -1
- package/dist/host/DataGridDefaultRenderer.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +238 -263
- package/dist/internal.js +3 -3
- package/dist/overlays/DataGridAdvancedFilterPopover.vue.d.ts +6 -4
- package/dist/overlays/DataGridColumnLayoutPopover.vue.d.ts +6 -4
- package/dist/overlays/DataGridColumnMenu.vue.d.ts +2 -1
- package/dist/stage/dataGridTableStage.types.d.ts +3 -3
- package/dist/stage/useDataGridTableStageRuntime.d.ts +13 -13
- package/package.json +3 -3
- package/dist/chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-CDuio50U.js +0 -261
- package/dist/chunks/useDataGridAppRowModel-CQEe1pSs.js +0 -4424
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
|
package/dist/DataGrid.d.ts
CHANGED
|
@@ -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;
|
package/dist/advanced-filter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e } from "./chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-
|
|
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
|
};
|
package/dist/aggregations.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as a } from "./chunks/DataGridAggregationsPopover.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _ as a } from "./chunks/DataGridAggregationsPopover.vue_vue_type_script_setup_true_lang-t6v8MqIT.js";
|
|
2
2
|
export {
|
|
3
3
|
a as DataGridAggregationsPopover
|
|
4
4
|
};
|
package/dist/chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DxZakgyj.js
ADDED
|
@@ -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
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as V, inject as E, ref as b, computed as d, watch as _, nextTick as m, openBlock as l, createElementBlock as i, Fragment as y, createElementVNode as e, mergeProps as k, unref as f, toDisplayString as h, createBlock as G, Teleport as D, createVNode as C, renderList as I, createCommentVNode as L } from "vue";
|
|
2
2
|
import { usePopoverController as j, useFloatingPopover as z } from "@affino/popover-vue";
|
|
3
|
-
import { _ as O } from "./DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-
|
|
3
|
+
import { _ as O } from "./DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-xry4J3Lx.js";
|
|
4
4
|
import { d as q, r as K } from "./dataGridOverlayThemeVars-vzY74EIz.js";
|
|
5
5
|
const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" }, J = /* @__PURE__ */ e("div", null, [
|
|
6
6
|
/* @__PURE__ */ e("div", { class: "datagrid-aggregations__eyebrow" }, "Aggregations"),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as Oe, inject as ke, ref as v, useAttrs as Le, computed as s, watch as V, nextTick as m, onMounted as Fe, onBeforeUnmount as Se, openBlock as b, createElementBlock as h, createElementVNode as ne, mergeProps as Ae, withModifiers as w, createBlock as Re, Teleport as Me, normalizeStyle as Be, normalizeClass as oe, Fragment as le, renderList as Ve, toDisplayString as De, createCommentVNode as U } from "vue";
|
|
2
2
|
import { d as Te, r as Pe } from "./dataGridOverlayThemeVars-vzY74EIz.js";
|
|
3
3
|
function Ne(n = {}) {
|
|
4
4
|
return {
|
|
@@ -58,8 +58,8 @@ function Je(n, o) {
|
|
|
58
58
|
return r.sort((u, c) => {
|
|
59
59
|
if (u.score !== c.score)
|
|
60
60
|
return u.score - c.score;
|
|
61
|
-
const
|
|
62
|
-
return
|
|
61
|
+
const I = u.option.label.length, d = c.option.label.length;
|
|
62
|
+
return I !== d ? I - d : u.originalIndex - c.originalIndex;
|
|
63
63
|
}), r.map((u) => u.option);
|
|
64
64
|
}
|
|
65
65
|
function Ye(n, o) {
|
|
@@ -84,7 +84,7 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
84
84
|
class: "datagrid-cell-combobox__empty"
|
|
85
85
|
}, at = {
|
|
86
86
|
inheritAttrs: !1
|
|
87
|
-
}, pt = /* @__PURE__ */
|
|
87
|
+
}, pt = /* @__PURE__ */ Oe({
|
|
88
88
|
...at,
|
|
89
89
|
__name: "DataGridFilterableCombobox",
|
|
90
90
|
props: {
|
|
@@ -101,7 +101,7 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
101
101
|
},
|
|
102
102
|
emits: ["commit", "cancel", "optionsResolved"],
|
|
103
103
|
setup(n, { emit: o }) {
|
|
104
|
-
const t = n, r = o, u = ke(Te, v(null)), c = Le(),
|
|
104
|
+
const t = n, r = o, u = ke(Te, v(null)), c = Le(), I = v(null), d = v(null), E = v(null), q = v({}), D = v({}), S = v("below"), C = v(""), T = v(!1), P = v([]), l = v(Ne({ open: !1 })), O = `datagrid-filterable-combobox-${Math.random().toString(36).slice(2, 10)}`, ue = `${O}-input`, se = `${O}-field`;
|
|
105
105
|
let A = 0;
|
|
106
106
|
const ce = s(() => {
|
|
107
107
|
const {
|
|
@@ -118,9 +118,9 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
118
118
|
onBlur: st,
|
|
119
119
|
onKeydown: ct,
|
|
120
120
|
onClick: dt,
|
|
121
|
-
...
|
|
121
|
+
...Ce
|
|
122
122
|
} = c;
|
|
123
|
-
return
|
|
123
|
+
return Ce;
|
|
124
124
|
}), de = s(() => String(c.id ?? ue)), ve = s(() => String(c.name ?? se)), fe = s(() => [
|
|
125
125
|
"cell-editor-control",
|
|
126
126
|
"datagrid-cell-combobox__input",
|
|
@@ -136,12 +136,12 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
136
136
|
q.value = Pe(u.value);
|
|
137
137
|
}
|
|
138
138
|
function G() {
|
|
139
|
-
|
|
139
|
+
C.value = N.value?.label ?? t.value;
|
|
140
140
|
}
|
|
141
141
|
function Y() {
|
|
142
|
-
|
|
142
|
+
C.value = t.initialFilter;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function k(e) {
|
|
145
145
|
const a = p.value;
|
|
146
146
|
if (a.length === 0) {
|
|
147
147
|
l.value = {
|
|
@@ -166,7 +166,7 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
166
166
|
const i = await t.loadOptions(e);
|
|
167
167
|
if (a !== A)
|
|
168
168
|
return;
|
|
169
|
-
P.value = i, r("optionsResolved", i),
|
|
169
|
+
P.value = i, r("optionsResolved", i), k(!0), m(() => {
|
|
170
170
|
g(), x();
|
|
171
171
|
});
|
|
172
172
|
} finally {
|
|
@@ -187,7 +187,7 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
187
187
|
}
|
|
188
188
|
if (typeof window > "u" || !d.value)
|
|
189
189
|
return;
|
|
190
|
-
const e = d.value.getBoundingClientRect(), a = Math.max(e.width, 160), i = Math.min(
|
|
190
|
+
const e = d.value.getBoundingClientRect(), a = Math.max(e.width, 160), i = Math.min(E.value?.offsetHeight ?? 220, 260), y = window.innerHeight - e.bottom - 8 < Math.min(180, i) && e.top > i + 12;
|
|
191
191
|
S.value = y ? "above" : "below";
|
|
192
192
|
const ee = y ? Math.max(8, e.top - i + 1) : Math.min(window.innerHeight - i - 8, e.bottom - 1), te = Math.min(
|
|
193
193
|
Math.max(8, e.left),
|
|
@@ -203,12 +203,12 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
205
|
function x() {
|
|
206
|
-
if (!
|
|
206
|
+
if (!E.value || _.value < 0)
|
|
207
207
|
return;
|
|
208
|
-
|
|
208
|
+
E.value.querySelector(`[data-option-index="${_.value}"]`)?.scrollIntoView({ block: "nearest" });
|
|
209
209
|
}
|
|
210
210
|
function W() {
|
|
211
|
-
t.disabled || (l.value = L(l.value, !0),
|
|
211
|
+
t.disabled || (l.value = L(l.value, !0), k(!0), m(() => {
|
|
212
212
|
if (g(), x(), d.value?.focus({ preventScroll: !0 }), !!d.value) {
|
|
213
213
|
if (l.value.filter.length > 0) {
|
|
214
214
|
const e = d.value.value.length;
|
|
@@ -223,14 +223,14 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
223
223
|
l.value = L(l.value, !1);
|
|
224
224
|
}
|
|
225
225
|
function _e(e) {
|
|
226
|
-
return e instanceof Node && (
|
|
226
|
+
return e instanceof Node && (I.value?.contains(e) === !0 || E.value?.contains(e) === !0);
|
|
227
227
|
}
|
|
228
228
|
function xe() {
|
|
229
229
|
if (l.value.filter.trim().length === 0)
|
|
230
230
|
return t.value;
|
|
231
231
|
if (R.value)
|
|
232
232
|
return R.value.value;
|
|
233
|
-
const e =
|
|
233
|
+
const e = C.value.trim().toLocaleLowerCase();
|
|
234
234
|
return e.length === 0 ? t.value : p.value.find((i) => i.label.trim().toLocaleLowerCase() === e || i.value.trim().toLocaleLowerCase() === e)?.value ?? t.value;
|
|
235
235
|
}
|
|
236
236
|
function Z(e = "stay") {
|
|
@@ -252,7 +252,7 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
252
252
|
if (t.disabled)
|
|
253
253
|
return;
|
|
254
254
|
const a = e.target.value;
|
|
255
|
-
|
|
255
|
+
C.value = a, l.value = X(l.value, a), l.value = L(l.value, !0), k(!1), m(() => {
|
|
256
256
|
g(), x();
|
|
257
257
|
}), t.loadOptions && H(a);
|
|
258
258
|
}
|
|
@@ -294,11 +294,11 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
294
294
|
$.value && g();
|
|
295
295
|
}
|
|
296
296
|
return V(() => t.options, () => {
|
|
297
|
-
t.loadOptions || (
|
|
297
|
+
t.loadOptions || (k(!0), m(g));
|
|
298
298
|
}, { immediate: !0 }), V(() => t.value, () => {
|
|
299
299
|
G();
|
|
300
300
|
}), V(() => t.initialFilter, (e) => {
|
|
301
|
-
document.activeElement !== d.value && (l.value = X(l.value, e), e.length > 0 ? (Y(), H(e)) : G(),
|
|
301
|
+
document.activeElement !== d.value && (l.value = X(l.value, e), e.length > 0 ? (Y(), H(e)) : G(), k(!0), m(() => {
|
|
302
302
|
g(), x();
|
|
303
303
|
}));
|
|
304
304
|
}), V(() => t.disabled, (e) => {
|
|
@@ -309,7 +309,7 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
309
309
|
typeof window < "u" && (window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0));
|
|
310
310
|
}), (e, a) => (b(), h("div", {
|
|
311
311
|
ref_key: "rootEl",
|
|
312
|
-
ref:
|
|
312
|
+
ref: I,
|
|
313
313
|
class: "datagrid-cell-combobox"
|
|
314
314
|
}, [
|
|
315
315
|
ne("input", Ae({
|
|
@@ -322,7 +322,7 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
322
322
|
style: pe.value,
|
|
323
323
|
type: "text",
|
|
324
324
|
role: "combobox",
|
|
325
|
-
value:
|
|
325
|
+
value: C.value,
|
|
326
326
|
placeholder: e.placeholder,
|
|
327
327
|
disabled: e.disabled,
|
|
328
328
|
"aria-expanded": $.value ? "true" : "false",
|
|
@@ -330,11 +330,13 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
330
330
|
"aria-autocomplete": "list",
|
|
331
331
|
"aria-activedescendant": be.value,
|
|
332
332
|
onFocus: ye,
|
|
333
|
-
onMousedown: a[0] || (a[0] =
|
|
333
|
+
onMousedown: a[0] || (a[0] = w(() => {
|
|
334
334
|
}, ["stop"])),
|
|
335
|
-
|
|
335
|
+
onContextmenu: a[1] || (a[1] = w(() => {
|
|
336
|
+
}, ["stop"])),
|
|
337
|
+
onClick: w(ge, ["stop"]),
|
|
336
338
|
onInput: we,
|
|
337
|
-
onKeydown:
|
|
339
|
+
onKeydown: w(Ee, ["stop"]),
|
|
338
340
|
onBlur: Ie
|
|
339
341
|
}), null, 16, Ze),
|
|
340
342
|
(b(), Re(Me, {
|
|
@@ -345,7 +347,7 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
345
347
|
key: 0,
|
|
346
348
|
id: O,
|
|
347
349
|
ref_key: "panelEl",
|
|
348
|
-
ref:
|
|
350
|
+
ref: E,
|
|
349
351
|
class: oe(["datagrid-cell-combobox__panel", {
|
|
350
352
|
"datagrid-cell-combobox__panel--inline": e.inlinePanel,
|
|
351
353
|
"datagrid-cell-combobox__panel--attached-below": S.value === "below",
|
|
@@ -354,7 +356,7 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
354
356
|
"data-affino-popover-sticky": e.stickyPopoverId || void 0,
|
|
355
357
|
style: Be([q.value, D.value]),
|
|
356
358
|
role: "listbox",
|
|
357
|
-
onMousedown: a[
|
|
359
|
+
onMousedown: a[2] || (a[2] = w(() => {
|
|
358
360
|
}, ["prevent"]))
|
|
359
361
|
}, [
|
|
360
362
|
T.value ? (b(), h("div", et, "Loading options...")) : (b(), h(le, { key: 1 }, [
|
|
@@ -370,7 +372,7 @@ const Ze = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "
|
|
|
370
372
|
"aria-selected": i.value === e.value ? "true" : "false",
|
|
371
373
|
"data-option-index": f,
|
|
372
374
|
onMousemove: (y) => K(f),
|
|
373
|
-
onClick:
|
|
375
|
+
onClick: w((y) => Q(i.value), ["stop"])
|
|
374
376
|
}, [
|
|
375
377
|
ne("span", nt, De(i.label), 1),
|
|
376
378
|
i.value === e.value ? (b(), h("span", ot)) : U("", !0)
|