cosey 0.8.2 → 0.9.1

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.
@@ -7,6 +7,7 @@ import { ConfigProvider } from './config-provider';
7
7
  import { Container } from './container';
8
8
  import { ContextMenu, ContextMenuItem, ContextSubMenu } from './context-menu';
9
9
  import { Copy } from './copy';
10
+ import { Descriptions } from './descriptions';
10
11
  import { DndSort, DndSortItem } from './dnd-sort';
11
12
  import { Editor } from './editor';
12
13
  import { Field } from './field';
@@ -63,6 +64,7 @@ declare module 'vue' {
63
64
  CoContextMenuItem: typeof ContextMenuItem;
64
65
  CoContextSubMenu: typeof ContextSubMenu;
65
66
  CoCopy: typeof Copy;
67
+ CoDescriptions: typeof Descriptions;
66
68
  CoDndSort: typeof DndSort;
67
69
  CoDndSortItem: typeof DndSortItem;
68
70
  CoEditor: typeof Editor;
@@ -111,4 +113,4 @@ declare module 'vue' {
111
113
  CoWeekRangePicker: typeof WeekRangePicker;
112
114
  }
113
115
  }
114
- export { AudioCard, AudioViewer, Card, Close, Col, ConfigProvider, Container, ContextMenu, ContextMenuItem, ContextSubMenu, Copy, DndSort, DndSortItem, Editor, Field, FileCard, Form, FormDialog, FormDrawer, FormGroup, FormItem, FormList, FormQuery, Highlight, HorizontalTree, Icon, IconifyIcon, ImageCard, InputNumberRange, LongText, Mask, MediaCard, MediaCardGroup, MediaViewer, NumberFormat, OnlyChild, OptionalWrapper, Panel, RemoteSelect, Ribbon, Row, ScrollView, SnugMenu, SnugMenuItem, StackDialog, SvgIcon, SvgaCard, SvgaViewer, Table, TableAction, Toggle, Transition, TransitionGroup, Upload, VideoCard, VideoViewer, WeekRangePicker, };
116
+ export { AudioCard, AudioViewer, Card, Close, Col, ConfigProvider, Container, ContextMenu, ContextMenuItem, ContextSubMenu, Copy, Descriptions, DndSort, DndSortItem, Editor, Field, FileCard, Form, FormDialog, FormDrawer, FormGroup, FormItem, FormList, FormQuery, Highlight, HorizontalTree, Icon, IconifyIcon, ImageCard, InputNumberRange, LongText, Mask, MediaCard, MediaCardGroup, MediaViewer, NumberFormat, OnlyChild, OptionalWrapper, Panel, RemoteSelect, Ribbon, Row, ScrollView, SnugMenu, SnugMenuItem, StackDialog, SvgIcon, SvgaCard, SvgaViewer, Table, TableAction, Toggle, Transition, TransitionGroup, Upload, VideoCard, VideoViewer, WeekRangePicker, };
@@ -7,6 +7,7 @@ export { ConfigProvider } from './config-provider/index.js';
7
7
  export { Container } from './container/index.js';
8
8
  export { ContextMenu, ContextMenuItem, ContextSubMenu } from './context-menu/index.js';
9
9
  export { Copy } from './copy/index.js';
10
+ export { Descriptions } from './descriptions/index.js';
10
11
  export { DndSort, DndSortItem } from './dnd-sort/index.js';
11
12
  export { Editor } from './editor/index.js';
12
13
  export { Field } from './field/index.js';
@@ -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
  };
