vxe-pc-ui 4.15.25 → 4.15.26

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 (52) hide show
  1. package/dist/all.esm.js +586 -34
  2. package/dist/style.css +1 -1
  3. package/dist/style.min.css +1 -1
  4. package/es/icon/style.css +1 -1
  5. package/es/list/src/list.js +567 -26
  6. package/es/list/src/util.js +8 -0
  7. package/es/list/style.css +10 -4
  8. package/es/list/style.min.css +1 -1
  9. package/es/style.css +1 -1
  10. package/es/style.min.css +1 -1
  11. package/es/ui/index.js +4 -1
  12. package/es/ui/src/log.js +1 -1
  13. package/es/vxe-list/style.css +10 -4
  14. package/es/vxe-list/style.min.css +1 -1
  15. package/lib/icon/style/style.css +1 -1
  16. package/lib/icon/style/style.min.css +1 -1
  17. package/lib/index.umd.js +666 -24
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/list/src/list.js +647 -18
  20. package/lib/list/src/list.min.js +1 -1
  21. package/lib/list/src/util.js +14 -0
  22. package/lib/list/src/util.min.js +1 -0
  23. package/lib/list/style/style.css +10 -4
  24. package/lib/list/style/style.min.css +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/ui/index.js +4 -1
  28. package/lib/ui/index.min.js +1 -1
  29. package/lib/ui/src/log.js +1 -1
  30. package/lib/ui/src/log.min.js +1 -1
  31. package/lib/vxe-list/style/style.css +10 -4
  32. package/lib/vxe-list/style/style.min.css +1 -1
  33. package/package.json +1 -1
  34. package/packages/list/src/list.ts +581 -22
  35. package/packages/list/src/util.ts +11 -0
  36. package/packages/ui/index.ts +3 -0
  37. package/styles/components/list.scss +8 -4
  38. package/types/components/list.d.ts +119 -4
  39. package/types/components/tree.d.ts +2 -2
  40. package/types/ui/menus.d.ts +13 -1
  41. /package/es/icon/{iconfont.1783247320664.ttf → iconfont.1783301651996.ttf} +0 -0
  42. /package/es/icon/{iconfont.1783247320664.woff → iconfont.1783301651996.woff} +0 -0
  43. /package/es/icon/{iconfont.1783247320664.woff2 → iconfont.1783301651996.woff2} +0 -0
  44. /package/es/{iconfont.1783247320664.ttf → iconfont.1783301651996.ttf} +0 -0
  45. /package/es/{iconfont.1783247320664.woff → iconfont.1783301651996.woff} +0 -0
  46. /package/es/{iconfont.1783247320664.woff2 → iconfont.1783301651996.woff2} +0 -0
  47. /package/lib/icon/style/{iconfont.1783247320664.ttf → iconfont.1783301651996.ttf} +0 -0
  48. /package/lib/icon/style/{iconfont.1783247320664.woff → iconfont.1783301651996.woff} +0 -0
  49. /package/lib/icon/style/{iconfont.1783247320664.woff2 → iconfont.1783301651996.woff2} +0 -0
  50. /package/lib/{iconfont.1783247320664.ttf → iconfont.1783301651996.ttf} +0 -0
  51. /package/lib/{iconfont.1783247320664.woff → iconfont.1783301651996.woff} +0 -0
  52. /package/lib/{iconfont.1783247320664.woff2 → iconfont.1783301651996.woff2} +0 -0
package/dist/all.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as core from '@vxe-ui/core';
2
- import { VxeUI, setConfig as setConfig$1, setIcon, getConfig as getConfig$3, createEvent, getIcon as getIcon$2, renderEmptyElement, useSize, usePermission, permission, globalEvents, renderer, getI18n as getI18n$2, globalResize, GLOBAL_EVENT_KEYS, getSlotVNs as getSlotVNs$1, commands, formats, getComponent, validators } from '@vxe-ui/core';
2
+ import { VxeUI, setConfig as setConfig$1, setIcon, getConfig as getConfig$3, createEvent, getIcon as getIcon$2, renderEmptyElement, useSize, usePermission, permission, globalEvents, renderer, getI18n as getI18n$2, globalResize, menus as menus$3, GLOBAL_EVENT_KEYS, getSlotVNs as getSlotVNs$1, commands, formats, getComponent, validators } from '@vxe-ui/core';
3
3
  export * from '@vxe-ui/core';
4
4
  import { defineComponent, reactive, h, createCommentVNode, createApp, ref, inject, computed, watch, onMounted, onUnmounted, provide, nextTick, onBeforeUnmount, resolveComponent, Teleport, onActivated, onDeactivated, TransitionGroup } from 'vue';
5
5
  import XEUtils from 'xe-utils';
@@ -81,7 +81,7 @@ function checkDynamic() {
81
81
  }
82
82
 
83
83
  const { log } = VxeUI;
84
- const uiVersion = `ui v${"4.15.25"}`;
84
+ const uiVersion = `ui v${"4.15.26"}`;
85
85
  function createComponentLog(name) {
86
86
  const tableVersion = VxeUI.tableVersion ? `table v${VxeUI.tableVersion}` : '';
87
87
  const ganttVersion = VxeUI.ganttVersion ? `gantt v${VxeUI.ganttVersion}` : '';
@@ -92,18 +92,18 @@ function createComponentLog(name) {
92
92
  errLog: log.create('error', versionInfo + '] [' + name)
93
93
  };
94
94
  }
95
- const warnLog$g = log.create('warn', uiVersion);
95
+ const warnLog$h = log.create('warn', uiVersion);
96
96
  log.create('error', uiVersion);
97
97
 
98
- const version = "4.15.25";
98
+ const version = "4.15.26";
99
99
  VxeUI.uiVersion = version;
