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
package/lib/index.umd.js CHANGED
@@ -1788,7 +1788,8 @@ __webpack_require__.d(__webpack_exports__, {
1788
1788
  "setup": function() { return /* reexport */ setup; },
1789
1789
  "t": function() { return /* reexport */ t; },
1790
1790
  "use": function() { return /* reexport */ use; },
1791
- "v": function() { return /* reexport */ v; }
1791
+ "v": function() { return /* reexport */ v; },
1792
+ "validators": function() { return /* reexport */ validators; }
1792
1793
  });
1793
1794
 
1794
1795
  // NAMESPACE OBJECT: ./packages/all.ts
@@ -1877,7 +1878,8 @@ __webpack_require__.d(all_namespaceObject, {
1877
1878
  "setup": function() { return setup; },
1878
1879
  "t": function() { return t; },
1879
1880
  "use": function() { return use; },
1880
- "v": function() { return v; }
1881
+ "v": function() { return v; },
1882
+ "validators": function() { return validators; }
1881
1883
  });
1882
1884
 
1883
1885
  ;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
@@ -3973,7 +3975,9 @@ class Store {
3973
3975
  _defineProperty(this, "store", {});
3974
3976
  }
3975
3977
  mixin(options) {
3976
- Object.assign(this.store, options);
3978
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(options, (item, key) => {
3979
+ this.add(key, item);
3980
+ });
3977
3981
  return this;
3978
3982
  }
