@adapttable/element-plus 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +534 -1
- package/dist/ElementCard-BRZekaHr.cjs +41 -0
- package/dist/ElementCard-BRZekaHr.cjs.map +1 -0
- package/dist/ElementCard-DZdAU6x8.js +36 -0
- package/dist/ElementCard-DZdAU6x8.js.map +1 -0
- package/dist/ElementCheckbox-BQN4_eas.js +99 -0
- package/dist/ElementCheckbox-BQN4_eas.js.map +1 -0
- package/dist/ElementCheckbox-BewKx6sv.cjs +104 -0
- package/dist/ElementCheckbox-BewKx6sv.cjs.map +1 -0
- package/dist/ElementColumnMenuPanel-D7SdfclW.js +126 -0
- package/dist/ElementColumnMenuPanel-D7SdfclW.js.map +1 -0
- package/dist/ElementColumnMenuPanel-DRQbZVow.cjs +137 -0
- package/dist/ElementColumnMenuPanel-DRQbZVow.cjs.map +1 -0
- package/dist/ElementFilterHeaderRow-CR1aax4I.cjs +202 -0
- package/dist/ElementFilterHeaderRow-CR1aax4I.cjs.map +1 -0
- package/dist/ElementFilterHeaderRow-CjduRYN5.js +191 -0
- package/dist/ElementFilterHeaderRow-CjduRYN5.js.map +1 -0
- package/dist/ElementFilterHeaderRow.vue-aMWpPgI9.d.cts +33 -0
- package/dist/ElementFilterHeaderRow.vue-aMWpPgI9.d.cts.map +1 -0
- package/dist/ElementFilterHeaderRow.vue-aMWpPgI9.d.ts +33 -0
- package/dist/ElementFilterHeaderRow.vue-aMWpPgI9.d.ts.map +1 -0
- package/dist/ElementFilterSurface-DcPyYCK-.cjs +302 -0
- package/dist/ElementFilterSurface-DcPyYCK-.cjs.map +1 -0
- package/dist/ElementFilterSurface-DdvPfm1N.js +285 -0
- package/dist/ElementFilterSurface-DdvPfm1N.js.map +1 -0
- package/dist/ElementInput-BsoAvPfO.js +55 -0
- package/dist/ElementInput-BsoAvPfO.js.map +1 -0
- package/dist/ElementInput-vBVDBaLp.cjs +60 -0
- package/dist/ElementInput-vBVDBaLp.cjs.map +1 -0
- package/dist/ElementRowActions-BKfX2XRn.js +59 -0
- package/dist/ElementRowActions-BKfX2XRn.js.map +1 -0
- package/dist/ElementRowActions-B_rR7qSj.cjs +64 -0
- package/dist/ElementRowActions-B_rR7qSj.cjs.map +1 -0
- package/dist/ElementSelect-Cl5ZjuQM.js +65 -0
- package/dist/ElementSelect-Cl5ZjuQM.js.map +1 -0
- package/dist/ElementSelect-K1rRvu5q.cjs +70 -0
- package/dist/ElementSelect-K1rRvu5q.cjs.map +1 -0
- package/dist/assistant.cjs +301 -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 +297 -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 +15 -0
- package/dist/bulk-actions.cjs.map +1 -0
- package/dist/bulk-actions.d.cts +6 -0
- package/dist/bulk-actions.d.cts.map +1 -0
- package/dist/bulk-actions.d.ts +6 -0
- package/dist/bulk-actions.d.ts.map +1 -0
- package/dist/bulk-actions.js +14 -0
- package/dist/bulk-actions.js.map +1 -0
- package/dist/button-BFjBL9m3.cjs +77 -0
- package/dist/button-BFjBL9m3.cjs.map +1 -0
- package/dist/button-DwB4UxI2.js +66 -0
- package/dist/button-DwB4UxI2.js.map +1 -0
- package/dist/cell-navigation-BXE28fwQ.cjs +85 -0
- package/dist/cell-navigation-BXE28fwQ.cjs.map +1 -0
- package/dist/cell-navigation-THnr6YdK.js +74 -0
- package/dist/cell-navigation-THnr6YdK.js.map +1 -0
- package/dist/cell-navigation.cjs +4 -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 +2 -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-DhUYYwWe.cjs +26 -0
- package/dist/checkbox-DhUYYwWe.cjs.map +1 -0
- package/dist/classNamesContext-18Wbxy4F.js +2 -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-CfqfyZzs.js +115 -0
- package/dist/column-menu-CfqfyZzs.js.map +1 -0
- package/dist/column-menu-DfTLlqC-.cjs +126 -0
- package/dist/column-menu-DfTLlqC-.cjs.map +1 -0
- package/dist/column-menu.cjs +4 -0
- package/dist/column-menu.d.cts +34 -0
- package/dist/column-menu.d.cts.map +1 -0
- package/dist/column-menu.d.ts +34 -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/columns.cjs +26 -0
- package/dist/columns.d.cts +3 -0
- package/dist/columns.d.ts +3 -0
- package/dist/columns.js +2 -0
- package/dist/command-palette.cjs +43 -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 +42 -0
- package/dist/command-palette.js.map +1 -0
- package/dist/context-menu.cjs +34 -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 +33 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/density-Bj1pck4x.cjs +82 -0
- package/dist/density-Bj1pck4x.cjs.map +1 -0
- package/dist/density-ChRp0NG3.js +77 -0
- package/dist/density-ChRp0NG3.js.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-BX-jUtdO.cjs +423 -0
- package/dist/editing-BX-jUtdO.cjs.map +1 -0
- package/dist/editing-BnLdNDlo.d.ts +60 -0
- package/dist/editing-BnLdNDlo.d.ts.map +1 -0
- package/dist/editing-C1Hy-MCQ.js +383 -0
- package/dist/editing-C1Hy-MCQ.js.map +1 -0
- package/dist/editing-Cg6ZNvSa.d.cts +60 -0
- package/dist/editing-Cg6ZNvSa.d.cts.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/elementActionSlots-CbKE3WnM.js +8 -0
- package/dist/elementActionSlots-CbKE3WnM.js.map +1 -0
- package/dist/elementActionSlots-DlhU82H7.cjs +13 -0
- package/dist/elementActionSlots-DlhU82H7.cjs.map +1 -0
- package/dist/elementHierarchyControlSlots-Ctcmq3T2.js +21 -0
- package/dist/elementHierarchyControlSlots-Ctcmq3T2.js.map +1 -0
- package/dist/elementRemainingControls-BPGBbbUF.js +243 -0
- package/dist/elementRemainingControls-BPGBbbUF.js.map +1 -0
- package/dist/elementRemainingControls-CtY2jZWN.cjs +266 -0
- package/dist/elementRemainingControls-CtY2jZWN.cjs.map +1 -0
- package/dist/export-CL36qPVY.cjs +79 -0
- package/dist/export-CL36qPVY.cjs.map +1 -0
- package/dist/export-DR1t4N5Q.js +74 -0
- package/dist/export-DR1t4N5Q.js.map +1 -0
- package/dist/export.cjs +3 -0
- package/dist/export.d.cts +8 -0
- package/dist/export.d.cts.map +1 -0
- package/dist/export.d.ts +8 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +2 -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-BA8vjGzr.cjs +201 -0
- package/dist/filters-BA8vjGzr.cjs.map +1 -0
- package/dist/filters-Dg22pfUy.js +191 -0
- package/dist/filters-Dg22pfUy.js.map +1 -0
- package/dist/filters.cjs +14 -0
- package/dist/filters.d.cts +54 -0
- package/dist/filters.d.cts.map +1 -0
- package/dist/filters.d.ts +54 -0
- package/dist/filters.d.ts.map +1 -0
- package/dist/filters.js +3 -0
- package/dist/find-in-table--8ZBYijC.js +57 -0
- package/dist/find-in-table--8ZBYijC.js.map +1 -0
- package/dist/find-in-table-DOn2Hua1.cjs +61 -0
- package/dist/find-in-table-DOn2Hua1.cjs.map +1 -0
- package/dist/find-in-table.cjs +3 -0
- package/dist/find-in-table.d.cts +9 -0
- package/dist/find-in-table.d.cts.map +1 -0
- package/dist/find-in-table.d.ts +9 -0
- package/dist/find-in-table.d.ts.map +1 -0
- package/dist/find-in-table.js +2 -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 +15 -0
- package/dist/fullscreen.cjs.map +1 -0
- package/dist/fullscreen.d.cts +6 -0
- package/dist/fullscreen.d.cts.map +1 -0
- package/dist/fullscreen.d.ts +6 -0
- package/dist/fullscreen.d.ts.map +1 -0
- package/dist/fullscreen.js +14 -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 +144 -0
- package/dist/grouping-panel.js.map +1 -0
- package/dist/grouping.cjs +41 -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 +22 -0
- package/dist/grouping.js.map +1 -0
- package/dist/header-filters-B_WFdnIO.js +67 -0
- package/dist/header-filters-B_WFdnIO.js.map +1 -0
- package/dist/header-filters-DnlmROS8.cjs +77 -0
- package/dist/header-filters-DnlmROS8.cjs.map +1 -0
- package/dist/header-filters.cjs +7 -0
- package/dist/header-filters.d.cts +24 -0
- package/dist/header-filters.d.cts.map +1 -0
- package/dist/header-filters.d.ts +24 -0
- package/dist/header-filters.d.ts.map +1 -0
- package/dist/header-filters.js +3 -0
- package/dist/index.cjs +485 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +25 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +483 -0
- package/dist/index.js.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 +82 -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 +81 -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 +15 -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 +14 -0
- package/dist/print.js.map +1 -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 +163 -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 +157 -0
- package/dist/row-reorder.js.map +1 -0
- package/dist/rowActionsSlot-CdnzwBmt.js +11 -0
- package/dist/rowActionsSlot-CdnzwBmt.js.map +1 -0
- package/dist/rowActionsSlot-Ps5hHI6n.cjs +21 -0
- package/dist/rowActionsSlot-Ps5hHI6n.cjs.map +1 -0
- package/dist/rows.cjs +30 -0
- package/dist/rows.d.cts +6 -0
- package/dist/rows.d.ts +6 -0
- package/dist/rows.js +4 -0
- package/dist/saved-views-BtC15-kG.js +135 -0
- package/dist/saved-views-BtC15-kG.js.map +1 -0
- package/dist/saved-views-DLiRBZ13.cjs +146 -0
- package/dist/saved-views-DLiRBZ13.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/scrollbarGutter-B-QczwA9.cjs +21 -0
- package/dist/scrollbarGutter-B-QczwA9.cjs.map +1 -0
- package/dist/scrollbarGutter-BNp0-4l1.js +16 -0
- package/dist/scrollbarGutter-BNp0-4l1.js.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 +29 -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 +28 -0
- package/dist/side-panel.js.map +1 -0
- package/dist/status-bar-C-XuZg77.cjs +78 -0
- package/dist/status-bar-C-XuZg77.cjs.map +1 -0
- package/dist/status-bar-DaWh0Agh.js +68 -0
- package/dist/status-bar-DaWh0Agh.js.map +1 -0
- package/dist/status-bar.cjs +4 -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 +2 -0
- package/dist/styles.css +434 -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-CLQKtnFl.d.cts +2 -0
- package/dist/types-CLQKtnFl.d.ts +2 -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 +465 -4
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { t as elementButton } from "./button-DwB4UxI2.js";
|
|
2
|
+
import { t as _sfc_main } from "./ElementInput-BsoAvPfO.js";
|
|
3
|
+
import { t as ElementCard } from "./ElementCard-DZdAU6x8.js";
|
|
4
|
+
import { defineComponent, h, nextTick, onScopeDispose, shallowRef, watch } from "vue";
|
|
5
|
+
import { managedCommandPaletteSurface, toVueAttrs, useScopeActivity } from "@adapttable/vue/adapter";
|
|
6
|
+
import { ElDialog, ElDivider, ElDropdown, ElDropdownItem, ElDropdownMenu } from "element-plus";
|
|
7
|
+
//#region src/actions/ElementCommandSurface.ts
|
|
8
|
+
/** ElDialog owns focus trapping, Escape and outside dismissal. */
|
|
9
|
+
const ElementCommandSurface = defineComponent((props) => {
|
|
10
|
+
const active = useScopeActivity();
|
|
11
|
+
const body = shallowRef(null);
|
|
12
|
+
return () => {
|
|
13
|
+
const owner = props.control;
|
|
14
|
+
return h(ElDialog, {
|
|
15
|
+
modelValue: active.value && owner.open && owner.isCurrent(),
|
|
16
|
+
title: owner.label,
|
|
17
|
+
class: owner.className,
|
|
18
|
+
dir: props.dir,
|
|
19
|
+
appendTo: props.container ?? "body",
|
|
20
|
+
appendToBody: true,
|
|
21
|
+
width: "min(32rem, calc(100vw - 2rem))",
|
|
22
|
+
destroyOnClose: true,
|
|
23
|
+
showClose: false,
|
|
24
|
+
closeOnClickModal: true,
|
|
25
|
+
closeOnPressEscape: true,
|
|
26
|
+
beforeClose: () => {
|
|
27
|
+
if (active.value && owner.isCurrent()) owner.onClose();
|
|
28
|
+
}
|
|
29
|
+
}, { default: () => h("div", {
|
|
30
|
+
ref: body,
|
|
31
|
+
"data-adapttable-part": "command-palette"
|
|
32
|
+
}, [owner.children]) });
|
|
33
|
+
};
|
|
34
|
+
}, {
|
|
35
|
+
name: "ElementCommandSurface",
|
|
36
|
+
props: {
|
|
37
|
+
control: { type: Object },
|
|
38
|
+
container: { type: Object },
|
|
39
|
+
dir: { type: String }
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/actions/ElementContextSurface.ts
|
|
44
|
+
/** The public dropdown API synchronizes the primitive with the binding's open session. */
|
|
45
|
+
const ElementContextSurface = defineComponent((props) => {
|
|
46
|
+
const active = useScopeActivity();
|
|
47
|
+
const control = shallowRef();
|
|
48
|
+
let live = true;
|
|
49
|
+
let generation = 0;
|
|
50
|
+
onScopeDispose(() => {
|
|
51
|
+
live = false;
|
|
52
|
+
generation++;
|
|
53
|
+
});
|
|
54
|
+
const virtualAnchor = {
|
|
55
|
+
getBoundingClientRect: () => new DOMRect(props.at.x, props.at.y, 0, 0),
|
|
56
|
+
get contextElement() {
|
|
57
|
+
return props.anchorRef.current ?? void 0;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
watch([active, () => props.at], () => {
|
|
61
|
+
generation++;
|
|
62
|
+
}, {
|
|
63
|
+
flush: "sync",
|
|
64
|
+
immediate: true
|
|
65
|
+
});
|
|
66
|
+
watch([
|
|
67
|
+
active,
|
|
68
|
+
control,
|
|
69
|
+
() => props.at
|
|
70
|
+
], () => {
|
|
71
|
+
const ticket = generation;
|
|
72
|
+
nextTick(() => {
|
|
73
|
+
if (live && active.value && ticket === generation) control.value?.handleOpen();
|
|
74
|
+
else if (!active.value) control.value?.handleClose();
|
|
75
|
+
});
|
|
76
|
+
}, {
|
|
77
|
+
flush: "post",
|
|
78
|
+
immediate: true
|
|
79
|
+
});
|
|
80
|
+
return () => {
|
|
81
|
+
if (!active.value) return null;
|
|
82
|
+
const at = props.at;
|
|
83
|
+
const ticket = generation;
|
|
84
|
+
const onClose = props.onClose;
|
|
85
|
+
const isCurrent = () => live && active.value && ticket === generation && props.at === at && props.onClose === onClose;
|
|
86
|
+
return h(ElDropdown, {
|
|
87
|
+
ref: control,
|
|
88
|
+
virtualTriggering: true,
|
|
89
|
+
virtualRef: virtualAnchor,
|
|
90
|
+
trigger: "contextmenu",
|
|
91
|
+
role: "menu",
|
|
92
|
+
showTimeout: 0,
|
|
93
|
+
hideTimeout: 0,
|
|
94
|
+
hideOnClick: false,
|
|
95
|
+
placement: "bottom-start",
|
|
96
|
+
appendTo: props.container ?? "body",
|
|
97
|
+
teleported: true,
|
|
98
|
+
persistent: false,
|
|
99
|
+
showArrow: false,
|
|
100
|
+
maxHeight: "min(70vh, 32rem)",
|
|
101
|
+
popperStyle: { maxWidth: "calc(100vw - 1rem)" },
|
|
102
|
+
onVisibleChange: (visible) => {
|
|
103
|
+
if (visible || !isCurrent()) return;
|
|
104
|
+
onClose();
|
|
105
|
+
nextTick(() => {
|
|
106
|
+
if (isCurrent()) control.value?.handleOpen();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}, { dropdown: () => h(ElDropdownMenu, {
|
|
110
|
+
"aria-label": props.label,
|
|
111
|
+
class: props.className,
|
|
112
|
+
dir: props.dir,
|
|
113
|
+
"data-adapttable-part": "context-menu",
|
|
114
|
+
onKeydown: (event) => {
|
|
115
|
+
if (!isCurrent() || event.key !== "Escape" || event.defaultPrevented || event.isComposing || !(event.target instanceof Element) || event.target.closest("[role=\"menu\"]") !== event.currentTarget) return;
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
control.value?.handleClose();
|
|
119
|
+
},
|
|
120
|
+
onFocus: (event) => {
|
|
121
|
+
if (!isCurrent() || event.target !== event.currentTarget || !(event.currentTarget instanceof HTMLElement)) return;
|
|
122
|
+
event.currentTarget.querySelector("[role=\"menuitem\"]:not([aria-disabled=\"true\"])")?.focus();
|
|
123
|
+
}
|
|
124
|
+
}, { default: () => props.children }) });
|
|
125
|
+
};
|
|
126
|
+
}, {
|
|
127
|
+
name: "ElementContextSurface",
|
|
128
|
+
props: {
|
|
129
|
+
at: { type: Object },
|
|
130
|
+
anchorRef: { type: Object },
|
|
131
|
+
label: { type: String },
|
|
132
|
+
onClose: { type: Function },
|
|
133
|
+
container: { type: Object },
|
|
134
|
+
children: {
|
|
135
|
+
type: [
|
|
136
|
+
String,
|
|
137
|
+
Number,
|
|
138
|
+
Boolean,
|
|
139
|
+
Array,
|
|
140
|
+
Object
|
|
141
|
+
],
|
|
142
|
+
default: void 0
|
|
143
|
+
},
|
|
144
|
+
className: { type: String },
|
|
145
|
+
dir: { type: String }
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/actions/elementRemainingControls.ts
|
|
150
|
+
const elementActionButton = ({ attrs, label, icon }) => elementButton(attrs, [icon, label]);
|
|
151
|
+
const elementPaletteSlots = (names = () => ({}), container = () => void 0, dir = () => void 0) => ({
|
|
152
|
+
Surface: managedCommandPaletteSurface((control) => h(ElementCommandSurface, {
|
|
153
|
+
control,
|
|
154
|
+
container: container(),
|
|
155
|
+
dir: dir()
|
|
156
|
+
})),
|
|
157
|
+
Input: ({ inputProps }) => {
|
|
158
|
+
const { onChange, ref, value, ...attrs } = inputProps;
|
|
159
|
+
return h(_sfc_main, {
|
|
160
|
+
...toVueAttrs(attrs),
|
|
161
|
+
value,
|
|
162
|
+
inputRef: (element) => {
|
|
163
|
+
if (element instanceof HTMLInputElement || element === null) ref(element);
|
|
164
|
+
},
|
|
165
|
+
class: names().commandInput,
|
|
166
|
+
onChange
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
Item: ({ command, itemProps }) => elementButton({
|
|
170
|
+
...toVueAttrs(itemProps),
|
|
171
|
+
class: names().commandItem,
|
|
172
|
+
type: "button",
|
|
173
|
+
tabindex: -1,
|
|
174
|
+
disabled: command.disabled
|
|
175
|
+
}, command.label),
|
|
176
|
+
Empty: ({ message }) => h("p", {
|
|
177
|
+
"data-adapttable-part": "command-empty",
|
|
178
|
+
class: names().commandEmpty
|
|
179
|
+
}, message)
|
|
180
|
+
});
|
|
181
|
+
const elementContextMenuSlots = (names = () => ({}), dir = () => void 0) => ({
|
|
182
|
+
Surface: (props) => h(ElementContextSurface, {
|
|
183
|
+
...props,
|
|
184
|
+
dir: dir()
|
|
185
|
+
}),
|
|
186
|
+
Item: ({ item, onSelect }) => h(ElDropdownItem, {
|
|
187
|
+
disabled: item.disabled,
|
|
188
|
+
textValue: item.label,
|
|
189
|
+
"aria-disabled": item.disabled,
|
|
190
|
+
"data-danger": item.danger ? "" : void 0,
|
|
191
|
+
"data-adapttable-part": "context-menu-item",
|
|
192
|
+
class: names().contextMenuItem,
|
|
193
|
+
onClick: onSelect
|
|
194
|
+
}, { default: () => item.label }),
|
|
195
|
+
Separator: () => h(ElDivider, {
|
|
196
|
+
role: "separator",
|
|
197
|
+
"data-adapttable-part": "context-menu-separator",
|
|
198
|
+
class: names().contextMenuSeparator
|
|
199
|
+
})
|
|
200
|
+
});
|
|
201
|
+
const elementSidePanelSlots = (names = () => ({})) => {
|
|
202
|
+
let closeChoice;
|
|
203
|
+
return {
|
|
204
|
+
Frame: (props) => {
|
|
205
|
+
const close = closeChoice;
|
|
206
|
+
return h(ElementCard, { attrs: {
|
|
207
|
+
"data-adapttable-part": "side-panel",
|
|
208
|
+
class: props.className,
|
|
209
|
+
"data-side": props.side,
|
|
210
|
+
style: {
|
|
211
|
+
minWidth: "min(18rem,100%)",
|
|
212
|
+
maxWidth: "100%"
|
|
213
|
+
},
|
|
214
|
+
onKeydownCapture: (event) => {
|
|
215
|
+
const target = event.target;
|
|
216
|
+
if (event.key === "Escape" && !event.defaultPrevented && !event.isComposing && target instanceof Element && target.getAttribute("role") === "combobox" && target.getAttribute("aria-expanded") === "false" && !target.closest("[role=\"dialog\"],[role=\"menu\"]")) {
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
event.stopPropagation();
|
|
219
|
+
close?.();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
} }, { default: () => props.children });
|
|
223
|
+
},
|
|
224
|
+
Tab: (props) => elementButton({
|
|
225
|
+
...toVueAttrs(props.buttonProps),
|
|
226
|
+
class: names().sidePanelTab
|
|
227
|
+
}, props.panel.label),
|
|
228
|
+
Close: (props) => {
|
|
229
|
+
closeChoice = props.onClose;
|
|
230
|
+
return elementButton({
|
|
231
|
+
type: "button",
|
|
232
|
+
"aria-label": props.label,
|
|
233
|
+
"data-adapttable-part": "side-panel-close",
|
|
234
|
+
class: names().sidePanelClose,
|
|
235
|
+
onClick: props.onClose
|
|
236
|
+
}, props.label);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
//#endregion
|
|
241
|
+
export { elementSidePanelSlots as i, elementContextMenuSlots as n, elementPaletteSlots as r, elementActionButton as t };
|
|
242
|
+
|
|
243
|
+
//# sourceMappingURL=elementRemainingControls-BPGBbbUF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elementRemainingControls-BPGBbbUF.js","names":["ElementInput"],"sources":["../src/actions/ElementCommandSurface.ts","../src/actions/ElementContextSurface.ts","../src/actions/elementRemainingControls.ts"],"sourcesContent":["import {\n type ManagedCommandPaletteSurfaceProps,\n useScopeActivity,\n} from \"@adapttable/vue/adapter\";\nimport { ElDialog } from \"element-plus\";\nimport { defineComponent, h, type PropType, shallowRef } from \"vue\";\n/** ElDialog owns focus trapping, Escape and outside dismissal. */\nexport const ElementCommandSurface = defineComponent(\n (props: {\n readonly control: ManagedCommandPaletteSurfaceProps;\n readonly container?: HTMLElement;\n readonly dir?: \"ltr\" | \"rtl\";\n }) => {\n const active = useScopeActivity();\n const body = shallowRef<HTMLElement | null>(null);\n return () => {\n const owner = props.control;\n return h(\n ElDialog,\n {\n modelValue: active.value && owner.open && owner.isCurrent(),\n title: owner.label,\n class: owner.className,\n dir: props.dir,\n appendTo: props.container ?? \"body\",\n appendToBody: true,\n width: \"min(32rem, calc(100vw - 2rem))\",\n destroyOnClose: true,\n showClose: false,\n closeOnClickModal: true,\n closeOnPressEscape: true,\n beforeClose: () => {\n if (active.value && owner.isCurrent()) owner.onClose();\n },\n },\n {\n default: () =>\n h(\"div\", { ref: body, \"data-adapttable-part\": \"command-palette\" }, [\n owner.children,\n ]),\n }\n );\n };\n },\n {\n name: \"ElementCommandSurface\",\n props: {\n control: { type: Object as PropType<ManagedCommandPaletteSurfaceProps> },\n container: { type: Object as PropType<HTMLElement | undefined> },\n dir: { type: String as PropType<(\"ltr\" | \"rtl\") | undefined> },\n },\n }\n);\n","import {\n type ContextMenuSurfaceProps,\n useScopeActivity,\n} from \"@adapttable/vue/adapter\";\nimport {\n type DropdownInstance,\n ElDropdown,\n ElDropdownMenu,\n} from \"element-plus\";\nimport {\n defineComponent,\n h,\n nextTick,\n onScopeDispose,\n type PropType,\n shallowRef,\n type VNodeChild,\n watch,\n} from \"vue\";\n/** The public dropdown API synchronizes the primitive with the binding's open session. */\nexport const ElementContextSurface = defineComponent(\n (\n props: ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n }\n ) => {\n const active = useScopeActivity();\n const control = shallowRef<DropdownInstance>();\n let live = true;\n let generation = 0;\n onScopeDispose(() => {\n live = false;\n generation++;\n });\n const virtualAnchor = {\n getBoundingClientRect: () => new DOMRect(props.at.x, props.at.y, 0, 0),\n get contextElement() {\n return props.anchorRef.current ?? undefined;\n },\n };\n watch(\n [active, () => props.at],\n () => {\n generation++;\n },\n { flush: \"sync\", immediate: true }\n );\n watch(\n [active, control, () => props.at],\n () => {\n const ticket = generation;\n void nextTick(() => {\n if (live && active.value && ticket === generation)\n control.value?.handleOpen();\n else if (!active.value) control.value?.handleClose();\n });\n },\n { flush: \"post\", immediate: true }\n );\n return () => {\n if (!active.value) return null;\n const at = props.at;\n const ticket = generation;\n const onClose = props.onClose;\n const isCurrent = () =>\n live &&\n active.value &&\n ticket === generation &&\n props.at === at &&\n props.onClose === onClose;\n return h(\n ElDropdown,\n {\n ref: control,\n virtualTriggering: true,\n virtualRef: virtualAnchor,\n trigger: \"contextmenu\",\n role: \"menu\",\n showTimeout: 0,\n hideTimeout: 0,\n hideOnClick: false,\n placement: \"bottom-start\",\n appendTo: props.container ?? \"body\",\n teleported: true,\n persistent: false,\n showArrow: false,\n maxHeight: \"min(70vh, 32rem)\",\n popperStyle: { maxWidth: \"calc(100vw - 1rem)\" },\n onVisibleChange: (visible: boolean) => {\n if (visible || !isCurrent()) return;\n onClose();\n // A rejected controlled close keeps the same native session open.\n void nextTick(() => {\n if (isCurrent()) control.value?.handleOpen();\n });\n },\n },\n {\n dropdown: () =>\n h(\n ElDropdownMenu,\n {\n \"aria-label\": props.label,\n class: props.className,\n dir: props.dir,\n \"data-adapttable-part\": \"context-menu\",\n onKeydown: (event: KeyboardEvent) => {\n if (\n !isCurrent() ||\n event.key !== \"Escape\" ||\n event.defaultPrevented ||\n event.isComposing ||\n !(event.target instanceof Element) ||\n event.target.closest('[role=\"menu\"]') !==\n event.currentTarget\n )\n return;\n event.preventDefault();\n event.stopPropagation();\n control.value?.handleClose();\n },\n onFocus: (event: FocusEvent) => {\n if (\n !isCurrent() ||\n event.target !== event.currentTarget ||\n !(event.currentTarget instanceof HTMLElement)\n )\n return;\n event.currentTarget\n .querySelector<HTMLElement>(\n '[role=\"menuitem\"]:not([aria-disabled=\"true\"])'\n )\n ?.focus();\n },\n },\n { default: () => props.children }\n ),\n }\n );\n };\n },\n {\n name: \"ElementContextSurface\",\n props: {\n at: {\n type: Object as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"at\"]\n >,\n },\n anchorRef: {\n type: Object as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"anchorRef\"]\n >,\n },\n label: {\n type: String as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"label\"]\n >,\n },\n onClose: {\n type: Function as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"onClose\"]\n >,\n },\n container: {\n type: Object as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"container\"]\n >,\n },\n children: {\n type: [String, Number, Boolean, Array, Object] as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"children\"]\n >,\n default: undefined,\n },\n className: {\n type: String as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"className\"]\n >,\n },\n dir: {\n type: String as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"dir\"]\n >,\n },\n },\n }\n);\n","import {\n type ActionButton,\n type CommandPaletteSlots,\n type ContextMenuSlots,\n managedCommandPaletteSurface,\n type SidePanelSlots,\n toVueAttrs,\n} from \"@adapttable/vue/adapter\";\nimport { ElDivider, ElDropdownItem } from \"element-plus\";\nimport { h } from \"vue\";\n\nimport { elementButton } from \"../controls/button\";\nimport ElementInput from \"../controls/ElementInput.vue\";\nimport { ElementCard } from \"../presentation/ElementCard\";\nimport { ElementCommandSurface } from \"./ElementCommandSurface\";\nimport { ElementContextSurface } from \"./ElementContextSurface\";\nexport const elementActionButton = ({ attrs, label, icon }: ActionButton) =>\n elementButton(attrs, [icon, label]);\nexport const elementPaletteSlots = (\n names: () => Readonly<Record<string, string | undefined>> = () => ({}),\n container: () => HTMLElement | undefined = () => undefined,\n dir: () => \"ltr\" | \"rtl\" | undefined = () => undefined\n): CommandPaletteSlots => ({\n Surface: managedCommandPaletteSurface((control) =>\n h(ElementCommandSurface, { control, container: container(), dir: dir() })\n ),\n Input: ({ inputProps }) => {\n const { onChange, ref, value, ...attrs } = inputProps;\n return h(ElementInput, {\n ...toVueAttrs(attrs),\n value,\n inputRef: (element) => {\n if (element instanceof HTMLInputElement || element === null)\n ref(element);\n },\n class: names().commandInput,\n onChange,\n });\n },\n Item: ({ command, itemProps }) =>\n elementButton(\n {\n ...toVueAttrs(itemProps),\n class: names().commandItem,\n type: \"button\",\n tabindex: -1,\n disabled: command.disabled,\n },\n command.label\n ),\n Empty: ({ message }) =>\n h(\n \"p\",\n { \"data-adapttable-part\": \"command-empty\", class: names().commandEmpty },\n message\n ),\n});\nexport const elementContextMenuSlots = (\n names: () => Readonly<Record<string, string | undefined>> = () => ({}),\n dir: () => \"ltr\" | \"rtl\" | undefined = () => undefined\n): ContextMenuSlots => ({\n Surface: (props) => h(ElementContextSurface, { ...props, dir: dir() }),\n Item: ({ item, onSelect }) =>\n h(\n ElDropdownItem,\n {\n disabled: item.disabled,\n textValue: item.label,\n \"aria-disabled\": item.disabled,\n \"data-danger\": item.danger ? \"\" : undefined,\n \"data-adapttable-part\": \"context-menu-item\",\n class: names().contextMenuItem,\n onClick: onSelect,\n },\n { default: () => item.label }\n ),\n Separator: () =>\n h(ElDivider, {\n role: \"separator\",\n \"data-adapttable-part\": \"context-menu-separator\",\n class: names().contextMenuSeparator,\n }),\n});\nexport const elementSidePanelSlots = (\n names: () => Readonly<Record<string, string | undefined>> = () => ({})\n): SidePanelSlots => {\n let closeChoice: (() => void) | undefined;\n return {\n Frame: (props) => {\n const close = closeChoice;\n return h(\n ElementCard,\n {\n attrs: {\n \"data-adapttable-part\": \"side-panel\",\n class: props.className,\n \"data-side\": props.side,\n style: { minWidth: \"min(18rem,100%)\", maxWidth: \"100%\" },\n onKeydownCapture: (event: KeyboardEvent) => {\n const target = event.target;\n // ElSelect stops Escape even while closed; forward that case to the\n // binding's current close callback before the native event is consumed.\n if (\n event.key === \"Escape\" &&\n !event.defaultPrevented &&\n !event.isComposing &&\n target instanceof Element &&\n target.getAttribute(\"role\") === \"combobox\" &&\n target.getAttribute(\"aria-expanded\") === \"false\" &&\n !target.closest('[role=\"dialog\"],[role=\"menu\"]')\n ) {\n event.preventDefault();\n event.stopPropagation();\n close?.();\n }\n },\n },\n },\n { default: () => props.children }\n );\n },\n Tab: (props) =>\n elementButton(\n { ...toVueAttrs(props.buttonProps), class: names().sidePanelTab },\n props.panel.label\n ),\n Close: (props) => {\n closeChoice = props.onClose;\n return elementButton(\n {\n type: \"button\",\n \"aria-label\": props.label,\n \"data-adapttable-part\": \"side-panel-close\",\n class: names().sidePanelClose,\n onClick: props.onClose,\n },\n props.label\n );\n },\n };\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,wBAAwB,iBAClC,UAIK;CACJ,MAAM,SAAS,iBAAiB;CAChC,MAAM,OAAO,WAA+B,IAAI;CAChD,aAAa;EACX,MAAM,QAAQ,MAAM;EACpB,OAAO,EACL,UACA;GACE,YAAY,OAAO,SAAS,MAAM,QAAQ,MAAM,UAAU;GAC1D,OAAO,MAAM;GACb,OAAO,MAAM;GACb,KAAK,MAAM;GACX,UAAU,MAAM,aAAa;GAC7B,cAAc;GACd,OAAO;GACP,gBAAgB;GAChB,WAAW;GACX,mBAAmB;GACnB,oBAAoB;GACpB,mBAAmB;IACjB,IAAI,OAAO,SAAS,MAAM,UAAU,GAAG,MAAM,QAAQ;GACvD;EACF,GACA,EACE,eACE,EAAE,OAAO;GAAE,KAAK;GAAM,wBAAwB;EAAkB,GAAG,CACjE,MAAM,QACR,CAAC,EACL,CACF;CACF;AACF,GACA;CACE,MAAM;CACN,OAAO;EACL,SAAS,EAAE,MAAM,OAAsD;EACvE,WAAW,EAAE,MAAM,OAA4C;EAC/D,KAAK,EAAE,MAAM,OAAgD;CAC/D;AACF,CACF;;;;AChCA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WACzC,CAAC,OAAO,QAAQ,mCAA+B,GAC/C;MACA,MAAM,eAAe;MACrB,MAAM,gBAAgB;MACtB,QAAQ;KACV;IACF;GACF,EACF,GACA,EAAE,eAAe,MAAM,SAAS,CAClC;EACF;EACA,MAAM,UACJ,cACE;GAAE,GAAG,WAAW,MAAM,WAAW;GAAG,OAAO,MAAM,CAAC,CAAC;EAAa,GAChE,MAAM,MAAM,KACd;EACF,QAAQ,UAAU;GAChB,cAAc,MAAM;GACpB,OAAO,cACL;IACE,MAAM;IACN,cAAc,MAAM;IACpB,wBAAwB;IACxB,OAAO,MAAM,CAAC,CAAC;IACf,SAAS,MAAM;GACjB,GACA,MAAM,KACR;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
const require_button = require("./button-BFjBL9m3.cjs");
|
|
2
|
+
const require_ElementInput = require("./ElementInput-vBVDBaLp.cjs");
|
|
3
|
+
const require_ElementCard = require("./ElementCard-BRZekaHr.cjs");
|
|
4
|
+
let vue = require("vue");
|
|
5
|
+
let _adapttable_vue_adapter = require("@adapttable/vue/adapter");
|
|
6
|
+
let element_plus = require("element-plus");
|
|
7
|
+
//#region src/actions/ElementCommandSurface.ts
|
|
8
|
+
/** ElDialog owns focus trapping, Escape and outside dismissal. */
|
|
9
|
+
const ElementCommandSurface = (0, vue.defineComponent)((props) => {
|
|
10
|
+
const active = (0, _adapttable_vue_adapter.useScopeActivity)();
|
|
11
|
+
const body = (0, vue.shallowRef)(null);
|
|
12
|
+
return () => {
|
|
13
|
+
const owner = props.control;
|
|
14
|
+
return (0, vue.h)(element_plus.ElDialog, {
|
|
15
|
+
modelValue: active.value && owner.open && owner.isCurrent(),
|
|
16
|
+
title: owner.label,
|
|
17
|
+
class: owner.className,
|
|
18
|
+
dir: props.dir,
|
|
19
|
+
appendTo: props.container ?? "body",
|
|
20
|
+
appendToBody: true,
|
|
21
|
+
width: "min(32rem, calc(100vw - 2rem))",
|
|
22
|
+
destroyOnClose: true,
|
|
23
|
+
showClose: false,
|
|
24
|
+
closeOnClickModal: true,
|
|
25
|
+
closeOnPressEscape: true,
|
|
26
|
+
beforeClose: () => {
|
|
27
|
+
if (active.value && owner.isCurrent()) owner.onClose();
|
|
28
|
+
}
|
|
29
|
+
}, { default: () => (0, vue.h)("div", {
|
|
30
|
+
ref: body,
|
|
31
|
+
"data-adapttable-part": "command-palette"
|
|
32
|
+
}, [owner.children]) });
|
|
33
|
+
};
|
|
34
|
+
}, {
|
|
35
|
+
name: "ElementCommandSurface",
|
|
36
|
+
props: {
|
|
37
|
+
control: { type: Object },
|
|
38
|
+
container: { type: Object },
|
|
39
|
+
dir: { type: String }
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/actions/ElementContextSurface.ts
|
|
44
|
+
/** The public dropdown API synchronizes the primitive with the binding's open session. */
|
|
45
|
+
const ElementContextSurface = (0, vue.defineComponent)((props) => {
|
|
46
|
+
const active = (0, _adapttable_vue_adapter.useScopeActivity)();
|
|
47
|
+
const control = (0, vue.shallowRef)();
|
|
48
|
+
let live = true;
|
|
49
|
+
let generation = 0;
|
|
50
|
+
(0, vue.onScopeDispose)(() => {
|
|
51
|
+
live = false;
|
|
52
|
+
generation++;
|
|
53
|
+
});
|
|
54
|
+
const virtualAnchor = {
|
|
55
|
+
getBoundingClientRect: () => new DOMRect(props.at.x, props.at.y, 0, 0),
|
|
56
|
+
get contextElement() {
|
|
57
|
+
return props.anchorRef.current ?? void 0;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
(0, vue.watch)([active, () => props.at], () => {
|
|
61
|
+
generation++;
|
|
62
|
+
}, {
|
|
63
|
+
flush: "sync",
|
|
64
|
+
immediate: true
|
|
65
|
+
});
|
|
66
|
+
(0, vue.watch)([
|
|
67
|
+
active,
|
|
68
|
+
control,
|
|
69
|
+
() => props.at
|
|
70
|
+
], () => {
|
|
71
|
+
const ticket = generation;
|
|
72
|
+
(0, vue.nextTick)(() => {
|
|
73
|
+
if (live && active.value && ticket === generation) control.value?.handleOpen();
|
|
74
|
+
else if (!active.value) control.value?.handleClose();
|
|
75
|
+
});
|
|
76
|
+
}, {
|
|
77
|
+
flush: "post",
|
|
78
|
+
immediate: true
|
|
79
|
+
});
|
|
80
|
+
return () => {
|
|
81
|
+
if (!active.value) return null;
|
|
82
|
+
const at = props.at;
|
|
83
|
+
const ticket = generation;
|
|
84
|
+
const onClose = props.onClose;
|
|
85
|
+
const isCurrent = () => live && active.value && ticket === generation && props.at === at && props.onClose === onClose;
|
|
86
|
+
return (0, vue.h)(element_plus.ElDropdown, {
|
|
87
|
+
ref: control,
|
|
88
|
+
virtualTriggering: true,
|
|
89
|
+
virtualRef: virtualAnchor,
|
|
90
|
+
trigger: "contextmenu",
|
|
91
|
+
role: "menu",
|
|
92
|
+
showTimeout: 0,
|
|
93
|
+
hideTimeout: 0,
|
|
94
|
+
hideOnClick: false,
|
|
95
|
+
placement: "bottom-start",
|
|
96
|
+
appendTo: props.container ?? "body",
|
|
97
|
+
teleported: true,
|
|
98
|
+
persistent: false,
|
|
99
|
+
showArrow: false,
|
|
100
|
+
maxHeight: "min(70vh, 32rem)",
|
|
101
|
+
popperStyle: { maxWidth: "calc(100vw - 1rem)" },
|
|
102
|
+
onVisibleChange: (visible) => {
|
|
103
|
+
if (visible || !isCurrent()) return;
|
|
104
|
+
onClose();
|
|
105
|
+
(0, vue.nextTick)(() => {
|
|
106
|
+
if (isCurrent()) control.value?.handleOpen();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}, { dropdown: () => (0, vue.h)(element_plus.ElDropdownMenu, {
|
|
110
|
+
"aria-label": props.label,
|
|
111
|
+
class: props.className,
|
|
112
|
+
dir: props.dir,
|
|
113
|
+
"data-adapttable-part": "context-menu",
|
|
114
|
+
onKeydown: (event) => {
|
|
115
|
+
if (!isCurrent() || event.key !== "Escape" || event.defaultPrevented || event.isComposing || !(event.target instanceof Element) || event.target.closest("[role=\"menu\"]") !== event.currentTarget) return;
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
control.value?.handleClose();
|
|
119
|
+
},
|
|
120
|
+
onFocus: (event) => {
|
|
121
|
+
if (!isCurrent() || event.target !== event.currentTarget || !(event.currentTarget instanceof HTMLElement)) return;
|
|
122
|
+
event.currentTarget.querySelector("[role=\"menuitem\"]:not([aria-disabled=\"true\"])")?.focus();
|
|
123
|
+
}
|
|
124
|
+
}, { default: () => props.children }) });
|
|
125
|
+
};
|
|
126
|
+
}, {
|
|
127
|
+
name: "ElementContextSurface",
|
|
128
|
+
props: {
|
|
129
|
+
at: { type: Object },
|
|
130
|
+
anchorRef: { type: Object },
|
|
131
|
+
label: { type: String },
|
|
132
|
+
onClose: { type: Function },
|
|
133
|
+
container: { type: Object },
|
|
134
|
+
children: {
|
|
135
|
+
type: [
|
|
136
|
+
String,
|
|
137
|
+
Number,
|
|
138
|
+
Boolean,
|
|
139
|
+
Array,
|
|
140
|
+
Object
|
|
141
|
+
],
|
|
142
|
+
default: void 0
|
|
143
|
+
},
|
|
144
|
+
className: { type: String },
|
|
145
|
+
dir: { type: String }
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/actions/elementRemainingControls.ts
|
|
150
|
+
const elementActionButton = ({ attrs, label, icon }) => require_button.elementButton(attrs, [icon, label]);
|
|
151
|
+
const elementPaletteSlots = (names = () => ({}), container = () => void 0, dir = () => void 0) => ({
|
|
152
|
+
Surface: (0, _adapttable_vue_adapter.managedCommandPaletteSurface)((control) => (0, vue.h)(ElementCommandSurface, {
|
|
153
|
+
control,
|
|
154
|
+
container: container(),
|
|
155
|
+
dir: dir()
|
|
156
|
+
})),
|
|
157
|
+
Input: ({ inputProps }) => {
|
|
158
|
+
const { onChange, ref, value, ...attrs } = inputProps;
|
|
159
|
+
return (0, vue.h)(require_ElementInput._sfc_main, {
|
|
160
|
+
...(0, _adapttable_vue_adapter.toVueAttrs)(attrs),
|
|
161
|
+
value,
|
|
162
|
+
inputRef: (element) => {
|
|
163
|
+
if (element instanceof HTMLInputElement || element === null) ref(element);
|
|
164
|
+
},
|
|
165
|
+
class: names().commandInput,
|
|
166
|
+
onChange
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
Item: ({ command, itemProps }) => require_button.elementButton({
|
|
170
|
+
...(0, _adapttable_vue_adapter.toVueAttrs)(itemProps),
|
|
171
|
+
class: names().commandItem,
|
|
172
|
+
type: "button",
|
|
173
|
+
tabindex: -1,
|
|
174
|
+
disabled: command.disabled
|
|
175
|
+
}, command.label),
|
|
176
|
+
Empty: ({ message }) => (0, vue.h)("p", {
|
|
177
|
+
"data-adapttable-part": "command-empty",
|
|
178
|
+
class: names().commandEmpty
|
|
179
|
+
}, message)
|
|
180
|
+
});
|
|
181
|
+
const elementContextMenuSlots = (names = () => ({}), dir = () => void 0) => ({
|
|
182
|
+
Surface: (props) => (0, vue.h)(ElementContextSurface, {
|
|
183
|
+
...props,
|
|
184
|
+
dir: dir()
|
|
185
|
+
}),
|
|
186
|
+
Item: ({ item, onSelect }) => (0, vue.h)(element_plus.ElDropdownItem, {
|
|
187
|
+
disabled: item.disabled,
|
|
188
|
+
textValue: item.label,
|
|
189
|
+
"aria-disabled": item.disabled,
|
|
190
|
+
"data-danger": item.danger ? "" : void 0,
|
|
191
|
+
"data-adapttable-part": "context-menu-item",
|
|
192
|
+
class: names().contextMenuItem,
|
|
193
|
+
onClick: onSelect
|
|
194
|
+
}, { default: () => item.label }),
|
|
195
|
+
Separator: () => (0, vue.h)(element_plus.ElDivider, {
|
|
196
|
+
role: "separator",
|
|
197
|
+
"data-adapttable-part": "context-menu-separator",
|
|
198
|
+
class: names().contextMenuSeparator
|
|
199
|
+
})
|
|
200
|
+
});
|
|
201
|
+
const elementSidePanelSlots = (names = () => ({})) => {
|
|
202
|
+
let closeChoice;
|
|
203
|
+
return {
|
|
204
|
+
Frame: (props) => {
|
|
205
|
+
const close = closeChoice;
|
|
206
|
+
return (0, vue.h)(require_ElementCard.ElementCard, { attrs: {
|
|
207
|
+
"data-adapttable-part": "side-panel",
|
|
208
|
+
class: props.className,
|
|
209
|
+
"data-side": props.side,
|
|
210
|
+
style: {
|
|
211
|
+
minWidth: "min(18rem,100%)",
|
|
212
|
+
maxWidth: "100%"
|
|
213
|
+
},
|
|
214
|
+
onKeydownCapture: (event) => {
|
|
215
|
+
const target = event.target;
|
|
216
|
+
if (event.key === "Escape" && !event.defaultPrevented && !event.isComposing && target instanceof Element && target.getAttribute("role") === "combobox" && target.getAttribute("aria-expanded") === "false" && !target.closest("[role=\"dialog\"],[role=\"menu\"]")) {
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
event.stopPropagation();
|
|
219
|
+
close?.();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
} }, { default: () => props.children });
|
|
223
|
+
},
|
|
224
|
+
Tab: (props) => require_button.elementButton({
|
|
225
|
+
...(0, _adapttable_vue_adapter.toVueAttrs)(props.buttonProps),
|
|
226
|
+
class: names().sidePanelTab
|
|
227
|
+
}, props.panel.label),
|
|
228
|
+
Close: (props) => {
|
|
229
|
+
closeChoice = props.onClose;
|
|
230
|
+
return require_button.elementButton({
|
|
231
|
+
type: "button",
|
|
232
|
+
"aria-label": props.label,
|
|
233
|
+
"data-adapttable-part": "side-panel-close",
|
|
234
|
+
class: names().sidePanelClose,
|
|
235
|
+
onClick: props.onClose
|
|
236
|
+
}, props.label);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
//#endregion
|
|
241
|
+
Object.defineProperty(exports, "elementActionButton", {
|
|
242
|
+
enumerable: true,
|
|
243
|
+
get: function() {
|
|
244
|
+
return elementActionButton;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
Object.defineProperty(exports, "elementContextMenuSlots", {
|
|
248
|
+
enumerable: true,
|
|
249
|
+
get: function() {
|
|
250
|
+
return elementContextMenuSlots;
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
Object.defineProperty(exports, "elementPaletteSlots", {
|
|
254
|
+
enumerable: true,
|
|
255
|
+
get: function() {
|
|
256
|
+
return elementPaletteSlots;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
Object.defineProperty(exports, "elementSidePanelSlots", {
|
|
260
|
+
enumerable: true,
|
|
261
|
+
get: function() {
|
|
262
|
+
return elementSidePanelSlots;
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
//# sourceMappingURL=elementRemainingControls-CtY2jZWN.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elementRemainingControls-CtY2jZWN.cjs","names":["defineComponent","useScopeActivity","shallowRef","h","ElDialog","defineComponent","useScopeActivity","shallowRef","nextTick","h","ElDropdown","ElDropdownMenu","elementButton","managedCommandPaletteSurface","h","ElementInput","toVueAttrs","ElDropdownItem","ElDivider","ElementCard"],"sources":["../src/actions/ElementCommandSurface.ts","../src/actions/ElementContextSurface.ts","../src/actions/elementRemainingControls.ts"],"sourcesContent":["import {\n type ManagedCommandPaletteSurfaceProps,\n useScopeActivity,\n} from \"@adapttable/vue/adapter\";\nimport { ElDialog } from \"element-plus\";\nimport { defineComponent, h, type PropType, shallowRef } from \"vue\";\n/** ElDialog owns focus trapping, Escape and outside dismissal. */\nexport const ElementCommandSurface = defineComponent(\n (props: {\n readonly control: ManagedCommandPaletteSurfaceProps;\n readonly container?: HTMLElement;\n readonly dir?: \"ltr\" | \"rtl\";\n }) => {\n const active = useScopeActivity();\n const body = shallowRef<HTMLElement | null>(null);\n return () => {\n const owner = props.control;\n return h(\n ElDialog,\n {\n modelValue: active.value && owner.open && owner.isCurrent(),\n title: owner.label,\n class: owner.className,\n dir: props.dir,\n appendTo: props.container ?? \"body\",\n appendToBody: true,\n width: \"min(32rem, calc(100vw - 2rem))\",\n destroyOnClose: true,\n showClose: false,\n closeOnClickModal: true,\n closeOnPressEscape: true,\n beforeClose: () => {\n if (active.value && owner.isCurrent()) owner.onClose();\n },\n },\n {\n default: () =>\n h(\"div\", { ref: body, \"data-adapttable-part\": \"command-palette\" }, [\n owner.children,\n ]),\n }\n );\n };\n },\n {\n name: \"ElementCommandSurface\",\n props: {\n control: { type: Object as PropType<ManagedCommandPaletteSurfaceProps> },\n container: { type: Object as PropType<HTMLElement | undefined> },\n dir: { type: String as PropType<(\"ltr\" | \"rtl\") | undefined> },\n },\n }\n);\n","import {\n type ContextMenuSurfaceProps,\n useScopeActivity,\n} from \"@adapttable/vue/adapter\";\nimport {\n type DropdownInstance,\n ElDropdown,\n ElDropdownMenu,\n} from \"element-plus\";\nimport {\n defineComponent,\n h,\n nextTick,\n onScopeDispose,\n type PropType,\n shallowRef,\n type VNodeChild,\n watch,\n} from \"vue\";\n/** The public dropdown API synchronizes the primitive with the binding's open session. */\nexport const ElementContextSurface = defineComponent(\n (\n props: ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n }\n ) => {\n const active = useScopeActivity();\n const control = shallowRef<DropdownInstance>();\n let live = true;\n let generation = 0;\n onScopeDispose(() => {\n live = false;\n generation++;\n });\n const virtualAnchor = {\n getBoundingClientRect: () => new DOMRect(props.at.x, props.at.y, 0, 0),\n get contextElement() {\n return props.anchorRef.current ?? undefined;\n },\n };\n watch(\n [active, () => props.at],\n () => {\n generation++;\n },\n { flush: \"sync\", immediate: true }\n );\n watch(\n [active, control, () => props.at],\n () => {\n const ticket = generation;\n void nextTick(() => {\n if (live && active.value && ticket === generation)\n control.value?.handleOpen();\n else if (!active.value) control.value?.handleClose();\n });\n },\n { flush: \"post\", immediate: true }\n );\n return () => {\n if (!active.value) return null;\n const at = props.at;\n const ticket = generation;\n const onClose = props.onClose;\n const isCurrent = () =>\n live &&\n active.value &&\n ticket === generation &&\n props.at === at &&\n props.onClose === onClose;\n return h(\n ElDropdown,\n {\n ref: control,\n virtualTriggering: true,\n virtualRef: virtualAnchor,\n trigger: \"contextmenu\",\n role: \"menu\",\n showTimeout: 0,\n hideTimeout: 0,\n hideOnClick: false,\n placement: \"bottom-start\",\n appendTo: props.container ?? \"body\",\n teleported: true,\n persistent: false,\n showArrow: false,\n maxHeight: \"min(70vh, 32rem)\",\n popperStyle: { maxWidth: \"calc(100vw - 1rem)\" },\n onVisibleChange: (visible: boolean) => {\n if (visible || !isCurrent()) return;\n onClose();\n // A rejected controlled close keeps the same native session open.\n void nextTick(() => {\n if (isCurrent()) control.value?.handleOpen();\n });\n },\n },\n {\n dropdown: () =>\n h(\n ElDropdownMenu,\n {\n \"aria-label\": props.label,\n class: props.className,\n dir: props.dir,\n \"data-adapttable-part\": \"context-menu\",\n onKeydown: (event: KeyboardEvent) => {\n if (\n !isCurrent() ||\n event.key !== \"Escape\" ||\n event.defaultPrevented ||\n event.isComposing ||\n !(event.target instanceof Element) ||\n event.target.closest('[role=\"menu\"]') !==\n event.currentTarget\n )\n return;\n event.preventDefault();\n event.stopPropagation();\n control.value?.handleClose();\n },\n onFocus: (event: FocusEvent) => {\n if (\n !isCurrent() ||\n event.target !== event.currentTarget ||\n !(event.currentTarget instanceof HTMLElement)\n )\n return;\n event.currentTarget\n .querySelector<HTMLElement>(\n '[role=\"menuitem\"]:not([aria-disabled=\"true\"])'\n )\n ?.focus();\n },\n },\n { default: () => props.children }\n ),\n }\n );\n };\n },\n {\n name: \"ElementContextSurface\",\n props: {\n at: {\n type: Object as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"at\"]\n >,\n },\n anchorRef: {\n type: Object as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"anchorRef\"]\n >,\n },\n label: {\n type: String as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"label\"]\n >,\n },\n onClose: {\n type: Function as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"onClose\"]\n >,\n },\n container: {\n type: Object as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"container\"]\n >,\n },\n children: {\n type: [String, Number, Boolean, Array, Object] as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"children\"]\n >,\n default: undefined,\n },\n className: {\n type: String as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"className\"]\n >,\n },\n dir: {\n type: String as PropType<\n (ContextMenuSurfaceProps<VNodeChild> & {\n readonly dir?: \"ltr\" | \"rtl\";\n })[\"dir\"]\n >,\n },\n },\n }\n);\n","import {\n type ActionButton,\n type CommandPaletteSlots,\n type ContextMenuSlots,\n managedCommandPaletteSurface,\n type SidePanelSlots,\n toVueAttrs,\n} from \"@adapttable/vue/adapter\";\nimport { ElDivider, ElDropdownItem } from \"element-plus\";\nimport { h } from \"vue\";\n\nimport { elementButton } from \"../controls/button\";\nimport ElementInput from \"../controls/ElementInput.vue\";\nimport { ElementCard } from \"../presentation/ElementCard\";\nimport { ElementCommandSurface } from \"./ElementCommandSurface\";\nimport { ElementContextSurface } from \"./ElementContextSurface\";\nexport const elementActionButton = ({ attrs, label, icon }: ActionButton) =>\n elementButton(attrs, [icon, label]);\nexport const elementPaletteSlots = (\n names: () => Readonly<Record<string, string | undefined>> = () => ({}),\n container: () => HTMLElement | undefined = () => undefined,\n dir: () => \"ltr\" | \"rtl\" | undefined = () => undefined\n): CommandPaletteSlots => ({\n Surface: managedCommandPaletteSurface((control) =>\n h(ElementCommandSurface, { control, container: container(), dir: dir() })\n ),\n Input: ({ inputProps }) => {\n const { onChange, ref, value, ...attrs } = inputProps;\n return h(ElementInput, {\n ...toVueAttrs(attrs),\n value,\n inputRef: (element) => {\n if (element instanceof HTMLInputElement || element === null)\n ref(element);\n },\n class: names().commandInput,\n onChange,\n });\n },\n Item: ({ command, itemProps }) =>\n elementButton(\n {\n ...toVueAttrs(itemProps),\n class: names().commandItem,\n type: \"button\",\n tabindex: -1,\n disabled: command.disabled,\n },\n command.label\n ),\n Empty: ({ message }) =>\n h(\n \"p\",\n { \"data-adapttable-part\": \"command-empty\", class: names().commandEmpty },\n message\n ),\n});\nexport const elementContextMenuSlots = (\n names: () => Readonly<Record<string, string | undefined>> = () => ({}),\n dir: () => \"ltr\" | \"rtl\" | undefined = () => undefined\n): ContextMenuSlots => ({\n Surface: (props) => h(ElementContextSurface, { ...props, dir: dir() }),\n Item: ({ item, onSelect }) =>\n h(\n ElDropdownItem,\n {\n disabled: item.disabled,\n textValue: item.label,\n \"aria-disabled\": item.disabled,\n \"data-danger\": item.danger ? \"\" : undefined,\n \"data-adapttable-part\": \"context-menu-item\",\n class: names().contextMenuItem,\n onClick: onSelect,\n },\n { default: () => item.label }\n ),\n Separator: () =>\n h(ElDivider, {\n role: \"separator\",\n \"data-adapttable-part\": \"context-menu-separator\",\n class: names().contextMenuSeparator,\n }),\n});\nexport const elementSidePanelSlots = (\n names: () => Readonly<Record<string, string | undefined>> = () => ({})\n): SidePanelSlots => {\n let closeChoice: (() => void) | undefined;\n return {\n Frame: (props) => {\n const close = closeChoice;\n return h(\n ElementCard,\n {\n attrs: {\n \"data-adapttable-part\": \"side-panel\",\n class: props.className,\n \"data-side\": props.side,\n style: { minWidth: \"min(18rem,100%)\", maxWidth: \"100%\" },\n onKeydownCapture: (event: KeyboardEvent) => {\n const target = event.target;\n // ElSelect stops Escape even while closed; forward that case to the\n // binding's current close callback before the native event is consumed.\n if (\n event.key === \"Escape\" &&\n !event.defaultPrevented &&\n !event.isComposing &&\n target instanceof Element &&\n target.getAttribute(\"role\") === \"combobox\" &&\n target.getAttribute(\"aria-expanded\") === \"false\" &&\n !target.closest('[role=\"dialog\"],[role=\"menu\"]')\n ) {\n event.preventDefault();\n event.stopPropagation();\n close?.();\n }\n },\n },\n },\n { default: () => props.children }\n );\n },\n Tab: (props) =>\n elementButton(\n { ...toVueAttrs(props.buttonProps), class: names().sidePanelTab },\n props.panel.label\n ),\n Close: (props) => {\n closeChoice = props.onClose;\n return elementButton(\n {\n type: \"button\",\n \"aria-label\": props.label,\n \"data-adapttable-part\": \"side-panel-close\",\n class: names().sidePanelClose,\n onClick: props.onClose,\n },\n props.label\n );\n },\n };\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,yBAAA,GAAwBA,IAAAA,gBAAAA,EAClC,UAIK;CACJ,MAAM,UAAA,GAASC,wBAAAA,iBAAAA,CAAiB;CAChC,MAAM,QAAA,GAAOC,IAAAA,WAAAA,CAA+B,IAAI;CAChD,aAAa;EACX,MAAM,QAAQ,MAAM;EACpB,QAAA,GAAOC,IAAAA,EAAAA,CACLC,aAAAA,UACA;GACE,YAAY,OAAO,SAAS,MAAM,QAAQ,MAAM,UAAU;GAC1D,OAAO,MAAM;GACb,OAAO,MAAM;GACb,KAAK,MAAM;GACX,UAAU,MAAM,aAAa;GAC7B,cAAc;GACd,OAAO;GACP,gBAAgB;GAChB,WAAW;GACX,mBAAmB;GACnB,oBAAoB;GACpB,mBAAmB;IACjB,IAAI,OAAO,SAAS,MAAM,UAAU,GAAG,MAAM,QAAQ;GACvD;EACF,GACA,EACE,gBAAA,GACED,IAAAA,EAAAA,CAAE,OAAO;GAAE,KAAK;GAAM,wBAAwB;EAAkB,GAAG,CACjE,MAAM,QACR,CAAC,EACL,CACF;CACF;AACF,GACA;CACE,MAAM;CACN,OAAO;EACL,SAAS,EAAE,MAAM,OAAsD;EACvE,WAAW,EAAE,MAAM,OAA4C;EAC/D,KAAK,EAAE,MAAM,OAAgD;CAC/D;AACF,CACF;;;;AChCA,MAAa,yBAAA,GAAwBE,IAAAA,gBAAAA,EAEjC,UAGG;CACH,MAAM,UAAA,GAASC,wBAAAA,iBAAAA,CAAiB;CAChC,MAAM,WAAA,GAAUC,IAAAA,WAAAA,CAA6B;CAC7C,IA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QAAQ,UAAU;GAChB,MAAM,QAAQ;GACd,QAAA,GAAOJ,IAAAA,EAAAA,CACLK,oBAAAA,aACA,EACE,OAAO;IACL,wBAAwB;IACxB,OAAO,MAAM;IACb,aAAa,MAAM;IACnB,OAAO;KAAE,UAAU;KAAmB,UAAU;IAAO;IACvD,mBAAmB,UAAyB;KAC1C,MAAM,SAAS,MAAM;KAGrB,IACE,MAAM,QAAQ,YACd,CAAC,MAAM,oBACP,CAAC,MAAM,eACP,kBAAkB,WAClB,OAAO,aAAa,MAAM,MAAM,cAChC,OAAO,aAAa,eAAe,MAAM,WACzC,CAAC,OAAO,QAAQ,mCAA+B,GAC/C;MACA,MAAM,eAAe;MACrB,MAAM,gBAAgB;MACtB,QAAQ;KACV;IACF;GACF,EACF,GACA,EAAE,eAAe,MAAM,SAAS,CAClC;EACF;EACA,MAAM,UACJP,eAAAA,cACE;GAAE,IAAA,GAAGI,wBAAAA,WAAAA,CAAW,MAAM,WAAW;GAAG,OAAO,MAAM,CAAC,CAAC;EAAa,GAChE,MAAM,MAAM,KACd;EACF,QAAQ,UAAU;GAChB,cAAc,MAAM;GACpB,OAAOJ,eAAAA,cACL;IACE,MAAM;IACN,cAAc,MAAM;IACpB,wBAAwB;IACxB,OAAO,MAAM,CAAC,CAAC;IACf,SAAS,MAAM;GACjB,GACA,MAAM,KACR;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const require_button = require("./button-BFjBL9m3.cjs");
|
|
2
|
+
const require_ElementCard = require("./ElementCard-BRZekaHr.cjs");
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
let _adapttable_vue_adapter = require("@adapttable/vue/adapter");
|
|
5
|
+
let element_plus = require("element-plus");
|
|
6
|
+
let _adapttable_vue_features = require("@adapttable/vue/features");
|
|
7
|
+
//#region src/actions/elementExportSlots.ts
|
|
8
|
+
const elementExportSlots = (names = {}) => ({
|
|
9
|
+
Button: ({ attrs, label, icon }) => require_button.elementButton({
|
|
10
|
+
...attrs,
|
|
11
|
+
loading: attrs["aria-busy"] === true
|
|
12
|
+
}, [attrs["aria-busy"] === true ? null : icon, label], () => (0, vue.h)(element_plus.ElIcon, {
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
"data-adapttable-part": "export-spinner",
|
|
15
|
+
class: ["is-loading", names.exportSpinner]
|
|
16
|
+
}, { default: () => (0, vue.h)("svg", {
|
|
17
|
+
viewBox: "0 0 24 24",
|
|
18
|
+
fill: "none",
|
|
19
|
+
stroke: "currentColor",
|
|
20
|
+
"stroke-width": 2
|
|
21
|
+
}, [(0, vue.h)("path", { d: "M21 12a9 9 0 1 1-6.22-8.56" })]) })),
|
|
22
|
+
Surface: (props) => (0, vue.h)(require_ElementCard.ElementCard, { attrs: {
|
|
23
|
+
"data-adapttable-part": "export-progress-surface",
|
|
24
|
+
class: names.exportProgress,
|
|
25
|
+
role: "region",
|
|
26
|
+
"aria-label": props.heading
|
|
27
|
+
} }, { default: () => [
|
|
28
|
+
(0, vue.h)("h3", props.heading),
|
|
29
|
+
props.status === "busy" ? (0, vue.h)(element_plus.ElProgress, {
|
|
30
|
+
"data-adapttable-part": "export-progress-bar",
|
|
31
|
+
class: names.exportProgressBar,
|
|
32
|
+
percentage: props.progress ?? 0,
|
|
33
|
+
indeterminate: props.progress === void 0,
|
|
34
|
+
"aria-label": props.progressLabel
|
|
35
|
+
}) : null,
|
|
36
|
+
props.message ? (0, vue.h)("p", {
|
|
37
|
+
"data-adapttable-part": "export-progress-message",
|
|
38
|
+
class: names.exportProgressMessage
|
|
39
|
+
}, props.message) : null,
|
|
40
|
+
props.error ? (0, vue.h)("p", {
|
|
41
|
+
role: "alert",
|
|
42
|
+
"data-adapttable-part": "export-progress-message",
|
|
43
|
+
class: names.exportProgressMessage
|
|
44
|
+
}, props.error) : null,
|
|
45
|
+
(0, vue.h)("div", { "data-adapttable-part": "export-progress-actions" }, [...[
|
|
46
|
+
["cancel", props.cancel],
|
|
47
|
+
["retry", props.retry],
|
|
48
|
+
["dismiss", props.dismiss]
|
|
49
|
+
].map(([key, action]) => action ? require_button.elementButton({
|
|
50
|
+
key,
|
|
51
|
+
type: "button",
|
|
52
|
+
"data-adapttable-part": `export-progress-${key}`,
|
|
53
|
+
class: names.exportProgressButton,
|
|
54
|
+
onClick: action.onAction
|
|
55
|
+
}, action.label) : null), props.download ? (0, vue.h)(element_plus.ElLink, {
|
|
56
|
+
"data-adapttable-part": "export-progress-download",
|
|
57
|
+
class: names.exportProgressDownload,
|
|
58
|
+
href: props.download.url,
|
|
59
|
+
download: ""
|
|
60
|
+
}, { default: () => props.download?.label }) : null])
|
|
61
|
+
] })
|
|
62
|
+
});
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/export.ts
|
|
65
|
+
function exportCsv(options = true) {
|
|
66
|
+
return (0, _adapttable_vue_adapter.extendFeature)((0, _adapttable_vue_features.exportCsv)(options), [(0, _adapttable_vue_adapter.slotRender)(_adapttable_vue_adapter.EXPORT_CONTROL, (props) => (0, vue.h)(_adapttable_vue_adapter.ExportChrome, {
|
|
67
|
+
...props,
|
|
68
|
+
slots: elementExportSlots(props.classNames)
|
|
69
|
+
}))]);
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
Object.defineProperty(exports, "exportCsv", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function() {
|
|
75
|
+
return exportCsv;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=export-CL36qPVY.cjs.map
|