@adapttable/element-plus 0.5.0 → 0.6.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 +10 -7
- package/dist/{ElementRowActions-CUlFbY6s.js → ElementRowActions-CUdXemC-.js} +2 -2
- package/dist/ElementRowActions-CUdXemC-.js.map +1 -0
- package/dist/{ElementRowActions-ClYC3Ssq.cjs → ElementRowActions-XyX2PAWL.cjs} +2 -2
- package/dist/ElementRowActions-XyX2PAWL.cjs.map +1 -0
- package/dist/assistant.cjs +309 -5
- package/dist/assistant.cjs.map +1 -0
- package/dist/assistant.js +305 -1
- package/dist/assistant.js.map +1 -0
- package/dist/batch-editing.cjs +1 -1
- package/dist/batch-editing.d.cts +1 -1
- package/dist/batch-editing.d.ts +1 -1
- package/dist/batch-editing.js +1 -1
- package/dist/cell-navigation-DJ-_1Mjr.cjs.map +1 -1
- package/dist/cell-navigation-arDY86xD.js.map +1 -1
- package/dist/cell-navigation.d.cts +1 -1
- package/dist/cell-navigation.d.cts.map +1 -1
- package/dist/cell-navigation.d.ts +1 -1
- package/dist/cell-navigation.d.ts.map +1 -1
- package/dist/column-layout.cjs +24 -0
- package/dist/column-layout.cjs.map +1 -0
- package/dist/column-layout.d.cts +12 -0
- package/dist/column-layout.d.cts.map +1 -0
- package/dist/column-layout.d.ts +12 -0
- package/dist/column-layout.d.ts.map +1 -0
- package/dist/column-layout.js +22 -0
- package/dist/column-layout.js.map +1 -0
- package/dist/{column-menu-jNw7kuxp.cjs → column-menu-CqyYtohz.cjs} +3 -3
- package/dist/{column-menu-jNw7kuxp.cjs.map → column-menu-CqyYtohz.cjs.map} +1 -1
- package/dist/{column-menu-BUxMPyJI.js → column-menu-CwTWnahc.js} +3 -3
- package/dist/{column-menu-BUxMPyJI.js.map → column-menu-CwTWnahc.js.map} +1 -1
- package/dist/column-menu.cjs +1 -1
- package/dist/column-menu.d.cts +34 -2
- package/dist/column-menu.d.cts.map +1 -0
- package/dist/column-menu.d.ts +34 -2
- package/dist/column-menu.d.ts.map +1 -0
- package/dist/column-menu.js +1 -1
- package/dist/{editing-DHjzbw-I.js → editing-BlpYR839.js} +19 -5
- package/dist/{editing-DHjzbw-I.js.map → editing-BlpYR839.js.map} +1 -1
- package/dist/{editing-Bhw_4VG8.cjs → editing-CSqZENeW.cjs} +23 -3
- package/dist/editing-CSqZENeW.cjs.map +1 -0
- package/dist/{editing-BnLdNDlo.d.ts → editing-CU4pOLjr.d.ts} +10 -2
- package/dist/{editing-BnLdNDlo.d.ts.map → editing-CU4pOLjr.d.ts.map} +1 -1
- package/dist/{editing-Cg6ZNvSa.d.cts → editing-DJrjZjpu.d.cts} +10 -2
- package/dist/{editing-Cg6ZNvSa.d.cts.map → editing-DJrjZjpu.d.cts.map} +1 -1
- package/dist/editing.cjs +4 -13
- package/dist/editing.d.cts +2 -2
- package/dist/editing.d.ts +2 -2
- package/dist/editing.js +2 -2
- package/dist/export-kuOvIoQg.js +10 -0
- package/dist/export-kuOvIoQg.js.map +1 -0
- package/dist/{export-csv.cjs → export-x-Ow8SY5.cjs} +7 -3
- package/dist/export-x-Ow8SY5.cjs.map +1 -0
- package/dist/export.cjs +2 -2
- package/dist/export.d.cts +9 -2
- package/dist/export.d.cts.map +1 -0
- package/dist/export.d.ts +9 -2
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +1 -1
- package/dist/filtering.cjs +22 -0
- package/dist/filtering.cjs.map +1 -0
- package/dist/filtering.d.cts +13 -0
- package/dist/filtering.d.cts.map +1 -0
- package/dist/filtering.d.ts +13 -0
- package/dist/filtering.d.ts.map +1 -0
- package/dist/filtering.js +21 -0
- package/dist/filtering.js.map +1 -0
- package/dist/{filters-C0YXpD3-.js → filters-CIQ1uMZw.js} +6 -5
- package/dist/filters-CIQ1uMZw.js.map +1 -0
- package/dist/{filters-hVQM8Cok.cjs → filters-CYQFsZ_f.cjs} +5 -4
- package/dist/filters-CYQFsZ_f.cjs.map +1 -0
- package/dist/filters.cjs +1 -1
- package/dist/filters.d.cts +77 -2
- package/dist/filters.d.cts.map +1 -0
- package/dist/filters.d.ts +77 -2
- package/dist/filters.d.ts.map +1 -0
- package/dist/filters.js +1 -1
- package/dist/grouping-panel.cjs +145 -3
- package/dist/grouping-panel.cjs.map +1 -0
- package/dist/grouping-panel.js +145 -2
- package/dist/grouping-panel.js.map +1 -0
- package/dist/header-filters.d.cts +23 -2
- package/dist/header-filters.d.cts.map +1 -0
- package/dist/header-filters.d.ts +23 -2
- package/dist/header-filters.d.ts.map +1 -0
- package/dist/index.cjs +2 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -26
- package/dist/index.js.map +1 -1
- package/dist/preset.cjs +8 -9
- package/dist/preset.cjs.map +1 -1
- package/dist/preset.js +7 -8
- package/dist/preset.js.map +1 -1
- package/dist/row-actions.cjs +1 -1
- package/dist/row-actions.d.cts +7 -2
- package/dist/row-actions.d.cts.map +1 -0
- package/dist/row-actions.d.ts +7 -2
- package/dist/row-actions.d.ts.map +1 -0
- package/dist/row-actions.js +1 -1
- package/dist/row-pinning.cjs +1 -1
- package/dist/row-pinning.d.cts +8 -2
- package/dist/row-pinning.d.cts.map +1 -0
- package/dist/row-pinning.d.ts +8 -2
- package/dist/row-pinning.d.ts.map +1 -0
- package/dist/row-pinning.js +1 -1
- package/dist/row-reorder.cjs +155 -2
- package/dist/row-reorder.cjs.map +1 -0
- package/dist/row-reorder.d.cts +2 -1
- package/dist/row-reorder.d.cts.map +1 -1
- package/dist/row-reorder.d.ts +2 -1
- package/dist/row-reorder.d.ts.map +1 -1
- package/dist/row-reorder.js +156 -1
- package/dist/row-reorder.js.map +1 -0
- package/dist/rows.d.cts +2 -2
- package/dist/rows.d.ts +2 -2
- package/dist/selection.cjs +8 -0
- package/dist/selection.d.cts +2 -0
- package/dist/selection.d.ts +2 -0
- package/dist/selection.js +2 -0
- package/dist/styles.css +57 -57
- package/package.json +33 -23
- package/dist/ElementRowActions-CUlFbY6s.js.map +0 -1
- package/dist/ElementRowActions-ClYC3Ssq.cjs.map +0 -1
- package/dist/assistant-D4l4OdXN.cjs +0 -329
- package/dist/assistant-D4l4OdXN.cjs.map +0 -1
- package/dist/assistant-DRDxJajO.js +0 -306
- package/dist/assistant-DRDxJajO.js.map +0 -1
- package/dist/column-menu-CAkx6AjR.d.ts +0 -33
- package/dist/column-menu-CAkx6AjR.d.ts.map +0 -1
- package/dist/column-menu-DsL_xeEM.d.cts +0 -33
- package/dist/column-menu-DsL_xeEM.d.cts.map +0 -1
- package/dist/editing-Bhw_4VG8.cjs.map +0 -1
- package/dist/export-csv-DRDjZuQj.d.cts +0 -9
- package/dist/export-csv-DRDjZuQj.d.cts.map +0 -1
- package/dist/export-csv-VyICO_s0.d.ts +0 -9
- package/dist/export-csv-VyICO_s0.d.ts.map +0 -1
- package/dist/export-csv.cjs.map +0 -1
- package/dist/export-csv.d.cts +0 -2
- package/dist/export-csv.d.ts +0 -2
- package/dist/export-csv.js +0 -10
- package/dist/export-csv.js.map +0 -1
- package/dist/features.cjs +0 -220
- package/dist/features.d.cts +0 -36
- package/dist/features.d.ts +0 -36
- package/dist/features.js +0 -32
- package/dist/filters-C0YXpD3-.js.map +0 -1
- package/dist/filters-Ci3fdJMe.d.cts +0 -77
- package/dist/filters-Ci3fdJMe.d.cts.map +0 -1
- package/dist/filters-Dh2MjW9V.d.ts +0 -77
- package/dist/filters-Dh2MjW9V.d.ts.map +0 -1
- package/dist/filters-hVQM8Cok.cjs.map +0 -1
- package/dist/grouping-panel-B7j8sSpT.js +0 -146
- package/dist/grouping-panel-B7j8sSpT.js.map +0 -1
- package/dist/grouping-panel-B_ibl915.cjs +0 -150
- package/dist/grouping-panel-B_ibl915.cjs.map +0 -1
- package/dist/header-filters-B2B5RqQS.d.ts +0 -24
- package/dist/header-filters-B2B5RqQS.d.ts.map +0 -1
- package/dist/header-filters-hGm_7LFO.d.cts +0 -24
- package/dist/header-filters-hGm_7LFO.d.cts.map +0 -1
- package/dist/row-actions-VRa4T6oF.d.cts +0 -7
- package/dist/row-actions-VRa4T6oF.d.cts.map +0 -1
- package/dist/row-actions-VRa4T6oF.d.ts +0 -7
- package/dist/row-actions-VRa4T6oF.d.ts.map +0 -1
- package/dist/row-pinning-B0WfYDZD.d.ts +0 -8
- package/dist/row-pinning-B0WfYDZD.d.ts.map +0 -1
- package/dist/row-pinning-LzBZmZcZ.d.cts +0 -8
- package/dist/row-pinning-LzBZmZcZ.d.cts.map +0 -1
- package/dist/row-reorder-BYwX3CBP.js +0 -157
- package/dist/row-reorder-BYwX3CBP.js.map +0 -1
- package/dist/row-reorder-MSR2yDN6.cjs +0 -161
- package/dist/row-reorder-MSR2yDN6.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ AdaptTable's Vue data table with Element Plus controls and card surfaces.
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
9
|
import { ref } from "vue";
|
|
10
10
|
import { DataTable, type ColumnDef } from "@adapttable/element-plus";
|
|
11
|
+
import { selection } from "@adapttable/element-plus/selection";
|
|
11
12
|
import "element-plus/dist/index.css";
|
|
12
13
|
import "@adapttable/element-plus/styles.css";
|
|
13
14
|
|
|
@@ -26,29 +27,31 @@ const columns: ColumnDef<Person>[] = [
|
|
|
26
27
|
{ key: "score", header: "Score", sortable: true },
|
|
27
28
|
];
|
|
28
29
|
const selectedIds = ref<string[]>([]);
|
|
30
|
+
function changeSelection(ids: string[]) {
|
|
31
|
+
selectedIds.value = ids;
|
|
32
|
+
}
|
|
29
33
|
const rowKey = (row: Person) => row.id;
|
|
30
34
|
</script>
|
|
31
35
|
|
|
32
36
|
<template>
|
|
33
37
|
<DataTable
|
|
34
|
-
v-model:selected-ids="selectedIds"
|
|
35
38
|
:data="rows"
|
|
36
39
|
:columns="columns"
|
|
37
40
|
:row-key="rowKey"
|
|
38
41
|
:url-sync="false"
|
|
39
|
-
|
|
42
|
+
:features="[selection({ selectedIds, onSelectionChange: changeSelection })]"
|
|
40
43
|
/>
|
|
41
44
|
</template>
|
|
42
45
|
```
|
|
43
46
|
|
|
44
|
-
##
|
|
47
|
+
## Feature imports
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
`DataTable` import does not load this barrel.
|
|
49
|
+
Import each factory from its own entry. The base `DataTable` import does not
|
|
50
|
+
load a feature.
|
|
49
51
|
|
|
50
52
|
```ts
|
|
51
|
-
import { editing
|
|
53
|
+
import { editing } from "@adapttable/element-plus/editing";
|
|
54
|
+
import { filters } from "@adapttable/element-plus/filters";
|
|
52
55
|
```
|
|
53
56
|
|
|
54
57
|
The factories retain their individual signatures, native controls and
|
|
@@ -19,7 +19,7 @@ const ElementRowActionsPresentation = defineComponent((props) => {
|
|
|
19
19
|
};
|
|
20
20
|
const attrs = (action) => mergeProps({
|
|
21
21
|
key: action.key,
|
|
22
|
-
class:
|
|
22
|
+
class: props.classNames.actionButton,
|
|
23
23
|
onClick: (event) => event.stopPropagation()
|
|
24
24
|
}, action.attrs);
|
|
25
25
|
const menuItem = (action) => h(ElDropdownItem, {
|
|
@@ -56,4 +56,4 @@ const ElementRowActions = /* @__PURE__ */ withProps(function ElementRowActions(p
|
|
|
56
56
|
//#endregion
|
|
57
57
|
export { ElementRowActions as t };
|
|
58
58
|
|
|
59
|
-
//# sourceMappingURL=ElementRowActions-
|
|
59
|
+
//# sourceMappingURL=ElementRowActions-CUdXemC-.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ElementRowActions-CUdXemC-.js","names":[],"sources":["../src/ElementRowActions.ts"],"sourcesContent":["import type { RowActionControl } from \"@adapttable/vue\";\nimport {\n type DataTableClassNames,\n rowActionContent,\n type RowActionsLayout,\n withProps,\n} from \"@adapttable/vue/adapter\";\nimport { ElDropdown, ElDropdownItem, ElDropdownMenu } from \"element-plus\";\nimport {\n createVNode,\n defineComponent,\n Fragment,\n h,\n mergeProps,\n shallowRef,\n type VNode,\n} from \"vue\";\n\nimport { elementButton } from \"./controls/button\";\n\ninterface ElementRowActionsProps<TRow> {\n readonly controls: readonly RowActionControl<TRow>[];\n readonly layout?: RowActionsLayout;\n readonly label: string;\n readonly classNames: DataTableClassNames;\n}\nconst actionProps = {\n controls: null,\n layout: null,\n label: null,\n classNames: null,\n} satisfies Record<keyof ElementRowActionsProps<unknown>, unknown>;\n\nconst ElementRowActionsPresentation = defineComponent(\n (props: ElementRowActionsProps<unknown>) => {\n const trigger = shallowRef<HTMLElement | null>(null);\n const setTrigger = (element: HTMLElement | null) => {\n trigger.value = element;\n };\n const returnToTrigger = () => {\n if (trigger.value?.isConnected)\n trigger.value.focus({ preventScroll: true });\n };\n const attrs = (action: RowActionControl<unknown>) =>\n mergeProps(\n {\n key: action.key,\n class: props.classNames.actionButton,\n onClick: (event: MouseEvent) => event.stopPropagation(),\n },\n action.attrs\n );\n const menuItem = (action: RowActionControl<unknown>) =>\n h(\n ElDropdownItem,\n {\n ...mergeProps({ onClick: returnToTrigger }, attrs(action)),\n type: undefined,\n },\n { default: () => action.label }\n );\n return () => {\n if (props.layout !== \"menu\" || props.controls.length === 0)\n return h(\n Fragment,\n null,\n props.controls.map((action) =>\n elementButton(attrs(action), rowActionContent(action))\n )\n );\n return h(\n ElDropdown,\n {\n trigger: \"click\",\n teleported: false,\n \"data-adapttable-part\": \"row-actions-menu\",\n class: props.classNames.rowActionsMenu,\n onPointerdown: (event: PointerEvent) => event.stopPropagation(),\n },\n {\n default: () =>\n elementButton(\n {\n ref: setTrigger,\n \"data-adapttable-part\": \"row-actions-trigger\",\n class: props.classNames.rowActionsTrigger,\n \"aria-label\": props.label,\n onClick: (event: MouseEvent) => event.stopPropagation(),\n },\n \"⋮\"\n ),\n dropdown: () =>\n h(\n ElDropdownMenu,\n {},\n { default: () => props.controls.map(menuItem) }\n ),\n }\n );\n };\n },\n { name: \"ElementRowActionsPresentation\", props: actionProps }\n);\n\n/** A menu returns focus to its native trigger before an action opens another surface. */\nexport const ElementRowActions = /* @__PURE__ */ withProps(\n function ElementRowActions<TRow>(props: ElementRowActionsProps<TRow>): VNode {\n return createVNode(ElementRowActionsPresentation, { ...props });\n },\n actionProps\n);\n"],"mappings":";;;;;AA0BA,MAAM,cAAc;CAClB,UAAU;CACV,QAAQ;CACR,OAAO;CACP,YAAY;AACd;AAEA,MAAM,gCAAgC,iBACnC,UAA2C;CAC1C,MAAM,UAAU,WAA+B,IAAI;CACnD,MAAM,cAAc,YAAgC;EAClD,QAAQ,QAAQ;CAClB;CACA,MAAM,wBAAwB;EAC5B,IAAI,QAAQ,OAAO,aACjB,QAAQ,MAAM,MAAM,EAAE,eAAe,KAAK,CAAC;CAC/C;CACA,MAAM,SAAS,WACb,WACE;EACE,KAAK,OAAO;EACZ,OAAO,MAAM,WAAW;EACxB,UAAU,UAAsB,MAAM,gBAAgB;CACxD,GACA,OAAO,KACT;CACF,MAAM,YAAY,WAChB,EACE,gBACA;EACE,GAAG,WAAW,EAAE,SAAS,gBAAgB,GAAG,MAAM,MAAM,CAAC;EACzD,MAAM,KAAA;CACR,GACA,EAAE,eAAe,OAAO,MAAM,CAChC;CACF,aAAa;EACX,IAAI,MAAM,WAAW,UAAU,MAAM,SAAS,WAAW,GACvD,OAAO,EACL,UACA,MACA,MAAM,SAAS,KAAK,WAClB,cAAc,MAAM,MAAM,GAAG,iBAAiB,MAAM,CAAC,CACvD,CACF;EACF,OAAO,EACL,YACA;GACE,SAAS;GACT,YAAY;GACZ,wBAAwB;GACxB,OAAO,MAAM,WAAW;GACxB,gBAAgB,UAAwB,MAAM,gBAAgB;EAChE,GACA;GACE,eACE,cACE;IACE,KAAK;IACL,wBAAwB;IACxB,OAAO,MAAM,WAAW;IACxB,cAAc,MAAM;IACpB,UAAU,UAAsB,MAAM,gBAAgB;GACxD,GACA,GACF;GACF,gBACE,EACE,gBACA,CAAC,GACD,EAAE,eAAe,MAAM,SAAS,IAAI,QAAQ,EAAE,CAChD;EACJ,CACF;CACF;AACF,GACA;CAAE,MAAM;CAAiC,OAAO;AAAY,CAC9D;;AAGA,MAAa,oBAAoC,0BAC/C,SAAS,kBAAwB,OAA4C;CAC3E,OAAO,YAAY,+BAA+B,EAAE,GAAG,MAAM,CAAC;AAChE,GACA,WACF"}
|
|
@@ -19,7 +19,7 @@ const ElementRowActionsPresentation = (0, vue.defineComponent)((props) => {
|
|
|
19
19
|
};
|
|
20
20
|
const attrs = (action) => (0, vue.mergeProps)({
|
|
21
21
|
key: action.key,
|
|
22
|
-
class:
|
|
22
|
+
class: props.classNames.actionButton,
|
|
23
23
|
onClick: (event) => event.stopPropagation()
|
|
24
24
|
}, action.attrs);
|
|
25
25
|
const menuItem = (action) => (0, vue.h)(element_plus.ElDropdownItem, {
|
|
@@ -61,4 +61,4 @@ Object.defineProperty(exports, "ElementRowActions", {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
//# sourceMappingURL=ElementRowActions-
|
|
64
|
+
//# sourceMappingURL=ElementRowActions-XyX2PAWL.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ElementRowActions-XyX2PAWL.cjs","names":["defineComponent","shallowRef","mergeProps","h","ElDropdownItem","Fragment","elementButton","rowActionContent","ElDropdown","ElDropdownMenu","createVNode"],"sources":["../src/ElementRowActions.ts"],"sourcesContent":["import type { RowActionControl } from \"@adapttable/vue\";\nimport {\n type DataTableClassNames,\n rowActionContent,\n type RowActionsLayout,\n withProps,\n} from \"@adapttable/vue/adapter\";\nimport { ElDropdown, ElDropdownItem, ElDropdownMenu } from \"element-plus\";\nimport {\n createVNode,\n defineComponent,\n Fragment,\n h,\n mergeProps,\n shallowRef,\n type VNode,\n} from \"vue\";\n\nimport { elementButton } from \"./controls/button\";\n\ninterface ElementRowActionsProps<TRow> {\n readonly controls: readonly RowActionControl<TRow>[];\n readonly layout?: RowActionsLayout;\n readonly label: string;\n readonly classNames: DataTableClassNames;\n}\nconst actionProps = {\n controls: null,\n layout: null,\n label: null,\n classNames: null,\n} satisfies Record<keyof ElementRowActionsProps<unknown>, unknown>;\n\nconst ElementRowActionsPresentation = defineComponent(\n (props: ElementRowActionsProps<unknown>) => {\n const trigger = shallowRef<HTMLElement | null>(null);\n const setTrigger = (element: HTMLElement | null) => {\n trigger.value = element;\n };\n const returnToTrigger = () => {\n if (trigger.value?.isConnected)\n trigger.value.focus({ preventScroll: true });\n };\n const attrs = (action: RowActionControl<unknown>) =>\n mergeProps(\n {\n key: action.key,\n class: props.classNames.actionButton,\n onClick: (event: MouseEvent) => event.stopPropagation(),\n },\n action.attrs\n );\n const menuItem = (action: RowActionControl<unknown>) =>\n h(\n ElDropdownItem,\n {\n ...mergeProps({ onClick: returnToTrigger }, attrs(action)),\n type: undefined,\n },\n { default: () => action.label }\n );\n return () => {\n if (props.layout !== \"menu\" || props.controls.length === 0)\n return h(\n Fragment,\n null,\n props.controls.map((action) =>\n elementButton(attrs(action), rowActionContent(action))\n )\n );\n return h(\n ElDropdown,\n {\n trigger: \"click\",\n teleported: false,\n \"data-adapttable-part\": \"row-actions-menu\",\n class: props.classNames.rowActionsMenu,\n onPointerdown: (event: PointerEvent) => event.stopPropagation(),\n },\n {\n default: () =>\n elementButton(\n {\n ref: setTrigger,\n \"data-adapttable-part\": \"row-actions-trigger\",\n class: props.classNames.rowActionsTrigger,\n \"aria-label\": props.label,\n onClick: (event: MouseEvent) => event.stopPropagation(),\n },\n \"⋮\"\n ),\n dropdown: () =>\n h(\n ElDropdownMenu,\n {},\n { default: () => props.controls.map(menuItem) }\n ),\n }\n );\n };\n },\n { name: \"ElementRowActionsPresentation\", props: actionProps }\n);\n\n/** A menu returns focus to its native trigger before an action opens another surface. */\nexport const ElementRowActions = /* @__PURE__ */ withProps(\n function ElementRowActions<TRow>(props: ElementRowActionsProps<TRow>): VNode {\n return createVNode(ElementRowActionsPresentation, { ...props });\n },\n actionProps\n);\n"],"mappings":";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AA,EAAAA,CACEM,aAAAA,gBACA,CAAC,GACD,EAAE,eAAe,MAAM,SAAS,IAAI,QAAQ,EAAE,CAChD;EACJ,CACF;CACF;AACF,GACA;CAAE,MAAM;CAAiC,OAAO;AAAY,CAC9D;;AAGA,MAAa,oBAAoC,iBAAA,GAAA,wBAAA,UAAA,CAC/C,SAAS,kBAAwB,OAA4C;CAC3E,QAAA,GAAOC,IAAAA,YAAAA,CAAY,+BAA+B,EAAE,GAAG,MAAM,CAAC;AAChE,GACA,WACF"}
|
package/dist/assistant.cjs
CHANGED
|
@@ -1,6 +1,310 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
const require_button = require("./button-BFjBL9m3.cjs");
|
|
3
|
+
const require_ElementInput = require("./ElementInput-BF97xXSC.cjs");
|
|
4
|
+
const require_ElementSelect = require("./ElementSelect-1UwtGCCr.cjs");
|
|
5
|
+
const require_ElementCard = require("./ElementCard-BRZekaHr.cjs");
|
|
6
|
+
let vue = require("vue");
|
|
7
|
+
let _adapttable_vue_adapter = require("@adapttable/vue/adapter");
|
|
8
|
+
let element_plus = require("element-plus");
|
|
9
|
+
//#region src/assistant/ExamplesMenu.ts
|
|
10
|
+
/** One shortcut: its icon, title and optional description. */
|
|
11
|
+
function menuItem(item) {
|
|
12
|
+
return (0, vue.h)(element_plus.ElDropdownItem, {
|
|
13
|
+
key: item.id,
|
|
14
|
+
command: item.id,
|
|
15
|
+
"data-adapttable-part": item.part
|
|
16
|
+
}, { default: () => [item.icon, (0, vue.h)("span", [(0, vue.h)("strong", item.title), item.description ? (0, vue.h)("small", item.description) : null])] });
|
|
17
|
+
}
|
|
18
|
+
/** The assistant's shortcuts in an Element Plus dropdown under its trigger. */
|
|
19
|
+
const ElementExamplesMenu = (0, vue.defineComponent)((props) => {
|
|
20
|
+
const active = (0, _adapttable_vue_adapter.useScopeActivity)();
|
|
21
|
+
const dropdown = (0, vue.shallowRef)();
|
|
22
|
+
const trigger = (0, vue.shallowRef)(null);
|
|
23
|
+
const open = (0, vue.shallowRef)(false);
|
|
24
|
+
let generation = 0;
|
|
25
|
+
(0, vue.watch)([
|
|
26
|
+
active,
|
|
27
|
+
() => props.disabled,
|
|
28
|
+
() => props.items,
|
|
29
|
+
() => props.onSelect
|
|
30
|
+
], () => {
|
|
31
|
+
generation++;
|
|
32
|
+
dropdown.value?.handleClose();
|
|
33
|
+
}, { flush: "sync" });
|
|
34
|
+
const keydown = (event) => {
|
|
35
|
+
if (event.key !== "Escape" || event.isComposing) return;
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
event.stopPropagation();
|
|
38
|
+
dropdown.value?.handleClose();
|
|
39
|
+
trigger.value?.focus({ preventScroll: true });
|
|
40
|
+
};
|
|
41
|
+
return () => {
|
|
42
|
+
if (!active.value) return null;
|
|
43
|
+
const ticket = generation;
|
|
44
|
+
const current = () => active.value && !props.disabled && ticket === generation;
|
|
45
|
+
return (0, vue.h)(element_plus.ElDropdown, {
|
|
46
|
+
ref: dropdown,
|
|
47
|
+
trigger: "click",
|
|
48
|
+
persistent: false,
|
|
49
|
+
hideTimeout: 0,
|
|
50
|
+
disabled: props.disabled,
|
|
51
|
+
maxHeight: props.maxHeight,
|
|
52
|
+
onVisibleChange: (value) => {
|
|
53
|
+
open.value = value;
|
|
54
|
+
},
|
|
55
|
+
onCommand: (id) => {
|
|
56
|
+
if (current() && typeof id === "string" && props.items.some((item) => item.id === id)) props.onSelect(id);
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
default: () => require_button.elementButton({
|
|
60
|
+
ref: (element) => {
|
|
61
|
+
trigger.value = element;
|
|
62
|
+
},
|
|
63
|
+
type: "button",
|
|
64
|
+
disabled: props.disabled,
|
|
65
|
+
"aria-label": props.label,
|
|
66
|
+
title: props.label,
|
|
67
|
+
class: props.className,
|
|
68
|
+
"data-adapttable-part": props.part,
|
|
69
|
+
onKeydown: (event) => {
|
|
70
|
+
if (open.value) keydown(event);
|
|
71
|
+
}
|
|
72
|
+
}, [props.icon ?? props.label]),
|
|
73
|
+
dropdown: () => (0, vue.h)(element_plus.ElDropdownMenu, {
|
|
74
|
+
"aria-label": props.label,
|
|
75
|
+
onKeydownCapture: keydown
|
|
76
|
+
}, { default: () => props.items.map(menuItem) })
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
}, {
|
|
80
|
+
name: "ElementExamplesMenu",
|
|
81
|
+
props: {
|
|
82
|
+
label: { type: String },
|
|
83
|
+
part: { type: String },
|
|
84
|
+
className: { type: String },
|
|
85
|
+
icon: {
|
|
86
|
+
type: [
|
|
87
|
+
String,
|
|
88
|
+
Number,
|
|
89
|
+
Boolean,
|
|
90
|
+
Array,
|
|
91
|
+
Object
|
|
92
|
+
],
|
|
93
|
+
default: void 0
|
|
94
|
+
},
|
|
95
|
+
disabled: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: void 0
|
|
98
|
+
},
|
|
99
|
+
items: { type: Array },
|
|
100
|
+
onSelect: { type: Function },
|
|
101
|
+
maxHeight: { type: String }
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/assistant/Sheet.ts
|
|
106
|
+
/**
|
|
107
|
+
* Chrome chooses initial and return focus; ElDrawer contains focus and owns
|
|
108
|
+
* the portal. Escape and backdrop dismissal become one close request to the
|
|
109
|
+
* host, and the drawer stays open until the host closes it.
|
|
110
|
+
*/
|
|
111
|
+
const ElementAssistantSheet = (0, vue.defineComponent)((props) => {
|
|
112
|
+
const active = (0, _adapttable_vue_adapter.useScopeActivity)();
|
|
113
|
+
const requestClose = () => {
|
|
114
|
+
if (active.value && props.open) props.onClose();
|
|
115
|
+
};
|
|
116
|
+
const preventDefault = (event) => event.preventDefault();
|
|
117
|
+
const keydown = (event) => {
|
|
118
|
+
if (event.key !== "Escape" || event.defaultPrevented || event.isComposing) return;
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
event.stopPropagation();
|
|
121
|
+
requestClose();
|
|
122
|
+
};
|
|
123
|
+
return () => {
|
|
124
|
+
if (!active.value) return null;
|
|
125
|
+
return (0, vue.h)(element_plus.ElDrawer, {
|
|
126
|
+
modelValue: props.open,
|
|
127
|
+
direction: props.dir === "rtl" ? "ltr" : "rtl",
|
|
128
|
+
size: "min(28rem, 100vw)",
|
|
129
|
+
withHeader: false,
|
|
130
|
+
showClose: false,
|
|
131
|
+
appendToBody: true,
|
|
132
|
+
destroyOnClose: true,
|
|
133
|
+
closeOnPressEscape: false,
|
|
134
|
+
title: props.label,
|
|
135
|
+
"aria-label": props.label,
|
|
136
|
+
dir: props.dir,
|
|
137
|
+
class: ["adapttable-element-plus-assistant-sheet", props.className],
|
|
138
|
+
"data-adapttable-part": props.part,
|
|
139
|
+
beforeClose: requestClose,
|
|
140
|
+
onKeydown: keydown,
|
|
141
|
+
"on:focus-trap.focus-after-trapped": preventDefault,
|
|
142
|
+
"on:focus-trap.focus-after-released": preventDefault
|
|
143
|
+
}, { default: () => props.children });
|
|
144
|
+
};
|
|
145
|
+
}, {
|
|
146
|
+
name: "ElementAssistantSheet",
|
|
147
|
+
props: {
|
|
148
|
+
label: { type: String },
|
|
149
|
+
part: { type: String },
|
|
150
|
+
className: { type: String },
|
|
151
|
+
dir: { type: String },
|
|
152
|
+
open: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
default: void 0
|
|
155
|
+
},
|
|
156
|
+
onClose: { type: Function },
|
|
157
|
+
children: {
|
|
158
|
+
type: [
|
|
159
|
+
String,
|
|
160
|
+
Number,
|
|
161
|
+
Boolean,
|
|
162
|
+
Array,
|
|
163
|
+
Object
|
|
164
|
+
],
|
|
165
|
+
default: void 0
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/assistant/controls.ts
|
|
171
|
+
/** Element Plus tag types for the assistant's status tones. */
|
|
172
|
+
const TAG_TYPE = {
|
|
173
|
+
neutral: "info",
|
|
174
|
+
busy: "primary",
|
|
175
|
+
warning: "warning",
|
|
176
|
+
danger: "danger"
|
|
177
|
+
};
|
|
178
|
+
const elementAssistantControls = {
|
|
179
|
+
Button: (props) => require_button.elementButton({
|
|
180
|
+
type: "button",
|
|
181
|
+
"data-adapttable-part": props.part,
|
|
182
|
+
"aria-label": props.label,
|
|
183
|
+
"aria-expanded": props.expanded,
|
|
184
|
+
title: props.tooltip,
|
|
185
|
+
class: props.className,
|
|
186
|
+
disabled: props.disabled,
|
|
187
|
+
onClick: props.onClick
|
|
188
|
+
}, [props.icon, props.iconOnly && props.icon ? null : props.children ?? props.label]),
|
|
189
|
+
Composer: (props) => (0, vue.h)(require_ElementInput._sfc_main, {
|
|
190
|
+
type: "textarea",
|
|
191
|
+
rows: 1,
|
|
192
|
+
value: props.value,
|
|
193
|
+
disabled: props.disabled,
|
|
194
|
+
"data-adapttable-part": props.part,
|
|
195
|
+
"aria-label": props.label,
|
|
196
|
+
placeholder: props.placeholder,
|
|
197
|
+
class: ["adapttable-element-plus-assistant-input", props.className],
|
|
198
|
+
onChange: props.onChange,
|
|
199
|
+
onKeydown: props.onKeyDown
|
|
200
|
+
}),
|
|
201
|
+
Badge: (props) => (0, vue.h)(element_plus.ElTag, {
|
|
202
|
+
"data-adapttable-part": props.part,
|
|
203
|
+
"data-tone": props.tone,
|
|
204
|
+
type: TAG_TYPE[props.tone],
|
|
205
|
+
size: "small",
|
|
206
|
+
effect: "light",
|
|
207
|
+
style: props.tone === "neutral" || props.tone === "warning" ? { "--el-tag-text-color": "var(--el-text-color-regular)" } : void 0,
|
|
208
|
+
class: props.className
|
|
209
|
+
}, { default: () => props.label }),
|
|
210
|
+
Panel: (props) => (0, vue.h)(require_ElementCard.ElementCard, { attrs: {
|
|
211
|
+
role: "region",
|
|
212
|
+
"data-adapttable-part": props.part,
|
|
213
|
+
"aria-label": props.label,
|
|
214
|
+
class: ["adapttable-element-plus-assistant-panel", props.className]
|
|
215
|
+
} }, { default: () => props.children }),
|
|
216
|
+
Window: (props) => (0, vue.h)(require_ElementCard.ElementCard, { attrs: {
|
|
217
|
+
role: "region",
|
|
218
|
+
"data-adapttable-part": props.part,
|
|
219
|
+
"aria-label": props.label,
|
|
220
|
+
class: ["adapttable-element-plus-assistant-window", props.className],
|
|
221
|
+
style: props.style
|
|
222
|
+
} }, { default: () => props.children }),
|
|
223
|
+
Sheet: (props) => (0, vue.h)(ElementAssistantSheet, {
|
|
224
|
+
...props,
|
|
225
|
+
key: props.part
|
|
226
|
+
}),
|
|
227
|
+
Menu: (props) => (0, vue.h)(ElementExamplesMenu, props),
|
|
228
|
+
LanguageChip: (props) => (0, vue.h)(require_ElementSelect._sfc_main, {
|
|
229
|
+
"data-adapttable-part": props.part,
|
|
230
|
+
"aria-label": props.label,
|
|
231
|
+
class: props.className,
|
|
232
|
+
disabled: props.disabled,
|
|
233
|
+
value: props.value,
|
|
234
|
+
options: props.options,
|
|
235
|
+
onChange: props.onChange
|
|
236
|
+
})
|
|
237
|
+
};
|
|
238
|
+
const elementApprovalControls = {
|
|
239
|
+
Approve: elementAssistantControls.Button,
|
|
240
|
+
Reject: elementAssistantControls.Button,
|
|
241
|
+
Action: elementAssistantControls.Button,
|
|
242
|
+
List: (props) => (0, vue.h)("ul", {
|
|
243
|
+
"data-adapttable-part": props.part,
|
|
244
|
+
"aria-label": props.label,
|
|
245
|
+
class: ["adapttable-element-plus-approval-list", props.className]
|
|
246
|
+
}, [props.children])
|
|
247
|
+
};
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/assistant.ts
|
|
250
|
+
const TableAssistant = (0, vue.defineComponent)((props) => () => (0, vue.h)(_adapttable_vue_adapter.TableAssistantChrome, {
|
|
251
|
+
...props,
|
|
252
|
+
accent: props.accent ?? "var(--el-color-primary)",
|
|
253
|
+
slots: elementAssistantControls
|
|
254
|
+
}), {
|
|
255
|
+
name: "ElementTableAssistant",
|
|
256
|
+
props: {
|
|
257
|
+
assistant: { type: Object },
|
|
258
|
+
speech: { type: Object },
|
|
259
|
+
open: {
|
|
260
|
+
type: Boolean,
|
|
261
|
+
default: void 0
|
|
262
|
+
},
|
|
263
|
+
onOpenChange: { type: Function },
|
|
264
|
+
presentation: { type: String },
|
|
265
|
+
labels: { type: Object },
|
|
266
|
+
accent: { type: String },
|
|
267
|
+
receipts: {
|
|
268
|
+
type: Boolean,
|
|
269
|
+
default: void 0
|
|
270
|
+
},
|
|
271
|
+
className: { type: String },
|
|
272
|
+
launcher: {
|
|
273
|
+
type: Boolean,
|
|
274
|
+
default: void 0
|
|
275
|
+
},
|
|
276
|
+
onSettings: { type: Function },
|
|
277
|
+
boundary: { type: [String, Object] },
|
|
278
|
+
note: { type: String },
|
|
279
|
+
greeting: { type: String },
|
|
280
|
+
avatars: { type: Object },
|
|
281
|
+
messageAction: { type: Function },
|
|
282
|
+
approval: { type: Object },
|
|
283
|
+
dir: { type: String }
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
const AgentApproval = (0, vue.defineComponent)((props) => () => (0, vue.h)(_adapttable_vue_adapter.AgentApprovalChrome, {
|
|
287
|
+
...props,
|
|
288
|
+
slots: elementApprovalControls
|
|
289
|
+
}), {
|
|
290
|
+
name: "ElementAgentApproval",
|
|
291
|
+
props: {
|
|
292
|
+
pending: { type: Object },
|
|
293
|
+
labels: { type: Object },
|
|
294
|
+
className: { type: String },
|
|
295
|
+
buttonClassName: { type: String }
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
function tableAssistant() {
|
|
299
|
+
return (0, _adapttable_vue_adapter.createAdapterTableAssistantFeature)((props) => (0, vue.h)(TableAssistant, props));
|
|
300
|
+
}
|
|
301
|
+
function agentApproval() {
|
|
302
|
+
return (0, _adapttable_vue_adapter.createAdapterAgentApprovalFeature)((props) => (0, vue.h)(AgentApproval, props));
|
|
303
|
+
}
|
|
304
|
+
//#endregion
|
|
305
|
+
exports.AgentApproval = AgentApproval;
|
|
306
|
+
exports.TableAssistant = TableAssistant;
|
|
307
|
+
exports.agentApproval = agentApproval;
|
|
308
|
+
exports.tableAssistant = tableAssistant;
|
|
309
|
+
|
|
310
|
+
//# sourceMappingURL=assistant.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant.cjs","names":["h","ElDropdownItem","defineComponent","useScopeActivity","shallowRef","ElDropdown","elementButton","ElDropdownMenu","defineComponent","useScopeActivity","h","ElDrawer","elementButton","h","ElementInput","ElTag","ElementCard","ElementSelect","defineComponent","h","TableAssistantChrome","AgentApprovalChrome","createAdapterTableAssistantFeature","createAdapterAgentApprovalFeature"],"sources":["../src/assistant/ExamplesMenu.ts","../src/assistant/Sheet.ts","../src/assistant/controls.ts","../src/assistant.ts"],"sourcesContent":["import {\n type TableAssistantMenuProps,\n useScopeActivity,\n} from \"@adapttable/vue/adapter\";\nimport {\n type DropdownInstance,\n ElDropdown,\n ElDropdownItem,\n ElDropdownMenu,\n} from \"element-plus\";\nimport { defineComponent, h, type PropType, shallowRef, watch } from \"vue\";\n\nimport { elementButton } from \"../controls/button\";\n\n/** One shortcut: its icon, title and optional description. */\nfunction menuItem(item: TableAssistantMenuProps[\"items\"][number]) {\n return h(\n ElDropdownItem,\n { key: item.id, command: item.id, \"data-adapttable-part\": item.part },\n {\n default: () => [\n item.icon,\n h(\"span\", [\n h(\"strong\", item.title),\n item.description ? h(\"small\", item.description) : null,\n ]),\n ],\n }\n );\n}\n\n/** The assistant's shortcuts in an Element Plus dropdown under its trigger. */\nexport const ElementExamplesMenu = defineComponent(\n (props: TableAssistantMenuProps) => {\n const active = useScopeActivity();\n const dropdown = shallowRef<DropdownInstance>();\n const trigger = shallowRef<HTMLElement | null>(null);\n const open = shallowRef(false);\n let generation = 0;\n watch(\n [active, () => props.disabled, () => props.items, () => props.onSelect],\n () => {\n generation++;\n dropdown.value?.handleClose();\n },\n { flush: \"sync\" }\n );\n // The menu closes itself on Escape and hands focus back to its trigger,\n // so an Escape inside it never reaches the surface around the trigger.\n const keydown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.isComposing) return;\n event.preventDefault();\n event.stopPropagation();\n dropdown.value?.handleClose();\n trigger.value?.focus({ preventScroll: true });\n };\n return () => {\n if (!active.value) return null;\n const ticket = generation;\n const current = () =>\n active.value && !props.disabled && ticket === generation;\n return h(\n ElDropdown,\n {\n ref: dropdown,\n trigger: \"click\",\n persistent: false,\n hideTimeout: 0,\n disabled: props.disabled,\n maxHeight: props.maxHeight,\n onVisibleChange: (value: boolean) => {\n open.value = value;\n },\n onCommand: (id: unknown) => {\n if (\n current() &&\n typeof id === \"string\" &&\n props.items.some((item) => item.id === id)\n )\n props.onSelect(id);\n },\n },\n {\n default: () =>\n elementButton(\n {\n ref: (element: HTMLElement | null) => {\n trigger.value = element;\n },\n type: \"button\",\n disabled: props.disabled,\n \"aria-label\": props.label,\n title: props.label,\n class: props.className,\n \"data-adapttable-part\": props.part,\n onKeydown: (event: KeyboardEvent) => {\n if (open.value) keydown(event);\n },\n },\n [props.icon ?? props.label]\n ),\n dropdown: () =>\n h(\n ElDropdownMenu,\n // Captured on the list so an Escape from any item reaches it\n // before Element's own handling moves focus into the list.\n { \"aria-label\": props.label, onKeydownCapture: keydown },\n { default: () => props.items.map(menuItem) }\n ),\n }\n );\n };\n },\n {\n name: \"ElementExamplesMenu\",\n props: {\n label: { type: String as PropType<TableAssistantMenuProps[\"label\"]> },\n part: { type: String as PropType<TableAssistantMenuProps[\"part\"]> },\n className: {\n type: String as PropType<TableAssistantMenuProps[\"className\"]>,\n },\n icon: {\n type: [String, Number, Boolean, Array, Object] as PropType<\n TableAssistantMenuProps[\"icon\"]\n >,\n default: undefined,\n },\n disabled: {\n type: Boolean as PropType<TableAssistantMenuProps[\"disabled\"]>,\n default: undefined,\n },\n items: { type: Array as PropType<TableAssistantMenuProps[\"items\"]> },\n onSelect: {\n type: Function as PropType<TableAssistantMenuProps[\"onSelect\"]>,\n },\n maxHeight: {\n type: String as PropType<TableAssistantMenuProps[\"maxHeight\"]>,\n },\n },\n }\n);\n","import {\n type TableAssistantSheetProps,\n useScopeActivity,\n} from \"@adapttable/vue/adapter\";\nimport { ElDrawer } from \"element-plus\";\nimport { defineComponent, h, type PropType } from \"vue\";\n\n/**\n * Chrome chooses initial and return focus; ElDrawer contains focus and owns\n * the portal. Escape and backdrop dismissal become one close request to the\n * host, and the drawer stays open until the host closes it.\n */\nexport const ElementAssistantSheet = defineComponent(\n (props: TableAssistantSheetProps) => {\n const active = useScopeActivity();\n const requestClose = () => {\n if (active.value && props.open) props.onClose();\n };\n const preventDefault = (event: Event) => event.preventDefault();\n const keydown = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || event.isComposing)\n return;\n event.preventDefault();\n event.stopPropagation();\n requestClose();\n };\n return () => {\n if (!active.value) return null;\n return h(\n ElDrawer,\n {\n modelValue: props.open,\n direction: props.dir === \"rtl\" ? \"ltr\" : \"rtl\",\n size: \"min(28rem, 100vw)\",\n withHeader: false,\n showClose: false,\n appendToBody: true,\n destroyOnClose: true,\n closeOnPressEscape: false,\n title: props.label,\n \"aria-label\": props.label,\n dir: props.dir,\n class: [\"adapttable-element-plus-assistant-sheet\", props.className],\n \"data-adapttable-part\": props.part,\n beforeClose: requestClose,\n onKeydown: keydown,\n // Chrome places the initial focus and returns it to the launcher;\n // the drawer's trap only keeps focus inside while open.\n \"on:focus-trap.focus-after-trapped\": preventDefault,\n \"on:focus-trap.focus-after-released\": preventDefault,\n },\n { default: () => props.children }\n );\n };\n },\n {\n name: \"ElementAssistantSheet\",\n props: {\n label: { type: String as PropType<TableAssistantSheetProps[\"label\"]> },\n part: { type: String as PropType<TableAssistantSheetProps[\"part\"]> },\n className: {\n type: String as PropType<TableAssistantSheetProps[\"className\"]>,\n },\n dir: { type: String as PropType<TableAssistantSheetProps[\"dir\"]> },\n open: {\n type: Boolean as PropType<TableAssistantSheetProps[\"open\"]>,\n default: undefined,\n },\n onClose: {\n type: Function as PropType<TableAssistantSheetProps[\"onClose\"]>,\n },\n children: {\n type: [String, Number, Boolean, Array, Object] as PropType<\n TableAssistantSheetProps[\"children\"]\n >,\n default: undefined,\n },\n },\n }\n);\n","import type {\n ApprovalReviewSlots,\n TableAssistantSlots,\n} from \"@adapttable/vue/adapter\";\nimport { ElTag } from \"element-plus\";\nimport { h } from \"vue\";\n\nimport { elementButton } from \"../controls/button\";\nimport ElementInput from \"../controls/ElementInput.vue\";\nimport ElementSelect from \"../controls/ElementSelect.vue\";\nimport { ElementCard } from \"../presentation/ElementCard\";\nimport { ElementExamplesMenu } from \"./ExamplesMenu\";\nimport { ElementAssistantSheet } from \"./Sheet\";\n\n/** Element Plus tag types for the assistant's status tones. */\nconst TAG_TYPE = {\n neutral: \"info\",\n busy: \"primary\",\n warning: \"warning\",\n danger: \"danger\",\n} as const;\n\nexport const elementAssistantControls: TableAssistantSlots = {\n Button: (props) =>\n elementButton(\n {\n type: \"button\",\n \"data-adapttable-part\": props.part,\n \"aria-label\": props.label,\n \"aria-expanded\": props.expanded,\n title: props.tooltip,\n class: props.className,\n disabled: props.disabled,\n onClick: props.onClick,\n },\n [\n props.icon,\n props.iconOnly && props.icon ? null : (props.children ?? props.label),\n ]\n ),\n Composer: (props) =>\n h(ElementInput, {\n type: \"textarea\",\n rows: 1,\n value: props.value,\n disabled: props.disabled,\n \"data-adapttable-part\": props.part,\n \"aria-label\": props.label,\n placeholder: props.placeholder,\n class: [\"adapttable-element-plus-assistant-input\", props.className],\n onChange: props.onChange,\n onKeydown: props.onKeyDown,\n }),\n Badge: (props) =>\n h(\n ElTag,\n {\n \"data-adapttable-part\": props.part,\n \"data-tone\": props.tone,\n type: TAG_TYPE[props.tone],\n size: \"small\",\n effect: \"light\",\n style:\n props.tone === \"neutral\" || props.tone === \"warning\"\n ? { \"--el-tag-text-color\": \"var(--el-text-color-regular)\" }\n : undefined,\n class: props.className,\n },\n { default: () => props.label }\n ),\n Panel: (props) =>\n h(\n ElementCard,\n {\n attrs: {\n role: \"region\",\n \"data-adapttable-part\": props.part,\n \"aria-label\": props.label,\n class: [\"adapttable-element-plus-assistant-panel\", props.className],\n },\n },\n { default: () => props.children }\n ),\n Window: (props) =>\n h(\n ElementCard,\n {\n attrs: {\n role: \"region\",\n \"data-adapttable-part\": props.part,\n \"aria-label\": props.label,\n class: [\"adapttable-element-plus-assistant-window\", props.className],\n style: props.style,\n },\n },\n { default: () => props.children }\n ),\n Sheet: (props) => h(ElementAssistantSheet, { ...props, key: props.part }),\n Menu: (props) => h(ElementExamplesMenu, props),\n LanguageChip: (props) =>\n h(ElementSelect, {\n \"data-adapttable-part\": props.part,\n \"aria-label\": props.label,\n class: props.className,\n disabled: props.disabled,\n value: props.value,\n options: props.options,\n onChange: props.onChange,\n }),\n};\n\nexport const elementApprovalControls: ApprovalReviewSlots = {\n Approve: elementAssistantControls.Button,\n Reject: elementAssistantControls.Button,\n Action: elementAssistantControls.Button,\n List: (props) =>\n h(\n \"ul\",\n {\n \"data-adapttable-part\": props.part,\n \"aria-label\": props.label,\n class: [\"adapttable-element-plus-approval-list\", props.className],\n },\n [props.children]\n ),\n};\n","/** Optional assistant presentation; all conversation and approval state stays in the binding. */\nimport \"./assistant/assistant.css\";\n\nimport type { StaticTableFeature } from \"@adapttable/vue\";\nimport {\n AgentApprovalChrome,\n type AgentApprovalProps,\n createAdapterAgentApprovalFeature,\n createAdapterTableAssistantFeature,\n TableAssistantChrome,\n type TableAssistantProps,\n} from \"@adapttable/vue/adapter\";\nimport { defineComponent, h, type PropType } from \"vue\";\n\nimport {\n elementApprovalControls,\n elementAssistantControls,\n} from \"./assistant/controls\";\n\nexport const TableAssistant = defineComponent(\n (props: TableAssistantProps) => () =>\n h(TableAssistantChrome, {\n ...props,\n accent: props.accent ?? \"var(--el-color-primary)\",\n slots: elementAssistantControls,\n }),\n {\n name: \"ElementTableAssistant\",\n props: {\n assistant: { type: Object as PropType<TableAssistantProps[\"assistant\"]> },\n speech: { type: Object as PropType<TableAssistantProps[\"speech\"]> },\n open: {\n type: Boolean as PropType<TableAssistantProps[\"open\"]>,\n default: undefined,\n },\n onOpenChange: {\n type: Function as PropType<TableAssistantProps[\"onOpenChange\"]>,\n },\n presentation: {\n type: String as PropType<TableAssistantProps[\"presentation\"]>,\n },\n labels: { type: Object as PropType<TableAssistantProps[\"labels\"]> },\n accent: { type: String as PropType<TableAssistantProps[\"accent\"]> },\n receipts: {\n type: Boolean as PropType<TableAssistantProps[\"receipts\"]>,\n default: undefined,\n },\n className: { type: String as PropType<TableAssistantProps[\"className\"]> },\n launcher: {\n type: Boolean as PropType<TableAssistantProps[\"launcher\"]>,\n default: undefined,\n },\n onSettings: {\n type: Function as PropType<TableAssistantProps[\"onSettings\"]>,\n },\n boundary: {\n type: [String, Object] as PropType<TableAssistantProps[\"boundary\"]>,\n },\n note: { type: String as PropType<TableAssistantProps[\"note\"]> },\n greeting: { type: String as PropType<TableAssistantProps[\"greeting\"]> },\n avatars: { type: Object as PropType<TableAssistantProps[\"avatars\"]> },\n messageAction: {\n type: Function as PropType<TableAssistantProps[\"messageAction\"]>,\n },\n approval: { type: Object as PropType<TableAssistantProps[\"approval\"]> },\n dir: { type: String as PropType<TableAssistantProps[\"dir\"]> },\n },\n }\n);\nexport const AgentApproval = defineComponent(\n (props: AgentApprovalProps) => () =>\n h(AgentApprovalChrome, { ...props, slots: elementApprovalControls }),\n {\n name: \"ElementAgentApproval\",\n props: {\n pending: { type: Object as PropType<AgentApprovalProps[\"pending\"]> },\n labels: { type: Object as PropType<AgentApprovalProps[\"labels\"]> },\n className: { type: String as PropType<AgentApprovalProps[\"className\"]> },\n buttonClassName: {\n type: String as PropType<AgentApprovalProps[\"buttonClassName\"]>,\n },\n },\n }\n);\nexport function tableAssistant(): StaticTableFeature {\n return createAdapterTableAssistantFeature((props) =>\n h(TableAssistant, props)\n );\n}\nexport function agentApproval(): StaticTableFeature {\n return createAdapterAgentApprovalFeature((props) => h(AgentApproval, props));\n}\nexport type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