@atscript/vue-table 0.1.133 → 0.1.134
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/dist/as-action-form-dialog.cjs +1 -1
- package/dist/as-action-form-dialog.mjs +1 -1
- package/dist/{as-action-menu-content-DiS37BYK.cjs → as-action-menu-content-C_D_Fepo.cjs} +1 -1
- package/dist/{as-action-menu-content-4D7CJNgr.mjs → as-action-menu-content-rim8hAO9.mjs} +1 -1
- package/dist/{as-cell-array-2qmJ1lT2.mjs → as-cell-array-BWHkJX3I.mjs} +2 -2
- package/dist/{as-cell-array-iPeUnk2G.cjs → as-cell-array-D-8Pqlgo.cjs} +2 -2
- package/dist/as-cell-array.cjs +1 -1
- package/dist/as-cell-array.mjs +1 -1
- package/dist/{as-cell-date-DyixWKuS.cjs → as-cell-date-DviMJEqs.cjs} +2 -2
- package/dist/{as-cell-date-BwFgi6O0.mjs → as-cell-date-mGlnDeLP.mjs} +2 -2
- package/dist/as-cell-date.cjs +1 -1
- package/dist/as-cell-date.mjs +1 -1
- package/dist/{as-cell-json--95Xq6yq.mjs → as-cell-json-2I081xnO.mjs} +2 -2
- package/dist/{as-cell-json-Bvv2P7YV.cjs → as-cell-json-CaVB6e7V.cjs} +2 -2
- package/dist/as-cell-json.cjs +1 -1
- package/dist/as-cell-json.mjs +1 -1
- package/dist/{as-cell-number-DuPMOesI.cjs → as-cell-number-BnYbxOiG.cjs} +2 -2
- package/dist/{as-cell-number-DKRaS9pM.mjs → as-cell-number-CP2AZI9g.mjs} +2 -2
- package/dist/as-cell-number.cjs +1 -1
- package/dist/as-cell-number.mjs +1 -1
- package/dist/{as-cell-union-DJNsEKTi.cjs → as-cell-union-BjMP91PS.cjs} +3 -3
- package/dist/{as-cell-union-C9FukGqF.mjs → as-cell-union-NHpDCXty.mjs} +3 -3
- package/dist/as-cell-union.cjs +1 -1
- package/dist/as-cell-union.mjs +1 -1
- package/dist/as-column-menu.cjs +1 -1
- package/dist/as-column-menu.d.cts +1 -1
- package/dist/as-column-menu.d.mts +1 -1
- package/dist/as-column-menu.mjs +1 -1
- package/dist/{as-column-menu.vue-Cuelpv3p.d.mts → as-column-menu.vue-De7SRhj6.d.cts} +2 -2
- package/dist/{as-column-menu.vue-CZ8XqHl0.d.cts → as-column-menu.vue-Dg0H1dOd.d.mts} +2 -2
- package/dist/{as-config-dialog-BKsm8OHR.mjs → as-config-dialog-BUBHiVlf.mjs} +28 -15
- package/dist/{as-config-dialog-Bt8oP8qg.cjs → as-config-dialog-DvBptYMS.cjs} +28 -15
- package/dist/as-config-dialog.cjs +1 -1
- package/dist/as-config-dialog.mjs +1 -1
- package/dist/{as-confirm-dialog-Cw7KErhz.cjs → as-confirm-dialog-ByMfIG0A.cjs} +1 -1
- package/dist/{as-confirm-dialog-BV01t7dn.mjs → as-confirm-dialog-G4ZoL_Xo.mjs} +1 -1
- package/dist/as-confirm-dialog.cjs +1 -1
- package/dist/as-confirm-dialog.mjs +1 -1
- package/dist/{as-filter-dialog-Ckrl79kU.mjs → as-filter-dialog-BJWH8cvc.mjs} +9 -9
- package/dist/{as-filter-dialog-Bxii-mYH.cjs → as-filter-dialog-C2oyT0yt.cjs} +9 -9
- package/dist/as-filter-dialog.cjs +1 -1
- package/dist/as-filter-dialog.mjs +1 -1
- package/dist/{as-filter-field-C-IFnj8K.mjs → as-filter-field-B2skq4K0.mjs} +3 -3
- package/dist/{as-filter-field-xBr6TtKo.cjs → as-filter-field-DxGfasQj.cjs} +3 -3
- package/dist/as-filter-field.cjs +1 -1
- package/dist/as-filter-field.mjs +1 -1
- package/dist/as-filter-input.cjs +1 -1
- package/dist/as-filter-input.mjs +1 -1
- package/dist/{as-filters-DuCk8nkk.cjs → as-filters-Bhte22La.cjs} +3 -3
- package/dist/{as-filters-DJEQj7_p.mjs → as-filters-DogNVlqr.mjs} +3 -3
- package/dist/as-filters.cjs +1 -1
- package/dist/as-filters.mjs +1 -1
- package/dist/{as-preset-dialog-CCIacZ2C.mjs → as-preset-dialog-BwHV6Y77.mjs} +3 -3
- package/dist/{as-preset-dialog-jZeyXJeJ.cjs → as-preset-dialog-D2a6nxEX.cjs} +3 -3
- package/dist/as-preset-dialog.cjs +1 -1
- package/dist/as-preset-dialog.mjs +1 -1
- package/dist/{as-preset-picker-DGSqQl9A.mjs → as-preset-picker-B0JnyAPA.mjs} +2 -2
- package/dist/{as-preset-picker-4xXU1KQz.cjs → as-preset-picker-DbkmapBx.cjs} +2 -2
- package/dist/as-preset-picker.cjs +1 -1
- package/dist/as-preset-picker.mjs +1 -1
- package/dist/{as-row-actions-pukI1JT7.mjs → as-row-actions-BkIsJVBm.mjs} +24 -11
- package/dist/{as-row-actions-B_OHWIAt.cjs → as-row-actions-CRg8LHGk.cjs} +24 -11
- package/dist/as-row-actions.cjs +1 -1
- package/dist/as-row-actions.d.cts +1 -1
- package/dist/as-row-actions.d.mts +1 -1
- package/dist/as-row-actions.mjs +1 -1
- package/dist/{as-row-actions.vue-DUSDuoR2.d.mts → as-row-actions.vue-VpJsBAJ4.d.mts} +8 -0
- package/dist/{as-row-actions.vue-Bvcc2tUN.d.cts → as-row-actions.vue-dn_DKcMm.d.cts} +8 -0
- package/dist/{as-table-D5_bQ0p5.mjs → as-table-BEvsX87E.mjs} +6 -6
- package/dist/{as-table-actions-DKYK_mTO.mjs → as-table-actions-B5upF1bQ.mjs} +14 -9
- package/dist/{as-table-actions-qb0gQz2D.cjs → as-table-actions-B6sKd4sl.cjs} +14 -9
- package/dist/as-table-actions.cjs +1 -1
- package/dist/as-table-actions.d.cts +1 -1
- package/dist/as-table-actions.d.mts +1 -1
- package/dist/as-table-actions.mjs +1 -1
- package/dist/{as-table-actions.vue-CckRRsL6.d.cts → as-table-actions.vue-CoxhpIlJ.d.mts} +2 -2
- package/dist/{as-table-actions.vue-DsqauvXR.d.mts → as-table-actions.vue-Kic8m28V.d.cts} +2 -2
- package/dist/{as-table-base-B0arhJI8.mjs → as-table-base-BxKBdIdS.mjs} +3 -3
- package/dist/{as-table-base-Dfw012G5.cjs → as-table-base-DLuhKz69.cjs} +3 -3
- package/dist/{as-table-cell-value-D1JkTQt0.cjs → as-table-cell-value-BAi5yadc.cjs} +2 -2
- package/dist/{as-table-cell-value-CPcFxSOj.mjs → as-table-cell-value-BVcfhhCb.mjs} +2 -2
- package/dist/as-table-cell-value.cjs +1 -1
- package/dist/as-table-cell-value.mjs +1 -1
- package/dist/{as-table-header-cell-Bb4ddLmQ.cjs → as-table-header-cell-Bv6q5iKA.cjs} +2 -2
- package/dist/{as-table-header-cell-q-c_QklI.mjs → as-table-header-cell-Xd3cvnII.mjs} +2 -2
- package/dist/as-table-header-cell.cjs +1 -1
- package/dist/as-table-header-cell.d.cts +1 -1
- package/dist/as-table-header-cell.d.mts +1 -1
- package/dist/as-table-header-cell.mjs +1 -1
- package/dist/{as-table-header-cell.vue-BjVOEFqz.d.mts → as-table-header-cell.vue-AS6u4e6v.d.cts} +2 -2
- package/dist/{as-table-header-cell.vue-qS1Xfc-U.d.cts → as-table-header-cell.vue-zKOmlzhT.d.mts} +2 -2
- package/dist/{as-table-root-Bpsrp0Vz.mjs → as-table-root-C1A6JkwL.mjs} +111 -9
- package/dist/{as-table-root-CUDO9ybm.cjs → as-table-root-DlYjnZax.cjs} +111 -9
- package/dist/as-table-root.cjs +1 -1
- package/dist/as-table-root.d.cts +1 -1
- package/dist/as-table-root.d.mts +1 -1
- package/dist/as-table-root.mjs +1 -1
- package/dist/{as-table-root.vue-szvjZsCn.d.cts → as-table-root.vue-CWk9YgpG.d.mts} +205 -32
- package/dist/{as-table-root.vue-BPU92_Ns.d.mts → as-table-root.vue-D94eypcL.d.cts} +206 -33
- package/dist/{as-table-status-BgDexT2x.cjs → as-table-status-B2HPerJT.cjs} +5 -5
- package/dist/{as-table-status-B9jlzPPV.mjs → as-table-status-QzlBdSiR.mjs} +5 -5
- package/dist/{as-table-BejpMVid.cjs → as-table-vJbZyZVx.cjs} +6 -6
- package/dist/as-table.cjs +1 -1
- package/dist/as-table.d.cts +1 -1
- package/dist/as-table.d.mts +1 -1
- package/dist/as-table.mjs +1 -1
- package/dist/{as-table.vue-4WhMA8AM.d.mts → as-table.vue-BB1vaNL6.d.cts} +4 -4
- package/dist/{as-table.vue-_urybtQj.d.cts → as-table.vue-BUDFTCpo.d.mts} +4 -4
- package/dist/{as-window-table-S1XWpDHQ.mjs → as-window-table-BH0tDDnr.mjs} +11 -7
- package/dist/{as-window-table-CXq6UuUx.cjs → as-window-table-Bl_q72WL.cjs} +11 -7
- package/dist/as-window-table.cjs +1 -1
- package/dist/as-window-table.d.cts +1 -1
- package/dist/as-window-table.d.mts +1 -1
- package/dist/as-window-table.mjs +1 -1
- package/dist/{as-window-table.vue-h1bdyMv7.d.cts → as-window-table.vue-Be2IA0Eb.d.cts} +3 -3
- package/dist/{as-window-table.vue-CWsJvOkL.d.mts → as-window-table.vue-CLqFM2ff.d.mts} +3 -3
- package/dist/index.cjs +193 -29
- package/dist/index.d.cts +9 -9
- package/dist/index.d.mts +9 -9
- package/dist/index.mjs +186 -31
- package/dist/{types-BZ0HssRY.d.cts → types--ex8BJIO.d.cts} +138 -2
- package/dist/{types-CXz-4dPz.d.mts → types-CBGaTR2Z.d.mts} +138 -2
- package/dist/{use-table-Bk-jSxOM.mjs → use-table-BFhbfWgY.mjs} +23 -13
- package/dist/{use-table-component-KuzZxAP8.mjs → use-table-component-CRmLHdqi.mjs} +1 -1
- package/dist/{use-table-component-DlLganVc.cjs → use-table-component-DS5NJPzs.cjs} +1 -1
- package/dist/{use-table-nav-bridge-CVUmTjDr.cjs → use-table-nav-bridge-DS14D_rG.cjs} +1 -1
- package/dist/{use-table-nav-bridge-B9SSEajW.mjs → use-table-nav-bridge-DzJN5v9a.mjs} +1 -1
- package/dist/{use-table-CdFFqaEx.cjs → use-table-nvuZdgUd.cjs} +28 -12
- package/dist/{use-table-state-DLJbW753.mjs → use-table-state-mBXx11aH.mjs} +208 -52
- package/dist/{use-table-state-D6dHOFrA.cjs → use-table-state-mhm-YWnu.cjs} +212 -56
- package/package.json +4 -4
- /package/dist/{as-cell-json-popover-Dkdv5Y9E.mjs → as-cell-json-popover-CH5bAcLE.mjs} +0 -0
- /package/dist/{as-cell-json-popover-BM2QLgfk.cjs → as-cell-json-popover-vty5vMjW.cjs} +0 -0
- /package/dist/{as-column-menu-kTIQfLTi.mjs → as-column-menu-BMTS3DO2.mjs} +0 -0
- /package/dist/{as-column-menu-fZVbJ9lU.cjs → as-column-menu-D_8NxujZ.cjs} +0 -0
- /package/dist/{as-filter-input-BM23TNeh.mjs → as-filter-input-C8KmOus8.mjs} +0 -0
- /package/dist/{as-filter-input-DJu2k9gO.cjs → as-filter-input-DUqpkTkg.cjs} +0 -0
- /package/dist/{error-message-CglODWl4.cjs → error-message-CfKpn_5w.cjs} +0 -0
- /package/dist/{error-message-hPSAu8Ug.mjs → error-message-gNEXnnbb.mjs} +0 -0
- /package/dist/{format-cell-D1Ziv96Q.mjs → format-cell-Bx7wNc4X.mjs} +0 -0
- /package/dist/{format-cell-vCNTh4WZ.cjs → format-cell-DaxV6WIJ.cjs} +0 -0
- /package/dist/{get-cell-value-4rHKP-TG.cjs → get-cell-value-CJT4fk4y.cjs} +0 -0
- /package/dist/{get-cell-value-C8LLc_Rr.mjs → get-cell-value-Cb3X8nUn.mjs} +0 -0
- /package/dist/{use-cell-locale-MQXoONh5.mjs → use-cell-locale-CxQOQsns.mjs} +0 -0
- /package/dist/{use-cell-locale-BGBRQB7s.cjs → use-cell-locale-caG2Fzpc.cjs} +0 -0
- /package/dist/{use-has-emit-listener-hhOH8CBI.cjs → use-has-emit-listener-BaGFZDyM.cjs} +0 -0
- /package/dist/{use-has-emit-listener-BTMDIv2e.mjs → use-has-emit-listener-DrBbsLHQ.mjs} +0 -0
- /package/dist/{use-seed-on-open-Dg9I89fU.cjs → use-seed-on-open-9TSm1Vbv.cjs} +0 -0
- /package/dist/{use-seed-on-open-DO3A1kIb.mjs → use-seed-on-open-DSh4XFyp.mjs} +0 -0
- /package/dist/{use-table-column-handlers-ehreEzcx.cjs → use-table-column-handlers-BMrP0WY2.cjs} +0 -0
- /package/dist/{use-table-column-handlers-CpiiIniD.mjs → use-table-column-handlers-Bx3JERqs.mjs} +0 -0
- /package/dist/{use-table-selection-Cmiu1h4S.cjs → use-table-selection-DtCV3rhu.cjs} +0 -0
- /package/dist/{use-table-selection-C84z4OZy.mjs → use-table-selection-ULbKT2xW.mjs} +0 -0
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
import { i as useRegisterMainActionListener } from "./use-table-state-
|
|
2
|
-
import { n as useTable } from "./use-table-
|
|
3
|
-
import { t as useTableNavBridge } from "./use-table-nav-bridge-
|
|
4
|
-
import { t as useHasEmitListener } from "./use-has-emit-listener-
|
|
5
|
-
import { t as as_confirm_dialog_default } from "./as-confirm-dialog-
|
|
1
|
+
import { i as useRegisterMainActionListener, t as createStaticTableState } from "./use-table-state-mBXx11aH.mjs";
|
|
2
|
+
import { n as finalizeTableState, r as useTable } from "./use-table-BFhbfWgY.mjs";
|
|
3
|
+
import { t as useTableNavBridge } from "./use-table-nav-bridge-DzJN5v9a.mjs";
|
|
4
|
+
import { t as useHasEmitListener } from "./use-has-emit-listener-DrBbsLHQ.mjs";
|
|
5
|
+
import { t as as_confirm_dialog_default } from "./as-confirm-dialog-G4ZoL_Xo.mjs";
|
|
6
6
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, defineAsyncComponent, defineComponent, mergeModels, openBlock, ref, renderSlot, resolveDynamicComponent, unref, useModel, watch } from "vue";
|
|
7
|
+
//#region src/utils/dev.ts
|
|
8
|
+
/**
|
|
9
|
+
* `true` outside a production build — the gate for authoring-time warnings, so
|
|
10
|
+
* their strings and checks cost a shipped app nothing.
|
|
11
|
+
*
|
|
12
|
+
* Read from `process.env.NODE_ENV` rather than `import.meta.env`: bundlers
|
|
13
|
+
* replace this expression with a literal in both the ESM and the CJS output,
|
|
14
|
+
* while `import.meta` only exists in the former. Where neither a bundler nor a
|
|
15
|
+
* `process` shim is present the read throws — warnings stay on, which is the
|
|
16
|
+
* safe side of the trade.
|
|
17
|
+
*/
|
|
18
|
+
function detectDev() {
|
|
19
|
+
try {
|
|
20
|
+
return process.env.NODE_ENV !== "production";
|
|
21
|
+
} catch {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const DEV = detectDev();
|
|
7
26
|
//#endregion
|
|
8
27
|
//#region src/components/as-table-root.vue
|
|
9
28
|
var as_table_root_default = /* @__PURE__ */ defineComponent({
|
|
@@ -11,7 +30,32 @@ var as_table_root_default = /* @__PURE__ */ defineComponent({
|
|
|
11
30
|
props: /* @__PURE__ */ mergeModels({
|
|
12
31
|
url: {
|
|
13
32
|
type: String,
|
|
14
|
-
required:
|
|
33
|
+
required: false
|
|
34
|
+
},
|
|
35
|
+
rows: {
|
|
36
|
+
type: Array,
|
|
37
|
+
required: false
|
|
38
|
+
},
|
|
39
|
+
columns: {
|
|
40
|
+
type: Array,
|
|
41
|
+
required: false
|
|
42
|
+
},
|
|
43
|
+
searchPaths: {
|
|
44
|
+
type: Array,
|
|
45
|
+
required: false
|
|
46
|
+
},
|
|
47
|
+
localSort: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
required: false,
|
|
50
|
+
default: true
|
|
51
|
+
},
|
|
52
|
+
displayColumns: {
|
|
53
|
+
type: Array,
|
|
54
|
+
required: false
|
|
55
|
+
},
|
|
56
|
+
rowActions: {
|
|
57
|
+
type: Object,
|
|
58
|
+
required: false
|
|
15
59
|
},
|
|
16
60
|
clientFactory: {
|
|
17
61
|
type: Function,
|
|
@@ -174,7 +218,61 @@ var as_table_root_default = /* @__PURE__ */ defineComponent({
|
|
|
174
218
|
const urlQuery = useModel(__props, "urlQuery");
|
|
175
219
|
const urlQueryActive = useHasEmitListener("onUpdate:urlQuery").value;
|
|
176
220
|
const urlQueryReady = ref(!urlQueryActive);
|
|
177
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Local mode is decided once, at setup: `:rows` present means "render this
|
|
223
|
+
* array", which is a different state factory (no client, no metadata fetch).
|
|
224
|
+
* It cannot flip at runtime — a table that changes data source re-mounts.
|
|
225
|
+
*/
|
|
226
|
+
const localMode = props.rows !== void 0;
|
|
227
|
+
if (!localMode && !props.url) throw new Error("[vue-table] <AsTableRoot> requires either :url or :rows (local mode).");
|
|
228
|
+
/**
|
|
229
|
+
* Build the local-mode state: a `createStaticTableState` over the `:rows`
|
|
230
|
+
* array, provided to the subtree exactly like the fetching path so cells,
|
|
231
|
+
* keyboard nav, header slots, selection and the config dialog all work.
|
|
232
|
+
* Features that need a client are inert here and warned about once.
|
|
233
|
+
*/
|
|
234
|
+
function createLocalState() {
|
|
235
|
+
if (DEV) {
|
|
236
|
+
if (props.url) console.warn("[vue-table] <AsTableRoot>: :rows is set, so :url is ignored (local mode).");
|
|
237
|
+
if (props.preset) console.warn("[vue-table] <AsTableRoot>: presets need a server and are off in local mode.");
|
|
238
|
+
if (urlQueryActive) console.warn("[vue-table] <AsTableRoot>: v-model:urlQuery is not wired in local mode.");
|
|
239
|
+
if (props.queryFn) console.warn("[vue-table] <AsTableRoot>: :queryFn is ignored in local mode.");
|
|
240
|
+
}
|
|
241
|
+
const { state: localState } = createStaticTableState({
|
|
242
|
+
rows: () => props.rows ?? [],
|
|
243
|
+
columns: props.columns ?? [],
|
|
244
|
+
searchPaths: props.searchPaths,
|
|
245
|
+
localSort: props.localSort,
|
|
246
|
+
displayColumns: props.displayColumns,
|
|
247
|
+
limit: props.limit,
|
|
248
|
+
queryOnMount: props.queryOnMount,
|
|
249
|
+
selection: {
|
|
250
|
+
rowValueFn: props.rowValueFn,
|
|
251
|
+
selectedRows
|
|
252
|
+
},
|
|
253
|
+
model: {
|
|
254
|
+
filterFields,
|
|
255
|
+
columnNames,
|
|
256
|
+
columnWidths,
|
|
257
|
+
sorters
|
|
258
|
+
},
|
|
259
|
+
actions: {
|
|
260
|
+
resolveHref: props.resolveHref,
|
|
261
|
+
onResolved: (action, ids, result, event) => emit("action", action, ids, result, event)
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
finalizeTableState(localState, {}, {
|
|
265
|
+
selectionPersistence: props.selectionPersistence,
|
|
266
|
+
controls: props.controls,
|
|
267
|
+
types: props.types,
|
|
268
|
+
components: props.components,
|
|
269
|
+
formTypes: props.formTypes,
|
|
270
|
+
formComponents: props.formComponents
|
|
271
|
+
});
|
|
272
|
+
watch(() => props.rows, () => localState.query({ silent: true }));
|
|
273
|
+
return localState;
|
|
274
|
+
}
|
|
275
|
+
const state = localMode ? createLocalState() : useTable(props.url, {
|
|
178
276
|
limit: props.limit,
|
|
179
277
|
rowValueFn: props.rowValueFn,
|
|
180
278
|
selectionPersistence: props.selectionPersistence,
|
|
@@ -206,9 +304,13 @@ var as_table_root_default = /* @__PURE__ */ defineComponent({
|
|
|
206
304
|
urlQueryReady: urlQueryActive ? urlQueryReady : void 0,
|
|
207
305
|
onUrlQueryChange: urlQueryActive ? (s) => urlQuery.value = s : void 0,
|
|
208
306
|
urlQuerySync: props.urlQuerySync,
|
|
209
|
-
preset: props.preset
|
|
307
|
+
preset: props.preset,
|
|
308
|
+
displayColumns: props.displayColumns
|
|
210
309
|
});
|
|
211
|
-
|
|
310
|
+
watch(() => props.rowActions, (value) => {
|
|
311
|
+
state.rowActions.value = value;
|
|
312
|
+
}, { immediate: true });
|
|
313
|
+
if (urlQueryActive && !localMode) watch([
|
|
212
314
|
() => state.tableDef.value,
|
|
213
315
|
() => urlQuery.value,
|
|
214
316
|
() => state.preset.ready.value
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
const require_use_table_state = require("./use-table-state-
|
|
2
|
-
const require_use_table = require("./use-table-
|
|
3
|
-
const require_use_table_nav_bridge = require("./use-table-nav-bridge-
|
|
4
|
-
const require_use_has_emit_listener = require("./use-has-emit-listener-
|
|
5
|
-
const require_as_confirm_dialog = require("./as-confirm-dialog-
|
|
1
|
+
const require_use_table_state = require("./use-table-state-mhm-YWnu.cjs");
|
|
2
|
+
const require_use_table = require("./use-table-nvuZdgUd.cjs");
|
|
3
|
+
const require_use_table_nav_bridge = require("./use-table-nav-bridge-DS14D_rG.cjs");
|
|
4
|
+
const require_use_has_emit_listener = require("./use-has-emit-listener-BaGFZDyM.cjs");
|
|
5
|
+
const require_as_confirm_dialog = require("./as-confirm-dialog-ByMfIG0A.cjs");
|
|
6
6
|
let vue = require("vue");
|
|
7
|
+
//#region src/utils/dev.ts
|
|
8
|
+
/**
|
|
9
|
+
* `true` outside a production build — the gate for authoring-time warnings, so
|
|
10
|
+
* their strings and checks cost a shipped app nothing.
|
|
11
|
+
*
|
|
12
|
+
* Read from `process.env.NODE_ENV` rather than `import.meta.env`: bundlers
|
|
13
|
+
* replace this expression with a literal in both the ESM and the CJS output,
|
|
14
|
+
* while `import.meta` only exists in the former. Where neither a bundler nor a
|
|
15
|
+
* `process` shim is present the read throws — warnings stay on, which is the
|
|
16
|
+
* safe side of the trade.
|
|
17
|
+
*/
|
|
18
|
+
function detectDev() {
|
|
19
|
+
try {
|
|
20
|
+
return process.env.NODE_ENV !== "production";
|
|
21
|
+
} catch {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const DEV = detectDev();
|
|
7
26
|
//#endregion
|
|
8
27
|
//#region src/components/as-table-root.vue
|
|
9
28
|
var as_table_root_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -11,7 +30,32 @@ var as_table_root_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
11
30
|
props: /* @__PURE__ */ (0, vue.mergeModels)({
|
|
12
31
|
url: {
|
|
13
32
|
type: String,
|
|
14
|
-
required:
|
|
33
|
+
required: false
|
|
34
|
+
},
|
|
35
|
+
rows: {
|
|
36
|
+
type: Array,
|
|
37
|
+
required: false
|
|
38
|
+
},
|
|
39
|
+
columns: {
|
|
40
|
+
type: Array,
|
|
41
|
+
required: false
|
|
42
|
+
},
|
|
43
|
+
searchPaths: {
|
|
44
|
+
type: Array,
|
|
45
|
+
required: false
|
|
46
|
+
},
|
|
47
|
+
localSort: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
required: false,
|
|
50
|
+
default: true
|
|
51
|
+
},
|
|
52
|
+
displayColumns: {
|
|
53
|
+
type: Array,
|
|
54
|
+
required: false
|
|
55
|
+
},
|
|
56
|
+
rowActions: {
|
|
57
|
+
type: Object,
|
|
58
|
+
required: false
|
|
15
59
|
},
|
|
16
60
|
clientFactory: {
|
|
17
61
|
type: Function,
|
|
@@ -174,7 +218,61 @@ var as_table_root_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
174
218
|
const urlQuery = (0, vue.useModel)(__props, "urlQuery");
|
|
175
219
|
const urlQueryActive = require_use_has_emit_listener.useHasEmitListener("onUpdate:urlQuery").value;
|
|
176
220
|
const urlQueryReady = (0, vue.ref)(!urlQueryActive);
|
|
177
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Local mode is decided once, at setup: `:rows` present means "render this
|
|
223
|
+
* array", which is a different state factory (no client, no metadata fetch).
|
|
224
|
+
* It cannot flip at runtime — a table that changes data source re-mounts.
|
|
225
|
+
*/
|
|
226
|
+
const localMode = props.rows !== void 0;
|
|
227
|
+
if (!localMode && !props.url) throw new Error("[vue-table] <AsTableRoot> requires either :url or :rows (local mode).");
|
|
228
|
+
/**
|
|
229
|
+
* Build the local-mode state: a `createStaticTableState` over the `:rows`
|
|
230
|
+
* array, provided to the subtree exactly like the fetching path so cells,
|
|
231
|
+
* keyboard nav, header slots, selection and the config dialog all work.
|
|
232
|
+
* Features that need a client are inert here and warned about once.
|
|
233
|
+
*/
|
|
234
|
+
function createLocalState() {
|
|
235
|
+
if (DEV) {
|
|
236
|
+
if (props.url) console.warn("[vue-table] <AsTableRoot>: :rows is set, so :url is ignored (local mode).");
|
|
237
|
+
if (props.preset) console.warn("[vue-table] <AsTableRoot>: presets need a server and are off in local mode.");
|
|
238
|
+
if (urlQueryActive) console.warn("[vue-table] <AsTableRoot>: v-model:urlQuery is not wired in local mode.");
|
|
239
|
+
if (props.queryFn) console.warn("[vue-table] <AsTableRoot>: :queryFn is ignored in local mode.");
|
|
240
|
+
}
|
|
241
|
+
const { state: localState } = require_use_table_state.createStaticTableState({
|
|
242
|
+
rows: () => props.rows ?? [],
|
|
243
|
+
columns: props.columns ?? [],
|
|
244
|
+
searchPaths: props.searchPaths,
|
|
245
|
+
localSort: props.localSort,
|
|
246
|
+
displayColumns: props.displayColumns,
|
|
247
|
+
limit: props.limit,
|
|
248
|
+
queryOnMount: props.queryOnMount,
|
|
249
|
+
selection: {
|
|
250
|
+
rowValueFn: props.rowValueFn,
|
|
251
|
+
selectedRows
|
|
252
|
+
},
|
|
253
|
+
model: {
|
|
254
|
+
filterFields,
|
|
255
|
+
columnNames,
|
|
256
|
+
columnWidths,
|
|
257
|
+
sorters
|
|
258
|
+
},
|
|
259
|
+
actions: {
|
|
260
|
+
resolveHref: props.resolveHref,
|
|
261
|
+
onResolved: (action, ids, result, event) => emit("action", action, ids, result, event)
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
require_use_table.finalizeTableState(localState, {}, {
|
|
265
|
+
selectionPersistence: props.selectionPersistence,
|
|
266
|
+
controls: props.controls,
|
|
267
|
+
types: props.types,
|
|
268
|
+
components: props.components,
|
|
269
|
+
formTypes: props.formTypes,
|
|
270
|
+
formComponents: props.formComponents
|
|
271
|
+
});
|
|
272
|
+
(0, vue.watch)(() => props.rows, () => localState.query({ silent: true }));
|
|
273
|
+
return localState;
|
|
274
|
+
}
|
|
275
|
+
const state = localMode ? createLocalState() : require_use_table.useTable(props.url, {
|
|
178
276
|
limit: props.limit,
|
|
179
277
|
rowValueFn: props.rowValueFn,
|
|
180
278
|
selectionPersistence: props.selectionPersistence,
|
|
@@ -206,9 +304,13 @@ var as_table_root_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
206
304
|
urlQueryReady: urlQueryActive ? urlQueryReady : void 0,
|
|
207
305
|
onUrlQueryChange: urlQueryActive ? (s) => urlQuery.value = s : void 0,
|
|
208
306
|
urlQuerySync: props.urlQuerySync,
|
|
209
|
-
preset: props.preset
|
|
307
|
+
preset: props.preset,
|
|
308
|
+
displayColumns: props.displayColumns
|
|
210
309
|
});
|
|
211
|
-
|
|
310
|
+
(0, vue.watch)(() => props.rowActions, (value) => {
|
|
311
|
+
state.rowActions.value = value;
|
|
312
|
+
}, { immediate: true });
|
|
313
|
+
if (urlQueryActive && !localMode) (0, vue.watch)([
|
|
212
314
|
() => state.tableDef.value,
|
|
213
315
|
() => urlQuery.value,
|
|
214
316
|
() => state.preset.ready.value
|
package/dist/as-table-root.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_table_root = require("./as-table-root-
|
|
1
|
+
const require_as_table_root = require("./as-table-root-DlYjnZax.cjs");
|
|
2
2
|
module.exports = require_as_table_root.as_table_root_default;
|
package/dist/as-table-root.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-table-root.vue-
|
|
1
|
+
import { t as _default } from "./as-table-root.vue-D94eypcL.cjs";
|
|
2
2
|
export = _default;
|
package/dist/as-table-root.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-table-root.vue-
|
|
1
|
+
import { t as _default } from "./as-table-root.vue-CWk9YgpG.mjs";
|
|
2
2
|
export { _default as default };
|
package/dist/as-table-root.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_table_root_default } from "./as-table-root-
|
|
1
|
+
import { t as as_table_root_default } from "./as-table-root-C1A6JkwL.mjs";
|
|
2
2
|
export { as_table_root_default as default };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as vue from "vue";
|
|
3
|
-
import { AllowedComponentProps, AnchorHTMLAttributes, App, Component as Component$1, ComponentCustomProps, ComponentPublicInstance, ComputedRef, DefineComponent, InjectionKey, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, UnwrapRef, VNode, VNodeProps, WritableComputedRef } from "vue";
|
|
4
|
-
import { Client, PageResult, TDbActionInfo } from "@atscript/db-client";
|
|
1
|
+
import { C as TableActionsState, S as TVueTableActionInfo, b as TAsCellTypeComponents, f as ReactiveTableState, i as ConfirmOptions, l as NavKeyOptions, p as RowActionsConfig, t as ActionResult, u as PresetConfig, w as TableNavBridge, x as TAsTableControls } from "./types-CBGaTR2Z.mjs";
|
|
5
2
|
import * as _atscript_ui0 from "@atscript/ui";
|
|
6
3
|
import { ClientFactory, ClientFactory as ClientFactory$1, ColumnDef, SortControl, TableDef, getDefaultClientFactory, resetDefaultClientFactory, setDefaultClientFactory } from "@atscript/ui";
|
|
4
|
+
import * as vue from "vue";
|
|
5
|
+
import { AllowedComponentProps, AnchorHTMLAttributes, App, Component as Component$1, ComponentCustomProps, ComponentPublicInstance, ComputedRef, DefineComponent, InjectionKey, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, UnwrapRef, VNode, VNodeProps, WritableComputedRef } from "vue";
|
|
7
6
|
import * as _atscript_ui_table0 from "@atscript/ui-table";
|
|
8
|
-
import { AppConfData, AppConfData as AppConfData$1, AsPresetEntryRow, AsPresetEntryRow as AsPresetEntryRow$1, ColumnWidthsMap, FilterCondition, PRESET_ASPECTS, PresetAspect, PresetAspect as PresetAspect$1, PresetCapabilities, PresetCapabilities as PresetCapabilities$1, PresetData, PresetDraft, PresetSnapshot, PresetSnapshot as PresetSnapshot$1, PresetSnapshotWire, QueryOptions, STANDARD_PRESET_ID, SYSTEM_PRESET_PREFIX, SelectionMode, SystemPreset, SystemPreset as SystemPreset$1, SystemPresetInput, SystemPresetInput as SystemPresetInput$1, UrlQuerySync, UrlQuerySync as UrlQuerySync$1, UserConfData, isSystemPresetId, resolveSystemPresets } from "@atscript/ui-table";
|
|
7
|
+
import { AppConfData, AppConfData as AppConfData$1, AsPresetEntryRow, AsPresetEntryRow as AsPresetEntryRow$1, ColumnWidthsMap, CsvOptions, CsvOptions as CsvOptions$1, DisplayColumnDef, DisplayColumnDef as DisplayColumnDef$1, ExportAbortError, ExportScalar, ExportScalar as ExportScalar$1, FilterCondition, PRESET_ASPECTS, PresetAspect, PresetAspect as PresetAspect$1, PresetCapabilities, PresetCapabilities as PresetCapabilities$1, PresetData, PresetDraft, PresetSnapshot, PresetSnapshot as PresetSnapshot$1, PresetSnapshotWire, QueryOptions, STANDARD_PRESET_ID as STANDARD_PRESET_ID$1, SYSTEM_PRESET_PREFIX, SelectionMode, SystemPreset, SystemPreset as SystemPreset$1, SystemPresetInput, SystemPresetInput as SystemPresetInput$1, UrlQuerySync, UrlQuerySync as UrlQuerySync$1, UserConfData, isSystemPresetId as isSystemPresetId$1, resolveSystemPresets as resolveSystemPresets$1 } from "@atscript/ui-table";
|
|
8
|
+
import { Client, PageResult } from "@atscript/db-client";
|
|
9
9
|
import { TAsTypeComponents } from "@atscript/vue-form";
|
|
10
10
|
import { FilterExpr, Uniquery } from "@uniqu/core";
|
|
11
11
|
|
|
@@ -200,6 +200,16 @@ interface TableContext {
|
|
|
200
200
|
formComponents?: Record<string, Component$1>;
|
|
201
201
|
}
|
|
202
202
|
type QueryFn = (query: Uniquery, page: number, size: number) => Promise<PageResult<Record<string, unknown>>>;
|
|
203
|
+
/** Per-call overrides for `state.buildQuery()`. Since 0.1.134. */
|
|
204
|
+
interface BuildQueryOptions {
|
|
205
|
+
/**
|
|
206
|
+
* Column paths to project instead of the visible ones. Client-owned
|
|
207
|
+
* (`local`) columns are dropped from the result either way.
|
|
208
|
+
*/
|
|
209
|
+
columnPaths?: string[];
|
|
210
|
+
/** Override the `$actions` opt-in (default: whatever the renderer asked for). */
|
|
211
|
+
includeActions?: boolean;
|
|
212
|
+
}
|
|
203
213
|
/** External refs the consumer wires up via `defineModel` (or otherwise). */
|
|
204
214
|
interface TableModelRefs {
|
|
205
215
|
filterFields?: Ref<string[]>;
|
|
@@ -243,6 +253,12 @@ interface TableQueryOptions {
|
|
|
243
253
|
ignoreSortersWhenSearched?: boolean;
|
|
244
254
|
/** Auto-query when metadata loads (default: true). */
|
|
245
255
|
queryOnMount?: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* The query function already returns its rows ordered by every active
|
|
258
|
+
* sorter, so `applyLocalSort` must not re-order the page on top of it. Set
|
|
259
|
+
* by the in-memory (`createStaticTableState`) path. Since 0.1.134.
|
|
260
|
+
*/
|
|
261
|
+
preSorted?: boolean;
|
|
246
262
|
/**
|
|
247
263
|
* Gate the initial `scheduleQuery("initial")` until this ref flips to
|
|
248
264
|
* `true`. Used by `<AsTableRoot>` when `v-model:urlQuery` is bound, to
|
|
@@ -317,6 +333,11 @@ interface CreateTableStateOptions {
|
|
|
317
333
|
actions?: TableActionsOptions;
|
|
318
334
|
/** Preset settings. */
|
|
319
335
|
preset?: TablePresetOptions;
|
|
336
|
+
/**
|
|
337
|
+
* Client-owned columns merged into the server's column list. Captured once
|
|
338
|
+
* at setup — to change the set, re-mount. Since 0.1.134.
|
|
339
|
+
*/
|
|
340
|
+
displayColumns?: readonly DisplayColumnDef[];
|
|
320
341
|
}
|
|
321
342
|
/** Internal handles returned alongside the public state. */
|
|
322
343
|
interface TableStateInternals {
|
|
@@ -330,8 +351,12 @@ declare function createTableState(opts: CreateTableStateOptions): {
|
|
|
330
351
|
internals: TableStateInternals;
|
|
331
352
|
};
|
|
332
353
|
interface CreateStaticTableStateOptions {
|
|
333
|
-
/**
|
|
334
|
-
|
|
354
|
+
/**
|
|
355
|
+
* All rows in the dataset. Sorting/searching is applied locally. Pass a
|
|
356
|
+
* getter (or a ref) to keep it reactive — every local "fetch" re-reads it,
|
|
357
|
+
* so replacing the array and calling `state.query()` re-renders the table.
|
|
358
|
+
*/
|
|
359
|
+
rows: MaybeRefOrGetter<Record<string, unknown>[]>;
|
|
335
360
|
/** Columns to render. Used to synthesize a minimal `TableDef`. */
|
|
336
361
|
columns: ColumnDef[];
|
|
337
362
|
/** Field paths matched (substring, case-insensitive) by `searchTerm`. */
|
|
@@ -340,6 +365,23 @@ interface CreateStaticTableStateOptions {
|
|
|
340
365
|
selection?: TableSelectionOptions;
|
|
341
366
|
/** Default page size (`pagination.itemsPerPage`). */
|
|
342
367
|
limit?: number;
|
|
368
|
+
/**
|
|
369
|
+
* Sort `rows` in memory from the active sorters (default `true`). Set
|
|
370
|
+
* `false` when `rows` already arrives in the order it should render and the
|
|
371
|
+
* header's sort affordance is purely cosmetic. Since 0.1.134.
|
|
372
|
+
*/
|
|
373
|
+
localSort?: boolean;
|
|
374
|
+
/** Client-owned columns merged into `columns`. Since 0.1.134. */
|
|
375
|
+
displayColumns?: readonly DisplayColumnDef[];
|
|
376
|
+
/** External refs from `defineModel` — same contract as `createTableState`. Since 0.1.134. */
|
|
377
|
+
model?: TableModelRefs;
|
|
378
|
+
/** Auto-query once the synthetic definition is in place (default: true). Since 0.1.134. */
|
|
379
|
+
queryOnMount?: boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Action settings. Only the client-free parts apply — there is no client to
|
|
382
|
+
* invoke a server action with. Since 0.1.134.
|
|
383
|
+
*/
|
|
384
|
+
actions?: TableActionsOptions;
|
|
343
385
|
}
|
|
344
386
|
/**
|
|
345
387
|
* Build a `ReactiveTableState` backed by an in-memory row list. Used by the
|
|
@@ -350,6 +392,8 @@ declare function createStaticTableState(opts: CreateStaticTableStateOptions): {
|
|
|
350
392
|
state: ReactiveTableState;
|
|
351
393
|
internals: TableStateInternals;
|
|
352
394
|
};
|
|
395
|
+
/** Provide the full table context to the component subtree. */
|
|
396
|
+
declare function provideTableContext(ctx: TableContext): void;
|
|
353
397
|
/** Inject the full table context (throws if used outside as-table-root). */
|
|
354
398
|
declare function useTableContext(): TableContext;
|
|
355
399
|
/**
|
|
@@ -505,6 +549,11 @@ interface UseTableOptions {
|
|
|
505
549
|
* `url` and `tableKey` are required.
|
|
506
550
|
*/
|
|
507
551
|
preset?: PresetConfig;
|
|
552
|
+
/**
|
|
553
|
+
* Client-owned columns merged into the server's column list — see
|
|
554
|
+
* {@link DisplayColumnDef}. Captured once at setup. Since 0.1.134.
|
|
555
|
+
*/
|
|
556
|
+
displayColumns?: readonly DisplayColumnDef[];
|
|
508
557
|
}
|
|
509
558
|
/**
|
|
510
559
|
* Main entry composable for table setup.
|
|
@@ -513,6 +562,106 @@ interface UseTableOptions {
|
|
|
513
562
|
*/
|
|
514
563
|
declare function useTable(url: string, opts?: UseTableOptions): ReactiveTableState;
|
|
515
564
|
//#endregion
|
|
565
|
+
//#region src/composables/use-table-export.d.ts
|
|
566
|
+
/** Per-cell formatter override. Return `undefined` to fall back to the default. */
|
|
567
|
+
type ExportCellFormatter = (value: unknown, column: ColumnDef, row: Record<string, unknown>) => ExportScalar | undefined;
|
|
568
|
+
interface ExportRowsOptions {
|
|
569
|
+
/**
|
|
570
|
+
* `'visible'` (default) exports the visible columns in their current display
|
|
571
|
+
* order, minus the client-owned ([display](/tables/customization)) ones —
|
|
572
|
+
* nothing on the server backs them, so they would export as an empty column
|
|
573
|
+
* unless a `formatters` entry fills them in. An array of column paths
|
|
574
|
+
* exports exactly those, in that order, display columns included.
|
|
575
|
+
*/
|
|
576
|
+
columns?: "visible" | string[];
|
|
577
|
+
/** `'csv'` (default) renders a CSV string; `'rows'` returns scalar arrays. */
|
|
578
|
+
format?: "csv" | "rows";
|
|
579
|
+
/** Rows per request while paging. Default 500. */
|
|
580
|
+
pageSize?: number;
|
|
581
|
+
/** Stop the run between pages; the promise rejects with an `AbortError`. */
|
|
582
|
+
signal?: AbortSignal;
|
|
583
|
+
/** Called after each settled page. `total` is the first page's `count`, when the endpoint reports one. */
|
|
584
|
+
onProgress?: (done: number, total?: number) => void;
|
|
585
|
+
/** Global cell formatter, applied to every column that has no `formatters` entry. */
|
|
586
|
+
formatCell?: ExportCellFormatter;
|
|
587
|
+
/** Per-column formatters keyed by column path. Win over `formatCell`. */
|
|
588
|
+
formatters?: Record<string, ExportCellFormatter>;
|
|
589
|
+
/** File name for `format: 'csv'`. `.csv` is appended when missing. Default `"export.csv"`. */
|
|
590
|
+
filename?: string;
|
|
591
|
+
/**
|
|
592
|
+
* CSV writer settings — `bom`, `escapeFormulas`, `delimiter`. Ignored by
|
|
593
|
+
* `format: 'rows'`.
|
|
594
|
+
*/
|
|
595
|
+
csv?: CsvOptions;
|
|
596
|
+
/** Hard ceiling on exported rows. */
|
|
597
|
+
maxRows?: number;
|
|
598
|
+
}
|
|
599
|
+
interface ExportResultBase {
|
|
600
|
+
/** Header labels, in export order. */
|
|
601
|
+
columns: string[];
|
|
602
|
+
/** Column paths, in export order. */
|
|
603
|
+
columnPaths: string[];
|
|
604
|
+
/** How many data rows the run collected. */
|
|
605
|
+
rowCount: number;
|
|
606
|
+
/** Total the endpoint reported for the query, when it reported one. */
|
|
607
|
+
total?: number;
|
|
608
|
+
}
|
|
609
|
+
/** A finished export. `format` discriminates the payload. */
|
|
610
|
+
type ExportResult = (ExportResultBase & {
|
|
611
|
+
format: "csv";
|
|
612
|
+
csv: string;
|
|
613
|
+
filename: string;
|
|
614
|
+
}) | (ExportResultBase & {
|
|
615
|
+
format: "rows";
|
|
616
|
+
rows: ExportScalar[][];
|
|
617
|
+
});
|
|
618
|
+
/** Progress of the run in flight: rows collected so far, and the reported total. */
|
|
619
|
+
interface ExportProgress {
|
|
620
|
+
done: number;
|
|
621
|
+
total?: number;
|
|
622
|
+
}
|
|
623
|
+
interface UseTableExportReturn {
|
|
624
|
+
/**
|
|
625
|
+
* Run an export against the table's CURRENT query. Rejects when a run is
|
|
626
|
+
* already in flight — one handle runs one export at a time.
|
|
627
|
+
*/
|
|
628
|
+
exportRows: (opts?: ExportRowsOptions) => Promise<ExportResult>;
|
|
629
|
+
/** `true` while an `exportRows` call is in flight. */
|
|
630
|
+
exporting: ComputedRef<boolean>;
|
|
631
|
+
/** Progress of the in-flight run, or `null` while idle. */
|
|
632
|
+
progress: Ref<ExportProgress | null>;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Export the table's data as it is queried right now.
|
|
636
|
+
*
|
|
637
|
+
* The export snapshots the table's own query at call time — the same filters,
|
|
638
|
+
* sorters, search term, force-filters and `$select` projection the on-screen
|
|
639
|
+
* fetch uses (`state.buildQuery()`), through the same fetch path
|
|
640
|
+
* (`state.fetchPage()`, so a custom `queryFn` is honoured) — then pages
|
|
641
|
+
* through every result instead of one page. The primary key(s) are appended
|
|
642
|
+
* to the sort as a tiebreaker so pages never overlap or skip.
|
|
643
|
+
*
|
|
644
|
+
* Values come out of the same column metadata the cells read: union/enum keys
|
|
645
|
+
* become their labels, dates become ISO strings, arrays join. Override per
|
|
646
|
+
* column with `formatters`, or globally with `formatCell`.
|
|
647
|
+
*
|
|
648
|
+
* ```ts
|
|
649
|
+
* const { exportRows } = useTableExport()
|
|
650
|
+
* downloadExport(await exportRows({ filename: "orders.csv", csv: { bom: true } }))
|
|
651
|
+
* ```
|
|
652
|
+
*
|
|
653
|
+
* Since 0.1.134.
|
|
654
|
+
*/
|
|
655
|
+
declare function useTableExport(ctx?: TableContext): UseTableExportReturn;
|
|
656
|
+
/**
|
|
657
|
+
* Hand a finished CSV export to the browser as a file download. Returns
|
|
658
|
+
* `false` without doing anything when there is no DOM (SSR / a worker), so a
|
|
659
|
+
* server render can call it unguarded.
|
|
660
|
+
*
|
|
661
|
+
* Since 0.1.134.
|
|
662
|
+
*/
|
|
663
|
+
declare function downloadExport(result: ExportResult): boolean;
|
|
664
|
+
//#endregion
|
|
516
665
|
//#region src/composables/use-table-nav-bridge.d.ts
|
|
517
666
|
interface UseTableNavBridgeOptions extends Omit<NavKeyOptions, "mode"> {
|
|
518
667
|
/**
|
|
@@ -2200,25 +2349,48 @@ declare function getCellValue(row: Record<string, unknown>, path: string): unkno
|
|
|
2200
2349
|
/** Format a cell value based on column type. */
|
|
2201
2350
|
declare function formatCellValue(value: unknown, type: string): string;
|
|
2202
2351
|
//#endregion
|
|
2203
|
-
//#region src/composables/state/intent-scope.d.ts
|
|
2204
|
-
/**
|
|
2205
|
-
* Build the identifier object to forward to `client.action` / `client.remove`.
|
|
2206
|
-
*
|
|
2207
|
-
* Per `@atscript/db-client` invariant #11, identifier bodies are object-only
|
|
2208
|
-
* — never bare scalars, even for single-field PK tables. This helper accepts:
|
|
2209
|
-
* - a row-shaped object (default `rowValueFn`) → picks `preferredId` fields;
|
|
2210
|
-
* - a scalar value when `preferredId` has exactly one field (consumers that
|
|
2211
|
-
* override `rowValueFn` to return the PK scalar) → wraps it.
|
|
2212
|
-
*
|
|
2213
|
-
* Returns `undefined` when no `preferredId` is declared, the source is
|
|
2214
|
-
* `null`/`undefined`, or a scalar can't be paired with a single-field
|
|
2215
|
-
* identifier.
|
|
2216
|
-
*/
|
|
2217
|
-
declare function extractIdentifier(source: unknown, preferredId: readonly string[]): Record<string, unknown> | undefined;
|
|
2218
|
-
//#endregion
|
|
2219
2352
|
//#region src/components/as-table-root.vue.d.ts
|
|
2220
2353
|
type __VLS_Props = {
|
|
2221
|
-
/**
|
|
2354
|
+
/**
|
|
2355
|
+
* Table endpoint URL (e.g. "/db/tables/products"). Omit it — and pass
|
|
2356
|
+
* `:rows` + `:columns` instead — to run the table in local mode over an
|
|
2357
|
+
* already-loaded array.
|
|
2358
|
+
*/
|
|
2359
|
+
url?: string;
|
|
2360
|
+
/**
|
|
2361
|
+
* Local mode: render these rows instead of fetching. No client, no
|
|
2362
|
+
* `/meta` request and no metadata cache entry. Reactive — replacing the
|
|
2363
|
+
* array re-runs the local query (search / sort / paging stay live).
|
|
2364
|
+
* Requires `:columns`. Since 0.1.134.
|
|
2365
|
+
*/
|
|
2366
|
+
rows?: Record<string, unknown>[];
|
|
2367
|
+
/**
|
|
2368
|
+
* Local mode: the columns to render. Read once at setup. Since 0.1.134.
|
|
2369
|
+
*/
|
|
2370
|
+
columns?: ColumnDef[];
|
|
2371
|
+
/**
|
|
2372
|
+
* Local mode: field paths the search term matches (substring,
|
|
2373
|
+
* case-insensitive). Omit to disable search. Since 0.1.134.
|
|
2374
|
+
*/
|
|
2375
|
+
searchPaths?: string[];
|
|
2376
|
+
/**
|
|
2377
|
+
* Local mode: sort `rows` in memory from the active sorters (default
|
|
2378
|
+
* `true`). Since 0.1.134.
|
|
2379
|
+
*/
|
|
2380
|
+
localSort?: boolean;
|
|
2381
|
+
/**
|
|
2382
|
+
* Client-owned columns merged into the server's column list — labelled,
|
|
2383
|
+
* hideable, reorderable and preset-persisted like any column, but never
|
|
2384
|
+
* part of `$select`, server sorting or filters. Since 0.1.134.
|
|
2385
|
+
*/
|
|
2386
|
+
displayColumns?: DisplayColumnDef[];
|
|
2387
|
+
/**
|
|
2388
|
+
* Per-screen policy for the row-actions cell: narrow the server's action
|
|
2389
|
+
* set (`include` / `exclude`), relabel it (`overrides`), and append
|
|
2390
|
+
* app-owned actions (`extra`). The server stays authoritative — an action
|
|
2391
|
+
* a row's `$actions` gated away never appears. Since 0.1.134.
|
|
2392
|
+
*/
|
|
2393
|
+
rowActions?: RowActionsConfig; /** Factory to create a client from a URL. Falls back to the app-wide default set via `setDefaultClientFactory` (or the built-in `new Client(url)` factory if unset). */
|
|
2222
2394
|
clientFactory?: ClientFactory; /** Skin-slot overrides for table chrome — header cells, filter dialog, column menu, etc. Use {@link createDefaultControls} to seed defaults. */
|
|
2223
2395
|
controls?: TAsTableControls; /** Cell-type → component dispatch map. Use {@link createDefaultCellTypes} to seed defaults. */
|
|
2224
2396
|
types?: TAsCellTypeComponents; /** Named cell-component overrides — looked up by `@ui.table.component "name"`. */
|
|
@@ -2304,10 +2476,10 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
|
2304
2476
|
declare var __VLS_1: {
|
|
2305
2477
|
tableDef: _atscript_ui0.TableDef | null;
|
|
2306
2478
|
loadingMetadata: boolean;
|
|
2307
|
-
allColumns:
|
|
2479
|
+
allColumns: ColumnDef[];
|
|
2308
2480
|
columnNames: string[];
|
|
2309
2481
|
columnWidths: ColumnWidthsMap;
|
|
2310
|
-
columns:
|
|
2482
|
+
columns: ColumnDef[];
|
|
2311
2483
|
filterFields: string[];
|
|
2312
2484
|
filters: _atscript_ui_table0.FieldFilters;
|
|
2313
2485
|
sorters: SortControl[];
|
|
@@ -2329,7 +2501,7 @@ declare var __VLS_1: {
|
|
|
2329
2501
|
queryNext: () => void;
|
|
2330
2502
|
resetFilters: () => void;
|
|
2331
2503
|
showConfigDialog: (tab?: _atscript_ui_table0.ConfigTab) => void;
|
|
2332
|
-
openFilterDialog: (column:
|
|
2504
|
+
openFilterDialog: (column: ColumnDef) => void;
|
|
2333
2505
|
closeFilterDialog: () => void;
|
|
2334
2506
|
setFieldFilter: (path: string, conditions: _atscript_ui_table0.FilterCondition[]) => void;
|
|
2335
2507
|
removeFieldFilter: (path: string) => void;
|
|
@@ -2353,9 +2525,11 @@ declare const __VLS_base: vue.DefineComponent<__VLS_PublicProps, {
|
|
|
2353
2525
|
"update:selectedRows": (value: unknown[]) => any;
|
|
2354
2526
|
"update:urlQuery": (value: string | undefined) => any;
|
|
2355
2527
|
} & {
|
|
2356
|
-
action: (
|
|
2357
|
-
|
|
2528
|
+
"main-action": (row: Record<string, unknown>, absIndex: number, event: MouseEvent | KeyboardEvent) => any;
|
|
2529
|
+
action: (action: TVueTableActionInfo, ids: unknown[], result: ActionResult, event?: MouseEvent | KeyboardEvent | undefined) => any;
|
|
2358
2530
|
}, string, vue.PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
2531
|
+
"onMain-action"?: ((row: Record<string, unknown>, absIndex: number, event: MouseEvent | KeyboardEvent) => any) | undefined;
|
|
2532
|
+
onAction?: ((action: TVueTableActionInfo, ids: unknown[], result: ActionResult, event?: MouseEvent | KeyboardEvent | undefined) => any) | undefined;
|
|
2359
2533
|
"onUpdate:filterFields"?: ((value: string[]) => any) | undefined;
|
|
2360
2534
|
"onUpdate:columnNames"?: ((value: string[]) => any) | undefined;
|
|
2361
2535
|
"onUpdate:columnWidths"?: ((value: ColumnWidthsMap) => any) | undefined;
|
|
@@ -2363,9 +2537,8 @@ declare const __VLS_base: vue.DefineComponent<__VLS_PublicProps, {
|
|
|
2363
2537
|
"onUpdate:ignoreSortersWhenSearched"?: ((value: boolean) => any) | undefined;
|
|
2364
2538
|
"onUpdate:selectedRows"?: ((value: unknown[]) => any) | undefined;
|
|
2365
2539
|
"onUpdate:urlQuery"?: ((value: string | undefined) => any) | undefined;
|
|
2366
|
-
onAction?: ((action: TVueTableActionInfo, ids: unknown[], result: ActionResult, event?: KeyboardEvent | MouseEvent | undefined) => any) | undefined;
|
|
2367
|
-
"onMain-action"?: ((row: Record<string, unknown>, absIndex: number, event: KeyboardEvent | MouseEvent) => any) | undefined;
|
|
2368
2540
|
}>, {
|
|
2541
|
+
localSort: boolean;
|
|
2369
2542
|
queryOnMount: boolean;
|
|
2370
2543
|
selectionPersistence: SelectionPersistence;
|
|
2371
2544
|
refreshOnAction: boolean;
|
|
@@ -2378,4 +2551,4 @@ type __VLS_WithSlots<T, S> = T & {
|
|
|
2378
2551
|
};
|
|
2379
2552
|
};
|
|
2380
2553
|
//#endregion
|
|
2381
|
-
export {
|
|
2554
|
+
export { useTableExport as $, CellLocale as A, injectPresetsApp as B, isSystemPresetId$1 as C, UseLocalDraftReturn as Ct, formatCellValue as D, setDefaultClientFactory as E, useTableComponent as F, useTableFilter as G, useTableUrlQuery as H, UseAppPrefsOptions as I, ExportProgress as J, useTableNavBridge as K, UseAppPrefsReturn as L, useCellLocale as M, createDefaultCellTypes as N, getCellValue as O, createDefaultControls as P, downloadExport as Q, useAppPrefs as R, getDefaultClientFactory as S, UseLocalDraftOptions as St, resolveSystemPresets$1 as T, useTableActions as U, UseTableUrlQueryOptions as V, useTableSearch as W, ExportRowsOptions as X, ExportResult as Y, UseTableExportReturn as Z, SYSTEM_PRESET_PREFIX as _, ActivePresetView as _t, CsvOptions$1 as a, BuildQueryOptions as at, UrlQuerySync$1 as b, usePresets as bt, ExportScalar$1 as c, QueryFn as ct, PresetCapabilities$1 as d, TableStateInternals as dt, UseTableOptions as et, PresetData as f, createStaticTableState as ft, STANDARD_PRESET_ID$1 as g, useTableContextOptional as gt, QueryOptions as h, useTableContext as ht, ClientFactory$1 as i, useTableSelection as it, provideCellLocale as j, getColumnWidth as k, PRESET_ASPECTS as l, TableContext as lt, PresetSnapshotWire as m, provideTableContext as mt, AppConfData$1 as n, useTable as nt, DisplayColumnDef$1 as o, CreateStaticTableStateOptions as ot, PresetSnapshot$1 as p, createTableState as pt, ExportCellFormatter as q, AsPresetEntryRow$1 as r, SelectionPersistence as rt, ExportAbortError as s, CreateTableStateOptions as st, _default as t, clearTableCache as tt, PresetAspect$1 as u, TableModelRefs as ut, SystemPreset$1 as v, UsePresetsOptions as vt, resetDefaultClientFactory as w, useLocalDraft as wt, UserConfData as x, StorageLike as xt, SystemPresetInput$1 as y, UsePresetsReturn as yt, AS_PRESETS_APP as z };
|