@adapttable/naive-ui 0.0.0 → 0.1.1
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/LICENSE +21 -0
- package/README.md +290 -1
- package/dist/NaiveFilterSurface-DFoXPlGU.cjs +371 -0
- package/dist/NaiveFilterSurface-DFoXPlGU.cjs.map +1 -0
- package/dist/NaiveFilterSurface-DZKgJ6G_.js +348 -0
- package/dist/NaiveFilterSurface-DZKgJ6G_.js.map +1 -0
- package/dist/NaiveManagedPopover-BScsoUHh.cjs +131 -0
- package/dist/NaiveManagedPopover-BScsoUHh.cjs.map +1 -0
- package/dist/NaiveManagedPopover-DqSDYnef.js +126 -0
- package/dist/NaiveManagedPopover-DqSDYnef.js.map +1 -0
- package/dist/NaiveRowActions-BhgFAnM3.cjs +79 -0
- package/dist/NaiveRowActions-BhgFAnM3.cjs.map +1 -0
- package/dist/NaiveRowActions-BxDGoOKe.js +74 -0
- package/dist/NaiveRowActions-BxDGoOKe.js.map +1 -0
- package/dist/assistant.cjs +355 -0
- package/dist/assistant.cjs.map +1 -0
- package/dist/assistant.d.cts +10 -0
- package/dist/assistant.d.cts.map +1 -0
- package/dist/assistant.d.ts +10 -0
- package/dist/assistant.d.ts.map +1 -0
- package/dist/assistant.js +351 -0
- package/dist/assistant.js.map +1 -0
- package/dist/batch-editing.cjs +4 -0
- package/dist/batch-editing.d.cts +2 -0
- package/dist/batch-editing.d.ts +2 -0
- package/dist/batch-editing.js +2 -0
- package/dist/bulk-actions.cjs +17 -0
- package/dist/bulk-actions.cjs.map +1 -0
- package/dist/bulk-actions.d.cts +7 -0
- package/dist/bulk-actions.d.cts.map +1 -0
- package/dist/bulk-actions.d.ts +7 -0
- package/dist/bulk-actions.d.ts.map +1 -0
- package/dist/bulk-actions.js +16 -0
- package/dist/bulk-actions.js.map +1 -0
- package/dist/button-CVOchGam.cjs +98 -0
- package/dist/button-CVOchGam.cjs.map +1 -0
- package/dist/button-Cf1lslmX.js +69 -0
- package/dist/button-Cf1lslmX.js.map +1 -0
- package/dist/cell-navigation.cjs +18 -0
- package/dist/cell-navigation.cjs.map +1 -0
- package/dist/cell-navigation.d.cts +9 -0
- package/dist/cell-navigation.d.cts.map +1 -0
- package/dist/cell-navigation.d.ts +9 -0
- package/dist/cell-navigation.d.ts.map +1 -0
- package/dist/cell-navigation.js +16 -0
- package/dist/cell-navigation.js.map +1 -0
- package/dist/cell-span.cjs +8 -0
- package/dist/cell-span.d.cts +2 -0
- package/dist/cell-span.d.ts +2 -0
- package/dist/cell-span.js +2 -0
- package/dist/checkbox-Bu4Tl5TQ.cjs +26 -0
- package/dist/checkbox-Bu4Tl5TQ.cjs.map +1 -0
- package/dist/checkbox-CcYT0Q-6.js +21 -0
- package/dist/checkbox-CcYT0Q-6.js.map +1 -0
- package/dist/classNames-2CRJjDRZ.js +11 -0
- package/dist/classNames-2CRJjDRZ.js.map +1 -0
- package/dist/classNames-CR71pIAv.cjs +16 -0
- package/dist/classNames-CR71pIAv.cjs.map +1 -0
- package/dist/column-groups.cjs +8 -0
- package/dist/column-groups.d.cts +2 -0
- package/dist/column-groups.d.ts +2 -0
- package/dist/column-groups.js +2 -0
- package/dist/column-menu-B5xm8hhB.js +74 -0
- package/dist/column-menu-B5xm8hhB.js.map +1 -0
- package/dist/column-menu-Cd8Fm695.cjs +85 -0
- package/dist/column-menu-Cd8Fm695.cjs.map +1 -0
- package/dist/column-menu.cjs +4 -0
- package/dist/column-menu.d.cts +23 -0
- package/dist/column-menu.d.cts.map +1 -0
- package/dist/column-menu.d.ts +23 -0
- package/dist/column-menu.d.ts.map +1 -0
- package/dist/column-menu.js +2 -0
- package/dist/column-selection.cjs +3 -0
- package/dist/column-selection.d.cts +2 -0
- package/dist/column-selection.d.ts +2 -0
- package/dist/column-selection.js +2 -0
- package/dist/command-palette.cjs +113 -0
- package/dist/command-palette.cjs.map +1 -0
- package/dist/command-palette.d.cts +7 -0
- package/dist/command-palette.d.cts.map +1 -0
- package/dist/command-palette.d.ts +7 -0
- package/dist/command-palette.d.ts.map +1 -0
- package/dist/command-palette.js +112 -0
- package/dist/command-palette.js.map +1 -0
- package/dist/context-menu.cjs +141 -0
- package/dist/context-menu.cjs.map +1 -0
- package/dist/context-menu.d.cts +7 -0
- package/dist/context-menu.d.cts.map +1 -0
- package/dist/context-menu.d.ts +7 -0
- package/dist/context-menu.d.ts.map +1 -0
- package/dist/context-menu.js +140 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/controls-D193740P.cjs +86 -0
- package/dist/controls-D193740P.cjs.map +1 -0
- package/dist/controls-Dj3k83WJ.cjs +169 -0
- package/dist/controls-Dj3k83WJ.cjs.map +1 -0
- package/dist/controls-Dp-hPfD4.js +75 -0
- package/dist/controls-Dp-hPfD4.js.map +1 -0
- package/dist/controls-ZeT4wgJ-.js +146 -0
- package/dist/controls-ZeT4wgJ-.js.map +1 -0
- package/dist/density-C7K5aGdQ.js +40 -0
- package/dist/density-C7K5aGdQ.js.map +1 -0
- package/dist/density-CUp3mMNH.cjs +45 -0
- package/dist/density-CUp3mMNH.cjs.map +1 -0
- package/dist/density.cjs +3 -0
- package/dist/density.d.cts +7 -0
- package/dist/density.d.cts.map +1 -0
- package/dist/density.d.ts +7 -0
- package/dist/density.d.ts.map +1 -0
- package/dist/density.js +2 -0
- package/dist/editing-BKNxRBEo.cjs +409 -0
- package/dist/editing-BKNxRBEo.cjs.map +1 -0
- package/dist/editing-BsaH2gDF.js +368 -0
- package/dist/editing-BsaH2gDF.js.map +1 -0
- package/dist/editing-CdIoFGiK.d.cts +60 -0
- package/dist/editing-CdIoFGiK.d.cts.map +1 -0
- package/dist/editing-Dho3Y2RK.d.ts +60 -0
- package/dist/editing-Dho3Y2RK.d.ts.map +1 -0
- package/dist/editing.cjs +22 -0
- package/dist/editing.d.cts +2 -0
- package/dist/editing.d.ts +2 -0
- package/dist/editing.js +2 -0
- package/dist/export.cjs +16 -0
- package/dist/export.cjs.map +1 -0
- package/dist/export.d.cts +9 -0
- package/dist/export.d.cts.map +1 -0
- package/dist/export.d.ts +9 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +15 -0
- package/dist/export.js.map +1 -0
- package/dist/extra-rows.cjs +8 -0
- package/dist/extra-rows.d.cts +2 -0
- package/dist/extra-rows.d.ts +2 -0
- package/dist/extra-rows.js +2 -0
- package/dist/filters-BqymR1RY.cjs +214 -0
- package/dist/filters-BqymR1RY.cjs.map +1 -0
- package/dist/filters-i_dmiQO_.js +203 -0
- package/dist/filters-i_dmiQO_.js.map +1 -0
- package/dist/filters.cjs +14 -0
- package/dist/filters.d.cts +66 -0
- package/dist/filters.d.cts.map +1 -0
- package/dist/filters.d.ts +66 -0
- package/dist/filters.d.ts.map +1 -0
- package/dist/filters.js +3 -0
- package/dist/find-in-table.cjs +21 -0
- package/dist/find-in-table.cjs.map +1 -0
- package/dist/find-in-table.d.cts +8 -0
- package/dist/find-in-table.d.cts.map +1 -0
- package/dist/find-in-table.d.ts +8 -0
- package/dist/find-in-table.d.ts.map +1 -0
- package/dist/find-in-table.js +20 -0
- package/dist/find-in-table.js.map +1 -0
- package/dist/fit-columns.cjs +8 -0
- package/dist/fit-columns.d.cts +2 -0
- package/dist/fit-columns.d.ts +2 -0
- package/dist/fit-columns.js +2 -0
- package/dist/fullscreen.cjs +16 -0
- package/dist/fullscreen.cjs.map +1 -0
- package/dist/fullscreen.d.cts +7 -0
- package/dist/fullscreen.d.cts.map +1 -0
- package/dist/fullscreen.d.ts +7 -0
- package/dist/fullscreen.d.ts.map +1 -0
- package/dist/fullscreen.js +15 -0
- package/dist/fullscreen.js.map +1 -0
- package/dist/grouping-panel.cjs +144 -0
- package/dist/grouping-panel.cjs.map +1 -0
- package/dist/grouping-panel.d.cts +8 -0
- package/dist/grouping-panel.d.cts.map +1 -0
- package/dist/grouping-panel.d.ts +8 -0
- package/dist/grouping-panel.d.ts.map +1 -0
- package/dist/grouping-panel.js +143 -0
- package/dist/grouping-panel.js.map +1 -0
- package/dist/grouping.cjs +40 -0
- package/dist/grouping.cjs.map +1 -0
- package/dist/grouping.d.cts +10 -0
- package/dist/grouping.d.cts.map +1 -0
- package/dist/grouping.d.ts +10 -0
- package/dist/grouping.d.ts.map +1 -0
- package/dist/grouping.js +21 -0
- package/dist/grouping.js.map +1 -0
- package/dist/header-filters-C6K_Y6Sa.js +250 -0
- package/dist/header-filters-C6K_Y6Sa.js.map +1 -0
- package/dist/header-filters-WYusPMig.cjs +273 -0
- package/dist/header-filters-WYusPMig.cjs.map +1 -0
- package/dist/header-filters.cjs +6 -0
- package/dist/header-filters.d.cts +52 -0
- package/dist/header-filters.d.cts.map +1 -0
- package/dist/header-filters.d.ts +52 -0
- package/dist/header-filters.d.ts.map +1 -0
- package/dist/header-filters.js +2 -0
- package/dist/index.cjs +304 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +24 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +303 -0
- package/dist/index.js.map +1 -0
- package/dist/input-Cgm2r2YC.cjs +57 -0
- package/dist/input-Cgm2r2YC.cjs.map +1 -0
- package/dist/input-l5DTkb1E.js +52 -0
- package/dist/input-l5DTkb1E.js.map +1 -0
- package/dist/mobile-298ixM-b.js +419 -0
- package/dist/mobile-298ixM-b.js.map +1 -0
- package/dist/mobile-52C0B3aN.cjs +436 -0
- package/dist/mobile-52C0B3aN.cjs.map +1 -0
- package/dist/modalEscape-CP6_uqjE.js +28 -0
- package/dist/modalEscape-CP6_uqjE.js.map +1 -0
- package/dist/modalEscape-aYoIK8OW.cjs +33 -0
- package/dist/modalEscape-aYoIK8OW.cjs.map +1 -0
- package/dist/multi-sort.cjs +8 -0
- package/dist/multi-sort.d.cts +2 -0
- package/dist/multi-sort.d.ts +2 -0
- package/dist/multi-sort.js +2 -0
- package/dist/nested-table.cjs +8 -0
- package/dist/nested-table.d.cts +2 -0
- package/dist/nested-table.d.ts +2 -0
- package/dist/nested-table.js +2 -0
- package/dist/pinned-summary-rows.cjs +8 -0
- package/dist/pinned-summary-rows.d.cts +2 -0
- package/dist/pinned-summary-rows.d.ts +2 -0
- package/dist/pinned-summary-rows.js +2 -0
- package/dist/pivot.cjs +81 -0
- package/dist/pivot.cjs.map +1 -0
- package/dist/pivot.d.cts +11 -0
- package/dist/pivot.d.cts.map +1 -0
- package/dist/pivot.d.ts +11 -0
- package/dist/pivot.d.ts.map +1 -0
- package/dist/pivot.js +80 -0
- package/dist/pivot.js.map +1 -0
- package/dist/preset.cjs +40 -0
- package/dist/preset.cjs.map +1 -0
- package/dist/preset.d.cts +21 -0
- package/dist/preset.d.cts.map +1 -0
- package/dist/preset.d.ts +21 -0
- package/dist/preset.d.ts.map +1 -0
- package/dist/preset.js +38 -0
- package/dist/preset.js.map +1 -0
- package/dist/print.cjs +17 -0
- package/dist/print.cjs.map +1 -0
- package/dist/print.d.cts +6 -0
- package/dist/print.d.cts.map +1 -0
- package/dist/print.d.ts +6 -0
- package/dist/print.d.ts.map +1 -0
- package/dist/print.js +16 -0
- package/dist/print.js.map +1 -0
- package/dist/renderers.cjs +5 -0
- package/dist/renderers.d.cts +33 -0
- package/dist/renderers.d.cts.map +1 -0
- package/dist/renderers.d.ts +33 -0
- package/dist/renderers.d.ts.map +1 -0
- package/dist/renderers.js +2 -0
- package/dist/resizable-columns.cjs +8 -0
- package/dist/resizable-columns.d.cts +2 -0
- package/dist/resizable-columns.d.ts +2 -0
- package/dist/resizable-columns.js +2 -0
- package/dist/row-actions.cjs +15 -0
- package/dist/row-actions.cjs.map +1 -0
- package/dist/row-actions.d.cts +7 -0
- package/dist/row-actions.d.cts.map +1 -0
- package/dist/row-actions.d.ts +7 -0
- package/dist/row-actions.d.ts.map +1 -0
- package/dist/row-actions.js +14 -0
- package/dist/row-actions.js.map +1 -0
- package/dist/row-appearance.cjs +8 -0
- package/dist/row-appearance.d.cts +2 -0
- package/dist/row-appearance.d.ts +2 -0
- package/dist/row-appearance.js +2 -0
- package/dist/row-detail.cjs +28 -0
- package/dist/row-detail.d.cts +4 -0
- package/dist/row-detail.d.ts +4 -0
- package/dist/row-detail.js +4 -0
- package/dist/row-pinning.cjs +15 -0
- package/dist/row-pinning.cjs.map +1 -0
- package/dist/row-pinning.d.cts +8 -0
- package/dist/row-pinning.d.cts.map +1 -0
- package/dist/row-pinning.d.ts +8 -0
- package/dist/row-pinning.d.ts.map +1 -0
- package/dist/row-pinning.js +14 -0
- package/dist/row-pinning.js.map +1 -0
- package/dist/row-reorder.cjs +193 -0
- package/dist/row-reorder.cjs.map +1 -0
- package/dist/row-reorder.d.cts +6 -0
- package/dist/row-reorder.d.cts.map +1 -0
- package/dist/row-reorder.d.ts +6 -0
- package/dist/row-reorder.d.ts.map +1 -0
- package/dist/row-reorder.js +186 -0
- package/dist/row-reorder.js.map +1 -0
- package/dist/rowActionsSlot-B48S_yZD.cjs +21 -0
- package/dist/rowActionsSlot-B48S_yZD.cjs.map +1 -0
- package/dist/rowActionsSlot-YWkCOo5W.js +11 -0
- package/dist/rowActionsSlot-YWkCOo5W.js.map +1 -0
- package/dist/saved-views-BO5_w40C.js +132 -0
- package/dist/saved-views-BO5_w40C.js.map +1 -0
- package/dist/saved-views-CRyxrATI.cjs +143 -0
- package/dist/saved-views-CRyxrATI.cjs.map +1 -0
- package/dist/saved-views.cjs +4 -0
- package/dist/saved-views.d.cts +15 -0
- package/dist/saved-views.d.cts.map +1 -0
- package/dist/saved-views.d.ts +15 -0
- package/dist/saved-views.d.ts.map +1 -0
- package/dist/saved-views.js +2 -0
- package/dist/select-BSo8XTMg.js +92 -0
- package/dist/select-BSo8XTMg.js.map +1 -0
- package/dist/select-ChoLy-Ja.cjs +97 -0
- package/dist/select-ChoLy-Ja.cjs.map +1 -0
- package/dist/selection-stats.cjs +3 -0
- package/dist/selection-stats.d.cts +2 -0
- package/dist/selection-stats.d.ts +2 -0
- package/dist/selection-stats.js +2 -0
- package/dist/side-panel.cjs +60 -0
- package/dist/side-panel.cjs.map +1 -0
- package/dist/side-panel.d.cts +7 -0
- package/dist/side-panel.d.cts.map +1 -0
- package/dist/side-panel.d.ts +7 -0
- package/dist/side-panel.d.ts.map +1 -0
- package/dist/side-panel.js +59 -0
- package/dist/side-panel.js.map +1 -0
- package/dist/status-bar.cjs +19 -0
- package/dist/status-bar.cjs.map +1 -0
- package/dist/status-bar.d.cts +7 -0
- package/dist/status-bar.d.cts.map +1 -0
- package/dist/status-bar.d.ts +7 -0
- package/dist/status-bar.d.ts.map +1 -0
- package/dist/status-bar.js +17 -0
- package/dist/status-bar.js.map +1 -0
- package/dist/styles.css +218 -0
- package/dist/tree.cjs +21 -0
- package/dist/tree.d.cts +3 -0
- package/dist/tree.d.ts +3 -0
- package/dist/tree.js +3 -0
- package/dist/types-oiTfSnx3.d.cts +13 -0
- package/dist/types-oiTfSnx3.d.cts.map +1 -0
- package/dist/types-oiTfSnx3.d.ts +13 -0
- package/dist/types-oiTfSnx3.d.ts.map +1 -0
- package/dist/virtualize.cjs +8 -0
- package/dist/virtualize.d.cts +2 -0
- package/dist/virtualize.d.ts +2 -0
- package/dist/virtualize.js +2 -0
- package/package.json +457 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Orwa Mahmoud
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,292 @@
|
|
|
1
1
|
# @adapttable/naive-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Requires Node.js **22.12.0 or newer**; packed releases are tested on Node 22.12 and Node 24.
|
|
4
|
+
|
|
5
|
+
Naive UI controls for the AdaptTable Vue binding. AdaptTable owns table state,
|
|
6
|
+
feature composition and semantic table structure. Naive UI supplies the visible
|
|
7
|
+
controls and their styling.
|
|
8
|
+
|
|
9
|
+
Import the adapter stylesheet alongside the component:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { DataTable } from "@adapttable/naive-ui";
|
|
13
|
+
import "@adapttable/naive-ui/styles.css";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Feature composition with 41 canonical factories and focused, opt-in imports.
|
|
19
|
+
- Sorting, multi-sort, pagination, global search, selection and selection
|
|
20
|
+
statistics, with host-controlled state.
|
|
21
|
+
- Filtering, custom filter types, the AND/OR filter tree and header filters.
|
|
22
|
+
- Cell editing, row and batch editing, dirty indicators, undo/redo and
|
|
23
|
+
host-owned save callbacks.
|
|
24
|
+
- Column management, column groups, resizing and fit-to-width.
|
|
25
|
+
- Grouping and aggregation, tree data, row expansion and nested tables.
|
|
26
|
+
- Row reordering, row pinning, pinned summary rows, row and column spanning,
|
|
27
|
+
full-width separator rows, row styling and virtualization.
|
|
28
|
+
- Keyboard navigation, cell ranges, Find, saved views, row actions, bulk actions,
|
|
29
|
+
a command palette, context menus and side-panel view controls.
|
|
30
|
+
- Optional assistant and approval surfaces with host-owned transport and
|
|
31
|
+
decisions.
|
|
32
|
+
- CSV export and host-owned print layout; PDF export and XLSX use optional
|
|
33
|
+
writers supplied to the export feature.
|
|
34
|
+
- Pivot data, a spreadsheet formula engine and sparklines through the shared
|
|
35
|
+
Vue binding's opt-in entries.
|
|
36
|
+
- Mobile card layouts, localized labels, RTL and server-side rendering (SSR)
|
|
37
|
+
with the host setup described below.
|
|
38
|
+
|
|
39
|
+
Import `pdfWriter` from `@adapttable/vue/pdf` or `xlsxWriter` from
|
|
40
|
+
`@adapttable/vue/xlsx` and pass it as the `writer` option to this adapter's
|
|
41
|
+
`exportCsv` factory. The adapter retains its own export controls.
|
|
42
|
+
|
|
43
|
+
For pivot data, import `pivot` and `pivotTableModel` from
|
|
44
|
+
`@adapttable/vue/pivot` and render the prepared rows and columns with this
|
|
45
|
+
adapter; the `pivot` entry's `PivotPanel` edits the axes and measures with
|
|
46
|
+
Naive UI controls. Formula columns come from
|
|
47
|
+
`buildFormulaColumns` in `@adapttable/vue/formula`, and SVG sparkline columns
|
|
48
|
+
from `sparklineColumn` in `@adapttable/vue/sparkline`.
|
|
49
|
+
|
|
50
|
+
## Table rendering
|
|
51
|
+
|
|
52
|
+
The desktop renderer uses Naive UI's `NTable`, `NThead`, `NTbody`, `NTr`, `NTh`
|
|
53
|
+
and `NTd` primitives. The mobile renderer uses `NCard`. Their public slots keep
|
|
54
|
+
attributes, native element refs, ARIA metadata and prepared cell spans on the
|
|
55
|
+
actual semantic targets. Naive UI supplies the table/card theme and controls.
|
|
56
|
+
|
|
57
|
+
The renderer consumes the Vue binding's prepared models. It does not ask
|
|
58
|
+
`NDataTable` to sort, filter, paginate, select, expand or virtualize rows again.
|
|
59
|
+
`NDataTable`'s `remote`, `rowProps` and `cellProps` APIs do not expose its private
|
|
60
|
+
table, header-row or header-cell targets, and its virtual modes restrict spans.
|
|
61
|
+
The semantic primitives avoid those limitations without private DOM changes.
|
|
62
|
+
|
|
63
|
+
`DataTable` uses the binding's optional outer layout for search, status, loading
|
|
64
|
+
and pagination. Applications composing a custom shell can use the desktop and
|
|
65
|
+
mobile renderers directly, or use the headless Vue binding with their own
|
|
66
|
+
presentation.
|
|
67
|
+
|
|
68
|
+
The adapter uses the following public Naive UI APIs:
|
|
69
|
+
|
|
70
|
+
- `NButton` renders action controls. Its `attrType` forwards native button types.
|
|
71
|
+
- `NCheckbox` exposes its focusable `role="checkbox"` root. Controlled `checked`
|
|
72
|
+
and `indeterminate` values come from AdaptTable; one `update:checked` event
|
|
73
|
+
requests one selection toggle.
|
|
74
|
+
- `NInput.inputProps` sends IDs, accessible names, part markers and classes to
|
|
75
|
+
the actual input. Value changes use `update:value`.
|
|
76
|
+
- `NSelect` is a compound control. Its part marker and class are on the component
|
|
77
|
+
host; `inputProps` supplies the accessible name of its filtering input. Its
|
|
78
|
+
menu stays inside the table with `to=false`, including in fullscreen mode.
|
|
79
|
+
|
|
80
|
+
The density and fullscreen features are separate imports:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { densityChooser } from "@adapttable/naive-ui/density";
|
|
84
|
+
import { fullscreen } from "@adapttable/naive-ui/fullscreen";
|
|
85
|
+
|
|
86
|
+
const features = [densityChooser(), fullscreen()];
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Filtering
|
|
90
|
+
|
|
91
|
+
Import filter contributions only where they are used:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { filters } from "@adapttable/naive-ui/filters";
|
|
95
|
+
import { headerFilters } from "@adapttable/naive-ui/header-filters";
|
|
96
|
+
|
|
97
|
+
interface Person {
|
|
98
|
+
name: string;
|
|
99
|
+
}
|
|
100
|
+
const features = [
|
|
101
|
+
filters<Person>([{ key: "name", type: "text" }], { tree: true }),
|
|
102
|
+
headerFilters(),
|
|
103
|
+
];
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Filter fields use Naive inputs, selects and checkboxes. The advanced builder
|
|
107
|
+
uses a controlled Naive collapse with a native Naive button as its keyboard
|
|
108
|
+
trigger. Filter values, option loading, checklist windows and recursive writes
|
|
109
|
+
remain owned by the Vue binding. Standalone `ChecklistFilter`,
|
|
110
|
+
`FilterTreeBuilder`, `FilterHeaderControl` and `FilterHeaderRow` components use
|
|
111
|
+
the same generic row contracts.
|
|
112
|
+
|
|
113
|
+
The popover uses Naive's public manual coordinates, placement, portal and
|
|
114
|
+
outside-click APIs. Drawer mode retains Naive's mask, focus trap and scroll
|
|
115
|
+
lock. Escape first dismisses an open nested select, then the filter surface.
|
|
116
|
+
The drawer mask boundary below also applies to filtering.
|
|
117
|
+
|
|
118
|
+
## Editing and grouping
|
|
119
|
+
|
|
120
|
+
The proposed `editing`, `batch-editing` and `grouping` subpaths add opt-in
|
|
121
|
+
controls. Cell, row and batch editing use `NInput`, `NInputNumber`, `NCheckbox`
|
|
122
|
+
and `NSelect`; Save, Cancel, conflict resolution, rollback, Undo and Redo use
|
|
123
|
+
`NButton`. Group collapse, paging and selection fill the shared group chrome
|
|
124
|
+
with Naive buttons and checkboxes on desktop and cards.
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import {
|
|
128
|
+
editing,
|
|
129
|
+
editHistory,
|
|
130
|
+
dirtyIndicators,
|
|
131
|
+
undoRedoButtons,
|
|
132
|
+
} from "@adapttable/naive-ui/editing";
|
|
133
|
+
|
|
134
|
+
const features = [
|
|
135
|
+
editing<Person>((row, columnKey, value) => {
|
|
136
|
+
// Update your authoritative data here.
|
|
137
|
+
}),
|
|
138
|
+
editHistory(),
|
|
139
|
+
dirtyIndicators(),
|
|
140
|
+
undoRedoButtons(),
|
|
141
|
+
];
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Validation, raw drafts, pending saves, conflicts, history and stale callback
|
|
145
|
+
ownership remain in the Vue binding. Row editing saves through Save or Enter;
|
|
146
|
+
batch editing requires its explicit Save. Blur keeps staged drafts. History with
|
|
147
|
+
row or batch editing also needs an `editing()` callback to
|
|
148
|
+
replay values. Custom editors receive the binding's existing editor contract.
|
|
149
|
+
|
|
150
|
+
Numeric inputs use the public `inputProps` and `format` APIs so the binding's
|
|
151
|
+
raw draft survives vendor blur formatting. Numeric and choice editor refs
|
|
152
|
+
resolve `input[role="spinbutton"]` and `input[role="combobox"]` beneath Vue's
|
|
153
|
+
public `$el`; the roles are supplied through `inputProps`. Editing part markers,
|
|
154
|
+
validation ARIA attributes and class hooks land on these native inputs. This
|
|
155
|
+
editing select differs from the general compound-select host contract above.
|
|
156
|
+
An open select owns its navigation, selection and first Escape; a second Escape
|
|
157
|
+
cancels the edit and restores the activation button's focus.
|
|
158
|
+
|
|
159
|
+
## Compatibility
|
|
160
|
+
|
|
161
|
+
This `0.1.0` package requires Vue `^3.5.0` and Naive UI `^2.45.3`.
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
pnpm add @adapttable/naive-ui naive-ui@^2.45.3 vue@^3.5.0
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Native control refs
|
|
168
|
+
|
|
169
|
+
Button, checkbox, table and card refs resolve their semantic root through Vue's
|
|
170
|
+
public `$el`. Adding or removing a callback keeps the same native element and
|
|
171
|
+
its focus. A public component option that replaces the root, such as
|
|
172
|
+
`NButton.tag`, releases the old target before supplying its replacement.
|
|
173
|
+
|
|
174
|
+
Input refs use the `inputElRef` and `textareaElRef` fields in Naive UI 2.45.3's
|
|
175
|
+
exported `InputInst` type. These return the actual input or textarea, including
|
|
176
|
+
when the control changes between those two shapes.
|
|
177
|
+
|
|
178
|
+
Naive UI's exported `SelectInst` exposes focus methods but no native-element
|
|
179
|
+
ref. Its `inputProps.ref` is replaced by its own internal template ref. The
|
|
180
|
+
adapter therefore performs a read-only lookup beneath Vue's public `$el` host
|
|
181
|
+
for `input[role="combobox"]`; that role reaches the actual filtering input
|
|
182
|
+
through the public `inputProps` API. This is a tested DOM-target bridge for
|
|
183
|
+
Naive UI 2.45.3, not an exposed `SelectInst` native-ref API. It does not read
|
|
184
|
+
private component state or change rendered attributes.
|
|
185
|
+
|
|
186
|
+
Replacing a callback, replacing its native target, removing the callback, or
|
|
187
|
+
unmounting the control releases the previous target with `null` before handing
|
|
188
|
+
over the next target. The select's part marker and classes remain on its
|
|
189
|
+
compound host.
|
|
190
|
+
|
|
191
|
+
## Server rendering
|
|
192
|
+
|
|
193
|
+
Use Naive UI's CSS-render SSR integration on the server. Install
|
|
194
|
+
`@css-render/vue3-ssr` and collect the component styles after rendering:
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import { setup } from "@css-render/vue3-ssr";
|
|
198
|
+
import { createSSRApp } from "vue";
|
|
199
|
+
import { renderToString } from "vue/server-renderer";
|
|
200
|
+
|
|
201
|
+
const app = createSSRApp(App);
|
|
202
|
+
const { collect } = setup(app);
|
|
203
|
+
const html = await renderToString(app);
|
|
204
|
+
const styles = collect();
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Include `styles` in the document head and hydrate `html` with the matching
|
|
208
|
+
client app. This is required by Naive UI's floating controls as well as its
|
|
209
|
+
stylesheet collection.
|
|
210
|
+
|
|
211
|
+
## Naive UI drawer mask boundary
|
|
212
|
+
|
|
213
|
+
Naive UI 2.45.3 keeps its decorative drawer mask internal. It exposes no public
|
|
214
|
+
mask attribute, class or theme-color hook. The vendor focus trap requires this
|
|
215
|
+
mask to remain enabled. Consequently, the mask cannot receive the shared
|
|
216
|
+
`data-adapttable-part="filters-backdrop"` marker or `filtersBackdrop` class hook
|
|
217
|
+
through supported Naive UI APIs. The public dialog and content targets remain
|
|
218
|
+
customizable.
|
|
219
|
+
|
|
220
|
+
## Component documentation
|
|
221
|
+
|
|
222
|
+
- [Naive UI table primitives](https://www.naiveui.com/en-US/os-theme/components/table)
|
|
223
|
+
- [Naive UI button](https://www.naiveui.com/en-US/os-theme/components/button)
|
|
224
|
+
- [Naive UI checkbox](https://www.naiveui.com/en-US/os-theme/components/checkbox)
|
|
225
|
+
- [Naive UI input](https://www.naiveui.com/en-US/os-theme/components/input)
|
|
226
|
+
- [Naive UI select](https://www.naiveui.com/en-US/os-theme/components/select)
|
|
227
|
+
- [Naive UI license](https://github.com/tusen-ai/naive-ui/blob/main/LICENSE)
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
MIT.
|
|
232
|
+
|
|
233
|
+
## Navigation and utility controls
|
|
234
|
+
|
|
235
|
+
Opt in through `bulk-actions`, `cell-navigation`, `export`, `find-in-table`,
|
|
236
|
+
`print`, `selection-stats`, and `status-bar`. The `cell-navigation` entry also
|
|
237
|
+
exports `columnSelectionCheckbox`; `status-bar` also exports `selectionStats`.
|
|
238
|
+
|
|
239
|
+
Naive buttons, checkboxes, inputs, text, cards and progress indicators render
|
|
240
|
+
the controls. The Vue binding owns selection ranges, find matches, action
|
|
241
|
+
requests and export jobs. Printing and data changes remain host callbacks.
|
|
242
|
+
Find and utility controls work in mobile cards; cell ranges and fill handles
|
|
243
|
+
are desktop-grid features.
|
|
244
|
+
|
|
245
|
+
## Command and context surfaces
|
|
246
|
+
|
|
247
|
+
Import `commandPalette` from `command-palette` and `contextMenu` from
|
|
248
|
+
`context-menu`. The command palette uses native Naive inputs and buttons
|
|
249
|
+
inside an `NModal` and `NCard`; native modal focus and dismissal are guarded
|
|
250
|
+
against nested or already-handled Escape events.
|
|
251
|
+
|
|
252
|
+
The context menu uses `NPopover`, `NCard`, and real `NButton` menu items. The
|
|
253
|
+
shared binding's menu controller owns wrapped navigation, disabled-item
|
|
254
|
+
skipping, and prefix typeahead. Tab and Shift+Tab dismiss without cancelling
|
|
255
|
+
native traversal. Both surfaces retain the binding's lifecycle and fullscreen
|
|
256
|
+
container contracts.
|
|
257
|
+
|
|
258
|
+
## Grouping panel and row movement
|
|
259
|
+
|
|
260
|
+
Import `groupingPanel` from `grouping-panel` and `rowReorder` from
|
|
261
|
+
`row-reorder`. Naive grouping choices, buttons, checkboxes and tags fill the
|
|
262
|
+
shared grouping controller. Group ordering, aggregation capabilities, defaults,
|
|
263
|
+
and announcements stay in the binding. Declare numeric aggregation operations
|
|
264
|
+
explicitly, or supply a numeric column filter/editor for implied operations.
|
|
265
|
+
|
|
266
|
+
Row handles and mobile move buttons issue host requests. Cross-group destination
|
|
267
|
+
choices use `NSelect`, retain disabled choices and their reasons, and keep the
|
|
268
|
+
selector within the table. The optional native confirmation modal starts on
|
|
269
|
+
Cancel and restores the real destination input. Confirmation and stale-session
|
|
270
|
+
decisions stay with the shared row model.
|
|
271
|
+
|
|
272
|
+
## Saved views and side panels
|
|
273
|
+
|
|
274
|
+
Import `savedViews` and `SavedViewsPanel` from `saved-views`, and `sidePanel`
|
|
275
|
+
from `side-panel`. Native Naive buttons, inputs, cards and tags render the
|
|
276
|
+
binding's saved-view disclosure and management controls. Read-only views,
|
|
277
|
+
renaming, ordering and persistence remain owned by the shared controller.
|
|
278
|
+
|
|
279
|
+
Side panels use native card and button presentation over the shared tab,
|
|
280
|
+
selection, identity and lifecycle contract. Host-controlled open state stays
|
|
281
|
+
authoritative. Managed saved-view popovers use the table's fullscreen container
|
|
282
|
+
and semantic trigger/input refs.
|
|
283
|
+
|
|
284
|
+
### Optional assistant and pivot controls
|
|
285
|
+
|
|
286
|
+
The `assistant` entry provides `TableAssistant`, `AgentApproval`,
|
|
287
|
+
`tableAssistant()`, and `agentApproval()` using the binding's conversation and
|
|
288
|
+
approval contracts. Its sheet is an `NDrawer`, examples use an `NPopover` menu,
|
|
289
|
+
the composer is an `NInput` textarea, and speech language choices use
|
|
290
|
+
`NSelect`. It does not import an AI transport or own approval decisions. The
|
|
291
|
+
`pivot` entry provides a controlled `PivotPanel` with `NSelect` and `NButton`
|
|
292
|
+
controls.
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
const require_button = require("./button-CVOchGam.cjs");
|
|
2
|
+
const require_input = require("./input-Cgm2r2YC.cjs");
|
|
3
|
+
const require_classNames = require("./classNames-CR71pIAv.cjs");
|
|
4
|
+
const require_select = require("./select-ChoLy-Ja.cjs");
|
|
5
|
+
let _adapttable_vue_adapter = require("@adapttable/vue/adapter");
|
|
6
|
+
let vue = require("vue");
|
|
7
|
+
let naive_ui = require("naive-ui");
|
|
8
|
+
//#region src/filters/controls.ts
|
|
9
|
+
/** The kit owns checkbox paint and its value event; the filter model owns writes. */
|
|
10
|
+
function naiveFilterCheckbox(control, content = control.label) {
|
|
11
|
+
return require_button.naiveElement(naive_ui.NCheckbox, {
|
|
12
|
+
...control.attrs,
|
|
13
|
+
checked: control.checked,
|
|
14
|
+
"aria-label": control.label,
|
|
15
|
+
"aria-labelledby": control.attrs["aria-labelledby"] ?? void 0,
|
|
16
|
+
"onUpdate:checked": (checked) => control.onChange(checked)
|
|
17
|
+
}, () => content);
|
|
18
|
+
}
|
|
19
|
+
function naiveFilterControls(names) {
|
|
20
|
+
return {
|
|
21
|
+
Input: (control) => require_input.naiveInput({
|
|
22
|
+
...control,
|
|
23
|
+
attrs: {
|
|
24
|
+
...control.attrs,
|
|
25
|
+
class: names().filterInput
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
Select: (control) => require_select.naiveSelect({
|
|
29
|
+
...control,
|
|
30
|
+
attrs: {
|
|
31
|
+
...control.attrs,
|
|
32
|
+
class: control.attrs["data-adapttable-part"] === "filter-operator" ? names().filterOperator : names().filterSelect
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
Checkbox: (control) => naiveFilterCheckbox({
|
|
36
|
+
...control,
|
|
37
|
+
attrs: {
|
|
38
|
+
...control.attrs,
|
|
39
|
+
class: names().filterCheckbox
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/filters/NaiveBasicFilterField.vue
|
|
46
|
+
const _sfc_main$2 = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
47
|
+
name: "NaiveBasicFilterField",
|
|
48
|
+
__name: "NaiveBasicFilterField",
|
|
49
|
+
props: {
|
|
50
|
+
id: {},
|
|
51
|
+
def: {},
|
|
52
|
+
source: {},
|
|
53
|
+
labels: {},
|
|
54
|
+
registry: {}
|
|
55
|
+
},
|
|
56
|
+
setup(__props) {
|
|
57
|
+
const props = __props;
|
|
58
|
+
const names = (0, _adapttable_vue_adapter.useDataTableClassNames)();
|
|
59
|
+
const model = (0, _adapttable_vue_adapter.useFilterField)(() => props);
|
|
60
|
+
const controls = naiveFilterControls(() => names.value);
|
|
61
|
+
const Render = () => (0, _adapttable_vue_adapter.FilterFieldChrome)({
|
|
62
|
+
model: model.value,
|
|
63
|
+
controls,
|
|
64
|
+
classNames: names.value
|
|
65
|
+
});
|
|
66
|
+
Render.props = [];
|
|
67
|
+
return (_ctx, _cache) => {
|
|
68
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(Render);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/filters/NaiveChecklistFilter.vue
|
|
74
|
+
const _sfc_main$1 = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
75
|
+
name: "NaiveChecklistFilter",
|
|
76
|
+
__name: "NaiveChecklistFilter",
|
|
77
|
+
props: {
|
|
78
|
+
def: {},
|
|
79
|
+
source: {},
|
|
80
|
+
labels: {},
|
|
81
|
+
classNames: {}
|
|
82
|
+
},
|
|
83
|
+
setup(__props) {
|
|
84
|
+
const props = __props;
|
|
85
|
+
const model = (0, _adapttable_vue_adapter.useChecklistModel)(() => props);
|
|
86
|
+
const controls = {
|
|
87
|
+
Search: (control) => require_input.naiveInput({
|
|
88
|
+
value: control.value,
|
|
89
|
+
onChange: control.onChange,
|
|
90
|
+
attrs: {
|
|
91
|
+
type: "search",
|
|
92
|
+
"aria-label": control.label,
|
|
93
|
+
"data-adapttable-part": "filter-checklist-search",
|
|
94
|
+
class: control.className
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
97
|
+
Button: (control) => require_button.naiveButton({ onClick: control.onClick }, control.label),
|
|
98
|
+
Checkbox: (control) => naiveFilterCheckbox({
|
|
99
|
+
...control,
|
|
100
|
+
attrs: {
|
|
101
|
+
"data-adapttable-part": "filter-checkbox",
|
|
102
|
+
class: control.className
|
|
103
|
+
}
|
|
104
|
+
}, [control.label, (0, vue.h)("span", {
|
|
105
|
+
"data-adapttable-part": "filter-checklist-count",
|
|
106
|
+
class: control.countClassName
|
|
107
|
+
}, control.count)])
|
|
108
|
+
};
|
|
109
|
+
const Render = () => (0, _adapttable_vue_adapter.ChecklistChrome)({
|
|
110
|
+
model: model.value,
|
|
111
|
+
controls
|
|
112
|
+
});
|
|
113
|
+
Render.props = [];
|
|
114
|
+
return (_ctx, _cache) => {
|
|
115
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(Render);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/filters/NaiveFilterField.vue
|
|
121
|
+
const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
122
|
+
name: "NaiveFilterField",
|
|
123
|
+
__name: "NaiveFilterField",
|
|
124
|
+
props: {
|
|
125
|
+
id: {},
|
|
126
|
+
def: {},
|
|
127
|
+
source: {},
|
|
128
|
+
labels: {},
|
|
129
|
+
registry: {}
|
|
130
|
+
},
|
|
131
|
+
setup(__props) {
|
|
132
|
+
const props = __props;
|
|
133
|
+
const names = (0, _adapttable_vue_adapter.useDataTableClassNames)();
|
|
134
|
+
const Render = () => {
|
|
135
|
+
if ((0, _adapttable_vue_adapter.filterWidgetKind)(props.def, props.registry ?? _adapttable_vue_adapter.defaultFilterRegistry) !== "checklist") return (0, vue.h)(_sfc_main$2, { ...props });
|
|
136
|
+
return (0, vue.h)("fieldset", {
|
|
137
|
+
"data-adapttable-part": "filter-field",
|
|
138
|
+
class: names.value.filterField
|
|
139
|
+
}, [(0, vue.h)("legend", {
|
|
140
|
+
"data-adapttable-part": "filter-label",
|
|
141
|
+
class: names.value.filterLabel
|
|
142
|
+
}, (0, _adapttable_vue_adapter.filterLabel)(props.def)), (0, vue.h)(_sfc_main$1, {
|
|
143
|
+
def: props.def,
|
|
144
|
+
source: props.source,
|
|
145
|
+
labels: props.labels,
|
|
146
|
+
classNames: names.value
|
|
147
|
+
})]);
|
|
148
|
+
};
|
|
149
|
+
Render.props = [];
|
|
150
|
+
return (_ctx, _cache) => {
|
|
151
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(Render);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/filters/NaiveFilterSurface.ts
|
|
157
|
+
/** Public vendor surfaces own their mask, trap, scroll lock and portal. */
|
|
158
|
+
const NaiveFilterSurface = (0, vue.defineComponent)((props) => {
|
|
159
|
+
const names = (0, _adapttable_vue_adapter.useDataTableClassNames)();
|
|
160
|
+
const active = (0, _adapttable_vue_adapter.useScopeActivity)();
|
|
161
|
+
const mounted = (0, vue.shallowRef)(false);
|
|
162
|
+
const content = (0, vue.shallowRef)(null);
|
|
163
|
+
const position = (0, vue.shallowRef)();
|
|
164
|
+
let lifetime = 0;
|
|
165
|
+
let reason;
|
|
166
|
+
const dismiss = (why, ticket, owner) => {
|
|
167
|
+
if (ticket !== lifetime || !active.value || !props.open || owner !== props.onClose) return;
|
|
168
|
+
reason = why;
|
|
169
|
+
owner(why);
|
|
170
|
+
};
|
|
171
|
+
(0, vue.onMounted)(() => {
|
|
172
|
+
mounted.value = true;
|
|
173
|
+
});
|
|
174
|
+
(0, vue.watch)([
|
|
175
|
+
active,
|
|
176
|
+
() => props.open,
|
|
177
|
+
() => props.anchor,
|
|
178
|
+
() => props.modal,
|
|
179
|
+
() => props.onClose
|
|
180
|
+
], ([enabled, open, anchor, modal], previous) => {
|
|
181
|
+
const ticket = ++lifetime;
|
|
182
|
+
const surface = content.value;
|
|
183
|
+
const focused = surface?.ownerDocument.activeElement;
|
|
184
|
+
if (!modal && enabled && !open && previous[1] && reason !== "outside" && surface && focused && surface.contains(focused) && anchor?.isConnected) (0, vue.nextTick)(() => {
|
|
185
|
+
const current = anchor.ownerDocument.activeElement;
|
|
186
|
+
if (ticket === lifetime && active.value && !props.open && props.anchor === anchor && anchor.isConnected && (current === focused || current === anchor.ownerDocument.body)) anchor.focus();
|
|
187
|
+
});
|
|
188
|
+
reason = void 0;
|
|
189
|
+
}, { flush: "sync" });
|
|
190
|
+
(0, vue.watch)([
|
|
191
|
+
mounted,
|
|
192
|
+
active,
|
|
193
|
+
() => props.open,
|
|
194
|
+
() => props.anchor,
|
|
195
|
+
() => props.dir,
|
|
196
|
+
() => props.modal,
|
|
197
|
+
() => props.onClose
|
|
198
|
+
], ([ready, enabled, open, anchor, dir, modal], _previous, cleanup) => {
|
|
199
|
+
if (!ready || !enabled || !open || !anchor || modal) return;
|
|
200
|
+
const view = anchor.ownerDocument.defaultView;
|
|
201
|
+
if (!view) return;
|
|
202
|
+
const place = () => {
|
|
203
|
+
const rect = anchor.getBoundingClientRect();
|
|
204
|
+
const root = anchor.ownerDocument.documentElement;
|
|
205
|
+
const viewport = root.clientWidth;
|
|
206
|
+
const rem = Number.parseFloat(view.getComputedStyle(root).fontSize);
|
|
207
|
+
const width = Math.min(22 * (rem || 16), viewport - 16);
|
|
208
|
+
position.value = {
|
|
209
|
+
x: dir === "rtl" ? Math.min(viewport - 8, Math.max(rect.right, width + 8)) : Math.max(8, Math.min(rect.left, viewport - 8 - width)),
|
|
210
|
+
maxWidth: viewport - 16,
|
|
211
|
+
y: rect.bottom,
|
|
212
|
+
maxHeight: Math.max(0, Math.min(560, Math.max(rect.top, view.innerHeight - rect.bottom) - 8))
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
place();
|
|
216
|
+
const ticket = lifetime;
|
|
217
|
+
const owner = props.onClose;
|
|
218
|
+
const keydown = (event) => {
|
|
219
|
+
if (event.key !== "Escape" || event.defaultPrevented || event.isComposing) return;
|
|
220
|
+
const target = event.target;
|
|
221
|
+
const dialog = target instanceof Element ? target.closest("[role=\"dialog\"]") : null;
|
|
222
|
+
if (dialog && dialog !== content.value?.closest("[role=\"dialog\"]")) return;
|
|
223
|
+
event.preventDefault();
|
|
224
|
+
dismiss("escape", ticket, owner);
|
|
225
|
+
};
|
|
226
|
+
anchor.ownerDocument.addEventListener("keydown", keydown);
|
|
227
|
+
view.addEventListener("resize", place);
|
|
228
|
+
view.addEventListener("scroll", place, true);
|
|
229
|
+
const observer = view.ResizeObserver ? new view.ResizeObserver(place) : void 0;
|
|
230
|
+
observer?.observe(anchor);
|
|
231
|
+
cleanup(() => {
|
|
232
|
+
anchor.ownerDocument.removeEventListener("keydown", keydown);
|
|
233
|
+
view.removeEventListener("resize", place);
|
|
234
|
+
view.removeEventListener("scroll", place, true);
|
|
235
|
+
observer?.disconnect();
|
|
236
|
+
});
|
|
237
|
+
}, { flush: "post" });
|
|
238
|
+
(0, vue.watch)([
|
|
239
|
+
content,
|
|
240
|
+
active,
|
|
241
|
+
() => props.open,
|
|
242
|
+
() => props.modal
|
|
243
|
+
], ([element, enabled, open, modal]) => {
|
|
244
|
+
if (!element || !enabled || !open || modal || element.contains(element.ownerDocument.activeElement)) return;
|
|
245
|
+
([...element.querySelectorAll("input:not([type='hidden']), select, button, [tabindex='0']")].find((node) => !node.matches(":disabled") && node.getAttribute("aria-disabled") !== "true" && !node.closest("[hidden], [inert]")) ?? element).focus({ preventScroll: true });
|
|
246
|
+
}, { flush: "post" });
|
|
247
|
+
return () => {
|
|
248
|
+
const classes = require_classNames.naiveClassNames(names.value);
|
|
249
|
+
const ticket = lifetime;
|
|
250
|
+
const requestClose = props.onClose;
|
|
251
|
+
const current = () => ticket === lifetime && active.value && props.open;
|
|
252
|
+
const close = (why) => {
|
|
253
|
+
dismiss(why, ticket, requestClose);
|
|
254
|
+
};
|
|
255
|
+
const open = mounted.value && active.value && props.open;
|
|
256
|
+
const children = () => (0, vue.h)("div", {
|
|
257
|
+
ref: content,
|
|
258
|
+
tabindex: -1
|
|
259
|
+
}, [props.children]);
|
|
260
|
+
const keydown = (event) => {
|
|
261
|
+
if (event.key !== "Escape" || event.defaultPrevented || event.isComposing || !current()) return;
|
|
262
|
+
if (props.modal) {
|
|
263
|
+
reason = "escape";
|
|
264
|
+
(0, vue.nextTick)(() => {
|
|
265
|
+
if (ticket === lifetime) reason = void 0;
|
|
266
|
+
});
|
|
267
|
+
} else {
|
|
268
|
+
event.preventDefault();
|
|
269
|
+
event.stopPropagation();
|
|
270
|
+
close("escape");
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
const attrs = {
|
|
274
|
+
dir: props.dir,
|
|
275
|
+
role: "dialog",
|
|
276
|
+
"aria-label": props.label,
|
|
277
|
+
"data-adapttable-part": props.part ?? (props.modal ? "filters-panel" : "filters-popover"),
|
|
278
|
+
class: ["adapttable-naive-filter-surface", props.className ?? (props.modal ? classes.filtersPanel : classes.filtersPopover)],
|
|
279
|
+
onKeydown: keydown
|
|
280
|
+
};
|
|
281
|
+
if (props.modal) return (0, vue.h)(naive_ui.NDrawer, {
|
|
282
|
+
...attrs,
|
|
283
|
+
class: [attrs.class, classes.filtersDrawer],
|
|
284
|
+
show: open,
|
|
285
|
+
to: props.container ?? void 0,
|
|
286
|
+
placement: props.dir === "rtl" ? "left" : "right",
|
|
287
|
+
width: "min(24rem, calc(100vw - 16px))",
|
|
288
|
+
"onUpdate:show": (show) => {
|
|
289
|
+
if (!show) close(reason ?? "outside");
|
|
290
|
+
}
|
|
291
|
+
}, { default: () => (0, vue.h)(naive_ui.NDrawerContent, {}, { default: children }) });
|
|
292
|
+
if (!mounted.value || !props.anchor || !position.value) return null;
|
|
293
|
+
return (0, vue.h)(naive_ui.NPopover, {
|
|
294
|
+
...attrs,
|
|
295
|
+
trigger: "manual",
|
|
296
|
+
show: open && !!props.anchor && !!position.value,
|
|
297
|
+
x: position.value?.x,
|
|
298
|
+
y: position.value?.y,
|
|
299
|
+
to: props.container ?? void 0,
|
|
300
|
+
placement: props.dir === "rtl" ? "bottom-end" : "bottom-start",
|
|
301
|
+
showArrow: false,
|
|
302
|
+
style: {
|
|
303
|
+
boxSizing: "border-box",
|
|
304
|
+
width: "22rem",
|
|
305
|
+
maxWidth: `${position.value.maxWidth}px`,
|
|
306
|
+
maxHeight: `${position.value.maxHeight}px`,
|
|
307
|
+
overflow: "auto"
|
|
308
|
+
},
|
|
309
|
+
onClickoutside: (event) => {
|
|
310
|
+
const target = event.target;
|
|
311
|
+
if (!(target instanceof Node) || !props.anchor?.contains(target)) close("outside");
|
|
312
|
+
}
|
|
313
|
+
}, { default: children });
|
|
314
|
+
};
|
|
315
|
+
}, {
|
|
316
|
+
name: "NaiveFilterSurface",
|
|
317
|
+
props: {
|
|
318
|
+
open: {
|
|
319
|
+
type: Boolean,
|
|
320
|
+
default: void 0
|
|
321
|
+
},
|
|
322
|
+
label: { type: String },
|
|
323
|
+
dir: { type: String },
|
|
324
|
+
anchor: { type: Object },
|
|
325
|
+
container: { type: Object },
|
|
326
|
+
children: {
|
|
327
|
+
type: [
|
|
328
|
+
String,
|
|
329
|
+
Number,
|
|
330
|
+
Boolean,
|
|
331
|
+
Array,
|
|
332
|
+
Object
|
|
333
|
+
],
|
|
334
|
+
default: void 0
|
|
335
|
+
},
|
|
336
|
+
onClose: { type: Function },
|
|
337
|
+
className: { type: String },
|
|
338
|
+
modal: {
|
|
339
|
+
type: Boolean,
|
|
340
|
+
default: void 0
|
|
341
|
+
},
|
|
342
|
+
part: { type: String }
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
//#endregion
|
|
346
|
+
Object.defineProperty(exports, "NaiveFilterSurface", {
|
|
347
|
+
enumerable: true,
|
|
348
|
+
get: function() {
|
|
349
|
+
return NaiveFilterSurface;
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
Object.defineProperty(exports, "_sfc_main", {
|
|
353
|
+
enumerable: true,
|
|
354
|
+
get: function() {
|
|
355
|
+
return _sfc_main;
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
Object.defineProperty(exports, "_sfc_main$1", {
|
|
359
|
+
enumerable: true,
|
|
360
|
+
get: function() {
|
|
361
|
+
return _sfc_main$1;
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
Object.defineProperty(exports, "naiveFilterCheckbox", {
|
|
365
|
+
enumerable: true,
|
|
366
|
+
get: function() {
|
|
367
|
+
return naiveFilterCheckbox;
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
//# sourceMappingURL=NaiveFilterSurface-DFoXPlGU.cjs.map
|