100
100
  VxeUI.dynamicApp = dynamicApp;
101
101
  function config(options) {
102
- warnLog$g('vxe.error.delFunc', ['config', 'setConfig']);
102
+ warnLog$h('vxe.error.delFunc', ['config', 'setConfig']);
103
103
  return setConfig$1(options);
104
104
  }
105
105
  function setup(options) {
106
- warnLog$g('vxe.error.delFunc', ['setup', 'setConfig']);
106
+ warnLog$h('vxe.error.delFunc', ['setup', 'setConfig']);
107
107
  return setConfig$1(options);
108
108
  }
109
109
  VxeUI.config = config;
@@ -318,6 +318,9 @@ setConfig$1({
318
318
  listView: {},
319
319
  list: {
320
320
  // size: null,
321
+ rowConfig: {
322
+ contentField: 'label'
323
+ },
321
324
  dragConfig: {
322
325
  showIcon: true,
323
326
  animation: true,
@@ -3120,7 +3123,7 @@ dynamicApp.use(VxeTooltip);
3120
3123
  VxeUI.component(VxeTooltipComponent);
3121
3124
  const Tooltip = VxeTooltip;
3122
3125
 
3123
- const { warnLog: warnLog$f } = createComponentLog('button');
3126
+ const { warnLog: warnLog$g } = createComponentLog('button');
3124
3127
  const VxeButtonComponent = defineVxeComponent({
3125
3128
  name: 'VxeButton',
3126
3129
  props: {
@@ -3839,7 +3842,7 @@ const VxeButtonComponent = defineVxeComponent({
3839
3842
  $xeButton.renderVN = renderVN;
3840
3843
  onMounted(() => {
3841
3844
  if (props.type === 'text') {
3842
- warnLog$f('vxe.error.delProp', ['type=text', 'mode=text']);
3845
+ warnLog$g('vxe.error.delProp', ['type=text', 'mode=text']);
3843
3846
  }
3844
3847
  globalEvents.on($xeButton, 'mousewheel', handleGlobalMousewheelEvent);
3845
3848
  globalEvents.on($xeButton, 'mousedown', handleGlobalMousedownEvent);
@@ -6869,7 +6872,16 @@ function clearRowAnimate(elem, clss) {
6869
6872
  }, 500);
6870
6873
  }
6871
6874
 
6872
- const { errLog: errLog$g } = createComponentLog('tree');
6875
+ function getItemCacheObj$1(item) {
6876
+ return {
6877
+ item,
6878
+ index: -1,
6879
+ $index: -1,
6880
+ _index: -1
6881
+ };
6882
+ }
6883
+
6884
+ const { warnLog: warnLog$f, errLog: errLog$g } = createComponentLog('tree');
6873
6885
  function getRowKeyByField(row, keyField) {
6874
6886
  return row ? ('' + (row[keyField] || '')) : '';
6875
6887
  }
@@ -6896,15 +6908,20 @@ function createReactData$j() {
6896
6908
  updateCheckboxFlag: 1,
6897
6909
  isAllChecked: false,
6898
6910
  isAllIndeterminate: false,
6911
+ insertRowFlag: 1,
6912
+ removeRowFlag: 1,
6899
6913
  dragRow: null,
6900
- dragTipText: ''
6914
+ dragTipText: '',
6915
+ isCrossDragRow: false
6901
6916
  };
6902
6917
  }
6903
6918
  function createInternalData$i() {
6904
6919
  return {
6905
6920
  resizeObserver: undefined,
6906
6921
  fullData: [],
6922
+ afterList: [],
6907
6923
  fullKeyMaps: {},
6924
+ rowMaps: {},
6908
6925
  lastScrollLeft: 0,
6909
6926
  lastScrollTop: 0,
6910
6927
  scrollYStore: {
@@ -6915,11 +6932,14 @@ function createInternalData$i() {
6915
6932
  rowHeight: 0
6916
6933
  },
6917
6934
  currentRow: null,
6918
- selectCheckboxMaps: {}
6935
+ selectCheckboxMaps: {},
6936
+ insertRowMaps: {},
6937
+ removeRowMaps: {}
6919
6938
  // prevDragRow: null,
6920
6939
  // prevDragPos: ''
6921
6940
  };
6922
6941
  }
6942
+ let crossListDragRowObj = null;
6923
6943
  var VxeListComponent = defineVxeComponent({
6924
6944
  name: 'VxeList',
6925
6945
  props: {
@@ -6937,6 +6957,10 @@ var VxeListComponent = defineVxeComponent({
6937
6957
  default: () => getConfig$3().list.autoResize
6938
6958
  },
6939
6959
  syncResize: [Boolean, String, Number],
6960
+ showSeq: {
6961
+ type: Boolean,
6962
+ default: () => getConfig$3().list.showSeq
6963
+ },
6940
6964
  showRadio: {
6941
6965
  type: Boolean,
6942
6966
  default: () => getConfig$3().list.showRadio
@@ -6951,6 +6975,7 @@ var VxeListComponent = defineVxeComponent({
6951
6975
  checkboxConfig: Object,
6952
6976
  rowConfig: Object,
6953
6977
  dragConfig: Object,
6978
+ menuConfig: Object,
6954
6979
  virtualYConfig: Object,
6955
6980
  scrollY: Object
6956
6981
  },
@@ -6966,7 +6991,11 @@ var VxeListComponent = defineVxeComponent({
6966
6991
  'scroll',
6967
6992
  'row-dragstart',
6968
6993
  'row-dragover',
6969
- 'row-dragend'
6994
+ 'row-dragend',
6995
+ 'row-remove-dragend',
6996
+ 'row-insert-dragend',
6997
+ 'row-menu',
6998
+ 'menu-click'
6970
6999
  ],
6971
7000
  setup(props, context) {
6972
7001
  const { slots, emit } = context;
@@ -7024,6 +7053,9 @@ var VxeListComponent = defineVxeComponent({
7024
7053
  const computeCheckboxOpts = computed(() => {
7025
7054
  return Object.assign({ showIcon: true }, getConfig$3().list.checkboxConfig, props.checkboxConfig);
7026
7055
  });
7056
+ const computeMenuOpts = computed(() => {
7057
+ return Object.assign({}, getConfig$3().list.menuConfig, props.menuConfig);
7058
+ });
7027
7059
  const computeWrapperStyles = computed(() => {
7028
7060
  const rowHeight = computeRowHeight.value;
7029
7061
  const style = {};
@@ -7092,10 +7124,30 @@ var VxeListComponent = defineVxeComponent({
7092
7124
  reactData.bodyHeight = scrollYLoad ? fullData.length * scrollYStore.rowHeight : 0;
7093
7125
  reactData.topSpaceHeight = scrollYLoad ? Math.max(scrollYStore.startIndex * scrollYStore.rowHeight, 0) : 0;
7094
7126
  };
7095
- const handleData = () => {
7127
+ const updateAfterFullData = () => {
7128
+ const { fullData } = internalData;
7129
+ internalData.afterList = fullData.slice(0);
7130
+ updateAfterDataIndex();
7131
+ };
7132
+ const handleData = (force) => {
7096
7133
  const { scrollYLoad } = reactData;
7097
- const { fullData, scrollYStore } = internalData;
7098
- reactData.rowList = scrollYLoad ? fullData.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullData.slice(0);
7134
+ const { fullData, scrollYStore, rowMaps } = internalData;
7135
+ const keyField = computeKeyField.value;
7136
+ if (force) {
7137
+ // 更新数据,处理筛选和排序
7138
+ updateAfterFullData();
7139
+ }
7140
+ const rowList = scrollYLoad ? fullData.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullData.slice(0);
7141
+ if (keyField) {
7142
+ rowList.forEach((item, $index) => {
7143
+ const rowid = getRowIdByField(item, keyField);
7144
+ const rowRest = rowMaps[rowid];
7145
+ if (rowRest) {
7146
+ rowRest.$index = $index;
7147
+ }
7148
+ });
7149
+ }
7150
+ reactData.rowList = rowList;
7099
7151
  return nextTick();
7100
7152
  };
7101
7153
  const updateYData = () => {
@@ -7261,15 +7313,48 @@ var VxeListComponent = defineVxeComponent({
7261
7313
  internalData.selectCheckboxMaps = selectMaps;
7262
7314
  updateCheckboxStatus();
7263
7315
  };
7316
+ const updateAfterDataIndex = () => {
7317
+ const { afterList, rowMaps } = internalData;
7318
+ const keyField = computeKeyField.value;
7319
+ let vtIndex = 0;
7320
+ afterList.forEach((item, index) => {
7321
+ const roweid = getRowIdByField(item, keyField);
7322
+ const rowRest = rowMaps[roweid];
7323
+ if (rowRest) {
7324
+ rowRest._index = vtIndex;
7325
+ }
7326
+ else {
7327
+ const rest = {
7328
+ item,
7329
+ index,
7330
+ $index: -1,
7331
+ _index: vtIndex
7332
+ };
7333
+ rowMaps[roweid] = rest;
7334
+ }
7335
+ vtIndex++;
7336
+ });
7337
+ };
7264
7338
  const cacheRowMap = () => {
7265
7339
  const { fullData } = internalData;
7266
7340
  const keyField = computeKeyField.value;
7267
7341
  const keyMaps = {};
7268
- fullData.forEach(row => {
7269
- const rowKey = getRowKeyByField(row, keyField);
7270
- keyMaps[rowKey] = row;
7271
- });
7342
+ const rowMaps = {};
7343
+ if (keyField) {
7344
+ fullData.forEach((row, rowIndex) => {
7345
+ const rowid = getRowIdByField(row, keyField);
7346
+ const rowKey = getRowKeyByField(row, keyField);
7347
+ keyMaps[rowKey] = row;
7348
+ rowMaps[rowid] = {
7349
+ item: row,
7350
+ index: rowIndex,
7351
+ $index: -1,
7352
+ _index: -1
7353
+ };
7354
+ });
7355
+ }
7272
7356
  internalData.fullKeyMaps = keyMaps;
7357
+ internalData.rowMaps = rowMaps;
7273
7358
  };
7274
7359
  /**
7275
7360
  * 加载数据
@@ -7278,23 +7363,32 @@ var VxeListComponent = defineVxeComponent({
7278
7363
  const loadData = (datas) => {
7279
7364
  const { scrollYStore } = internalData;
7280
7365
  const sYOpts = computeSYOpts.value;
7281
- const fullData = datas || [];
7366
+ const fullData = datas ? datas.slice(0) : [];
7282
7367
  Object.assign(scrollYStore, {
7283
7368
  startIndex: 0,
7284
7369
  endIndex: 1,
7285
7370
  visibleSize: 0
7286
7371
  });
7287
7372
  internalData.fullData = fullData;
7373
+ internalData.insertRowMaps = {};
7374
+ reactData.insertRowFlag++;
7375
+ internalData.removeRowMaps = {};
7376
+ reactData.removeRowFlag++;
7288
7377
  // 如果gt为0,则总是启用
7289
7378
  reactData.scrollYLoad = !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt <= fullData.length);
7290
7379
  cacheRowMap();
7291
- handleData();
7380
+ handleData(true);
7292
7381
  updateRadioModeValue();
7293
7382
  updateCheckboxModeValue();
7294
7383
  return computeScrollLoad().then(() => {
7295
7384
  refreshScroll();
7296
7385
  });
7297
7386
  };
7387
+ const handleRowDragEndClearStatus = () => {
7388
+ clearRowDragData();
7389
+ clearCrossListDragStatus();
7390
+ recalculate();
7391
+ };
7298
7392
  const clearRowDropOrigin = () => {
7299
7393
  const el = refElem.value;
7300
7394
  if (el) {
@@ -7346,7 +7440,7 @@ var VxeListComponent = defineVxeComponent({
7346
7440
  }
7347
7441
  };
7348
7442
  const clearCrossListDragStatus = () => {
7349
- // crossListDragRowObj = null
7443
+ crossListDragRowObj = null;
7350
7444
  crossListDragRowInfo.row = null;
7351
7445
  };
7352
7446
  const clearDragStatus = () => {
@@ -7362,7 +7456,7 @@ var VxeListComponent = defineVxeComponent({
7362
7456
  evnt.stopPropagation();
7363
7457
  const { row } = params;
7364
7458
  const dragConfig = computeDragOpts.value;
7365
- const { trigger, dragStartMethod } = dragConfig;
7459
+ const { isCrossListDrag, trigger, dragStartMethod } = dragConfig;
7366
7460
  const dragEl = evnt.currentTarget;
7367
7461
  const rowEl = trigger === 'row' ? dragEl : dragEl.parentElement.parentElement;
7368
7462
  clearRowDropOrigin();
@@ -7372,10 +7466,15 @@ var VxeListComponent = defineVxeComponent({
7372
7466
  hideDropTip();
7373
7467
  return;
7374
7468
  }
7469
+ if (isCrossListDrag) {
7470
+ crossListDragRowInfo.row = row;
7471
+ crossListDragRowObj = { $oldList: $xeList, $newList: null };
7472
+ }
7375
7473
  const dragstartEventParams = {
7376
7474
  row
7377
7475
  };
7378
7476
  reactData.dragRow = row;
7477
+ reactData.isCrossDragRow = false;
7379
7478
  rowEl.draggable = true;
7380
7479
  updateRowDropOrigin(row);
7381
7480
  updateRowDropTipContent(rowEl);
@@ -7578,11 +7677,23 @@ var VxeListComponent = defineVxeComponent({
7578
7677
  const handleRowDragDragendEvent = (evnt) => {
7579
7678
  const { dragRow } = reactData;
7580
7679
  const { prevDragRow, prevDragPos } = internalData;
7680
+ const dragConfig = computeDragOpts.value;
7681
+ const { isCrossListDrag } = dragConfig;
7682
+ // 跨列表拖拽
7683
+ if (isCrossListDrag && crossListDragRowObj) {
7684
+ const { $newList } = crossListDragRowObj;
7685
+ if ($newList && $newList.xID !== $xeList.xID) {
7686
+ $newList.handleCrossListRowDragInsertEvent(evnt);
7687
+ return;
7688
+ }
7689
+ }
7581
7690
  handleRowDragSwapEvent(evnt, dragRow, prevDragRow, prevDragPos);
7582
7691
  };
7583
7692
  const handleRowDragDragoverEvent = (evnt) => {
7584
7693
  const { dragRow } = reactData;
7585
7694
  const { fullData } = internalData;
7695
+ const dragConfig = computeDragOpts.value;
7696
+ const { isCrossListDrag } = dragConfig;
7586
7697
  if (!dragRow) {
7587
7698
  evnt.preventDefault();
7588
7699
  }
@@ -7595,6 +7706,32 @@ var VxeListComponent = defineVxeComponent({
7595
7706
  const dragPos = offsetY < rowEl.clientHeight / 2 ? 'top' : 'bottom';
7596
7707
  internalData.prevDragRow = row;
7597
7708
  internalData.prevDragPos = dragPos;
7709
+ // 跨列表拖拽
7710
+ if (isCrossListDrag && crossListDragRowObj) {
7711
+ const { $oldList, $newList } = crossListDragRowObj;
7712
+ if ($oldList) {
7713
+ const oldListReactData = $oldList.reactData;
7714
+ if ($oldList.xID === $xeList.xID) {
7715
+ if ($newList) {
7716
+ $newList.hideCrossListRowDropClearStatus();
7717
+ }
7718
+ reactData.isCrossDragRow = false;
7719
+ oldListReactData.isCrossDragRow = false;
7720
+ crossListDragRowObj.$newList = null;
7721
+ }
7722
+ else {
7723
+ if ($newList && $newList.xID !== $xeList.xID) {
7724
+ $newList.hideCrossListRowDropClearStatus();
7725
+ }
7726
+ $oldList.hideCrossListRowDropClearStatus();
7727
+ oldListReactData.isCrossDragRow = true;
7728
+ reactData.dragTipText = oldListReactData.dragTipText;
7729
+ crossListDragRowObj.$newList = $xeList;
7730
+ showDropTip(evnt, rowEl, true, dragPos);
7731
+ return;
7732
+ }
7733
+ }
7734
+ }
7598
7735
  if ((dragRow && getRowId(dragRow) === rowid)) {
7599
7736
  showDropTip(evnt, rowEl, false, dragPos);
7600
7737
  return;
@@ -7979,6 +8116,135 @@ var VxeListComponent = defineVxeComponent({
7979
8116
  emitRadioMode(value);
7980
8117
  dispatchEvent('radio-change', { row, value, checked: isChecked }, evnt);
7981
8118
  };
8119
+ const insertListRow = (newRecords, isAppend) => {
8120
+ const { fullData, rowMaps } = internalData;
8121
+ const keyField = computeKeyField.value;
8122
+ const funcName = isAppend ? 'push' : 'unshift';
8123
+ newRecords.forEach((item) => {
8124
+ const rowid = getRowIdByField(item, keyField);
8125
+ const rowRest = getItemCacheObj$1(item);
8126
+ fullData[funcName](item);
8127
+ rowMaps[rowid] = rowRest;
8128
+ });
8129
+ };
8130
+ const handleInsertRowAt = (records, targetRowOrRowKey, isInsertNextRow) => {
8131
+ const { fullData, rowMaps, removeRowMaps, insertRowMaps } = internalData;
8132
+ const keyField = computeKeyField.value;
8133
+ if (!keyField) {
8134
+ errLog$g('vxe.error.reqSupportProp', ['insert() | insertAt() | insertNextAt()', 'row-config.keyField']);
8135
+ return Promise.resolve({ row: null, rows: [] });
8136
+ }
8137
+ if (!XEUtils.isArray(records)) {
8138
+ records = [records];
8139
+ }
8140
+ let targetRow = targetRowOrRowKey;
8141
+ if (XEUtils.isString(targetRowOrRowKey) || XEUtils.isNumber(targetRowOrRowKey)) {
8142
+ const rowRest = rowMaps[targetRowOrRowKey];
8143
+ if (rowRest) {
8144
+ targetRow = rowRest.item;
8145
+ }
8146
+ }
8147
+ if (!records.length) {
8148
+ return Promise.resolve({ row: null, rows: [] });
8149
+ }
8150
+ const newRecords = records.map(record => XEUtils.assign({}, record));
8151
+ if (XEUtils.eqNull(targetRow)) {
8152
+ insertListRow(newRecords, false);
8153
+ }
8154
+ else {
8155
+ if (targetRow === -1) {
8156
+ insertListRow(newRecords, true);
8157
+ }
8158
+ else {
8159
+ const rowIndex = fullData.findIndex(item => targetRow[keyField] === item[keyField]);
8160
+ if (rowIndex > -1) {
8161
+ newRecords.forEach(item => {
8162
+ const rowid = getRowIdByField(item, keyField);
8163
+ const rowRest = getItemCacheObj$1(item);
8164
+ rowMaps[rowid] = rowRest;
8165
+ });
8166
+ let targetIndex = rowIndex;
8167
+ if (isInsertNextRow) {
8168
+ targetIndex = targetIndex + 1;
8169
+ }
8170
+ fullData.splice(targetIndex, 0, ...newRecords);
8171
+ }
8172
+ else {
8173
+ warnLog$f('vxe.error.unableInsert');
8174
+ insertListRow(newRecords, true);
8175
+ }
8176
+ }
8177
+ }
8178
+ newRecords.forEach((newItem) => {
8179
+ const rowid = getRowIdByField(newItem, keyField);
8180
+ // 如果是被删除的数据,则还原状态
8181
+ if (removeRowMaps[rowid]) {
8182
+ delete removeRowMaps[rowid];
8183
+ if (insertRowMaps[rowid]) {
8184
+ delete insertRowMaps[rowid];
8185
+ }
8186
+ }
8187
+ else {
8188
+ insertRowMaps[rowid] = newItem;
8189
+ }
8190
+ });
8191
+ reactData.removeRowFlag++;
8192
+ reactData.insertRowFlag++;
8193
+ cacheRowMap();
8194
+ handleData(true);
8195
+ updateAfterDataIndex();
8196
+ updateCheckboxStatus();
8197
+ if (reactData.scrollYLoad) {
8198
+ updateYSpace();
8199
+ }
8200
+ return nextTick().then(() => {
8201
+ return {
8202
+ row: newRecords.length ? newRecords[newRecords.length - 1] : null,
8203
+ rows: newRecords
8204
+ };
8205
+ });
8206
+ };
8207
+ const handleContextmenuEvent = (evnt, row) => {
8208
+ const { menuConfig } = props;
8209
+ const menuOpts = computeMenuOpts.value;
8210
+ const rowOpts = computeRowOpts.value;
8211
+ const { isCurrent } = rowOpts;
8212
+ if (menuConfig ? isEnableConf(menuOpts) : menuOpts.enabled) {
8213
+ const { options, visibleMethod } = menuOpts;
8214
+ if (!visibleMethod || visibleMethod({ $list: $xeList, options, row })) {
8215
+ if (isCurrent) {
8216
+ changeCurrentEvent(evnt, row);
8217
+ }
8218
+ else if (internalData.currentRow) {
8219
+ internalData.currentRow = null;
8220
+ reactData.currRowFlag++;
8221
+ }
8222
+ if (VxeUI.contextMenu) {
8223
+ VxeUI.contextMenu.openByEvent(evnt, {
8224
+ options,
8225
+ events: {
8226
+ optionClick(eventParams) {
8227
+ const { option } = eventParams;
8228
+ const gMenuOpts = menus$3.get(option.code);
8229
+ const tmMethod = gMenuOpts ? gMenuOpts.listMenuMethod : null;
8230
+ const params = {
8231
+ menu: option,
8232
+ row,
8233
+ $event: evnt,
8234
+ $list: $xeList
8235
+ };
8236
+ if (tmMethod) {
8237
+ tmMethod(params, evnt);
8238
+ }
8239
+ dispatchEvent('menu-click', params, eventParams.$event);
8240
+ }
8241
+ }
8242
+ });
8243
+ }
8244
+ }
8245
+ }
8246
+ dispatchEvent('row-menu', { row }, evnt);
8247
+ };
7982
8248
  const listMethods = {
7983
8249
  dispatchEvent,
7984
8250
  loadData,
@@ -8025,9 +8291,282 @@ var VxeListComponent = defineVxeComponent({
8025
8291
  getCheckboxRows,
8026
8292
  getCheckboxRowKeys,
8027
8293
  clearCheckboxRow,
8028
- setAllCheckboxRow
8294
+ setAllCheckboxRow,
8295
+ insert(records) {
8296
+ return handleInsertRowAt(records, null);
8297
+ },
8298
+ insertAt(records, targetRowOrRowKey) {
8299
+ return handleInsertRowAt(records, targetRowOrRowKey);
8300
+ },
8301
+ insertNextAt(records, targetRowOrRowKey) {
8302
+ return handleInsertRowAt(records, targetRowOrRowKey, true);
8303
+ },
8304
+ getInsertRecords() {
8305
+ const { insertRowMaps } = internalData;
8306
+ const insertRecords = [];
8307
+ XEUtils.each(insertRowMaps, (item) => {
8308
+ insertRecords.push(item);
8309
+ });
8310
+ return insertRecords;
8311
+ },
8312
+ isInsertByRow(row) {
8313
+ const rowid = getRowId(row);
8314
+ return !!reactData.insertRowFlag && !!internalData.insertRowMaps[rowid];
8315
+ },
8316
+ remove(rows) {
8317
+ const { fullData, insertRowMaps, removeRowMaps } = internalData;
8318
+ const keyField = computeKeyField.value;
8319
+ if (!keyField) {
8320
+ errLog$g('vxe.error.reqSupportProp', ['insert() | insertAt() | insertNextAt()', 'row-config.keyField']);
8321
+ return Promise.resolve({ row: null, rows: [] });
8322
+ }
8323
+ let delList = [];
8324
+ if (!rows) {
8325
+ rows = fullData;
8326
+ }
8327
+ else if (!XEUtils.isArray(rows)) {
8328
+ rows = [rows];
8329
+ }
8330
+ if (!rows.length) {
8331
+ return Promise.resolve({ row: null, rows: [] });
8332
+ }
8333
+ // 如果是新增,则保存记录
8334
+ rows.forEach((item) => {
8335
+ if (!$xeList.isInsertByRow(item)) {
8336
+ const rowid = getRowId(item);
8337
+ removeRowMaps[rowid] = item;
8338
+ }
8339
+ });
8340
+ // 从数据源中移除
8341
+ if (fullData === rows) {
8342
+ rows = delList = fullData.slice(0);
8343
+ internalData.fullData = [];
8344
+ }
8345
+ else {
8346
+ rows.forEach((item) => {
8347
+ const rowid = getRowId(item);
8348
+ const rowIndex = XEUtils.findIndexOf(fullData, item => rowid === getRowId(item));
8349
+ if (rowIndex > -1) {
8350
+ const rItems = fullData.splice(rowIndex, 1);
8351
+ delList.push(rItems[0]);
8352
+ }
8353
+ });
8354
+ }
8355
+ // 从新增中移除已删除的数据
8356
+ rows.forEach((item) => {
8357
+ const rowid = getRowId(item);
8358
+ if (insertRowMaps[rowid]) {
8359
+ delete insertRowMaps[rowid];
8360
+ }
8361
+ });
8362
+ reactData.removeRowFlag++;
8363
+ reactData.insertRowFlag++;
8364
+ cacheRowMap();
8365
+ handleData(true);
8366
+ updateAfterDataIndex();
8367
+ updateCheckboxStatus();
8368
+ if (reactData.scrollYLoad) {
8369
+ updateYSpace();
8370
+ }
8371
+ return nextTick().then(() => {
8372
+ return recalculate();
8373
+ }).then(() => {
8374
+ return { row: delList.length ? delList[delList.length - 1] : null, rows: delList };
8375
+ });
8376
+ },
8377
+ getRemoveRecords() {
8378
+ const { removeRowMaps } = internalData;
8379
+ const removeRecords = [];
8380
+ XEUtils.each(removeRowMaps, (item) => {
8381
+ removeRecords.push(item);
8382
+ });
8383
+ return removeRecords;
8384
+ },
8385
+ isRemoveByRow(row) {
8386
+ const rowid = getRowId(row);
8387
+ return !!reactData.removeRowFlag && !!internalData.removeRowMaps[rowid];
8388
+ }
8389
+ };
8390
+ const listPrivateMethods = {
8391
+ handleCrossListRowDragCancelEvent() {
8392
+ clearRowDragData();
8393
+ clearCrossListDragStatus();
8394
+ },
8395
+ /**
8396
+ * 处理跨树拖拽完成
8397
+ */
8398
+ handleCrossListRowDragFinishEvent(evnt) {
8399
+ const { rowList } = reactData;
8400
+ const { rowMaps } = internalData;
8401
+ const dragOpts = computeDragOpts.value;
8402
+ const { animation, isCrossListDrag } = dragOpts;
8403
+ const el = refElem.value;
8404
+ if (!el) {
8405
+ return;
8406
+ }
8407
+ if (isCrossListDrag && crossListDragRowObj && crossListDragRowInfo) {
8408
+ const { row: dragRow } = crossListDragRowInfo;
8409
+ if (dragRow) {
8410
+ const dragRowid = getRowId(dragRow);
8411
+ const dragRowRest = rowMaps[dragRowid];
8412
+ let dragRowHeight = 0;
8413
+ let rsIndex = -1;
8414
+ if (dragRowRest) {
8415
+ if (animation) {
8416
+ const oldItemEl = el.querySelector(`.vxe-list--row[rowid="${dragRowid}"]`);
8417
+ const targetItemEl = oldItemEl;
8418
+ if (targetItemEl) {
8419
+ dragRowHeight = targetItemEl.offsetHeight;
8420
+ }
8421
+ }
8422
+ rsIndex = dragRowRest.$index;
8423
+ }
8424
+ const dragRangeList = rsIndex > -1 && rsIndex < rowList.length - 1 ? rowList.slice(rsIndex + 1) : [];
8425
+ const dragList = [dragRow];
8426
+ $xeList.remove(dragList).then(() => {
8427
+ if (animation && dragRowHeight && dragRangeList.length) {
8428
+ const wrapperEl = el;
8429
+ const dtClss = [];
8430
+ dragRangeList.forEach(item => {
8431
+ const rowid = getRowId(item);
8432
+ dtClss.push(`.vxe-list--row[rowid="${rowid}"]`);
8433
+ });
8434
+ const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
8435
+ moveRowAnimateToTb(dtTrList, dragRowHeight);
8436
+ }
8437
+ });
8438
+ dispatchEvent('row-remove-dragend', {
8439
+ row: dragRow
8440
+ }, evnt);
8441
+ handleRowDragEndClearStatus();
8442
+ }
8443
+ }
8444
+ },
8445
+ /**
8446
+ * 处理跨树拖至新的空树
8447
+ */
8448
+ handleCrossListRowDragoverEmptyEvent(evnt) {
8449
+ const { rowList } = reactData;
8450
+ const dragOpts = computeDragOpts.value;
8451
+ const { isCrossListDrag } = dragOpts;
8452
+ if (isCrossListDrag && crossListDragRowObj && !rowList.length) {
8453
+ const { $oldList, $newList } = crossListDragRowObj;
8454
+ if ($oldList) {
8455
+ const oldListReactData = $oldList;
8456
+ if ($oldList.xID !== $xeList.xID) {
8457
+ if ($newList && $newList.xID !== $xeList.xID) {
8458
+ $newList.hideCrossListRowDropClearStatus();
8459
+ }
8460
+ evnt.preventDefault();
8461
+ $oldList.hideCrossListRowDropClearStatus();
8462
+ crossListDragRowObj.$newList = $xeList;
8463
+ internalData.prevDragRow = null;
8464
+ reactData.dragTipText = oldListReactData.dragTipText;
8465
+ showDropTip(evnt, evnt.currentTarget, true, '');
8466
+ }
8467
+ }
8468
+ }
8469
+ },
8470
+ /**
8471
+ * 处理跨树拖插入
8472
+ */
8473
+ handleCrossListRowDragInsertEvent(evnt) {
8474
+ const { prevDragRow, prevDragPos } = internalData;
8475
+ const dragOpts = computeDragOpts.value;
8476
+ const { animation, isCrossListDrag, dragEndMethod } = dragOpts;
8477
+ // 跨表拖拽
8478
+ if (isCrossListDrag && crossListDragRowObj && crossListDragRowInfo) {
8479
+ const { row: oldRow } = crossListDragRowInfo;
8480
+ const { $oldList } = crossListDragRowObj;
8481
+ const el = refElem.value;
8482
+ if (!el) {
8483
+ return;
8484
+ }
8485
+ if ($oldList && oldRow) {
8486
+ const dragRow = oldRow;
8487
+ let dragOffsetIndex = -1;
8488
+ if (prevDragRow) {
8489
+ dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
8490
+ }
8491
+ const dragParams = {
8492
+ oldRow: dragRow,
8493
+ newRow: prevDragRow,
8494
+ dragRow,
8495
+ dragPos: prevDragPos,
8496
+ offsetIndex: dragOffsetIndex
8497
+ };
8498
+ const errRest = {
8499
+ status: false
8500
+ };
8501
+ Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
8502
+ if (!status) {
8503
+ if ($oldList) {
8504
+ if ($oldList.xID !== $xeList.xID) {
8505
+ $oldList.handleCrossListRowDragCancelEvent(evnt);
8506
+ }
8507
+ }
8508
+ handleRowDragEndClearStatus();
8509
+ return errRest;
8510
+ }
8511
+ let insertRest = Promise.resolve();
8512
+ const dragList = [dragRow];
8513
+ $oldList.handleCrossListRowDragFinishEvent(evnt);
8514
+ if (prevDragRow) {
8515
+ if (prevDragPos === 'bottom') {
8516
+ insertRest = $xeList.insertNextAt(dragList, prevDragRow);
8517
+ }
8518
+ else {
8519
+ insertRest = $xeList.insertAt(dragList, prevDragRow);
8520
+ }
8521
+ }
8522
+ else {
8523
+ insertRest = $xeList.insert(dragList);
8524
+ }
8525
+ $xeList.dispatchEvent('row-insert-dragend', {
8526
+ oldRow,
8527
+ newRow: prevDragRow,
8528
+ dragRow,
8529
+ dragPos: prevDragPos,
8530
+ offsetIndex: dragOffsetIndex
8531
+ }, evnt);
8532
+ clearRowDragData();
8533
+ insertRest.then(() => {
8534
+ const { rowList } = reactData;
8535
+ const { rowMaps } = internalData;
8536
+ const oldRowid = getRowId(dragRow);
8537
+ const oldRowRest = rowMaps[oldRowid];
8538
+ let dragRowHeight = 0;
8539
+ let rsIndex = -1;
8540
+ if (oldRowRest) {
8541
+ if (animation) {
8542
+ const oldItemEl = el.querySelector(`.vxe-list--row[rowid="${oldRowid}"]`);
8543
+ const targetItemEl = oldItemEl;
8544
+ if (targetItemEl) {
8545
+ dragRowHeight = targetItemEl.offsetHeight;
8546
+ }
8547
+ }
8548
+ rsIndex = oldRowRest.$index;
8549
+ }
8550
+ const dragRangeList = rsIndex > -1 ? rowList.slice(rsIndex) : [];
8551
+ if (animation && dragRowHeight && dragRangeList.length) {
8552
+ const wrapperEl = el;
8553
+ const dtClss = [];
8554
+ dragRangeList.forEach(item => {
8555
+ const rowid = getRowId(item);
8556
+ dtClss.push(`.vxe-list--row[rowid="${rowid}"]`);
8557
+ });
8558
+ const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
8559
+ moveRowAnimateToTb(dtTrList, -dragRowHeight);
8560
+ }
8561
+ });
8562
+ });
8563
+ }
8564
+ }
8565
+ },
8566
+ hideCrossListRowDropClearStatus() {
8567
+ hideDropTip();
8568
+ }
8029
8569
  };
8030
- const listPrivateMethods = {};
8031
8570
  Object.assign($xeList, listMethods, listPrivateMethods);
8032
8571
  const renderDragTip = () => {
8033
8572
  const { dragRow, dragTipText } = reactData;
@@ -8129,6 +8668,7 @@ var VxeListComponent = defineVxeComponent({
8129
8668
  const { selectRadioRow, currRowFlag, updateCheckboxFlag } = reactData;
8130
8669
  const { selectCheckboxMaps, currentRow } = internalData;
8131
8670
  const contentSlot = slots.content;
8671
+ const extraSlot = slots.extra;
8132
8672
  const dragOpts = computeDragOpts.value;
8133
8673
  const { trigger, icon, disabledMethod, visibleMethod } = dragOpts;
8134
8674
  const rowOpts = computeRowOpts.value;
@@ -8182,6 +8722,12 @@ var VxeListComponent = defineVxeComponent({
8182
8722
  key: 'ct5',
8183
8723
  class: 'vxe-list--row-content'
8184
8724
  }, contentSlot ? contentSlot(rowParams) : (contentField ? getText(row[contentField]) : '')));
8725
+ if (extraSlot) {
8726
+ ctVNs.push(h('div', {
8727
+ key: 'ct7',
8728
+ class: 'vxe-list--row-extra'
8729
+ }, extraSlot(rowParams)));
8730
+ }
8185
8731
  const rowOns = {
8186
8732
  onMousedown(evnt) {
8187
8733
  handleRowMousedownEvent(evnt, row);
@@ -8192,6 +8738,9 @@ var VxeListComponent = defineVxeComponent({
8192
8738
  },
8193
8739
  onDblclick(evnt) {
8194
8740
  handleRowDblclickEvent(evnt, row);
8741
+ },
8742
+ onContextmenu(evnt) {
8743
+ handleContextmenuEvent(evnt, row);
8195
8744
  }
8196
8745
  };
8197
8746
  // 拖拽行事件
@@ -8220,20 +8769,20 @@ var VxeListComponent = defineVxeComponent({
8220
8769
  const checkboxOpts = computeCheckboxOpts.value;
8221
8770
  const { showHeader, headerTitle } = checkboxOpts;
8222
8771
  const dragOpts = computeDragOpts.value;
8223
- const { trigger } = dragOpts;
8772
+ const { trigger, isCrossListDrag } = dragOpts;
8224
8773
  const rowOpts = computeRowOpts.value;
8225
8774
  const { isHover, padding } = rowOpts;
8226
8775
  const isDrag = computeIsDrag.value;
8227
8776
  const showDefChekboxHead = showCheckbox && showHeader !== false;
8228
- return h('div', {
8229
- ref: refElem,
8230
- class: ['vxe-list', className ? (XEUtils.isFunction(className) ? className({ $list: $xeList }) : className) : '', {
8777
+ const leOns = {};
8778
+ if (isCrossListDrag && !rowList.length) {
8779
+ leOns.onDragover = $xeList.handleCrossListRowDragoverEmptyEvent;
8780
+ }
8781
+ return h('div', Object.assign({ ref: refElem, class: ['vxe-list', className ? (XEUtils.isFunction(className) ? className({ $list: $xeList }) : className) : '', {
8231
8782
  [`size--${vSize}`]: vSize,
8232
8783
  'is--drag': isDrag,
8233
8784
  'is--loading': loading
8234
- }],
8235
- style: wrapperStyles
8236
- }, [
8785
+ }], style: wrapperStyles }, leOns), [
8237
8786
  headerSlot || showDefChekboxHead
8238
8787
  ? h('div', {
8239
8788
  ref: refHeaderElem,
@@ -8359,12 +8908,15 @@ var VxeListComponent = defineVxeComponent({
8359
8908
  loadData(props.data || []);
8360
8909
  });
8361
8910
  onMounted(() => {
8362
- const { showRadio, showCheckbox } = props;
8911
+ const { showSeq, showRadio, showCheckbox } = props;
8363
8912
  const rowOpts = computeRowOpts.value;
8364
8913
  const { useKey } = rowOpts;
8365
8914
  const isDrag = computeIsDrag.value;
8366
8915
  const keyField = computeKeyField.value;
8367
8916
  if (!keyField) {
8917
+ if (showSeq) {
8918
+ errLog$g('vxe.error.reqSupportProp', ['show-seq', 'row-config.keyField']);
8919
+ }
8368
8920
  if (showRadio) {
8369
8921
  errLog$g('vxe.error.reqSupportProp', ['show-radio', 'row-config.keyField']);
8370
8922
  }
@@ -33122,7 +33674,7 @@ function handlePrint(opts, printHtml = '') {
33122
33674
  if (styleUrls && styleUrls.length) {
33123
33675
  styleUrls.forEach(url => {
33124
33676
  if (!/.css$/.test(url)) {
33125
- warnLog$g('vxe.error.errProp', [url, `${url}.css`]);
33677
+ warnLog$h('vxe.error.errProp', [url, `${url}.css`]);
33126
33678
  }
33127
33679
  });
33128
33680
  }