vxe-table 3.5.9-beta.1 → 3.5.9-beta.4

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 (77) hide show
  1. package/lib/edit/src/mixin.js +3 -3
  2. package/lib/edit/src/mixin.min.js +1 -1
  3. package/lib/form/src/form.js +12 -7
  4. package/lib/form/src/form.min.js +1 -1
  5. package/lib/form/style/style.css +2 -1
  6. package/lib/form/style/style.min.css +1 -1
  7. package/lib/grid/src/grid.js +12 -7
  8. package/lib/grid/src/grid.min.js +1 -1
  9. package/lib/index.css +1 -1
  10. package/lib/index.umd.js +113 -45
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/list/src/list.js +12 -7
  13. package/lib/list/src/list.min.js +1 -1
  14. package/lib/loading/index.js +19 -0
  15. package/lib/loading/index.min.js +1 -0
  16. package/lib/loading/src/loading.js +36 -0
  17. package/lib/loading/src/loading.min.js +1 -0
  18. package/lib/locale/lang/en-US.js +3 -0
  19. package/lib/locale/lang/en-US.min.js +1 -1
  20. package/lib/locale/lang/en-US.umd.js +3 -0
  21. package/lib/locale/lang/ja-JP.js +3 -0
  22. package/lib/locale/lang/ja-JP.min.js +1 -1
  23. package/lib/locale/lang/ja-JP.umd.js +3 -0
  24. package/lib/locale/lang/zh-CN.js +3 -0
  25. package/lib/locale/lang/zh-CN.min.js +1 -1
  26. package/lib/locale/lang/zh-CN.umd.js +3 -0
  27. package/lib/locale/lang/zh-HK.min.js +1 -1
  28. package/lib/locale/lang/zh-HK.umd.js +3 -0
  29. package/lib/locale/lang/zh-MO.min.js +1 -1
  30. package/lib/locale/lang/zh-MO.umd.js +3 -0
  31. package/lib/locale/lang/zh-TC.js +3 -0
  32. package/lib/locale/lang/zh-TC.min.js +1 -1
  33. package/lib/locale/lang/zh-TC.umd.js +3 -0
  34. package/lib/locale/lang/zh-TW.min.js +1 -1
  35. package/lib/locale/lang/zh-TW.umd.js +3 -0
  36. package/lib/modal/src/modal.js +22 -11
  37. package/lib/modal/src/modal.min.js +1 -1
  38. package/lib/select/style/style.css +0 -69
  39. package/lib/select/style/style.min.css +1 -1
  40. package/lib/style.css +1 -1
  41. package/lib/style.min.css +1 -1
  42. package/lib/table/src/methods.js +3 -1
  43. package/lib/table/src/methods.min.js +1 -1
  44. package/lib/table/src/table.js +12 -8
  45. package/lib/table/src/table.min.js +1 -1
  46. package/lib/table/style/style.css +0 -68
  47. package/lib/table/style/style.min.css +1 -1
  48. package/lib/tools/log.js +1 -1
  49. package/lib/tools/log.min.js +1 -1
  50. package/lib/v-x-e-table/index.js +1 -1
  51. package/lib/v-x-e-table/index.min.js +1 -1
  52. package/lib/v-x-e-table/src/conf.js +4 -0
  53. package/lib/v-x-e-table/src/conf.min.js +1 -1
  54. package/lib/v-x-e-table/style/style.css +590 -0
  55. package/lib/v-x-e-table/style/style.min.css +1 -0
  56. package/package.json +1 -1
  57. package/packages/edit/src/mixin.js +3 -2
  58. package/packages/form/src/form.js +10 -9
  59. package/packages/grid/src/grid.js +8 -5
  60. package/packages/list/src/list.js +10 -9
  61. package/packages/loading/index.js +9 -0
  62. package/packages/loading/src/loading.js +31 -0
  63. package/packages/locale/lang/en-US.js +3 -0
  64. package/packages/locale/lang/ja-JP.js +3 -0
  65. package/packages/locale/lang/zh-CN.js +3 -0
  66. package/packages/locale/lang/zh-TC.js +3 -0
  67. package/packages/modal/src/modal.js +18 -13
  68. package/packages/table/src/methods.js +2 -1
  69. package/packages/table/src/table.js +10 -9
  70. package/packages/v-x-e-table/src/conf.js +4 -0
  71. package/styles/form.scss +1 -0
  72. package/styles/{base/loading.scss → loading.scss} +17 -4
  73. package/styles/modules.scss +1 -0
  74. package/styles/select.scss +0 -1
  75. package/styles/table.scss +0 -1
  76. package/styles/v-x-e-table.scss +2 -0
  77. package/types/table.d.ts +5 -0
