@tmagic/table 1.5.0-beta.5 → 1.5.0-beta.6

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.
@@ -237,6 +237,7 @@ const formatter = (item, row) => {
237
237
  return row[item.prop];
238
238
  }
239
239
  };
240
+ const createColumns = (columns) => columns;
240
241
 
241
242
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
242
243
  ...{
@@ -555,4 +556,4 @@ const index = {
555
556
  }
556
557
  };
557
558
 
558
- export { _sfc_main as MagicTable, index as default, formatter };
559
+ export { _sfc_main as MagicTable, createColumns, index as default, formatter };
@@ -238,6 +238,7 @@
238
238
  return row[item.prop];
239
239
  }
240
240
  };
241
+ const createColumns = (columns) => columns;
241
242
 
242
243
  const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
243
244
  ...{
@@ -557,6 +558,7 @@
557
558
  };
558
559
 
559
560
  exports.MagicTable = _sfc_main;
561
+ exports.createColumns = createColumns;
560
562
  exports.default = index;
561
563
  exports.formatter = formatter;
562
564
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.0-beta.5",
2
+ "version": "1.5.0-beta.6",
3
3
  "name": "@tmagic/table",
4
4
  "type": "module",
5
5
  "main": "dist/tmagic-table.umd.cjs",
@@ -46,8 +46,8 @@
46
46
  "peerDependencies": {
47
47
  "vue": "^3.4.35",
48
48
  "typescript": "*",
49
- "@tmagic/design": "1.5.0-beta.5",
50
- "@tmagic/form": "1.5.0-beta.5"
49
+ "@tmagic/design": "1.5.0-beta.6",
50
+ "@tmagic/form": "1.5.0-beta.6"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "typescript": {
package/src/schema.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  import { FormConfig, FormValue } from '@tmagic/form';
20
20
 
21
21
  export interface ColumnActionConfig {
22
- type?: 'delete' | 'copy' | 'edit';
22
+ type?: 'delete' | 'copy' | 'edit' | string;
23
23
  buttonType?: string;
24
24
  display?: (row: any) => boolean;
25
25
  text?: string | ((row: any) => string);
@@ -46,6 +46,7 @@ export interface ColumnConfig<T = any> {
46
46
  type?: 'popover' | 'expand' | 'component' | string | ((value: any, row: T) => string);
47
47
  text?: string;
48
48
  prop?: string;
49
+ name?: string;
49
50
  showHeader?: boolean;
50
51
  table?: ColumnConfig[];
51
52
  formatter?: 'datetime' | ((item: any, row: T) => any);
package/src/utils.ts CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  import { datetimeFormatter } from '@tmagic/form';
20
20
 
21
- import { ColumnConfig } from './schema';
21
+ import type { ColumnConfig } from './schema';
22
22
 
23
23
  export const formatter = (item: ColumnConfig, row: any) => {
24
24
  if (!item.prop) return '';
@@ -37,3 +37,5 @@ export const formatter = (item: ColumnConfig, row: any) => {
37
37
  return row[item.prop];
38
38
  }
39
39
  };
40
+
41
+ export const createColumns = (columns: ColumnConfig[]) => columns;
package/types/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { App } from 'vue';
3
3
  import { FormConfig, FormValue } from '@tmagic/form';
4
4
 
5
5
  interface ColumnActionConfig {
6
- type?: 'delete' | 'copy' | 'edit';
6
+ type?: 'delete' | 'copy' | 'edit' | string;
7
7
  buttonType?: string;
8
8
  display?: (row: any) => boolean;
9
9
  text?: string | ((row: any) => string);
@@ -31,6 +31,7 @@ interface ColumnConfig<T = any> {
31
31
  type?: 'popover' | 'expand' | 'component' | string | ((value: any, row: T) => string);
32
32
  text?: string;
33
33
  prop?: string;
34
+ name?: string;
34
35
  showHeader?: boolean;
35
36
  table?: ColumnConfig[];
36
37
  formatter?: 'datetime' | ((item: any, row: T) => any);
@@ -159,9 +160,10 @@ type __VLS_TypePropsToOption<T> = {
159
160
  };
160
161
 
161
162
  declare const formatter: (item: ColumnConfig, row: any) => any;
163
+ declare const createColumns: (columns: ColumnConfig[]) => ColumnConfig<any>[];
162
164
 
163
165
  declare const _default: {
164
166
  install(app: App): void;
165
167
  };
166
168
 
167
- export { type ColumnActionConfig, type ColumnConfig, _default$1 as MagicTable, _default as default, formatter };
169
+ export { type ColumnActionConfig, type ColumnConfig, _default$1 as MagicTable, createColumns, _default as default, formatter };