@weitutech/by-components 1.1.44 → 1.1.45

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.
@@ -872,7 +872,7 @@ module.exports = function (it) {
872
872
 
873
873
  var call = __webpack_require__(9565);
874
874
  var aCallable = __webpack_require__(9306);
875
- var anObject = __webpack_require__(932);
875
+ var anObject = __webpack_require__(8551);
876
876
  var tryToString = __webpack_require__(6823);
877
877
  var getIteratorMethod = __webpack_require__(851);
878
878
 
@@ -1080,7 +1080,7 @@ var $ = __webpack_require__(6518);
1080
1080
  var call = __webpack_require__(9565);
1081
1081
  var iterate = __webpack_require__(2652);
1082
1082
  var aCallable = __webpack_require__(9306);
1083
- var anObject = __webpack_require__(932);
1083
+ var anObject = __webpack_require__(8551);
1084
1084
  var getIteratorDirect = __webpack_require__(1767);
1085
1085
  var iteratorClose = __webpack_require__(9539);
1086
1086
  var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
@@ -1946,7 +1946,7 @@ module.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) {
1946
1946
  var $ = __webpack_require__(6518);
1947
1947
  var call = __webpack_require__(9565);
1948
1948
  var aCallable = __webpack_require__(9306);
1949
- var anObject = __webpack_require__(932);
1949
+ var anObject = __webpack_require__(8551);
1950
1950
  var getIteratorDirect = __webpack_require__(1767);
1951
1951
  var getIteratorFlattenable = __webpack_require__(8646);
1952
1952
  var createIteratorProxy = __webpack_require__(9462);
@@ -2663,25 +2663,6 @@ module.exports = function (it) {
2663
2663
  };
2664
2664
 
2665
2665
 
2666
- /***/ }),
2667
-
2668
- /***/ 932:
2669
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
2670
-
2671
- "use strict";
2672
-
2673
- var isObject = __webpack_require__(34);
2674
-
2675
- var $String = String;
2676
- var $TypeError = TypeError;
2677
-
2678
- // `Assert: Type(argument) is Object`
2679
- module.exports = function (argument) {
2680
- if (isObject(argument)) return argument;
2681
- throw new $TypeError($String(argument) + ' is not an object');
2682
- };
2683
-
2684
-
2685
2666
  /***/ }),
2686
2667
 
2687
2668
  /***/ 936:
@@ -4740,7 +4721,7 @@ var $ = __webpack_require__(6518);
4740
4721
  var call = __webpack_require__(9565);
4741
4722
  var iterate = __webpack_require__(2652);
4742
4723
  var aCallable = __webpack_require__(9306);
4743
- var anObject = __webpack_require__(932);
4724
+ var anObject = __webpack_require__(8551);
4744
4725
  var getIteratorDirect = __webpack_require__(1767);
4745
4726
  var iteratorClose = __webpack_require__(9539);
4746
4727
  var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