@@ -173,7 +173,7 @@ export default {
173
173
  tZindex: 0,
174
174
  tablePage: {
175
175
  total: 0,
176
- pageSize: 10,
176
+ pageSize: GlobalConfig.pager.pageSize || 10,
177
177
  currentPage: 1
178
178
  }
179
179
  }
@@ -226,7 +226,7 @@ export default {
226
226
  }
227
227
  }
228
228
  if (editConfig) {
229
- tableProps.editConfig = Object.assign({}, editConfig, { activeMethod: this.handleActiveMethod })
229
+ tableProps.editConfig = Object.assign({}, editConfig, { beforeEditMethod: this.handleBeforeEditMethod })
230
230
  }
231
231
  return tableProps
232
232
  }
@@ -400,10 +400,13 @@ export default {
400
400
  clss.push(rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : '')
401
401
  return clss
402
402
  },
403
- handleActiveMethod (params) {
403
+ handleBeforeEditMethod (params) {
404
404
  const { editConfig } = this
405
- const activeMethod = editConfig ? editConfig.activeMethod : null
406
- return this.pendingRecords.indexOf(params.row) === -1 && (!activeMethod || activeMethod({ ...params, $grid: this }))
405
+ const beforeEditMethod = editConfig ? (editConfig.beforeEditMethod || editConfig.activeMethod) : null
406
+ if (this.pendingRecords.indexOf(params.row) === -1) {
407
+ return !beforeEditMethod || beforeEditMethod({ ...params, $grid: this })
408
+ }
409
+ return false
407
410
  },
408
411
  initToolbar () {
409
412
  this.$nextTick(() => {
@@ -4,6 +4,7 @@ import vSize from '../../mixins/size'
4
4
  import { createResizeEvent } from '../../tools/resize'
5
5
  import { GlobalEvent } from '../../tools/event'
6
6
  import { browse } from '../../tools/dom'
7
+ import VxeLoading from '../../loading/index'
7
8
 
8
9
  export default {
9
10
  name: 'VxeList',
@@ -113,15 +114,15 @@ export default {
113
114
  }
114
115
  }, $scopedSlots.default ? $scopedSlots.default.call(this, { items, $list: this }, h) : [])
115
116
  ]),
116
- h('div', {
117
- class: ['vxe-list--loading vxe-loading', {
118
- 'is--visible': loading
119
- }]
120
- }, [
121
- h('div', {
122
- class: 'vxe-loading--spinner'
123
- })
124
- ])
117
+ /**
118
+ * 加载中
119
+ */
120
+ h(VxeLoading, {
121
+ class: 'vxe-list--loading',
122
+ props: {
123
+ loading
124
+ }
125
+ })
125
126
  ])
126
127
  },
