@shwfed/nuxt 0.8.0 → 0.8.2

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.
@@ -1,4 +1,4 @@
1
- import type { Field } from '../fields/Fields.vue.js';
1
+ import { type Field } from '../fields/schema.js';
2
2
  type __VLS_Props = {
3
3
  fields: ReadonlyArray<Field>;
4
4
  };
@@ -69,7 +69,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
69
69
  locale: "zh" | "ja" | "en" | "ko";
70
70
  message: string;
71
71
  }[];
72
- mode: "year" | "month" | "date";
72
+ mode: "date" | "month" | "year";
73
73
  value: string;
74
74
  icon?: string | undefined;
75
75
  style?: string | undefined;
@@ -145,7 +145,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
145
145
  locale: "zh" | "ja" | "en" | "ko";
146
146
  message: string;
147
147
  }[];
148
- mode: "year" | "month" | "date";
148
+ mode: "date" | "month" | "year";
149
149
  value: string;
150
150
  icon?: string | undefined;
151
151
  style?: string | undefined;
@@ -1,6 +1,6 @@
1
1
  import { type CellContext } from '@tanstack/vue-table';
2
2
  import { Effect } from 'effect';
3
- import { type TableConfig } from './schema.js';
3
+ import { type TableConfigInput } from './schema.js';
4
4
  export type { Accessor, Column, Expression, Markdown, Render, TableConfig } from './schema.js';
5
5
  export { AccessorC, ColumnC, RenderC, TableConfigC } from './schema.js';
6
6
  declare module '@tanstack/vue-table' {
@@ -14,7 +14,7 @@ declare module '@tanstack/vue-table' {
14
14
  declare const _default: typeof __VLS_export;
15
15
  export default _default;
16
16
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
17
- config: Effect.Effect<TableConfig>;
17
+ config?: TableConfigInput | Effect.Effect<TableConfigInput | undefined>;
18
18
  data: Array<unknown>;
19
19
  rowCount?: number;
20
20
  }, import("@tanstack/table-core").Table<unknown>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -75,7 +75,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
75
75
  paginationPageSizes?: ReadonlyArray<number>;
76
76
  }>) => any;
77
77
  }, string, import("vue").PublicProps, Readonly<{
78
- config: Effect.Effect<TableConfig>;
78
+ config?: TableConfigInput | Effect.Effect<TableConfigInput | undefined>;
79
79
  data: Array<unknown>;
80
80
  rowCount?: number;
81
81
  }> & Readonly<{
@@ -31,12 +31,19 @@ import { Skeleton } from "../skeleton";
31
31
  import TableConfiguratorDialog from "../table-configurator/TableConfiguratorDialog.vue";
32
32
  import { Tooltip, TooltipContent, TooltipTrigger } from "../tooltip";
33
33
  const props = defineProps({
34
- config: { type: null, required: true },
34
+ config: { type: null, required: false },
35
35
  data: { type: Array, required: true },
36
36
  rowCount: { type: Number, required: false }
37
37
  });
38
38
  const emit = defineEmits(["update:config"]);
39
- const resolvedConfig = computedAsync(async () => TableConfigC.parse(await props.config.pipe(Effect.runPromise)));
39
+ function isTableConfigEffect(value) {
40
+ return typeof value === "object" && value !== null && "pipe" in value && typeof value.pipe === "function";
41
+ }
42
+ async function resolveTableConfig(value) {
43
+ const nextValue = isTableConfigEffect(value) ? await Effect.runPromise(value) : value;
44
+ return TableConfigC.parse(nextValue);
45
+ }
46
+ const resolvedConfig = computedAsync(async () => resolveTableConfig(props.config));
40
47
  const currentConfig = ref();
41
48
  const { t, locale } = useI18n();
42
49
  const slots = defineSlots();
@@ -502,7 +509,7 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
502
509
 
503
510
  <template>
504
511
  <div
505
- class="relative flex h-full flex-col"
512
+ class="relative flex-1 flex flex-col"
506
513
  >
507
514
  <Button
508
515
  v-if="isCheating"
@@ -545,7 +552,10 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
545
552
  >
546
553
  <div :style="{ height: `${rowTotalSize}px` }">
547
554
  <table class="grid">
548
- <thead class="grid sticky top-0 z-10 select-none">
555
+ <thead
556
+ v-if="columns.length > 0"
557
+ class="grid sticky top-0 z-10 select-none"
558
+ >
549
559
  <tr
550
560
  v-for="group in tableApi.getHeaderGroups()"
551
561
  :key="group.id"
@@ -683,6 +693,7 @@ export { AccessorC, ColumnC, RenderC, TableConfigC } from "./schema";
683
693
  </thead>
684
694
 
685
695
  <tbody
696
+ v-if="columns.length > 0"
686
697
  class="grid relative"
687
698
  :style="{ height: `${rowTotalSize}px` }"
688
699
  >
@@ -1,6 +1,6 @@
1
1
  import { type CellContext } from '@tanstack/vue-table';
2
2
  import { Effect } from 'effect';
3
- import { type TableConfig } from './schema.js';
3
+ import { type TableConfigInput } from './schema.js';
4
4
  export type { Accessor, Column, Expression, Markdown, Render, TableConfig } from './schema.js';
5
5
  export { AccessorC, ColumnC, RenderC, TableConfigC } from './schema.js';
6
6
  declare module '@tanstack/vue-table' {
@@ -14,7 +14,7 @@ declare module '@tanstack/vue-table' {
14
14
  declare const _default: typeof __VLS_export;
15
15
  export default _default;
16
16
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
17
- config: Effect.Effect<TableConfig>;
17
+ config?: TableConfigInput | Effect.Effect<TableConfigInput | undefined>;
18
18
  data: Array<unknown>;
19
19
  rowCount?: number;
20
20
  }, import("@tanstack/table-core").Table<unknown>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -75,7 +75,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
75
75
  paginationPageSizes?: ReadonlyArray<number>;
76
76
  }>) => any;
