@shwfed/nuxt 0.7.10 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +2 -1
  3. package/dist/runtime/components/table.d.vue.ts +68 -2
  4. package/dist/runtime/components/table.vue +0 -1
  5. package/dist/runtime/components/table.vue.d.ts +68 -2
  6. package/dist/runtime/components/ui/dropdown-menu/DropdownMenuItem.vue +1 -1
  7. package/dist/runtime/components/ui/field/FieldLabel.vue +1 -1
  8. package/dist/runtime/components/ui/fields/Fields.vue +14 -6
  9. package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue +28 -14
  10. package/dist/runtime/components/ui/icon-picker/IconPicker.d.vue.ts +15 -0
  11. package/dist/runtime/components/ui/icon-picker/IconPicker.vue +178 -0
  12. package/dist/runtime/components/ui/icon-picker/IconPicker.vue.d.ts +15 -0
  13. package/dist/runtime/components/ui/icon-picker/index.d.ts +1 -0
  14. package/dist/runtime/components/ui/icon-picker/index.js +1 -0
  15. package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue +1 -1
  16. package/dist/runtime/components/ui/input-group/InputGroupInput.vue +1 -1
  17. package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue +1 -1
  18. package/dist/runtime/components/ui/input-group/InputGroupTextarea.vue +1 -1
  19. package/dist/runtime/components/ui/native-select/NativeSelect.d.vue.ts +2 -2
  20. package/dist/runtime/components/ui/native-select/NativeSelect.vue +1 -1
  21. package/dist/runtime/components/ui/native-select/NativeSelect.vue.d.ts +2 -2
  22. package/dist/runtime/components/ui/switch/Switch.vue +2 -2
  23. package/dist/runtime/components/ui/table/Table.d.vue.ts +69 -3
  24. package/dist/runtime/components/ui/table/Table.vue +201 -41
  25. package/dist/runtime/components/ui/table/Table.vue.d.ts +69 -3
  26. package/dist/runtime/components/ui/table/schema.d.ts +107 -4
  27. package/dist/runtime/components/ui/table/schema.js +106 -90
  28. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.d.vue.ts +68 -2
  29. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue +732 -257
  30. package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue.d.ts +68 -2
  31. package/dist/runtime/components/ui/textarea/Textarea.vue +1 -1
  32. package/dist/runtime/layouts/default.d.vue.ts +40 -0
  33. package/dist/runtime/layouts/default.vue +19 -0
  34. package/dist/runtime/layouts/default.vue.d.ts +40 -0
  35. package/dist/runtime/plugins/toast/index.d.ts +2 -2
  36. package/dist/runtime/table-renderers/builtins.js +151 -75
  37. package/dist/runtime/table-renderers/registry.d.ts +1 -1
  38. package/dist/runtime/utils/coders.d.ts +2 -0
  39. package/dist/runtime/utils/coders.js +13 -0
  40. package/package.json +6 -6
