cosey 0.9.0 → 0.9.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.
@@ -2,6 +2,7 @@ import { type ComputedRef, type ExtractPropTypes, type PropType } from 'vue';
2
2
  import { type TableConfig } from '../table';
3
3
  import { type ThemeConfig } from '../theme';
4
4
  import { type Language } from '../../locale';
5
+ import { type TableActionConfig } from '../table-action';
5
6
  export declare const configProviderProps: {
6
7
  prefixCls: {
7
8
  type: StringConstructor;
@@ -12,6 +13,9 @@ export declare const configProviderProps: {
12
13
  table: {
13
14
  type: PropType<TableConfig>;
14
15
  };
16
+ tableAction: {
17
+ type: PropType<TableActionConfig>;
18
+ };
15
19
  locale: {
16
20
  type: PropType<Language>;
17
21
  };
@@ -21,6 +25,7 @@ export interface ConfigProviderInnerProps {
21
25
  getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string;
22
26
  theme?: ComputedRef<ThemeConfig | undefined>;
23
27
  table: ComputedRef<TableConfig | undefined>;
28
+ tableAction: ComputedRef<TableActionConfig | undefined>;
24
29
  prefixCls: ComputedRef<string>;
25
30
  }
26
31
  export declare const defaultPrefixCls = "co";
@@ -10,6 +10,9 @@ const configProviderProps = {
10
10
  table: {
11
11
  type: Object
12
12
  },
13
+ tableAction: {
14
+ type: Object
15
+ },
13
16
  locale: {
14
17
  type: Object
15
18
  }
@@ -22,7 +25,8 @@ const defaultConfigProvider = {
22
25
  return suffixCls ? `${defaultPrefixCls}-${suffixCls}` : defaultPrefixCls;
23
26
  },
24
27
  prefixCls: computed(() => defaultPrefixCls),
25
- table: computed(() => void 0)
28
+ table: computed(() => void 0),
29
+ tableAction: computed(() => void 0)
26
30
  };
27
31
  const useConfigProvide = (props) => {
28
32
  return provide(configProviderKey, props);
@@ -8,6 +8,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
8
8
  table: {
9
9
  type: import("vue").PropType<import("..").TableConfig>;
10
10
  };
11
+ tableAction: {
12
+ type: import("vue").PropType<import("..").TableActionConfig>;
13
+ };
11
14
  locale: {
12
15
  type: import("vue").PropType<import("../../locale").Language>;
13
16
  };
@@ -21,6 +24,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
21
24
  table: {
22
25
  type: import("vue").PropType<import("..").TableConfig>;
23
26
  };
27
+ tableAction: {
28
+ type: import("vue").PropType<import("..").TableActionConfig>;
29
+ };
24
30
  locale: {
25
31
  type: import("vue").PropType<import("../../locale").Language>;
26
32
  };
@@ -23,11 +23,15 @@ var stdin_default = defineComponent({
23
23
  const mergedTable = computed(() => {
24
24
  return props.table || unref(parentContext.table);
25
25
  });
26
+ const mergedTableAction = computed(() => {
27
+ return props.tableAction || unref(parentContext.tableAction);
28
+ });
26
29
  const configProvider = {
27
30
  getPrefixCls,
28
31
  theme: mergedTheme,
29
32
  prefixCls: mergedPrefixCls,
30
- table: mergedTable
33
+ table: mergedTable,
34
+ tableAction: mergedTableAction
31
35
  };
32
36
  useConfigProvide(configProvider);
33
37
  provide(localeContextKey, computed(() => props.locale));
@@ -10,6 +10,9 @@ declare const _ConfigProvider: {
10
10
  table: {
11
11
  type: import("vue").PropType<import("..").TableConfig>;
12
12
  };
13
+ tableAction: {
14
+ type: import("vue").PropType<import("..").TableActionConfig>;
15
+ };
13
16
  locale: {
14
17
  type: import("vue").PropType<import("../../locale").Language>;
15
18
  };
@@ -30,6 +33,9 @@ declare const _ConfigProvider: {
30
33
  table: {
31
34
  type: import("vue").PropType<import("..").TableConfig>;
32
35
  };
36
+ tableAction: {
37
+ type: import("vue").PropType<import("..").TableActionConfig>;
38
+ };
33
39
  locale: {
34
40
  type: import("vue").PropType<import("../../locale").Language>;
35
41
  };
@@ -47,6 +53,9 @@ declare const _ConfigProvider: {
47
53
  table: {
48
54
  type: import("vue").PropType<import("..").TableConfig>;
49
55
  };
56
+ tableAction: {
57
+ type: import("vue").PropType<import("..").TableActionConfig>;
58
+ };
50
59
  locale: {
51
60
  type: import("vue").PropType<import("../../locale").Language>;
52
61
  };
@@ -2,11 +2,11 @@ export * from './table-action.api';
2
2
  declare const _TableAction: {
3
3
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
4
4
  actions: {
5
- type: import("vue").PropType<(import("./item.api").TableActionItem | null | undefined)[] | (import("./item.api").TableActionItem | null | undefined)[][]>;
5
+ type: import("vue").PropType<(boolean | import("./item.api").TableActionItemProps | null | undefined)[] | (boolean | import("./item.api").TableActionItemProps | null | undefined)[][]>;
6
6
  default: () => never[];
7
7
  };
8
8
  }>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
9
- actions: (import("./item.api").TableActionItem | null | undefined)[] | (import("./item.api").TableActionItem | null | undefined)[][];
9
+ actions: (boolean | import("./item.api").TableActionItemProps | null | undefined)[] | (boolean | import("./item.api").TableActionItemProps | null | undefined)[][];
10
10
  }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
11
11
  P: {};
12
12
  B: {};
@@ -16,22 +16,22 @@ declare const _TableAction: {
16
16
  Defaults: {};
17
17
  }, Readonly<import("vue").ExtractPropTypes<{
18
18
  actions: {
19
- type: import("vue").PropType<(import("./item.api").TableActionItem | null | undefined)[] | (import("./item.api").TableActionItem | null | undefined)[][]>;
19
+ type: import("vue").PropType<(boolean | import("./item.api").TableActionItemProps | null | undefined)[] | (boolean | import("./item.api").TableActionItemProps | null | undefined)[][]>;
20
20
  default: () => never[];
21
21
  };
22
22
  }>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
23
- actions: (import("./item.api").TableActionItem | null | undefined)[] | (import("./item.api").TableActionItem | null | undefined)[][];
23
+ actions: (boolean | import("./item.api").TableActionItemProps | null | undefined)[] | (boolean | import("./item.api").TableActionItemProps | null | undefined)[][];
24
24
  }>;
25
25
  __isFragment?: never;
26
26
  __isTeleport?: never;
27
27
  __isSuspense?: never;
28
28
  } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
29
29
  actions: {
30
- type: import("vue").PropType<(import("./item.api").TableActionItem | null | undefined)[] | (import("./item.api").TableActionItem | null | undefined)[][]>;
30
+ type: import("vue").PropType<(boolean | import("./item.api").TableActionItemProps | null | undefined)[] | (boolean | import("./item.api").TableActionItemProps | null | undefined)[][]>;
31
31
  default: () => never[];
32
32
  };
33
33
  }>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
34
- actions: (import("./item.api").TableActionItem | null | undefined)[] | (import("./item.api").TableActionItem | null | undefined)[][];
34
+ actions: (boolean | import("./item.api").TableActionItemProps | null | undefined)[] | (boolean | import("./item.api").TableActionItemProps | null | undefined)[][];
35
35
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("vue").Plugin;
36
36
  export { _TableAction as TableAction };
37
37
  export default _TableAction;
@@ -1,105 +1,19 @@
1
- import { popconfirmProps } from 'element-plus';
2
- import { ExtractPublicPropTypes, PropType, type ExtractPropTypes } from 'vue';
1
+ import { type ButtonProps, popconfirmProps } from 'element-plus';
2
+ import { type PropType, type ExtractPropTypes } from 'vue';
3
+ export interface TableActionItemProps extends Partial<ButtonProps> {
4
+ label?: string;
5
+ popconfirm?: Partial<ExtractPropTypes<typeof popconfirmProps>> & {
6
+ confirm?: (event: MouseEvent) => any;
7
+ cancel?: (event: MouseEvent) => void;
8
+ };
9
+ onClick?: (event: MouseEvent) => void;
10
+ hidden?: boolean;
11
+ visible?: boolean;
12
+ icon?: string;
13
+ }
14
+ export declare const defaultTableActionItemProps: TableActionItemProps;
3
15
  export declare const tableActionItemProps: {
4
- link: {
5
- type: PropType<boolean>;
6
- default: boolean;
7
- };
8
- type: {
9
- type: PropType<"primary" | "success" | "warning" | "danger" | "info" | "text">;
10
- default: string;
11
- };
12
- label: {
13
- type: StringConstructor;
14
- };
15
- popconfirm: {
16
- type: PropType<Partial<ExtractPropTypes<typeof popconfirmProps>> & {
17
- confirm?: (event: MouseEvent) => any;
18
- cancel?: (event: MouseEvent) => void;
19
- }>;
20
- };
21
- onClick: {
22
- type: PropType<(event: MouseEvent) => void>;
23
- };
24
- hidden: {
25
- type: BooleanConstructor;
26
- default: boolean;
27
- };
28
- visible: {
29
- type: BooleanConstructor;
30
- default: boolean;
31
- };
32
- icon: {
33
- type: StringConstructor;
34
- };
35
- size: {
36
- readonly type: PropType<"" | "default" | "large" | "small">;
37
- readonly required: false;
38
- readonly validator: ((val: unknown) => boolean) | undefined;
39
- __epPropKey: true;
40
- };
41
- disabled: BooleanConstructor;
42
- nativeType: {
43
- readonly type: PropType<"button" | "reset" | "submit">;
44
- readonly required: false;
45
- readonly validator: ((val: unknown) => boolean) | undefined;
46
- __epPropKey: true;
47
- } & {
48
- readonly default: "button";
49
- };
50
- loading: BooleanConstructor;
51
- loadingIcon: {
52
- readonly type: PropType<string | import("vue").Component>;
53
- readonly required: false;
54
- readonly validator: ((val: unknown) => boolean) | undefined;
55
- __epPropKey: true;
56
- } & {
57
- readonly default: () => any;
58
- };
59
- plain: {
60
- readonly type: PropType<boolean>;
61
- readonly required: false;
62
- readonly validator: ((val: unknown) => boolean) | undefined;
63
- __epPropKey: true;
64
- } & {
65
- readonly default: undefined;
66
- };
67
- text: {
68
- readonly type: PropType<boolean>;
69
- readonly required: false;
70
- readonly validator: ((val: unknown) => boolean) | undefined;
71
- __epPropKey: true;
72
- } & {
73
- readonly default: undefined;
74
- };
75
- bg: BooleanConstructor;
76
- autofocus: BooleanConstructor;
77
- round: {
78
- readonly type: PropType<boolean>;
79
- readonly required: false;
80
- readonly validator: ((val: unknown) => boolean) | undefined;
81
- __epPropKey: true;
82
- } & {
83
- readonly default: undefined;
84
- };
85
- circle: BooleanConstructor;
86
- color: StringConstructor;
87
- dark: BooleanConstructor;
88
- autoInsertSpace: {
89
- readonly type: PropType<boolean>;
90
- readonly required: false;
91
- readonly validator: ((val: unknown) => boolean) | undefined;
92
- __epPropKey: true;
93
- } & {
94
- readonly default: undefined;
95
- };
96
- tag: {
97
- readonly type: PropType<string | import("vue").Component>;
98
- readonly required: false;
99
- readonly validator: ((val: unknown) => boolean) | undefined;
100
- __epPropKey: true;
101
- } & {
102
- readonly default: "button";
16
+ props: {
17
+ type: PropType<TableActionItemProps>;
103
18
  };
104
19
  };
105
- export type TableActionItem = ExtractPublicPropTypes<typeof tableActionItemProps>;
@@ -1,35 +1,13 @@
1
- import { buttonProps } from 'element-plus';
2
-
1
+ const defaultTableActionItemProps = {
2
+ link: true,
3
+ type: "primary",
4
+ hidden: false,
5
+ visible: true
6
+ };
3
7
  const tableActionItemProps = {
4
- ...buttonProps,
5
- link: {
6
- type: Boolean,
7
- default: true
8
- },
9
- type: {
10
- type: String,
11
- default: "primary"
12
- },
13
- label: {
14
- type: String
15
- },
16
- popconfirm: {
8
+ props: {
17
9
  type: Object
18
- },
19
- onClick: {
20
- type: Function
21
- },
22
- hidden: {
23
- type: Boolean,
24
- default: false
25
- },
26
- visible: {
27
- type: Boolean,
28
- default: true
29
- },
30
- icon: {
31
- type: String
32
10
  }
33
11
  };
34
12
 
35
- export { tableActionItemProps };
13
+ export { defaultTableActionItemProps, tableActionItemProps };
@@ -1,222 +1,11 @@
1
+ import { type TableActionItemProps } from './item.api';
1
2
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
- link: {
3
- type: import("vue").PropType<boolean>;
4
- default: boolean;
5
- };
6
- type: {
7
- type: import("vue").PropType<"primary" | "success" | "warning" | "danger" | "info" | "text">;
8
- default: string;
9
- };
10
- label: {
11
- type: StringConstructor;
12
- };
13
- popconfirm: {
14
- type: import("vue").PropType<Partial<import("vue").ExtractPropTypes<typeof import("element-plus").popconfirmProps>> & {
15
- confirm?: (event: MouseEvent) => any;
16
- cancel?: (event: MouseEvent) => void;
17
- }>;
18
- };
19
- onClick: {
20
- type: import("vue").PropType<(event: MouseEvent) => void>;
21
- };
22
- hidden: {
23
- type: BooleanConstructor;
24
- default: boolean;
25
- };
26
- visible: {
27
- type: BooleanConstructor;
28
- default: boolean;
29
- };
30
- icon: {
31
- type: StringConstructor;
32
- };
33
- size: {
34
- readonly type: import("vue").PropType<"" | "default" | "large" | "small">;
35
- readonly required: false;
36
- readonly validator: ((val: unknown) => boolean) | undefined;
37
- __epPropKey: true;
38
- };
39
- disabled: BooleanConstructor;
40
- nativeType: {
41
- readonly type: import("vue").PropType<"button" | "reset" | "submit">;
42
- readonly required: false;
43
- readonly validator: ((val: unknown) => boolean) | undefined;
44
- __epPropKey: true;
45
- } & {
46
- readonly default: "button";
47
- };
48
- loading: BooleanConstructor;
49
- loadingIcon: {
50
- readonly type: import("vue").PropType<string | import("vue").Component>;
51
- readonly required: false;
52
- readonly validator: ((val: unknown) => boolean) | undefined;
53
- __epPropKey: true;
54
- } & {
55
- readonly default: () => any;
56
- };
57
- plain: {
58
- readonly type: import("vue").PropType<boolean>;
59
- readonly required: false;
60
- readonly validator: ((val: unknown) => boolean) | undefined;
61
- __epPropKey: true;
62
- } & {
63
- readonly default: undefined;
64
- };
65
- text: {
66
- readonly type: import("vue").PropType<boolean>;
67
- readonly required: false;
68
- readonly validator: ((val: unknown) => boolean) | undefined;
69
- __epPropKey: true;
70
- } & {
71
- readonly default: undefined;
72
- };
73
- bg: BooleanConstructor;
74
- autofocus: BooleanConstructor;
75
- round: {
76
- readonly type: import("vue").PropType<boolean>;
77
- readonly required: false;
78
- readonly validator: ((val: unknown) => boolean) | undefined;
79
- __epPropKey: true;
80
- } & {
81
- readonly default: undefined;
82
- };
83
- circle: BooleanConstructor;
84
- color: StringConstructor;
85
- dark: BooleanConstructor;
86
- autoInsertSpace: {
87
- readonly type: import("vue").PropType<boolean>;
88
- readonly required: false;
89
- readonly validator: ((val: unknown) => boolean) | undefined;
90
- __epPropKey: true;
91
- } & {
92
- readonly default: undefined;
93
- };
94
- tag: {
95
- readonly type: import("vue").PropType<string | import("vue").Component>;
96
- readonly required: false;
97
- readonly validator: ((val: unknown) => boolean) | undefined;
98
- __epPropKey: true;
99
- } & {
100
- readonly default: "button";
3
+ props: {
4
+ type: import("vue").PropType<TableActionItemProps>;
101
5
  };
102
6
  }>, () => import("vue/jsx-runtime").JSX.Element | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
103
- link: {
104
- type: import("vue").PropType<boolean>;
105
- default: boolean;
106
- };
107
- type: {
108
- type: import("vue").PropType<"primary" | "success" | "warning" | "danger" | "info" | "text">;
109
- default: string;
110
- };
111
- label: {
112
- type: StringConstructor;
113
- };
114
- popconfirm: {
115
- type: import("vue").PropType<Partial<import("vue").ExtractPropTypes<typeof import("element-plus").popconfirmProps>> & {
116
- confirm?: (event: MouseEvent) => any;
117
- cancel?: (event: MouseEvent) => void;
118
- }>;
119
- };
120
- onClick: {
121
- type: import("vue").PropType<(event: MouseEvent) => void>;
122
- };
123
- hidden: {
124
- type: BooleanConstructor;
125
- default: boolean;
126
- };
127
- visible: {
128
- type: BooleanConstructor;
129
- default: boolean;
130
- };
131
- icon: {
132
- type: StringConstructor;
133
- };
134
- size: {
135
- readonly type: import("vue").PropType<"" | "default" | "large" | "small">;
136
- readonly required: false;
137
- readonly validator: ((val: unknown) => boolean) | undefined;
138
- __epPropKey: true;
139
- };
140
- disabled: BooleanConstructor;
141
- nativeType: {
142
- readonly type: import("vue").PropType<"button" | "reset" | "submit">;
143
- readonly required: false;
144
- readonly validator: ((val: unknown) => boolean) | undefined;
145
- __epPropKey: true;
146
- } & {
147
- readonly default: "button";
148
- };
149
- loading: BooleanConstructor;
150
- loadingIcon: {
151
- readonly type: import("vue").PropType<string | import("vue").Component>;
152
- readonly required: false;
153
- readonly validator: ((val: unknown) => boolean) | undefined;
154
- __epPropKey: true;
155
- } & {
156
- readonly default: () => any;
157
- };
158
- plain: {
159
- readonly type: import("vue").PropType<boolean>;
160
- readonly required: false;
161
- readonly validator: ((val: unknown) => boolean) | undefined;
162
- __epPropKey: true;
163
- } & {
164
- readonly default: undefined;
165
- };
166
- text: {
167
- readonly type: import("vue").PropType<boolean>;
168
- readonly required: false;
169
- readonly validator: ((val: unknown) => boolean) | undefined;
170
- __epPropKey: true;
171
- } & {
172
- readonly default: undefined;
173
- };
174
- bg: BooleanConstructor;
175
- autofocus: BooleanConstructor;
176
- round: {
177
- readonly type: import("vue").PropType<boolean>;
178
- readonly required: false;
179
- readonly validator: ((val: unknown) => boolean) | undefined;
180
- __epPropKey: true;
181
- } & {
182
- readonly default: undefined;
183
- };
184
- circle: BooleanConstructor;
185
- color: StringConstructor;
186
- dark: BooleanConstructor;
187
- autoInsertSpace: {
188
- readonly type: import("vue").PropType<boolean>;
189
- readonly required: false;
190
- readonly validator: ((val: unknown) => boolean) | undefined;
191
- __epPropKey: true;
192
- } & {
193
- readonly default: undefined;
194
- };
195
- tag: {
196
- readonly type: import("vue").PropType<string | import("vue").Component>;
197
- readonly required: false;
198
- readonly validator: ((val: unknown) => boolean) | undefined;
199
- __epPropKey: true;
200
- } & {
201
- readonly default: "button";
7
+ props: {
8
+ type: import("vue").PropType<TableActionItemProps>;
202
9
  };
203
- }>> & Readonly<{}>, {
204
- hidden: boolean;
205
- visible: boolean;
206
- round: boolean;
207
- dark: boolean;
208
- text: boolean;
209
- circle: boolean;
210
- disabled: boolean;
211
- type: "text" | "primary" | "success" | "warning" | "info" | "danger";
212
- link: boolean;
213
- tag: string | import("vue").Component;
214
- loading: boolean;
215
- plain: boolean;
216
- nativeType: "button" | "reset" | "submit";
217
- loadingIcon: string | import("vue").Component;
218
- bg: boolean;
219
- autofocus: boolean;
220
- autoInsertSpace: boolean;
221
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
10
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
222
11
  export default _default;
@@ -1,10 +1,11 @@
1
- import { defineComponent, computed, ref, createVNode, Fragment, mergeProps, isVNode } from 'vue';
1
+ import { defineComponent, computed, unref, ref, createVNode, Fragment, mergeProps, isVNode } from 'vue';
2
2
  import { omit } from 'lodash-es';
3
3
  import { ElPopconfirm, ElButton } from 'element-plus';
4
- import { tableActionItemProps } from './item.api.js';
4
+ import { tableActionItemProps, defaultTableActionItemProps } from './item.api.js';
5
5
  import stdin_default$1 from '../icon/icon.vue.js';
6
6
  import { useToken } from '../theme/util/useToken.js';
7
7
  import { useLocale } from '../../hooks/useLocale.js';
8
+ import { useConfig } from '../config-provider/config-provider.api.js';
8
9
 
9
10
  function _isSlot(s) {
10
11
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
@@ -20,17 +21,27 @@ var stdin_default = defineComponent({
20
21
  const {
21
22
  token
22
23
  } = useToken();
24
+ const {
25
+ tableAction: tableActionConfig
26
+ } = useConfig();
27
+ const mergedProps = computed(() => {
28
+ return {
29
+ ...defaultTableActionItemProps,
30
+ ...unref(tableActionConfig)?.itemProps,
31
+ ...props.props
32
+ };
33
+ });
23
34
  const buttonProps = computed(() => {
24
- return omit(props, "icon");
35
+ return omit(unref(mergedProps), ["icon", "visible", "hidden", "popconfirm", "label"]);
25
36
  });
26
37
  const loading = ref(false);
27
38
  const mergedVisible = computed(() => {
28
- return props.hidden ? false : props.visible;
39
+ return unref(mergedProps).hidden ? false : unref(mergedProps).visible;
29
40
  });
30
41
  const onConfirm = async (e, confirm) => {
31
42
  loading.value = true;
32
43
  try {
33
- await props.popconfirm?.confirm?.(e);
44
+ await unref(mergedProps).popconfirm?.confirm?.(e);
34
45
  confirm(e);
35
46
  } catch {} finally {
36
47
  loading.value = false;
@@ -41,17 +52,17 @@ var stdin_default = defineComponent({
41
52
  };
42
53
  return () => {
43
54
  if (!mergedVisible.value) return;
44
- if (props.popconfirm) {
45
- return createVNode(ElPopconfirm, props.popconfirm, {
46
- reference: () => createVNode(ElButton, mergeProps(omit(buttonProps.value, "popconfirm"), {
55
+ if (unref(mergedProps).popconfirm) {
56
+ return createVNode(ElPopconfirm, unref(mergedProps).popconfirm, {
57
+ reference: () => createVNode(ElButton, mergeProps(buttonProps.value, {
47
58
  "style": "margin: 0"
48
59
  }), {
49
- default: () => [props.icon && createVNode(stdin_default$1, {
50
- "name": props.icon,
60
+ default: () => [unref(mergedProps).icon && createVNode(stdin_default$1, {
61
+ "name": unref(mergedProps).icon,
51
62
  "style": {
52
63
  marginInlineEnd: token.value.marginXXS + "px"
53
64
  }
54
- }, null), props.label]
65
+ }, null), unref(mergedProps).label]
55
66
  }),
56
67
  actions: ({
57
68
  confirm,
@@ -77,12 +88,12 @@ var stdin_default = defineComponent({
77
88
  return createVNode(ElButton, mergeProps(buttonProps.value, {
78
89
  "style": "margin: 0"
79
90
  }), {
80
- default: () => [props.icon && createVNode(stdin_default$1, {
81
- "name": props.icon,
91
+ default: () => [unref(mergedProps).icon && createVNode(stdin_default$1, {
92
+ "name": unref(mergedProps).icon,
82
93
  "style": {
83
94
  marginInlineEnd: token.value.marginXXS + "px"
84
95
  }
85
- }, null), props.label]
96
+ }, null), unref(mergedProps).label]
86
97
  });
87
98
  };
88
99
  }
@@ -1,6 +1,6 @@
1
1
  import { type ExtractPropTypes, type PropType } from 'vue';
2
- import { type TableActionItem } from './item.api';
3
- type TableActionItemAtom = TableActionItem | null | undefined;
2
+ import { type TableActionItemProps } from './item.api';
3
+ type TableActionItemAtom = TableActionItemProps | null | undefined | boolean;
4
4
  export declare const tableActionProps: {
5
5
  actions: {
6
6
  type: PropType<TableActionItemAtom[] | TableActionItemAtom[][]>;
@@ -8,4 +8,7 @@ export declare const tableActionProps: {
8
8
  };
9
9
  };
10
10
  export type TableActionProps = ExtractPropTypes<typeof tableActionProps>;
11
+ export interface TableActionConfig {
12
+ itemProps?: TableActionItemProps;
13
+ }
11
14
  export {};
@@ -1,15 +1,15 @@
1
- import { TableActionItem } from './item.api';
1
+ import { TableActionItemProps } from './item.api';
2
2
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
3
  actions: {
4
- type: import("vue").PropType<(TableActionItem | null | undefined)[] | (TableActionItem | null | undefined)[][]>;
4
+ type: import("vue").PropType<(boolean | TableActionItemProps | null | undefined)[] | (boolean | TableActionItemProps | null | undefined)[][]>;
5
5
  default: () => never[];
6
6
  };
7
7
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
8
8
  actions: {
9
- type: import("vue").PropType<(TableActionItem | null | undefined)[] | (TableActionItem | null | undefined)[][]>;
9
+ type: import("vue").PropType<(boolean | TableActionItemProps | null | undefined)[] | (boolean | TableActionItemProps | null | undefined)[][]>;
10
10
  default: () => never[];
11
11
  };
12
12
  }>> & Readonly<{}>, {
13
- actions: (TableActionItem | null | undefined)[] | (TableActionItem | null | undefined)[][];
13
+ actions: (boolean | TableActionItemProps | null | undefined)[] | (boolean | TableActionItemProps | null | undefined)[][];
14
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
15
15
  export default _default;
@@ -1,8 +1,9 @@
1
- import { defineComponent, computed, createVNode, mergeProps } from 'vue';
1
+ import { defineComponent, computed, createVNode } from 'vue';
2
2
  import { tableActionProps } from './table-action.api.js';
3
3
  import stdin_default$2 from './item.js';
4
4
  import stdin_default$1 from './table-action.style.js';
5
5
  import { useComponentConfig } from '../config-provider/config-provider.api.js';
6
+ import { isObject } from '../../utils/is.js';
6
7
 
7
8
  var stdin_default = defineComponent({
8
9
  name: "CoTableAction",
@@ -25,10 +26,11 @@ var stdin_default = defineComponent({
25
26
  return createVNode("div", {
26
27
  "key": rowIndex,
27
28
  "class": `${prefixCls.value}-row`
28
- }, [actions.filter(Boolean).map((action, actionIndex) => {
29
- return createVNode(stdin_default$2, mergeProps({
30
- "key": actionIndex
31
- }, action), null);
29
+ }, [actions.filter(isObject).map((action, actionIndex) => {
30
+ return createVNode(stdin_default$2, {
31
+ "key": actionIndex,
32
+ "props": action
33
+ }, null);
32
34
  })]);
33
35
  })]);
34
36
  };
@@ -11,6 +11,9 @@ export declare const rootConfigProviderProps: {
11
11
  table: {
12
12
  type: import("vue").PropType<import("../components").TableConfig>;
13
13
  };
14
+ tableAction: {
15
+ type: import("vue").PropType<import("../components").TableActionConfig>;
16
+ };
14
17
  locale: {
15
18
  type: import("vue").PropType<import("../locale").Language>;
16
19
  };
@@ -10,6 +10,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
10
10
  table: {
11
11
  type: import("vue").PropType<import("../components").TableConfig>;
12
12
  };
13
+ tableAction: {
14
+ type: import("vue").PropType<import("../components").TableActionConfig>;
15
+ };
13
16
  locale: {
14
17
  type: import("vue").PropType<import("../locale").Language>;
15
18
  };
@@ -23,6 +26,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
23
26
  table: {
24
27
  type: import("vue").PropType<import("../components").TableConfig>;
25
28
  };
29
+ tableAction: {
30
+ type: import("vue").PropType<import("../components").TableActionConfig>;
31
+ };
26
32
  locale: {
27
33
  type: import("vue").PropType<import("../locale").Language>;
28
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",