@atscript/vue-table 0.1.132 → 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 +42 -30
- package/dist/as-action-form-dialog.mjs +42 -30
- package/dist/{as-action-menu-content-C5qx9MPE.cjs → as-action-menu-content-C_D_Fepo.cjs} +1 -1
- package/dist/{as-action-menu-content-4UfcabUe.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-u_DNy3f-.d.cts → as-column-menu.vue-De7SRhj6.d.cts} +1 -1
- package/dist/{as-column-menu.vue-DL5N9mKR.d.mts → as-column-menu.vue-Dg0H1dOd.d.mts} +1 -1
- package/dist/{as-config-dialog-BehfqIGd.mjs → as-config-dialog-BUBHiVlf.mjs} +56 -35
- package/dist/{as-config-dialog-BOYWPYYH.cjs → as-config-dialog-DvBptYMS.cjs} +55 -34
- package/dist/as-config-dialog.cjs +1 -1
- package/dist/as-config-dialog.mjs +1 -1
- package/dist/{as-confirm-dialog-UwhDHysk.cjs → as-confirm-dialog-ByMfIG0A.cjs} +12 -9
- package/dist/{as-confirm-dialog-bpN4A-KN.mjs → as-confirm-dialog-G4ZoL_Xo.mjs} +12 -9
- package/dist/as-confirm-dialog.cjs +1 -1
- package/dist/as-confirm-dialog.mjs +1 -1
- package/dist/{as-filter-dialog-D1qzq-8b.mjs → as-filter-dialog-BJWH8cvc.mjs} +34 -26
- package/dist/{as-filter-dialog-Dh2Ylthb.cjs → as-filter-dialog-C2oyT0yt.cjs} +33 -25
- package/dist/as-filter-dialog.cjs +1 -1
- package/dist/as-filter-dialog.mjs +1 -1
- package/dist/{as-filter-field-DirBmnbb.mjs → as-filter-field-B2skq4K0.mjs} +4 -4
- package/dist/{as-filter-field-DRsDJdpx.cjs → as-filter-field-DxGfasQj.cjs} +4 -4
- 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-Bhte22La.cjs +130 -0
- package/dist/as-filters-DogNVlqr.mjs +125 -0
- package/dist/as-filters.cjs +1 -1
- package/dist/as-filters.d.cts +1 -1
- package/dist/as-filters.d.mts +1 -1
- package/dist/as-filters.mjs +1 -1
- package/dist/as-filters.vue-BG_ysCkC.d.mts +65 -0
- package/dist/as-filters.vue-DcxDnWAU.d.cts +65 -0
- package/dist/{as-preset-dialog-CDqCAR7N.mjs → as-preset-dialog-BwHV6Y77.mjs} +71 -21
- package/dist/{as-preset-dialog-DpM06jqR.cjs → as-preset-dialog-D2a6nxEX.cjs} +75 -25
- package/dist/as-preset-dialog.cjs +1 -1
- package/dist/as-preset-dialog.mjs +1 -1
- package/dist/{as-preset-picker-CISaxEZ0.mjs → as-preset-picker-B0JnyAPA.mjs} +39 -15
- package/dist/{as-preset-picker-jUS_YDX8.cjs → as-preset-picker-DbkmapBx.cjs} +45 -21
- package/dist/as-preset-picker.cjs +1 -1
- package/dist/as-preset-picker.mjs +1 -1
- package/dist/{as-row-actions-xqJeAdQl.mjs → as-row-actions-BkIsJVBm.mjs} +24 -11
- package/dist/{as-row-actions-Bm6Bzyno.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-Bvcc2tUN.d.cts → as-row-actions.vue-VpJsBAJ4.d.mts} +8 -0
- package/dist/{as-row-actions.vue-DUSDuoR2.d.mts → as-row-actions.vue-dn_DKcMm.d.cts} +8 -0
- package/dist/{as-table-CDSG2yED.mjs → as-table-BEvsX87E.mjs} +26 -8
- package/dist/{as-table-actions-DMxeaczm.mjs → as-table-actions-B5upF1bQ.mjs} +69 -18
- package/dist/{as-table-actions-gV4lqqxc.cjs → as-table-actions-B6sKd4sl.cjs} +68 -17
- 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-B-cgiCXP.d.cts → as-table-actions.vue-CoxhpIlJ.d.mts} +2 -2
- package/dist/{as-table-actions.vue-ClMa0OD1.d.mts → as-table-actions.vue-Kic8m28V.d.cts} +2 -2
- package/dist/{as-table-base-BaTE3VSN.mjs → as-table-base-BxKBdIdS.mjs} +142 -47
- package/dist/{as-table-base-RG2TEIgV.cjs → as-table-base-DLuhKz69.cjs} +142 -47
- 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-CIqlO6Lw.cjs → as-table-header-cell-Bv6q5iKA.cjs} +2 -2
- package/dist/{as-table-header-cell-Bdhl5Lox.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-BCszzxtU.d.mts → as-table-header-cell.vue-AS6u4e6v.d.cts} +2 -2
- package/dist/{as-table-header-cell.vue-BzTzfGRo.d.cts → as-table-header-cell.vue-zKOmlzhT.d.mts} +2 -2
- package/dist/{as-table-root-BLReUbRH.mjs → as-table-root-C1A6JkwL.mjs} +112 -10
- package/dist/{as-table-root-DLJ_3Jf4.cjs → as-table-root-DlYjnZax.cjs} +112 -10
- 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-QMT93qPk.d.mts → as-table-root.vue-CWk9YgpG.d.mts} +257 -41
- package/dist/{as-table-root.vue-D0T3n-Vm.d.cts → as-table-root.vue-D94eypcL.d.cts} +258 -42
- package/dist/{as-table-status-Du4WLF4k.cjs → as-table-status-B2HPerJT.cjs} +54 -38
- package/dist/{as-table-status-DGTZlpyq.mjs → as-table-status-QzlBdSiR.mjs} +54 -38
- package/dist/{as-table-BWUPzjRn.cjs → as-table-vJbZyZVx.cjs} +26 -8
- 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-Ds7MEp37.d.cts → as-table.vue-BB1vaNL6.d.cts} +28 -4
- package/dist/{as-table.vue-Ce5606ZO.d.mts → as-table.vue-BUDFTCpo.d.mts} +28 -4
- package/dist/{as-window-table-DWujiUQy.mjs → as-window-table-BH0tDDnr.mjs} +107 -24
- package/dist/{as-window-table-jD_y9yet.cjs → as-window-table-Bl_q72WL.cjs} +107 -24
- 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-DfZF1Mux.d.mts → as-window-table.vue-Be2IA0Eb.d.cts} +27 -4
- package/dist/{as-window-table.vue-Bhf9BK8E.d.cts → as-window-table.vue-CLqFM2ff.d.mts} +27 -4
- package/dist/error-message-CfKpn_5w.cjs +18 -0
- package/dist/error-message-gNEXnnbb.mjs +13 -0
- package/dist/index.cjs +237 -41
- package/dist/index.d.cts +10 -10
- package/dist/index.d.mts +10 -10
- package/dist/index.mjs +230 -43
- package/dist/{types-ByU4O0Yf.d.mts → types--ex8BJIO.d.cts} +263 -5
- package/dist/{types-CTMxE_zA.d.cts → types-CBGaTR2Z.d.mts} +263 -5
- package/dist/{use-table-CyFcVtUN.mjs → use-table-BFhbfWgY.mjs} +48 -23
- package/dist/{use-table-component-K6xj1obF.mjs → use-table-component-CRmLHdqi.mjs} +1 -1
- package/dist/{use-table-component-DO_kvKSf.cjs → use-table-component-DS5NJPzs.cjs} +1 -1
- package/dist/{use-table-nav-bridge-uOQUDooh.cjs → use-table-nav-bridge-DS14D_rG.cjs} +1 -1
- package/dist/{use-table-nav-bridge-DeGeaQX-.mjs → use-table-nav-bridge-DzJN5v9a.mjs} +1 -1
- package/dist/{use-table-nvBq1dZ4.cjs → use-table-nvuZdgUd.cjs} +51 -20
- package/dist/{use-table-state-BxX3SpeW.mjs → use-table-state-mBXx11aH.mjs} +501 -105
- package/dist/{use-table-state-Oi2ds4_a.cjs → use-table-state-mhm-YWnu.cjs} +541 -109
- package/package.json +9 -9
- package/dist/as-filters-DCZTHjf5.cjs +0 -51
- package/dist/as-filters-beIud9sF.mjs +0 -46
- package/dist/as-filters.vue-DmECMd1v.d.mts +0 -10
- package/dist/as-filters.vue-fv-tRL2H.d.cts +0 -10
- package/dist/preset-aspect-display-IICxAlVo.mjs +0 -43
- package/dist/preset-aspect-display-TWwf6j1B.cjs +0 -72
- /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/{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,6 +1,6 @@
|
|
|
1
|
-
const require_use_table_state = require("./use-table-state-
|
|
2
|
-
const require_get_cell_value = require("./get-cell-value-
|
|
3
|
-
const require_as_table_status = require("./as-table-status-
|
|
1
|
+
const require_use_table_state = require("./use-table-state-mhm-YWnu.cjs");
|
|
2
|
+
const require_get_cell_value = require("./get-cell-value-CJT4fk4y.cjs");
|
|
3
|
+
const require_as_table_status = require("./as-table-status-B2HPerJT.cjs");
|
|
4
4
|
let vue = require("vue");
|
|
5
5
|
let _atscript_ui_table = require("@atscript/ui-table");
|
|
6
6
|
let _vueuse_core = require("@vueuse/core");
|
|
@@ -160,6 +160,7 @@ const _hoisted_6 = [
|
|
|
160
160
|
"id",
|
|
161
161
|
"aria-rowindex",
|
|
162
162
|
"aria-selected",
|
|
163
|
+
"data-selectable",
|
|
163
164
|
"onClick",
|
|
164
165
|
"onDblclick"
|
|
165
166
|
];
|
|
@@ -168,16 +169,24 @@ const _hoisted_7 = {
|
|
|
168
169
|
class: "as-td-select",
|
|
169
170
|
role: "gridcell"
|
|
170
171
|
};
|
|
171
|
-
const _hoisted_8 =
|
|
172
|
+
const _hoisted_8 = [
|
|
173
|
+
"tabindex",
|
|
174
|
+
"aria-checked",
|
|
175
|
+
"aria-disabled",
|
|
176
|
+
"aria-label",
|
|
177
|
+
"title",
|
|
178
|
+
"onKeydown"
|
|
179
|
+
];
|
|
180
|
+
const _hoisted_9 = {
|
|
172
181
|
key: 0,
|
|
173
182
|
class: "as-table-checkbox-tick",
|
|
174
183
|
"aria-hidden": "true"
|
|
175
184
|
};
|
|
176
|
-
const
|
|
185
|
+
const _hoisted_10 = {
|
|
177
186
|
key: 0,
|
|
178
187
|
role: "gridcell"
|
|
179
188
|
};
|
|
180
|
-
const
|
|
189
|
+
const _hoisted_11 = {
|
|
181
190
|
key: 3,
|
|
182
191
|
class: "as-td-filler",
|
|
183
192
|
role: "gridcell"
|
|
@@ -289,6 +298,14 @@ var as_table_base_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
289
298
|
type: Boolean,
|
|
290
299
|
required: false,
|
|
291
300
|
default: false
|
|
301
|
+
},
|
|
302
|
+
rowClass: {
|
|
303
|
+
type: Function,
|
|
304
|
+
required: false
|
|
305
|
+
},
|
|
306
|
+
rowAttrs: {
|
|
307
|
+
type: Function,
|
|
308
|
+
required: false
|
|
292
309
|
}
|
|
293
310
|
},
|
|
294
311
|
emits: [
|
|
@@ -314,14 +331,69 @@ var as_table_base_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
314
331
|
const isListbox = (0, vue.computed)(() => props.renderMode === "listbox");
|
|
315
332
|
const isRekaWrapped = (0, vue.computed)(() => isCombobox.value || isListbox.value);
|
|
316
333
|
const hasValue = (0, vue.computed)(() => isRekaWrapped.value || props.select !== "none");
|
|
334
|
+
const SELECTABLE = Object.freeze({ ok: true });
|
|
335
|
+
const DEFAULT_ROW_META = Object.freeze({
|
|
336
|
+
selectable: SELECTABLE,
|
|
337
|
+
cls: void 0,
|
|
338
|
+
attrs: void 0
|
|
339
|
+
});
|
|
340
|
+
const rowHooks = (0, vue.computed)(() => {
|
|
341
|
+
const rows = props.rows;
|
|
342
|
+
if (!isStandalone.value) return {
|
|
343
|
+
metas: [],
|
|
344
|
+
selectable: rows.length,
|
|
345
|
+
selected: 0
|
|
346
|
+
};
|
|
347
|
+
const gated = !!ctx?.state.rowSelectable.value;
|
|
348
|
+
if (!gated && !props.rowClass && !props.rowAttrs) {
|
|
349
|
+
let selected = 0;
|
|
350
|
+
for (const row of rows) if (isPkSelected(row)) selected++;
|
|
351
|
+
return {
|
|
352
|
+
metas: [],
|
|
353
|
+
selectable: rows.length,
|
|
354
|
+
selected
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
let selectable = 0;
|
|
358
|
+
let selected = 0;
|
|
359
|
+
return {
|
|
360
|
+
metas: rows.map((row, index) => {
|
|
361
|
+
const hookCtx = {
|
|
362
|
+
index,
|
|
363
|
+
get selected() {
|
|
364
|
+
return isPkSelected(row);
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
const verdict = gated ? ctx.state.isRowSelectable(row, index) : SELECTABLE;
|
|
368
|
+
if (verdict.ok) {
|
|
369
|
+
selectable++;
|
|
370
|
+
if (isPkSelected(row)) selected++;
|
|
371
|
+
}
|
|
372
|
+
return {
|
|
373
|
+
selectable: verdict,
|
|
374
|
+
cls: props.rowClass?.(row, hookCtx),
|
|
375
|
+
attrs: props.rowAttrs?.(row, hookCtx)
|
|
376
|
+
};
|
|
377
|
+
}),
|
|
378
|
+
selectable,
|
|
379
|
+
selected
|
|
380
|
+
};
|
|
381
|
+
});
|
|
382
|
+
function metaFor(index) {
|
|
383
|
+
return rowHooks.value.metas[index] ?? DEFAULT_ROW_META;
|
|
384
|
+
}
|
|
385
|
+
/** Accessible name for a row's selection control, carrying the disabled reason. */
|
|
386
|
+
function selectLabel(verdict) {
|
|
387
|
+
if (verdict.ok) return "Select row";
|
|
388
|
+
return verdict.reason ? `Select row, ${verdict.reason}` : "Select row, not selectable";
|
|
389
|
+
}
|
|
317
390
|
const hasActiveFilters = (0, vue.computed)(() => props.filters ? (0, _atscript_ui_table.filledFilterCount)(props.filters) > 0 : false);
|
|
318
391
|
const showSelectAllCheckbox = (0, vue.computed)(() => isStandalone.value && props.select === "multi" && !!props.selectedRows);
|
|
319
392
|
const selectAllState = (0, vue.computed)(() => {
|
|
320
393
|
if (!showSelectAllCheckbox.value) return void 0;
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
return "some";
|
|
394
|
+
if ((props.selectedRows ?? []).length === 0) return "none";
|
|
395
|
+
const { selectable, selected } = rowHooks.value;
|
|
396
|
+
return selectable > 0 && selected >= selectable ? "all" : "some";
|
|
325
397
|
});
|
|
326
398
|
const emit = __emit;
|
|
327
399
|
const slots = (0, vue.useSlots)();
|
|
@@ -360,6 +432,11 @@ var as_table_base_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
360
432
|
if (!isStandalone.value || !ctx) return;
|
|
361
433
|
ctx.state.handleNavKey(event, { mode: props.select });
|
|
362
434
|
}
|
|
435
|
+
/** Space on a row's selection control toggles just that row. */
|
|
436
|
+
function onSelectCellKeydown(event, index) {
|
|
437
|
+
if (!ctx) return;
|
|
438
|
+
require_use_table_state.onSelectControlKeydown(event, index, props.select, ctx.state);
|
|
439
|
+
}
|
|
363
440
|
const scrollContainerRef = (0, vue.ref)(null);
|
|
364
441
|
function alignActiveRow(idx) {
|
|
365
442
|
if (!ctx) return;
|
|
@@ -597,50 +674,68 @@ var as_table_base_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
597
674
|
"aria-activedescendant": ariaActiveDescendant.value,
|
|
598
675
|
onKeydown: onTbodyKeydown
|
|
599
676
|
}, {
|
|
600
|
-
default: (0, vue.withCtx)(({ item, index, spaceBefore }) => [(0, vue.
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
677
|
+
default: (0, vue.withCtx)(({ item, index, spaceBefore }) => [(0, vue.createCommentVNode)("\n `meta` is resolved ONCE per row (the row's hook results + its\n selectability verdict); `v-bind=\"meta.attrs\"` comes FIRST so every\n framework binding after it wins — consumer attrs can decorate a\n row but can never rewrite its id / role / aria / data contract.\n "), ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)([metaFor(index)], (meta) => {
|
|
678
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("tr", (0, vue.mergeProps)({
|
|
679
|
+
key: 0,
|
|
680
|
+
ref_for: true
|
|
681
|
+
}, meta.attrs, {
|
|
682
|
+
id: rowIdFor(index),
|
|
683
|
+
role: "row",
|
|
684
|
+
"aria-rowindex": index + 2,
|
|
685
|
+
"aria-selected": ariaSelectedFor(item),
|
|
686
|
+
"data-selectable": meta.selectable.ok ? void 0 : "false",
|
|
687
|
+
class: [{ "as-table-row-active": isActiveRow(index) }, meta.cls],
|
|
688
|
+
style: {
|
|
689
|
+
height: __props.virtualRowHeight ? `${__props.virtualRowHeight}px` : void 0,
|
|
690
|
+
transform: spaceBefore ? `translateY(${spaceBefore}px)` : void 0
|
|
691
|
+
},
|
|
692
|
+
onClick: ($event) => onRowClick(item, $event, index),
|
|
693
|
+
onDblclick: ($event) => onRowDblClick(item, $event, index)
|
|
694
|
+
}), [
|
|
695
|
+
hasValue.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("td", _hoisted_7, [(0, vue.createElementVNode)("span", {
|
|
696
|
+
class: (0, vue.normalizeClass)(["as-table-checkbox", {
|
|
697
|
+
"as-table-checkbox-checked": isPkSelected(item),
|
|
698
|
+
"as-table-checkbox-disabled": !meta.selectable.ok
|
|
699
|
+
}]),
|
|
700
|
+
role: "checkbox",
|
|
701
|
+
tabindex: meta.selectable.ok ? 0 : void 0,
|
|
702
|
+
"aria-checked": isPkSelected(item) ? "true" : "false",
|
|
703
|
+
"aria-disabled": meta.selectable.ok ? void 0 : "true",
|
|
704
|
+
"aria-label": selectLabel(meta.selectable),
|
|
705
|
+
title: meta.selectable.reason,
|
|
706
|
+
onKeydown: ($event) => onSelectCellKeydown($event, index)
|
|
707
|
+
}, [isPkSelected(item) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_9)) : (0, vue.createCommentVNode)("v-if", true)], 42, _hoisted_8)])) : (0, vue.createCommentVNode)("v-if", true),
|
|
708
|
+
(0, vue.unref)(hasAnyCellBindings) ? ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, (0, vue.renderList)(__props.columns, (col) => {
|
|
709
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: col.path }, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)([(0, vue.unref)(cellResolver)(col, item, index)], (bindings) => {
|
|
710
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [cellSlotFlags.value[col.path] ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("td", (0, vue.mergeProps)({
|
|
711
|
+
key: 0,
|
|
712
|
+
role: "gridcell"
|
|
713
|
+
}, { ref_for: true }, bindings), [(0, vue.renderSlot)(_ctx.$slots, `cell-${col.path}`, {
|
|
714
|
+
row: item,
|
|
715
|
+
value: (0, vue.unref)(require_get_cell_value.getCellValue)(item, col.path),
|
|
716
|
+
column: col
|
|
717
|
+
})], 16)) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(cellComponents)[col.path]), (0, vue.mergeProps)({
|
|
718
|
+
key: 1,
|
|
719
|
+
row: item,
|
|
720
|
+
column: col,
|
|
721
|
+
role: "gridcell"
|
|
722
|
+
}, { ref_for: true }, bindings), null, 16, ["row", "column"]))], 64);
|
|
723
|
+
}), 128))], 64);
|
|
724
|
+
}), 128)) : ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, (0, vue.renderList)(__props.columns, (col) => {
|
|
725
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: col.path }, [cellSlotFlags.value[col.path] ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("td", _hoisted_10, [(0, vue.renderSlot)(_ctx.$slots, `cell-${col.path}`, {
|
|
620
726
|
row: item,
|
|
621
727
|
value: (0, vue.unref)(require_get_cell_value.getCellValue)(item, col.path),
|
|
622
728
|
column: col
|
|
623
|
-
})]
|
|
729
|
+
})])) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(cellComponents)[col.path]), {
|
|
624
730
|
key: 1,
|
|
625
731
|
row: item,
|
|
626
732
|
column: col,
|
|
627
733
|
role: "gridcell"
|
|
628
|
-
},
|
|
629
|
-
}), 128))
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
value: (0, vue.unref)(require_get_cell_value.getCellValue)(item, col.path),
|
|
634
|
-
column: col
|
|
635
|
-
})])) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(cellComponents)[col.path]), {
|
|
636
|
-
key: 1,
|
|
637
|
-
row: item,
|
|
638
|
-
column: col,
|
|
639
|
-
role: "gridcell"
|
|
640
|
-
}, null, 8, ["row", "column"]))], 64);
|
|
641
|
-
}), 128)),
|
|
642
|
-
__props.stretch ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("td", _hoisted_10)) : (0, vue.createCommentVNode)("v-if", true)
|
|
643
|
-
], 46, _hoisted_6)]),
|
|
734
|
+
}, null, 8, ["row", "column"]))], 64);
|
|
735
|
+
}), 128)),
|
|
736
|
+
__props.stretch ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("td", _hoisted_11)) : (0, vue.createCommentVNode)("v-if", true)
|
|
737
|
+
], 16, _hoisted_6);
|
|
738
|
+
}), 128))]),
|
|
644
739
|
_: 3
|
|
645
740
|
}, 8, [
|
|
646
741
|
"options",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_get_cell_value = require("./get-cell-value-
|
|
2
|
-
const require_format_cell = require("./format-cell-
|
|
1
|
+
const require_get_cell_value = require("./get-cell-value-CJT4fk4y.cjs");
|
|
2
|
+
const require_format_cell = require("./format-cell-DaxV6WIJ.cjs");
|
|
3
3
|
let vue = require("vue");
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/components/defaults/as-table-cell-value.vue
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as getCellValue } from "./get-cell-value-
|
|
2
|
-
import { t as formatCellValue } from "./format-cell-
|
|
1
|
+
import { t as getCellValue } from "./get-cell-value-Cb3X8nUn.mjs";
|
|
2
|
+
import { t as formatCellValue } from "./format-cell-Bx7wNc4X.mjs";
|
|
3
3
|
import { createElementBlock, defineComponent, normalizeClass, openBlock, toDisplayString, unref } from "vue";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/components/defaults/as-table-cell-value.vue
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_table_cell_value = require("./as-table-cell-value-
|
|
1
|
+
const require_as_table_cell_value = require("./as-table-cell-value-BAi5yadc.cjs");
|
|
2
2
|
module.exports = require_as_table_cell_value.as_table_cell_value_default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_table_cell_value_default } from "./as-table-cell-value-
|
|
1
|
+
import { t as as_table_cell_value_default } from "./as-table-cell-value-BVcfhhCb.mjs";
|
|
2
2
|
export { as_table_cell_value_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_use_table_component = require("./use-table-component-
|
|
2
|
-
const require_as_column_menu = require("./as-column-menu-
|
|
1
|
+
const require_use_table_component = require("./use-table-component-DS5NJPzs.cjs");
|
|
2
|
+
const require_as_column_menu = require("./as-column-menu-D_8NxujZ.cjs");
|
|
3
3
|
let vue = require("vue");
|
|
4
4
|
let _atscript_ui_table = require("@atscript/ui-table");
|
|
5
5
|
//#region src/components/defaults/as-table-header-cell.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as useTableComponent } from "./use-table-component-
|
|
2
|
-
import { t as as_column_menu_default } from "./as-column-menu-
|
|
1
|
+
import { t as useTableComponent } from "./use-table-component-CRmLHdqi.mjs";
|
|
2
|
+
import { t as as_column_menu_default } from "./as-column-menu-BMTS3DO2.mjs";
|
|
3
3
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, resolveDynamicComponent, toDisplayString, unref, withCtx, withModifiers } from "vue";
|
|
4
4
|
import { isFilled } from "@atscript/ui-table";
|
|
5
5
|
//#region src/components/defaults/as-table-header-cell.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_as_table_header_cell = require("./as-table-header-cell-
|
|
1
|
+
const require_as_table_header_cell = require("./as-table-header-cell-Bv6q5iKA.cjs");
|
|
2
2
|
module.exports = require_as_table_header_cell.as_table_header_cell_default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-table-header-cell.vue-
|
|
1
|
+
import { t as _default } from "./as-table-header-cell.vue-AS6u4e6v.cjs";
|
|
2
2
|
export = _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-table-header-cell.vue-
|
|
1
|
+
import { t as _default } from "./as-table-header-cell.vue-zKOmlzhT.mjs";
|
|
2
2
|
export { _default as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_table_header_cell_default } from "./as-table-header-cell-
|
|
1
|
+
import { t as as_table_header_cell_default } from "./as-table-header-cell-Xd3cvnII.mjs";
|
|
2
2
|
export { as_table_header_cell_default as default };
|
package/dist/{as-table-header-cell.vue-BCszzxtU.d.mts → as-table-header-cell.vue-AS6u4e6v.d.cts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as ColumnMenuConfig } from "./types
|
|
2
|
-
import { ColumnDef } from "@atscript/ui";
|
|
1
|
+
import { n as ColumnMenuConfig } from "./types--ex8BJIO.cjs";
|
|
3
2
|
import * as vue from "vue";
|
|
3
|
+
import { ColumnDef } from "@atscript/ui";
|
|
4
4
|
import { ColumnWidthEntry, FilterCondition } from "@atscript/ui-table";
|
|
5
5
|
|
|
6
6
|
//#region src/components/defaults/as-table-header-cell.vue.d.ts
|
package/dist/{as-table-header-cell.vue-BzTzfGRo.d.cts → as-table-header-cell.vue-zKOmlzhT.d.mts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as ColumnMenuConfig } from "./types-
|
|
2
|
-
import * as vue from "vue";
|
|
1
|
+
import { n as ColumnMenuConfig } from "./types-CBGaTR2Z.mjs";
|
|
3
2
|
import { ColumnDef } from "@atscript/ui";
|
|
3
|
+
import * as vue from "vue";
|
|
4
4
|
import { ColumnWidthEntry, FilterCondition } from "@atscript/ui-table";
|
|
5
5
|
|
|
6
6
|
//#region src/components/defaults/as-table-header-cell.vue.d.ts
|
|
@@ -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,
|
|
@@ -183,7 +281,7 @@ var as_table_root_default = /* @__PURE__ */ defineComponent({
|
|
|
183
281
|
alwaysSelected: props.alwaysSelected,
|
|
184
282
|
queryFn: props.queryFn,
|
|
185
283
|
queryOnMount: props.queryOnMount,
|
|
186
|
-
blockQuery: props.blockQuery,
|
|
284
|
+
blockQuery: () => props.blockQuery === true,
|
|
187
285
|
blockSize: props.blockSize,
|
|
188
286
|
dragReleaseDebounceMs: props.dragReleaseDebounceMs,
|
|
189
287
|
clientFactory: props.clientFactory,
|
|
@@ -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,
|
|
@@ -183,7 +281,7 @@ var as_table_root_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
183
281
|
alwaysSelected: props.alwaysSelected,
|
|
184
282
|
queryFn: props.queryFn,
|
|
185
283
|
queryOnMount: props.queryOnMount,
|
|
186
|
-
blockQuery: props.blockQuery,
|
|
284
|
+
blockQuery: () => props.blockQuery === true,
|
|
187
285
|
blockSize: props.blockSize,
|
|
188
286
|
dragReleaseDebounceMs: props.dragReleaseDebounceMs,
|
|
189
287
|
clientFactory: props.clientFactory,
|
|
@@ -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;
|