vxe-table 4.5.0-beta.12 → 4.5.0-beta.13

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 (115) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/README.zh-TW.md +1 -1
  4. package/es/form/src/form.js +27 -5
  5. package/es/icon/style.css +1 -1
  6. package/es/input/src/input.js +4 -1
  7. package/es/locale/lang/en-US.js +4 -0
  8. package/es/locale/lang/es-ES.js +5 -0
  9. package/es/locale/lang/ja-JP.js +5 -0
  10. package/es/locale/lang/zh-CN.js +5 -0
  11. package/es/locale/lang/zh-TC.js +5 -0
  12. package/es/menu/src/hooks.js +3 -3
  13. package/es/select/src/select.js +4 -1
  14. package/es/style.css +1 -1
  15. package/es/style.min.css +1 -1
  16. package/es/table/src/table.js +3 -3
  17. package/es/table/style.css +2 -2
  18. package/es/textarea/src/textarea.js +4 -1
  19. package/es/tools/log.js +1 -1
  20. package/es/v-x-e-table/index.js +4 -1
  21. package/es/v-x-e-table/src/menus.js +48 -2
  22. package/es/v-x-e-table/src/store.js +4 -1
  23. package/es/v-x-e-table/src/validators.js +5 -0
  24. package/es/validator/src/hook.js +31 -6
  25. package/es/vxe-table/style.css +2 -2
  26. package/lib/form/src/form.js +24 -4
  27. package/lib/form/src/form.min.js +1 -1
  28. package/lib/icon/style/style.css +1 -1
  29. package/lib/icon/style/style.min.css +1 -1
  30. package/lib/index.umd.js +140 -23
  31. package/lib/index.umd.min.js +1 -1
  32. package/lib/input/src/input.js +6 -1
  33. package/lib/input/src/input.min.js +1 -1
  34. package/lib/locale/lang/en-US.js +4 -0
  35. package/lib/locale/lang/en-US.min.js +1 -1
  36. package/lib/locale/lang/en-US.umd.js +4 -0
  37. package/lib/locale/lang/es-ES.js +5 -0
  38. package/lib/locale/lang/es-ES.min.js +1 -1
  39. package/lib/locale/lang/es-ES.umd.js +5 -0
  40. package/lib/locale/lang/ja-JP.js +5 -0
  41. package/lib/locale/lang/ja-JP.min.js +1 -1
  42. package/lib/locale/lang/ja-JP.umd.js +5 -0
  43. package/lib/locale/lang/zh-CN.js +5 -0
  44. package/lib/locale/lang/zh-CN.min.js +1 -1
  45. package/lib/locale/lang/zh-CN.umd.js +5 -0
  46. package/lib/locale/lang/zh-HK.min.js +1 -1
  47. package/lib/locale/lang/zh-HK.umd.js +5 -0
  48. package/lib/locale/lang/zh-MO.min.js +1 -1
  49. package/lib/locale/lang/zh-MO.umd.js +5 -0
  50. package/lib/locale/lang/zh-TC.js +5 -0
  51. package/lib/locale/lang/zh-TC.min.js +1 -1
  52. package/lib/locale/lang/zh-TC.umd.js +5 -0
  53. package/lib/locale/lang/zh-TW.min.js +1 -1
  54. package/lib/locale/lang/zh-TW.umd.js +5 -0
  55. package/lib/menu/src/hooks.js +3 -3
  56. package/lib/menu/src/hooks.min.js +1 -1
  57. package/lib/select/src/select.js +6 -1
  58. package/lib/select/src/select.min.js +1 -1
  59. package/lib/style.css +1 -1
  60. package/lib/style.min.css +1 -1
  61. package/lib/table/src/table.js +4 -4
  62. package/lib/table/src/table.min.js +1 -1
  63. package/lib/table/style/style.css +2 -2
  64. package/lib/table/style/style.min.css +1 -1
  65. package/lib/textarea/src/textarea.js +6 -1
  66. package/lib/textarea/src/textarea.min.js +1 -1
  67. package/lib/tools/log.js +1 -1
  68. package/lib/tools/log.min.js +1 -1
  69. package/lib/v-x-e-table/index.js +14 -1
  70. package/lib/v-x-e-table/index.min.js +1 -1
  71. package/lib/v-x-e-table/src/menus.js +48 -2
  72. package/lib/v-x-e-table/src/menus.min.js +1 -1
  73. package/lib/v-x-e-table/src/store.js +4 -1
  74. package/lib/v-x-e-table/src/store.min.js +1 -1
  75. package/lib/v-x-e-table/src/validators.js +15 -0
  76. package/lib/v-x-e-table/src/validators.min.js +1 -0
  77. package/lib/validator/src/hook.js +29 -6
  78. package/lib/validator/src/hook.min.js +1 -1
  79. package/lib/vxe-table/style/style.css +2 -2
  80. package/lib/vxe-table/style/style.min.css +1 -1
  81. package/package.json +2 -2
  82. package/packages/form/src/form.ts +24 -5
  83. package/packages/input/src/input.ts +4 -1
  84. package/packages/locale/lang/en-US.ts +4 -0
  85. package/packages/locale/lang/es-ES.ts +5 -0
  86. package/packages/locale/lang/ja-JP.ts +5 -0
  87. package/packages/locale/lang/zh-CN.ts +5 -0
  88. package/packages/locale/lang/zh-TC.ts +5 -0
  89. package/packages/menu/src/hooks.ts +3 -3
  90. package/packages/select/src/select.ts +4 -1
  91. package/packages/table/src/table.ts +3 -3
  92. package/packages/textarea/src/textarea.ts +4 -1
  93. package/packages/v-x-e-table/index.ts +3 -0
  94. package/packages/v-x-e-table/src/menus.ts +52 -2
  95. package/packages/v-x-e-table/src/store.ts +3 -1
  96. package/packages/v-x-e-table/src/validators.ts +9 -0
  97. package/packages/validator/src/hook.ts +28 -6
  98. package/styles/table.scss +2 -2
  99. package/types/form.d.ts +9 -12
  100. package/types/v-x-e-table/index.d.ts +8 -1
  101. package/types/v-x-e-table/menus.d.ts +19 -7
  102. package/types/v-x-e-table/validators.d.ts +30 -0
  103. package/types/validator.d.ts +14 -1
  104. /package/es/icon/style/{iconfont.1690003639196.ttf → iconfont.1690032028705.ttf} +0 -0
  105. /package/es/icon/style/{iconfont.1690003639196.woff → iconfont.1690032028705.woff} +0 -0
  106. /package/es/icon/style/{iconfont.1690003639196.woff2 → iconfont.1690032028705.woff2} +0 -0
  107. /package/es/{iconfont.1690003639196.ttf → iconfont.1690032028705.ttf} +0 -0
  108. /package/es/{iconfont.1690003639196.woff → iconfont.1690032028705.woff} +0 -0
  109. /package/es/{iconfont.1690003639196.woff2 → iconfont.1690032028705.woff2} +0 -0
  110. /package/lib/icon/style/{iconfont.1690003639196.ttf → iconfont.1690032028705.ttf} +0 -0
  111. /package/lib/icon/style/{iconfont.1690003639196.woff → iconfont.1690032028705.woff} +0 -0
  112. /package/lib/icon/style/{iconfont.1690003639196.woff2 → iconfont.1690032028705.woff2} +0 -0
  113. /package/lib/{iconfont.1690003639196.ttf → iconfont.1690032028705.ttf} +0 -0
  114. /package/lib/{iconfont.1690003639196.woff → iconfont.1690032028705.woff} +0 -0
  115. /package/lib/{iconfont.1690003639196.woff2 → iconfont.1690032028705.woff2} +0 -0
