@deot/vc-components 1.0.12 → 1.0.14

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.
@@ -756,7 +756,7 @@ var VcComponents = (function (exports, vue) {
756
756
 
757
757
  // [color, borderColor, backgroundColor], -> CSS
758
758
  const THEME_MAP = {
759
- info: ['#5495f6', '#91d5ff', '#e6f7ff'],
759
+ info: ['#2B72FD', '#91d5ff', '#e6f7ff'],
760
760
  success: ['#52c41a', '#b7eb8f', '#f6ffed'],
761
761
  error: ['#ed4014', '#ffb08f', '#fbe9e9'],
762
762
  warning: ['#ffbf00', '#ffe58f', '#fffbe6']
@@ -17034,7 +17034,7 @@ var VcComponents = (function (exports, vue) {
17034
17034
  validator: (v) => /(small|medium|large)/.test(v),
17035
17035
  default: "small"
17036
17036
  },
17037
- portalClass: [Object, String],
17037
+ contentClass: [Object, String],
17038
17038
  width: {
17039
17039
  type: Number
17040
17040
  },
@@ -17083,6 +17083,10 @@ var VcComponents = (function (exports, vue) {
17083
17083
  type: Boolean,
17084
17084
  default: true
17085
17085
  },
17086
+ border: {
17087
+ type: Boolean,
17088
+ default: false
17089
+ },
17086
17090
  /**
17087
17091
  * 兼容portal设计, 实现Promise方式
17088
17092
  */
@@ -17380,7 +17384,8 @@ var VcComponents = (function (exports, vue) {
17380
17384
  "class": [{
17381
17385
  'is-drag': props.draggable,
17382
17386
  'is-large': props.size === 'large' || props.size === 'medium',
17383
- 'is-no-footer': !props.footer || !props.cancelText && !props.okText
17387
+ 'has-footer': props.footer && (props.cancelText || props.okText),
17388
+ 'has-border': props.border
17384
17389
  }, 'vc-modal__container'],
17385
17390
  "style": [basicStyle.value, draggableStyle.value]
17386
17391
  }, [vue.createVNode("div", {
@@ -17412,7 +17417,7 @@ var VcComponents = (function (exports, vue) {
17412
17417
  "height": isTransitionEnd.value ? row.height : void 0,
17413
17418
  "contentClass": [{
17414
17419
  'is-confirm': props.mode
17415
- }, props.portalClass, 'vc-modal__content']
17420
+ }, props.contentClass, 'vc-modal__content']
17416
17421
  }, {
17417
17422
  default: () => [typeof props.content === 'string' ? vue.createVNode("div", {
17418
17423
  "innerHTML": props.content
@@ -18893,7 +18898,7 @@ var VcComponents = (function (exports, vue) {
18893
18898
  color: {
18894
18899
  type: [Object, String],
18895
18900
  default: () => ({
18896
- normal: "#5495f6",
18901
+ normal: "#2B72FD",
18897
18902
  success: "#52c41a",
18898
18903
  error: "#f5222d"
18899
18904
  })
@@ -20247,6 +20252,8 @@ var VcComponents = (function (exports, vue) {
20247
20252
  });
20248
20253
  if (!originalData.length) {
20249
20254
  rebuildData.value = [];
20255
+ } else {
20256
+ rebuildData.value = originalData.slice();
20250
20257
  }
20251
20258
  offsetPageSize.value = 0;
20252
20259
  await refreshLayout(0, originalData.length);
@@ -38600,17 +38607,24 @@ var VcComponents = (function (exports, vue) {
38600
38607
  const dataInstanceChanged = this.states._data !== data;
38601
38608
  this.states._data = data;
38602
38609
  this.states.data = data;
38610
+ const caches = /* @__PURE__ */ new Map();
38611
+ this.states.list.forEach((item) => {
38612
+ item.rows.forEach((row) => {
38613
+ caches.set(row.data, row);
38614
+ });
38615
+ });
38603
38616
  this.states.list = data.reduce((pre, row, index) => {
38617
+ const cache = caches.get(row) || { heightMap: {} };
38604
38618
  pre.push({
38605
38619
  rows: [
38606
38620
  {
38607
38621
  index,
38608
38622
  data: row,
38609
- height: "",
38623
+ height: cache.height || "",
38610
38624
  heightMap: {
38611
- left: "",
38612
- main: "",
38613
- right: ""
38625
+ left: cache.heightMap.left || "",
38626
+ main: cache.heightMap.main || "",
38627
+ right: cache.heightMap.right || ""
38614
38628
  }
38615
38629
  }
38616
38630
  ],
@@ -38618,6 +38632,7 @@ var VcComponents = (function (exports, vue) {
38618
38632
  });
38619
38633
  return pre;
38620
38634
  }, []);
38635
+ caches.clear();
38621
38636
  this.current.update();
38622
38637
  this.expand.update();
38623
38638
  if (!this.states.reserveSelection) {
@@ -38751,12 +38766,12 @@ var VcComponents = (function (exports, vue) {
38751
38766
  */
38752
38767
  cleanSelection() {
38753
38768
  const { primaryKey } = this.table.props;
38754
- const { selection = [] } = this.states;
38769
+ const { selection = [], data } = this.states;
38755
38770
  let deleted;
38756
38771
  if (primaryKey) {
38757
38772
  deleted = [];
38758
38773
  const selectedMap = getValuesMap(selection, primaryKey);
38759
- const dataMap = getValuesMap(selection, primaryKey);
38774
+ const dataMap = getValuesMap(data, primaryKey);
38760
38775
  for (const key in selectedMap) {
38761
38776
  if (hasOwn$1(selectedMap, key) && !dataMap[key]) {
38762
38777
  deleted.push(selectedMap[key].row);
@@ -38931,8 +38946,10 @@ var VcComponents = (function (exports, vue) {
38931
38946
  const NormalList = /* @__PURE__ */ vue.defineComponent({
38932
38947
  name: COMPONENT_NAME$h,
38933
38948
  props: {
38934
- data: Array,
38935
- default: () => []
38949
+ data: {
38950
+ type: Array,
38951
+ default: () => []
38952
+ }
38936
38953
  },
38937
38954
  emits: ['row-resize'],
38938
38955
  setup(props, {
@@ -38974,7 +38991,7 @@ var VcComponents = (function (exports, vue) {
38974
38991
  expose
38975
38992
  }) {
38976
38993
  const instance = vue.getCurrentInstance();
38977
- const table = getInstance$1('table', 'tableId');
38994
+ const table = vue.inject('vc-table');
38978
38995
  const states = useStates({
38979
38996
  data: 'data',
38980
38997
  list: 'list',
@@ -39098,7 +39115,7 @@ var VcComponents = (function (exports, vue) {
39098
39115
  column,
39099
39116
  row
39100
39117
  };
39101
- table.exposed.hoverState.value = hoverState;
39118
+ table.hoverState.value = hoverState;
39102
39119
  table.emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, e);
39103
39120
  }
39104
39121
 
@@ -39131,7 +39148,7 @@ var VcComponents = (function (exports, vue) {
39131
39148
  const handleCellMouseLeave = e => {
39132
39149
  const cell = getCell(e);
39133
39150
  if (!cell) return;
39134
- const oldHoverState = table.exposed.hoverState.value || {};
39151
+ const oldHoverState = table.hoverState.value || {};
39135
39152
  table.emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, e);
39136
39153
  };
39137
39154
  const handleMouseEnter = debounce$1(index => {
@@ -39169,6 +39186,7 @@ var VcComponents = (function (exports, vue) {
39169
39186
  columns
39170
39187
  } = states;
39171
39188
  const key = getValueOfRow(row, rowIndex);
39189
+ const selected = props.store.isSelected(row);
39172
39190
  return vue.createVNode("div", {
39173
39191
  "key": key,
39174
39192
  "class": [getRowClass(row, rowIndex), 'vc-table__tr'],
@@ -39189,10 +39207,12 @@ var VcComponents = (function (exports, vue) {
39189
39207
  };
39190
39208
  if (columnsHidden.value[columnIndex]) {
39191
39209
  return vue.createVNode("div", {
39210
+ "key": column.id,
39192
39211
  "style": [sizeStyle]
39193
39212
  }, null);
39194
39213
  }
39195
39214
  return vue.createVNode("div", {
39215
+ "key": column.id,
39196
39216
  "style": [getCellStyle(rowIndex, columnIndex, row, column), sizeStyle],
39197
39217
  "class": [getCellClass(rowIndex, columnIndex, row, column), 'vc-table__td'],
39198
39218
  "onMouseenter": e => handleCellMouseEnter(e, row),
@@ -39202,7 +39222,8 @@ var VcComponents = (function (exports, vue) {
39202
39222
  column,
39203
39223
  rowIndex,
39204
39224
  columnIndex,
39205
- store: props.store
39225
+ store: props.store,
39226
+ selected
39206
39227
  })]);
39207
39228
  })]);
39208
39229
  };
@@ -39236,7 +39257,7 @@ var VcComponents = (function (exports, vue) {
39236
39257
  wrapper,
39237
39258
  getRootElement: () => instance.vnode.el
39238
39259
  });
39239
- const layout = table.exposed.layout;
39260
+ const layout = table.layout;
39240
39261
  return () => {
39241
39262
  return vue.createVNode("div", {
39242
39263
  "class": "vc-table__body"
@@ -39246,7 +39267,7 @@ var VcComponents = (function (exports, vue) {
39246
39267
  "disabled": true,
39247
39268
  "class": "vc-table__tbody",
39248
39269
  "scrollerOptions": {
39249
- barTo: `.${table.exposed.tableId}`,
39270
+ barTo: `.${table.tableId}`,
39250
39271
  native: false,
39251
39272
  always: false,
39252
39273
  showBar: !props.fixed,
@@ -39298,7 +39319,7 @@ var VcComponents = (function (exports, vue) {
39298
39319
  }
39299
39320
  },
39300
39321
  setup(props) {
39301
- const table = getInstance$1('table', 'tableId');
39322
+ const table = vue.inject('vc-table');
39302
39323
  const instance = vue.getCurrentInstance();
39303
39324
  const draggingColumn = vue.ref(null);
39304
39325
  const dragging = vue.ref(false);
@@ -39405,7 +39426,7 @@ var VcComponents = (function (exports, vue) {
39405
39426
  /* istanbul ignore if */
39406
39427
  if (draggingColumn.value && props.border) {
39407
39428
  dragging.value = true;
39408
- table.exposed.resizeProxyVisible.value = true;
39429
+ table.resizeProxyVisible.value = true;
39409
39430
  const tableEl = table.vnode.el;
39410
39431
  const tableLeft = tableEl.getBoundingClientRect().left;
39411
39432
  const columnEl = instance.vnode.el.querySelector(`.vc-table__th.${column.id}`);
@@ -39418,7 +39439,7 @@ var VcComponents = (function (exports, vue) {
39418
39439
  startColumnLeft: columnRect.left - tableLeft,
39419
39440
  tableLeft
39420
39441
  };
39421
- const resizeProxy = table.exposed.resizeProxy.value;
39442
+ const resizeProxy = table.resizeProxy.value;
39422
39443
  resizeProxy.style.left = dragState.value.startLeft + 'px';
39423
39444
  document.onselectstart = () => false;
39424
39445
  document.ondragstart = () => false;
@@ -39777,7 +39798,8 @@ var VcComponents = (function (exports, vue) {
39777
39798
  emits: ['select', 'select-all', 'selection-change', 'cell-mouse-enter', 'cell-mouse-leave', 'cell-click', 'cell-dblclick', 'row-click', 'row-contextmenu', 'row-dblclick', 'header-click', 'header-contextmenu', 'current-change', 'header-dragend ', 'expand-change', 'sort-change'],
39778
39799
  setup(props, {
39779
39800
  slots,
39780
- expose
39801
+ expose,
39802
+ emit
39781
39803
  }) {
39782
39804
  const instance = vue.getCurrentInstance();
39783
39805
  const store = new Store({
@@ -39893,7 +39915,8 @@ var VcComponents = (function (exports, vue) {
39893
39915
  };
39894
39916
  }
39895
39917
  return {
39896
- height: layout.states.viewportHeight ? layout.states.viewportHeight + 'px' : ''
39918
+ height: layout.states.viewportHeight ? layout.states.viewportHeight + 'px' : '',
39919
+ bottom: 0
39897
39920
  };
39898
39921
  }
39899
39922
  });
@@ -40097,8 +40120,8 @@ var VcComponents = (function (exports, vue) {
40097
40120
  }, {
40098
40121
  immediate: true
40099
40122
  });
40100
- vue.watch(() => props.data, v => {
40101
- store.setData(v);
40123
+ vue.watch(() => [props.data, props.data.length], () => {
40124
+ store.setData(props.data);
40102
40125
  isReady.value && vue.nextTick(refreshLayout);
40103
40126
  }, {
40104
40127
  immediate: true
@@ -40136,7 +40159,7 @@ var VcComponents = (function (exports, vue) {
40136
40159
  isUnMount = true;
40137
40160
  unbindEvents();
40138
40161
  });
40139
- expose({
40162
+ const exposed = {
40140
40163
  bodyXWrapper,
40141
40164
  bodyYWrapper,
40142
40165
  tableId,
@@ -40158,8 +40181,12 @@ var VcComponents = (function (exports, vue) {
40158
40181
  isReady,
40159
40182
  hoverState,
40160
40183
  renderExpanded,
40161
- hiddenColumns
40162
- });
40184
+ hiddenColumns,
40185
+ props,
40186
+ emit
40187
+ };
40188
+ expose(exposed);
40189
+ vue.provide('vc-table', exposed);
40163
40190
  return () => {
40164
40191
  return vue.createVNode("div", {
40165
40192
  "class": [classes.value, tableId, 'vc-table'],
@@ -40195,7 +40222,9 @@ var VcComponents = (function (exports, vue) {
40195
40222
  }, null), props.data.length === 0 && vue.createVNode("div", {
40196
40223
  "ref": emptyBlock,
40197
40224
  "style": bodyWidthStyle.value,
40198
- "class": "vc-table__empty-block"
40225
+ "class": [{
40226
+ 'is-absolute': !!props.height
40227
+ }, 'vc-table__empty-wrapper']
40199
40228
  }, [vue.createVNode("span", {
40200
40229
  "class": "vc-table__empty-text"
40201
40230
  }, [slots.empty ? slots.empty() : props.emptyText || '暂无数据'])]), slots.append && vue.createVNode("div", {
@@ -40346,10 +40375,11 @@ var VcComponents = (function (exports, vue) {
40346
40375
  column,
40347
40376
  store,
40348
40377
  rowIndex,
40349
- level
40378
+ level,
40379
+ selected
40350
40380
  }) {
40351
40381
  return vue.withDirectives(vue.createVNode(Checkbox, {
40352
- "modelValue": store.isSelected(row),
40382
+ "modelValue": selected,
40353
40383
  "disabled": column.selectable ? !column.selectable.call(null, row, rowIndex) : false,
40354
40384
  "onChange": () => store.rowSelectedChanged(row),
40355
40385
  "onClick": e => e.stopPropagation()
@@ -40522,15 +40552,14 @@ var VcComponents = (function (exports, vue) {
40522
40552
  tooltip: [String, Function]
40523
40553
  },
40524
40554
  setup(props, {
40525
- slots,
40526
- expose
40555
+ slots
40527
40556
  }) {
40528
40557
  const instance = vue.getCurrentInstance();
40529
- const table = getInstance$1('table', 'tableId');
40530
- const parent = getInstance$1('table-column', 'columnId') || table;
40558
+ const table = vue.inject('vc-table');
40559
+ const parent = vue.inject('vc-table-column', table);
40531
40560
  const isSubColumn = table !== parent; // 用于多久表头
40532
40561
 
40533
- const columnId = vue.ref((parent.exposed.tableId || parent.exposed.columnId) + getUid('column'));
40562
+ const columnId = vue.ref((parent.tableId || parent.columnId) + getUid('column'));
40534
40563
  const realWidth = vue.computed(() => {
40535
40564
  return parseWidth(props.width);
40536
40565
  });
@@ -40629,7 +40658,7 @@ var VcComponents = (function (exports, vue) {
40629
40658
  column.renderCell = data => vue.createVNode("div", {
40630
40659
  "class": "vc-table__cell"
40631
40660
  }, [originRenderCell(data)]);
40632
- table.exposed.renderExpanded.value = data => {
40661
+ table.renderExpanded.value = data => {
40633
40662
  return slots.default ? slots.default(data) : slots.default;
40634
40663
  };
40635
40664
  } else {
@@ -40648,7 +40677,7 @@ var VcComponents = (function (exports, vue) {
40648
40677
  style: {}
40649
40678
  };
40650
40679
  // 存在树形数组,且当前行无箭头图标且处于当前展开列,表格对齐
40651
- if (!isEmpty$1(table.exposed.store.states.treeData) && !prefix && data.isExpandColumn) {
40680
+ if (!isEmpty$1(table.store.states.treeData) && !prefix && data.isExpandColumn) {
40652
40681
  prefix = vue.createVNode("span", {
40653
40682
  "class": "vc-table-un-expand__indent"
40654
40683
  }, null);
@@ -40691,15 +40720,15 @@ var VcComponents = (function (exports, vue) {
40691
40720
 
40692
40721
  // 影响布局
40693
40722
  vue.watch(() => props.fixed, () => {
40694
- table.exposed.store.scheduleLayout(true);
40723
+ table.store.scheduleLayout(true);
40695
40724
  });
40696
40725
  vue.watch(() => realWidth.value, v => {
40697
40726
  columnConfig['width'] = v;
40698
40727
  columnConfig['realWidth'] = v;
40699
- table.exposed.store.scheduleLayout(false);
40728
+ table.store.scheduleLayout(false);
40700
40729
  });
40701
40730
  vue.watch(() => realMinWidth.value, () => {
40702
- table.exposed.store.scheduleLayout(false);
40731
+ table.store.scheduleLayout(false);
40703
40732
  });
40704
40733
  };
40705
40734
  vue.onBeforeMount(() => {
@@ -40707,17 +40736,17 @@ var VcComponents = (function (exports, vue) {
40707
40736
  registerWatchers();
40708
40737
  });
40709
40738
  vue.onMounted(() => {
40710
- const children = isSubColumn ? parent.vnode.el.children : parent.exposed.hiddenColumns.value.children;
40739
+ const children = isSubColumn ? parent.vnode.el.children : parent.hiddenColumns.value.children;
40711
40740
 
40712
40741
  // DOM上
40713
40742
  const columnIndex = [...children].indexOf(instance.vnode.el);
40714
- table.exposed.store.insertColumn(columnConfig, columnIndex, isSubColumn && parent.exposed.columnConfig);
40743
+ table.store.insertColumn(columnConfig, columnIndex, isSubColumn && parent.columnConfig);
40715
40744
  });
40716
40745
  vue.onUnmounted(() => {
40717
40746
  if (!instance.parent) return;
40718
- table.exposed.store.removeColumn(columnConfig, isSubColumn && parent.exposed.columnConfig);
40747
+ table.store.removeColumn(columnConfig, isSubColumn && parent.columnConfig);
40719
40748
  });
40720
- expose({
40749
+ vue.provide('vc-table-column', {
40721
40750
  columnId,
40722
40751
  columnConfig
40723
40752
  });
@@ -40958,7 +40987,7 @@ var VcComponents = (function (exports, vue) {
40958
40987
  if (!Array.from(items).length) return;
40959
40988
  let offset = 0;
40960
40989
  if (index > 0) {
40961
- const gutter = 16; // margin-right -> 16px
40990
+ const gutter = 12; // margin-right -> 12px
40962
40991
  for (let i = 0; i < index; i++) {
40963
40992
  offset += parseFloat(items[i].offsetWidth) + gutter;
40964
40993
  }
@@ -41030,7 +41059,7 @@ var VcComponents = (function (exports, vue) {
41030
41059
  }, [slots.extra?.()]), vue.createVNode("div", {
41031
41060
  "ref": wrapper,
41032
41061
  "style": {
41033
- padding: tabs.scrollable.value && '0 24px'
41062
+ padding: tabs.scrollable.value ? '0 24px' : 0
41034
41063
  },
41035
41064
  "class": "vc-tabs__bar"
41036
41065
  }, [tabs.scrollable.value && vue.createVNode(Icon, {