@lx-frontend/wrap-element-ui 1.0.2 → 1.0.3-beta.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lx-frontend/wrap-element-ui",
3
- "version": "1.0.2",
3
+ "version": "1.0.3-beta.2",
4
4
  "description": "wrap-element-ui",
5
5
  "author": "",
6
6
  "main": "src/components/index.ts",
@@ -39,7 +39,7 @@ export function useViewSetting({
39
39
  };
40
40
 
41
41
  const handleViewSettingShow = () => {
42
- emit('update:viewSettingDragSortOptions', [...actualColumns.value]);
42
+ emit('update:viewSettingDragSortOptions', [...actualColumns.value.filter(v => v?.prop !== '$$operation')]);
43
43
  tempLeftFixedColumnCount.value = leftFixedColumnCount.value;
44
44
  viewSettingVisible.value = true;
45
45
  columnsToBeShown.value = [...showingColumns.value];
@@ -95,7 +95,8 @@ export function useViewSetting({
95
95
  { immediate: true }
96
96
  )
97
97
 
98
- watch(columnsToBeShown, (val) => {
98
+ watch(columnsToBeShown, (val, oldVal) => {
99
+ if (val.length === oldVal?.length) return // 排序调整时不做处理,避免出现死循环
99
100
  const _map = new Map<string, IColumnConfig>()
100
101
  props.columnConfig.forEach(c => _map.set(c.prop, c))
101
102
  // 展示时保留顺序
@@ -103,6 +104,12 @@ export function useViewSetting({
103
104
  if (tempLeftFixedColumnCount.value > val.length) tempLeftFixedColumnCount.value = val.length
104
105
  }, { immediate: true })
105
106
 
107
+ // 拖拽调整排序时,同时更新勾选数组的顺序,避免出现拖拽排序操作过程后再勾选新列时被还原成拖拽前的顺序的问题
108
+ watch(viewSettingDragSortOptions, (val, oldVal) => {
109
+ if (!val.length || val.length !== oldVal?.length) return // 不是排序调整
110
+ columnsToBeShown.value = val.map(c => c.prop)
111
+ }, { deep: true })
112
+
106
113
  watch(leftFixedColumnCount, (val) => emit('update:leftFixedColumnCount', val), { immediate: true });
107
114
 
108
115
  return {