@@ -10056,7 +10037,7 @@ $({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('uni
10056
10037
  var $ = __webpack_require__(6518);
10057
10038
  var call = __webpack_require__(9565);
10058
10039
  var aCallable = __webpack_require__(9306);
10059
- var anObject = __webpack_require__(932);
10040
+ var anObject = __webpack_require__(8551);
10060
10041
  var getIteratorDirect = __webpack_require__(1767);
10061
10042
  var createIteratorProxy = __webpack_require__(9462);
10062
10043
  var callWithSafeIterationClosing = __webpack_require__(6319);
@@ -10119,7 +10100,7 @@ module.exports = function (obj) {
10119
10100
  "use strict";
10120
10101
 
10121
10102
  var $ = __webpack_require__(6518);
10122
- var anObject = __webpack_require__(932);
10103
+ var anObject = __webpack_require__(8551);
10123
10104
  var iterate = __webpack_require__(2652);
10124
10105
  var getIteratorDirect = __webpack_require__(1767);
10125
10106
 
@@ -11670,7 +11651,7 @@ module.exports = !fails(function () {
11670
11651
  "use strict";
11671
11652
 
11672
11653
  /* global ActiveXObject -- old IE, WSH */
11673
- var anObject = __webpack_require__(932);
11654
+ var anObject = __webpack_require__(8551);
11674
11655
  var definePropertiesModule = __webpack_require__(6801);
11675
11656
  var enumBugKeys = __webpack_require__(8727);
11676
11657
  var hiddenKeys = __webpack_require__(421);
@@ -12184,7 +12165,7 @@ $({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
12184
12165
  var $ = __webpack_require__(6518);
12185
12166
  var call = __webpack_require__(9565);
12186
12167
  var aCallable = __webpack_require__(9306);
12187
- var anObject = __webpack_require__(932);
12168
+ var anObject = __webpack_require__(8551);
12188
12169
  var getIteratorDirect = __webpack_require__(1767);
12189
12170
  var createIteratorProxy = __webpack_require__(9462);
12190
12171
  var callWithSafeIterationClosing = __webpack_require__(6319);
@@ -13019,7 +13000,7 @@ module.exports = function (name) {
13019
13000
 
13020
13001
  var bind = __webpack_require__(6080);
13021
13002
  var call = __webpack_require__(9565);
13022
- var anObject = __webpack_require__(932);
13003
+ var anObject = __webpack_require__(8551);
13023
13004
  var tryToString = __webpack_require__(6823);
13024
13005
  var isArrayIteratorMethod = __webpack_require__(4209);
13025
13006
  var lengthOfArrayLike = __webpack_require__(6198);
@@ -24162,7 +24143,7 @@ var $ = __webpack_require__(6518);
24162
24143
  var call = __webpack_require__(9565);
24163
24144
  var iterate = __webpack_require__(2652);
24164
24145
  var aCallable = __webpack_require__(9306);
24165
- var anObject = __webpack_require__(932);
24146
+ var anObject = __webpack_require__(8551);
24166
24147
  var getIteratorDirect = __webpack_require__(1767);
24167
24148
  var iteratorClose = __webpack_require__(9539);
24168
24149
  var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
@@ -26914,7 +26895,7 @@ __webpack_require__(8237);
26914
26895
  "use strict";
26915
26896
 
26916
26897
  var aCallable = __webpack_require__(9306);
26917
- var anObject = __webpack_require__(932);
26898
+ var anObject = __webpack_require__(8551);
26918
26899
  var call = __webpack_require__(9565);
26919
26900
  var toIntegerOrInfinity = __webpack_require__(1291);
26920
26901
  var getIteratorDirect = __webpack_require__(1767);
@@ -29544,7 +29525,7 @@ module.exports = typeof documentAll == 'undefined' && documentAll !== undefined
29544
29525
  var DESCRIPTORS = __webpack_require__(3724);
29545
29526
  var IE8_DOM_DEFINE = __webpack_require__(5917);
29546
29527
  var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(8686);
29547
- var anObject = __webpack_require__(932);
29528
+ var anObject = __webpack_require__(8551);
29548
29529
  var toPropertyKey = __webpack_require__(6969);
29549
29530
 
29550
29531
  var $TypeError = TypeError;
@@ -30182,7 +30163,7 @@ module.exports = function (it) {
30182
30163
 
30183
30164
  var $ = __webpack_require__(6518);
30184
30165
  var call = __webpack_require__(9565);
30185
- var anObject = __webpack_require__(932);
30166
+ var anObject = __webpack_require__(8551);
30186
30167
  var getIteratorDirect = __webpack_require__(1767);
30187
30168
  var notANaN = __webpack_require__(4149);
30188
30169
  var toPositiveInteger = __webpack_require__(9590);
@@ -30432,7 +30413,7 @@ var getBuiltIn = __webpack_require__(7751);
30432
30413
  var uncurryThis = __webpack_require__(9504);
30433
30414
  var getOwnPropertyNamesModule = __webpack_require__(8480);
30434
30415
  var getOwnPropertySymbolsModule = __webpack_require__(3717);
30435
- var anObject = __webpack_require__(932);
30416
+ var anObject = __webpack_require__(8551);
30436
30417
 
30437
30418
  var concat = uncurryThis([].concat);
30438
30419
 
@@ -34293,7 +34274,7 @@ module.exports = function (target, src, options) {
34293
34274
 
34294
34275
  "use strict";
34295
34276
 
34296
- var anObject = __webpack_require__(932);
34277
+ var anObject = __webpack_require__(8551);
34297
34278
  var iteratorClose = __webpack_require__(9539);
34298
34279
 
34299
34280
  // call something on iterator step with safe closing on error
@@ -36039,7 +36020,7 @@ if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
36039
36020
  var DESCRIPTORS = __webpack_require__(3724);
36040
36021
  var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(8686);
36041
36022
  var definePropertyModule = __webpack_require__(4913);
36042
- var anObject = __webpack_require__(932);
36023
+ var anObject = __webpack_require__(8551);
36043
36024
  var toIndexedObject = __webpack_require__(5397);
36044
36025
  var objectKeys = __webpack_require__(1072);
36045
36026
 
@@ -38089,7 +38070,7 @@ var $ = __webpack_require__(6518);
38089
38070
  var call = __webpack_require__(9565);
38090
38071
  var iterate = __webpack_require__(2652);
38091
38072
  var aCallable = __webpack_require__(9306);
38092
- var anObject = __webpack_require__(932);
38073
+ var anObject = __webpack_require__(8551);
38093
38074
  var getIteratorDirect = __webpack_require__(1767);
38094
38075
  var iteratorClose = __webpack_require__(9539);
38095
38076
  var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
@@ -40493,7 +40474,7 @@ module.exports = function (argument) {
40493
40474
  var $ = __webpack_require__(6518);
40494
40475
  var globalThis = __webpack_require__(4576);
40495
40476
  var anInstance = __webpack_require__(679);
40496
- var anObject = __webpack_require__(932);
40477
+ var anObject = __webpack_require__(8551);
40497
40478
  var isCallable = __webpack_require__(4901);
40498
40479
  var getPrototypeOf = __webpack_require__(2787);
40499
40480
  var defineBuiltInAccessor = __webpack_require__(2106);
@@ -40593,7 +40574,7 @@ module.exports = function (name) {
40593
40574
  var $ = __webpack_require__(6518);
40594
40575
  var iterate = __webpack_require__(2652);
40595
40576
  var aCallable = __webpack_require__(9306);
40596
- var anObject = __webpack_require__(932);
40577
+ var anObject = __webpack_require__(8551);
40597
40578
  var getIteratorDirect = __webpack_require__(1767);
40598
40579
  var iteratorClose = __webpack_require__(9539);
40599
40580
  var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
@@ -41430,6 +41411,25 @@ module.exports = function isSupersetOf(other) {
41430
41411
  return deCh;
41431
41412
  });
41432
41413
 
41414
+ /***/ }),
41415
+
41416
+ /***/ 8551:
41417
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
41418
+
41419
+ "use strict";
41420
+
41421
+ var isObject = __webpack_require__(34);
41422
+
41423
+ var $String = String;
41424
+ var $TypeError = TypeError;
41425
+
41426
+ // `Assert: Type(argument) is Object`
41427
+ module.exports = function (argument) {
41428
+ if (isObject(argument)) return argument;
41429
+ throw new $TypeError($String(argument) + ' is not an object');
41430
+ };
41431
+
41432
+
41433
41433
  /***/ }),
41434
41434
 
41435
41435
  /***/ 8560:
@@ -41539,7 +41539,7 @@ module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
41539
41539
  "use strict";
41540
41540
 
41541
41541
  var call = __webpack_require__(9565);
41542
- var anObject = __webpack_require__(932);
41542
+ var anObject = __webpack_require__(8551);
41543
41543
  var getIteratorDirect = __webpack_require__(1767);
41544
41544
  var getIteratorMethod = __webpack_require__(851);
41545
41545
 
@@ -52560,7 +52560,7 @@ module.exports = function (argument) {
52560
52560
 
52561
52561
  var $ = __webpack_require__(6518);
52562
52562
  var call = __webpack_require__(9565);
52563
- var anObject = __webpack_require__(932);
52563
+ var anObject = __webpack_require__(8551);
52564
52564
  var getIteratorDirect = __webpack_require__(1767);
52565
52565
  var notANaN = __webpack_require__(4149);
52566
52566
  var toPositiveInteger = __webpack_require__(9590);
@@ -53062,7 +53062,7 @@ module.exports = version;
53062
53062
  "use strict";
53063
53063
 
53064
53064
  var call = __webpack_require__(9565);
53065
- var anObject = __webpack_require__(932);
53065
+ var anObject = __webpack_require__(8551);
53066
53066
  var getMethod = __webpack_require__(5966);
53067
53067
 
53068
53068
  module.exports = function (iterator, kind, value) {
@@ -60752,8 +60752,8 @@ var component = normalizeComponent(
60752
60752
  )
60753
60753
 
60754
60754
  /* harmony default export */ var pager = (component.exports);
60755
- ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"72942c6c-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/table/index.vue?vue&type=template&id=58d17823
60756
- var tablevue_type_template_id_58d17823_render = function render() {
60755
+ ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"72942c6c-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/table/index.vue?vue&type=template&id=4926859a
60756
+ var tablevue_type_template_id_4926859a_render = function render() {
60757
60757
  var _vm = this,
60758
60758
  _c = _vm._self._c;
60759
60759
  return _c('div', [_c('vxe-grid', _vm._g(_vm._b({
@@ -60817,6 +60817,7 @@ var tablevue_type_template_id_58d17823_render = function render() {
60817
60817
  attrs: {
60818
60818
  "info-method": _vm.gridOptions.customColumnConfig.infoMethod,
60819
60819
  "submit-method": _vm.gridOptions.customColumnConfig.submitMethod,
60820
+ "fixed-max-count": _vm.gridOptions.customColumnConfig.fixedMaxCount,
60820
60821
  "dialog-visible": _vm.customTableVisible
60821
60822
  },
60822
60823
  on: {
@@ -60826,7 +60827,7 @@ var tablevue_type_template_id_58d17823_render = function render() {
60826
60827
  }
60827
60828
  }) : _vm._e()], 1);
60828
60829
  };
60829
- var tablevue_type_template_id_58d17823_staticRenderFns = [];
60830
+ var tablevue_type_template_id_4926859a_staticRenderFns = [];
60830
60831
 
60831
60832
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
60832
60833
  var es_array_push = __webpack_require__(4114);
@@ -60846,8 +60847,8 @@ var es_set_is_superset_of_v2 = __webpack_require__(2475);
60846
60847
  var es_set_symmetric_difference_v2 = __webpack_require__(5024);
60847
60848
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.union.v2.js
60848
60849
  var es_set_union_v2 = __webpack_require__(1698);
60849
- ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"72942c6c-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/custom-column/index.vue?vue&type=template&id=6ff46ecd
60850
- var custom_columnvue_type_template_id_6ff46ecd_render = function render() {
60850
+ ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"72942c6c-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/custom-column/index.vue?vue&type=template&id=22c5acce
60851
+ var custom_columnvue_type_template_id_22c5acce_render = function render() {
60851
60852
  var _vm = this,
60852
60853
  _c = _vm._self._c;
60853
60854
  return _c('div', {
@@ -61048,7 +61049,7 @@ var custom_columnvue_type_template_id_6ff46ecd_render = function render() {
61048
61049
  }) : _vm._e()]);
61049
61050
  }), 0)], 1)], 1)], 1)])])])], 1);
