@adapttable/naive-ui 0.1.3 → 0.2.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/README.md +14 -0
- package/dist/assistant-Cv8df2ti.js +355 -0
- package/dist/assistant-Cv8df2ti.js.map +1 -0
- package/dist/assistant-D6mc-LJl.cjs +378 -0
- package/dist/assistant-D6mc-LJl.cjs.map +1 -0
- package/dist/assistant.cjs +5 -358
- package/dist/assistant.js +1 -354
- package/dist/column-menu-DdWVP1hz.d.cts +23 -0
- package/dist/column-menu-DdWVP1hz.d.cts.map +1 -0
- package/dist/column-menu-DdWVP1hz.d.ts +23 -0
- package/dist/column-menu-DdWVP1hz.d.ts.map +1 -0
- package/dist/column-menu.d.cts +2 -23
- package/dist/column-menu.d.ts +2 -23
- package/dist/command-palette-vIegnqVo.js +112 -0
- package/dist/command-palette-vIegnqVo.js.map +1 -0
- package/dist/command-palette-ztI3qI2V.cjs +117 -0
- package/dist/command-palette-ztI3qI2V.cjs.map +1 -0
- package/dist/command-palette.cjs +2 -112
- package/dist/command-palette.js +1 -111
- package/dist/context-menu-BbhrjTZr.cjs +145 -0
- package/dist/context-menu-BbhrjTZr.cjs.map +1 -0
- package/dist/context-menu-DjYIQXhY.js +140 -0
- package/dist/context-menu-DjYIQXhY.js.map +1 -0
- package/dist/context-menu.cjs +2 -140
- package/dist/context-menu.js +1 -139
- package/dist/features.cjs +217 -0
- package/dist/features.d.cts +40 -0
- package/dist/features.d.ts +40 -0
- package/dist/features.js +36 -0
- package/dist/filters-BJ48GzqJ.d.ts +66 -0
- package/dist/filters-BJ48GzqJ.d.ts.map +1 -0
- package/dist/filters-C6DvAZ_T.d.cts +66 -0
- package/dist/filters-C6DvAZ_T.d.cts.map +1 -0
- package/dist/filters.d.cts +2 -66
- package/dist/filters.d.ts +2 -66
- package/dist/grouping-panel-BPaPG49S.cjs +151 -0
- package/dist/grouping-panel-BPaPG49S.cjs.map +1 -0
- package/dist/grouping-panel-CYUPSa0u.js +146 -0
- package/dist/grouping-panel-CYUPSa0u.js.map +1 -0
- package/dist/grouping-panel.cjs +3 -146
- package/dist/grouping-panel.js +2 -145
- package/dist/header-filters-CQg6clum.d.cts +52 -0
- package/dist/header-filters-CQg6clum.d.cts.map +1 -0
- package/dist/header-filters-CQg6clum.d.ts +52 -0
- package/dist/header-filters-CQg6clum.d.ts.map +1 -0
- package/dist/header-filters.d.cts +2 -52
- package/dist/header-filters.d.ts +2 -52
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{mobile-Bc3-31-b.cjs → mobile-C2JUs6b_.cjs} +3 -2
- package/dist/mobile-C2JUs6b_.cjs.map +1 -0
- package/dist/{mobile-Dlwq8dB7.js → mobile-CC3NeIRK.js} +4 -3
- package/dist/mobile-CC3NeIRK.js.map +1 -0
- package/dist/preset.cjs +5 -5
- package/dist/preset.js +5 -5
- package/dist/renderers.cjs +1 -1
- package/dist/renderers.d.cts.map +1 -1
- package/dist/renderers.d.ts.map +1 -1
- package/dist/renderers.js +1 -1
- package/dist/row-reorder-BNYYEL8w.js +186 -0
- package/dist/row-reorder-BNYYEL8w.js.map +1 -0
- package/dist/row-reorder-BRySq2FF.cjs +191 -0
- package/dist/row-reorder-BRySq2FF.cjs.map +1 -0
- package/dist/row-reorder.cjs +2 -185
- package/dist/row-reorder.js +1 -185
- package/dist/side-panel-Bf4zBlYZ.cjs +64 -0
- package/dist/side-panel-Bf4zBlYZ.cjs.map +1 -0
- package/dist/side-panel-CLTgXUnb.js +59 -0
- package/dist/side-panel-CLTgXUnb.js.map +1 -0
- package/dist/side-panel.cjs +2 -59
- package/dist/side-panel.js +1 -58
- package/dist/styles.css +39 -39
- package/package.json +14 -3
- package/dist/assistant.cjs.map +0 -1
- package/dist/assistant.js.map +0 -1
- package/dist/column-menu.d.cts.map +0 -1
- package/dist/column-menu.d.ts.map +0 -1
- package/dist/command-palette.cjs.map +0 -1
- package/dist/command-palette.js.map +0 -1
- package/dist/context-menu.cjs.map +0 -1
- package/dist/context-menu.js.map +0 -1
- package/dist/filters.d.cts.map +0 -1
- package/dist/filters.d.ts.map +0 -1
- package/dist/grouping-panel.cjs.map +0 -1
- package/dist/grouping-panel.js.map +0 -1
- package/dist/header-filters.d.cts.map +0 -1
- package/dist/header-filters.d.ts.map +0 -1
- package/dist/mobile-Bc3-31-b.cjs.map +0 -1
- package/dist/mobile-Dlwq8dB7.js.map +0 -1
- package/dist/row-reorder.cjs.map +0 -1
- package/dist/row-reorder.js.map +0 -1
- package/dist/side-panel.cjs.map +0 -1
- package/dist/side-panel.js.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StaticTableFeature } from "@adapttable/vue";
|
|
2
|
+
import { ColumnMenuSlotProps, ColumnMenuSlotProps as ColumnMenuSlotProps$1 } from "@adapttable/vue/adapter";
|
|
3
|
+
//#region src/columns/ColumnMenu.vue.d.ts
|
|
4
|
+
declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<ColumnMenuSlotProps<TRow>> & (typeof globalThis extends {
|
|
6
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
7
|
+
} ? P : {});
|
|
8
|
+
expose: (exposed: {}) => void;
|
|
9
|
+
attrs: any;
|
|
10
|
+
slots: {};
|
|
11
|
+
emit: {};
|
|
12
|
+
}>) => import("vue").VNode & {
|
|
13
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
14
|
+
};
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/column-menu.d.ts
|
|
19
|
+
/** Shared column state and rename editors with genuine Naive UI controls. */
|
|
20
|
+
declare function columnMenu(): StaticTableFeature;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { columnMenu as n, _default as r, ColumnMenuSlotProps$1 as t };
|
|
23
|
+
//# sourceMappingURL=column-menu-DdWVP1hz.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-menu-DdWVP1hz.d.cts","names":[],"sources":["../src/columns/ColumnMenu.vue","../src/column-menu.ts"],"mappings":";;;cA0BM,eAAiB,MACtB,aAAa,YAAY,eAAe,wBACxC,YAAY,oBAAoB,KAAK,YAAY,eAAe,6CAChE,gBAAgB,YAAY,eAAe,yBAC3C,cAAA;EAiCO,qBAAc,cAAc,oBAAmB,oBAAA,iBAA8B;IAAqB,4BAA4B;MAAM;EACnI,SAAC;EACF;EACA;EACD;qBAGmB;EAAU,QAAQ,YAAY,eAAe;;cAClD,iBAAO;KACvB,oBAAoB,MAAM,mBAAmB,WAAW,IAAI,EAAE,WAAW,WAAW,KAAK,IAAI,EAAE;;;;iBCzDpF,cAAc"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StaticTableFeature } from "@adapttable/vue";
|
|
2
|
+
import { ColumnMenuSlotProps, ColumnMenuSlotProps as ColumnMenuSlotProps$1 } from "@adapttable/vue/adapter";
|
|
3
|
+
//#region src/columns/ColumnMenu.vue.d.ts
|
|
4
|
+
declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<ColumnMenuSlotProps<TRow>> & (typeof globalThis extends {
|
|
6
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
7
|
+
} ? P : {});
|
|
8
|
+
expose: (exposed: {}) => void;
|
|
9
|
+
attrs: any;
|
|
10
|
+
slots: {};
|
|
11
|
+
emit: {};
|
|
12
|
+
}>) => import("vue").VNode & {
|
|
13
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
14
|
+
};
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/column-menu.d.ts
|
|
19
|
+
/** Shared column state and rename editors with genuine Naive UI controls. */
|
|
20
|
+
declare function columnMenu(): StaticTableFeature;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { columnMenu as n, _default as r, ColumnMenuSlotProps$1 as t };
|
|
23
|
+
//# sourceMappingURL=column-menu-DdWVP1hz.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-menu-DdWVP1hz.d.ts","names":[],"sources":["../src/columns/ColumnMenu.vue","../src/column-menu.ts"],"mappings":";;;cA0BM,eAAiB,MACtB,aAAa,YAAY,eAAe,wBACxC,YAAY,oBAAoB,KAAK,YAAY,eAAe,6CAChE,gBAAgB,YAAY,eAAe,yBAC3C,cAAA;EAiCO,qBAAc,cAAc,oBAAmB,oBAAA,iBAA8B;IAAqB,4BAA4B;MAAM;EACnI,SAAC;EACF;EACA;EACD;qBAGmB;EAAU,QAAQ,YAAY,eAAe;;cAClD,iBAAO;KACvB,oBAAoB,MAAM,mBAAmB,WAAW,IAAI,EAAE,WAAW,WAAW,KAAK,IAAI,EAAE;;;;iBCzDpF,cAAc"}
|
package/dist/column-menu.d.cts
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/columns/ColumnMenu.vue.d.ts
|
|
4
|
-
declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<ColumnMenuSlotProps$1<TRow>> & (typeof globalThis extends {
|
|
6
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
7
|
-
} ? P : {});
|
|
8
|
-
expose: (exposed: {}) => void;
|
|
9
|
-
attrs: any;
|
|
10
|
-
slots: {};
|
|
11
|
-
emit: {};
|
|
12
|
-
}>) => import("vue").VNode & {
|
|
13
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
14
|
-
};
|
|
15
|
-
declare const _default: typeof __VLS_export;
|
|
16
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/column-menu.d.ts
|
|
19
|
-
/** Shared column state and rename editors with genuine Naive UI controls. */
|
|
20
|
-
declare function columnMenu(): StaticTableFeature;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { _default as ColumnMenu, type ColumnMenuSlotProps, columnMenu };
|
|
23
|
-
//# sourceMappingURL=column-menu.d.cts.map
|
|
1
|
+
import { n as columnMenu, r as _default, t as ColumnMenuSlotProps } from "./column-menu-DdWVP1hz.cjs";
|
|
2
|
+
export { _default as ColumnMenu, type ColumnMenuSlotProps, columnMenu };
|
package/dist/column-menu.d.ts
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/columns/ColumnMenu.vue.d.ts
|
|
4
|
-
declare const __VLS_export: <TRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<ColumnMenuSlotProps$1<TRow>> & (typeof globalThis extends {
|
|
6
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
7
|
-
} ? P : {});
|
|
8
|
-
expose: (exposed: {}) => void;
|
|
9
|
-
attrs: any;
|
|
10
|
-
slots: {};
|
|
11
|
-
emit: {};
|
|
12
|
-
}>) => import("vue").VNode & {
|
|
13
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
14
|
-
};
|
|
15
|
-
declare const _default: typeof __VLS_export;
|
|
16
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/column-menu.d.ts
|
|
19
|
-
/** Shared column state and rename editors with genuine Naive UI controls. */
|
|
20
|
-
declare function columnMenu(): StaticTableFeature;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { _default as ColumnMenu, type ColumnMenuSlotProps, columnMenu };
|
|
23
|
-
//# sourceMappingURL=column-menu.d.ts.map
|
|
1
|
+
import { n as columnMenu, r as _default, t as ColumnMenuSlotProps } from "./column-menu-DdWVP1hz.js";
|
|
2
|
+
export { _default as ColumnMenu, type ColumnMenuSlotProps, columnMenu };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { r as htmlRoot, t as naiveButton } from "./button-BxXdDW7A.js";
|
|
2
|
+
import { t as naiveInput } from "./input-DZI_oY9v.js";
|
|
3
|
+
import { t as useNaiveModalEscape } from "./modalEscape-CP6_uqjE.js";
|
|
4
|
+
import { COMMAND_PALETTE_CONTROL, CommandPaletteChrome, extendFeature, managedCommandPaletteSurface, slotRender, toVueAttrs } from "@adapttable/vue/adapter";
|
|
5
|
+
import { commandPalette } from "@adapttable/vue/features";
|
|
6
|
+
import { defineComponent, h, shallowRef } from "vue";
|
|
7
|
+
import { NCard, NModal, NText } from "naive-ui";
|
|
8
|
+
//#region src/actions/NaivePaletteSurface.ts
|
|
9
|
+
/** Naive owns modal autofocus, Tab trapping, and focus restoration. */
|
|
10
|
+
const NaivePaletteSurface = /*#__PURE__*/ defineComponent((props) => {
|
|
11
|
+
const card = shallowRef(null);
|
|
12
|
+
const escape = useNaiveModalEscape(() => card.value ? htmlRoot(card.value) : null);
|
|
13
|
+
return () => {
|
|
14
|
+
const owner = props.control;
|
|
15
|
+
const close = () => {
|
|
16
|
+
if (owner.open && owner.isCurrent()) owner.onClose();
|
|
17
|
+
};
|
|
18
|
+
return h(NModal, {
|
|
19
|
+
show: owner.open && owner.isCurrent(),
|
|
20
|
+
to: props.container,
|
|
21
|
+
autoFocus: true,
|
|
22
|
+
trapFocus: true,
|
|
23
|
+
"onUpdate:show": (show) => {
|
|
24
|
+
if (!show && escape.allow()) close();
|
|
25
|
+
}
|
|
26
|
+
}, { default: () => h(NCard, {
|
|
27
|
+
ref: card,
|
|
28
|
+
role: "dialog",
|
|
29
|
+
dir: props.dir,
|
|
30
|
+
onKeydownCapture: escape.capture,
|
|
31
|
+
"aria-modal": true,
|
|
32
|
+
"aria-label": owner.label,
|
|
33
|
+
"data-adapttable-part": "command-palette",
|
|
34
|
+
class: owner.className,
|
|
35
|
+
style: {
|
|
36
|
+
width: "min(40rem,calc(100vw - 2rem))",
|
|
37
|
+
maxHeight: "75dvh",
|
|
38
|
+
overflow: "auto"
|
|
39
|
+
}
|
|
40
|
+
}, { default: () => owner.children }) });
|
|
41
|
+
};
|
|
42
|
+
}, {
|
|
43
|
+
name: "NaivePaletteSurface",
|
|
44
|
+
props: {
|
|
45
|
+
control: { type: Object },
|
|
46
|
+
container: { type: Object },
|
|
47
|
+
dir: { type: String }
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/command-palette.ts
|
|
52
|
+
const NaiveCommandPalette = /*#__PURE__*/ defineComponent((props) => {
|
|
53
|
+
const slots = {
|
|
54
|
+
Surface: managedCommandPaletteSurface((control) => h(NaivePaletteSurface, {
|
|
55
|
+
control,
|
|
56
|
+
container: props.container,
|
|
57
|
+
dir: props.dir
|
|
58
|
+
})),
|
|
59
|
+
Input: ({ inputProps }) => {
|
|
60
|
+
const { value, onChange, ref, ...attrs } = inputProps;
|
|
61
|
+
return naiveInput({
|
|
62
|
+
value,
|
|
63
|
+
onChange,
|
|
64
|
+
attrs: {
|
|
65
|
+
...toVueAttrs(attrs),
|
|
66
|
+
ref,
|
|
67
|
+
class: props.classNames?.commandInput
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
Item: (control) => naiveButton({
|
|
72
|
+
...toVueAttrs(control.itemProps),
|
|
73
|
+
class: props.classNames?.commandItem,
|
|
74
|
+
tabindex: -1,
|
|
75
|
+
disabled: control.command.disabled
|
|
76
|
+
}, control.command.label),
|
|
77
|
+
Empty: (control) => h(NText, {
|
|
78
|
+
"data-adapttable-part": "command-empty",
|
|
79
|
+
class: props.classNames?.commandEmpty
|
|
80
|
+
}, { default: () => control.message })
|
|
81
|
+
};
|
|
82
|
+
return () => [props.model.button ? naiveButton({
|
|
83
|
+
"data-adapttable-part": "command-palette-button",
|
|
84
|
+
"aria-haspopup": "dialog",
|
|
85
|
+
"aria-expanded": props.model.open,
|
|
86
|
+
class: props.classNames?.commandPaletteButton,
|
|
87
|
+
onClick: props.model.show
|
|
88
|
+
}, props.labels.commandPalette) : null, h(CommandPaletteChrome, {
|
|
89
|
+
commands: props.model.commands,
|
|
90
|
+
open: props.model.open,
|
|
91
|
+
onClose: props.model.close,
|
|
92
|
+
labels: props.labels,
|
|
93
|
+
className: props.classNames?.commandPalette,
|
|
94
|
+
slots
|
|
95
|
+
})];
|
|
96
|
+
}, {
|
|
97
|
+
name: "NaiveCommandPalette",
|
|
98
|
+
props: {
|
|
99
|
+
model: { type: Object },
|
|
100
|
+
labels: { type: Object },
|
|
101
|
+
dir: { type: String },
|
|
102
|
+
classNames: { type: Object },
|
|
103
|
+
container: { type: Object }
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
function commandPalette$1(options = true) {
|
|
107
|
+
return extendFeature(commandPalette(options), [slotRender(COMMAND_PALETTE_CONTROL, (props) => h(NaiveCommandPalette, props))]);
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { commandPalette$1 as t };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=command-palette-vIegnqVo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-palette-vIegnqVo.js","names":["commandPalette","bindingCommandPalette"],"sources":["../src/actions/NaivePaletteSurface.ts","../src/command-palette.ts"],"sourcesContent":["import type { Direction } from \"@adapttable/vue\";\nimport type { ManagedCommandPaletteSurfaceProps } from \"@adapttable/vue/adapter\";\nimport { NCard, NModal } from \"naive-ui\";\nimport {\n type ComponentPublicInstance,\n defineComponent,\n h,\n type PropType,\n shallowRef,\n} from \"vue\";\n\nimport { htmlRoot } from \"../controls/elementTarget\";\nimport { useNaiveModalEscape } from \"../controls/modalEscape\";\n\n/** Naive owns modal autofocus, Tab trapping, and focus restoration. */\nexport const NaivePaletteSurface = /*#__PURE__*/ defineComponent(\n (props: {\n readonly control: ManagedCommandPaletteSurfaceProps;\n readonly container?: HTMLElement;\n readonly dir: Direction;\n }) => {\n const card = shallowRef<ComponentPublicInstance | null>(null);\n const escape = useNaiveModalEscape(() =>\n card.value ? htmlRoot(card.value) : null\n );\n return () => {\n const owner = props.control;\n const close = () => {\n if (owner.open && owner.isCurrent()) owner.onClose();\n };\n return h(\n NModal,\n {\n show: owner.open && owner.isCurrent(),\n to: props.container,\n autoFocus: true,\n trapFocus: true,\n \"onUpdate:show\": (show: boolean) => {\n if (!show && escape.allow()) close();\n },\n },\n {\n default: () =>\n h(\n NCard,\n {\n ref: card,\n role: \"dialog\",\n dir: props.dir,\n onKeydownCapture: escape.capture,\n \"aria-modal\": true,\n \"aria-label\": owner.label,\n \"data-adapttable-part\": \"command-palette\",\n class: owner.className,\n style: {\n width: \"min(40rem,calc(100vw - 2rem))\",\n maxHeight: \"75dvh\",\n overflow: \"auto\",\n },\n },\n { default: () => owner.children }\n ),\n }\n );\n };\n },\n {\n name: \"NaivePaletteSurface\",\n props: {\n control: { type: Object as PropType<ManagedCommandPaletteSurfaceProps> },\n container: { type: Object as PropType<HTMLElement | undefined> },\n dir: { type: String as PropType<Direction> },\n },\n }\n);\n","import type { StaticTableFeature } from \"@adapttable/vue\";\nimport {\n type ActionPresentation,\n COMMAND_PALETTE_CONTROL,\n CommandPaletteChrome,\n type CommandPaletteModel,\n type CommandPaletteSlots,\n extendFeature,\n managedCommandPaletteSurface,\n slotRender,\n toVueAttrs,\n} from \"@adapttable/vue/adapter\";\nimport { commandPalette as bindingCommandPalette } from \"@adapttable/vue/features\";\nimport { NText } from \"naive-ui\";\nimport { defineComponent, h, type PropType } from \"vue\";\n\nimport { NaivePaletteSurface } from \"./actions/NaivePaletteSurface\";\nimport { naiveButton } from \"./controls/button\";\nimport { naiveInput } from \"./controls/input\";\n\nconst NaiveCommandPalette = /*#__PURE__*/ defineComponent(\n (props: ActionPresentation & { readonly model: CommandPaletteModel }) => {\n // A stable surface identity lets the shared controller retain queued actions.\n const slots: CommandPaletteSlots = {\n Surface: managedCommandPaletteSurface((control) =>\n h(NaivePaletteSurface, {\n control,\n container: props.container,\n dir: props.dir,\n })\n ),\n Input: ({ inputProps }) => {\n const { value, onChange, ref, ...attrs } = inputProps;\n return naiveInput({\n value,\n onChange,\n attrs: {\n ...toVueAttrs(attrs),\n ref,\n class: props.classNames?.commandInput,\n },\n });\n },\n Item: (control) =>\n naiveButton(\n {\n ...toVueAttrs(control.itemProps),\n class: props.classNames?.commandItem,\n tabindex: -1,\n disabled: control.command.disabled,\n },\n control.command.label\n ),\n Empty: (control) =>\n h(\n NText,\n {\n \"data-adapttable-part\": \"command-empty\",\n class: props.classNames?.commandEmpty,\n },\n { default: () => control.message }\n ),\n };\n return () => [\n props.model.button\n ? naiveButton(\n {\n \"data-adapttable-part\": \"command-palette-button\",\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": props.model.open,\n class: props.classNames?.commandPaletteButton,\n onClick: props.model.show,\n },\n props.labels.commandPalette\n )\n : null,\n h(CommandPaletteChrome, {\n commands: props.model.commands,\n open: props.model.open,\n onClose: props.model.close,\n labels: props.labels,\n className: props.classNames?.commandPalette,\n slots,\n }),\n ];\n },\n {\n name: \"NaiveCommandPalette\",\n props: {\n model: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"model\"]\n >,\n },\n labels: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"labels\"]\n >,\n },\n dir: {\n type: String as PropType<\n (ActionPresentation & { readonly model: CommandPaletteModel })[\"dir\"]\n >,\n },\n classNames: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"classNames\"]\n >,\n },\n container: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"container\"]\n >,\n },\n },\n }\n);\nexport function commandPalette(\n options: Parameters<typeof bindingCommandPalette>[0] = true\n): StaticTableFeature {\n return extendFeature(bindingCommandPalette(options), [\n slotRender(COMMAND_PALETTE_CONTROL, (props) =>\n h(NaiveCommandPalette, props)\n ),\n ]);\n}\nexport type { CommandPaletteOptions } from \"@adapttable/vue/features\";\n"],"mappings":";;;;;;;;;AAeA,MAAa,sBAAoC,+BAC9C,UAIK;CACJ,MAAM,OAAO,WAA2C,IAAI;CAC5D,MAAM,SAAS,0BACb,KAAK,QAAQ,SAAS,KAAK,KAAK,IAAI,IACtC;CACA,aAAa;EACX,MAAM,QAAQ,MAAM;EACpB,MAAM,cAAc;GAClB,IAAI,MAA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ACX,MAAM,MAAM,SACR,YACE;EACE,wBAAwB;EACxB,iBAAiB;EACjB,iBAAiB,MAAM,MAAM;EAC7B,OAAO,MAAM,YAAY;EACzB,SAAS,MAAM,MAAM;CACvB,GACA,MAAM,OAAO,cACf,IACA,MACJ,EAAE,sBAAsB;EACtB,UAAU,MAAM,MAAM;EACtB,MAAM,MAAM,MAAM;EAClB,SAAS,MAAM,MAAM;EACrB,QAAQ,MAAM;EACd,WAAW,MAAM,YAAY;EAC7B;CACF,CAAC,CACH;AACF,GACA;CACE,MAAM;CACN,OAAO;EACL,OAAO,EACL,MAAM,OAKR;EACA,QAAQ,EACN,MAAM,OAKR;EACA,KAAK,EACH,MAAM,OAGR;EACA,YAAY,EACV,MAAM,OAKR;EACA,WAAW,EACT,MAAM,OAKR;CACF;AACF,CACF;AACA,SAAgBA,iBACd,UAAuD,MACnC;CACpB,OAAO,cAAcC,eAAsB,OAAO,GAAG,CACnD,WAAW,0BAA0B,UACnC,EAAE,qBAAqB,KAAK,CAC9B,CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
const require_button = require("./button-CaakTzYM.cjs");
|
|
2
|
+
const require_input = require("./input-DPQy4L2b.cjs");
|
|
3
|
+
const require_modalEscape = require("./modalEscape-aYoIK8OW.cjs");
|
|
4
|
+
let _adapttable_vue_adapter = require("@adapttable/vue/adapter");
|
|
5
|
+
let _adapttable_vue_features = require("@adapttable/vue/features");
|
|
6
|
+
let vue = require("vue");
|
|
7
|
+
let naive_ui = require("naive-ui");
|
|
8
|
+
//#region src/actions/NaivePaletteSurface.ts
|
|
9
|
+
/** Naive owns modal autofocus, Tab trapping, and focus restoration. */
|
|
10
|
+
const NaivePaletteSurface = /*#__PURE__*/ (0, vue.defineComponent)((props) => {
|
|
11
|
+
const card = (0, vue.shallowRef)(null);
|
|
12
|
+
const escape = require_modalEscape.useNaiveModalEscape(() => card.value ? require_button.htmlRoot(card.value) : null);
|
|
13
|
+
return () => {
|
|
14
|
+
const owner = props.control;
|
|
15
|
+
const close = () => {
|
|
16
|
+
if (owner.open && owner.isCurrent()) owner.onClose();
|
|
17
|
+
};
|
|
18
|
+
return (0, vue.h)(naive_ui.NModal, {
|
|
19
|
+
show: owner.open && owner.isCurrent(),
|
|
20
|
+
to: props.container,
|
|
21
|
+
autoFocus: true,
|
|
22
|
+
trapFocus: true,
|
|
23
|
+
"onUpdate:show": (show) => {
|
|
24
|
+
if (!show && escape.allow()) close();
|
|
25
|
+
}
|
|
26
|
+
}, { default: () => (0, vue.h)(naive_ui.NCard, {
|
|
27
|
+
ref: card,
|
|
28
|
+
role: "dialog",
|
|
29
|
+
dir: props.dir,
|
|
30
|
+
onKeydownCapture: escape.capture,
|
|
31
|
+
"aria-modal": true,
|
|
32
|
+
"aria-label": owner.label,
|
|
33
|
+
"data-adapttable-part": "command-palette",
|
|
34
|
+
class: owner.className,
|
|
35
|
+
style: {
|
|
36
|
+
width: "min(40rem,calc(100vw - 2rem))",
|
|
37
|
+
maxHeight: "75dvh",
|
|
38
|
+
overflow: "auto"
|
|
39
|
+
}
|
|
40
|
+
}, { default: () => owner.children }) });
|
|
41
|
+
};
|
|
42
|
+
}, {
|
|
43
|
+
name: "NaivePaletteSurface",
|
|
44
|
+
props: {
|
|
45
|
+
control: { type: Object },
|
|
46
|
+
container: { type: Object },
|
|
47
|
+
dir: { type: String }
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/command-palette.ts
|
|
52
|
+
const NaiveCommandPalette = /*#__PURE__*/ (0, vue.defineComponent)((props) => {
|
|
53
|
+
const slots = {
|
|
54
|
+
Surface: (0, _adapttable_vue_adapter.managedCommandPaletteSurface)((control) => (0, vue.h)(NaivePaletteSurface, {
|
|
55
|
+
control,
|
|
56
|
+
container: props.container,
|
|
57
|
+
dir: props.dir
|
|
58
|
+
})),
|
|
59
|
+
Input: ({ inputProps }) => {
|
|
60
|
+
const { value, onChange, ref, ...attrs } = inputProps;
|
|
61
|
+
return require_input.naiveInput({
|
|
62
|
+
value,
|
|
63
|
+
onChange,
|
|
64
|
+
attrs: {
|
|
65
|
+
...(0, _adapttable_vue_adapter.toVueAttrs)(attrs),
|
|
66
|
+
ref,
|
|
67
|
+
class: props.classNames?.commandInput
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
Item: (control) => require_button.naiveButton({
|
|
72
|
+
...(0, _adapttable_vue_adapter.toVueAttrs)(control.itemProps),
|
|
73
|
+
class: props.classNames?.commandItem,
|
|
74
|
+
tabindex: -1,
|
|
75
|
+
disabled: control.command.disabled
|
|
76
|
+
}, control.command.label),
|
|
77
|
+
Empty: (control) => (0, vue.h)(naive_ui.NText, {
|
|
78
|
+
"data-adapttable-part": "command-empty",
|
|
79
|
+
class: props.classNames?.commandEmpty
|
|
80
|
+
}, { default: () => control.message })
|
|
81
|
+
};
|
|
82
|
+
return () => [props.model.button ? require_button.naiveButton({
|
|
83
|
+
"data-adapttable-part": "command-palette-button",
|
|
84
|
+
"aria-haspopup": "dialog",
|
|
85
|
+
"aria-expanded": props.model.open,
|
|
86
|
+
class: props.classNames?.commandPaletteButton,
|
|
87
|
+
onClick: props.model.show
|
|
88
|
+
}, props.labels.commandPalette) : null, (0, vue.h)(_adapttable_vue_adapter.CommandPaletteChrome, {
|
|
89
|
+
commands: props.model.commands,
|
|
90
|
+
open: props.model.open,
|
|
91
|
+
onClose: props.model.close,
|
|
92
|
+
labels: props.labels,
|
|
93
|
+
className: props.classNames?.commandPalette,
|
|
94
|
+
slots
|
|
95
|
+
})];
|
|
96
|
+
}, {
|
|
97
|
+
name: "NaiveCommandPalette",
|
|
98
|
+
props: {
|
|
99
|
+
model: { type: Object },
|
|
100
|
+
labels: { type: Object },
|
|
101
|
+
dir: { type: String },
|
|
102
|
+
classNames: { type: Object },
|
|
103
|
+
container: { type: Object }
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
function commandPalette(options = true) {
|
|
107
|
+
return (0, _adapttable_vue_adapter.extendFeature)((0, _adapttable_vue_features.commandPalette)(options), [(0, _adapttable_vue_adapter.slotRender)(_adapttable_vue_adapter.COMMAND_PALETTE_CONTROL, (props) => (0, vue.h)(NaiveCommandPalette, props))]);
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
Object.defineProperty(exports, "commandPalette", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: function() {
|
|
113
|
+
return commandPalette;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
//# sourceMappingURL=command-palette-ztI3qI2V.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-palette-ztI3qI2V.cjs","names":["shallowRef","useNaiveModalEscape","htmlRoot","h","NModal","NCard","managedCommandPaletteSurface","h","naiveInput","toVueAttrs","naiveButton","NText","CommandPaletteChrome","extendFeature","bindingCommandPalette","slotRender","COMMAND_PALETTE_CONTROL"],"sources":["../src/actions/NaivePaletteSurface.ts","../src/command-palette.ts"],"sourcesContent":["import type { Direction } from \"@adapttable/vue\";\nimport type { ManagedCommandPaletteSurfaceProps } from \"@adapttable/vue/adapter\";\nimport { NCard, NModal } from \"naive-ui\";\nimport {\n type ComponentPublicInstance,\n defineComponent,\n h,\n type PropType,\n shallowRef,\n} from \"vue\";\n\nimport { htmlRoot } from \"../controls/elementTarget\";\nimport { useNaiveModalEscape } from \"../controls/modalEscape\";\n\n/** Naive owns modal autofocus, Tab trapping, and focus restoration. */\nexport const NaivePaletteSurface = /*#__PURE__*/ defineComponent(\n (props: {\n readonly control: ManagedCommandPaletteSurfaceProps;\n readonly container?: HTMLElement;\n readonly dir: Direction;\n }) => {\n const card = shallowRef<ComponentPublicInstance | null>(null);\n const escape = useNaiveModalEscape(() =>\n card.value ? htmlRoot(card.value) : null\n );\n return () => {\n const owner = props.control;\n const close = () => {\n if (owner.open && owner.isCurrent()) owner.onClose();\n };\n return h(\n NModal,\n {\n show: owner.open && owner.isCurrent(),\n to: props.container,\n autoFocus: true,\n trapFocus: true,\n \"onUpdate:show\": (show: boolean) => {\n if (!show && escape.allow()) close();\n },\n },\n {\n default: () =>\n h(\n NCard,\n {\n ref: card,\n role: \"dialog\",\n dir: props.dir,\n onKeydownCapture: escape.capture,\n \"aria-modal\": true,\n \"aria-label\": owner.label,\n \"data-adapttable-part\": \"command-palette\",\n class: owner.className,\n style: {\n width: \"min(40rem,calc(100vw - 2rem))\",\n maxHeight: \"75dvh\",\n overflow: \"auto\",\n },\n },\n { default: () => owner.children }\n ),\n }\n );\n };\n },\n {\n name: \"NaivePaletteSurface\",\n props: {\n control: { type: Object as PropType<ManagedCommandPaletteSurfaceProps> },\n container: { type: Object as PropType<HTMLElement | undefined> },\n dir: { type: String as PropType<Direction> },\n },\n }\n);\n","import type { StaticTableFeature } from \"@adapttable/vue\";\nimport {\n type ActionPresentation,\n COMMAND_PALETTE_CONTROL,\n CommandPaletteChrome,\n type CommandPaletteModel,\n type CommandPaletteSlots,\n extendFeature,\n managedCommandPaletteSurface,\n slotRender,\n toVueAttrs,\n} from \"@adapttable/vue/adapter\";\nimport { commandPalette as bindingCommandPalette } from \"@adapttable/vue/features\";\nimport { NText } from \"naive-ui\";\nimport { defineComponent, h, type PropType } from \"vue\";\n\nimport { NaivePaletteSurface } from \"./actions/NaivePaletteSurface\";\nimport { naiveButton } from \"./controls/button\";\nimport { naiveInput } from \"./controls/input\";\n\nconst NaiveCommandPalette = /*#__PURE__*/ defineComponent(\n (props: ActionPresentation & { readonly model: CommandPaletteModel }) => {\n // A stable surface identity lets the shared controller retain queued actions.\n const slots: CommandPaletteSlots = {\n Surface: managedCommandPaletteSurface((control) =>\n h(NaivePaletteSurface, {\n control,\n container: props.container,\n dir: props.dir,\n })\n ),\n Input: ({ inputProps }) => {\n const { value, onChange, ref, ...attrs } = inputProps;\n return naiveInput({\n value,\n onChange,\n attrs: {\n ...toVueAttrs(attrs),\n ref,\n class: props.classNames?.commandInput,\n },\n });\n },\n Item: (control) =>\n naiveButton(\n {\n ...toVueAttrs(control.itemProps),\n class: props.classNames?.commandItem,\n tabindex: -1,\n disabled: control.command.disabled,\n },\n control.command.label\n ),\n Empty: (control) =>\n h(\n NText,\n {\n \"data-adapttable-part\": \"command-empty\",\n class: props.classNames?.commandEmpty,\n },\n { default: () => control.message }\n ),\n };\n return () => [\n props.model.button\n ? naiveButton(\n {\n \"data-adapttable-part\": \"command-palette-button\",\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": props.model.open,\n class: props.classNames?.commandPaletteButton,\n onClick: props.model.show,\n },\n props.labels.commandPalette\n )\n : null,\n h(CommandPaletteChrome, {\n commands: props.model.commands,\n open: props.model.open,\n onClose: props.model.close,\n labels: props.labels,\n className: props.classNames?.commandPalette,\n slots,\n }),\n ];\n },\n {\n name: \"NaiveCommandPalette\",\n props: {\n model: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"model\"]\n >,\n },\n labels: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"labels\"]\n >,\n },\n dir: {\n type: String as PropType<\n (ActionPresentation & { readonly model: CommandPaletteModel })[\"dir\"]\n >,\n },\n classNames: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"classNames\"]\n >,\n },\n container: {\n type: Object as PropType<\n (ActionPresentation & {\n readonly model: CommandPaletteModel;\n })[\"container\"]\n >,\n },\n },\n }\n);\nexport function commandPalette(\n options: Parameters<typeof bindingCommandPalette>[0] = true\n): StaticTableFeature {\n return extendFeature(bindingCommandPalette(options), [\n slotRender(COMMAND_PALETTE_CONTROL, (props) =>\n h(NaiveCommandPalette, props)\n ),\n ]);\n}\nexport type { CommandPaletteOptions } from \"@adapttable/vue/features\";\n"],"mappings":";;;;;;;;;AAeA,MAAa,sBAAoC,eAAA,GAAA,IAAA,gBAAA,EAC9C,UAIK;CACJ,MAAM,QAAA,GAAOA,IAAAA,WAAAA,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Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const require_modalEscape = require("./modalEscape-aYoIK8OW.cjs");
|
|
5
|
-
let _adapttable_vue_adapter = require("@adapttable/vue/adapter");
|
|
6
|
-
let _adapttable_vue_features = require("@adapttable/vue/features");
|
|
7
|
-
let vue = require("vue");
|
|
8
|
-
let naive_ui = require("naive-ui");
|
|
9
|
-
//#region src/actions/NaivePaletteSurface.ts
|
|
10
|
-
/** Naive owns modal autofocus, Tab trapping, and focus restoration. */
|
|
11
|
-
const NaivePaletteSurface = /*#__PURE__*/ (0, vue.defineComponent)((props) => {
|
|
12
|
-
const card = (0, vue.shallowRef)(null);
|
|
13
|
-
const escape = require_modalEscape.useNaiveModalEscape(() => card.value ? require_button.htmlRoot(card.value) : null);
|
|
14
|
-
return () => {
|
|
15
|
-
const owner = props.control;
|
|
16
|
-
const close = () => {
|
|
17
|
-
if (owner.open && owner.isCurrent()) owner.onClose();
|
|
18
|
-
};
|
|
19
|
-
return (0, vue.h)(naive_ui.NModal, {
|
|
20
|
-
show: owner.open && owner.isCurrent(),
|
|
21
|
-
to: props.container,
|
|
22
|
-
autoFocus: true,
|
|
23
|
-
trapFocus: true,
|
|
24
|
-
"onUpdate:show": (show) => {
|
|
25
|
-
if (!show && escape.allow()) close();
|
|
26
|
-
}
|
|
27
|
-
}, { default: () => (0, vue.h)(naive_ui.NCard, {
|
|
28
|
-
ref: card,
|
|
29
|
-
role: "dialog",
|
|
30
|
-
dir: props.dir,
|
|
31
|
-
onKeydownCapture: escape.capture,
|
|
32
|
-
"aria-modal": true,
|
|
33
|
-
"aria-label": owner.label,
|
|
34
|
-
"data-adapttable-part": "command-palette",
|
|
35
|
-
class: owner.className,
|
|
36
|
-
style: {
|
|
37
|
-
width: "min(40rem,calc(100vw - 2rem))",
|
|
38
|
-
maxHeight: "75dvh",
|
|
39
|
-
overflow: "auto"
|
|
40
|
-
}
|
|
41
|
-
}, { default: () => owner.children }) });
|
|
42
|
-
};
|
|
43
|
-
}, {
|
|
44
|
-
name: "NaivePaletteSurface",
|
|
45
|
-
props: {
|
|
46
|
-
control: { type: Object },
|
|
47
|
-
container: { type: Object },
|
|
48
|
-
dir: { type: String }
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region src/command-palette.ts
|
|
53
|
-
const NaiveCommandPalette = /*#__PURE__*/ (0, vue.defineComponent)((props) => {
|
|
54
|
-
const slots = {
|
|
55
|
-
Surface: (0, _adapttable_vue_adapter.managedCommandPaletteSurface)((control) => (0, vue.h)(NaivePaletteSurface, {
|
|
56
|
-
control,
|
|
57
|
-
container: props.container,
|
|
58
|
-
dir: props.dir
|
|
59
|
-
})),
|
|
60
|
-
Input: ({ inputProps }) => {
|
|
61
|
-
const { value, onChange, ref, ...attrs } = inputProps;
|
|
62
|
-
return require_input.naiveInput({
|
|
63
|
-
value,
|
|
64
|
-
onChange,
|
|
65
|
-
attrs: {
|
|
66
|
-
...(0, _adapttable_vue_adapter.toVueAttrs)(attrs),
|
|
67
|
-
ref,
|
|
68
|
-
class: props.classNames?.commandInput
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
},
|
|
72
|
-
Item: (control) => require_button.naiveButton({
|
|
73
|
-
...(0, _adapttable_vue_adapter.toVueAttrs)(control.itemProps),
|
|
74
|
-
class: props.classNames?.commandItem,
|
|
75
|
-
tabindex: -1,
|
|
76
|
-
disabled: control.command.disabled
|
|
77
|
-
}, control.command.label),
|
|
78
|
-
Empty: (control) => (0, vue.h)(naive_ui.NText, {
|
|
79
|
-
"data-adapttable-part": "command-empty",
|
|
80
|
-
class: props.classNames?.commandEmpty
|
|
81
|
-
}, { default: () => control.message })
|
|
82
|
-
};
|
|
83
|
-
return () => [props.model.button ? require_button.naiveButton({
|
|
84
|
-
"data-adapttable-part": "command-palette-button",
|
|
85
|
-
"aria-haspopup": "dialog",
|
|
86
|
-
"aria-expanded": props.model.open,
|
|
87
|
-
class: props.classNames?.commandPaletteButton,
|
|
88
|
-
onClick: props.model.show
|
|
89
|
-
}, props.labels.commandPalette) : null, (0, vue.h)(_adapttable_vue_adapter.CommandPaletteChrome, {
|
|
90
|
-
commands: props.model.commands,
|
|
91
|
-
open: props.model.open,
|
|
92
|
-
onClose: props.model.close,
|
|
93
|
-
labels: props.labels,
|
|
94
|
-
className: props.classNames?.commandPalette,
|
|
95
|
-
slots
|
|
96
|
-
})];
|
|
97
|
-
}, {
|
|
98
|
-
name: "NaiveCommandPalette",
|
|
99
|
-
props: {
|
|
100
|
-
model: { type: Object },
|
|
101
|
-
labels: { type: Object },
|
|
102
|
-
dir: { type: String },
|
|
103
|
-
classNames: { type: Object },
|
|
104
|
-
container: { type: Object }
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
function commandPalette(options = true) {
|
|
108
|
-
return (0, _adapttable_vue_adapter.extendFeature)((0, _adapttable_vue_features.commandPalette)(options), [(0, _adapttable_vue_adapter.slotRender)(_adapttable_vue_adapter.COMMAND_PALETTE_CONTROL, (props) => (0, vue.h)(NaiveCommandPalette, props))]);
|
|
109
|
-
}
|
|
110
|
-
//#endregion
|
|
111
|
-
exports.commandPalette = commandPalette;
|
|
112
|
-
|
|
113
|
-
//# sourceMappingURL=command-palette.cjs.map
|
|
2
|
+
const require_command_palette = require("./command-palette-ztI3qI2V.cjs");
|
|
3
|
+
exports.commandPalette = require_command_palette.commandPalette;
|
package/dist/command-palette.js
CHANGED
|
@@ -1,112 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as naiveInput } from "./input-DZI_oY9v.js";
|
|
3
|
-
import { t as useNaiveModalEscape } from "./modalEscape-CP6_uqjE.js";
|
|
4
|
-
import { COMMAND_PALETTE_CONTROL, CommandPaletteChrome, extendFeature, managedCommandPaletteSurface, slotRender, toVueAttrs } from "@adapttable/vue/adapter";
|
|
5
|
-
import { commandPalette as commandPalette$1 } from "@adapttable/vue/features";
|
|
6
|
-
import { defineComponent, h, shallowRef } from "vue";
|
|
7
|
-
import { NCard, NModal, NText } from "naive-ui";
|
|
8
|
-
//#region src/actions/NaivePaletteSurface.ts
|
|
9
|
-
/** Naive owns modal autofocus, Tab trapping, and focus restoration. */
|
|
10
|
-
const NaivePaletteSurface = /*#__PURE__*/ defineComponent((props) => {
|
|
11
|
-
const card = shallowRef(null);
|
|
12
|
-
const escape = useNaiveModalEscape(() => card.value ? htmlRoot(card.value) : null);
|
|
13
|
-
return () => {
|
|
14
|
-
const owner = props.control;
|
|
15
|
-
const close = () => {
|
|
16
|
-
if (owner.open && owner.isCurrent()) owner.onClose();
|
|
17
|
-
};
|
|
18
|
-
return h(NModal, {
|
|
19
|
-
show: owner.open && owner.isCurrent(),
|
|
20
|
-
to: props.container,
|
|
21
|
-
autoFocus: true,
|
|
22
|
-
trapFocus: true,
|
|
23
|
-
"onUpdate:show": (show) => {
|
|
24
|
-
if (!show && escape.allow()) close();
|
|
25
|
-
}
|
|
26
|
-
}, { default: () => h(NCard, {
|
|
27
|
-
ref: card,
|
|
28
|
-
role: "dialog",
|
|
29
|
-
dir: props.dir,
|
|
30
|
-
onKeydownCapture: escape.capture,
|
|
31
|
-
"aria-modal": true,
|
|
32
|
-
"aria-label": owner.label,
|
|
33
|
-
"data-adapttable-part": "command-palette",
|
|
34
|
-
class: owner.className,
|
|
35
|
-
style: {
|
|
36
|
-
width: "min(40rem,calc(100vw - 2rem))",
|
|
37
|
-
maxHeight: "75dvh",
|
|
38
|
-
overflow: "auto"
|
|
39
|
-
}
|
|
40
|
-
}, { default: () => owner.children }) });
|
|
41
|
-
};
|
|
42
|
-
}, {
|
|
43
|
-
name: "NaivePaletteSurface",
|
|
44
|
-
props: {
|
|
45
|
-
control: { type: Object },
|
|
46
|
-
container: { type: Object },
|
|
47
|
-
dir: { type: String }
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/command-palette.ts
|
|
52
|
-
const NaiveCommandPalette = /*#__PURE__*/ defineComponent((props) => {
|
|
53
|
-
const slots = {
|
|
54
|
-
Surface: managedCommandPaletteSurface((control) => h(NaivePaletteSurface, {
|
|
55
|
-
control,
|
|
56
|
-
container: props.container,
|
|
57
|
-
dir: props.dir
|
|
58
|
-
})),
|
|
59
|
-
Input: ({ inputProps }) => {
|
|
60
|
-
const { value, onChange, ref, ...attrs } = inputProps;
|
|
61
|
-
return naiveInput({
|
|
62
|
-
value,
|
|
63
|
-
onChange,
|
|
64
|
-
attrs: {
|
|
65
|
-
...toVueAttrs(attrs),
|
|
66
|
-
ref,
|
|
67
|
-
class: props.classNames?.commandInput
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
Item: (control) => naiveButton({
|
|
72
|
-
...toVueAttrs(control.itemProps),
|
|
73
|
-
class: props.classNames?.commandItem,
|
|
74
|
-
tabindex: -1,
|
|
75
|
-
disabled: control.command.disabled
|
|
76
|
-
}, control.command.label),
|
|
77
|
-
Empty: (control) => h(NText, {
|
|
78
|
-
"data-adapttable-part": "command-empty",
|
|
79
|
-
class: props.classNames?.commandEmpty
|
|
80
|
-
}, { default: () => control.message })
|
|
81
|
-
};
|
|
82
|
-
return () => [props.model.button ? naiveButton({
|
|
83
|
-
"data-adapttable-part": "command-palette-button",
|
|
84
|
-
"aria-haspopup": "dialog",
|
|
85
|
-
"aria-expanded": props.model.open,
|
|
86
|
-
class: props.classNames?.commandPaletteButton,
|
|
87
|
-
onClick: props.model.show
|
|
88
|
-
}, props.labels.commandPalette) : null, h(CommandPaletteChrome, {
|
|
89
|
-
commands: props.model.commands,
|
|
90
|
-
open: props.model.open,
|
|
91
|
-
onClose: props.model.close,
|
|
92
|
-
labels: props.labels,
|
|
93
|
-
className: props.classNames?.commandPalette,
|
|
94
|
-
slots
|
|
95
|
-
})];
|
|
96
|
-
}, {
|
|
97
|
-
name: "NaiveCommandPalette",
|
|
98
|
-
props: {
|
|
99
|
-
model: { type: Object },
|
|
100
|
-
labels: { type: Object },
|
|
101
|
-
dir: { type: String },
|
|
102
|
-
classNames: { type: Object },
|
|
103
|
-
container: { type: Object }
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
function commandPalette(options = true) {
|
|
107
|
-
return extendFeature(commandPalette$1(options), [slotRender(COMMAND_PALETTE_CONTROL, (props) => h(NaiveCommandPalette, props))]);
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
1
|
+
import { t as commandPalette } from "./command-palette-vIegnqVo.js";
|
|
110
2
|
export { commandPalette };
|
|
111
|
-
|
|
112
|
-
//# sourceMappingURL=command-palette.js.map
|