vxe-table 3.7.0-beta.5 → 3.7.0-beta.7

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.
Files changed (137) hide show
  1. package/README.md +4 -8
  2. package/lib/edit/src/mixin.js +3 -3
  3. package/lib/edit/src/mixin.min.js +1 -1
  4. package/lib/filter/src/mixin.js +13 -7
  5. package/lib/filter/src/mixin.min.js +1 -1
  6. package/lib/form/src/form.js +27 -5
  7. package/lib/form/src/form.min.js +1 -1
  8. package/lib/grid/src/grid.js +7 -3
  9. package/lib/grid/src/grid.min.js +1 -1
  10. package/lib/icon/style/style.css +1 -1
  11. package/lib/icon/style/style.min.css +1 -1
  12. package/lib/index.css +1 -1
  13. package/lib/index.umd.js +394 -127
  14. package/lib/index.umd.min.js +1 -1
  15. package/lib/input/src/input.js +11 -1
  16. package/lib/input/src/input.min.js +1 -1
  17. package/lib/locale/lang/en-US.js +7 -0
  18. package/lib/locale/lang/en-US.min.js +1 -1
  19. package/lib/locale/lang/en-US.umd.js +7 -0
  20. package/lib/locale/lang/es-ES.js +7 -0
  21. package/lib/locale/lang/es-ES.min.js +1 -1
  22. package/lib/locale/lang/es-ES.umd.js +7 -0
  23. package/lib/locale/lang/ja-JP.js +7 -0
  24. package/lib/locale/lang/ja-JP.min.js +1 -1
  25. package/lib/locale/lang/ja-JP.umd.js +7 -0
  26. package/lib/locale/lang/zh-CN.js +7 -0
  27. package/lib/locale/lang/zh-CN.min.js +1 -1
  28. package/lib/locale/lang/zh-CN.umd.js +7 -0
  29. package/lib/locale/lang/zh-HK.min.js +1 -1
  30. package/lib/locale/lang/zh-HK.umd.js +7 -0
  31. package/lib/locale/lang/zh-MO.min.js +1 -1
  32. package/lib/locale/lang/zh-MO.umd.js +7 -0
  33. package/lib/locale/lang/zh-TC.js +7 -0
  34. package/lib/locale/lang/zh-TC.min.js +1 -1
  35. package/lib/locale/lang/zh-TC.umd.js +7 -0
  36. package/lib/locale/lang/zh-TW.min.js +1 -1
  37. package/lib/locale/lang/zh-TW.umd.js +7 -0
  38. package/lib/menu/src/mixin.js +3 -3
  39. package/lib/menu/src/mixin.min.js +1 -1
  40. package/lib/select/src/select.js +6 -1
  41. package/lib/select/src/select.min.js +1 -1
  42. package/lib/style.css +1 -1
  43. package/lib/style.min.css +1 -1
  44. package/lib/table/src/cell.js +4 -2
  45. package/lib/table/src/cell.min.js +1 -1
  46. package/lib/table/src/columnInfo.js +6 -6
  47. package/lib/table/src/columnInfo.min.js +1 -1
  48. package/lib/table/src/methods.js +74 -47
  49. package/lib/table/src/methods.min.js +1 -1
  50. package/lib/table/src/table.js +12 -25
  51. package/lib/table/src/table.min.js +1 -1
  52. package/lib/table/style/style.css +2 -2
  53. package/lib/table/style/style.min.css +1 -1
  54. package/lib/textarea/src/textarea.js +6 -1
  55. package/lib/textarea/src/textarea.min.js +1 -1
  56. package/lib/toolbar/src/toolbar.js +18 -6
  57. package/lib/toolbar/src/toolbar.min.js +1 -1
  58. package/lib/tools/log.js +1 -1
  59. package/lib/tools/log.min.js +1 -1
  60. package/lib/v-x-e-table/index.js +3 -1
  61. package/lib/v-x-e-table/index.min.js +1 -1
  62. package/lib/v-x-e-table/src/commands.js +58 -2
  63. package/lib/v-x-e-table/src/commands.min.js +1 -1
  64. package/lib/v-x-e-table/src/conf.js +4 -1
  65. package/lib/v-x-e-table/src/conf.min.js +1 -1
  66. package/lib/v-x-e-table/src/formats.js +58 -2
  67. package/lib/v-x-e-table/src/formats.min.js +1 -1
  68. package/lib/v-x-e-table/src/menus.js +58 -2
  69. package/lib/v-x-e-table/src/menus.min.js +1 -1
  70. package/lib/v-x-e-table/src/store.js +5 -2
  71. package/lib/v-x-e-table/src/store.min.js +1 -1
  72. package/lib/v-x-e-table/src/validators.js +15 -0
  73. package/lib/v-x-e-table/src/validators.min.js +1 -0
  74. package/lib/validator/src/mixin.js +26 -4
  75. package/lib/validator/src/mixin.min.js +1 -1
  76. package/package.json +2 -2
  77. package/packages/edit/src/mixin.js +3 -3
  78. package/packages/filter/src/mixin.js +5 -1
  79. package/packages/form/src/form.js +27 -6
  80. package/packages/grid/src/grid.js +7 -3
  81. package/packages/input/src/input.js +9 -1
  82. package/packages/locale/lang/en-US.js +7 -0
  83. package/packages/locale/lang/es-ES.js +7 -0
  84. package/packages/locale/lang/ja-JP.js +7 -0
  85. package/packages/locale/lang/zh-CN.js +7 -0
  86. package/packages/locale/lang/zh-TC.js +7 -0
  87. package/packages/menu/src/mixin.js +3 -3
  88. package/packages/select/src/select.js +4 -1
  89. package/packages/table/src/cell.js +4 -2
  90. package/packages/table/src/columnInfo.js +6 -6
  91. package/packages/table/src/methods.js +67 -46
  92. package/packages/table/src/table.js +6 -2
  93. package/packages/textarea/src/textarea.js +4 -1
  94. package/packages/toolbar/src/toolbar.js +18 -6
  95. package/packages/v-x-e-table/index.js +2 -0
  96. package/packages/v-x-e-table/src/commands.js +48 -2
  97. package/packages/v-x-e-table/src/conf.js +4 -1
  98. package/packages/v-x-e-table/src/formats.js +48 -2
  99. package/packages/v-x-e-table/src/menus.js +48 -2
  100. package/packages/v-x-e-table/src/store.js +4 -2
  101. package/packages/v-x-e-table/src/validators.js +7 -0
  102. package/packages/validator/src/mixin.js +25 -4
  103. package/styles/table.scss +2 -2
  104. package/types/colgroup.d.ts +3 -1
  105. package/types/column.d.ts +3 -0
  106. package/types/edit.d.ts +4 -2
  107. package/types/export.d.ts +2 -0
  108. package/types/filter.d.ts +3 -1
  109. package/types/footer.d.ts +3 -1
  110. package/types/form-item.d.ts +2 -0
  111. package/types/form.d.ts +16 -12
  112. package/types/grid.d.ts +3 -0
  113. package/types/header.d.ts +3 -1
  114. package/types/index.d.ts +1 -1
  115. package/types/input.d.ts +2 -0
  116. package/types/list.d.ts +1 -1
  117. package/types/menu.d.ts +2 -0
  118. package/types/modal.d.ts +7 -3
  119. package/types/pulldown.d.ts +2 -3
  120. package/types/table.d.ts +33 -26
  121. package/types/textarea.d.ts +1 -0
  122. package/types/toolbar.d.ts +2 -0
  123. package/types/tooltip.d.ts +1 -1
  124. package/types/v-x-e-table/commands.d.ts +23 -13
  125. package/types/v-x-e-table/formats.d.ts +21 -12
  126. package/types/v-x-e-table/index.d.ts +31 -24
  127. package/types/v-x-e-table/interceptor.d.ts +1 -1
  128. package/types/v-x-e-table/menus.d.ts +17 -6
  129. package/types/v-x-e-table/renderer.d.ts +5 -3
  130. package/types/v-x-e-table/validators.d.ts +30 -0
  131. package/types/validator.d.ts +15 -4
  132. /package/lib/icon/style/{iconfont.1689384538396.ttf → iconfont.1690156580206.ttf} +0 -0
  133. /package/lib/icon/style/{iconfont.1689384538396.woff → iconfont.1690156580206.woff} +0 -0
  134. /package/lib/icon/style/{iconfont.1689384538396.woff2 → iconfont.1690156580206.woff2} +0 -0
  135. /package/lib/{iconfont.1689384538396.ttf → iconfont.1690156580206.ttf} +0 -0
  136. /package/lib/{iconfont.1689384538396.woff → iconfont.1690156580206.woff} +0 -0
  137. /package/lib/{iconfont.1689384538396.woff2 → iconfont.1690156580206.woff2} +0 -0
