@atscript/vue-table 0.1.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +24 -0
- package/dist/as-action-form-dialog.cjs +221 -0
- package/dist/as-action-form-dialog.d.cts +6 -0
- package/dist/as-action-form-dialog.d.mts +7 -0
- package/dist/as-action-form-dialog.mjs +221 -0
- package/dist/as-action-menu-content-CXsdPn42.mjs +104 -0
- package/dist/as-action-menu-content-CyUfBrWH.cjs +109 -0
- package/dist/as-cell-array-CXeZzZqt.cjs +69 -0
- package/dist/as-cell-array-DOQKR6t5.mjs +64 -0
- package/dist/as-cell-array.cjs +3 -0
- package/dist/as-cell-array.d.cts +2 -0
- package/dist/as-cell-array.d.mts +2 -0
- package/dist/as-cell-array.mjs +3 -0
- package/dist/as-cell-array.vue-DZGM2VHh.d.mts +12 -0
- package/dist/as-cell-array.vue-pFs5GcCR.d.cts +12 -0
- package/dist/as-cell-date-CTrvxS1h.cjs +78 -0
- package/dist/as-cell-date-Cq49RHmL.mjs +73 -0
- package/dist/as-cell-date.cjs +3 -0
- package/dist/as-cell-date.d.cts +2 -0
- package/dist/as-cell-date.d.mts +2 -0
- package/dist/as-cell-date.mjs +3 -0
- package/dist/as-cell-date.vue-BBSps2B2.d.cts +12 -0
- package/dist/as-cell-date.vue-Zlt4mHWb.d.mts +12 -0
- package/dist/as-cell-json-BynWIs1d.mjs +37 -0
- package/dist/as-cell-json-DvHvQ6IL.cjs +42 -0
- package/dist/as-cell-json-popover-BWdNs1YU.cjs +70 -0
- package/dist/as-cell-json-popover-DUq25I0L.mjs +65 -0
- package/dist/as-cell-json.cjs +3 -0
- package/dist/as-cell-json.d.cts +2 -0
- package/dist/as-cell-json.d.mts +2 -0
- package/dist/as-cell-json.mjs +3 -0
- package/dist/as-cell-json.vue-C6wg4ARZ.d.cts +12 -0
- package/dist/as-cell-json.vue-CESWuCer.d.mts +12 -0
- package/dist/as-cell-number-0_WrSCzu.cjs +76 -0
- package/dist/as-cell-number-Bc1C97Vg.mjs +71 -0
- package/dist/as-cell-number.cjs +3 -0
- package/dist/as-cell-number.d.cts +2 -0
- package/dist/as-cell-number.d.mts +2 -0
- package/dist/as-cell-number.mjs +3 -0
- package/dist/as-cell-number.vue-1Oq7nVI3.d.mts +12 -0
- package/dist/as-cell-number.vue-CJ2K5zeM.d.cts +12 -0
- package/dist/as-cell-union-C1w3B38J.mjs +88 -0
- package/dist/as-cell-union-CFAI0utz.cjs +93 -0
- package/dist/as-cell-union.cjs +4 -0
- package/dist/as-cell-union.d.cts +2 -0
- package/dist/as-cell-union.d.mts +2 -0
- package/dist/as-cell-union.mjs +4 -0
- package/dist/as-cell-union.vue-CslPM_c2.d.cts +12 -0
- package/dist/as-cell-union.vue-NnDmQZOA.d.mts +12 -0
- package/dist/as-column-menu-CH9Htz0Q.cjs +220 -0
- package/dist/as-column-menu-DCfhorMP.mjs +215 -0
- package/dist/as-column-menu.cjs +2 -0
- package/dist/as-column-menu.d.cts +2 -0
- package/dist/as-column-menu.d.mts +2 -0
- package/dist/as-column-menu.mjs +2 -0
- package/dist/as-column-menu.vue-C9e6wJ3z.d.mts +47 -0
- package/dist/as-column-menu.vue-o0qFdzoL.d.cts +47 -0
- package/dist/as-config-dialog-d2k7_l0U.cjs +699 -0
- package/dist/as-config-dialog-vRklaKbi.mjs +688 -0
- package/dist/as-config-dialog.cjs +3 -0
- package/dist/as-config-dialog.d.cts +2 -0
- package/dist/as-config-dialog.d.mts +2 -0
- package/dist/as-config-dialog.mjs +3 -0
- package/dist/as-config-dialog.vue-C6Q62xF5.d.mts +7 -0
- package/dist/as-config-dialog.vue-DvvJi3xx.d.cts +7 -0
- package/dist/as-confirm-dialog-BLh3Ju4-.mjs +52 -0
- package/dist/as-confirm-dialog-BgpIEE2z.cjs +57 -0
- package/dist/as-confirm-dialog.cjs +3 -0
- package/dist/as-confirm-dialog.d.cts +2 -0
- package/dist/as-confirm-dialog.d.mts +2 -0
- package/dist/as-confirm-dialog.mjs +3 -0
- package/dist/as-confirm-dialog.vue-CXxLpzbu.d.cts +7 -0
- package/dist/as-confirm-dialog.vue-pas8jGhv.d.mts +7 -0
- package/dist/as-filter-dialog-C0HMpUPT.mjs +610 -0
- package/dist/as-filter-dialog-DcGvIV3h.cjs +621 -0
- package/dist/as-filter-dialog.cjs +15 -0
- package/dist/as-filter-dialog.d.cts +2 -0
- package/dist/as-filter-dialog.d.mts +2 -0
- package/dist/as-filter-dialog.mjs +15 -0
- package/dist/as-filter-dialog.vue-BV2J8PgZ.d.cts +7 -0
- package/dist/as-filter-dialog.vue-RDZjp4gJ.d.mts +7 -0
- package/dist/as-filter-field-B_tYzvvl.cjs +984 -0
- package/dist/as-filter-field-Bqvu2ASN.mjs +943 -0
- package/dist/as-filter-field.cjs +9 -0
- package/dist/as-filter-field.d.cts +2 -0
- package/dist/as-filter-field.d.mts +2 -0
- package/dist/as-filter-field.mjs +9 -0
- package/dist/as-filter-field.vue-ByQ8xIGq.d.cts +11 -0
- package/dist/as-filter-field.vue-QY8wi5S5.d.mts +11 -0
- package/dist/as-filter-input--nr72iwX.cjs +106 -0
- package/dist/as-filter-input-P1i0CW2-.mjs +101 -0
- package/dist/as-filter-input.cjs +2 -0
- package/dist/as-filter-input.d.cts +2 -0
- package/dist/as-filter-input.d.mts +2 -0
- package/dist/as-filter-input.mjs +2 -0
- package/dist/as-filter-input.vue-CBQ71eNg.d.mts +18 -0
- package/dist/as-filter-input.vue-CS4nOk_Q.d.cts +18 -0
- package/dist/as-filters-Bxa9ZEMm.mjs +44 -0
- package/dist/as-filters-xRT2qv56.cjs +49 -0
- package/dist/as-filters.cjs +10 -0
- package/dist/as-filters.d.cts +2 -0
- package/dist/as-filters.d.mts +2 -0
- package/dist/as-filters.mjs +10 -0
- package/dist/as-filters.vue-BsMgYUcX.d.mts +10 -0
- package/dist/as-filters.vue-fv-tRL2H.d.cts +10 -0
- package/dist/as-preset-dialog-BaTfwMnh.cjs +569 -0
- package/dist/as-preset-dialog-BdDRgwf_.mjs +564 -0
- package/dist/as-preset-dialog.cjs +4 -0
- package/dist/as-preset-dialog.d.cts +2 -0
- package/dist/as-preset-dialog.d.mts +2 -0
- package/dist/as-preset-dialog.mjs +4 -0
- package/dist/as-preset-dialog.vue-Bzv-ON9W.d.mts +7 -0
- package/dist/as-preset-dialog.vue-DP9fy00Y.d.cts +7 -0
- package/dist/as-preset-picker-BQbNEiy9.mjs +427 -0
- package/dist/as-preset-picker-Ce3crTQy.cjs +432 -0
- package/dist/as-preset-picker.cjs +4 -0
- package/dist/as-preset-picker.d.cts +2 -0
- package/dist/as-preset-picker.d.mts +2 -0
- package/dist/as-preset-picker.mjs +4 -0
- package/dist/as-preset-picker.vue-CTBk6leV.d.mts +7 -0
- package/dist/as-preset-picker.vue-DfXS3pGl.d.cts +7 -0
- package/dist/as-row-actions-B6Kob6gt.cjs +120 -0
- package/dist/as-row-actions-CeWBBGqh.mjs +115 -0
- package/dist/as-row-actions.cjs +4 -0
- package/dist/as-row-actions.d.cts +2 -0
- package/dist/as-row-actions.d.mts +2 -0
- package/dist/as-row-actions.mjs +4 -0
- package/dist/as-row-actions.vue-BPaQfGev.d.mts +11 -0
- package/dist/as-row-actions.vue-Bvcc2tUN.d.cts +11 -0
- package/dist/as-table-Cnw2fOqZ.mjs +204 -0
- package/dist/as-table-DlDFxdXI.cjs +209 -0
- package/dist/as-table-actions-BK1Thy2G.cjs +142 -0
- package/dist/as-table-actions-BpMiNFni.mjs +137 -0
- package/dist/as-table-actions.cjs +4 -0
- package/dist/as-table-actions.d.cts +2 -0
- package/dist/as-table-actions.d.mts +2 -0
- package/dist/as-table-actions.mjs +4 -0
- package/dist/as-table-actions.vue-B7Q-JA3z.d.cts +47 -0
- package/dist/as-table-actions.vue-Bs1Jl1ep.d.mts +47 -0
- package/dist/as-table-base-D0k4k7k_.mjs +646 -0
- package/dist/as-table-base-VIz-B_6_.cjs +651 -0
- package/dist/as-table-cell-value-B1CiJYFn.mjs +26 -0
- package/dist/as-table-cell-value-CuxRtFn9.cjs +31 -0
- package/dist/as-table-cell-value.cjs +3 -0
- package/dist/as-table-cell-value.d.cts +2 -0
- package/dist/as-table-cell-value.d.mts +2 -0
- package/dist/as-table-cell-value.mjs +3 -0
- package/dist/as-table-cell-value.vue-BgFDv2JQ.d.cts +12 -0
- package/dist/as-table-cell-value.vue-BuPCQ8YA.d.mts +12 -0
- package/dist/as-table-header-cell-C3zeZUZo.cjs +117 -0
- package/dist/as-table-header-cell-CBn_ioCe.mjs +112 -0
- package/dist/as-table-header-cell.cjs +3 -0
- package/dist/as-table-header-cell.d.cts +2 -0
- package/dist/as-table-header-cell.d.mts +2 -0
- package/dist/as-table-header-cell.mjs +3 -0
- package/dist/as-table-header-cell.vue-Bc_DSsGY.d.cts +31 -0
- package/dist/as-table-header-cell.vue-DNMOHfek.d.mts +31 -0
- package/dist/as-table-root-Br6WcGRo.cjs +263 -0
- package/dist/as-table-root-gG7pTIdD.mjs +258 -0
- package/dist/as-table-root.cjs +28 -0
- package/dist/as-table-root.d.cts +2 -0
- package/dist/as-table-root.d.mts +2 -0
- package/dist/as-table-root.mjs +28 -0
- package/dist/as-table-root.vue-5_OhVwse.d.mts +2258 -0
- package/dist/as-table-root.vue-CSqEtIll.d.cts +2258 -0
- package/dist/as-table-status-BjRGGuhC.mjs +683 -0
- package/dist/as-table-status-DWYoJIMC.cjs +724 -0
- package/dist/as-table.cjs +10 -0
- package/dist/as-table.d.cts +2 -0
- package/dist/as-table.d.mts +2 -0
- package/dist/as-table.mjs +10 -0
- package/dist/as-table.vue-BTYg-e3Z.d.mts +81 -0
- package/dist/as-table.vue-wdRARLIe.d.cts +81 -0
- package/dist/as-window-table-CKIfo3M_.mjs +709 -0
- package/dist/as-window-table-DE7_NyEP.cjs +714 -0
- package/dist/as-window-table.cjs +9 -0
- package/dist/as-window-table.d.cts +2 -0
- package/dist/as-window-table.d.mts +2 -0
- package/dist/as-window-table.mjs +9 -0
- package/dist/as-window-table.vue-Bf8xGC9M.d.mts +86 -0
- package/dist/as-window-table.vue-CA8qsrz4.d.cts +86 -0
- package/dist/format-cell-B2xMDYO9.mjs +27 -0
- package/dist/format-cell-D4mqaN0E.cjs +32 -0
- package/dist/get-cell-value-CZSVfDLg.cjs +19 -0
- package/dist/get-cell-value-DiH84HKL.mjs +14 -0
- package/dist/index.cjs +598 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.mjs +505 -0
- package/dist/preset-aspect-display-BYeiSgcc.mjs +43 -0
- package/dist/preset-aspect-display-y8aal_EF.cjs +72 -0
- package/dist/types-BvvXN72P.d.mts +531 -0
- package/dist/types-CNMmF6W2.d.cts +531 -0
- package/dist/use-cell-locale-1uQaFTLQ.mjs +23 -0
- package/dist/use-cell-locale-B480_QYK.cjs +34 -0
- package/dist/use-table-column-handlers-CGYAY2xH.cjs +65 -0
- package/dist/use-table-column-handlers-t6xi1yCE.mjs +54 -0
- package/dist/use-table-state-C4JbonEZ.mjs +1822 -0
- package/dist/use-table-state-MU-vuzui.cjs +1917 -0
- package/package.json +195 -0
- package/styles.d.ts +2 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
const require_use_table_state = require("./use-table-state-MU-vuzui.cjs");
|
|
2
|
+
const require_as_action_menu_content = require("./as-action-menu-content-CyUfBrWH.cjs");
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
let reka_ui = require("reka-ui");
|
|
5
|
+
//#region src/components/as-table-actions.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
const _hoisted_1 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "as-table-actions"
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_2 = ["aria-label", "title"];
|
|
11
|
+
const _hoisted_3 = { class: "as-table-actions-btn-label" };
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/components/as-table-actions.vue
|
|
14
|
+
var as_table_actions_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
15
|
+
__name: "as-table-actions",
|
|
16
|
+
props: { level: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: false,
|
|
19
|
+
default: "auto"
|
|
20
|
+
} },
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const { state } = require_use_table_state.useTableContext();
|
|
24
|
+
function collapseSingle(r) {
|
|
25
|
+
if (r.defaultAction !== void 0) return r;
|
|
26
|
+
if (r.otherActions.length + r.trailingRowActions.length !== 1) return r;
|
|
27
|
+
const [only] = r.otherActions.length === 1 ? r.otherActions : r.trailingRowActions;
|
|
28
|
+
return {
|
|
29
|
+
...r,
|
|
30
|
+
defaultAction: only,
|
|
31
|
+
otherActions: [],
|
|
32
|
+
trailingRowActions: []
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function resolveLevel(explicit, selectedCount) {
|
|
36
|
+
if (explicit !== "auto") return explicit;
|
|
37
|
+
if (selectedCount === 0) return "table";
|
|
38
|
+
if (selectedCount === 1) return "row";
|
|
39
|
+
return "rows";
|
|
40
|
+
}
|
|
41
|
+
const preferredId = (0, vue.computed)(() => state.tableDef.value?.preferredId ?? []);
|
|
42
|
+
const resolved = (0, vue.computed)(() => {
|
|
43
|
+
const selectedCount = state.selectedCount.value;
|
|
44
|
+
const explicit = props.level;
|
|
45
|
+
const effectiveLevel = resolveLevel(explicit, selectedCount);
|
|
46
|
+
const pid = preferredId.value;
|
|
47
|
+
if (effectiveLevel === "table") return collapseSingle({
|
|
48
|
+
defaultAction: state.actions.default.table,
|
|
49
|
+
otherActions: state.actions.others.table,
|
|
50
|
+
trailingRowActions: [],
|
|
51
|
+
level: "table",
|
|
52
|
+
ids: []
|
|
53
|
+
});
|
|
54
|
+
if (effectiveLevel === "row") {
|
|
55
|
+
const source = explicit === "auto" && selectedCount === 1 ? state.selectedRows.value[0] : state.activeIndex.value >= 0 ? state.results.value[state.activeIndex.value - state.resultsStart.value] : void 0;
|
|
56
|
+
const filtered = require_use_table_state.applyRowGate({
|
|
57
|
+
default: state.actions.default.row,
|
|
58
|
+
others: state.actions.others.row,
|
|
59
|
+
rows: explicit === "auto" && selectedCount === 1 ? state.actions.rows : []
|
|
60
|
+
}, source);
|
|
61
|
+
return collapseSingle({
|
|
62
|
+
defaultAction: filtered.default,
|
|
63
|
+
otherActions: filtered.others,
|
|
64
|
+
trailingRowActions: filtered.rows,
|
|
65
|
+
level: "row",
|
|
66
|
+
ids: require_use_table_state.collectIdentifiers(state, [source], pid)
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return collapseSingle({
|
|
70
|
+
defaultAction: state.actions.default.rows,
|
|
71
|
+
otherActions: state.actions.others.rows,
|
|
72
|
+
trailingRowActions: [],
|
|
73
|
+
level: "rows",
|
|
74
|
+
ids: require_use_table_state.collectIdentifiers(state, state.selectedRows.value, pid)
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
const hasAny = (0, vue.computed)(() => resolved.value.defaultAction !== void 0 || resolved.value.otherActions.length > 0 || resolved.value.trailingRowActions.length > 0);
|
|
78
|
+
async function invokeWith(action, event) {
|
|
79
|
+
await require_use_table_state.triggerAction(state, action, {
|
|
80
|
+
identifiers: resolved.value.ids,
|
|
81
|
+
preferredId: preferredId.value
|
|
82
|
+
}, event);
|
|
83
|
+
}
|
|
84
|
+
return (_ctx, _cache) => {
|
|
85
|
+
return hasAny.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_1, [(0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
86
|
+
defaultAction: resolved.value.defaultAction,
|
|
87
|
+
otherActions: resolved.value.otherActions,
|
|
88
|
+
trailingRowActions: resolved.value.trailingRowActions,
|
|
89
|
+
level: resolved.value.level,
|
|
90
|
+
ids: resolved.value.ids,
|
|
91
|
+
invoke: invokeWith
|
|
92
|
+
}, () => [resolved.value.defaultAction ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
|
|
93
|
+
key: 0,
|
|
94
|
+
type: "button",
|
|
95
|
+
class: (0, vue.normalizeClass)(["as-table-actions-btn", (0, vue.unref)(require_use_table_state.intentClass)("as-table-actions", resolved.value.defaultAction)]),
|
|
96
|
+
"data-default": "",
|
|
97
|
+
"aria-label": (0, vue.unref)(require_use_table_state.ariaLabelFor)(resolved.value.defaultAction),
|
|
98
|
+
title: (0, vue.unref)(require_use_table_state.ariaLabelFor)(resolved.value.defaultAction),
|
|
99
|
+
onClick: _cache[0] || (_cache[0] = ($event) => invokeWith(resolved.value.defaultAction, $event))
|
|
100
|
+
}, [(0, vue.renderSlot)(_ctx.$slots, "button", { action: resolved.value.defaultAction }, () => [resolved.value.defaultAction.icon ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
101
|
+
key: 0,
|
|
102
|
+
class: (0, vue.normalizeClass)(["as-table-actions-btn-icon", resolved.value.defaultAction.icon]),
|
|
103
|
+
"aria-hidden": "true"
|
|
104
|
+
}, null, 2)) : (0, vue.createCommentVNode)("v-if", true), (0, vue.createElementVNode)("span", _hoisted_3, (0, vue.toDisplayString)(resolved.value.defaultAction.label || resolved.value.defaultAction.name), 1)])], 10, _hoisted_2)) : (0, vue.createCommentVNode)("v-if", true), resolved.value.otherActions.length > 0 || resolved.value.trailingRowActions.length > 0 ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.DropdownMenuRoot), {
|
|
105
|
+
key: 1,
|
|
106
|
+
modal: false
|
|
107
|
+
}, {
|
|
108
|
+
default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(reka_ui.DropdownMenuTrigger), { "as-child": "" }, {
|
|
109
|
+
default: (0, vue.withCtx)(() => [..._cache[1] || (_cache[1] = [(0, vue.createElementVNode)("button", {
|
|
110
|
+
type: "button",
|
|
111
|
+
class: "as-table-actions-more",
|
|
112
|
+
"aria-label": "More actions",
|
|
113
|
+
title: "More actions"
|
|
114
|
+
}, [(0, vue.createElementVNode)("span", {
|
|
115
|
+
class: "i-as-menu",
|
|
116
|
+
"aria-hidden": "true"
|
|
117
|
+
})], -1)])]),
|
|
118
|
+
_: 1
|
|
119
|
+
}), (0, vue.createVNode)((0, vue.unref)(reka_ui.DropdownMenuPortal), null, {
|
|
120
|
+
default: (0, vue.withCtx)(() => [(0, vue.createVNode)(require_as_action_menu_content.as_action_menu_content_default, {
|
|
121
|
+
groups: [resolved.value.otherActions, resolved.value.trailingRowActions],
|
|
122
|
+
prefix: "as-table-actions",
|
|
123
|
+
onSelect: invokeWith
|
|
124
|
+
}, (0, vue.createSlots)({ _: 2 }, [_ctx.$slots["menu-item"] ? {
|
|
125
|
+
name: "menu-item",
|
|
126
|
+
fn: (0, vue.withCtx)((slotProps) => [(0, vue.renderSlot)(_ctx.$slots, "menu-item", { action: slotProps.action })]),
|
|
127
|
+
key: "0"
|
|
128
|
+
} : void 0]), 1032, ["groups"])]),
|
|
129
|
+
_: 3
|
|
130
|
+
})]),
|
|
131
|
+
_: 3
|
|
132
|
+
})) : (0, vue.createCommentVNode)("v-if", true)])])) : (0, vue.createCommentVNode)("v-if", true);
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
//#endregion
|
|
137
|
+
Object.defineProperty(exports, "as_table_actions_default", {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: function() {
|
|
140
|
+
return as_table_actions_default;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { a as useTableContext, c as applyRowGate, f as intentClass, l as ariaLabelFor, m as triggerAction, u as collectIdentifiers } from "./use-table-state-C4JbonEZ.mjs";
|
|
2
|
+
import { t as as_action_menu_content_default } from "./as-action-menu-content-CXsdPn42.mjs";
|
|
3
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createVNode, defineComponent, normalizeClass, openBlock, renderSlot, toDisplayString, unref, withCtx } from "vue";
|
|
4
|
+
import { DropdownMenuPortal, DropdownMenuRoot, DropdownMenuTrigger } from "reka-ui";
|
|
5
|
+
//#region src/components/as-table-actions.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
const _hoisted_1 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "as-table-actions"
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_2 = ["aria-label", "title"];
|
|
11
|
+
const _hoisted_3 = { class: "as-table-actions-btn-label" };
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/components/as-table-actions.vue
|
|
14
|
+
var as_table_actions_default = /* @__PURE__ */ defineComponent({
|
|
15
|
+
__name: "as-table-actions",
|
|
16
|
+
props: { level: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: false,
|
|
19
|
+
default: "auto"
|
|
20
|
+
} },
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const { state } = useTableContext();
|
|
24
|
+
function collapseSingle(r) {
|
|
25
|
+
if (r.defaultAction !== void 0) return r;
|
|
26
|
+
if (r.otherActions.length + r.trailingRowActions.length !== 1) return r;
|
|
27
|
+
const [only] = r.otherActions.length === 1 ? r.otherActions : r.trailingRowActions;
|
|
28
|
+
return {
|
|
29
|
+
...r,
|
|
30
|
+
defaultAction: only,
|
|
31
|
+
otherActions: [],
|
|
32
|
+
trailingRowActions: []
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function resolveLevel(explicit, selectedCount) {
|
|
36
|
+
if (explicit !== "auto") return explicit;
|
|
37
|
+
if (selectedCount === 0) return "table";
|
|
38
|
+
if (selectedCount === 1) return "row";
|
|
39
|
+
return "rows";
|
|
40
|
+
}
|
|
41
|
+
const preferredId = computed(() => state.tableDef.value?.preferredId ?? []);
|
|
42
|
+
const resolved = computed(() => {
|
|
43
|
+
const selectedCount = state.selectedCount.value;
|
|
44
|
+
const explicit = props.level;
|
|
45
|
+
const effectiveLevel = resolveLevel(explicit, selectedCount);
|
|
46
|
+
const pid = preferredId.value;
|
|
47
|
+
if (effectiveLevel === "table") return collapseSingle({
|
|
48
|
+
defaultAction: state.actions.default.table,
|
|
49
|
+
otherActions: state.actions.others.table,
|
|
50
|
+
trailingRowActions: [],
|
|
51
|
+
level: "table",
|
|
52
|
+
ids: []
|
|
53
|
+
});
|
|
54
|
+
if (effectiveLevel === "row") {
|
|
55
|
+
const source = explicit === "auto" && selectedCount === 1 ? state.selectedRows.value[0] : state.activeIndex.value >= 0 ? state.results.value[state.activeIndex.value - state.resultsStart.value] : void 0;
|
|
56
|
+
const filtered = applyRowGate({
|
|
57
|
+
default: state.actions.default.row,
|
|
58
|
+
others: state.actions.others.row,
|
|
59
|
+
rows: explicit === "auto" && selectedCount === 1 ? state.actions.rows : []
|
|
60
|
+
}, source);
|
|
61
|
+
return collapseSingle({
|
|
62
|
+
defaultAction: filtered.default,
|
|
63
|
+
otherActions: filtered.others,
|
|
64
|
+
trailingRowActions: filtered.rows,
|
|
65
|
+
level: "row",
|
|
66
|
+
ids: collectIdentifiers(state, [source], pid)
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return collapseSingle({
|
|
70
|
+
defaultAction: state.actions.default.rows,
|
|
71
|
+
otherActions: state.actions.others.rows,
|
|
72
|
+
trailingRowActions: [],
|
|
73
|
+
level: "rows",
|
|
74
|
+
ids: collectIdentifiers(state, state.selectedRows.value, pid)
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
const hasAny = computed(() => resolved.value.defaultAction !== void 0 || resolved.value.otherActions.length > 0 || resolved.value.trailingRowActions.length > 0);
|
|
78
|
+
async function invokeWith(action, event) {
|
|
79
|
+
await triggerAction(state, action, {
|
|
80
|
+
identifiers: resolved.value.ids,
|
|
81
|
+
preferredId: preferredId.value
|
|
82
|
+
}, event);
|
|
83
|
+
}
|
|
84
|
+
return (_ctx, _cache) => {
|
|
85
|
+
return hasAny.value ? (openBlock(), createElementBlock("span", _hoisted_1, [renderSlot(_ctx.$slots, "default", {
|
|
86
|
+
defaultAction: resolved.value.defaultAction,
|
|
87
|
+
otherActions: resolved.value.otherActions,
|
|
88
|
+
trailingRowActions: resolved.value.trailingRowActions,
|
|
89
|
+
level: resolved.value.level,
|
|
90
|
+
ids: resolved.value.ids,
|
|
91
|
+
invoke: invokeWith
|
|
92
|
+
}, () => [resolved.value.defaultAction ? (openBlock(), createElementBlock("button", {
|
|
93
|
+
key: 0,
|
|
94
|
+
type: "button",
|
|
95
|
+
class: normalizeClass(["as-table-actions-btn", unref(intentClass)("as-table-actions", resolved.value.defaultAction)]),
|
|
96
|
+
"data-default": "",
|
|
97
|
+
"aria-label": unref(ariaLabelFor)(resolved.value.defaultAction),
|
|
98
|
+
title: unref(ariaLabelFor)(resolved.value.defaultAction),
|
|
99
|
+
onClick: _cache[0] || (_cache[0] = ($event) => invokeWith(resolved.value.defaultAction, $event))
|
|
100
|
+
}, [renderSlot(_ctx.$slots, "button", { action: resolved.value.defaultAction }, () => [resolved.value.defaultAction.icon ? (openBlock(), createElementBlock("span", {
|
|
101
|
+
key: 0,
|
|
102
|
+
class: normalizeClass(["as-table-actions-btn-icon", resolved.value.defaultAction.icon]),
|
|
103
|
+
"aria-hidden": "true"
|
|
104
|
+
}, null, 2)) : createCommentVNode("v-if", true), createElementVNode("span", _hoisted_3, toDisplayString(resolved.value.defaultAction.label || resolved.value.defaultAction.name), 1)])], 10, _hoisted_2)) : createCommentVNode("v-if", true), resolved.value.otherActions.length > 0 || resolved.value.trailingRowActions.length > 0 ? (openBlock(), createBlock(unref(DropdownMenuRoot), {
|
|
105
|
+
key: 1,
|
|
106
|
+
modal: false
|
|
107
|
+
}, {
|
|
108
|
+
default: withCtx(() => [createVNode(unref(DropdownMenuTrigger), { "as-child": "" }, {
|
|
109
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [createElementVNode("button", {
|
|
110
|
+
type: "button",
|
|
111
|
+
class: "as-table-actions-more",
|
|
112
|
+
"aria-label": "More actions",
|
|
113
|
+
title: "More actions"
|
|
114
|
+
}, [createElementVNode("span", {
|
|
115
|
+
class: "i-as-menu",
|
|
116
|
+
"aria-hidden": "true"
|
|
117
|
+
})], -1)])]),
|
|
118
|
+
_: 1
|
|
119
|
+
}), createVNode(unref(DropdownMenuPortal), null, {
|
|
120
|
+
default: withCtx(() => [createVNode(as_action_menu_content_default, {
|
|
121
|
+
groups: [resolved.value.otherActions, resolved.value.trailingRowActions],
|
|
122
|
+
prefix: "as-table-actions",
|
|
123
|
+
onSelect: invokeWith
|
|
124
|
+
}, createSlots({ _: 2 }, [_ctx.$slots["menu-item"] ? {
|
|
125
|
+
name: "menu-item",
|
|
126
|
+
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "menu-item", { action: slotProps.action })]),
|
|
127
|
+
key: "0"
|
|
128
|
+
} : void 0]), 1032, ["groups"])]),
|
|
129
|
+
_: 3
|
|
130
|
+
})]),
|
|
131
|
+
_: 3
|
|
132
|
+
})) : createCommentVNode("v-if", true)])])) : createCommentVNode("v-if", true);
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
//#endregion
|
|
137
|
+
export { as_table_actions_default as t };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { h as TVueTableActionInfo } from "./types-CNMmF6W2.cjs";
|
|
2
|
+
import * as vue from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/components/as-table-actions.vue.d.ts
|
|
5
|
+
type __VLS_Props = {
|
|
6
|
+
/**
|
|
7
|
+
* Selection-aware level resolution. `'auto'` (default) chooses by
|
|
8
|
+
* `state.selectedCount`: 0 → table; exactly 1 → row (default + others
|
|
9
|
+
* come from the row group, with `actions.rows` appended after a
|
|
10
|
+
* separator inside the `…` menu so bulk operations on the single
|
|
11
|
+
* selection are still reachable); ≥2 → rows. Force a specific level
|
|
12
|
+
* with `'table'` / `'rows'` / `'row'`.
|
|
13
|
+
*/
|
|
14
|
+
level?: "auto" | "table" | "rows" | "row";
|
|
15
|
+
};
|
|
16
|
+
declare function invokeWith(action: TVueTableActionInfo, event?: MouseEvent | KeyboardEvent): Promise<void>;
|
|
17
|
+
declare var __VLS_1: {
|
|
18
|
+
defaultAction: TVueTableActionInfo | undefined;
|
|
19
|
+
otherActions: TVueTableActionInfo[];
|
|
20
|
+
trailingRowActions: TVueTableActionInfo[];
|
|
21
|
+
level: "table" | "rows" | "row";
|
|
22
|
+
ids: Record<string, unknown>[];
|
|
23
|
+
invoke: typeof invokeWith;
|
|
24
|
+
}, __VLS_3: {
|
|
25
|
+
action: TVueTableActionInfo;
|
|
26
|
+
}, __VLS_32: {
|
|
27
|
+
action: TVueTableActionInfo;
|
|
28
|
+
};
|
|
29
|
+
type __VLS_Slots = {} & {
|
|
30
|
+
default?: (props: typeof __VLS_1) => any;
|
|
31
|
+
} & {
|
|
32
|
+
button?: (props: typeof __VLS_3) => any;
|
|
33
|
+
} & {
|
|
34
|
+
'menu-item'?: (props: typeof __VLS_32) => any;
|
|
35
|
+
};
|
|
36
|
+
declare const __VLS_base: vue.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
37
|
+
level: "auto" | "table" | "rows" | "row";
|
|
38
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
39
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { _default as t };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { h as TVueTableActionInfo } from "./types-BvvXN72P.mjs";
|
|
2
|
+
import * as vue from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/components/as-table-actions.vue.d.ts
|
|
5
|
+
type __VLS_Props = {
|
|
6
|
+
/**
|
|
7
|
+
* Selection-aware level resolution. `'auto'` (default) chooses by
|
|
8
|
+
* `state.selectedCount`: 0 → table; exactly 1 → row (default + others
|
|
9
|
+
* come from the row group, with `actions.rows` appended after a
|
|
10
|
+
* separator inside the `…` menu so bulk operations on the single
|
|
11
|
+
* selection are still reachable); ≥2 → rows. Force a specific level
|
|
12
|
+
* with `'table'` / `'rows'` / `'row'`.
|
|
13
|
+
*/
|
|
14
|
+
level?: "auto" | "table" | "rows" | "row";
|
|
15
|
+
};
|
|
16
|
+
declare function invokeWith(action: TVueTableActionInfo, event?: MouseEvent | KeyboardEvent): Promise<void>;
|
|
17
|
+
declare var __VLS_1: {
|
|
18
|
+
defaultAction: TVueTableActionInfo | undefined;
|
|
19
|
+
otherActions: TVueTableActionInfo[];
|
|
20
|
+
trailingRowActions: TVueTableActionInfo[];
|
|
21
|
+
level: "table" | "rows" | "row";
|
|
22
|
+
ids: Record<string, unknown>[];
|
|
23
|
+
invoke: typeof invokeWith;
|
|
24
|
+
}, __VLS_3: {
|
|
25
|
+
action: TVueTableActionInfo;
|
|
26
|
+
}, __VLS_32: {
|
|
27
|
+
action: TVueTableActionInfo;
|
|
28
|
+
};
|
|
29
|
+
type __VLS_Slots = {} & {
|
|
30
|
+
default?: (props: typeof __VLS_1) => any;
|
|
31
|
+
} & {
|
|
32
|
+
button?: (props: typeof __VLS_3) => any;
|
|
33
|
+
} & {
|
|
34
|
+
'menu-item'?: (props: typeof __VLS_32) => any;
|
|
35
|
+
};
|
|
36
|
+
declare const __VLS_base: vue.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
37
|
+
level: "auto" | "table" | "rows" | "row";
|
|
38
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
39
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { _default as t };
|