@@ -10,7 +10,7 @@ const props = defineProps({
10
10
  <Textarea
11
11
  data-slot="input-group-control"
12
12
  :class="cn(
13
- 'flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none dark:bg-transparent',
13
+ 'flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none',
14
14
  props.class
15
15
  )"
16
16
  />
@@ -9,9 +9,9 @@ type __VLS_Slots = {} & {
9
9
  default?: (props: typeof __VLS_1) => any;
10
10
  };
11
11
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
- "update:modelValue": () => any;
12
+ "update:modelValue": (args_0: AcceptableValue) => any;
13
13
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
14
- "onUpdate:modelValue"?: (() => any) | undefined;
14
+ "onUpdate:modelValue"?: ((args_0: AcceptableValue) => any) | undefined;
15
15
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
16
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
17
17
  declare const _default: typeof __VLS_export;
@@ -27,7 +27,7 @@ const delegatedProps = reactiveOmit(props, "class");
27
27
  v-model="modelValue"
28
28
  data-slot="native-select"
29
29
  :class="cn(
30
- 'border-zinc-200 placeholder:text-zinc-400 selection:bg-primary selection:text-primary-foreground dark:bg-zinc-200/30 dark:hover:bg-zinc-200/50 h-9 w-full min-w-0 appearance-none rounded-md border bg-transparent px-3 py-2 pr-9 text-sm shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed',
30
+ 'border-zinc-200 placeholder:text-zinc-400 selection:bg-primary selection:text-primary-foreground h-9 w-full min-w-0 appearance-none rounded-md border bg-transparent px-3 py-2 pr-9 text-sm shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed',
31
31
  'focus-visible:border-(--primary)',
32
32
  'aria-invalid:border-red-400',
33
33
  props.class
@@ -9,9 +9,9 @@ type __VLS_Slots = {} & {
9
9
  default?: (props: typeof __VLS_1) => any;
10
10
  };
11
11
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
- "update:modelValue": () => any;
12
+ "update:modelValue": (args_0: AcceptableValue) => any;
13
13
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
14
- "onUpdate:modelValue"?: (() => any) | undefined;
14
+ "onUpdate:modelValue"?: ((args_0: AcceptableValue) => any) | undefined;
15
15
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
16
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
17
17
  declare const _default: typeof __VLS_export;
@@ -29,13 +29,13 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
29
29
  data-slot="switch"
30
30
  v-bind="forwarded"
31
31
  :class="cn(
32
- 'peer data-[state=checked]:bg-(--primary) data-[state=unchecked]:bg-zinc-200 focus-visible:border-(--primary) dark:data-[state=unchecked]:bg-zinc-200/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none disabled:cursor-not-allowed disabled:opacity-50',
32
+ 'peer data-[state=checked]:bg-(--primary) data-[state=unchecked]:bg-zinc-200 focus-visible:border-(--primary) inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none disabled:cursor-not-allowed disabled:opacity-50',
33
33
  props.class
34
34
  )"
35
35
  >
36
36
  <SwitchThumb
37
37
  data-slot="switch-thumb"
38
- :class="cn('bg-zinc-50 dark:data-[state=unchecked]:bg-zinc-800 dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0')"
38
+ :class="cn('bg-zinc-50 pointer-events-none block size-4 rounded-full transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0')"
39
39
  >
40
40
  <slot
41
41
  name="thumb"
@@ -1,4 +1,4 @@
1
- import { type CellContext, type TableOptions } from '@tanstack/vue-table';
1
+ import { type CellContext } from '@tanstack/vue-table';
2
2
  import { Effect } from 'effect';
3
3
  import { type TableConfig } from './schema.js';
4
4
  export type { Accessor, Column, Expression, Markdown, Render, TableConfig } from './schema.js';
@@ -37,9 +37,42 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
37
37
  grow?: boolean;
38
38
  }>[];
39
39
  cellStyles?: import("./schema.js").Expression;
40
- props?: Omit<TableOptions<unknown>, "columns" | "data" | "getRowId" | "getCoreRowModel">;
40
+ props?: Readonly<{
41
+ [key: string]: unknown;
42
+ initialState?: Readonly<{
43
+ columnVisibility?: Record<string, boolean>;
44
+ columnOrder?: ReadonlyArray<string>;
45
+ columnPinning?: Readonly<{
46
+ left?: ReadonlyArray<string>;
47
+ right?: ReadonlyArray<string>;
48
+ }>;
49
+ rowPinning?: Readonly<{
50
+ top?: ReadonlyArray<string>;
51
+ bottom?: ReadonlyArray<string>;
52
+ }>;
53
+ columnFilters?: ReadonlyArray<Readonly<{
54
+ id: string;
55
+ value: unknown;
56
+ }>>;
57
+ globalFilter?: unknown;
58
+ sorting?: ReadonlyArray<Readonly<{
59
+ id: string;
60
+ desc: boolean;
61
+ }>>;
62
+ expanded?: boolean | Record<string, boolean>;
63
+ grouping?: ReadonlyArray<string>;
64
+ columnSizing?: Record<string, number>;
65
+ columnSizingInfo?: Record<string, unknown>;
66
+ pagination?: Readonly<{
67
+ pageIndex?: number;
68
+ pageSize?: number;
69
+ }>;
70
+ rowSelection?: Record<string, boolean>;
71
+ }>;
72
+ }>;
41
73
  paginationLeft?: import("./schema.js").Markdown;