127
128
  methods: {
@@ -0,0 +1,9 @@
1
+ import VxeLoading from './src/loading'
2
+
3
+ export const Loading = Object.assign(VxeLoading, {
4
+ install (Vue) {
5
+ Vue.component(VxeLoading.name, VxeLoading)
6
+ }
7
+ })
8
+
9
+ export default VxeLoading
@@ -0,0 +1,31 @@
1
+ import GlobalConfig from '../../v-x-e-table/src/conf'
2
+
3
+ export default {
4
+ name: 'VxeLoading',
5
+ props: {
6
+ loading: Boolean
7
+ },
8
+ render (h) {
9
+ const icon = GlobalConfig.icon.LOADING
10
+ const loadingText = GlobalConfig.loadingText
11
+ const text = loadingText === null ? loadingText : GlobalConfig.i18n('vxe.loading.text')
12
+ return h('div', {
13
+ class: ['vxe-loading', {
14
+ 'is--visible': this.loading
15
+ }]
16
+ }, [
17
+ h('div', {
18
+ class: 'vxe-loading--chunk'
19
+ }, [
20
+ icon ? h('i', {
21
+ class: icon
22
+ }) : h('div', {
23
+ class: 'vxe-loading--spinner'
24
+ }),
25
+ text ? h('div', {
26
+ class: 'vxe-loading--text'
27
+ }, `${text}`) : null
28
+ ])
29
+ ])
30
+ }
31
+ }
@@ -1,5 +1,8 @@
1
1
  export default {
2
2
  vxe: {
3
+ loading: {
4
+ text: 'Loading'
5
+ },
3
6
  error: {
4
7
  groupFixed: 'If you use group headers, the fixed columns must be set by group.',
5
8
  groupMouseRange: 'Grouping headers and "{0}" cannot be used at the same time, which may cause errors.',
@@ -1,5 +1,8 @@
1
1
  export default {
2
2
  vxe: {
3
+ loading: {
4
+ text: 'Loading'
5
+ },
3
6
  error: {
4
7
  groupFixed: 'グループのヘッダを使用すると、固定列はグループで設定しなければなりません',
5
8
  groupMouseRange: 'グループ化ヘッダーと「{0}」は同時に使用できません。これによりエラーが発生する可能性があります',
@@ -1,5 +1,8 @@
1
1
  export default {
2
2
  vxe: {
3
+ loading: {
4
+ text: '加载中'
5
+ },
3
6
  error: {
4
7
  groupFixed: '如果使用分组表头,固定列必须按组设置',
5
8
  groupMouseRange: '分组表头与 "{0}" 不能同时使用,这可能会出现错误',
@@ -1,5 +1,8 @@
1
1
  export default {
2
2
  vxe: {
3
+ loading: {
4
+ text: '加載中'
5
+ },
3
6
  error: {
4
7
  groupFixed: '如果使用分組表頭,固定列必須按組設定',
5
8
  groupMouseRange: '分组表頭與 "{0}" 不能同時使用,這可能會出現錯誤',
@@ -5,6 +5,7 @@ import UtilTools, { getFuncText } from '../../tools/utils'
5
5
  import DomTools from '../../tools/dom'
6
6
  import { GlobalEvent } from '../../tools/event'
7
7
  import { errLog } from '../../tools/log'
8
+ import VxeLoading from '../../loading/index'
8
9
 
9
10
  export const allActivedModals = []
10
11
  export const msgQueue = []
@@ -68,7 +69,7 @@ export default {
68
69
  modalTop: 0,
69
70
  modalZindex: 0,
70
71
  zoomLocat: null,
71
- firstOpen: false
72
+ firstOpen: true
72
73
  }
73
74
  },
74
75
  computed: {
@@ -203,15 +204,15 @@ export default {
203
204
  h('div', {
204
205
  class: 'vxe-modal--content'
205
206
  }, defaultSlot ? (!inited || (destroyOnClose && !visible) ? [] : defaultSlot.call(this, { $modal: this }, h)) : getFuncText(content)),
206
- !isMsg ? h('div', {
207
- class: ['vxe-loading', {
208
- 'is--visible': loading
209
- }]
210
- }, [
211
- h('div', {
212
- class: 'vxe-loading--spinner'
213
- })
214
- ]) : null
207
+ /**
208
+ * 加载中
209
+ */
210
+ !isMsg ? h(VxeLoading, {
211
+ class: 'vxe-modal--loading',
212
+ props: {
213
+ loading
214
+ }
215
+ }) : null
215
216
  ]),
216
217
  showFooter ? h('div', {
217
218
  class: 'vxe-modal--footer'
@@ -346,18 +347,22 @@ export default {
346
347
  } else {
347
348
  this.$nextTick(() => {
348
349
  const { firstOpen, fullscreen } = this
349
- if (!remember || !firstOpen) {
350
+ if (!remember || firstOpen) {
350
351
  this.updatePosition().then(() => {
351
352
  setTimeout(() => this.updatePosition(), 20)
352
353
  })
353
354
  }
354
- if (!firstOpen) {
355
- this.firstOpen = true
355
+ if (firstOpen) {
356
+ this.firstOpen = false
356
357
  if (this.hasPosStorage()) {
357
358
  this.restorePosStorage()
358
359
  } else if (fullscreen) {
359
360
  this.$nextTick(() => this.maximize())
360
361
  }
362
+ } else {
363
+ if (fullscreen) {
364
+ this.$nextTick(() => this.maximize())
365
+ }
361
366
  }
362
367
  })
363
368
  }
@@ -2472,7 +2472,8 @@ const Methods = {
2472
2472
  // }
2473
2473
  // 如果是按下非功能键之外允许直接编辑
2474
2474
  if (selected.column && selected.row && isEnableConf(selected.column.editRender)) {
2475
- if (!editOpts.activeMethod || editOpts.activeMethod({ ...selected.args, $table: this })) {
2475
+ const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod
2476
+ if (!beforeEditMethod || beforeEditMethod({ ...selected.args, $table: this })) {
2476
2477
  if (editMethod) {
2477
2478
  editMethod({
2478
2479
  row: selected.row,
@@ -9,6 +9,7 @@ import { createResizeEvent } from '../../tools/resize'
9
9
  import { GlobalEvent } from '../../tools/event'
10
10
  import methods from './methods'
11
11
  import { warnLog, errLog } from '../../tools/log'
12
+ import VxeLoading from '../../loading/index'
12
13
 
13
14
  /**
14
15
  * 渲染浮固定列
@@ -829,6 +830,9 @@ export default {
829
830
  if (this.emptyRender && !XEUtils.isObject(this.emptyRender)) {
830
831
  warnLog('vxe.error.errProp', [`table.empty-render=${this.emptyRender}`, 'table.empty-render={}'])
831
832
  }
833
+ // if (this.editConfig && this.editConfig.activeMethod) {
834
+ // warnLog('vxe.error.delProp', ['table.edit-config.activeMethod', 'table.edit-config.beforeEditMethod'])
835
+ // }
832
836
  }
833
837
 
834
838
  // 检查是否有安装需要的模块
@@ -1083,15 +1087,12 @@ export default {
1083
1087
  /**
1084
1088
  * 加载中
1085
1089
  */
1086
- h('div', {
1087
- class: ['vxe-table--loading vxe-loading', {
1088
- 'is--visible': loading
1089
- }]
1090
- }, [
1091
- h('div', {
1092
- class: 'vxe-loading--spinner'
1093
- })
1094
- ]),
1090
+ h(VxeLoading, {
1091
+ class: 'vxe-table--loading',
1092
+ props: {
1093
+ loading
1094
+ }
1095
+ }),
1095
1096
  /**
1096
1097
  * 筛选
1097
1098
  */
@@ -6,6 +6,7 @@ export default {
6
6
  version: 0, // 版本号,对于某些带数据缓存的功能有用到,上升版本号可以用于重置数据
7
7
  // resizeInterval: 500,
8
8
  emptyCell: ' ',
9
+ loadingText: null, // 自定义loading提示内容,如果为null则不显示文本
9
10
  table: {
10
11
  fit: true,
11
12
  showHeader: true,
@@ -123,6 +124,9 @@ export default {
123
124
  types: {}
124
125
  },
125
126
  icon: {
127
+ // loading
128
+ // LOADING: iconPrefix + 'refresh roll vxe-loading--default-icon',
129
+
126
130
  // table
127
131
  TABLE_SORT_ASC: iconPrefix + 'caret-top',
128
132
  TABLE_SORT_DESC: iconPrefix + 'caret-bottom',
package/styles/form.scss CHANGED
@@ -177,6 +177,7 @@
177
177
  .vxe-form--item-content {
178
178
  position: relative;
179
179
  flex-grow: 1;
180
+ word-break: break-all;
180
181
  }
181
182
  }
182
183
  .vxe-default-input,
@@ -12,13 +12,26 @@
12
12
  &.is--visible {
13
13
  display: block;
14
14
  }
15
+ & > .vxe-loading--chunk {
16
+ width: 100%;
17
+ position: absolute;
18
+ top: 50%;
19
+ left: 0;
20
+ transform: translateY(-50%);
21
+ text-align: center;
22
+ color: $vxe-primary-color;
23
+ }
24
+ .vxe-loading--default-icon {
25
+ font-size: 1.2em;
26
+ }
27
+ .vxe-loading--text {
28
+ padding: 0.4em 0;
29
+ }
15
30
  .vxe-loading--spinner {
31
+ display: inline-block;
32
+ position: relative;
16
33
  width: 56px;
17
34
  height: 56px;
18
- position: absolute;
19
- top: 50%;
20
- left: 50%;
21
- transform: translate(-50%, -50%);
22
35
  &:before,
23
36
  &:after {
24
37
  content: "";
@@ -1,4 +1,5 @@
1
1
  @import './icon.scss';
2
+ @import './loading.scss';
2
3
  @import './table.scss';
3
4
  @import './column.scss';
4
5
  @import './colgroup.scss';
@@ -1,6 +1,5 @@
1
1
  /**Variable**/
2
2
  @import './helpers/mixin.scss';
3
- @import './base/loading.scss';
4
3
 
5
4
  .vxe-select {
6
5
  position: relative;
package/styles/table.scss CHANGED
@@ -2,7 +2,6 @@
2
2
  @import './helpers/mixin.scss';
3
3
  @import './base/checked.scss';
4
4
  @import './base/common.scss';
5
- @import './base/loading.scss';
6
5
 
7
6
  %DefaultColumnHeight {
8
7
  height: $vxe-table-row-height-default;
@@ -1 +1,3 @@
1
1
  /**Variable**/
2
+ @import './icon.scss';
3
+ @import './loading.scss';
package/types/table.d.ts CHANGED
@@ -1426,6 +1426,11 @@ export interface TableEditConfig {
1426
1426
  /**
1427
1427
  * 该方法的返回值用来决定该单元格是否允许编辑
1428
1428
  */
1429
+ beforeEditMethod?(params: { row: RowInfo, rowIndex: number, column: ColumnInfo, columnIndex: number }): boolean;
1430
+ /**
1431
+ * 请使用 beforeEditMethod
1432
+ * @deprecated
1433
+ */
1429
1434
  activeMethod?(params: { row: RowInfo, rowIndex: number, column: ColumnInfo, columnIndex: number }): boolean;
1430
1435
  }
1431
1436
  export interface EditConfig extends TableEditConfig {}