@@ -0,0 +1,28 @@
1
+ import type { ExtractPropTypes, PropType, SlotsType } from 'vue';
2
+ export declare const descriptionsProps: {
3
+ data: {
4
+ type: PropType<any[][]>;
5
+ default: () => never[];
6
+ };
7
+ labelAlign: {
8
+ type: PropType<"left" | "center" | "right">;
9
+ default: string;
10
+ };
11
+ border: {
12
+ type: BooleanConstructor;
13
+ default: boolean;
14
+ };
15
+ colon: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
19
+ };
20
+ export type DescriptionsProps = ExtractPropTypes<typeof descriptionsProps>;
21
+ export interface DescriptionsSlots {
22
+ default: {};
23
+ }
24
+ export declare const descriptionsSlots: SlotsType<DescriptionsSlots>;
25
+ export declare const descriptionsEmits: {};
26
+ export type DescriptionsEmits = typeof descriptionsEmits;
27
+ export interface DescriptionsExpose {
28
+ }
@@ -0,0 +1,22 @@
1
+ const descriptionsProps = {
2
+ data: {
3
+ type: Array,
4
+ default: () => []
5
+ },
6
+ labelAlign: {
7
+ type: String,
8
+ default: "right"
9
+ },
10
+ border: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ colon: {
15
+ type: Boolean,
16
+ default: true
17
+ }
18
+ };
19
+ const descriptionsSlots = {};
20
+ const descriptionsEmits = {};
21
+
22
+ export { descriptionsEmits, descriptionsProps, descriptionsSlots };
@@ -0,0 +1,41 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ data: {
3
+ type: import("vue").PropType<any[][]>;
4
+ default: () => never[];
5
+ };
6
+ labelAlign: {
7
+ type: import("vue").PropType<"left" | "center" | "right">;
8
+ default: string;
9
+ };
10
+ border: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ colon: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
18
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ data: {
20
+ type: import("vue").PropType<any[][]>;
21
+ default: () => never[];
22
+ };
23
+ labelAlign: {
24
+ type: import("vue").PropType<"left" | "center" | "right">;
25
+ default: string;
26
+ };
27
+ border: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
31
+ colon: {
32
+ type: BooleanConstructor;
33
+ default: boolean;
34
+ };
35
+ }>> & Readonly<{}>, {
36
+ border: boolean;
37
+ data: any[][];
38
+ labelAlign: "left" | "right" | "center";
39
+ colon: boolean;
40
+ }, import("vue").SlotsType<import("./descriptions.api").DescriptionsSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
41
+ export default _default;
@@ -0,0 +1,37 @@
1
+ import { defineComponent, createVNode } from 'vue';
2
+ import { descriptionsEmits, descriptionsSlots, descriptionsProps } from './descriptions.api.js';
3
+ import stdin_default$1 from './descriptions.style.js';
4
+ import { useComponentConfig } from '../config-provider/config-provider.api.js';
5
+
6
+ var stdin_default = defineComponent({
7
+ name: "CoDescriptions",
8
+ props: descriptionsProps,
9
+ slots: descriptionsSlots,
10
+ emits: descriptionsEmits,
11
+ setup(props) {
12
+ const {
13
+ prefixCls
14
+ } = useComponentConfig("descriptions", props);
15
+ const {
16
+ hashId
17
+ } = stdin_default$1(prefixCls);
18
+ return () => {
19
+ return createVNode("table", {
20
+ "class": [hashId.value, prefixCls.value, `is-label-${props.labelAlign}`, {
21
+ "is-bordered": props.border,
22
+ "has-colon": props.colon
23
+ }]
24
+ }, [createVNode("tbody", null, [props.data?.map((row, i) => {
25
+ return createVNode("tr", {
26
+ "key": i
27
+ }, [row.map((cell, j) => {
28
+ return createVNode("td", {
29
+ "key": j
30
+ }, [createVNode("span", null, [cell])]);
31
+ })]);
32
+ })])]);
33
+ };
34
+ }
35
+ });
36
+
37
+ export { stdin_default as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: (_prefixCls?: import("vue").ComputedRef<string> | string, themeManager?: import("../theme/theme-context").ThemeManager) => {
2
+ hashId: import("vue").Ref<string, string>;
3
+ };
4
+ export default _default;
@@ -0,0 +1,69 @@
1
+ import { getSimpleStyleHook } from '../theme/getSimpleStyleHook.js';
2
+
3
+ var stdin_default = getSimpleStyleHook("CoDescriptions", (token) => {
4
+ const { componentCls } = token;
5
+ return {
6
+ [`${componentCls}`]: {
7
+ borderCollapse: "collapse",
8
+ tr: {
9
+ background: "transparent"
10
+ },
11
+ td: {
12
+ "&:nth-child(2n-1)": {
13
+ color: token.colorTextTertiary
14
+ }
15
+ },
16
+ "&.is-label-left": {
17
+ td: {
18
+ "&:nth-child(2n-1)": {
19
+ textAlign: "left"
20
+ }
21
+ }
22
+ },
23
+ "&.is-label-center": {
24
+ td: {
25
+ "&:nth-child(2n-1)": {
26
+ textAlign: "center"
27
+ }
28
+ }
29
+ },
30
+ "&.is-label-right": {
31
+ td: {
32
+ "&:nth-child(2n-1)": {
33
+ textAlign: "right"
34
+ }
35
+ }
36
+ },
37
+ "&:not(.is-bordered)": {
38
+ td: {
39
+ "&:nth-child(2n)": {
40
+ paddingInlineStart: token.paddingXS
41
+ },
42
+ "&:nth-child(2n-1)": {
43
+ "&:not(:first-child)": {
44
+ paddingInlineStart: token.paddingSM
45
+ }
46
+ }
47
+ }
48
+ },
49
+ "&.is-bordered": {
50
+ td: {
51
+ border: `1px solid ${token.colorBorderSecondary}`,
52
+ paddingBlock: token.paddingXXS,
53
+ paddingInline: token.paddingXS
54
+ }
55
+ },
56
+ "&.has-colon": {
57
+ td: {
58
+ "&:nth-child(2n-1)": {
59
+ "span::after": {
60
+ content: '": "'
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ };
67
+ });
68
+
69
+ export { stdin_default as default };
@@ -0,0 +1,82 @@
1
+ export * from './descriptions';
2
+ declare const _Descriptions: {
3
+ new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
4
+ data: {
5
+ type: import("vue").PropType<any[][]>;
6
+ default: () => never[];
7
+ };
8
+ labelAlign: {
9
+ type: import("vue").PropType<"left" | "center" | "right">;
10
+ default: string;
11
+ };
12
+ border: {
13
+ type: BooleanConstructor;
14
+ default: boolean;
15
+ };
16
+ colon: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
20
+ }>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
21
+ border: boolean;
22
+ data: any[][];
23
+ labelAlign: "left" | "right" | "center";
24
+ colon: boolean;
25
+ }, true, {}, import("vue").SlotsType<import("./descriptions.api").DescriptionsSlots>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
26
+ P: {};
27
+ B: {};
28
+ D: {};
29
+ C: {};
30
+ M: {};
31
+ Defaults: {};
32
+ }, Readonly<import("vue").ExtractPropTypes<{
33
+ data: {
34
+ type: import("vue").PropType<any[][]>;
35
+ default: () => never[];
36
+ };
37
+ labelAlign: {
38
+ type: import("vue").PropType<"left" | "center" | "right">;
39
+ default: string;
40
+ };
41
+ border: {
42
+ type: BooleanConstructor;
43
+ default: boolean;
44
+ };
45
+ colon: {
46
+ type: BooleanConstructor;
47
+ default: boolean;
48
+ };
49
+ }>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
50
+ border: boolean;
51
+ data: any[][];
52
+ labelAlign: "left" | "right" | "center";
53
+ colon: boolean;
54
+ }>;
55
+ __isFragment?: never;
56
+ __isTeleport?: never;
57
+ __isSuspense?: never;
58
+ } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
59
+ data: {
60
+ type: import("vue").PropType<any[][]>;
61
+ default: () => never[];
62
+ };
63
+ labelAlign: {
64
+ type: import("vue").PropType<"left" | "center" | "right">;
65
+ default: string;
66
+ };
67
+ border: {
68
+ type: BooleanConstructor;
69
+ default: boolean;
70
+ };
71
+ colon: {
72
+ type: BooleanConstructor;
73
+ default: boolean;
74
+ };
75
+ }>> & Readonly<{}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
76
+ border: boolean;
77
+ data: any[][];
78
+ labelAlign: "left" | "right" | "center";
79
+ colon: boolean;
80
+ }, {}, string, import("vue").SlotsType<import("./descriptions.api").DescriptionsSlots>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("vue").Plugin;
81
+ export { _Descriptions as Descriptions };
82
+ export default _Descriptions;
@@ -0,0 +1,7 @@
1
+ import { withInstall } from '../utils.js';
2
+ import stdin_default$1 from './descriptions.js';
3
+
4
+ const _Descriptions = withInstall(stdin_default$1);
5
+ var stdin_default = _Descriptions;
6
+
7
+ export { _Descriptions as Descriptions, stdin_default as default };
@@ -8,6 +8,7 @@ export * from './container';
8
8
  export * from './context-menu';