42
74
  paginationRight?: import("./schema.js").Markdown;
75
+ paginationPageSizes?: ReadonlyArray<number>;
43
76
  }>) => any;
44
77
  }, string, import("vue").PublicProps, Readonly<{
45
78
  config: Effect.Effect<TableConfig>;
@@ -65,9 +98,42 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
65
98
  grow?: boolean;
66
99
  }>[];
67
100
  cellStyles?: import("./schema.js").Expression;
68
- props?: Omit<TableOptions<unknown>, "columns" | "data" | "getRowId" | "getCoreRowModel">;
101
+ props?: Readonly<{
102
+ [key: string]: unknown;
103
+ initialState?: Readonly<{
104
+ columnVisibility?: Record<string, boolean>;
105
+ columnOrder?: ReadonlyArray<string>;
106
+ columnPinning?: Readonly<{
107
+ left?: ReadonlyArray<string>;
108
+ right?: ReadonlyArray<string>;
109
+ }>;
110
+ rowPinning?: Readonly<{
111
+ top?: ReadonlyArray<string>;
112
+ bottom?: ReadonlyArray<string>;
113
+ }>;
114
+ columnFilters?: ReadonlyArray<Readonly<{
115
+ id: string;
116
+ value: unknown;
117
+ }>>;
118
+ globalFilter?: unknown;
119
+ sorting?: ReadonlyArray<Readonly<{
120
+ id: string;
121
+ desc: boolean;
122
+ }>>;
123
+ expanded?: boolean | Record<string, boolean>;
124
+ grouping?: ReadonlyArray<string>;
125
+ columnSizing?: Record<string, number>;
126
+ columnSizingInfo?: Record<string, unknown>;
127
+ pagination?: Readonly<{
128
+ pageIndex?: number;
129
+ pageSize?: number;
130
+ }>;
131
+ rowSelection?: Record<string, boolean>;
132
+ }>;
133
+ }>;
69
134
  paginationLeft?: import("./schema.js").Markdown;
70
135
  paginationRight?: import("./schema.js").Markdown;
136
+ paginationPageSizes?: ReadonlyArray<number>;
71
137
  }>) => any) | undefined;
