@vrojs/element-plus 0.0.19 → 0.0.20

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/index.js CHANGED
@@ -3,7 +3,7 @@ import { default as m } from "./locale/lang/zh-cn.js";
3
3
  import { useLocale as t } from "./locale/useLocale.js";
4
4
  import { datePickerValueFormat as f } from "./utils/datePickerValueFormat.js";
5
5
  import { elTableColumnProps as E } from "./utils/elTableColumnProps.js";
6
- import { parseType as i } from "@vrojs/base";
6
+ import { parseType as n } from "@vrojs/base";
7
7
  import { VroElCheckboxGroup as V } from "./vro-el-checkbox-group/index.js";
8
8
  import { VroElConfigProvider as g } from "./vro-el-config-provider/index.js";
9
9
  import { VroElFileUpload as v } from "./vro-el-file-upload/index.js";
@@ -28,7 +28,7 @@ import { vroElCheckboxGroupProps as oo } from "./vro-el-checkbox-group/types.js"
28
28
  import { provideVroElConfig as eo, setVroElGlobalConfig as lo, useVroElConfig as mo, useVroElGlobalConfig as po, vroElConfigContextKey as to } from "./vro-el-config-provider/config.js";
29
29
  import { vroElConfigProviderProps as fo } from "./vro-el-config-provider/types.js";
30
30
  import { vroElFileUploadProps as Eo } from "./vro-el-file-upload/types.js";
31
- import { getVroElFileUploadOptions as io, setVroElFileUploadOptions as no } from "./vro-el-file-upload/utils.js";
31
+ import { getVroElFileUploadOptions as no, setVroElFileUploadOptions as io } from "./vro-el-file-upload/utils.js";
32
32
  import { vroElIconProps as co } from "./vro-el-icon/types.js";
33
33
  import { vroElImageProps as uo } from "./vro-el-image/types.js";
34
34
  import { getVroElImageOptions as Fo, setVroElImageOptions as ho } from "./vro-el-image/utils.js";
@@ -52,15 +52,16 @@ import { useVroElSchemaFormDrawer as mr } from "./vro-el-schema-form-drawer/useV
52
52
  import { vroElSelectProps as tr } from "./vro-el-select/types.js";
53
53
  import { vroElSkeletonProps as fr } from "./vro-el-skeleton/types.js";
54
54
  import { vroElTableProps as Er } from "./vro-el-table/types.js";
55
- import { useVroElTable as ir } from "./vro-el-table/useVroElTable.js";
55
+ import { useVroElTable as nr } from "./vro-el-table/useVroElTable.js";
56
56
  import { vroElTableActionsColumnProps as Vr } from "./vro-el-table-actions-column/types.js";
57
57
  import { vroElTableColumnProps as gr } from "./vro-el-table-column/types.js";