61050
61051
  };
61051
- var custom_columnvue_type_template_id_6ff46ecd_staticRenderFns = [];
61052
+ var custom_columnvue_type_template_id_22c5acce_staticRenderFns = [];
61052
61053
 
61053
61054
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
61054
61055
  var es_iterator_filter = __webpack_require__(2489);
@@ -61097,6 +61098,304 @@ const deepClone = target => {
61097
61098
  // 返回最终结果
61098
61099
  return result;
61099
61100
  };
61101
+ ;// ./src/utils/tableUtils.js
61102
+
61103
+
61104
+
61105
+
61106
+
61107
+
61108
+ /**
61109
+ * 判断是否缓存了表格列宽
61110
+ * @param {*} name 表格名称
61111
+ * @returns
61112
+ */
61113
+ const isCachedTableColumns = name => {
61114
+ if (!name) return false;
61115
+ return !!localStorage.getItem(name);
61116
+ };
61117
+
61118
+ /**
61119
+ * 删除表格列宽缓存
61120
+ * @param {*} name 表格名称
61121
+ */
61122
+ const removeCachedTableColumns = name => {
61123
+ localStorage.removeItem(name);
61124
+ };
61125
+
61126
+ /**
61127
+ * 缓存列宽
61128
+ * @param {*} name 表格名称
61129
+ * @param {*} context
61130
+ */
61131
+ const saveCachedColumns = (name, context) => {
61132
+ if (!name) return;
61133
+ // 获取列宽信息
61134
+ const collectColumn = context.$table.collectColumn;
61135
+ // 获取已缓存的列宽数据
61136
+ const cachedColumns = getCachedColumns(name);
61137
+
61138
+ // 递归查找并更新列宽
61139
+ const updateColumnWidth = (columns, targetField, newWidth) => {
61140
+ const result = [];
61141
+ for (const col of columns) {
61142
+ if (col.children) {
61143
+ const updatedChildren = updateColumnWidth(col.children, targetField, newWidth);
61144
+ if (updatedChildren.length > 0) {
61145
+ result.push({
61146
+ field: col.field,
61147
+ width: newWidth,
61148
+ children: updatedChildren
61149
+ });
61150
+ }
61151
+ } else if (targetField && targetField !== '' && col.field === targetField) {
61152
+ //如果没设置field不缓存
61153
+ result.push({
61154
+ field: col.field,
61155
+ width: newWidth
61156
+ });
61157
+ }
61158
+ }
61159
+ return result;
61160
+ };
61161
+
61162
+ //当前拖动的列
61163
+ const currentColumn = context.column;
61164
+
61165
+ // 更新被拖动列的宽度(只缓存被拖动的列)
61166
+ const updatedColumns = updateColumnWidth(collectColumn, currentColumn.field, currentColumn.renderWidth);
61167
+
61168
+ // 合并新的列宽信息到缓存中
61169
+ const mergeColumns = (newColumns, cachedColumns) => {
61170
+ const result = [...cachedColumns];
61171
+ for (const newCol of newColumns) {
61172
+ const existingIndex = result.findIndex(col => col.field === newCol.field);
61173
+ if (existingIndex !== -1) {
61174
+ // 如果存在子列,递归合并
61175
+ if (newCol.children && result[existingIndex].children) {
61176
+ result[existingIndex].children = mergeColumns(newCol.children, result[existingIndex].children);
61177
+ } else {
61178
+ // 更新宽度
61179
+ result[existingIndex].width = newCol.width;
61180
+ }
61181
+ } else {
61182
+ // 添加新的列信息
61183
+ result.push(newCol);
61184
+ }
61185
+ }
61186
+ return result;
61187
+ };
61188
+
61189
+ // 合并并保存更新后的列宽数据
61190
+ const finalColumns = mergeColumns(updatedColumns, cachedColumns);
61191
+
61192
+ //缓存列宽
61193
+ localStorage.setItem(name, JSON.stringify(finalColumns));
61194
+ };
61195
+
61196
+ /**
61197
+ * 获取列宽缓存
61198
+ * @param {*} name 表格名称
61199
+ * @returns
61200
+ */
61201
+ const getCachedColumns = name => {
61202
+ return JSON.parse(localStorage.getItem(name) || '[]');
61203
+ };
61204
+
61205
+ /**
61206
+ * 替换列宽 - 表格列数据替换成缓存中的列宽(若有列宽缓存)
61207
+ * @param {*} name
61208
+ * @param {*} columns
61209
+ * @returns
61210
+ */
61211
+ const replaceColumnWidthToColumns = (name, columns) => {
61212
+ if (!name) {
61213
+ return columns;
61214
+ }
61215
+ const cacheColumns = getCachedColumns(name);
61216
+ if (!cacheColumns) {
61217
+ return columns;
61218
+ }
61219
+
61220
+ // 递归处理多级表头的列宽
61221
+ const processColumnWidth = (columns, cacheColumns) => {
61222
+ return columns.map(column => {
61223
+ if (column.children) {
61224
+ const cacheColumn = cacheColumns.find(col => col.field === column.field);
61225
+ return {
61226
+ ...column,
61227
+ ...((cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.width) && {
61228
+ width: cacheColumn.width
61229
+ }),
61230
+ children: processColumnWidth(column.children, (cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.children) || [])
61231
+ };
61232
+ }
61233
+ const cacheColumn = cacheColumns.filter(col => col.field && col.field !== '') //有设置field才替换width给列
61234
+ .find(col => col.field === column.field);
61235
+ return {
61236
+ ...column,
61237
+ ...((cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.width) && {
61238
+ width: cacheColumn.width
61239
+ })
61240
+ };
61241
+ });
61242
+ };
61243
+ return processColumnWidth(columns, cacheColumns);
61244
+ };
61245
+
61246
+ /**
61247
+ * 重写列宽 (v3是否要替换这个方法的逻辑???)
61248
+ * @param fromColumns 原始列
61249
+ * @param toColumns 目标列
61250
+ * @returns 重写后的列
61251
+ */
61252
+ const rewriteWidthColumns = (fromColumns, toColumns) => {
61253
+ if (!fromColumns || !toColumns) return [];
61254
+ if (!fromColumns || fromColumns.length === 0) return toColumns;
61255
+ const result = [];
61256
+ for (const col of toColumns) {
61257
+ const fromCol = fromColumns.find(from => from.field === col.field);
61258
+ if (col.children) {
61259
+ // 递归处理子列
61260
+ const newCol = {
61261
+ ...col,
61262
+ children: rewriteWidthColumns((fromCol === null || fromCol === void 0 ? void 0 : fromCol.children) || [], col.children)
61263
+ };
61264
+ // 如果 fromCol 有 width,则添加 width,否则不添加 width 字段
61265
+ if (fromCol) {
61266
+ if (fromCol !== null && fromCol !== void 0 && fromCol.width) {
61267
+ newCol.width = fromCol.width;
61268
+ } else {
61269
+ delete newCol.width;
61270
+ }
61271
+ }
61272
+ result.push(newCol);
61273
+ } else {
61274
+ const newCol = {
61275
+ ...col
61276
+ };
61277
+ // 如果 fromCol 有 width,则添加 width,否则不添加 width 字段
61278
+ if (fromCol) {
61279
+ if (fromCol !== null && fromCol !== void 0 && fromCol.width) {
61280
+ newCol.width = fromCol.width;
61281
+ } else {
61282
+ delete newCol.width;
61283
+ }
61284
+ }
61285
+ result.push(newCol);
61286
+ }
61287
+ }
61288
+ return result;
61289
+ };
61290
+
61291
+ /**
61292
+ * 递归增加slot
61293
+ * @param {*} fields 字段信息
61294
+ * @param {*} slotSet 收集的slot
61295
+ */
61296
+ const recursiveSlot = (fields, slotSet) => {
61297
+ if (!fields || !Array.isArray(fields)) {
61298
+ return;
61299
+ }
61300
+ fields.forEach(col => {
61301
+ if (col.slots) {
61302
+ const slots = Object.values(col.slots);
61303
+ slots.forEach(slot => slotSet.add(slot));
61304
+ }
61305
+ if (col.children) {
61306
+ recursiveSlot(col.children, slotSet);
61307
+ }
61308
+ });
61309
+ };
61310
+
61311
+ /**
61312
+ * 为表格创建分组列结构(将固定列按一级表头分组) -- 有二级表头情况
61313
+ * @param columns 原始列分组数据
61314
+ * @param fixed_max_count 固定列最大数量
61315
+ */
61316
+ const groupedColumnsForTable = (columns, fixed_max_count = 6) => {
61317
+ let fixedCount = 0; // 先统计所有固定列的数量
61318
+ columns.forEach(group => {
61319
+ group.data.forEach(col => {
61320
+ if (col.fixed === 'left' && ['true', true, '1', 1].includes(col.type)) {
61321
+ fixedCount++;
61322
+ }
61323
+ });
61324
+ });
61325
+
61326
+ //如果固定列数量>固定列最大数量,直接返回原始分组结构,但去除所有fixed属性
61327
+ if (fixedCount > fixed_max_count) {
61328
+ //超过fixed_max_count个固定列,取消所有固定
61329
+ const result = columns.map(group => ({
61330
+ ...group,
61331
+ fixed: undefined,
61332
+ data: group.data.map(col => ({
61333
+ ...col,
61334
+ fixed: undefined
61335
+ }))
61336
+ }));
61337
+ return result;
61338
+ }
61339
+
61340
+ // 固定列数量<=6个时,才进行重新分组
61341
+ const fixedGroups = [];
61342
+ const normalGroups = [];
61343
+ columns.forEach(group => {
61344
+ const fixedItems = [];
61345
+ const normalItems = [];
61346
+ group.data.forEach(col => {
61347
+ if (col.fixed === 'left') {
61348
+ fixedItems.push(col);
61349
+ } else {
61350
+ normalItems.push(col);
61351
+ }
61352
+ });
61353
+
61354
+ // 如果有固定的列,加入固定分组
61355
+ if (fixedItems.length > 0) {
61356
+ fixedGroups.push({
61357
+ label: group.label,
61358
+ fixed: 'left',
61359
+ data: fixedItems
61360
+ });
61361
+ }
61362
+
61363
+ // 如果有普通列,加入普通分组
61364
+ if (normalItems.length > 0) {
61365
+ normalGroups.push({
61366
+ label: group.label,
61367
+ data: normalItems
61368
+ });
61369
+ }
61370
+ });
61371
+ const result = [...fixedGroups, ...normalGroups];
61372
+
61373
+ // 将固定分组添加到最前面
61374
+ return result;
61375
+ };
61376
+
61377
+ /**
61378
+ * 判断左侧固定个数,决定是否左侧固定还是取消固定 -- 无二级表头情况
61379
+ * @param {*} cols 列数据
61380
+ * @param {*} fixed_max_count 固定列最大数量
61381
+ * @returns
61382
+ */
61383
+ const resetFixedColumns = (cols, fixed_max_count = 6) => {
61384
+ if (!cols) return [];
61385
+ let fixedCount = 0;
61386
+ cols.forEach(col => {
61387
+ if (col.fixed === 'left' && ['true', true, '1', 1].includes(col.type)) {
61388
+ fixedCount++;
61389
+ }
61390
+ });
61391
+ if (fixedCount > fixed_max_count) {
61392
+ cols.map(item => {
61393
+ item.fixed = false;
61394
+ });
61395
+ }
61396
+ return cols;
61397
+ };
61398
+
61100
61399
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/custom-column/index.vue?vue&type=script&lang=js
61101
61400
 