72
138
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
73
139
  [key: string]: (props: Readonly<{
@@ -7,6 +7,7 @@ import {
7
7
  getCoreRowModel,
8
8
  getExpandedRowModel,
9
9
  getPaginationRowModel,
10
+ getSortedRowModel,
10
11
  useVueTable
11
12
  } from "@tanstack/vue-table";
12
13
  import { useVirtualizer } from "@tanstack/vue-virtual";
@@ -14,11 +15,17 @@ import { computedAsync } from "@vueuse/core";
14
15
  import { getProperty } from "dot-prop";
15
16
  import { Effect } from "effect";
16
17
  import { Pagination } from "reka-ui/namespaced";
17
- import { computed, ref, watchEffect } from "vue";
18
+ import { computed, ref, watch } from "vue";
18
19
  import { useI18n } from "vue-i18n";
19
20
  import { useTableRenderers } from "../../../composables/useTableRenderers";
20
- import { getLocalizedText, TableConfigC } from "./schema";
21
+ import { getLocalizedText } from "../../../utils/coders";
22
+ import {
23
+ normalizePaginationPageSizes,
24
+ resolvePaginationPageSize,
25
+ TableConfigC
26
+ } from "./schema";
21
27
  import { Button } from "../button";
28
+ import { NativeSelect, NativeSelectOption } from "../native-select";
22
29
  import { NumberField, NumberFieldInput } from "../number-field";
23
30
  import { Skeleton } from "../skeleton";
24
31
  import TableConfiguratorDialog from "../table-configurator/TableConfiguratorDialog.vue";
@@ -30,13 +37,19 @@ const props = defineProps({
30
37
  });
31
38
  const emit = defineEmits(["update:config"]);
32
39
  const resolvedConfig = computedAsync(async () => TableConfigC.parse(await props.config.pipe(Effect.runPromise)));
40
+ const currentConfig = ref();
33
41
  const { t, locale } = useI18n();
34
42
  const slots = defineSlots();
35
43
  const { $dsl } = useNuxtApp();
36
44
  const isCheating = useCheating();
37
45
  const { resolveTableRenderer } = useTableRenderers();
38
46
  const containerRef = ref(null);
39
- const appliedInitialStateConfig = ref();
47
+ const appliedInitialStateKey = ref("");
48
+ watch(resolvedConfig, (config) => {
49
+ if (config !== void 0) {
50
+ currentConfig.value = config;
51
+ }
52
+ }, { immediate: true });
40
53
  function genColumnId(column) {
41
54
  if (typeof column.accessor === "string") {
42
55
  return column.accessor;
@@ -112,18 +125,37 @@ function translate(column) {
112
125
  ...renderer.columnDefOverrides
113
126
  };
114
127
  }
115
- const columns = computed(() => resolvedConfig.value?.columns.map((column) => translate(column)) ?? []);
128
+ const columns = computed(() => currentConfig.value?.columns.map((column) => translate(column)) ?? []);
116
129
  const data = computed(() => props.data);
117
130
  const isManualPagination = computed(() => props.rowCount !== void 0);
118
131
  const totalItems = computed(() => props.rowCount ?? data.value.length);
119
- const paginationLeft = computed(() => resolvedConfig.value?.paginationLeft ?? "");
120
- const paginationRight = computed(() => resolvedConfig.value?.paginationRight ?? "");
132
+ const paginationLeft = computed(() => currentConfig.value?.paginationLeft ?? "");
133
+ const paginationRight = computed(() => currentConfig.value?.paginationRight ?? "");
134
+ const resolvedPaginationPageSizes = computed(() => normalizePaginationPageSizes(currentConfig.value?.paginationPageSizes));
121
135
  const isConfiguratorOpen = ref(false);
122
136
  function handleConfiguratorConfirm(nextConfig) {
137
+ currentConfig.value = nextConfig;
123
138
  emit("update:config", nextConfig);
124
139
  }
140
+ function handlePaginationPageSizeChange(value) {
141
+ const nextPageSize = Number(value);
142
+ if (!Number.isInteger(nextPageSize) || nextPageSize <= 0) {
143
+ return;
144
+ }
145
+ tableApi.setPageSize(nextPageSize);
146
+ }
147
+ function syncPaginationPageSize() {
148
+ const nextPageSize = resolvePaginationPageSize(
149
+ tableApi.getState().pagination.pageSize,
150
+ resolvedPaginationPageSizes.value
151
+ );
152
+ if (nextPageSize === void 0 || nextPageSize === tableApi.getState().pagination.pageSize) {
153
+ return;
154
+ }
155
+ tableApi.setPageSize(nextPageSize);
156
+ }
125
157
  function getRowId(originalRow, index, parent) {
126
- const expression = resolvedConfig.value?.getRowId;
158
+ const expression = currentConfig.value?.getRowId;
127
159
  if (!expression) {
128
160
  return parent ? `${parent.index}.${index}` : `${index}`;
129
161
  }
@@ -148,7 +180,7 @@ function getRowId(originalRow, index, parent) {
148
180
  return parent ? `${parent.index}.${index}` : `${index}`;
149
181
  }
150
182
  function getSubRows(row, index) {
151
- const expression = resolvedConfig.value?.getSubRows;
183
+ const expression = currentConfig.value?.getSubRows;
152
184
  if (!expression) {
153
185
  return void 0;
154
186
  }
@@ -164,7 +196,7 @@ function getSubRows(row, index) {
164
196
  }
165
197
  }
166
198
  function enableRowSelection(row) {
167
- const expression = resolvedConfig.value?.enableRowSelection;
199
+ const expression = currentConfig.value?.enableRowSelection;
168
200
  if (!expression) {
169
201
  return true;
170
202
  }
@@ -180,7 +212,7 @@ function enableRowSelection(row) {
180
212
  }
181
213
  }
182
214
  function enableMultiRowSelection(row) {
183
- const expression = resolvedConfig.value?.enableMultiRowSelection;
215
+ const expression = currentConfig.value?.enableMultiRowSelection;
184
216
  if (!expression) {
185
217
  return true;
186
218
  }
@@ -204,6 +236,7 @@ const baseTableOptions = {
204
236
  getCoreRowModel: getCoreRowModel(),
205
237
  getExpandedRowModel: getExpandedRowModel(),
206
238
  getPaginationRowModel: getPaginationRowModel(),
239
+ getSortedRowModel: getSortedRowModel(),
207
240
  get manualPagination() {
208
241
  return isManualPagination.value;
209
242
  },
@@ -211,17 +244,17 @@ const baseTableOptions = {
211
244
  return props.rowCount;
212
245
  },
213
246
  get getRowId() {
214
- return resolvedConfig.value?.getRowId ? getRowId : void 0;
247
+ return currentConfig.value?.getRowId ? getRowId : void 0;
215
248
  },
216
249
  getSubRows,
217
250
  enableRowSelection,
218
251
  get enableMultiRowSelection() {
219
- return resolvedConfig.value?.enableMultiRowSelection ? enableMultiRowSelection : void 0;
252
+ return currentConfig.value?.enableMultiRowSelection ? enableMultiRowSelection : void 0;
220
253
  },
221
254
  columnResizeMode
222
255
  };
223
256
  function getConfigOption(property) {
224
- const configOptions = resolvedConfig.value?.props;
257
+ const configOptions = currentConfig.value?.props;
225
258
  if (!configOptions) {
226
259
  return void 0;
227
260
  }
@@ -236,19 +269,19 @@ const tableOptions = new Proxy(baseTableOptions, {
236
269
  return getConfigOption(property);
237
270
  },
238
271
  has(target, property) {
239
- const configOptions = resolvedConfig.value?.props;
272
+ const configOptions = currentConfig.value?.props;
240
273
  return Reflect.has(target, property) || (configOptions ? Reflect.has(configOptions, property) : false);
241
274
  },
242
275
  ownKeys(target) {
243
276
  const keys = [...Reflect.ownKeys(target)];
244
- const configOptions = resolvedConfig.value?.props;
277
+ const configOptions = currentConfig.value?.props;
245
278
  if (configOptions) {
246
279
  keys.push(...Reflect.ownKeys(configOptions));
247
280
  }
248
281
  return Array.from(new Set(keys));
249
282
  },
250
283
  getOwnPropertyDescriptor(target, property) {
251
- const configOptions = resolvedConfig.value?.props;
284
+ const configOptions = currentConfig.value?.props;
252
285
  if (!Reflect.has(target, property) && !(configOptions && Reflect.has(configOptions, property))) {
253
286
  return void 0;
254
287
  }
@@ -266,18 +299,22 @@ const tableOptions = new Proxy(baseTableOptions, {
266
299
  }
267
300
  });
268
301
  const tableApi = useVueTable(tableOptions);
269
- watchEffect(() => {
270
- const config = resolvedConfig.value;
271
- if (!config || appliedInitialStateConfig.value === config) {
302
+ watch(currentConfig, (config) => {
303
+ if (!config) {
272
304
  return;
273
305
  }
274
306
  const initialState = config.props?.initialState;
275
- if (initialState) {
276
- tableApi.initialState = mergeInitialState(tableApi.initialState, initialState);
277
- tableApi.reset();
307
+ const nextInitialStateKey = initialState ? JSON.stringify(initialState) : "";
308
+ if (appliedInitialStateKey.value === nextInitialStateKey || !initialState) {
309
+ appliedInitialStateKey.value = nextInitialStateKey;
310
+ syncPaginationPageSize();
311
+ return;
278
312
  }
279
- appliedInitialStateConfig.value = config;
280
- });
313
+ tableApi.initialState = mergeInitialState(tableApi.initialState, initialState);
314
+ tableApi.reset();
315
+ appliedInitialStateKey.value = nextInitialStateKey;
316
+ syncPaginationPageSize();
317
+ }, { immediate: true });
281
318
  defineExpose(tableApi);
282
319
  const rowVirtualizer = useVirtualizer(
283
320
  computed(() => ({
@@ -300,7 +337,7 @@ function isStyleRecord(x) {
300
337
  return typeof x === "object" && x !== null && !Array.isArray(x);
301
338
  }
302
339
  function getCellStyles(ctx) {
303
- const expression = resolvedConfig.value?.cellStyles;
340
+ const expression = currentConfig.value?.cellStyles;
304
341
  if (!expression)
305
342
  return {};
306
343
  try {
@@ -350,6 +387,14 @@ function pinnedStyle(column) {
350
387
  style.boxShadow = "-5px 5px 5px #00000005";
351
388
  return style;
352
389
  }
390
+ function shouldShowResizeHandle(column) {
391
+ const lastVisibleLeafColumn = tableApi.getVisibleLeafColumns().at(-1);
392
+ if (!lastVisibleLeafColumn) {
393
+ return false;
394
+ }
395
+ const lastLeafColumn = column.getLeafColumns().at(-1);
396
+ return lastLeafColumn?.id !== lastVisibleLeafColumn.id;
397
+ }
353
398
  const SORT_ICONS = {
354
399
  unsorted: "fluent:arrow-sort-16-regular",
355
400
  asc: "fluent:arrow-sort-up-16-regular",
@@ -360,20 +405,75 @@ function getSortIcon(column) {
360
405
  const iconKey = sortDir === false ? "unsorted" : sortDir;
361
406
  return SORT_ICONS[iconKey];
362
407
  }
408
+ function cloneItems(items) {
409
+ return items ? [...items] : void 0;
410
+ }
411
+ function isNullableNumber(value) {
412
+ return typeof value === "number" || value === null;
413
+ }
414
+ function normalizeExpandedState(expanded, current) {
415
+ if (expanded === void 0) {
416
+ return current;
417
+ }
418
+ if (expanded === true) {
419
+ return true;
420
+ }
421
+ if (expanded === false) {
422
+ return {};
423
+ }
424
+ return expanded;
425
+ }
426
+ function mergeColumnSizingInfo(current, next) {
427
+ if (!next) {
428
+ return current;
429
+ }
430
+ const merged = {
431
+ ...current
432
+ };
433
+ if (Array.isArray(next.columnSizingStart)) {
434
+ merged.columnSizingStart = next.columnSizingStart;
435
+ }
436
+ if (isNullableNumber(next.deltaOffset)) {
437
+ merged.deltaOffset = next.deltaOffset;
438
+ }
439
+ if (isNullableNumber(next.deltaPercentage)) {
440
+ merged.deltaPercentage = next.deltaPercentage;
441
+ }
442
+ if (next.isResizingColumn === false || typeof next.isResizingColumn === "string") {
443
+ merged.isResizingColumn = next.isResizingColumn;
444
+ }
445
+ if (isNullableNumber(next.startOffset)) {
446
+ merged.startOffset = next.startOffset;
447
+ }
448
+ if (isNullableNumber(next.startSize)) {
449
+ merged.startSize = next.startSize;
450
+ }
451
+ return merged;
452
+ }
363
453
  function mergeInitialState(current, initialState) {
364
454
  return {
365
455
  ...current,
366
456
  columnVisibility: initialState.columnVisibility ?? current.columnVisibility,
367
- columnOrder: initialState.columnOrder ?? current.columnOrder,
368
- columnPinning: initialState.columnPinning ? { ...current.columnPinning, ...initialState.columnPinning } : current.columnPinning,
369
- rowPinning: initialState.rowPinning ? { ...current.rowPinning, ...initialState.rowPinning } : current.rowPinning,
370
- columnFilters: initialState.columnFilters ?? current.columnFilters,
457
+ columnOrder: cloneItems(initialState.columnOrder) ?? current.columnOrder,
458
+ columnPinning: initialState.columnPinning ? {
459
+ ...current.columnPinning,
460
+ ...initialState.columnPinning,
461
+ left: cloneItems(initialState.columnPinning.left) ?? current.columnPinning.left,
462
+ right: cloneItems(initialState.columnPinning.right) ?? current.columnPinning.right
463
+ } : current.columnPinning,
464
+ rowPinning: initialState.rowPinning ? {
465
+ ...current.rowPinning,
466
+ ...initialState.rowPinning,
467
+ top: cloneItems(initialState.rowPinning.top) ?? current.rowPinning.top,
468
+ bottom: cloneItems(initialState.rowPinning.bottom) ?? current.rowPinning.bottom
469
+ } : current.rowPinning,
470
+ columnFilters: cloneItems(initialState.columnFilters) ?? current.columnFilters,
371
471
  globalFilter: initialState.globalFilter ?? current.globalFilter,
372
- sorting: initialState.sorting ?? current.sorting,
373
- expanded: initialState.expanded ?? current.expanded,
374
- grouping: initialState.grouping ?? current.grouping,
472
+ sorting: cloneItems(initialState.sorting) ?? current.sorting,
473
+ expanded: normalizeExpandedState(initialState.expanded, current.expanded),
474
+ grouping: cloneItems(initialState.grouping) ?? current.grouping,
375
475
  columnSizing: initialState.columnSizing ?? current.columnSizing,
376
- columnSizingInfo: initialState.columnSizingInfo ?? current.columnSizingInfo,
476
+ columnSizingInfo: mergeColumnSizingInfo(current.columnSizingInfo, initialState.columnSizingInfo),
377
477
  pagination: initialState.pagination ? { ...current.pagination, ...initialState.pagination } : current.pagination,
378
478
  rowSelection: initialState.rowSelection ?? current.rowSelection
379
479
  };
@@ -388,6 +488,12 @@ function getSortLabel(column) {
388
488
  }
389
489
  return t("table-sort-unsorted");
390
490
  }
491
+ function getColumnTooltipLabel(column) {
492
+ return t("table-column-tooltip", { column: column.id });
493
+ }
494
+ function getAccessorTooltipLabel(column) {
495
+ return t("table-column-accessor", { column: column.id });
496
+ }
391
497
  </script>
392
498
 
393
499
  <script>
@@ -403,6 +509,8 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
403
509
  data-slot="table-configurator-trigger"
404
510
  variant="ghost"
405
511
  size="sm"
512
+ :aria-label="t('table-open-configurator')"
513
+ :title="t('table-open-configurator')"
406
514
  type="button"
407
515
  class="absolute right-3 top-3 z-20 bg-white/90 shadow-xs backdrop-blur-sm hover:bg-white"
408
516
  @click="isConfiguratorOpen = true"
@@ -411,9 +519,9 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
411
519
  </Button>
412
520
 
413
521
  <TableConfiguratorDialog
414
- v-if="resolvedConfig"
522
+ v-if="currentConfig"
415
523
  v-model:open="isConfiguratorOpen"
416
- :config="resolvedConfig"
524
+ :config="currentConfig"
417
525
  @confirm="handleConfiguratorConfirm"
418
526
  />
419
527
 
@@ -421,14 +529,14 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
421
529
  class="relative flex min-h-0 flex-1 flex-col"
422
530
  >
423
531
  <Skeleton
424
- v-if="resolvedConfig === void 0"
532
+ v-if="currentConfig === void 0"
425
533
  class="absolute inset-0 z-10 w-full h-full"
426
534
  />
427
535
 
428
536
  <div
429
537
  :class="[
430
538
  'flex min-h-0 flex-1 flex-col',
431
- resolvedConfig === void 0 && 'opacity-0'
539
+ currentConfig === void 0 && 'opacity-0'
432
540
  ]"
433
541
  >
434
542
  <div
@@ -472,7 +580,16 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
472
580
  :delay-duration="180"
473
581
  >
474
582
  <TooltipTrigger as-child>
475
- <Icon icon="fluent:info-20-regular" />
583
+ <button
584
+ type="button"
585
+ data-slot="table-column-tooltip-trigger"
586
+ :aria-label="getColumnTooltipLabel(header.column)"
587
+ class="inline-flex items-center justify-center text-zinc-500"
588
+ >
589
+ <Icon
590
+ icon="fluent:info-20-regular"
591
+ />
592
+ </button>
476
593
  </TooltipTrigger>
477
594
  <TooltipContent
478
595
  align="center"
@@ -487,7 +604,16 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
487
604
  :delay-duration="180"
488
605
  >
489
606
  <TooltipTrigger as-child>
490
- <Icon icon="fluent:code-20-regular" />
607
+ <button
608
+ type="button"
609
+ data-slot="table-column-accessor-trigger"
610
+ :aria-label="getAccessorTooltipLabel(header.column)"
611
+ class="inline-flex items-center justify-center text-zinc-500"
612
+ >
613
+ <Icon
614
+ icon="fluent:code-20-regular"
615
+ />
616
+ </button>
491
617
  </TooltipTrigger>
492
618
  <TooltipContent
493
619
  align="center"
@@ -518,6 +644,7 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
518
644
  >
519
645
  <button
520
646
  type="button"
647
+ :aria-label="getSortLabel(header.column)"
521
648
  @click="header.column.getToggleSortingHandler()?.($event)"
522
649
  >
523
650
  <Icon :icon="getSortIcon(header.column)" />
@@ -530,7 +657,7 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
530
657
  </Tooltip>
531
658
 
532
659
  <div
533
- v-if="!header.isPlaceholder && header.column.getCanResize() && (!header.column.getIsLastColumn('right') || !tableApi.getIsSomeColumnsPinned('right') && !header.column.getIsLastColumn('center'))"
660
+ v-if="!header.isPlaceholder && header.column.getCanResize() && shouldShowResizeHandle(header.column)"
534
661
  :class="[
535
662
  'group',
536
663
  'absolute',
@@ -650,6 +777,27 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
650
777
  <strong>{{ totalItems }}</strong>
651
778
  </template>
652
779
  </i18n-t>
780
+ <label
781
+ v-if="resolvedPaginationPageSizes"
782
+ data-slot="table-pagination-page-size"
783
+ class="flex items-center gap-2 text-xs text-zinc-500"
784
+ >
785
+ <NativeSelect
786
+ data-slot="table-pagination-page-size-select"
787
+ :model-value="tableApi.getState().pagination.pageSize"
788
+ :aria-label="t('pagination-page-size')"
789
+ class="h-7 min-w-20 rounded-sm px-2 py-1 pr-7 text-xs text-zinc-600"
790
+ @update:model-value="handlePaginationPageSizeChange"
791
+ >
792
+ <NativeSelectOption
793
+ v-for="pageSize in resolvedPaginationPageSizes"
794
+ :key="pageSize"
795
+ :value="pageSize"
796
+ >
797
+ {{ pageSize }}
798
+ </NativeSelectOption>
799
+ </NativeSelect>
800
+ </label>
653
801
  <Pagination.Root
654
802
  show-edges
655
803
  :total="totalItems"
@@ -749,7 +897,7 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
749
897
  </div>
750
898
  <div
751
899
  :class="[
752
- 'relative p-1 flex-1 prose prose-zinc text-xs'
900
+ 'relative p-1 flex-1 prose prose-zinc text-xs text-right'
753
901
  ]"
754
902
  >
755
903
  <span
@@ -769,21 +917,33 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
769
917
  {
770
918
  "zh": {
771
919
  "total": "共 {count} 条",
920
+ "pagination-page-size": "每页条数",
772
921
  "goto": "前往 {page} 页",
922
+ "table-open-configurator": "打开表格配置",
923
+ "table-column-tooltip": "查看列提示:{column}",
924
+ "table-column-accessor": "查看列取值器:{column}",
773
925
  "table-sort-asc": "升序",
774
926
  "table-sort-desc": "降序",
775
927
  "table-sort-unsorted": "未排序"
776
928
  },
777
929
  "ja": {
778
930
  "total": "合計 {count} 件",
931
+ "pagination-page-size": "1ページあたりの件数",
779
932
  "goto": "ページ {page} に移動",
933
+ "table-open-configurator": "テーブル設定を開く",
934
+ "table-column-tooltip": "列ツールチップを表示: {column}",
935
+ "table-column-accessor": "列アクセサを表示: {column}",
780
936
  "table-sort-asc": "昇順",
781
937
  "table-sort-desc": "降順",
782
938
  "table-sort-unsorted": "未排序"
783
939
  },
784
940
  "en": {
785
941
  "total": "Total {count} items",
942
+ "pagination-page-size": "Page size",
786
943
  "goto": "Go to page {page}",
944
+ "table-open-configurator": "Open table configurator",
945
+ "table-column-tooltip": "Show column tooltip: {column}",
946
+ "table-column-accessor": "Show column accessor: {column}",
787
947
  "table-sort-asc": "Ascending",
788
948
  "table-sort-desc": "Descending",
789
949
  "table-sort-unsorted": "Unsorted"