@juzhenfe/page-model 3.14.2 → 3.14.3

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.
@@ -1,8 +1,7 @@
1
1
  export declare const useColumnDrag: () => {
2
2
  initTableDrag: (opt: {
3
3
  element: HTMLDivElement;
4
- getEls: () => any[];
5
- cb: (newList: any[]) => void;
4
+ cb: (oldIndex: number, newIndex: number) => void;
6
5
  }) => void;
7
6
  destroyTableDrag(): void;
8
7
  };
package/dist/index.es.js CHANGED
@@ -8561,12 +8561,7 @@ const useColumnDrag = () => {
8561
8561
  if (oldDraggableIndex === newDraggableIndex) {
8562
8562
  return;
8563
8563
  }
8564
- const _list = jsonClone(opt.getEls());
8565
- const [spliceItem] = _list.splice(oldDraggableIndex, 1);
8566
- let insertIndex;
8567
- insertIndex = newDraggableIndex;
8568
- _list.splice(insertIndex, 0, spliceItem);
8569
- opt.cb(_list);
8564
+ opt.cb(oldDraggableIndex, newDraggableIndex);
8570
8565
  }
8571
8566
  });
8572
8567
  };
@@ -8731,10 +8726,18 @@ const _sfc_main$k = defineComponent({
8731
8726
  if (tableManager.table.dragable) {
8732
8727
  initTableDrag({
8733
8728
  element: tableRef.value.$el.querySelector(".el-table__header thead tr"),
8734
- getEls() {
8735
- return renderedTableEls.value;
8736
- },
8737
- cb(newList) {
8729
+ cb(oldIndex, newIndex) {
8730
+ const oldItem = renderedTableEls.value[oldIndex];
8731
+ const newItem = renderedTableEls.value[newIndex];
8732
+ const newList = jsonClone(filteredUserEls.value);
8733
+ const realOldItemIndex = newList.findIndex(
8734
+ (a) => a.prop === oldItem.prop && a.label === oldItem.label
8735
+ );
8736
+ const realNewIemndex = newList.findIndex(
8737
+ (a) => a.prop === newItem.prop && a.label === newItem.label
8738
+ );
8739
+ const [spliceItem] = newList.splice(realOldItemIndex, 1);
8740
+ newList.splice(realNewIemndex, 0, spliceItem);
8738
8741
  onSaveColumns(newList);
8739
8742
  }
8740
8743
  });
@@ -8747,20 +8750,7 @@ const _sfc_main$k = defineComponent({
8747
8750
  if (newWidth === oldWidth) {
8748
8751
  return false;
8749
8752
  }
8750
- const originTableEls = table.value.els;
8751
- const userConfig = getUserConfig(originTableEls) || {};
8752
- const filteredUserEls2 = tableManager.saveContent.map((item) => {
8753
- const fItem = originTableEls[item.index];
8754
- fItem.userConfigShow = !!item.show;
8755
- fItem.showSummary = item.sum;
8756
- fItem.userLabel = item.ul;
8757
- fItem.width = item.w || void 0;
8758
- fItem.minWidth = item.mw || void 0;
8759
- fItem.fixed = item.fix || void 0;
8760
- fItem.showRowNumbers = userConfig.showRowNumbers;
8761
- return fItem;
8762
- });
8763
- const newList = jsonClone(filteredUserEls2);
8753
+ const newList = jsonClone(filteredUserEls.value);
8764
8754
  const _column = newList.find(
8765
8755
  (item) => item.label === column.label && item.prop === column.property
8766
8756
  );
@@ -12937,7 +12927,7 @@ const defineEditableTable = function(config) {
12937
12927
  };
12938
12928
  var iconfont = "";
12939
12929
  const name = "@juzhenfe/page-model";
12940
- const version = "3.14.2";
12930
+ const version = "3.14.3";
12941
12931
  const types = "dist/main.d.ts";
12942
12932
  const main = "dist/index.umd.js";
12943
12933
  const keywords = [