77
77
  }, string, import("vue").PublicProps, Readonly<{
78
- config: Effect.Effect<TableConfig>;
78
+ config?: TableConfigInput | Effect.Effect<TableConfigInput | undefined>;
79
79
  data: Array<unknown>;
80
80
  rowCount?: number;
81
81
  }> & Readonly<{
@@ -72,6 +72,18 @@ export type TableConfig = Readonly<{
72
72
  paginationRight?: Markdown;
73
73
  paginationPageSizes?: ReadonlyArray<number>;
74
74
  }>;
75
+ export type TableConfigInput = Readonly<{
76
+ getRowId?: Expression;
77
+ getSubRows?: Expression;
78
+ enableRowSelection?: Expression;
79
+ enableMultiRowSelection?: Expression;
80
+ columns?: ReadonlyArray<Column>;
81
+ cellStyles?: Expression;
82
+ props?: TableProps;
83
+ paginationLeft?: Markdown;
84
+ paginationRight?: Markdown;
85
+ paginationPageSizes?: ReadonlyArray<number>;
86
+ }>;
75
87
  export declare const TableConfigGetRowIdC: z.ZodOptional<z.ZodString>;
76
88
  export declare const TableConfigGetSubRowsC: z.ZodOptional<z.ZodString>;
77
89
  export declare const TableConfigEnableRowSelectionC: z.ZodOptional<z.ZodString>;
@@ -80,12 +92,12 @@ export declare const TableConfigCellStylesC: z.ZodOptional<z.ZodString>;
80
92
  export declare function normalizePaginationPageSizes(value: ReadonlyArray<number> | undefined): Array<number> | undefined;
81
93
  export declare function resolvePaginationPageSize(pageSize: number | undefined, paginationPageSizes: ReadonlyArray<number> | undefined): number | undefined;
82
94
  export declare const TableConfigPaginationPageSizesC: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>>;
83
- export declare const TableConfigC: z.ZodReadonly<z.ZodObject<{
95
+ export declare const TableConfigC: z.ZodPipe<z.ZodTransform<{} | null, unknown>, z.ZodReadonly<z.ZodObject<{
84
96
  getRowId: z.ZodOptional<z.ZodString>;
85
97
  getSubRows: z.ZodOptional<z.ZodString>;
86
98
  enableRowSelection: z.ZodOptional<z.ZodString>;
87
99
  enableMultiRowSelection: z.ZodOptional<z.ZodString>;
88
- columns: z.ZodReadonly<z.ZodArray<z.ZodType<Readonly<{
100
+ columns: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodType<Readonly<{
89
101
  id?: string;
90
102
  title?: LocaleValue;
91
103
  accessor?: Accessor;
@@ -109,7 +121,7 @@ export declare const TableConfigC: z.ZodReadonly<z.ZodObject<{
109
121
  enablePinning?: boolean;
110
122
  columns?: ReadonlyArray<Column>;
111
123
  grow?: boolean;
112
- }>, unknown>>>>;
124
+ }>, unknown>>>>>;
113
125
  cellStyles: z.ZodOptional<z.ZodString>;
114
126
  props: z.ZodOptional<z.ZodObject<{
115
127
  initialState: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
@@ -146,6 +158,6 @@ export declare const TableConfigC: z.ZodReadonly<z.ZodObject<{
146
158
  paginationLeft: z.ZodOptional<z.ZodString>;
147
159
  paginationRight: z.ZodOptional<z.ZodString>;
148
160
  paginationPageSizes: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>>;
149
- }, z.core.$strip>>;
161
+ }, z.core.$strip>>>;
150
162
  export declare function getColumnTechnicalKey(column: Column): string | undefined;
151
163
  export {};
@@ -119,18 +119,22 @@ export const TableConfigPaginationPageSizesC = z.preprocess(
119
119
  normalizePaginationPageSizesInput,
120
120
  z.array(z.number().int().positive()).readonly().optional()
121
121
  ).describe("\u53EF\u9009\u6BCF\u9875\u6761\u6570\u5217\u8868\u3002\u4F1A\u81EA\u52A8\u53BB\u91CD\u3001\u8FC7\u6EE4\u975E\u6B63\u6574\u6570\uFF0C\u5E76\u4FDD\u7559\u6700\u7EC8\u987A\u5E8F\u3002");
122
- export const TableConfigC = z.object({
122
+ const TableConfigObjectC = z.object({
123
123
  getRowId: TableConfigGetRowIdC,
124
124
  getSubRows: TableConfigGetSubRowsC,
125
125
  enableRowSelection: TableConfigEnableRowSelectionC,
126
126
  enableMultiRowSelection: TableConfigEnableMultiRowSelectionC,
127
- columns: z.array(ColumnC).readonly().describe("\u8868\u683C\u5217\u5B9A\u4E49\u5217\u8868\u3002"),
127
+ columns: z.array(ColumnC).readonly().default([]).describe("\u8868\u683C\u5217\u5B9A\u4E49\u5217\u8868\u3002"),
128
128
  cellStyles: TableConfigCellStylesC,
129
129
  props: TablePropsC,
130
130
  paginationLeft: z.string().optional().describe("\u5206\u9875\u533A\u57DF\u5DE6\u4FA7\u7684 Markdown \u6587\u6848\u3002"),
131
131
  paginationRight: z.string().optional().describe("\u5206\u9875\u533A\u57DF\u53F3\u4FA7\u7684 Markdown \u6587\u6848\u3002"),
132
132
  paginationPageSizes: TableConfigPaginationPageSizesC
133
- }).readonly().describe("\u8868\u683C\u7EC4\u4EF6\u914D\u7F6E\u3002\u7528\u4E8E\u63CF\u8FF0\u5217\u7ED3\u6784\u3001\u4EA4\u4E92\u80FD\u529B\u3001\u5206\u9875\u6587\u6848\u548C\u521D\u59CB\u72B6\u6001\u3002");
133
+ }).readonly();
134
+ export const TableConfigC = z.preprocess(
135
+ (value) => value === void 0 ? {} : value,
136
+ TableConfigObjectC
137
+ ).describe("\u8868\u683C\u7EC4\u4EF6\u914D\u7F6E\u3002\u7528\u4E8E\u63CF\u8FF0\u5217\u7ED3\u6784\u3001\u4EA4\u4E92\u80FD\u529B\u3001\u5206\u9875\u6587\u6848\u548C\u521D\u59CB\u72B6\u6001\u3002");
134
138
  export function getColumnTechnicalKey(column) {
135
139
  if (typeof column.accessor === "string") {
136
140
  return column.accessor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",