cosey 0.6.31 → 0.6.33

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.
@@ -12,11 +12,11 @@ declare const _Table: {
12
12
  default: boolean;
13
13
  };
14
14
  columns: {
15
- type: import("vue").PropType<import("..").TableColumnProps[]>;
15
+ type: import("vue").PropType<import("..").MayBeTableColumnProps[]>;
16
16
  default: () => never[];
17
17
  };
18
18
  actionColumn: {
19
- type: import("vue").PropType<import("..").TableColumnProps>;
19
+ type: import("vue").PropType<import("..").MayBeTableColumnProps>;
20
20
  };
21
21
  pagination: {
22
22
  type: import("vue").PropType<boolean | import("element-plus").PaginationProps>;
@@ -319,7 +319,7 @@ declare const _Table: {
319
319
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
320
320
  tableLayout: "auto" | "fixed";
321
321
  border: boolean;
322
- columns: import("..").TableColumnProps[];
322
+ columns: import("..").MayBeTableColumnProps[];
323
323
  data: any[];
324
324
  immediate: boolean;
325
325
  className: string;
@@ -358,11 +358,11 @@ declare const _Table: {
358
358
  default: boolean;
359
359
  };
360
360
  columns: {
361
- type: import("vue").PropType<import("..").TableColumnProps[]>;
361
+ type: import("vue").PropType<import("..").MayBeTableColumnProps[]>;
362
362
  default: () => never[];
363
363
  };
364
364
  actionColumn: {
365
- type: import("vue").PropType<import("..").TableColumnProps>;
365
+ type: import("vue").PropType<import("..").MayBeTableColumnProps>;
366
366
  };
367
367
  pagination: {
368
368
  type: import("vue").PropType<boolean | import("element-plus").PaginationProps>;
@@ -665,7 +665,7 @@ declare const _Table: {
665
665
  }, {}, {}, {}, {
666
666
  tableLayout: "auto" | "fixed";
667
667
  border: boolean;
668
- columns: import("..").TableColumnProps[];
668
+ columns: import("..").MayBeTableColumnProps[];
669
669
  data: any[];
670
670
  immediate: boolean;
671
671
  className: string;
@@ -701,11 +701,11 @@ declare const _Table: {
701
701
  default: boolean;
702
702
  };
703
703
  columns: {
704
- type: import("vue").PropType<import("..").TableColumnProps[]>;
704
+ type: import("vue").PropType<import("..").MayBeTableColumnProps[]>;
705
705
  default: () => never[];
706
706
  };
707
707
  actionColumn: {
708
- type: import("vue").PropType<import("..").TableColumnProps>;
708
+ type: import("vue").PropType<import("..").MayBeTableColumnProps>;
709
709
  };
710
710
  pagination: {
711
711
  type: import("vue").PropType<boolean | import("element-plus").PaginationProps>;
@@ -866,7 +866,7 @@ declare const _Table: {
866
866
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
867
867
  tableLayout: "auto" | "fixed";
868
868
  border: boolean;
869
- columns: import("..").TableColumnProps[];
869
+ columns: import("..").MayBeTableColumnProps[];
870
870
  data: any[];
871
871
  immediate: boolean;
872
872
  className: string;
@@ -32,6 +32,7 @@ export type TableColumnProps<T = any> = Partial<Omit<ExtractPropTypes<typeof elT
32
32
  tooltip?: string;
33
33
  format?: (cellValue: any, row: any, column: TableColumnCtx<any>, index: number) => VNode | string;
34
34
  };
35
+ export type MayBeTableColumnProps = TableColumnProps | null | undefined | boolean;
35
36
  export declare const tableColumnProps: {
36
37
  slots: {
37
38
  type: PropType<TableColumnProps["slots"]>;
@@ -1,6 +1,6 @@
1
1
  import { TableColumnCtx, type PaginationProps } from 'element-plus';
2
2
  import { type PropType, type ExtractPropTypes, MaybeRef } from 'vue';
3
- import { type TableColumnProps } from './table-column/table-column';
3
+ import { type MayBeTableColumnProps } from './table-column/table-column';
4
4
  import { TableQueryExpose, type TableQueryProps } from './table-query/table-query';
5
5
  import { TableStatisticsColumn } from './table-stats/table-stats';
6
6
  export interface ToolbarConfig {
@@ -25,11 +25,11 @@ export declare const tableProps: {
25
25
  default: boolean;
26
26
  };
27
27
  columns: {
28
- type: PropType<TableColumnProps[]>;
28
+ type: PropType<MayBeTableColumnProps[]>;
29
29
  default: () => never[];
30
30
  };
31
31
  actionColumn: {
32
- type: PropType<TableColumnProps>;
32
+ type: PropType<MayBeTableColumnProps>;
33
33
  };
34
34
  pagination: {
35
35
  type: PropType<boolean | PaginationProps>;
@@ -48,7 +48,7 @@ const tableExtraProps = {
48
48
  default: () => []
49
49
  },
50
50
  actionColumn: {
51
- type: Object
51
+ type: null
52
52
  },
53
53
  pagination: {
54
54
  type: [Object, Boolean],
@@ -1,6 +1,5 @@
1
1
  import { type PaginationProps, type TableColumnCtx } from 'element-plus';
2
2
  import { type TableSlots, type TableExpose, type ToolbarConfig } from './table';
3
- import { type TableColumnProps } from './table-column/table-column';
4
3
  type __VLS_Slots = TableSlots;
5
4
  declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
5
  api: {
@@ -11,11 +10,11 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
11
10
  default: boolean;
12
11
  };
13
12
  columns: {
14
- type: import("vue").PropType<TableColumnProps[]>;
13
+ type: import("vue").PropType<import("..").MayBeTableColumnProps[]>;
15
14
  default: () => never[];
16
15
  };
17
16
  actionColumn: {
18
- type: import("vue").PropType<TableColumnProps>;
17
+ type: import("vue").PropType<import("..").MayBeTableColumnProps>;
19
18
  };
20
19
  pagination: {
21
20
  type: import("vue").PropType<boolean | PaginationProps>;
@@ -182,11 +181,11 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
182
181
  default: boolean;
183
182
  };
184
183
  columns: {
185
- type: import("vue").PropType<TableColumnProps[]>;
184
+ type: import("vue").PropType<import("..").MayBeTableColumnProps[]>;
186
185
  default: () => never[];
187
186
  };
188
187
  actionColumn: {
189
- type: import("vue").PropType<TableColumnProps>;
188
+ type: import("vue").PropType<import("..").MayBeTableColumnProps>;
190
189
  };
191
190
  pagination: {
192
191
  type: import("vue").PropType<boolean | PaginationProps>;
@@ -308,7 +307,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
308
307
  }>> & Readonly<{}>, {
309
308
  tableLayout: "auto" | "fixed";
310
309
  border: boolean;
311
- columns: TableColumnProps[];
310
+ columns: import("..").MayBeTableColumnProps[];
312
311
  data: any[];
313
312
  immediate: boolean;
314
313
  className: string;
@@ -107,7 +107,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
107
107
  });
108
108
  const renderedColumns = ref([]);
109
109
  const setRenderedColumns = () => {
110
- renderedColumns.value = cloneDeep([...props.columns, props.actionColumn].filter(Boolean));
110
+ renderedColumns.value = cloneDeep([...props.columns, props.actionColumn].filter(isObject));
111
111
  };
112
112
  const exportColumns = computed(() => {
113
113
  return renderedColumns.value?.filter(column => {
@@ -18,7 +18,7 @@ export interface UseUpsertOptions<Model, Row = Model> {
18
18
  onShow?: () => void;
19
19
  onShown?: () => void;
20
20
  onShownAdd?: (...args: any[]) => void;
21
- onShownEdit?: (...args: any[]) => void;
21
+ onShownEdit?: (row: Row, ...args: any[]) => void;
22
22
  detailsFetch?: (row: Row) => any;
23
23
  beforeFill?: (row: Row) => any;
24
24
  addFetch?: (...args: any[]) => any;
@@ -81,7 +81,7 @@ function useUpsert(options) {
81
81
  unref(onShow)?.();
82
82
  nextTick(() => {
83
83
  unref(onShown)?.();
84
- unref(onShownEdit)?.(...editParams);
84
+ unref(onShownEdit)?.(_row, ...editParams);
85
85
  });
86
86
  let filledRow = row.value;
87
87
  if (unref(detailsFetch)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.6.31",
3
+ "version": "0.6.33",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,10 +1,10 @@
1
1
  import { bookFormats } from './bookFormats';
2
2
  import type { ExportBookType, ExportExcelScheme } from './type';
3
- import { type TableColumnProps } from '../../components/table/table-column/table-column';
3
+ import { type MayBeTableColumnProps, type TableColumnProps } from '../../components/table/table-column/table-column';
4
4
  /**
5
5
  * 只取最底层的列组成表头
6
6
  */
7
- export declare function flatColumns(columns: TableColumnProps[]): TableColumnProps[];
7
+ export declare function flatColumns(columns: MayBeTableColumnProps[]): TableColumnProps[];
8
8
  export interface ExportExcelOptions {
9
9
  footerCount?: number;
10
10
  }
@@ -7,6 +7,7 @@ import { wb2xlsx } from './xlsx.js';
7
7
  import { wb2xml } from './xml.js';
8
8
  import { wb2csv } from './csv.js';
9
9
  import { wb2txt } from './txt.js';
10
+ import { isObject } from '../is.js';
10
11
 
11
12
  function downloadByUrl(url, filename) {
12
13
  const link = document.createElement("a");
@@ -59,8 +60,10 @@ async function writeFile(wb, bookType) {
59
60
  }
60
61
  function flatColumns(columns) {
61
62
  return columns.reduce((result, column) => {
62
- return result.concat(Array.isArray(column.columns) ? flatColumns(column.columns) : column);
63
- }, []);
63
+ return result.concat(
64
+ isObject(column) && Array.isArray(column.columns) ? flatColumns(column.columns) : column
65
+ );
66
+ }, []).filter(isObject);
64
67
  }
65
68
  function columns2aoa(columns) {
66
69
  let aoa = [];