61102
61401
 
@@ -61108,6 +61407,7 @@ const deepClone = target => {
61108
61407
 
61109
61408
 
61110
61409
 
61410
+
61111
61411
  /* harmony default export */ var custom_columnvue_type_script_lang_js = ({
61112
61412
  name: 'CustomColumn',
61113
61413
  components: {
@@ -61127,6 +61427,14 @@ const deepClone = target => {
61127
61427
  type: Function,
61128
61428
  required: true,
61129
61429
  default: () => {}
61430
+ },
61431
+ //左侧固定列最多个数 - 默认6个 (超出个数时,左侧固定失效)
61432
+ fixedMaxCount: {
61433
+ type: Number,
61434
+ default: 6,
61435
+ validator: value => {
61436
+ return value >= 0;
61437
+ }
61130
61438
  }
61131
61439
  },
61132
61440
  data() {
@@ -61233,7 +61541,7 @@ const deepClone = target => {
61233
61541
  this.checkBoxMenu = this.deepClone(initColumn);
61234
61542
  this.draggableMenu = setDraggableMenu(this.checkBoxMenu);
61235
61543
  } else {
61236
- console.log('==========从未被保存过', initColumn);
61544
+ // console.log('==========从未被保存过', initColumn)
61237
61545
 
61238
61546
  // 从未被保存过
61239
61547
  let num = 0;
@@ -61255,12 +61563,8 @@ const deepClone = target => {
61255
61563
  this.checkBoxMenu = this.deepClone(initColumn);
61256
61564
  this.draggableMenu = setDraggableMenu(this.checkBoxMenu);
61257
61565
  }
61258
- this.$emit('changeTable', this.draggableMenu.filter(item => item.key !== 'sort-cut-off').sort((a, b) => a.sort - b.sort));
61259
-
61260
- // changeTableGroup 回调:对固定列进行重新分组
61261
- const groupedColumns = this.createGroupedColumnsForTable(this.checkBoxMenu);
61262
- this.$emit('changeTableGroup', groupedColumns);
61263
- // this.$emit('changeTableGroup', this.checkBoxMenu)
61566
+ this.emitChangeTable(this.draggableMenu.filter(item => item.key !== 'sort-cut-off').sort((a, b) => a.sort - b.sort));
61567
+ this.emitChangeTableGroup(this.checkBoxMenu);
61264
61568
  },
61265
61569
  // 全不选
61266
61570
  selectNone() {
@@ -61364,82 +61668,21 @@ const deepClone = target => {
61364
61668
  params.column.forEach(item => {
61365
61669
  cols.push(...item.data);
61366
61670
  });
61367
- this.$emit('changeTable', cols.sort((a, b) => a.sort - b.sort));
61368
-
61369
- // changeTableGroup 回调:对固定列进行重新分组
61370
- const groupedColumns = this.createGroupedColumnsForTable(params.column);
61371
- this.$emit('changeTableGroup', groupedColumns);
61671
+ this.emitChangeTable(cols.sort((a, b) => a.sort - b.sort));
61672
+ this.emitChangeTableGroup(params.column);
61372
61673
  this.closeDialog();
61373
61674
  },
61374
- /**
61375
- * 为表格创建分组列结构(将固定列按一级表头分组)
61376
- * @param columns 原始列分组数据
61377
- */
61378
- createGroupedColumnsForTable(columns) {
61379
- console.log('==========columns', columns);
61380
-
61381
- // 先统计所有固定列的数量
61382
- let fixedCount = 0;
61383
- columns.forEach(group => {
61384
- group.data.forEach(col => {
61385
- if (col.fixed === 'left' && ['true', true, '1', 1].includes(col.type)) {
61386
- fixedCount++;
61387
- }
61388
- });
61389
- });
61390
- console.log('==========固定列个数:', fixedCount);
61391
-
61392
- // *** 如果固定列数量>6个,直接返回原始分组结构,但去除所有fixed属性 start
61393
- if (fixedCount > 6) {
61394
- const result = columns.map(group => ({
61395
- ...group,
61396
- fixed: undefined,
61397
- data: group.data.map(col => ({
61398
- ...col,
61399
- fixed: undefined
61400
- }))
61401
- }));
61402
- console.log('==========超过6个固定列,取消所有固定:', result);
61403
- return result;
61404
- }
61405
- // *** 如果固定列数量>6个,直接返回原始分组结构,但去除所有fixed属性 end
61406
-
61407
- // 固定列数量<=6个时,才进行重新分组
61408
- const fixedGroups = [];
61409
- const normalGroups = [];
61410
- columns.forEach(group => {
61411
- const fixedItems = [];
61412
- const normalItems = [];
61413
- group.data.forEach(col => {
61414
- if (col.fixed === 'left') {
61415
- fixedItems.push(col);
61416
- } else {
61417
- normalItems.push(col);
61418
- }
61419
- });
61420
-
61421
- // 如果有固定的列,加入固定分组
61422
- if (fixedItems.length > 0) {
61423
- fixedGroups.push({
61424
- label: group.label,
61425
- fixed: 'left',
61426
- data: fixedItems
61427
- });
61428
- }
61429
-
61430
- // 如果有普通列,加入普通分组
61431
- if (normalItems.length > 0) {
61432
- normalGroups.push({
61433
- label: group.label,
61434
- data: normalItems
61435
- });
61436
- }
61437
- });
61438
- const result = [...fixedGroups, ...normalGroups];
61439
- console.log('==========<=6个固定列,正常分组:', result);
61440
-
61441
- // 将固定分组添加到最前面
61442
- return result;
61675
+ // changeTable
61676
+ emitChangeTable(cols) {
61677
+ //表头左侧固定逻辑(对固定列fixed重新赋值)
61678
+ const reCols = resetFixedColumns(cols, this.fixedMaxCount);
61679
+ this.$emit('changeTable', reCols);
61680
+ },
61681
+ // changeTableGroup
61682
+ emitChangeTableGroup(cols) {
61683
+ //表头左侧固定逻辑(对固定列进行重新分组)
61684
+ const groupedCols = groupedColumnsForTable(cols, this.fixedMaxCount);
61685
+ this.$emit('changeTableGroup', groupedCols);
61443
61686
  },
61444
61687
  // 关闭弹窗
61445
61688
  closeDialog() {
@@ -61462,8 +61705,8 @@ const deepClone = target => {
61462
61705
  ;
61463
61706
  var custom_column_component = normalizeComponent(
61464
61707
  components_custom_columnvue_type_script_lang_js,
61465
- custom_columnvue_type_template_id_6ff46ecd_render,
61466
- custom_columnvue_type_template_id_6ff46ecd_staticRenderFns,
61708
+ custom_columnvue_type_template_id_22c5acce_render,
61709
+ custom_columnvue_type_template_id_22c5acce_staticRenderFns,
61467
61710
  false,
61468
61711
  null,
61469
61712
  null,
@@ -61472,216 +61715,6 @@ var custom_column_component = normalizeComponent(
61472
61715
  )
61473
61716
 
61474
61717
  /* harmony default export */ var custom_column = (custom_column_component.exports);
61475
- ;// ./src/utils/tableUtils.js
61476
-
61477
-
61478
-
61479
-
61480
-
61481
-
61482
- /**
61483
- * 判断是否缓存了表格列宽
61484
- * @param {*} name 表格名称
61485
- * @returns
61486
- */
61487
- const isCachedTableColumns = name => {
61488
- if (!name) return false;
61489
- return !!localStorage.getItem(name);
61490
- };
61491
-
61492
- /**
61493
- * 删除表格列宽缓存
61494
- * @param {*} name 表格名称
61495
- */
61496
- const removeCachedTableColumns = name => {
61497
- localStorage.removeItem(name);
61498
- };
61499
-
61500
- /**
61501
- * 缓存列宽
61502
- * @param {*} name 表格名称
61503
- * @param {*} context
61504
- */
61505
- const saveCachedColumns = (name, context) => {
61506
- if (!name) return;
61507
- // 获取列宽信息
61508
- const collectColumn = context.$table.collectColumn;
61509
- // 获取已缓存的列宽数据
61510
- const cachedColumns = getCachedColumns(name);
61511
-
61512
- // 递归查找并更新列宽
61513
- const updateColumnWidth = (columns, targetField, newWidth) => {
61514
- const result = [];
61515
- for (const col of columns) {
61516
- if (col.children) {
61517
- const updatedChildren = updateColumnWidth(col.children, targetField, newWidth);
61518
- if (updatedChildren.length > 0) {
61519
- result.push({
61520
- field: col.field,
61521
- width: newWidth,
61522
- children: updatedChildren
61523
- });
61524
- }
61525
- } else if (targetField && targetField !== '' && col.field === targetField) {
61526
- //如果没设置field不缓存
61527
- result.push({
61528
- field: col.field,
61529
- width: newWidth
61530
- });
61531
- }
61532
- }
61533
- return result;
61534
- };
61535
-
61536
- //当前拖动的列
61537
- const currentColumn = context.column;
61538
-
61539
- // 更新被拖动列的宽度(只缓存被拖动的列)
61540
- const updatedColumns = updateColumnWidth(collectColumn, currentColumn.field, currentColumn.renderWidth);
61541
-
61542
- // 合并新的列宽信息到缓存中
61543
- const mergeColumns = (newColumns, cachedColumns) => {
61544
- const result = [...cachedColumns];
61545
- for (const newCol of newColumns) {
61546
- const existingIndex = result.findIndex(col => col.field === newCol.field);
61547
- if (existingIndex !== -1) {
61548
- // 如果存在子列,递归合并
61549
- if (newCol.children && result[existingIndex].children) {
61550
- result[existingIndex].children = mergeColumns(newCol.children, result[existingIndex].children);
61551
- } else {
61552
- // 更新宽度
61553
- result[existingIndex].width = newCol.width;
61554
- }
61555
- } else {
61556
- // 添加新的列信息
61557
- result.push(newCol);
61558
- }
61559
- }
61560
- return result;
61561
- };
61562
-
61563
- // 合并并保存更新后的列宽数据
61564
- const finalColumns = mergeColumns(updatedColumns, cachedColumns);
61565
-
61566
- //缓存列宽
61567
- localStorage.setItem(name, JSON.stringify(finalColumns));
61568
- };
61569
-
61570
- /**
61571
- * 获取列宽缓存
61572
- * @param {*} name 表格名称
61573
- * @returns
61574
- */
61575
- const getCachedColumns = name => {
61576
- return JSON.parse(localStorage.getItem(name) || '[]');
61577
- };
61578
-
61579
- /**
61580
- * 替换列宽 - 表格列数据替换成缓存中的列宽(若有列宽缓存)
61581
- * @param {*} name
61582
- * @param {*} columns
61583
- * @returns
61584
- */
61585
- const replaceColumnWidthToColumns = (name, columns) => {
61586
- if (!name) {
61587
- return columns;
61588
- }
61589
- const cacheColumns = getCachedColumns(name);
61590
- if (!cacheColumns) {
61591
- return columns;
61592
- }
61593
-
61594
- // 递归处理多级表头的列宽
61595
- const processColumnWidth = (columns, cacheColumns) => {
61596
- return columns.map(column => {
61597
- if (column.children) {
61598
- const cacheColumn = cacheColumns.find(col => col.field === column.field);
61599
- return {
61600
- ...column,
61601
- ...((cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.width) && {
61602
- width: cacheColumn.width
61603
- }),
61604
- children: processColumnWidth(column.children, (cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.children) || [])
61605
- };
61606
- }
61607
- const cacheColumn = cacheColumns.filter(col => col.field && col.field !== '') //有设置field才替换width给列
61608
- .find(col => col.field === column.field);
61609
- return {
61610
- ...column,
61611
- ...((cacheColumn === null || cacheColumn === void 0 ? void 0 : cacheColumn.width) && {
61612
- width: cacheColumn.width
61613
- })
61614
- };
61615
- });
61616
- };
61617
- return processColumnWidth(columns, cacheColumns);
61618
- };
61619
-
61620
- /**
61621
- * 重写列宽 (v3是否要替换这个方法的逻辑???)
61622
- * @param fromColumns 原始列
61623
- * @param toColumns 目标列
61624
- * @returns 重写后的列
61625
- */
61626
- const rewriteWidthColumns = (fromColumns, toColumns) => {
61627
- if (!fromColumns || !toColumns) return [];
61628
- if (!fromColumns || fromColumns.length === 0) return toColumns;
61629
- const result = [];
61630
- for (const col of toColumns) {
61631
- const fromCol = fromColumns.find(from => from.field === col.field);
61632
- if (col.children) {
61633
- // 递归处理子列
61634
- const newCol = {
61635
- ...col,
61636
- children: rewriteWidthColumns((fromCol === null || fromCol === void 0 ? void 0 : fromCol.children) || [], col.children)
61637
- };
61638
- // 如果 fromCol 有 width,则添加 width,否则不添加 width 字段
61639
- if (fromCol) {
61640
- if (fromCol !== null && fromCol !== void 0 && fromCol.width) {
61641
- newCol.width = fromCol.width;
61642
- } else {
61643
- delete newCol.width;
61644
- }
61645
- }
61646
- result.push(newCol);
61647
- } else {
61648
- const newCol = {
61649
- ...col
61650
- };
61651
- // 如果 fromCol 有 width,则添加 width,否则不添加 width 字段
61652
- if (fromCol) {
61653
- if (fromCol !== null && fromCol !== void 0 && fromCol.width) {
61654
- newCol.width = fromCol.width;
61655
- } else {
61656
- delete newCol.width;
61657
- }
61658
- }
61659
- result.push(newCol);
61660
- }
61661
- }
61662
- return result;
61663
- };
61664
-
61665
- /**
61666
- * 递归增加slot
61667
- * @param {*} fields 字段信息
61668
- * @param {*} slotSet 收集的slot
61669
- */
61670
- const recursiveSlot = (fields, slotSet) => {
61671
- if (!fields || !Array.isArray(fields)) {
61672
- return;
61673
- }
61674
- fields.forEach(col => {
61675
- if (col.slots) {
61676
- const slots = Object.values(col.slots);
61677
- slots.forEach(slot => slotSet.add(slot));
61678
- }
61679
- if (col.children) {
61680
- recursiveSlot(col.children, slotSet);
61681
- }
61682
- });
61683
- };
61684
-
61685
61718
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/table/index.vue?vue&type=script&lang=js
61686
61719
 
61687
61720
 
@@ -61954,8 +61987,8 @@ const recursiveSlot = (fields, slotSet) => {
61954
61987
  ;
61955
61988
  var table_component = normalizeComponent(
61956
61989
  components_tablevue_type_script_lang_js,
61957
- tablevue_type_template_id_58d17823_render,
61958
- tablevue_type_template_id_58d17823_staticRenderFns,
61990
+ tablevue_type_template_id_4926859a_render,
61991
+ tablevue_type_template_id_4926859a_staticRenderFns,
61959
61992
  false,
61960
61993
  null,
61961
61994
  null,