58
- import { vroElTableColumnGroupProps as vr } from "./vro-el-table-column-group/types.js";
59
- import { useVroElTableColumnGroup as hr } from "./vro-el-table-column-group/useVroElTableColumnGroup.js";
60
- import { vroElTableColumnGroupColumnManager as Pr } from "./vro-el-table-column-group/vroElTableColumnGroupColumnManager.js";
61
- import { vroElTagsProps as dr } from "./vro-el-tags/types.js";
62
- import { vroElTreeProps as br } from "./vro-el-tree/types.js";
63
- import { vroElWithConfigProps as Dr } from "./vro-el-with-config/types.js";
58
+ import { defineVroElTableColumns as vr } from "./vro-el-table-column-group/defineVroElTableColumns.js";
59
+ import { vroElTableColumnGroupProps as hr } from "./vro-el-table-column-group/types.js";
60
+ import { useVroElTableColumnGroup as Pr } from "./vro-el-table-column-group/useVroElTableColumnGroup.js";
61
+ import { vroElTableColumnGroupColumnManager as dr } from "./vro-el-table-column-group/vroElTableColumnGroupColumnManager.js";
62
+ import { vroElTagsProps as br } from "./vro-el-tags/types.js";
63
+ import { vroElTreeProps as Dr } from "./vro-el-tree/types.js";
64
+ import { vroElWithConfigProps as wr } from "./vro-el-with-config/types.js";
64
65
  export {
65
66
  V as VroElCheckboxGroup,
66
67
  g as VroElConfigProvider,
@@ -85,14 +86,15 @@ export {
85
86
  f as datePickerValueFormat,
86
87
  Oo as defineVroElSchemaFormCreateField,
87
88
  yo as defineVroElSchemaFormFieldTrigger,
89
+ vr as defineVroElTableColumns,
88
90
  E as elTableColumnProps,
89
91
  e as en,
90
- io as getVroElFileUploadOptions,
92
+ no as getVroElFileUploadOptions,
91
93
  Fo as getVroElImageOptions,
92
94
  To as getVroElImageUploadOptions,
93
- i as parseType,
95
+ n as parseType,
94
96
  eo as provideVroElConfig,
95
- no as setVroElFileUploadOptions,
97
+ io as setVroElFileUploadOptions,
96
98
  lo as setVroElGlobalConfig,
97
99
  ho as setVroElImageOptions,
98
100
  bo as setVroElImageUploadOptions,
@@ -106,8 +108,8 @@ export {
106
108
  qo as useVroElSchemaFormDialogInstance,
107
109
  mr as useVroElSchemaFormDrawer,
108
110
  $o as useVroElSchemaFormDrawerInstance,
109
- ir as useVroElTable,
110
- hr as useVroElTableColumnGroup,
111
+ nr as useVroElTable,
112
+ Pr as useVroElTableColumnGroup,
111
113
  oo as vroElCheckboxGroupProps,
112
114
  to as vroElConfigContextKey,
113
115
  fo as vroElConfigProviderProps,
@@ -126,12 +128,12 @@ export {
126
128
  tr as vroElSelectProps,
127
129
  fr as vroElSkeletonProps,
128
130
  Vr as vroElTableActionsColumnProps,
129
- Pr as vroElTableColumnGroupColumnManager,
130
- vr as vroElTableColumnGroupProps,
131
+ dr as vroElTableColumnGroupColumnManager,
132
+ hr as vroElTableColumnGroupProps,
131
133
  gr as vroElTableColumnProps,
132
134
  Er as vroElTableProps,
133
- dr as vroElTagsProps,
134
- br as vroElTreeProps,
135
- Dr as vroElWithConfigProps,
135
+ br as vroElTagsProps,
136
+ Dr as vroElTreeProps,
137
+ wr as vroElWithConfigProps,
136
138
  m as zhCN
137
139
  };
@@ -16,8 +16,15 @@ export type VroElTableRequestParams = [currentPage: number, pageSize: number];
16
16
  * 请求函数的查询参数。
17
17
  */
18
18
  export type VroElTableRequestQuery = Record<string, any>;
19
+ /**
20
+ * 请求函数的返回值:`[列表, 总数]`。
21
+ *
22
+ * 额外接受普通数组写法(`Array<T[] | number>`):调用方写成 `async () => [[], 1]`
23
+ * 时数组字面量不一定被推断成元组,只按元组校验会误报。
24
+ */
25
+ export type VroElTableRequestResult<T> = [T[], number] | Array<T[] | number>;
19
26
  export interface VroElTableRequest<T = any> {
20
- (state: VroElTableRequestParams, query: VroElTableRequestQuery): Promise<[T[], number]>;
27
+ (state: VroElTableRequestParams, query: VroElTableRequestQuery): Promise<VroElTableRequestResult<T>>;
21
28
  }
22
29
  export interface VroElTableEmits {
23
30
  request: [payload?: VroElTableRequestPayload];
@@ -1,7 +1,6 @@
1
1
  import { UseAsyncTaskOptions } from '@vrojs/use';
2
2
  import { ComputedRef, Ref } from 'vue';
3
3
  import { VroElSchemaFormSchema, VroElSchemaFormSchemaFieldBase } from '../vro-el-schema-form';
4
- import { VroElTableColumnGroupColumns } from '../vro-el-table-column-group';
5
4
  import { VroElTableRequest } from './types';
6
5
  export interface UseVroElTableOptions<Row extends Record<string, any> = any> extends Pick<UseAsyncTaskOptions<any>, 'activated' | 'immediate' | 'throwError' | 'onError'> {
7
6
  query?: Ref<Record<string, any>>;
@@ -23,7 +22,6 @@ export interface UseVroElTablePagination {
23
22
  export interface UseVroElTableTableProps<Row extends Record<string, any> = any, R extends VroElSchemaFormSchema = never> {
24
23
  schema: UseVroElTableSchema<R> | undefined;
25
24
  loading: boolean;
26
- columns: VroElTableColumnGroupColumns<Row>;
27
25
  data: Row[];
28
26
  pagination: UseVroElTablePagination;
29
27
  }
@@ -35,7 +33,6 @@ export interface UseVroElTableReturn<Row extends Record<string, any> = any, R ex
35
33
  tableProps: ComputedRef<UseVroElTableTableProps<Row, R>>;
36
34
  query: Ref<Record<string, any> | undefined>;
37
35
  schema: UseVroElTableSchemaResult<R>;
38
- columns: VroElTableColumnGroupColumns<Row>;
39
36
  trigger: (params?: UseVroElTableAsyncTaskParams) => Promise<Row[]>;
40
37
  data: Ref<Row[]>;
41
38
  loading: Ref<boolean>;
@@ -44,10 +41,8 @@ export interface UseVroElTableReturn<Row extends Record<string, any> = any, R ex
44
41
  /**
45
42
  * 表格请求状态管理。
46
43
  *
47
- * 参数统一按「筛选表单 → 请求函数 → 列配置 → 选项」排列,`request` 始终紧跟筛选表单,
48
- * 因此 `Row` 在解析列配置之前就能从 `request` 的返回值推断出来,列配置里的 `row` 可以直接拿到具体类型。
44
+ * 只负责筛选、分页、请求和 loading 状态,不接管列配置;
45
+ * 列配置请用 `defineVroElTableColumns<Row>()` 单独定义后传给表格组件。
49
46
  */
50
- export declare function useVroElTable<Row extends Record<string, any>, R extends VroElSchemaFormSchema = VroElSchemaFormSchema>(rowSchema: R, request: VroElTableRequest<Row>, rawColumns: VroElTableColumnGroupColumns<Row>, options?: UseVroElTableOptions<Row>): UseVroElTableReturn<Row, R>;
51
- export declare function useVroElTable<Row extends Record<string, any>>(request: VroElTableRequest<Row>, rawColumns: VroElTableColumnGroupColumns<Row>, options?: UseVroElTableOptions<Row>): UseVroElTableReturn<Row, never>;
52
- export declare function useVroElTable<Row extends Record<string, any>, R extends VroElSchemaFormSchema = VroElSchemaFormSchema>(rowSchema: R, request: VroElTableRequest<Row>, options?: UseVroElTableOptions<Row>): UseVroElTableReturn<Row, R>;
53
47
  export declare function useVroElTable<Row extends Record<string, any>>(request: VroElTableRequest<Row>, options?: UseVroElTableOptions<Row>): UseVroElTableReturn<Row, never>;
48
+ export declare function useVroElTable<Row extends Record<string, any>, R extends VroElSchemaFormSchema = VroElSchemaFormSchema>(rowSchema: R, request: VroElTableRequest<Row>, options?: UseVroElTableOptions<Row>): UseVroElTableReturn<Row, R>;
@@ -1,44 +1,42 @@
1
- import E from "../node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js";
2
- import { isNumber as T, filterEmptyValue as V } from "@daysnap/utils";
3
- import { useAsyncTask as h } from "@vrojs/use";
4
- import { reactive as c, ref as k, computed as j } from "vue";
5
- function C(e, u, d, m) {
6
- const i = !Array.isArray(e) && typeof e != "function", s = i ? e : void 0, v = i ? u : e, a = i ? d : u, A = Array.isArray(a) ? a : [], w = (Array.isArray(a) ? m : a) ?? {}, n = s ? c(s) : void 0, l = c(A), { query: P, ...b } = w, o = P ?? k(), t = c({
1
+ import S from "../node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js";
2
+ import { isNumber as h, filterEmptyValue as x } from "@daysnap/utils";
3
+ import { useAsyncTask as z } from "@vrojs/use";
4
+ import { reactive as g, ref as E, computed as T } from "vue";
5
+ function N(r, n, d) {
6
+ const i = typeof r != "function", u = i ? r : void 0, p = i ? n : r, y = (i ? d : n) ?? {}, a = u ? g(u) : void 0, { query: m, ...v } = y, o = m ?? E(), t = g({
7
7
  currentPage: 1,
8
8
  pageSize: 10,
9
9
  total: 0
10
- }), { trigger: S, data: y, loading: g } = h(
11
- async (r) => {
12
- T(r) && (r = { currentPage: r });
13
- const { currentPage: f, pageSize: p } = Object.assign({}, t, r);
14
- r?.query && (o.value = r.query), o.value || (o.value = n ? V(await E.extract(n), !0) : {}), t.currentPage = f, t.pageSize = p;
15
- const [x, z] = await v([f, p], o.value);
16
- return t.total = z, x || [];
10
+ }), { trigger: P, data: c, loading: l } = z(
11
+ async (e) => {
12
+ h(e) && (e = { currentPage: e });
13
+ const { currentPage: s, pageSize: f } = Object.assign({}, t, e);
14
+ e?.query && (o.value = e.query), o.value || (o.value = a ? x(await S.extract(a), !0) : {}), t.currentPage = s, t.pageSize = f;
15
+ const [b, w] = await p([s, f], o.value);
16
+ return t.total = w, b || [];
17
17
  },
18
18
  {
19
19
  immediate: !0,
20
20
  throwError: !0,
21
21
  initialValue: [],
22
- ...b
22
+ ...v
23
23
  }
24
24
  );
25
25
  return {
26
- tableProps: j(() => ({
27
- schema: n,
28
- loading: g.value,
29
- columns: l,
30
- data: y.value,
26
+ tableProps: T(() => ({
27
+ schema: a,
28
+ loading: l.value,
29
+ data: c.value,
31
30
  pagination: t
32
31
  })),
33
32
  query: o,
34
- schema: n,
35
- columns: l,
36
- trigger: S,
37
- data: y,
38
- loading: g,
33
+ schema: a,
34
+ trigger: P,
35
+ data: c,
36
+ loading: l,
39
37
  pagination: t
40
38
  };
41
39
  }
42
40
  export {
43
- C as useVroElTable
41
+ N as useVroElTable
44
42
  };
@@ -0,0 +1,2 @@
1
+ import { VroElTableColumnGroupColumns } from './types';
2
+ export declare function defineVroElTableColumns<T extends Record<string, any> = any>(columns: VroElTableColumnGroupColumns<T> | (() => VroElTableColumnGroupColumns<T>)): VroElTableColumnGroupColumns<T>;
@@ -0,0 +1,7 @@
1
+ import { isFunction as e } from "@daysnap/utils";
2
+ function n(r) {
3
+ return e(r) ? r() : r;
4
+ }
5
+ export {
6
+ n as defineVroElTableColumns
7
+ };
@@ -1,3 +1,4 @@
1
+ export * from './defineVroElTableColumns';
1
2
  export * from './types';
2
3
  export * from './useVroElTableColumnGroup';
3
4
  export * from './vroElTableColumnGroupColumnManager';
@@ -1,13 +1,15 @@
1
1
  import { withInstall as o } from "@vrojs/base";
2
2
  import r from "./vro-el-table-column-group.vue.js";
3
- import { vroElTableColumnGroupProps as a } from "./types.js";
4
- import { useVroElTableColumnGroup as n } from "./useVroElTableColumnGroup.js";
5
- import { vroElTableColumnGroupColumnManager as s } from "./vroElTableColumnGroupColumnManager.js";
6
- const e = o(r);
3
+ import { defineVroElTableColumns as a } from "./defineVroElTableColumns.js";
4
+ import { vroElTableColumnGroupProps as t } from "./types.js";
5
+ import { useVroElTableColumnGroup as s } from "./useVroElTableColumnGroup.js";
6
+ import { vroElTableColumnGroupColumnManager as b } from "./vroElTableColumnGroupColumnManager.js";
7
+ const m = o(r);
7
8
  export {
8
- e as VroElTableColumnGroup,
9
- e as default,
10
- n as useVroElTableColumnGroup,
11
- s as vroElTableColumnGroupColumnManager,
12
- a as vroElTableColumnGroupProps
9
+ m as VroElTableColumnGroup,
10
+ m as default,
11
+ a as defineVroElTableColumns,
12
+ s as useVroElTableColumnGroup,
13
+ b as vroElTableColumnGroupColumnManager,
14
+ t as vroElTableColumnGroupProps
13
15
  };
@@ -1,2 +1,2 @@
1
1
  import { VroElTableColumnGroupColumns } from './types';
2
- export declare function useVroElTableColumnGroup<T extends Record<string, any> = any>(rawColumns: VroElTableColumnGroupColumns<T> | (() => VroElTableColumnGroupColumns<T>)): VroElTableColumnGroupColumns<T>;
2
+ export declare function useVroElTableColumnGroup<T extends Record<string, any> = any>(columns: VroElTableColumnGroupColumns<T> | (() => VroElTableColumnGroupColumns<T>)): import('vue').Reactive<VroElTableColumnGroupColumns<T>>;
@@ -1,9 +1,7 @@
1
- import { isFunction as r } from "@daysnap/utils";
2
- import { reactive as t } from "vue";
1
+ import { reactive as r } from "vue";
2
+ import { defineVroElTableColumns as e } from "./defineVroElTableColumns.js";
3
3
  function n(o) {
4
- return t(
5
- r(o) ? o() : o
6
- );
4
+ return r(e(o));
7
5
  }
8
6
  export {
9
7
  n as useVroElTableColumnGroup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vrojs/element-plus",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "vrojs ui",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",