9
9
  export * from './copy';
10
10
  export * from './cssinjs';
11
+ export * from './descriptions';
11
12
  export * from './dnd-sort';
12
13
  export * from './editor';
13
14
  export * from './field';
@@ -7,6 +7,7 @@ export { ConfigProvider } from './config-provider/index.js';
7
7
  export { Container } from './container/index.js';
8
8
  export { ContextMenu, ContextMenuItem, ContextSubMenu } from './context-menu/index.js';
9
9
  export { Copy } from './copy/index.js';
10
+ export { Descriptions } from './descriptions/index.js';
10
11
  export { DndSort, DndSortItem } from './dnd-sort/index.js';
11
12
  export { Editor } from './editor/index.js';
12
13
  export { Field } from './field/index.js';
@@ -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<(import("./item.api").TableActionItemProps | null | undefined)[] | (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: (import("./item.api").TableActionItemProps | null | undefined)[] | (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<(import("./item.api").TableActionItemProps | null | undefined)[] | (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: (import("./item.api").TableActionItemProps | null | undefined)[] | (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<(import("./item.api").TableActionItemProps | null | undefined)[] | (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: (import("./item.api").TableActionItemProps | null | undefined)[] | (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;
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<(TableActionItemProps | null | undefined)[] | (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<(TableActionItemProps | null | undefined)[] | (TableActionItemProps | null | undefined)[][]>;
10
10
  default: () => never[];
11
11
  };
12
12
  }>> & Readonly<{}>, {
13
- actions: (TableActionItem | null | undefined)[] | (TableActionItem | null | undefined)[][];
13
+ actions: (TableActionItemProps | null | undefined)[] | (TableActionItemProps | null | undefined)[][];
14
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
15
15
  export default _default;
@@ -1,4 +1,4 @@
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';
@@ -26,9 +26,10 @@ var stdin_default = defineComponent({
26
26
  "key": rowIndex,
27
27
  "class": `${prefixCls.value}-row`
28
28
  }, [actions.filter(Boolean).map((action, actionIndex) => {
29
- return createVNode(stdin_default$2, mergeProps({
30
- "key": actionIndex
31
- }, action), null);
29
+ return createVNode(stdin_default$2, {
30
+ "key": actionIndex,
31
+ "props": action
32
+ }, null);
32
33
  })]);
33
34
  })]);
34
35
  };
@@ -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.8.2",
3
+ "version": "0.9.1",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",