3979
3983
  has(name) {
@@ -4014,7 +4018,52 @@ if (true) {
4014
4018
  }
4015
4019
  ;// CONCATENATED MODULE: ./packages/v-x-e-table/src/menus.ts
4016
4020
 
4017
- const menus = new store();
4021
+
4022
+
4023
+ class VXEMenusStore {
4024
+ constructor() {
4025
+ _defineProperty(this, "store", {});
4026
+ }
4027
+ mixin(options) {
4028
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(options, (item, key) => {
4029
+ this.add(key, item);
4030
+ });
4031
+ return this;
4032
+ }
4033
+ has(name) {
4034
+ return !!this.get(name);
4035
+ }
4036
+ get(name) {
4037
+ return this.store[name];
4038
+ }
4039
+ add(name, render) {
4040
+ const conf = this.store[name];
4041
+ // 兼容
4042
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(render)) {
4043
+ render = {
4044
+ menuMethod: render
4045
+ };
4046
+ }
4047
+ // 检测是否覆盖
4048
+ if (true) {
4049
+ const confKeys = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(conf);
4050
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(render, (item, key) => {
4051
+ if (confKeys.includes(key)) {
4052
+ warnLog('vxe.error.coverProp', [name, key]);
4053
+ }
4054
+ });
4055
+ }
4056
+ this.store[name] = conf ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().merge(conf, render) : render;
4057
+ return this;
4058
+ }
4059
+ delete(name) {
4060
+ delete this.store[name];
4061
+ }
4062
+ forEach(callback) {
4063
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(this.store, callback);
4064
+ }
4065
+ }
4066
+ const menus = new VXEMenusStore();
4018
4067
  if (true) {
4019
4068
  Object.assign(menus, {
4020
4069
  _name: 'Menus'
@@ -4028,6 +4077,14 @@ if (true) {
4028
4077
  _name: 'Formats'
4029
4078
  });
4030
4079
  }
4080
+ ;// CONCATENATED MODULE: ./packages/v-x-e-table/src/validators.ts
4081
+
4082
+ const validators = new store();
4083
+ if (true) {
4084
+ Object.assign(validators, {
4085
+ _name: 'Validators'
4086
+ });
4087
+ }
4031
4088
  ;// CONCATENATED MODULE: ./packages/v-x-e-table/src/hooks.ts
4032
4089
 
4033
4090
  const hooks = new store();
@@ -4052,6 +4109,7 @@ const setup = options => {
4052
4109
 
4053
4110
 
4054
4111
 
4112
+
4055
4113
  function getExportOrImpotType(types, flag) {
4056
4114
  const rest = [];
4057
4115
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(types, (val, type) => {
@@ -4114,6 +4172,7 @@ const VXETable = {
4114
4172
  renderer: renderer,
4115
4173
  commands: commands,
4116
4174
  formats: formats,
4175
+ validators: validators,
4117
4176
  menus: menus,
4118
4177
  hooks: hooks,
4119
4178
  config,
@@ -4128,6 +4187,7 @@ const VXETable = {
4128
4187
 
4129
4188
 
4130
4189
 
4190
+
4131
4191
  /* harmony default export */ var v_x_e_table = ((/* unused pure expression or super */ null && (VXETable)));
4132
4192
  ;// CONCATENATED MODULE: ./packages/filter/src/panel.ts
4133
4193
 
@@ -5299,15 +5359,15 @@ const tableMenuHook = {
5299
5359
  ctxMenuLinkEvent(evnt, menu) {
5300
5360
  // 如果一级菜单有配置 code 则允许点击,否则不能点击
5301
5361
  if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
5302
- const ctxMenuMethod = VXETable.menus.get(menu.code);
5362
+ const gMenuOpts = VXETable.menus.get(menu.code);
5303
5363
  const params = Object.assign({}, internalData._currMenuParams, {
5304
5364
  menu,
5305
5365
  $table: $xetable,
5306
5366
  $grid: $xetable.xegrid,
5307
5367
  $event: evnt
5308
5368
  });
5309
- if (ctxMenuMethod) {
5310
- ctxMenuMethod(params, evnt);
5369
+ if (gMenuOpts && gMenuOpts.menuMethod) {
5370
+ gMenuOpts.menuMethod(params, evnt);
5311
5371
  }
5312
5372
  $xetable.dispatchEvent('menu-click', params, evnt);
5313
5373
  menuMethods.closeMenu();
@@ -7985,7 +8045,10 @@ const quarterSize = 8;
7985
8045
  },
7986
8046
  readonly: Boolean,
7987
8047
  disabled: Boolean,
7988
- placeholder: String,
8048
+ placeholder: {
8049
+ type: String,
8050
+ default: () => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(conf.input.placeholder) ? conf.i18n('vxe.base.pleaseInput') : conf.input.placeholder
8051
+ },
7989
8052
  maxlength: [String, Number],
7990
8053
  autocomplete: {
7991
8054
  type: String,
@@ -10616,7 +10679,10 @@ function getOptUniqueId() {
10616
10679
  props: {
10617
10680
  modelValue: null,
10618
10681
  clearable: Boolean,
10619
- placeholder: String,
10682
+ placeholder: {
10683
+ type: String,
10684
+ default: () => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(conf.select.placeholder) ? conf.i18n('vxe.base.pleaseSelect') : conf.select.placeholder
10685
+ },
10620
10686
  loading: Boolean,
10621
10687
  disabled: Boolean,
10622
10688
  multiple: Boolean,
@@ -14648,6 +14714,8 @@ const Keyboard = VxeModuleKeyboard;
14648
14714
 
14649
14715
 
14650
14716
 
14717
+
14718
+
14651
14719
  /**
14652
14720
  * 校验规则
14653
14721
  */
@@ -14994,11 +15062,12 @@ const validatorHook = {
14994
15062
  const {
14995
15063
  type,
14996
15064
  trigger,
14997
- required
15065
+ required,
15066
+ validator
14998
15067
  } = rule;
14999
15068
  if (validType === 'all' || !trigger || validType === trigger) {
15000
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rule.validator)) {
15001
- const customValid = rule.validator({
15069
+ if (validator) {
15070
+ const validParams = {
15002
15071
  cellValue,
15003
15072
  rule,
15004
15073
  rules,
@@ -15006,9 +15075,29 @@ const validatorHook = {
15006
15075
  rowIndex: $xetable.getRowIndex(row),
15007
15076
  column,
15008
15077
  columnIndex: $xetable.getColumnIndex(column),
15009
- field: column.property,
15010
- $table: $xetable
15011
- });
15078
+ field: column.field,
15079
+ $table: $xetable,
15080
+ $grid: $xetable.xegrid
15081
+ };
15082
+ let customValid;
15083
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(validator)) {
15084
+ const gvItem = VXETable.validators.get(validator);
15085
+ if (gvItem) {
15086
+ if (gvItem.cellValidatorMethod) {
15087
+ customValid = gvItem.cellValidatorMethod(validParams);
15088
+ } else {
15089
+ if (true) {
15090
+ warnLog('vxe.error.notValidators', [validator]);
15091
+ }
15092
+ }
15093
+ } else {
15094
+ if (true) {
15095
+ errLog('vxe.error.notValidators', [validator]);
15096
+ }
15097
+ }
15098
+ } else {
15099
+ customValid = validator(validParams);
15100
+ }
15012
15101
  if (customValid) {
15013
15102
  if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isError(customValid)) {
15014
15103
  validRuleErr = true;
@@ -19635,7 +19724,10 @@ let autoTxtElem;
19635
19724
  name: String,
19636
19725
  readonly: Boolean,
19637
19726
  disabled: Boolean,
19638
- placeholder: String,
19727
+ placeholder: {
19728
+ type: String,
19729
+ default: () => external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(conf.textarea.placeholder) ? conf.i18n('vxe.base.pleaseInput') : conf.textarea.placeholder
19730
+ },
19639
19731
  maxlength: [String, Number],
19640
19732
  rows: {
19641
19733
  type: [String, Number],
@@ -21211,11 +21303,12 @@ function getResetValue(value, resetValue) {
21211
21303
  const {
21212
21304
  type,
21213
21305
  trigger,
21214
- required
21306
+ required,
21307
+ validator
21215
21308
  } = rule;
21216
21309
  if (validType === 'all' || !trigger || validType === trigger) {
21217
- if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rule.validator)) {
21218
- const customValid = rule.validator({
21310
+ if (validator) {
21311
+ const validParams = {
21219
21312
  itemValue,
21220
21313
  rule,
21221
21314
  rules,
@@ -21223,7 +21316,26 @@ function getResetValue(value, resetValue) {
21223
21316
  field: property,
21224
21317
  property,
21225
21318
  $form: $xeform
21226
- });
21319
+ };
21320
+ let customValid;
21321
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(validator)) {
21322
+ const gvItem = VXETable.validators.get(validator);
21323
+ if (gvItem) {
21324
+ if (gvItem.itemValidatorMethod) {
21325
+ customValid = gvItem.itemValidatorMethod(validParams);
21326
+ } else {
21327
+ if (true) {
21328
+ warnLog('vxe.error.notValidators', [validator]);
21329
+ }
21330
+ }
21331
+ } else {
21332
+ if (true) {
21333
+ errLog('vxe.error.notValidators', [validator]);
21334
+ }
21335
+ }
21336
+ } else {
21337
+ customValid = validator(validParams);
21338
+ }
21227
21339
  if (customValid) {
21228
21340
  if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isError(customValid)) {
21229
21341
  errorRules.push(new form_Rule({
@@ -29715,7 +29827,7 @@ const orderStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_ORDER';
29715
29827
  * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一列编辑状态
29716
29828
  * 如果单元格配置了校验规则,则会进行校验
29717
29829
  */
29718
- updateStatus(scope, cellValue) {
29830
+ updateStatus(slotParams, cellValue) {
29719
29831
  const customVal = !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(cellValue);
29720
29832
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
29721
29833
  const {
@@ -29725,11 +29837,11 @@ const orderStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_ORDER';
29725
29837
  validStore
29726
29838
  } = reactData;
29727
29839
  const tableBody = refTableBody.value;
29728
- if (!scope && tableBody && editRules) {
29840
+ if (slotParams && tableBody && editRules) {
29729
29841
  const {
29730
29842
  row,
29731
29843
  column
29732
- } = scope;
29844
+ } = slotParams;
29733
29845
  const type = 'change';
29734
29846
  if ($xetable.hasCellRules) {
29735
29847
  if ($xetable.hasCellRules(type, row, column)) {
@@ -32462,6 +32574,10 @@ dynamicApp.component(table.name, table);
32462
32574
  ;// CONCATENATED MODULE: ./packages/locale/lang/zh-CN.ts
32463
32575
  /* harmony default export */ var zh_CN = ({
32464
32576
  vxe: {
32577
+ base: {
32578
+ pleaseInput: '请输入',
32579
+ pleaseSelect: '请选择'
32580
+ },
32465
32581
  loading: {
32466
32582
  text: '加载中...'
32467
32583
  },
@@ -32481,6 +32597,7 @@ dynamicApp.component(table.name, table);
32481
32597
  errProp: '不支持的参数 "{0}",可能为 "{1}"',
32482
32598
  colRepet: 'column.{0}="{1}" 重复了,这可能会导致某些功能无法使用',
32483
32599
  notFunc: '方法 "{0}" 不存在',
32600
+ notValidators: '全局校验 "{0}" 不存在',
32484
32601
  notSlot: '插槽 "{0}" 不存在',
32485
32602
  noTree: '树结构不支持 "{0}"',
32486
32603
  notProp: '不支持的参数 "{0}"',