@@ -6,6 +6,7 @@ import { VxeGlobalInterceptor } from './interceptor'
6
6
  import { VxeGlobalCommands } from './commands'
7
7
  import { VxeGlobalFormats } from './formats'
8
8
  import { VxeGlobalMenus } from './menus'
9
+ import { VxeGlobalValidators } from './validators'
9
10
  import { VxeGlobalHooks } from './hooks'
10
11
  import { VxeGlobalSetup } from './setup'
11
12
 
@@ -39,6 +40,7 @@ export const renderer: VxeGlobalRenderer
39
40
  export const commands: VxeGlobalCommands
40
41
  export const formats: VxeGlobalFormats
41
42
  export const menus: VxeGlobalMenus
43
+ export const validators: VxeGlobalValidators
42
44
  export const hooks: VxeGlobalHooks
43
45
  export const modal: ModalController
44
46
  export const saveFile: SaveFileFunction
@@ -93,6 +95,10 @@ export interface VXETableCore {
93
95
  * Table context menu
94
96
  */
95
97
  menus: VxeGlobalMenus
98
+ /**
99
+ * Validators table/form
100
+ */
101
+ validators: VxeGlobalValidators
96
102
  /**
97
103
  * Table VxeGlobalHooks API
98
104
  */
@@ -131,7 +137,7 @@ export interface VXETableCore {
131
137
  }
132
138
 
133
139
  /**
134
- * 一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟滚动、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、虚拟列表、弹窗、自定义模板、渲染器、贼灵活的配置项等...
140
+ * 一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、JSON 配置式为零代码而设计...
135
141
  */
136
142
  export const VXETable: VXETableCore
137
143
 
@@ -140,6 +146,7 @@ export * from './interceptor'
140
146
  export * from './commands'
141
147
  export * from './formats'
142
148
  export * from './menus'
149
+ export * from './validators'
143
150
  export * from './hooks'
144
151
  export * from './setup'
145
152
 
@@ -5,18 +5,30 @@ import { VxeGlobalRendererHandles } from './renderer'
5
5
  /* eslint-disable no-use-before-define */
6
6
 
7
7
  export namespace VxeGlobalMenusHandles {
8
- export type MenusCallback<D = VxeTableDataRow> = (params: MenusCallbackParams<D>, event: Event) => any
9
-
8
+ export type MenusOption<D = VxeTableDataRow> = {
9
+ menuMethod?: (params: MenuMethodParams<D>, event: Event) => any
10
+ }
10
11
  interface MenusParams<D = VxeTableDataRow> {
11
12
  $grid: VxeGridConstructor<D> | null
12
13
  $table: VxeTableConstructor<D> & VxeTablePrivateMethods<D>
13
14
  }
14
- export interface MenusCallbackParams<D = VxeTableDataRow> extends MenusParams<D>, VxeGlobalRendererHandles.RenderCellParams<D> {
15
+ export interface MenuMethodParams<D = VxeTableDataRow> extends MenusParams<D>, VxeGlobalRendererHandles.RenderCellParams<D> {
15
16
  $grid: VxeGridConstructor<D> | null
16
17
  $table: VxeTableConstructor<D> & VxeTablePrivateMethods<D>
17
18
  $event: MouseEvent
18
19
  menu: VxeTableDefines.MenuFirstOption | VxeTableDefines.MenuChildOption
19
20
  }
21
+
22
+ /**
23
+ * 请使用 MenusOption
24
+ * @deprecated
25
+ */
26
+ export type MenusCallback = MenusOption
27
+ /**
28
+ * 请使用 MenuMethodParams
29
+ * @deprecated
30
+ */
31
+ export interface MenusCallbackParams<D = VxeTableDataRow> extends MenuMethodParams<D> {}
20
32
  }
21
33
 
22
34
  /**
@@ -24,11 +36,11 @@ export namespace VxeGlobalMenusHandles {
24
36
  */
25
37
  export interface VxeGlobalMenus {
26
38
  mixin(options: {
27
- [code: string]: VxeGlobalMenusHandles.MenusCallback<any>
39
+ [code: string]: VxeGlobalMenusHandles.MenusOption<any> | ((params: VxeGlobalMenusHandles.MenuMethodParams<any>, event: Event) => any)
28
40
  }): VxeGlobalMenus
29
41
  has(code: string): boolean
30
- get(code: string): VxeGlobalMenusHandles.MenusCallback<any>
31
- add(code: string, callback: VxeGlobalMenusHandles.MenusCallback<any>): VxeGlobalMenus
42
+ get(code: string): VxeGlobalMenusHandles.MenusOption<any>
43
+ add(code: string, options: VxeGlobalMenusHandles.MenusOption<any> | ((params: VxeGlobalMenusHandles.MenuMethodParams<any>, event: Event) => any)): VxeGlobalMenus
32
44
  delete(code: string): void
33
- forEach(callback: (options: VxeGlobalMenusHandles.MenusCallback<any>, code: string) => void): void
45
+ forEach(callback: (options: VxeGlobalMenusHandles.MenusOption<any>, code: string) => void): void
34
46
  }
@@ -0,0 +1,30 @@
1
+ import { VxeTableDefines, VxeTableDataRow } from '../table'
2
+ import { VxeFormDefines } from '../form'
3
+
4
+ /* eslint-disable no-use-before-define */
5
+
6
+ export namespace VxeGlobalValidatorsHandles {
7
+ export interface ValidatorsOptions<D = VxeTableDataRow> {
8
+ itemValidatorMethod?: ItemValidatorMethod
9
+ cellValidatorMethod?: CellValidatorMethod<D>
10
+ }
11
+
12
+ export type ItemValidatorMethod = (params: ItemValidatorParams, ...args: any[]) => void | Error | Promise<any>
13
+ export type CellValidatorMethod<D = VxeTableDataRow> = (params: CellValidatorParams<D>, ...args: any[]) => void | Error | Promise<any>
14
+ export interface ItemValidatorParams extends VxeFormDefines.RuleValidatorParams {}
15
+ export interface CellValidatorParams<D = VxeTableDataRow> extends VxeTableDefines.RuleValidatorParams<D> {}
16
+ }
17
+
18
+ /**
19
+ * 全局快捷菜单
20
+ */
21
+ export interface VxeGlobalValidators {
22
+ mixin(options: {
23
+ [code: string]: VxeGlobalValidatorsHandles.ValidatorsOptions<any>
24
+ }): VxeGlobalValidators
25
+ has(code: string): boolean
26
+ get(code: string): VxeGlobalValidatorsHandles.ValidatorsOptions<any>
27
+ add(code: string, callback: VxeGlobalValidatorsHandles.ValidatorsOptions<any>): VxeGlobalValidators
28
+ delete(code: string): void
29
+ forEach(callback: (options: VxeGlobalValidatorsHandles.ValidatorsOptions<any>, code: string) => void): void
30
+ }
@@ -1,5 +1,6 @@
1
1
  import { VXEComponent } from './component'
2
2
  import { VxeTableDefines, VxeTableDataRow, VxeTableConstructor } from './table'
3
+ import { VxeGridConstructor } from './grid'
3
4
  import { VxeColumnPropTypes } from './column'
4
5
 
5
6
  /* eslint-disable no-use-before-define */
@@ -71,7 +72,7 @@ declare module './table' {
71
72
  * 使用自定义校验函数,接收一个 Promise
72
73
  * @param params 参数
73
74
  */
74
- validator?(params: VxeTableDefines.ValidatorErrorParams<D>): void | Error | Promise<void>
75
+ validator?: string | ((params: RuleValidatorParams<D>) => void | Error | Promise<void>)
75
76
  /**
76
77
  * 提示消息
77
78
  */
@@ -83,6 +84,18 @@ declare module './table' {
83
84
  */
84
85
  message?: string
85
86
  }
87
+ export interface RuleValidatorParams<D = VxeTableDataRow> {
88
+ $table: VxeTableConstructor<D>
89
+ $grid: VxeGridConstructor<D> | null
90
+ cellValue: any
91
+ rule: ValidatorRule<D>
92
+ rules: ValidatorRule<D>[]
93
+ column: VxeTableDefines.ColumnInfo<D>
94
+ columnIndex: number
95
+ row: D
96
+ rowIndex: number
97
+ field: string
98
+ }
86
99
  export interface ValidatorErrorParams<D = VxeTableDataRow> {
87
100
  $table: VxeTableConstructor<D>
88
101
  cellValue: any