@affino/datagrid-vue-app 0.1.24 → 0.1.26
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 +118 -1
- package/dist/DataGrid.d.ts +22 -0
- package/dist/advanced-filter.js +1 -1
- package/dist/chunks/{DataGridAdvancedFilterPopover-CRd9hbEZ.js → DataGridAdvancedFilterPopover-C3NQXP09.js} +1 -1
- package/dist/chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-D8T70_4c.js +261 -0
- package/dist/chunks/{DataGridAggregationsPopover-Bu7nZX7u.js → DataGridAggregationsPopover-BBREw3IM.js} +29 -28
- package/dist/chunks/{DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-BPU8WkWd.js → DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-_qhryKE2.js} +132 -128
- package/dist/chunks/{DataGridFindReplacePopover-DCuFy-bD.js → DataGridFindReplacePopover-Dou8Fsm3.js} +1 -1
- package/dist/chunks/DataGridFindReplacePopover.vue_vue_type_script_setup_true_lang-BEVRKG31.js +186 -0
- package/dist/chunks/DataGridGanttStageEntry-BPW1JMgB.js +9080 -0
- package/dist/chunks/useDataGridAppRowModel-kmgM9pk5.js +4100 -0
- package/dist/chunks/useDataGridDraggableOverlaySurface-BgkSR_nl.js +91 -0
- package/dist/config/dataGridChrome.d.ts +16 -0
- package/dist/config/dataGridRowReorder.d.ts +7 -0
- package/dist/find-replace.js +1 -1
- package/dist/gantt.js +1 -1
- package/dist/host/DataGridDefaultRenderer.d.ts +27 -0
- package/dist/host/DataGridModuleHost.d.ts +9 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +583 -536
- package/dist/internal.d.ts +4 -0
- package/dist/internal.js +36 -34
- package/dist/overlays/DataGridColumnLayoutPopover.vue.d.ts +10 -0
- package/dist/overlays/DataGridColumnMenu.vue.d.ts +2 -2
- package/dist/overlays/DataGridColumnMenuCustomEntry.vue.d.ts +39 -0
- package/dist/overlays/dataGridColumnMenu.d.ts +10 -1
- package/dist/overlays/useDataGridDraggableOverlaySurface.d.ts +13 -0
- package/dist/stage/dataGridTableStage.types.d.ts +5 -0
- package/dist/stage/dataGridTableStageBody.types.d.ts +6 -0
- package/dist/stage/useDataGridTableStageRuntime.d.ts +5 -0
- package/package.json +3 -3
- package/dist/chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DhdOikY0.js +0 -248
- package/dist/chunks/DataGridFindReplacePopover.vue_vue_type_script_setup_true_lang-DfHFHhUf.js +0 -171
- package/dist/chunks/DataGridGanttStageEntry-C0jpOd17.js +0 -8758
- package/dist/chunks/useDataGridAppRowModel-BuddaLvA.js +0 -3864
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ Boundary doc:
|
|
|
16
16
|
Public export:
|
|
17
17
|
|
|
18
18
|
- `DataGrid`
|
|
19
|
+
- `DataGridModuleHost`
|
|
19
20
|
|
|
20
21
|
The package ships its own runtime table-stage styles, so the default renderer does not depend on sandbox CSS.
|
|
21
22
|
|
|
@@ -187,6 +188,65 @@ Normalization rules:
|
|
|
187
188
|
- if both limits are present and `maxRows < minRows`, `maxRows` is clamped up to `minRows`
|
|
188
189
|
- prefer `fill` for full-screen shells such as split gantt layouts and `auto-height` for embedded cards, stacked dashboard sections, and form flows
|
|
189
190
|
|
|
191
|
+
## Chrome Layout
|
|
192
|
+
|
|
193
|
+
`DataGrid` now exposes package-level chrome controls so apps do not need CSS overrides just to remove the default toolbar-to-stage gap or collapse spreadsheet shells into a single surface.
|
|
194
|
+
|
|
195
|
+
- `chrome.toolbarPlacement`: `"stacked"`, `"integrated"`, or `"hidden"`
|
|
196
|
+
- `chrome.density`: `"comfortable"` or `"compact"`
|
|
197
|
+
- `chrome.toolbarGap`: controls `--datagrid-app-layout-gap`
|
|
198
|
+
- `chrome.workspaceGap`: controls `--datagrid-app-workspace-gap`
|
|
199
|
+
|
|
200
|
+
```vue
|
|
201
|
+
<DataGrid
|
|
202
|
+
:rows="rows"
|
|
203
|
+
:columns="columns"
|
|
204
|
+
:chrome="{
|
|
205
|
+
toolbarPlacement: 'integrated',
|
|
206
|
+
density: 'compact',
|
|
207
|
+
toolbarGap: 0,
|
|
208
|
+
workspaceGap: 8,
|
|
209
|
+
}"
|
|
210
|
+
:history="{ controls: true }"
|
|
211
|
+
/>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Notes:
|
|
215
|
+
|
|
216
|
+
- `stacked` keeps the previous app-shell structure and remains the default
|
|
217
|
+
- `integrated` renders the toolbar inside the same surface as the table with a divider instead of a vertical gap
|
|
218
|
+
- `hidden` disables the internal toolbar renderer so the host can place modules in its own header
|
|
219
|
+
- gantt currently falls back to `stacked` when `integrated` is requested
|
|
220
|
+
|
|
221
|
+
When you hide the internal toolbar, the component emits the resolved built-in plus custom toolbar modules through `@toolbar-modules-change`, and the package exports `DataGridModuleHost` so the host can render the exact same modules externally.
|
|
222
|
+
|
|
223
|
+
```vue
|
|
224
|
+
<script setup lang="ts">
|
|
225
|
+
import { ref } from "vue"
|
|
226
|
+
import {
|
|
227
|
+
DataGrid,
|
|
228
|
+
DataGridModuleHost,
|
|
229
|
+
type DataGridAppToolbarModule,
|
|
230
|
+
} from "@affino/datagrid-vue-app"
|
|
231
|
+
|
|
232
|
+
const toolbarModules = ref<readonly DataGridAppToolbarModule[]>([])
|
|
233
|
+
</script>
|
|
234
|
+
|
|
235
|
+
<template>
|
|
236
|
+
<header class="sheet-header">
|
|
237
|
+
<DataGridModuleHost :modules="toolbarModules" />
|
|
238
|
+
</header>
|
|
239
|
+
|
|
240
|
+
<DataGrid
|
|
241
|
+
:rows="rows"
|
|
242
|
+
:columns="columns"
|
|
243
|
+
:history="{ controls: true }"
|
|
244
|
+
:chrome="{ toolbarPlacement: 'hidden' }"
|
|
245
|
+
@toolbar-modules-change="toolbarModules = $event"
|
|
246
|
+
/>
|
|
247
|
+
</template>
|
|
248
|
+
```
|
|
249
|
+
|
|
190
250
|
## Placeholder Rows
|
|
191
251
|
|
|
192
252
|
`DataGrid` can render an Excel-like visual tail without forcing your app to persist empty records up front.
|
|
@@ -525,6 +585,36 @@ const columnMenu: DataGridColumnMenuProp = {
|
|
|
525
585
|
console.log("Insert before", columnKey)
|
|
526
586
|
},
|
|
527
587
|
},
|
|
588
|
+
{
|
|
589
|
+
key: "organize",
|
|
590
|
+
kind: "submenu",
|
|
591
|
+
label: "Organize",
|
|
592
|
+
placement: "end",
|
|
593
|
+
items: [
|
|
594
|
+
{
|
|
595
|
+
key: "duplicate",
|
|
596
|
+
label: "Duplicate column",
|
|
597
|
+
onSelect: ({ columnKey }) => {
|
|
598
|
+
console.log("Duplicate", columnKey)
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
key: "advanced",
|
|
603
|
+
kind: "submenu",
|
|
604
|
+
label: "Advanced",
|
|
605
|
+
items: [
|
|
606
|
+
{
|
|
607
|
+
key: "freeze-snapshot",
|
|
608
|
+
label: "Freeze current layout",
|
|
609
|
+
onSelect: ({ columnKey, closeMenu }) => {
|
|
610
|
+
console.log("Freeze", columnKey)
|
|
611
|
+
closeMenu()
|
|
612
|
+
},
|
|
613
|
+
},
|
|
614
|
+
],
|
|
615
|
+
},
|
|
616
|
+
],
|
|
617
|
+
},
|
|
528
618
|
],
|
|
529
619
|
columns: {
|
|
530
620
|
amount: {
|
|
@@ -582,10 +672,12 @@ Supported app-level menu controls:
|
|
|
582
672
|
Custom menu items support:
|
|
583
673
|
|
|
584
674
|
- `key`: stable item id
|
|
675
|
+
- `kind`: `item` (default) or `submenu`
|
|
585
676
|
- `label`: rendered menu text
|
|
586
677
|
- `placement`: `start`, `end`, `before:sort`, `after:sort`, `before:group`, `after:group`, `before:pin`, `after:pin`, `before:filter`, `after:filter`
|
|
587
678
|
- `hidden`, `disabled`, `disabledReason`
|
|
588
|
-
- `onSelect(context)`: callback with `{ columnKey, columnLabel, closeMenu }`
|
|
679
|
+
- `onSelect(context)`: callback with `{ columnKey, columnLabel, closeMenu }` for leaf items
|
|
680
|
+
- `items`: nested submenu entries when `kind: "submenu"`
|
|
589
681
|
|
|
590
682
|
Grouping triggered from the built-in column menu updates the public controlled
|
|
591
683
|
surface through `@update:groupBy` / `v-model:groupBy`.
|
|
@@ -1472,6 +1564,31 @@ The component emits:
|
|
|
1472
1564
|
- When at least one filter is active, the `Advanced filter` toolbar button shows an active filter icon and active button styling.
|
|
1473
1565
|
- 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.
|
|
1474
1566
|
|
|
1567
|
+
## Built-in Overlay Panels
|
|
1568
|
+
|
|
1569
|
+
- 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.
|
|
1570
|
+
- 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.
|
|
1571
|
+
|
|
1572
|
+
## Row Reorder
|
|
1573
|
+
|
|
1574
|
+
Row drag-and-drop is declarative and opt-in.
|
|
1575
|
+
|
|
1576
|
+
- `rowReorder: true` enables drag reorder from the row index column
|
|
1577
|
+
- `rowReorder: false` keeps the row index non-draggable
|
|
1578
|
+
- the feature only applies when the grid is using a mutable rows API and `showRowIndex` is enabled
|
|
1579
|
+
- placeholder rows, group rows, and pinned rows are not draggable
|
|
1580
|
+
|
|
1581
|
+
```vue
|
|
1582
|
+
<DataGrid
|
|
1583
|
+
:rows="rows"
|
|
1584
|
+
:columns="columns"
|
|
1585
|
+
:show-row-index="true"
|
|
1586
|
+
:row-reorder="true"
|
|
1587
|
+
/>
|
|
1588
|
+
```
|
|
1589
|
+
|
|
1590
|
+
If you need to ship the UI but keep row order locked, leave `rowReorder` unset or pass `false`.
|
|
1591
|
+
|
|
1475
1592
|
## Ref API
|
|
1476
1593
|
|
|
1477
1594
|
### Runtime access
|
package/dist/DataGrid.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type PropType, type VNode } from "vue";
|
|
|
2
2
|
import { type CreateDataGridCoreOptions, type DataGridApi, type DataGridApiRowSelectionChangedEvent, type DataGridApiSelectionChangedEvent, type DataGridApiPluginDefinition, type DataGridAggregationModel, type DataGridColumnPin, type DataGridComputedFieldDefinition, type DataGridCoreServiceRegistry, type DataGridFilterSnapshot, type DataGridFormulaFieldDefinition, type DataGridFormulaFunctionRegistry, type DataGridGroupBySpec, type DataGridRowSelectionSnapshot, type DataGridRowModel, type DataGridSetStateOptions, type DataGridSortState, type DataGridUnifiedColumnState, type DataGridUnifiedState, type DataGridPivotSpec } from "@affino/datagrid-vue";
|
|
3
3
|
import type { DataGridAppToolbarModule } from "./host/DataGridModuleHost";
|
|
4
4
|
import { type DataGridAppClientRowModelOptions, type DataGridAppColumnInput } from "./config/dataGridFormulaOptions";
|
|
5
|
+
import { type DataGridChromeProp } from "./config/dataGridChrome";
|
|
5
6
|
import { type DataGridThemeProp } from "./theme/dataGridTheme";
|
|
6
7
|
import { type DataGridGroupByProp, type DataGridPaginationProp } from "./config/dataGridPublicProps";
|
|
7
8
|
import { type DataGridAdvancedFilterProp } from "./config/dataGridAdvancedFilter";
|
|
@@ -10,6 +11,7 @@ import { type DataGridGridLinesProp } from "./config/dataGridGridLines";
|
|
|
10
11
|
import { type DataGridLayoutMode } from "./config/dataGridLayout";
|
|
11
12
|
import { type DataGridPlaceholderRowsProp } from "./config/dataGridPlaceholderRows";
|
|
12
13
|
import { type DataGridColumnLayoutProp } from "./config/dataGridColumnLayout";
|
|
14
|
+
import { type DataGridRowReorderProp } from "./config/dataGridRowReorder";
|
|
13
15
|
import { type DataGridAggregationsProp } from "./config/dataGridAggregations";
|
|
14
16
|
import { type DataGridColumnMenuProp } from "./overlays/dataGridColumnMenu";
|
|
15
17
|
import { type DataGridCellMenuProp, type DataGridRowIndexMenuProp } from "./overlays/dataGridContextMenu";
|
|
@@ -109,6 +111,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
109
111
|
type: BooleanConstructor;
|
|
110
112
|
default: boolean;
|
|
111
113
|
};
|
|
114
|
+
rowReorder: {
|
|
115
|
+
type: PropType<DataGridRowReorderProp | undefined>;
|
|
116
|
+
default: undefined;
|
|
117
|
+
};
|
|
112
118
|
rowSelectionState: {
|
|
113
119
|
type: PropType<DataGridRowSelectionSnapshot | null | undefined>;
|
|
114
120
|
default: undefined;
|
|
@@ -237,6 +243,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
237
243
|
type: PropType<DataGridHistoryProp | undefined>;
|
|
238
244
|
default: undefined;
|
|
239
245
|
};
|
|
246
|
+
chrome: {
|
|
247
|
+
type: PropType<DataGridChromeProp | undefined>;
|
|
248
|
+
default: undefined;
|
|
249
|
+
};
|
|
240
250
|
toolbarModules: {
|
|
241
251
|
type: PropType<readonly DataGridAppToolbarModule[]>;
|
|
242
252
|
default: () => never[];
|
|
@@ -255,6 +265,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
255
265
|
"update:groupBy": (_payload: DataGridGroupBySpec | null) => true;
|
|
256
266
|
"update:viewMode": (_payload: DataGridAppViewMode) => true;
|
|
257
267
|
"update:state": (_payload: DataGridUnifiedState<Record<string, unknown>> | null) => true;
|
|
268
|
+
"toolbar-modules-change": (_payload: readonly DataGridAppToolbarModule[]) => true;
|
|
258
269
|
ready: (_payload: {
|
|
259
270
|
api: DataGridApi<Record<string, unknown>>;
|
|
260
271
|
rowModel: DataGridRowModel<Record<string, unknown>> | null;
|
|
@@ -348,6 +359,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
348
359
|
type: BooleanConstructor;
|
|
349
360
|
default: boolean;
|
|
350
361
|
};
|
|
362
|
+
rowReorder: {
|
|
363
|
+
type: PropType<DataGridRowReorderProp | undefined>;
|
|
364
|
+
default: undefined;
|
|
365
|
+
};
|
|
351
366
|
rowSelectionState: {
|
|
352
367
|
type: PropType<DataGridRowSelectionSnapshot | null | undefined>;
|
|
353
368
|
default: undefined;
|
|
@@ -476,6 +491,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
476
491
|
type: PropType<DataGridHistoryProp | undefined>;
|
|
477
492
|
default: undefined;
|
|
478
493
|
};
|
|
494
|
+
chrome: {
|
|
495
|
+
type: PropType<DataGridChromeProp | undefined>;
|
|
496
|
+
default: undefined;
|
|
497
|
+
};
|
|
479
498
|
toolbarModules: {
|
|
480
499
|
type: PropType<readonly DataGridAppToolbarModule[]>;
|
|
481
500
|
default: () => never[];
|
|
@@ -494,6 +513,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
494
513
|
"onUpdate:groupBy"?: ((_payload: DataGridGroupBySpec | null) => any) | undefined;
|
|
495
514
|
"onUpdate:viewMode"?: ((_payload: DataGridAppViewMode) => any) | undefined;
|
|
496
515
|
"onUpdate:state"?: ((_payload: DataGridUnifiedState<Record<string, unknown>> | null) => any) | undefined;
|
|
516
|
+
"onToolbar-modules-change"?: ((_payload: readonly DataGridAppToolbarModule[]) => any) | undefined;
|
|
497
517
|
onReady?: ((_payload: {
|
|
498
518
|
api: DataGridApi<Record<string, unknown>>;
|
|
499
519
|
rowModel: DataGridRowModel<Record<string, unknown>> | null;
|
|
@@ -510,6 +530,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
510
530
|
isCellEditable: DataGridCellEditablePredicate<Record<string, unknown>> | undefined;
|
|
511
531
|
rowSelection: boolean;
|
|
512
532
|
state: DataGridUnifiedState<Record<string, unknown>> | null | undefined;
|
|
533
|
+
chrome: DataGridChromeProp | undefined;
|
|
513
534
|
gantt: DataGridGanttProp | undefined;
|
|
514
535
|
rowModel: DataGridRowModel<unknown> | undefined;
|
|
515
536
|
baseRowHeight: number;
|
|
@@ -533,6 +554,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
533
554
|
placeholderRows: DataGridPlaceholderRowsProp<Record<string, unknown>> | undefined;
|
|
534
555
|
fillHandle: boolean;
|
|
535
556
|
rangeMove: boolean;
|
|
557
|
+
rowReorder: DataGridRowReorderProp | undefined;
|
|
536
558
|
viewMode: DataGridAppViewMode | undefined;
|
|
537
559
|
toolbarModules: readonly DataGridAppToolbarModule[];
|
|
538
560
|
history: DataGridHistoryProp | undefined;
|
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-D8T70_4c.js";
|
|
2
2
|
export {
|
|
3
3
|
e as DataGridAdvancedFilterPopover
|
|
4
4
|
};
|
package/dist/chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-D8T70_4c.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { defineComponent as j, inject as q, ref as w, computed as v, watch as y, nextTick as P, openBlock as o, createElementBlock as n, Fragment as h, createElementVNode as e, mergeProps as I, unref as s, createCommentVNode as A, createTextVNode as G, toDisplayString as C, createBlock as L, Teleport as z, renderList as T, createVNode as O } from "vue";
|
|
2
|
+
import { usePopoverController as J, useFloatingPopover as K } from "@affino/popover-vue";
|
|
3
|
+
import { _ as k } from "./DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-_qhryKE2.js";
|
|
4
|
+
import { d as M, r as Z } from "./dataGridOverlayThemeVars-vzY74EIz.js";
|
|
5
|
+
import { u as H } from "./useDataGridDraggableOverlaySurface-BgkSR_nl.js";
|
|
6
|
+
const Q = ["data-datagrid-advanced-filter-active"], U = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "datagrid-app-toolbar__button-icon datagrid-app-toolbar__button-icon--advanced-filter",
|
|
9
|
+
"data-datagrid-advanced-filter-icon": "true",
|
|
10
|
+
"aria-hidden": "true"
|
|
11
|
+
}, W = /* @__PURE__ */ e("svg", {
|
|
12
|
+
viewBox: "0 0 16 16",
|
|
13
|
+
focusable: "false"
|
|
14
|
+
}, [
|
|
15
|
+
/* @__PURE__ */ e("path", {
|
|
16
|
+
d: "M2 3.5h12l-4.6 5.2v3.2l-2.8 1.6V8.7L2 3.5Z",
|
|
17
|
+
fill: "currentColor"
|
|
18
|
+
})
|
|
19
|
+
], -1), X = [
|
|
20
|
+
W
|
|
21
|
+
], Y = ["data-datagrid-overlay-dragging"], x = { class: "datagrid-advanced-filter__header" }, ee = /* @__PURE__ */ e("div", { class: "datagrid-advanced-filter__eyebrow" }, "Advanced filter", -1), ae = /* @__PURE__ */ e("h3", { class: "datagrid-advanced-filter__title" }, "Build clause-based filter", -1), te = [
|
|
22
|
+
ee,
|
|
23
|
+
ae
|
|
24
|
+
], le = { class: "datagrid-advanced-filter__applied" }, de = { class: "datagrid-advanced-filter__applied-head" }, oe = /* @__PURE__ */ e("div", null, [
|
|
25
|
+
/* @__PURE__ */ e("div", { class: "datagrid-advanced-filter__eyebrow" }, "Applied on table"),
|
|
26
|
+
/* @__PURE__ */ e("div", { class: "datagrid-advanced-filter__applied-title" }, "Current filters")
|
|
27
|
+
], -1), ie = ["disabled"], ne = {
|
|
28
|
+
key: 0,
|
|
29
|
+
class: "datagrid-advanced-filter__applied-list"
|
|
30
|
+
}, re = {
|
|
31
|
+
key: 1,
|
|
32
|
+
class: "datagrid-advanced-filter__applied-empty"
|
|
33
|
+
}, se = { class: "datagrid-advanced-filter__rows" }, ce = { class: "datagrid-advanced-filter__field datagrid-advanced-filter__field--join" }, ue = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Join", -1), ve = { class: "datagrid-advanced-filter__field" }, pe = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Column", -1), fe = { class: "datagrid-advanced-filter__field" }, _e = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Operator", -1), ge = { class: "datagrid-advanced-filter__field datagrid-advanced-filter__field--value" }, me = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Value", -1), be = ["name", "value", "onInput"], ye = { class: "datagrid-advanced-filter__row-actions" }, he = ["onClick"], Ce = { class: "datagrid-advanced-filter__footer" }, Oe = { class: "datagrid-advanced-filter__footer-actions" }, Te = /* @__PURE__ */ j({
|
|
34
|
+
__name: "DataGridAdvancedFilterPopover",
|
|
35
|
+
props: {
|
|
36
|
+
isOpen: { type: Boolean },
|
|
37
|
+
clauses: {},
|
|
38
|
+
columns: {},
|
|
39
|
+
appliedFilterSummaryItems: { default: () => [] },
|
|
40
|
+
hasAnyFilters: { type: Boolean, default: !1 },
|
|
41
|
+
buttonLabel: { default: "Advanced filter" },
|
|
42
|
+
active: { type: Boolean, default: !1 },
|
|
43
|
+
showActiveIcon: { type: Boolean, default: !1 }
|
|
44
|
+
},
|
|
45
|
+
emits: ["open", "add", "remove", "apply", "cancel", "reset-all", "update-clause"],
|
|
46
|
+
setup(S, { emit: F }) {
|
|
47
|
+
const N = Object.freeze([
|
|
48
|
+
{ value: "and", label: "AND" },
|
|
49
|
+
{ value: "or", label: "OR" }
|
|
50
|
+
]), R = Object.freeze([
|
|
51
|
+
{ value: "contains", label: "Contains" },
|
|
52
|
+
{ value: "in", label: "In" },
|
|
53
|
+
{ value: "equals", label: "Equals" },
|
|
54
|
+
{ value: "not-equals", label: "Not equals" },
|
|
55
|
+
{ value: "starts-with", label: "Starts with" },
|
|
56
|
+
{ value: "ends-with", label: "Ends with" },
|
|
57
|
+
{ value: "gt", label: ">" },
|
|
58
|
+
{ value: "gte", label: ">=" },
|
|
59
|
+
{ value: "lt", label: "<" },
|
|
60
|
+
{ value: "lte", label: "<=" }
|
|
61
|
+
]), u = S, i = F, g = q(M, w(null)), m = w({}), d = J(
|
|
62
|
+
{
|
|
63
|
+
id: "advanced-filter",
|
|
64
|
+
role: "dialog",
|
|
65
|
+
closeOnEscape: !0,
|
|
66
|
+
closeOnInteractOutside: !0
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
onOpen: () => {
|
|
70
|
+
u.isOpen || i("open"), b();
|
|
71
|
+
},
|
|
72
|
+
onClose: () => {
|
|
73
|
+
u.isOpen && i("cancel");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
), c = K(d, {
|
|
77
|
+
placement: "bottom",
|
|
78
|
+
align: "start",
|
|
79
|
+
gutter: 10,
|
|
80
|
+
viewportPadding: 12,
|
|
81
|
+
zIndex: 180,
|
|
82
|
+
lockScroll: !1,
|
|
83
|
+
returnFocus: !0
|
|
84
|
+
}), p = H({
|
|
85
|
+
surfaceId: "advanced-filter",
|
|
86
|
+
rootElementRef: g,
|
|
87
|
+
floating: c
|
|
88
|
+
}), V = v(() => d.getTriggerProps({ role: "dialog" })), B = v(() => d.getContentProps({ role: "dialog", tabIndex: -1 })), $ = v(() => d.state.value.open), D = v(() => c.teleportTarget.value), E = v(() => u.columns.map((t) => ({
|
|
89
|
+
value: t.key,
|
|
90
|
+
label: t.label
|
|
91
|
+
})));
|
|
92
|
+
y(
|
|
93
|
+
() => u.isOpen,
|
|
94
|
+
async (t) => {
|
|
95
|
+
if (t) {
|
|
96
|
+
b(), d.state.value.open || d.open("programmatic"), await P(), c.contentRef.value?.querySelector('[data-advanced-filter-autofocus="true"]')?.focus({ preventScroll: !0 }), await c.updatePosition();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
d.state.value.open && d.close("programmatic");
|
|
100
|
+
},
|
|
101
|
+
{ immediate: !0 }
|
|
102
|
+
), y(g, () => {
|
|
103
|
+
d.state.value.open && b();
|
|
104
|
+
}), y(
|
|
105
|
+
() => u.clauses.length,
|
|
106
|
+
async () => {
|
|
107
|
+
d.state.value.open && (await P(), await c.updatePosition());
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
function b() {
|
|
111
|
+
m.value = Z(g.value);
|
|
112
|
+
}
|
|
113
|
+
function f(t, l, a) {
|
|
114
|
+
i("update-clause", { clauseId: t, field: l, value: a });
|
|
115
|
+
}
|
|
116
|
+
return (t, l) => (o(), n(h, null, [
|
|
117
|
+
e("button", I({
|
|
118
|
+
ref: s(c).triggerRef,
|
|
119
|
+
type: "button",
|
|
120
|
+
class: ["datagrid-app-toolbar__button", { "datagrid-app-toolbar__button--active": t.active }],
|
|
121
|
+
"data-datagrid-toolbar-action": "advanced-filter",
|
|
122
|
+
"data-datagrid-advanced-filter-active": t.showActiveIcon ? "true" : "false",
|
|
123
|
+
style: m.value
|
|
124
|
+
}, V.value), [
|
|
125
|
+
t.showActiveIcon ? (o(), n("span", U, X)) : A("", !0),
|
|
126
|
+
G(" " + C(t.buttonLabel), 1)
|
|
127
|
+
], 16, Q),
|
|
128
|
+
(o(), L(z, { to: D.value }, [
|
|
129
|
+
$.value ? (o(), n("section", I({
|
|
130
|
+
key: 0,
|
|
131
|
+
ref: s(c).contentRef,
|
|
132
|
+
class: "datagrid-advanced-filter",
|
|
133
|
+
"data-datagrid-overlay-surface": "true",
|
|
134
|
+
"data-datagrid-overlay-surface-id": "advanced-filter",
|
|
135
|
+
"data-datagrid-overlay-dragging": s(p).dragging.value ? "true" : "false",
|
|
136
|
+
style: [s(p).surfaceStyle.value, m.value]
|
|
137
|
+
}, B.value), [
|
|
138
|
+
e("header", x, [
|
|
139
|
+
e("div", {
|
|
140
|
+
class: "datagrid-overlay-drag-handle",
|
|
141
|
+
"data-datagrid-overlay-drag-handle": "true",
|
|
142
|
+
onPointerdown: l[0] || (l[0] = //@ts-ignore
|
|
143
|
+
(...a) => s(p).handlePointerDown && s(p).handlePointerDown(...a))
|
|
144
|
+
}, te, 32),
|
|
145
|
+
e("button", {
|
|
146
|
+
type: "button",
|
|
147
|
+
class: "datagrid-advanced-filter__ghost",
|
|
148
|
+
onClick: l[1] || (l[1] = (a) => i("cancel"))
|
|
149
|
+
}, " Close ")
|
|
150
|
+
]),
|
|
151
|
+
e("section", le, [
|
|
152
|
+
e("div", de, [
|
|
153
|
+
oe,
|
|
154
|
+
e("button", {
|
|
155
|
+
type: "button",
|
|
156
|
+
class: "datagrid-advanced-filter__ghost",
|
|
157
|
+
disabled: !t.hasAnyFilters,
|
|
158
|
+
"data-datagrid-advanced-filter-action": "reset-all",
|
|
159
|
+
onClick: l[2] || (l[2] = (a) => i("reset-all"))
|
|
160
|
+
}, " Reset all filters ", 8, ie)
|
|
161
|
+
]),
|
|
162
|
+
t.appliedFilterSummaryItems.length > 0 ? (o(), n("div", ne, [
|
|
163
|
+
(o(!0), n(h, null, T(t.appliedFilterSummaryItems, (a, _) => (o(), n("span", {
|
|
164
|
+
key: `applied-filter-${_}`,
|
|
165
|
+
class: "datagrid-advanced-filter__applied-chip"
|
|
166
|
+
}, C(a), 1))), 128))
|
|
167
|
+
])) : (o(), n("div", re, " No filters applied "))
|
|
168
|
+
]),
|
|
169
|
+
e("div", se, [
|
|
170
|
+
(o(!0), n(h, null, T(t.clauses, (a, _) => (o(), n("div", {
|
|
171
|
+
key: a.id,
|
|
172
|
+
class: "datagrid-advanced-filter__row"
|
|
173
|
+
}, [
|
|
174
|
+
e("label", ce, [
|
|
175
|
+
ue,
|
|
176
|
+
O(k, {
|
|
177
|
+
class: "datagrid-advanced-filter__select",
|
|
178
|
+
value: a.join,
|
|
179
|
+
options: s(N),
|
|
180
|
+
"open-on-mount": !1,
|
|
181
|
+
"open-on-focus": !1,
|
|
182
|
+
"sticky-popover-id": "advanced-filter",
|
|
183
|
+
disabled: _ === 0,
|
|
184
|
+
"aria-label": "Join operator",
|
|
185
|
+
onCommit: (r) => f(a.id, "join", r)
|
|
186
|
+
}, null, 8, ["value", "options", "disabled", "onCommit"])
|
|
187
|
+
]),
|
|
188
|
+
e("label", ve, [
|
|
189
|
+
pe,
|
|
190
|
+
O(k, {
|
|
191
|
+
class: "datagrid-advanced-filter__select",
|
|
192
|
+
value: a.columnKey,
|
|
193
|
+
options: E.value,
|
|
194
|
+
"open-on-mount": !1,
|
|
195
|
+
"open-on-focus": !1,
|
|
196
|
+
"sticky-popover-id": "advanced-filter",
|
|
197
|
+
"data-advanced-filter-autofocus": _ === 0 ? "true" : null,
|
|
198
|
+
"aria-label": "Column",
|
|
199
|
+
onCommit: (r) => f(a.id, "columnKey", r)
|
|
200
|
+
}, null, 8, ["value", "options", "data-advanced-filter-autofocus", "onCommit"])
|
|
201
|
+
]),
|
|
202
|
+
e("label", fe, [
|
|
203
|
+
_e,
|
|
204
|
+
O(k, {
|
|
205
|
+
class: "datagrid-advanced-filter__select",
|
|
206
|
+
value: a.operator,
|
|
207
|
+
options: s(R),
|
|
208
|
+
"open-on-mount": !1,
|
|
209
|
+
"open-on-focus": !1,
|
|
210
|
+
"sticky-popover-id": "advanced-filter",
|
|
211
|
+
"aria-label": "Condition operator",
|
|
212
|
+
onCommit: (r) => f(a.id, "operator", r)
|
|
213
|
+
}, null, 8, ["value", "options", "onCommit"])
|
|
214
|
+
]),
|
|
215
|
+
e("label", ge, [
|
|
216
|
+
me,
|
|
217
|
+
e("input", {
|
|
218
|
+
name: `datagrid-advanced-filter-value-${a.id}`,
|
|
219
|
+
value: a.value,
|
|
220
|
+
type: "text",
|
|
221
|
+
placeholder: "Value",
|
|
222
|
+
"aria-label": "Condition value",
|
|
223
|
+
onInput: (r) => f(a.id, "value", r.target.value)
|
|
224
|
+
}, null, 40, be)
|
|
225
|
+
]),
|
|
226
|
+
e("div", ye, [
|
|
227
|
+
e("button", {
|
|
228
|
+
type: "button",
|
|
229
|
+
class: "datagrid-advanced-filter__ghost datagrid-advanced-filter__ghost--danger",
|
|
230
|
+
onClick: (r) => i("remove", a.id)
|
|
231
|
+
}, C(t.clauses.length <= 1 ? "Clear" : "Remove"), 9, he)
|
|
232
|
+
])
|
|
233
|
+
]))), 128))
|
|
234
|
+
]),
|
|
235
|
+
e("footer", Ce, [
|
|
236
|
+
e("button", {
|
|
237
|
+
type: "button",
|
|
238
|
+
class: "datagrid-advanced-filter__secondary",
|
|
239
|
+
onClick: l[3] || (l[3] = (a) => i("add"))
|
|
240
|
+
}, " Add clause "),
|
|
241
|
+
e("div", Oe, [
|
|
242
|
+
e("button", {
|
|
243
|
+
type: "button",
|
|
244
|
+
class: "datagrid-advanced-filter__secondary",
|
|
245
|
+
onClick: l[4] || (l[4] = (a) => i("cancel"))
|
|
246
|
+
}, " Cancel "),
|
|
247
|
+
e("button", {
|
|
248
|
+
type: "button",
|
|
249
|
+
class: "datagrid-advanced-filter__primary",
|
|
250
|
+
onClick: l[5] || (l[5] = (a) => i("apply"))
|
|
251
|
+
}, " Apply ")
|
|
252
|
+
])
|
|
253
|
+
])
|
|
254
|
+
], 16, Y)) : A("", !0)
|
|
255
|
+
], 8, ["to"]))
|
|
256
|
+
], 64));
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
export {
|
|
260
|
+
Te as _
|
|
261
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
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-_qhryKE2.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"),
|
|
@@ -8,7 +8,7 @@ const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" },
|
|
|
8
8
|
], -1), M = { class: "datagrid-aggregations__basis" }, Q = /* @__PURE__ */ e("span", { class: "datagrid-aggregations__label" }, "Basis", -1), W = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "datagrid-aggregations__list"
|
|
11
|
-
}, X = { class: "datagrid-aggregations__toggle" }, Y = ["checked", "onChange"], Z = { class: "datagrid-aggregations__row-label" }, x = {
|
|
11
|
+
}, X = { class: "datagrid-aggregations__toggle" }, Y = ["name", "checked", "onChange"], Z = { class: "datagrid-aggregations__row-label" }, x = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "datagrid-aggregations__empty"
|
|
14
14
|
}, ee = { class: "datagrid-aggregations__footer" }, te = { class: "datagrid-aggregations__footer-actions" }, re = /* @__PURE__ */ V({
|
|
@@ -50,7 +50,7 @@ const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" },
|
|
|
50
50
|
zIndex: 180,
|
|
51
51
|
lockScroll: !1,
|
|
52
52
|
returnFocus: !0
|
|
53
|
-
}), A = d(() => s.getTriggerProps({ role: "dialog" })),
|
|
53
|
+
}), A = d(() => s.getTriggerProps({ role: "dialog" })), $ = d(() => s.getContentProps({ role: "dialog", tabIndex: -1 })), B = d(() => s.state.value.open), R = d(() => r.contentStyle.value), S = d(() => r.teleportTarget.value);
|
|
54
54
|
_(
|
|
55
55
|
() => g.isOpen,
|
|
56
56
|
async (t) => {
|
|
@@ -76,13 +76,13 @@ const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" },
|
|
|
76
76
|
return t === "countNonNull" ? "Count non-null" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
77
77
|
}
|
|
78
78
|
function N(t) {
|
|
79
|
-
return t.map((
|
|
80
|
-
value:
|
|
81
|
-
label: F(
|
|
79
|
+
return t.map((o) => ({
|
|
80
|
+
value: o,
|
|
81
|
+
label: F(o)
|
|
82
82
|
}));
|
|
83
83
|
}
|
|
84
|
-
return (t,
|
|
85
|
-
e("button",
|
|
84
|
+
return (t, o) => (l(), i(y, null, [
|
|
85
|
+
e("button", k({
|
|
86
86
|
ref: f(r).triggerRef,
|
|
87
87
|
type: "button",
|
|
88
88
|
class: ["datagrid-app-toolbar__button", { "datagrid-app-toolbar__button--active": t.active }],
|
|
@@ -91,21 +91,21 @@ const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" },
|
|
|
91
91
|
style: c.value,
|
|
92
92
|
disabled: t.disabled,
|
|
93
93
|
title: t.disabledReason || void 0
|
|
94
|
-
}),
|
|
95
|
-
(l(), G(D, { to:
|
|
96
|
-
|
|
94
|
+
}), h(t.buttonLabel), 17, U),
|
|
95
|
+
(l(), G(D, { to: S.value }, [
|
|
96
|
+
B.value ? (l(), i("section", k({
|
|
97
97
|
key: 0,
|
|
98
98
|
ref: f(r).contentRef,
|
|
99
99
|
class: "datagrid-aggregations",
|
|
100
100
|
"data-datagrid-overlay-surface": "true",
|
|
101
|
-
style: [
|
|
102
|
-
},
|
|
101
|
+
style: [R.value, c.value]
|
|
102
|
+
}, $.value), [
|
|
103
103
|
e("header", H, [
|
|
104
104
|
J,
|
|
105
105
|
e("button", {
|
|
106
106
|
type: "button",
|
|
107
107
|
class: "datagrid-aggregations__ghost",
|
|
108
|
-
onClick:
|
|
108
|
+
onClick: o[0] || (o[0] = (a) => n("cancel"))
|
|
109
109
|
}, " Close ")
|
|
110
110
|
]),
|
|
111
111
|
e("label", M, [
|
|
@@ -118,31 +118,32 @@ const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" },
|
|
|
118
118
|
"open-on-focus": !1,
|
|
119
119
|
"sticky-popover-id": "aggregations",
|
|
120
120
|
"data-aggregations-autofocus": "true",
|
|
121
|
-
onCommit:
|
|
121
|
+
onCommit: o[1] || (o[1] = (a) => n("update-basis", a))
|
|
122
122
|
}, null, 8, ["value", "options"])
|
|
123
123
|
]),
|
|
124
124
|
t.items.length > 0 ? (l(), i("div", W, [
|
|
125
|
-
(l(!0), i(y, null, I(t.items, (
|
|
126
|
-
key:
|
|
125
|
+
(l(!0), i(y, null, I(t.items, (a) => (l(), i("div", {
|
|
126
|
+
key: a.key,
|
|
127
127
|
class: "datagrid-aggregations__row"
|
|
128
128
|
}, [
|
|
129
129
|
e("label", X, [
|
|
130
130
|
e("input", {
|
|
131
|
+
name: `datagrid-aggregations-toggle-${a.key}`,
|
|
131
132
|
type: "checkbox",
|
|
132
|
-
checked:
|
|
133
|
-
onChange: (p) => n("toggle-column",
|
|
133
|
+
checked: a.enabled,
|
|
134
|
+
onChange: (p) => n("toggle-column", a.key, p.target.checked)
|
|
134
135
|
}, null, 40, Y),
|
|
135
|
-
e("span", Z,
|
|
136
|
+
e("span", Z, h(a.label), 1)
|
|
136
137
|
]),
|
|
137
138
|
C(O, {
|
|
138
139
|
class: "datagrid-aggregations__op",
|
|
139
|
-
value:
|
|
140
|
-
options: N(
|
|
140
|
+
value: a.op,
|
|
141
|
+
options: N(a.allowedOps),
|
|
141
142
|
"open-on-mount": !1,
|
|
142
143
|
"open-on-focus": !1,
|
|
143
144
|
"sticky-popover-id": "aggregations",
|
|
144
|
-
disabled: !
|
|
145
|
-
onCommit: (p) => n("update-op",
|
|
145
|
+
disabled: !a.enabled,
|
|
146
|
+
onCommit: (p) => n("update-op", a.key, p)
|
|
146
147
|
}, null, 8, ["value", "options", "disabled", "onCommit"])
|
|
147
148
|
]))), 128))
|
|
148
149
|
])) : (l(), i("div", x, " No aggregatable columns in the current grid schema. ")),
|
|
@@ -150,18 +151,18 @@ const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" },
|
|
|
150
151
|
e("button", {
|
|
151
152
|
type: "button",
|
|
152
153
|
class: "datagrid-aggregations__secondary",
|
|
153
|
-
onClick:
|
|
154
|
+
onClick: o[2] || (o[2] = (a) => n("clear"))
|
|
154
155
|
}, " Clear "),
|
|
155
156
|
e("div", te, [
|
|
156
157
|
e("button", {
|
|
157
158
|
type: "button",
|
|
158
159
|
class: "datagrid-aggregations__secondary",
|
|
159
|
-
onClick:
|
|
160
|
+
onClick: o[3] || (o[3] = (a) => n("cancel"))
|
|
160
161
|
}, " Cancel "),
|
|
161
162
|
e("button", {
|
|
162
163
|
type: "button",
|
|
163
164
|
class: "datagrid-aggregations__primary",
|
|
164
|
-
onClick:
|
|
165
|
+
onClick: o[4] || (o[4] = (a) => n("apply"))
|
|
165
166
|
}, " Apply ")
|
|
166
167
|
])
|
|
167
168
|
])
|