@adapttable/naive-ui 0.1.2 → 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 -354
- package/dist/assistant.d.cts.map +1 -1
- package/dist/assistant.d.ts.map +1 -1
- package/dist/assistant.js +1 -350
- 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,191 @@
|
|
|
1
|
+
const require_button = require("./button-CaakTzYM.cjs");
|
|
2
|
+
const require_select = require("./select-C8UKnsWO.cjs");
|
|
3
|
+
const require_modalEscape = require("./modalEscape-aYoIK8OW.cjs");
|
|
4
|
+
require("@adapttable/vue");
|
|
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/reorder/NaiveRowMoveMenu.ts
|
|
10
|
+
const NaiveRowMoveMenu = /*#__PURE__*/ (0, vue.defineComponent)((props) => {
|
|
11
|
+
const active = (0, _adapttable_vue_adapter.useScopeActivity)();
|
|
12
|
+
const container = (0, vue.shallowRef)(null);
|
|
13
|
+
const trigger = (0, vue.shallowRef)(null);
|
|
14
|
+
const card = (0, vue.shallowRef)(null);
|
|
15
|
+
const escape = require_modalEscape.useNaiveModalEscape(() => card.value ? require_button.htmlRoot(card.value) : null);
|
|
16
|
+
const descriptionId = (0, vue.useId)();
|
|
17
|
+
let revision = 0;
|
|
18
|
+
(0, vue.watch)([
|
|
19
|
+
active,
|
|
20
|
+
() => props.items,
|
|
21
|
+
() => props.confirmation
|
|
22
|
+
], () => {
|
|
23
|
+
revision++;
|
|
24
|
+
}, { flush: "sync" });
|
|
25
|
+
const restore = () => {
|
|
26
|
+
(0, vue.nextTick)(() => {
|
|
27
|
+
if (active.value && !props.confirmation && trigger.value?.isConnected) trigger.value.focus();
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
return () => {
|
|
31
|
+
const ticket = revision;
|
|
32
|
+
const live = active.value;
|
|
33
|
+
const current = () => live && active.value && ticket === revision;
|
|
34
|
+
const confirmation = props.confirmation;
|
|
35
|
+
const finish = (accept) => {
|
|
36
|
+
if (!current() || !confirmation || props.confirmation !== confirmation) return;
|
|
37
|
+
if (accept) confirmation.onConfirm();
|
|
38
|
+
else confirmation.onCancel();
|
|
39
|
+
restore();
|
|
40
|
+
};
|
|
41
|
+
const content = confirmation ? [
|
|
42
|
+
(0, vue.h)("p", { id: descriptionId }, confirmation.description),
|
|
43
|
+
require_button.naiveButton({
|
|
44
|
+
"data-adapttable-part": "row-move-cancel",
|
|
45
|
+
onClick: () => finish(false)
|
|
46
|
+
}, confirmation.cancelLabel),
|
|
47
|
+
require_button.naiveButton({
|
|
48
|
+
"data-adapttable-part": "row-move-confirm",
|
|
49
|
+
onClick: () => finish(true)
|
|
50
|
+
}, confirmation.confirmLabel)
|
|
51
|
+
] : [];
|
|
52
|
+
return (0, vue.h)("span", {
|
|
53
|
+
"data-adapttable-part": "row-move-menu",
|
|
54
|
+
ref: (0, _adapttable_vue_adapter.elementRef)((element) => {
|
|
55
|
+
container.value = element;
|
|
56
|
+
})
|
|
57
|
+
}, [(0, vue.h)("span", { "data-adapttable-part": "row-move-menu-content" }, [require_select.naiveSelect({
|
|
58
|
+
attrs: {
|
|
59
|
+
ref: (element) => {
|
|
60
|
+
trigger.value = element;
|
|
61
|
+
},
|
|
62
|
+
"aria-label": props.label,
|
|
63
|
+
placeholder: props.label,
|
|
64
|
+
"data-adapttable-part": "row-move-menu-trigger",
|
|
65
|
+
disabled: props.items.every((item) => item.disabled)
|
|
66
|
+
},
|
|
67
|
+
value: "",
|
|
68
|
+
optionPart: "row-move-menu-item",
|
|
69
|
+
virtualScroll: false,
|
|
70
|
+
options: props.items.map((item) => ({
|
|
71
|
+
value: item.id,
|
|
72
|
+
label: item.label,
|
|
73
|
+
disabled: item.disabled,
|
|
74
|
+
title: item.disabledReason
|
|
75
|
+
})),
|
|
76
|
+
onChange: (key) => {
|
|
77
|
+
if (!current()) return;
|
|
78
|
+
const item = props.items.find((entry) => entry.id === key);
|
|
79
|
+
if (item && !item.disabled) item.onSelect();
|
|
80
|
+
}
|
|
81
|
+
})]), confirmation && container.value ? (0, vue.h)(naive_ui.NModal, {
|
|
82
|
+
show: live,
|
|
83
|
+
to: container.value,
|
|
84
|
+
autoFocus: true,
|
|
85
|
+
trapFocus: true,
|
|
86
|
+
maskClosable: false,
|
|
87
|
+
"onUpdate:show": (show) => {
|
|
88
|
+
if (!show && escape.allow()) finish(false);
|
|
89
|
+
}
|
|
90
|
+
}, { default: () => (0, vue.h)(naive_ui.NCard, {
|
|
91
|
+
ref: card,
|
|
92
|
+
role: "alertdialog",
|
|
93
|
+
onKeydownCapture: escape.capture,
|
|
94
|
+
"aria-modal": true,
|
|
95
|
+
"aria-label": confirmation.title,
|
|
96
|
+
"aria-describedby": descriptionId,
|
|
97
|
+
"data-adapttable-part": "row-move-confirmation",
|
|
98
|
+
title: confirmation.title,
|
|
99
|
+
style: { width: "min(28rem,calc(100vw - 2rem))" }
|
|
100
|
+
}, { default: () => content }) }) : null]);
|
|
101
|
+
};
|
|
102
|
+
}, {
|
|
103
|
+
name: "NaiveRowMoveMenu",
|
|
104
|
+
props: {
|
|
105
|
+
label: { type: String },
|
|
106
|
+
items: { type: Array },
|
|
107
|
+
confirmation: { type: Object }
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/reorder/naiveReorderControls.ts
|
|
112
|
+
const naiveReorderControls = {
|
|
113
|
+
Handle: ({ label, pressed, dragging, disabled, dragProps, onKeyDown, className }) => require_button.naiveButton({
|
|
114
|
+
type: "button",
|
|
115
|
+
"aria-label": label,
|
|
116
|
+
"aria-pressed": pressed,
|
|
117
|
+
"data-dragging": dragging ? "" : void 0,
|
|
118
|
+
"data-adapttable-part": "row-reorder-handle",
|
|
119
|
+
"data-adapttable-grip": "",
|
|
120
|
+
class: className,
|
|
121
|
+
disabled,
|
|
122
|
+
draggable: dragProps.draggable,
|
|
123
|
+
onDragstart: (event) => {
|
|
124
|
+
if (event.dataTransfer) dragProps.onDragStart({
|
|
125
|
+
...event,
|
|
126
|
+
dataTransfer: event.dataTransfer,
|
|
127
|
+
clientY: event.clientY,
|
|
128
|
+
currentTarget: event.currentTarget instanceof HTMLElement ? event.currentTarget : null,
|
|
129
|
+
preventDefault: () => event.preventDefault()
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
onDragend: dragProps.onDragEnd,
|
|
133
|
+
onKeydown: (event) => onKeyDown({
|
|
134
|
+
key: event.key,
|
|
135
|
+
currentTarget: event.currentTarget instanceof HTMLElement ? event.currentTarget : null,
|
|
136
|
+
preventDefault: () => event.preventDefault()
|
|
137
|
+
})
|
|
138
|
+
}, "↕"),
|
|
139
|
+
Button: ({ label, part, disabled, onClick, className }) => require_button.naiveButton({
|
|
140
|
+
type: "button",
|
|
141
|
+
"aria-label": label,
|
|
142
|
+
"data-adapttable-part": part,
|
|
143
|
+
class: className,
|
|
144
|
+
disabled,
|
|
145
|
+
onClick
|
|
146
|
+
}, label),
|
|
147
|
+
Menu: (props) => (0, vue.h)(NaiveRowMoveMenu, props)
|
|
148
|
+
};
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/reorder/NaiveRowReorder.vue
|
|
151
|
+
const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
152
|
+
__name: "NaiveRowReorder",
|
|
153
|
+
props: {
|
|
154
|
+
model: {},
|
|
155
|
+
labels: {},
|
|
156
|
+
mobile: { type: Boolean },
|
|
157
|
+
classNames: {},
|
|
158
|
+
rowId: {},
|
|
159
|
+
localIndex: {},
|
|
160
|
+
row: {},
|
|
161
|
+
windowStart: {},
|
|
162
|
+
rowCount: {}
|
|
163
|
+
},
|
|
164
|
+
setup(__props) {
|
|
165
|
+
const props = __props;
|
|
166
|
+
const names = (0, _adapttable_vue_adapter.useDataTableClassNames)();
|
|
167
|
+
const Render = () => (0, _adapttable_vue_adapter.RowReorderChrome)({
|
|
168
|
+
...props,
|
|
169
|
+
classNames: { ...names.value },
|
|
170
|
+
slots: naiveReorderControls
|
|
171
|
+
});
|
|
172
|
+
Render.props = [];
|
|
173
|
+
return (_ctx, _cache) => {
|
|
174
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(Render);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/row-reorder.ts
|
|
180
|
+
function rowReorder(onRowReorder, options) {
|
|
181
|
+
return (0, _adapttable_vue_adapter.extendFeature)((0, _adapttable_vue_features.rowReorder)(onRowReorder, options), [(0, _adapttable_vue_adapter.slotRender)((0, _adapttable_vue_adapter.rowReorderControlKey)(), (props) => (0, vue.h)(_sfc_main, { ...props }))]);
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
Object.defineProperty(exports, "rowReorder", {
|
|
185
|
+
enumerable: true,
|
|
186
|
+
get: function() {
|
|
187
|
+
return rowReorder;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
//# sourceMappingURL=row-reorder-BRySq2FF.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-reorder-BRySq2FF.cjs","names":["useScopeActivity","shallowRef","useNaiveModalEscape","htmlRoot","useId","nextTick","h","naiveButton","elementRef","naiveSelect","NModal","NCard","naiveButton","h","extendFeature","bindingRowReorder","slotRender","rowReorderControlKey","h","NaiveRowReorder"],"sources":["../src/reorder/NaiveRowMoveMenu.ts","../src/reorder/naiveReorderControls.ts","../src/reorder/NaiveRowReorder.vue","../src/row-reorder.ts"],"sourcesContent":["import {\n elementRef,\n type RowMoveMenuSlotProps,\n useScopeActivity,\n} from \"@adapttable/vue/adapter\";\nimport { NCard, NModal } from \"naive-ui\";\nimport {\n type ComponentPublicInstance,\n defineComponent,\n h,\n nextTick,\n type PropType,\n shallowRef,\n useId,\n watch,\n} from \"vue\";\n\nimport { naiveButton } from \"../controls/button\";\nimport { htmlRoot } from \"../controls/elementTarget\";\nimport { useNaiveModalEscape } from \"../controls/modalEscape\";\nimport { naiveSelect } from \"../controls/select\";\n\nexport const NaiveRowMoveMenu = /*#__PURE__*/ defineComponent(\n (props: RowMoveMenuSlotProps) => {\n const active = useScopeActivity();\n const container = shallowRef<HTMLElement | null>(null);\n const trigger = shallowRef<HTMLElement | null>(null);\n const card = shallowRef<ComponentPublicInstance | null>(null);\n const escape = useNaiveModalEscape(() =>\n card.value ? htmlRoot(card.value) : null\n );\n const descriptionId = useId();\n let revision = 0;\n watch(\n [active, () => props.items, () => props.confirmation],\n () => {\n revision++;\n },\n { flush: \"sync\" }\n );\n const restore = () => {\n void nextTick(() => {\n if (active.value && !props.confirmation && trigger.value?.isConnected)\n trigger.value.focus();\n });\n };\n return () => {\n const ticket = revision;\n // Read activity on every render, even while no confirmation is visible.\n const live = active.value;\n const current = () => live && active.value && ticket === revision;\n const confirmation = props.confirmation;\n const finish = (accept: boolean) => {\n if (!current() || !confirmation || props.confirmation !== confirmation)\n return;\n if (accept) confirmation.onConfirm();\n else confirmation.onCancel();\n restore();\n };\n const content = confirmation\n ? [\n h(\"p\", { id: descriptionId }, confirmation.description),\n // Native modal autofocus begins on the non-destructive choice.\n naiveButton(\n {\n \"data-adapttable-part\": \"row-move-cancel\",\n onClick: () => finish(false),\n },\n confirmation.cancelLabel\n ),\n naiveButton(\n {\n \"data-adapttable-part\": \"row-move-confirm\",\n onClick: () => finish(true),\n },\n confirmation.confirmLabel\n ),\n ]\n : [];\n return h(\n \"span\",\n {\n \"data-adapttable-part\": \"row-move-menu\",\n ref: elementRef<HTMLElement>((element) => {\n container.value = element;\n }),\n },\n [\n h(\"span\", { \"data-adapttable-part\": \"row-move-menu-content\" }, [\n naiveSelect({\n attrs: {\n ref: (element: HTMLElement | null) => {\n trigger.value = element;\n },\n \"aria-label\": props.label,\n placeholder: props.label,\n \"data-adapttable-part\": \"row-move-menu-trigger\",\n disabled: props.items.every((item) => item.disabled),\n },\n value: \"\",\n optionPart: \"row-move-menu-item\",\n // A destination list keeps disabled choices and their reasons visible.\n virtualScroll: false,\n options: props.items.map((item) => ({\n value: item.id,\n label: item.label,\n disabled: item.disabled,\n title: item.disabledReason,\n })),\n onChange: (key) => {\n if (!current()) return;\n const item = props.items.find((entry) => entry.id === key);\n if (item && !item.disabled) item.onSelect();\n },\n }),\n ]),\n confirmation && container.value\n ? h(\n NModal,\n {\n show: live,\n to: container.value,\n autoFocus: true,\n trapFocus: true,\n maskClosable: false,\n \"onUpdate:show\": (show: boolean) => {\n if (!show && escape.allow()) finish(false);\n },\n },\n {\n default: () =>\n h(\n NCard,\n {\n ref: card,\n role: \"alertdialog\",\n onKeydownCapture: escape.capture,\n \"aria-modal\": true,\n \"aria-label\": confirmation.title,\n \"aria-describedby\": descriptionId,\n \"data-adapttable-part\": \"row-move-confirmation\",\n title: confirmation.title,\n style: { width: \"min(28rem,calc(100vw - 2rem))\" },\n },\n { default: () => content }\n ),\n }\n )\n : null,\n ]\n );\n };\n },\n {\n name: \"NaiveRowMoveMenu\",\n props: {\n label: { type: String as PropType<RowMoveMenuSlotProps[\"label\"]> },\n items: { type: Array as PropType<RowMoveMenuSlotProps[\"items\"]> },\n confirmation: {\n type: Object as PropType<RowMoveMenuSlotProps[\"confirmation\"]>,\n },\n },\n }\n);\n","import type { RowReorderControlSlots } from \"@adapttable/vue/adapter\";\nimport { h } from \"vue\";\n\nimport { naiveButton } from \"../controls/button\";\nimport { NaiveRowMoveMenu } from \"./NaiveRowMoveMenu\";\n\nexport const naiveReorderControls: RowReorderControlSlots = {\n Handle: ({\n label,\n pressed,\n dragging,\n disabled,\n dragProps,\n onKeyDown,\n className,\n }) =>\n naiveButton(\n {\n type: \"button\",\n \"aria-label\": label,\n \"aria-pressed\": pressed,\n \"data-dragging\": dragging ? \"\" : undefined,\n \"data-adapttable-part\": \"row-reorder-handle\",\n \"data-adapttable-grip\": \"\",\n class: className,\n disabled,\n draggable: dragProps.draggable,\n onDragstart: (event: DragEvent) => {\n if (event.dataTransfer)\n dragProps.onDragStart({\n ...event,\n dataTransfer: event.dataTransfer,\n clientY: event.clientY,\n currentTarget:\n event.currentTarget instanceof HTMLElement\n ? event.currentTarget\n : null,\n preventDefault: () => event.preventDefault(),\n });\n },\n onDragend: dragProps.onDragEnd,\n onKeydown: (event: KeyboardEvent) =>\n onKeyDown({\n key: event.key,\n currentTarget:\n event.currentTarget instanceof HTMLElement\n ? event.currentTarget\n : null,\n preventDefault: () => event.preventDefault(),\n }),\n },\n \"↕\"\n ),\n Button: ({ label, part, disabled, onClick, className }) =>\n naiveButton(\n {\n type: \"button\",\n \"aria-label\": label,\n \"data-adapttable-part\": part,\n class: className,\n disabled,\n onClick,\n },\n label\n ),\n Menu: (props) => h(NaiveRowMoveMenu, props),\n};\n","<script setup lang=\"ts\" generic=\"TRow\">\nimport {\n RowReorderChrome,\n type RowReorderControlProps,\n useDataTableClassNames,\n} from \"@adapttable/vue/adapter\";\n\nimport { naiveReorderControls } from \"./naiveReorderControls\";\n\nconst props = defineProps<RowReorderControlProps<TRow>>();\nconst names = useDataTableClassNames();\nconst Render = () =>\n RowReorderChrome({\n ...props,\n classNames: { ...names.value },\n slots: naiveReorderControls,\n });\n\n// Declare no props so Vue forwards all root attributes, including id and data-*.\nconst renderProps: string[] = [];\nRender.props = renderProps;\n</script>\n\n<template>\n <Render />\n</template>\n","import type {\n RowReorderHandler,\n RowReorderOptions,\n TableFeature,\n} from \"@adapttable/vue\";\nimport {\n extendFeature,\n rowReorderControlKey,\n slotRender,\n} from \"@adapttable/vue/adapter\";\nimport { rowReorder as bindingRowReorder } from \"@adapttable/vue/features\";\nimport { h } from \"vue\";\n\nimport NaiveRowReorder from \"./reorder/NaiveRowReorder.vue\";\nexport {\n type RowReorderHandler,\n type RowReorderOptions,\n useRowReorder,\n} from \"@adapttable/vue\";\nexport function rowReorder<TRow>(\n onRowReorder: RowReorderHandler<TRow>,\n options?: RowReorderOptions<TRow>\n): TableFeature<TRow> {\n return extendFeature(bindingRowReorder(onRowReorder, options), [\n slotRender(rowReorderControlKey<TRow>(), (props) =>\n h(NaiveRowReorder<TRow>, { ...props })\n ),\n ]);\n}\n"],"mappings":"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"}
|
package/dist/row-reorder.cjs
CHANGED
|
@@ -1,193 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const require_select = require("./select-C8UKnsWO.cjs");
|
|
4
|
-
const require_modalEscape = require("./modalEscape-aYoIK8OW.cjs");
|
|
2
|
+
const require_row_reorder = require("./row-reorder-BRySq2FF.cjs");
|
|
5
3
|
let _adapttable_vue = require("@adapttable/vue");
|
|
6
|
-
|
|
7
|
-
let _adapttable_vue_features = require("@adapttable/vue/features");
|
|
8
|
-
let vue = require("vue");
|
|
9
|
-
let naive_ui = require("naive-ui");
|
|
10
|
-
//#region src/reorder/NaiveRowMoveMenu.ts
|
|
11
|
-
const NaiveRowMoveMenu = /*#__PURE__*/ (0, vue.defineComponent)((props) => {
|
|
12
|
-
const active = (0, _adapttable_vue_adapter.useScopeActivity)();
|
|
13
|
-
const container = (0, vue.shallowRef)(null);
|
|
14
|
-
const trigger = (0, vue.shallowRef)(null);
|
|
15
|
-
const card = (0, vue.shallowRef)(null);
|
|
16
|
-
const escape = require_modalEscape.useNaiveModalEscape(() => card.value ? require_button.htmlRoot(card.value) : null);
|
|
17
|
-
const descriptionId = (0, vue.useId)();
|
|
18
|
-
let revision = 0;
|
|
19
|
-
(0, vue.watch)([
|
|
20
|
-
active,
|
|
21
|
-
() => props.items,
|
|
22
|
-
() => props.confirmation
|
|
23
|
-
], () => {
|
|
24
|
-
revision++;
|
|
25
|
-
}, { flush: "sync" });
|
|
26
|
-
const restore = () => {
|
|
27
|
-
(0, vue.nextTick)(() => {
|
|
28
|
-
if (active.value && !props.confirmation && trigger.value?.isConnected) trigger.value.focus();
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
return () => {
|
|
32
|
-
const ticket = revision;
|
|
33
|
-
const live = active.value;
|
|
34
|
-
const current = () => live && active.value && ticket === revision;
|
|
35
|
-
const confirmation = props.confirmation;
|
|
36
|
-
const finish = (accept) => {
|
|
37
|
-
if (!current() || !confirmation || props.confirmation !== confirmation) return;
|
|
38
|
-
if (accept) confirmation.onConfirm();
|
|
39
|
-
else confirmation.onCancel();
|
|
40
|
-
restore();
|
|
41
|
-
};
|
|
42
|
-
const content = confirmation ? [
|
|
43
|
-
(0, vue.h)("p", { id: descriptionId }, confirmation.description),
|
|
44
|
-
require_button.naiveButton({
|
|
45
|
-
"data-adapttable-part": "row-move-cancel",
|
|
46
|
-
onClick: () => finish(false)
|
|
47
|
-
}, confirmation.cancelLabel),
|
|
48
|
-
require_button.naiveButton({
|
|
49
|
-
"data-adapttable-part": "row-move-confirm",
|
|
50
|
-
onClick: () => finish(true)
|
|
51
|
-
}, confirmation.confirmLabel)
|
|
52
|
-
] : [];
|
|
53
|
-
return (0, vue.h)("span", {
|
|
54
|
-
"data-adapttable-part": "row-move-menu",
|
|
55
|
-
ref: (0, _adapttable_vue_adapter.elementRef)((element) => {
|
|
56
|
-
container.value = element;
|
|
57
|
-
})
|
|
58
|
-
}, [(0, vue.h)("span", { "data-adapttable-part": "row-move-menu-content" }, [require_select.naiveSelect({
|
|
59
|
-
attrs: {
|
|
60
|
-
ref: (element) => {
|
|
61
|
-
trigger.value = element;
|
|
62
|
-
},
|
|
63
|
-
"aria-label": props.label,
|
|
64
|
-
placeholder: props.label,
|
|
65
|
-
"data-adapttable-part": "row-move-menu-trigger",
|
|
66
|
-
disabled: props.items.every((item) => item.disabled)
|
|
67
|
-
},
|
|
68
|
-
value: "",
|
|
69
|
-
optionPart: "row-move-menu-item",
|
|
70
|
-
virtualScroll: false,
|
|
71
|
-
options: props.items.map((item) => ({
|
|
72
|
-
value: item.id,
|
|
73
|
-
label: item.label,
|
|
74
|
-
disabled: item.disabled,
|
|
75
|
-
title: item.disabledReason
|
|
76
|
-
})),
|
|
77
|
-
onChange: (key) => {
|
|
78
|
-
if (!current()) return;
|
|
79
|
-
const item = props.items.find((entry) => entry.id === key);
|
|
80
|
-
if (item && !item.disabled) item.onSelect();
|
|
81
|
-
}
|
|
82
|
-
})]), confirmation && container.value ? (0, vue.h)(naive_ui.NModal, {
|
|
83
|
-
show: live,
|
|
84
|
-
to: container.value,
|
|
85
|
-
autoFocus: true,
|
|
86
|
-
trapFocus: true,
|
|
87
|
-
maskClosable: false,
|
|
88
|
-
"onUpdate:show": (show) => {
|
|
89
|
-
if (!show && escape.allow()) finish(false);
|
|
90
|
-
}
|
|
91
|
-
}, { default: () => (0, vue.h)(naive_ui.NCard, {
|
|
92
|
-
ref: card,
|
|
93
|
-
role: "alertdialog",
|
|
94
|
-
onKeydownCapture: escape.capture,
|
|
95
|
-
"aria-modal": true,
|
|
96
|
-
"aria-label": confirmation.title,
|
|
97
|
-
"aria-describedby": descriptionId,
|
|
98
|
-
"data-adapttable-part": "row-move-confirmation",
|
|
99
|
-
title: confirmation.title,
|
|
100
|
-
style: { width: "min(28rem,calc(100vw - 2rem))" }
|
|
101
|
-
}, { default: () => content }) }) : null]);
|
|
102
|
-
};
|
|
103
|
-
}, {
|
|
104
|
-
name: "NaiveRowMoveMenu",
|
|
105
|
-
props: {
|
|
106
|
-
label: { type: String },
|
|
107
|
-
items: { type: Array },
|
|
108
|
-
confirmation: { type: Object }
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region src/reorder/naiveReorderControls.ts
|
|
113
|
-
const naiveReorderControls = {
|
|
114
|
-
Handle: ({ label, pressed, dragging, disabled, dragProps, onKeyDown, className }) => require_button.naiveButton({
|
|
115
|
-
type: "button",
|
|
116
|
-
"aria-label": label,
|
|
117
|
-
"aria-pressed": pressed,
|
|
118
|
-
"data-dragging": dragging ? "" : void 0,
|
|
119
|
-
"data-adapttable-part": "row-reorder-handle",
|
|
120
|
-
"data-adapttable-grip": "",
|
|
121
|
-
class: className,
|
|
122
|
-
disabled,
|
|
123
|
-
draggable: dragProps.draggable,
|
|
124
|
-
onDragstart: (event) => {
|
|
125
|
-
if (event.dataTransfer) dragProps.onDragStart({
|
|
126
|
-
...event,
|
|
127
|
-
dataTransfer: event.dataTransfer,
|
|
128
|
-
clientY: event.clientY,
|
|
129
|
-
currentTarget: event.currentTarget instanceof HTMLElement ? event.currentTarget : null,
|
|
130
|
-
preventDefault: () => event.preventDefault()
|
|
131
|
-
});
|
|
132
|
-
},
|
|
133
|
-
onDragend: dragProps.onDragEnd,
|
|
134
|
-
onKeydown: (event) => onKeyDown({
|
|
135
|
-
key: event.key,
|
|
136
|
-
currentTarget: event.currentTarget instanceof HTMLElement ? event.currentTarget : null,
|
|
137
|
-
preventDefault: () => event.preventDefault()
|
|
138
|
-
})
|
|
139
|
-
}, "↕"),
|
|
140
|
-
Button: ({ label, part, disabled, onClick, className }) => require_button.naiveButton({
|
|
141
|
-
type: "button",
|
|
142
|
-
"aria-label": label,
|
|
143
|
-
"data-adapttable-part": part,
|
|
144
|
-
class: className,
|
|
145
|
-
disabled,
|
|
146
|
-
onClick
|
|
147
|
-
}, label),
|
|
148
|
-
Menu: (props) => (0, vue.h)(NaiveRowMoveMenu, props)
|
|
149
|
-
};
|
|
150
|
-
//#endregion
|
|
151
|
-
//#region src/reorder/NaiveRowReorder.vue
|
|
152
|
-
const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
153
|
-
__name: "NaiveRowReorder",
|
|
154
|
-
props: {
|
|
155
|
-
model: {},
|
|
156
|
-
labels: {},
|
|
157
|
-
mobile: { type: Boolean },
|
|
158
|
-
classNames: {},
|
|
159
|
-
rowId: {},
|
|
160
|
-
localIndex: {},
|
|
161
|
-
row: {},
|
|
162
|
-
windowStart: {},
|
|
163
|
-
rowCount: {}
|
|
164
|
-
},
|
|
165
|
-
setup(__props) {
|
|
166
|
-
const props = __props;
|
|
167
|
-
const names = (0, _adapttable_vue_adapter.useDataTableClassNames)();
|
|
168
|
-
const Render = () => (0, _adapttable_vue_adapter.RowReorderChrome)({
|
|
169
|
-
...props,
|
|
170
|
-
classNames: { ...names.value },
|
|
171
|
-
slots: naiveReorderControls
|
|
172
|
-
});
|
|
173
|
-
Render.props = [];
|
|
174
|
-
return (_ctx, _cache) => {
|
|
175
|
-
return (0, vue.openBlock)(), (0, vue.createBlock)(Render);
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
//#endregion
|
|
180
|
-
//#region src/row-reorder.ts
|
|
181
|
-
function rowReorder(onRowReorder, options) {
|
|
182
|
-
return (0, _adapttable_vue_adapter.extendFeature)((0, _adapttable_vue_features.rowReorder)(onRowReorder, options), [(0, _adapttable_vue_adapter.slotRender)((0, _adapttable_vue_adapter.rowReorderControlKey)(), (props) => (0, vue.h)(_sfc_main, { ...props }))]);
|
|
183
|
-
}
|
|
184
|
-
//#endregion
|
|
185
|
-
exports.rowReorder = rowReorder;
|
|
4
|
+
exports.rowReorder = require_row_reorder.rowReorder;
|
|
186
5
|
Object.defineProperty(exports, "useRowReorder", {
|
|
187
6
|
enumerable: true,
|
|
188
7
|
get: function() {
|
|
189
8
|
return _adapttable_vue.useRowReorder;
|
|
190
9
|
}
|
|
191
10
|
});
|
|
192
|
-
|
|
193
|
-
//# sourceMappingURL=row-reorder.cjs.map
|
package/dist/row-reorder.js
CHANGED
|
@@ -1,186 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as naiveSelect } from "./select-Bgc5ttop.js";
|
|
3
|
-
import { t as useNaiveModalEscape } from "./modalEscape-CP6_uqjE.js";
|
|
4
|
-
import { useRowReorder } from "@adapttable/vue";
|
|
5
|
-
import { RowReorderChrome, elementRef, extendFeature, rowReorderControlKey, slotRender, useDataTableClassNames, useScopeActivity } from "@adapttable/vue/adapter";
|
|
6
|
-
import { rowReorder as rowReorder$1 } from "@adapttable/vue/features";
|
|
7
|
-
import { createBlock, defineComponent, h, nextTick, openBlock, shallowRef, useId, watch } from "vue";
|
|
8
|
-
import { NCard, NModal } from "naive-ui";
|
|
9
|
-
//#region src/reorder/NaiveRowMoveMenu.ts
|
|
10
|
-
const NaiveRowMoveMenu = /*#__PURE__*/ defineComponent((props) => {
|
|
11
|
-
const active = useScopeActivity();
|
|
12
|
-
const container = shallowRef(null);
|
|
13
|
-
const trigger = shallowRef(null);
|
|
14
|
-
const card = shallowRef(null);
|
|
15
|
-
const escape = useNaiveModalEscape(() => card.value ? htmlRoot(card.value) : null);
|
|
16
|
-
const descriptionId = useId();
|
|
17
|
-
let revision = 0;
|
|
18
|
-
watch([
|
|
19
|
-
active,
|
|
20
|
-
() => props.items,
|
|
21
|
-
() => props.confirmation
|
|
22
|
-
], () => {
|
|
23
|
-
revision++;
|
|
24
|
-
}, { flush: "sync" });
|
|
25
|
-
const restore = () => {
|
|
26
|
-
nextTick(() => {
|
|
27
|
-
if (active.value && !props.confirmation && trigger.value?.isConnected) trigger.value.focus();
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
return () => {
|
|
31
|
-
const ticket = revision;
|
|
32
|
-
const live = active.value;
|
|
33
|
-
const current = () => live && active.value && ticket === revision;
|
|
34
|
-
const confirmation = props.confirmation;
|
|
35
|
-
const finish = (accept) => {
|
|
36
|
-
if (!current() || !confirmation || props.confirmation !== confirmation) return;
|
|
37
|
-
if (accept) confirmation.onConfirm();
|
|
38
|
-
else confirmation.onCancel();
|
|
39
|
-
restore();
|
|
40
|
-
};
|
|
41
|
-
const content = confirmation ? [
|
|
42
|
-
h("p", { id: descriptionId }, confirmation.description),
|
|
43
|
-
naiveButton({
|
|
44
|
-
"data-adapttable-part": "row-move-cancel",
|
|
45
|
-
onClick: () => finish(false)
|
|
46
|
-
}, confirmation.cancelLabel),
|
|
47
|
-
naiveButton({
|
|
48
|
-
"data-adapttable-part": "row-move-confirm",
|
|
49
|
-
onClick: () => finish(true)
|
|
50
|
-
}, confirmation.confirmLabel)
|
|
51
|
-
] : [];
|
|
52
|
-
return h("span", {
|
|
53
|
-
"data-adapttable-part": "row-move-menu",
|
|
54
|
-
ref: elementRef((element) => {
|
|
55
|
-
container.value = element;
|
|
56
|
-
})
|
|
57
|
-
}, [h("span", { "data-adapttable-part": "row-move-menu-content" }, [naiveSelect({
|
|
58
|
-
attrs: {
|
|
59
|
-
ref: (element) => {
|
|
60
|
-
trigger.value = element;
|
|
61
|
-
},
|
|
62
|
-
"aria-label": props.label,
|
|
63
|
-
placeholder: props.label,
|
|
64
|
-
"data-adapttable-part": "row-move-menu-trigger",
|
|
65
|
-
disabled: props.items.every((item) => item.disabled)
|
|
66
|
-
},
|
|
67
|
-
value: "",
|
|
68
|
-
optionPart: "row-move-menu-item",
|
|
69
|
-
virtualScroll: false,
|
|
70
|
-
options: props.items.map((item) => ({
|
|
71
|
-
value: item.id,
|
|
72
|
-
label: item.label,
|
|
73
|
-
disabled: item.disabled,
|
|
74
|
-
title: item.disabledReason
|
|
75
|
-
})),
|
|
76
|
-
onChange: (key) => {
|
|
77
|
-
if (!current()) return;
|
|
78
|
-
const item = props.items.find((entry) => entry.id === key);
|
|
79
|
-
if (item && !item.disabled) item.onSelect();
|
|
80
|
-
}
|
|
81
|
-
})]), confirmation && container.value ? h(NModal, {
|
|
82
|
-
show: live,
|
|
83
|
-
to: container.value,
|
|
84
|
-
autoFocus: true,
|
|
85
|
-
trapFocus: true,
|
|
86
|
-
maskClosable: false,
|
|
87
|
-
"onUpdate:show": (show) => {
|
|
88
|
-
if (!show && escape.allow()) finish(false);
|
|
89
|
-
}
|
|
90
|
-
}, { default: () => h(NCard, {
|
|
91
|
-
ref: card,
|
|
92
|
-
role: "alertdialog",
|
|
93
|
-
onKeydownCapture: escape.capture,
|
|
94
|
-
"aria-modal": true,
|
|
95
|
-
"aria-label": confirmation.title,
|
|
96
|
-
"aria-describedby": descriptionId,
|
|
97
|
-
"data-adapttable-part": "row-move-confirmation",
|
|
98
|
-
title: confirmation.title,
|
|
99
|
-
style: { width: "min(28rem,calc(100vw - 2rem))" }
|
|
100
|
-
}, { default: () => content }) }) : null]);
|
|
101
|
-
};
|
|
102
|
-
}, {
|
|
103
|
-
name: "NaiveRowMoveMenu",
|
|
104
|
-
props: {
|
|
105
|
-
label: { type: String },
|
|
106
|
-
items: { type: Array },
|
|
107
|
-
confirmation: { type: Object }
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
//#endregion
|
|
111
|
-
//#region src/reorder/naiveReorderControls.ts
|
|
112
|
-
const naiveReorderControls = {
|
|
113
|
-
Handle: ({ label, pressed, dragging, disabled, dragProps, onKeyDown, className }) => naiveButton({
|
|
114
|
-
type: "button",
|
|
115
|
-
"aria-label": label,
|
|
116
|
-
"aria-pressed": pressed,
|
|
117
|
-
"data-dragging": dragging ? "" : void 0,
|
|
118
|
-
"data-adapttable-part": "row-reorder-handle",
|
|
119
|
-
"data-adapttable-grip": "",
|
|
120
|
-
class: className,
|
|
121
|
-
disabled,
|
|
122
|
-
draggable: dragProps.draggable,
|
|
123
|
-
onDragstart: (event) => {
|
|
124
|
-
if (event.dataTransfer) dragProps.onDragStart({
|
|
125
|
-
...event,
|
|
126
|
-
dataTransfer: event.dataTransfer,
|
|
127
|
-
clientY: event.clientY,
|
|
128
|
-
currentTarget: event.currentTarget instanceof HTMLElement ? event.currentTarget : null,
|
|
129
|
-
preventDefault: () => event.preventDefault()
|
|
130
|
-
});
|
|
131
|
-
},
|
|
132
|
-
onDragend: dragProps.onDragEnd,
|
|
133
|
-
onKeydown: (event) => onKeyDown({
|
|
134
|
-
key: event.key,
|
|
135
|
-
currentTarget: event.currentTarget instanceof HTMLElement ? event.currentTarget : null,
|
|
136
|
-
preventDefault: () => event.preventDefault()
|
|
137
|
-
})
|
|
138
|
-
}, "↕"),
|
|
139
|
-
Button: ({ label, part, disabled, onClick, className }) => naiveButton({
|
|
140
|
-
type: "button",
|
|
141
|
-
"aria-label": label,
|
|
142
|
-
"data-adapttable-part": part,
|
|
143
|
-
class: className,
|
|
144
|
-
disabled,
|
|
145
|
-
onClick
|
|
146
|
-
}, label),
|
|
147
|
-
Menu: (props) => h(NaiveRowMoveMenu, props)
|
|
148
|
-
};
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region src/reorder/NaiveRowReorder.vue
|
|
151
|
-
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
152
|
-
__name: "NaiveRowReorder",
|
|
153
|
-
props: {
|
|
154
|
-
model: {},
|
|
155
|
-
labels: {},
|
|
156
|
-
mobile: { type: Boolean },
|
|
157
|
-
classNames: {},
|
|
158
|
-
rowId: {},
|
|
159
|
-
localIndex: {},
|
|
160
|
-
row: {},
|
|
161
|
-
windowStart: {},
|
|
162
|
-
rowCount: {}
|
|
163
|
-
},
|
|
164
|
-
setup(__props) {
|
|
165
|
-
const props = __props;
|
|
166
|
-
const names = useDataTableClassNames();
|
|
167
|
-
const Render = () => RowReorderChrome({
|
|
168
|
-
...props,
|
|
169
|
-
classNames: { ...names.value },
|
|
170
|
-
slots: naiveReorderControls
|
|
171
|
-
});
|
|
172
|
-
Render.props = [];
|
|
173
|
-
return (_ctx, _cache) => {
|
|
174
|
-
return openBlock(), createBlock(Render);
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
//#endregion
|
|
179
|
-
//#region src/row-reorder.ts
|
|
180
|
-
function rowReorder(onRowReorder, options) {
|
|
181
|
-
return extendFeature(rowReorder$1(onRowReorder, options), [slotRender(rowReorderControlKey(), (props) => h(_sfc_main, { ...props }))]);
|
|
182
|
-
}
|
|
183
|
-
//#endregion
|
|
1
|
+
import { n as useRowReorder, t as rowReorder } from "./row-reorder-BNYYEL8w.js";
|
|
184
2
|
export { rowReorder, useRowReorder };
|
|
185
|
-
|
|
186
|
-
//# sourceMappingURL=row-reorder.js.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const require_button = require("./button-CaakTzYM.cjs");
|
|
2
|
+
require("@adapttable/vue");
|
|
3
|
+
let _adapttable_vue_adapter = require("@adapttable/vue/adapter");
|
|
4
|
+
let _adapttable_vue_features = require("@adapttable/vue/features");
|
|
5
|
+
let vue = require("vue");
|
|
6
|
+
let naive_ui = require("naive-ui");
|
|
7
|
+
//#region src/actions/sidePanelControls.ts
|
|
8
|
+
const naiveSidePanelSlots = (names = {}) => ({
|
|
9
|
+
Frame: (props) => (0, vue.h)(naive_ui.NCard, {
|
|
10
|
+
tag: "aside",
|
|
11
|
+
size: "small",
|
|
12
|
+
"data-adapttable-part": "side-panel",
|
|
13
|
+
class: props.className,
|
|
14
|
+
"data-side": props.side,
|
|
15
|
+
style: {
|
|
16
|
+
minWidth: "min(18rem,100%)",
|
|
17
|
+
maxWidth: "100%"
|
|
18
|
+
}
|
|
19
|
+
}, { default: () => props.children }),
|
|
20
|
+
Tab: (props) => require_button.naiveButton({
|
|
21
|
+
...(0, _adapttable_vue_adapter.toVueAttrs)(props.buttonProps),
|
|
22
|
+
class: names.sidePanelTab
|
|
23
|
+
}, props.panel.label),
|
|
24
|
+
Close: (props) => require_button.naiveButton({
|
|
25
|
+
"aria-label": props.label,
|
|
26
|
+
"data-adapttable-part": "side-panel-close",
|
|
27
|
+
class: names.sidePanelClose,
|
|
28
|
+
onClick: props.onClose
|
|
29
|
+
}, props.label)
|
|
30
|
+
});
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/side-panel.ts
|
|
33
|
+
const NaiveSidePanel = /*#__PURE__*/ (0, vue.defineComponent)((props) => {
|
|
34
|
+
const slots = {
|
|
35
|
+
Frame: (control) => naiveSidePanelSlots(props.classNames).Frame(control),
|
|
36
|
+
Tab: (control) => naiveSidePanelSlots(props.classNames).Tab(control),
|
|
37
|
+
Close: (control) => naiveSidePanelSlots(props.classNames).Close(control)
|
|
38
|
+
};
|
|
39
|
+
return () => (0, vue.h)(_adapttable_vue_adapter.SidePanelChrome, {
|
|
40
|
+
...props,
|
|
41
|
+
slots
|
|
42
|
+
});
|
|
43
|
+
}, {
|
|
44
|
+
name: "NaiveSidePanel",
|
|
45
|
+
props: {
|
|
46
|
+
model: { type: Object },
|
|
47
|
+
labels: { type: Object },
|
|
48
|
+
dir: { type: String },
|
|
49
|
+
classNames: { type: Object },
|
|
50
|
+
container: { type: Object }
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
function sidePanel(options) {
|
|
54
|
+
return (0, _adapttable_vue_adapter.extendFeature)((0, _adapttable_vue_features.sidePanel)(options), [(0, _adapttable_vue_adapter.slotRender)(_adapttable_vue_adapter.SIDE_PANEL_CONTROL, (props) => (0, vue.h)(NaiveSidePanel, { ...props }))]);
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
Object.defineProperty(exports, "sidePanel", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function() {
|
|
60
|
+
return sidePanel;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=side-panel-Bf4zBlYZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side-panel-Bf4zBlYZ.cjs","names":["h","NCard","naiveButton","toVueAttrs","h","SidePanelChrome","extendFeature","bindingSidePanel","slotRender","SIDE_PANEL_CONTROL"],"sources":["../src/actions/sidePanelControls.ts","../src/side-panel.ts"],"sourcesContent":["import { type SidePanelSlots, toVueAttrs } from \"@adapttable/vue/adapter\";\nimport { NCard } from \"naive-ui\";\nimport { h } from \"vue\";\n\nimport { naiveButton } from \"../controls/button\";\n\nexport const naiveSidePanelSlots = (\n names: Readonly<Record<string, string | undefined>> = {}\n): SidePanelSlots => ({\n Frame: (props) =>\n h(\n NCard,\n {\n tag: \"aside\",\n size: \"small\",\n \"data-adapttable-part\": \"side-panel\",\n class: props.className,\n \"data-side\": props.side,\n style: { minWidth: \"min(18rem,100%)\", maxWidth: \"100%\" },\n },\n { default: () => props.children }\n ),\n Tab: (props) =>\n naiveButton(\n { ...toVueAttrs(props.buttonProps), class: names.sidePanelTab },\n props.panel.label\n ),\n Close: (props) =>\n naiveButton(\n {\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","import { type StaticTableFeature } from \"@adapttable/vue\";\nimport {\n extendFeature,\n SIDE_PANEL_CONTROL,\n SidePanelChrome,\n type SidePanelChromeProps,\n type SidePanelSlots,\n slotRender,\n} from \"@adapttable/vue/adapter\";\nimport { sidePanel as bindingSidePanel } from \"@adapttable/vue/features\";\nimport { defineComponent, h, type PropType } from \"vue\";\n\nimport { naiveSidePanelSlots } from \"./actions/sidePanelControls\";\nconst NaiveSidePanel = /*#__PURE__*/ defineComponent(\n (props: Omit<SidePanelChromeProps, \"slots\" | \"presentation\">) => {\n const slots: SidePanelSlots = {\n Frame: (control) => naiveSidePanelSlots(props.classNames).Frame(control),\n Tab: (control) => naiveSidePanelSlots(props.classNames).Tab(control),\n Close: (control) => naiveSidePanelSlots(props.classNames).Close(control),\n };\n return () => h(SidePanelChrome, { ...props, slots });\n },\n {\n name: \"NaiveSidePanel\",\n props: {\n model: {\n type: Object as PropType<\n Omit<SidePanelChromeProps, \"slots\" | \"presentation\">[\"model\"]\n >,\n },\n labels: {\n type: Object as PropType<\n Omit<SidePanelChromeProps, \"slots\" | \"presentation\">[\"labels\"]\n >,\n },\n dir: {\n type: String as PropType<\n Omit<SidePanelChromeProps, \"slots\" | \"presentation\">[\"dir\"]\n >,\n },\n classNames: {\n type: Object as PropType<\n Omit<SidePanelChromeProps, \"slots\" | \"presentation\">[\"classNames\"]\n >,\n },\n container: {\n type: Object as PropType<\n Omit<SidePanelChromeProps, \"slots\" | \"presentation\">[\"container\"]\n >,\n },\n },\n }\n);\nexport function sidePanel(\n options: Parameters<typeof bindingSidePanel>[0]\n): StaticTableFeature {\n return extendFeature(bindingSidePanel(options), [\n slotRender(SIDE_PANEL_CONTROL, (props) => h(NaiveSidePanel, { ...props })),\n ]);\n}\nexport type {\n SidePanelOptions,\n SidePanelPanel,\n} from \"@adapttable/vue/features\";\n"],"mappings":";;;;;;;AAMA,MAAa,uBACX,QAAsD,CAAC,OACnC;CACpB,QAAQ,WAAA,GACNA,IAAAA,EAAAA,CACEC,SAAAA,OACA;EACE,KAAK;EACL,MAAM;EACN,wBAAwB;EACxB,OAAO,MAAM;EACb,aAAa,MAAM;EACnB,OAAO;GAAE,UAAU;GAAmB,UAAU;EAAO;CACzD,GACA,EAAE,eAAe,MAAM,SAAS,CAClC;CACF,MAAM,UACJC,eAAAA,YACE;EAAE,IAAA,GAAGC,wBAAAA,WAAAA,CAAW,MAAM,WAAW;EAAG,OAAO,MAAM;CAAa,GAC9D,MAAM,MAAM,KACd;CACF,QAAQ,UACND,eAAAA,YACE;EACE,cAAc,MAAM;EACpB,wBAAwB;EACxB,OAAO,MAAM;EACb,SAAS,MAAM;CACjB,GACA,MAAM,KACR;AACJ;;;ACxBA,MAAM,iBAA+B,eAAA,GAAA,IAAA,gBAAA,EAClC,UAAgE;CAC/D,MAAM,QAAwB;EAC5B,QAAQ,YAAY,oBAAoB,MAAM,UAAU,CAAC,CAAC,MAAM,OAAO;EACvE,MAAM,YAAY,oBAAoB,MAAM,UAAU,CAAC,CAAC,IAAI,OAAO;EACnE,QAAQ,YAAY,oBAAoB,MAAM,UAAU,CAAC,CAAC,MAAM,OAAO;CACzE;CACA,cAAA,GAAaE,IAAAA,EAAAA,CAAEC,wBAAAA,iBAAiB;EAAE,GAAG;EAAO;CAAM,CAAC;AACrD,GACA;CACE,MAAM;CACN,OAAO;EACL,OAAO,EACL,MAAM,OAGR;EACA,QAAQ,EACN,MAAM,OAGR;EACA,KAAK,EACH,MAAM,OAGR;EACA,YAAY,EACV,MAAM,OAGR;EACA,WAAW,EACT,MAAM,OAGR;CACF;AACF,CACF;AACA,SAAgB,UACd,SACoB;CACpB,QAAA,GAAOC,wBAAAA,cAAAA,EAAAA,GAAcC,yBAAAA,UAAAA,CAAiB,OAAO,GAAG,EAAA,GAC9CC,wBAAAA,WAAAA,CAAWC,wBAAAA,qBAAqB,WAAA,GAAUL,IAAAA,EAAAA,CAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC,CAAC,CAC3E,CAAC;AACH"}
|