@@ -1,19 +1,29 @@
1
1
  import { ToolbarButtonConfig } from '../toolbar'
2
- import { GridRenderParams } from './renderer'
2
+ import { Table } from '../table'
3
3
 
4
- declare function commandsFunc(params: CommandsParams, ...args: any[]): any;
4
+ /* eslint-disable no-use-before-define */
5
5
 
6
- /**
7
- * 全局指令
8
- */
9
- export class VxeGlobalCommands {
10
- mixin(map: { [type: string]: typeof commandsFunc }): VxeGlobalCommands;
11
- get(type: string): typeof commandsFunc;
12
- add(type: string, callback: typeof commandsFunc): VxeGlobalCommands;
13
- delete(type: string): VxeGlobalCommands;
6
+ export namespace VxeGlobalCommandsHandles {
7
+ export interface CommandsOptions {
8
+ commandMethod?: (params: CommandMethodParams, ...args: any[]) => void
9
+ }
10
+ export interface CommandMethodParams {
11
+ $table: Table;
12
+ code: string;
13
+ button?: ToolbarButtonConfig;
14
+ }
14
15
  }
15
16
 
16
- export interface CommandsParams extends GridRenderParams {
17
- code: string;
18
- button?: ToolbarButtonConfig;
17
+ /**
18
+ * 全局格式化
19
+ */
20
+ export interface VxeGlobalCommands {
21
+ mixin(opts: {
22
+ [name: string]: VxeGlobalCommandsHandles.CommandsOptions | ((params: VxeGlobalCommandsHandles.CommandMethodParams, ...args: any[]) => void)
23
+ }): VxeGlobalCommands
24
+ has(name: string): boolean
25
+ get(name: string): VxeGlobalCommandsHandles.CommandsOptions
26
+ add(name: string, options: VxeGlobalCommandsHandles.CommandsOptions | ((params: VxeGlobalCommandsHandles.CommandMethodParams, ...args: any[]) => void)): VxeGlobalCommands
27
+ delete(name: string): void
28
+ forEach(callback: (options: VxeGlobalCommandsHandles.CommandsOptions, name: string) => void): void
19
29
  }
@@ -1,19 +1,28 @@
1
1
  import { ColumnInfo } from '../column'
2
2
 
3
- declare function formatsFunc(params: FormatsParams, ...args: any[]): any;
3
+ /* eslint-disable no-use-before-define */
4
+
5
+ export namespace VxeGlobalFormatsHandles {
6
+ export interface FormatsOptions {
7
+ formatMethod?: (params: FormatMethodParams, ...args: any[]) => string | number
8
+ }
9
+ export interface FormatMethodParams {
10
+ cellValue: any
11
+ row: any
12
+ column: ColumnInfo
13
+ }
14
+ }
4
15
 
5
16
  /**
6
17
  * 全局格式化
7
18
  */
8
- export class VxeGlobalFormats {
9
- mixin(map: { [type: string]: typeof formatsFunc }): VxeGlobalFormats;
10
- get(type: string): typeof formatsFunc;
11
- add(type: string, callback: typeof formatsFunc): VxeGlobalFormats;
12
- delete(type: string): VxeGlobalFormats;
13
- }
14
-
15
- export interface FormatsParams {
16
- cellValue: any;
17
- row: any,
18
- column: ColumnInfo;
19
+ export interface VxeGlobalFormats {
20
+ mixin(opts: {
21
+ [name: string]: VxeGlobalFormatsHandles.FormatsOptions | ((params: VxeGlobalFormatsHandles.FormatMethodParams, ...args: any[]) => string | number)
22
+ }): VxeGlobalFormats
23
+ has(name: string): boolean
24
+ get(name: string): VxeGlobalFormatsHandles.FormatsOptions
25
+ add(name: string, options: VxeGlobalFormatsHandles.FormatsOptions | ((params: VxeGlobalFormatsHandles.FormatMethodParams, ...args: any[]) => string | number)): VxeGlobalFormats
26
+ delete(name: string): void
27
+ forEach(callback: (options: VxeGlobalFormatsHandles.FormatsOptions, name: string) => void): void
19
28
  }
@@ -8,25 +8,28 @@ import { VxeGlobalInterceptor } from './interceptor'
8
8
  import { VxeGlobalCommands } from './commands'
9
9
  import { VxeGlobalFormats } from './formats'
10
10
  import { VxeGlobalMenus } from './menus'
11
+ import { VxeGlobalValidators } from './validators'
11
12
  import { VxeGlobalSetup } from './setup'
12
13
 
14
+ /* eslint-disable no-use-before-define */
15
+
13
16
  export type VxeGlobalI18n = (key: string, args?: any) => number | string;
14
17
  export type VxeGlobalTranslate = (key: string, args?: any) => string;
15
18
  export type VxeGlobalUse = (plugin: VXETablePluginObject, ...options: any[]) => VXETableCore;
16
19
 
17
- export const setup: VxeGlobalSetup;
18
- export const interceptor: VxeGlobalInterceptor;
19
- export const renderer: VxeGlobalRenderer;
20
- export const commands: VxeGlobalCommands;
21
- export const formats: VxeGlobalFormats;
22
- export const menus: VxeGlobalMenus;
23
- export const modal: ModalController;
24
- export const saveFile: SaveFileFunction;
25
- export const readFile: ReadFileFunction;
26
- export const print: PrintFunction;
27
- export const t: VxeGlobalI18n;
28
- export const _t: VxeGlobalTranslate;
29
- export const use: VxeGlobalUse;
20
+ export const setup: VxeGlobalSetup
21
+ export const interceptor: VxeGlobalInterceptor
22
+ export const renderer: VxeGlobalRenderer
23
+ export const commands: VxeGlobalCommands
24
+ export const formats: VxeGlobalFormats
25
+ export const menus: VxeGlobalMenus
26
+ export const modal: ModalController
27
+ export const saveFile: SaveFileFunction
28
+ export const readFile: ReadFileFunction
29
+ export const print: PrintFunction
30
+ export const t: VxeGlobalI18n
31
+ export const _t: VxeGlobalTranslate
32
+ export const use: VxeGlobalUse
30
33
 
31
34
  export interface VXETablePluginObject {
32
35
  install(vxetable: VXETableCore, ...options: any[]): void;
@@ -71,6 +74,10 @@ export interface VXETableCore {
71
74
  * Table context menu
72
75
  */
73
76
  menus: VxeGlobalMenus;
77
+ /**
78
+ * Validators table/form
79
+ */
80
+ validators: VxeGlobalValidators
74
81
  /**
75
82
  * 弹窗
76
83
  */
@@ -101,16 +108,16 @@ export interface VXETableCore {
101
108
  }
102
109
 
103
110
  /**
104
- * 一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟滚动、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、虚拟列表、弹窗、自定义模板、渲染器、贼灵活的配置项等...
111
+ * 一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、JSON 配置式为零代码而设计...
105
112
  */
106
- export const VXETable: VXETableCore
113
+ export const VXETable: VXETableCore
114
+
115
+ export * from './renderer'
116
+ export * from './interceptor'
117
+ export * from './commands'
118
+ export * from './formats'
119
+ export * from './menus'
120
+ export * from './validators'
121
+ export * from './setup'
107
122
 
108
- export * from './renderer'
109
- export * from './interceptor'
110
- export * from './commands'
111
- export * from './formats'
112
- export * from './menus'
113
- export * from './setup'
114
-
115
- export default VXETable
116
-
123
+ export default VXETable
@@ -19,7 +19,7 @@ export interface InterceptorParams extends GridRenderParams {
19
19
  $event: any;
20
20
  }
21
21
 
22
- export interface InterceptorKeydownParams extends InterceptorParams { }
22
+ export type InterceptorKeydownParams = InterceptorParams
23
23
 
24
24
  export interface InterceptorExportParams extends InterceptorParams {
25
25
  options: TableExportConfig;
@@ -1,13 +1,24 @@
1
1
  import { MenuLinkParams } from '../menu'
2
2
 
3
- declare function menuFunc (params: MenuLinkParams, event: any): any;
3
+ /* eslint-disable no-use-before-define */
4
+
5
+ export namespace VxeGlobalMenusHandles {
6
+ export type MenusOption = {
7
+ menuMethod?: (params: MenuMethodParams, event: Event) => any
8
+ }
9
+ export type MenuMethodParams = MenuLinkParams
10
+ }
4
11
 
5
12
  /**
6
13
  * 全局快捷菜单
7
14
  */
8
- export class VxeGlobalMenus {
9
- mixin(map: { [type: string]: typeof menuFunc }): VxeGlobalMenus;
10
- get(type: string): typeof menuFunc;
11
- add(type: string, callback: typeof menuFunc): VxeGlobalMenus;
12
- delete(type: string): VxeGlobalMenus;
15
+ export interface VxeGlobalMenus {
16
+ mixin(opts: {
17
+ [code: string]: VxeGlobalMenusHandles.MenusOption | ((params: VxeGlobalMenusHandles.MenuMethodParams, event: Event) => any)
18
+ }): VxeGlobalMenus
19
+ has(code: string): boolean
20
+ get(code: string): VxeGlobalMenusHandles.MenusOption
21
+ add(code: string, options: VxeGlobalMenusHandles.MenusOption | ((params: VxeGlobalMenusHandles.MenuMethodParams, event: Event) => any)): VxeGlobalMenus
22
+ delete(code: string): void
23
+ forEach(callback: (options: VxeGlobalMenusHandles.MenusOption, code: string) => void): void
13
24
  }
@@ -10,6 +10,8 @@ import { ColumnFilterRenderOptions, ColumnFilterRenderParams, ColumnFilterMethod
10
10
  import { ToolbarButtonRenderOptions, ToolbarButtonRenderParams, ToolbarToolRenderOptions, ToolbarToolRenderParams } from '../toolbar'
11
11
  import { FormItemRenderOptions, FormItemRenderParams, FormItemVisibleParams, FormItemResetParams } from '../form-item'
12
12
 
13
+ /* eslint-disable no-use-before-define */
14
+
13
15
  /**
14
16
  * 渲染器
15
17
  */
@@ -43,7 +45,7 @@ export interface RendererMapOptions {
43
45
 
44
46
  // 单元格渲染
45
47
  cellClassName?: string | ((params: ColumnCellRenderParams | ColumnEditRenderParams) => string | VNodeClassName)
46
- cellStyle?: VNodeStyle | ((params: ColumnCellRenderParams | ColumnEditRenderParams) => VNodeStyle)
48
+ cellStyle?: VNodeStyle | ((params: ColumnCellRenderParams | ColumnEditRenderParams) => VNodeStyle)
47
49
  renderHeader?(h: CreateElement, renderOpts: ColumnCellRenderOptions | ColumnEditRenderOptions, params: ColumnCellRenderParams | ColumnEditRenderParams): SlotVNodeType | SlotVNodeType[];
48
50
  renderDefault?(h: CreateElement, renderOpts: ColumnCellRenderOptions | ColumnEditRenderOptions, params: ColumnCellRenderParams | ColumnEditRenderParams): SlotVNodeType | SlotVNodeType[];
49
51
  renderFooter?(h: CreateElement, renderOpts: ColumnCellRenderOptions | ColumnEditRenderOptions, params: ColumnFooterRenderParams): SlotVNodeType | SlotVNodeType[];
@@ -101,11 +103,11 @@ export class RenderOptions {
101
103
  /**
102
104
  * 目标组件渲染的事件
103
105
  */
104
- events?: { [key: string]: Function };
106
+ events?: { [key: string]: ((...angs: any[])=>any) };
105
107
  /**
106
108
  * 目标组件渲染的原生事件
107
109
  */
108
- nativeEvents?: { [key: string]: Function };
110
+ nativeEvents?: { [key: string]: ((...angs: any[])=>any) };
109
111
  [key: string]: any;
110
112
  }
111
113
 
@@ -0,0 +1,30 @@
1
+ import { CellRuleValidatorParams } from '../validator'
2
+ import { FormRuleValidatorParams } from '../form'
3
+
4
+ /* eslint-disable no-use-before-define */
5
+
6
+ export namespace VxeGlobalValidatorsHandles {
7
+ export interface ValidatorsOptions {
8
+ itemValidatorMethod?: ItemValidatorMethod
9
+ cellValidatorMethod?: CellValidatorMethod
10
+ }
11
+
12
+ export type ItemValidatorMethod = (params: ItemValidatorParams, ...args: any[]) => void | Error | Promise<any>
13
+ export type CellValidatorMethod = (params: CellValidatorParams, ...args: any[]) => void | Error | Promise<any>
14
+ export type ItemValidatorParams = FormRuleValidatorParams
15
+ export type CellValidatorParams = CellRuleValidatorParams
16
+ }
17
+
18
+ /**
19
+ * 全局快捷菜单
20
+ */
21
+ export interface VxeGlobalValidators {
22
+ mixin(options: {
23
+ [code: string]: VxeGlobalValidatorsHandles.ValidatorsOptions
24
+ }): VxeGlobalValidators
25
+ has(code: string): boolean
26
+ get(code: string): VxeGlobalValidatorsHandles.ValidatorsOptions
27
+ add(code: string, callback: VxeGlobalValidatorsHandles.ValidatorsOptions): VxeGlobalValidators
28
+ delete(code: string): void
29
+ forEach(callback: (options: VxeGlobalValidatorsHandles.ValidatorsOptions, code: string) => void): void
30
+ }
@@ -2,6 +2,8 @@ import { VXETableComponent } from './component'
2
2
  import { ColumnInfo } from './column'
3
3
  import { Table } from './table'
4
4
 
5
+ /* eslint-disable no-use-before-define */
6
+
5
7
  /**
6
8
  * 表格校验
7
9
  */
@@ -32,7 +34,7 @@ export interface ColumnEditRule {
32
34
  * 使用自定义校验函数,接收一个 Promise
33
35
  * @param params 参数
34
36
  */
35
- validator?: typeof ColumnValidatorMethod;
37
+ validator?: string | ((params: CellRuleValidatorParams) => void | Error | Promise<any>);
36
38
  /**
37
39
  * 提示消息
38
40
  */
@@ -41,9 +43,18 @@ export interface ColumnEditRule {
41
43
  maxWidth?: number;
42
44
  }
43
45
 
44
- export function ColumnValidatorMethod(params: ColumnEditValidErrParams): void;
45
- export function ColumnValidatorMethod(params: ColumnEditValidErrParams): Error;
46
- export function ColumnValidatorMethod(params: ColumnEditValidErrParams): Promise<any>;
46
+ export interface CellRuleValidatorParams {
47
+ $table: Table,
48
+ cellValue: any,
49
+ rule: ColumnEditRule;
50
+ rules: ColumnEditRule[];
51
+ column: ColumnInfo;
52
+ columnIndex: number;
53
+ row: any;
54
+ rowIndex: number;
55
+ }
56
+
57
+ export function ColumnValidatorMethod(params: ColumnEditValidErrParams): void | Error | Promise<any>;
47
58
 
48
59
  export interface ColumnEditValidErrParams {
49
60
  $table: Table,