@lx-frontend/wrap-element-ui 1.0.0-beta.4 → 1.0.0-beta.6

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.
@@ -0,0 +1,4 @@
1
+ import { default as MessageType } from 'element-ui/packages/message';
2
+
3
+ declare const singleMessage: MessageType;
4
+ export default singleMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lx-frontend/wrap-element-ui",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "wrap-element-ui",
5
5
  "author": "",
6
6
  "main": "dist/index.mjs",
@@ -55,8 +55,9 @@
55
55
  <div class="view-setting__content-right-frize">
56
56
  冻结前
57
57
  <el-input
58
- v-model="leftFixedColumnCount"
59
58
  class="view-setting__content-right-input"
59
+ :value="tempLeftFixedColumnCount"
60
+ @input="handleInputTempLeftFixedColumnCount"
60
61
  />
61
62
 
62
63
  </div>
@@ -788,6 +789,8 @@ const {
788
789
  columnsToBeShown,
789
790
  viewSettingVisible,
790
791
  leftFixedColumnCount,
792
+ tempLeftFixedColumnCount,
793
+ handleInputTempLeftFixedColumnCount,
791
794
  handleViewSettingShow,
792
795
  handleViewSettingClose,
793
796
  handleViewSettingConfirm
@@ -13,6 +13,7 @@ export default function useViewSetting({ tableDomRef, showingColumns, actualColu
13
13
  const columnsToBeShown = ref<string[]>([]); // 显示设置弹窗中勾选的列
14
14
  const viewSettingVisible = ref(false);
15
15
  const leftFixedColumnCount = ref(0);
16
+ const tempLeftFixedColumnCount = ref(0);
16
17
 
17
18
  const storageKey = computed(() => `@lx-frontend/wrap-element-ui/table_setting_cloumns/${props.settingStorgeKey || (location.pathname === '/' ? location.hash : location.pathname)}`);
18
19
 
@@ -37,14 +38,14 @@ export default function useViewSetting({ tableDomRef, showingColumns, actualColu
37
38
  if (!cache.showingColumns || !Array.isArray(cache.showingColumns)) {
38
39
  setColumns();
39
40
  } else {
40
- showingColumns.value = cache.keys.filter(key => _keys.has(key));
41
+ showingColumns.value = cache.showingColumns.filter(key => _keys.has(key));
41
42
  }
42
43
  const _leftFixedColumnCount = Number(cache?.leftFixedColumnCount)
43
44
  leftFixedColumnCount.value = isNaN(_leftFixedColumnCount) ? (props.leftFixedCount as number) : _leftFixedColumnCount;
44
45
  // 写入清理后的数据
45
46
  saveSettingToStorge();
46
47
  } catch (error) {
47
- console.error('缓存数据异常');
48
+ console.error(error);
48
49
  localStorage.removeItem(storageKey.value);
49
50
  setColumns();
50
51
  }
@@ -58,6 +59,7 @@ export default function useViewSetting({ tableDomRef, showingColumns, actualColu
58
59
  (val) => {
59
60
  viewSettingDragSortOptions.value = props.columnConfig
60
61
  .filter(c => val.includes(c.prop));
62
+ if (tempLeftFixedColumnCount.value > val.length) tempLeftFixedColumnCount.value = val.length
61
63
  },
62
64
  { immediate: true }
63
65
  )
@@ -78,6 +80,7 @@ export default function useViewSetting({ tableDomRef, showingColumns, actualColu
78
80
  const handleViewSettingShow = () => {
79
81
  viewSettingDragSortOptions.value = actualColumns.value
80
82
  .filter(c => columnsToBeShown.value.includes(c.prop));
83
+ tempLeftFixedColumnCount.value = leftFixedColumnCount.value;
81
84
  viewSettingVisible.value = true;
82
85
  }
83
86
 
@@ -90,19 +93,25 @@ export default function useViewSetting({ tableDomRef, showingColumns, actualColu
90
93
  const handleViewSettingConfirm = async () => {
91
94
  viewSettingVisible.value = false;
92
95
  showingColumns.value = viewSettingDragSortOptions.value.map(c => c.prop);
93
- localStorage.setItem(storageKey.value, JSON.stringify({
94
- keys: showingColumns.value,
95
- leftFixedColumnCount: leftFixedColumnCount.value,
96
- }));
96
+ leftFixedColumnCount.value = tempLeftFixedColumnCount.value;
97
+ saveSettingToStorge()
97
98
  await nextTick();
98
99
  tableDomRef.value?.doLayout();
99
100
  }
100
101
 
102
+ const handleInputTempLeftFixedColumnCount = (value: string) => {
103
+ const _value = Number(value)
104
+ if (isNaN(_value)) return
105
+ tempLeftFixedColumnCount.value = Math.max(0, Math.min(columnsToBeShown.value.length, Math.floor(_value)))
106
+ }
107
+
101
108
  return {
102
109
  viewSettingDragSortOptions,
103
110
  columnsToBeShown,
104
111
  viewSettingVisible,
105
112
  leftFixedColumnCount,
113
+ tempLeftFixedColumnCount,
114
+ handleInputTempLeftFixedColumnCount,
106
115
  handleViewSettingShow,
107
116
  handleViewSettingClose,
108
117
  handleViewSettingConfirm