cloud-web-corejs 1.0.54-dev.633 → 1.0.54-dev.634
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 +1 -1
- package/src/components/table/index copy.js +1185 -0
- package/src/components/table/index.js +96 -81
|
@@ -50,10 +50,10 @@ function collectTopRootIndex(collectColumn, leaf) {
|
|
|
50
50
|
async function initVxeTable(option) {
|
|
51
51
|
let tableName = option.tableName;
|
|
52
52
|
if (
|
|
53
|
-
!configUtil.tableConfig.disableTableName
|
|
54
|
-
option.tableNameRequired !== false
|
|
55
|
-
!tableName
|
|
56
|
-
settingConfig.tableStorageDisabled !== true
|
|
53
|
+
!configUtil.tableConfig.disableTableName
|
|
54
|
+
&& option.tableNameRequired !== false
|
|
55
|
+
&& !tableName
|
|
56
|
+
&& settingConfig.tableStorageDisabled !== true
|
|
57
57
|
) {
|
|
58
58
|
return false;
|
|
59
59
|
}
|
|
@@ -171,8 +171,8 @@ async function initVxeTable(option) {
|
|
|
171
171
|
function handleToolbar($grid, option) {
|
|
172
172
|
let selfConfig = getSelfConfig();
|
|
173
173
|
if (
|
|
174
|
-
option.bindToolbar
|
|
175
|
-
(option.bindToolbar !== false && selfConfig.bindToolbar)
|
|
174
|
+
option.bindToolbar
|
|
175
|
+
|| (option.bindToolbar !== false && selfConfig.bindToolbar)
|
|
176
176
|
) {
|
|
177
177
|
let loopDo = function (children) {
|
|
178
178
|
if (children && children.length) {
|
|
@@ -195,17 +195,17 @@ function handleToolbar($grid, option) {
|
|
|
195
195
|
function handleCustomAlign(option) {
|
|
196
196
|
let selfConfig = getSelfConfig();
|
|
197
197
|
// let customAlign = option.customAlign || selfConfig.customAlign || "right";
|
|
198
|
-
let customAlign
|
|
199
|
-
selfConfig.customAlign === false
|
|
198
|
+
let customAlign
|
|
199
|
+
= selfConfig.customAlign === false
|
|
200
200
|
? false
|
|
201
201
|
: selfConfig.customAlign || "right";
|
|
202
|
-
customAlign
|
|
203
|
-
option.customAlign === false ? false : option.customAlign || customAlign;
|
|
202
|
+
customAlign
|
|
203
|
+
= option.customAlign === false ? false : option.customAlign || customAlign;
|
|
204
204
|
|
|
205
|
-
let customColumnWidth
|
|
206
|
-
option.customColumnWidth || selfConfig.customColumnWidth || 47;
|
|
207
|
-
let checkBoxColumnWidth
|
|
208
|
-
option.checkBoxColumnWidth || selfConfig.checkBoxColumnWidth || 48;
|
|
205
|
+
let customColumnWidth
|
|
206
|
+
= option.customColumnWidth || selfConfig.customColumnWidth || 47;
|
|
207
|
+
let checkBoxColumnWidth
|
|
208
|
+
= option.checkBoxColumnWidth || selfConfig.checkBoxColumnWidth || 48;
|
|
209
209
|
|
|
210
210
|
let checkBoxRequired = selfConfig.checkBoxRequired !== false;
|
|
211
211
|
if (option.checkBoxRequired === false) {
|
|
@@ -273,46 +273,53 @@ function columnDrop(t, tableName, tableRef) {
|
|
|
273
273
|
$table.sortable.destroy();
|
|
274
274
|
$table.sortable = null;
|
|
275
275
|
}
|
|
276
|
-
|
|
277
|
-
let
|
|
278
|
-
let relatedColId = null;
|
|
276
|
+
let dragStartIndex = -1;
|
|
277
|
+
let dragEndIndex = -1;
|
|
279
278
|
$table.sortable = configUtil.Sortable.create(
|
|
280
279
|
$table.$el.querySelector(
|
|
281
280
|
".body--wrapper>.vxe-table--header .vxe-header--row"
|
|
282
281
|
),
|
|
283
282
|
{
|
|
284
283
|
handle: ".vxe-header--column:not(.col--fixed)",
|
|
285
|
-
onMove: (
|
|
286
|
-
let
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
},
|
|
290
|
-
onEnd: ({ item }) => {
|
|
291
|
-
const { fullColumn, tableColumn, collectColumn } =
|
|
292
|
-
$table.getTableColumn();
|
|
293
|
-
const targetThElem = item;
|
|
294
|
-
const wrapperElem = targetThElem.parentNode;
|
|
284
|
+
onMove: (a, b, c) => {
|
|
285
|
+
let { dragged, related } = a;
|
|
286
|
+
// dragStartIndex = getElementIndex(dragged);
|
|
287
|
+
// dragEndIndex = getElementIndex(related);
|
|
295
288
|
|
|
296
|
-
|
|
297
|
-
|
|
289
|
+
let tableColumn = $table.getTableColumn().tableColumn;
|
|
290
|
+
let draggedColId = dragged.getAttribute("colid");
|
|
291
|
+
let relatedColId = related.getAttribute("colid");
|
|
292
|
+
dragStartIndex = tableColumn.findIndex(
|
|
298
293
|
(item) => item.id === draggedColId
|
|
299
294
|
);
|
|
300
|
-
|
|
295
|
+
dragEndIndex = tableColumn.findIndex(
|
|
301
296
|
(item) => item.id === relatedColId
|
|
302
297
|
);
|
|
303
|
-
|
|
304
|
-
|
|
298
|
+
},
|
|
299
|
+
onEnd: (dropParam) => {
|
|
300
|
+
let { item } = dropParam;
|
|
301
|
+
let oldIndex = dragStartIndex;
|
|
302
|
+
let newIndex = dragEndIndex;
|
|
303
|
+
if(newIndex < 0) newIndex = dropParam.newIndex;
|
|
304
|
+
const { fullColumn, tableColumn, collectColumn }
|
|
305
|
+
= $table.getTableColumn();
|
|
306
|
+
const targetThElem = item;
|
|
307
|
+
const wrapperElem = targetThElem.parentNode;
|
|
308
|
+
let oldColumn = tableColumn[oldIndex];
|
|
309
|
+
let oldTitle = oldColumn.title;
|
|
305
310
|
|
|
306
|
-
|
|
311
|
+
const newColumn = tableColumn[newIndex];
|
|
312
|
+
let newTitle = newColumn.title;
|
|
313
|
+
if (newColumn.fixed) {
|
|
307
314
|
// 错误的移动
|
|
308
|
-
if (
|
|
315
|
+
if (newIndex > oldIndex) {
|
|
309
316
|
wrapperElem.insertBefore(
|
|
310
317
|
targetThElem,
|
|
311
|
-
wrapperElem.children[
|
|
318
|
+
wrapperElem.children[oldIndex]
|
|
312
319
|
);
|
|
313
320
|
} else {
|
|
314
321
|
wrapperElem.insertBefore(
|
|
315
|
-
wrapperElem.children[
|
|
322
|
+
wrapperElem.children[oldIndex],
|
|
316
323
|
targetThElem
|
|
317
324
|
);
|
|
318
325
|
}
|
|
@@ -322,9 +329,17 @@ function columnDrop(t, tableName, tableRef) {
|
|
|
322
329
|
status: 'error'
|
|
323
330
|
}) */
|
|
324
331
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
332
|
+
// 叶子在 fullColumn 中的下标,与 collectColumn 顶层结构的下标不能直接混用
|
|
333
|
+
const oldColumnIndex = fullColumn.findIndex(
|
|
334
|
+
(item) => item.id === oldColumn.id
|
|
335
|
+
);
|
|
336
|
+
const newColumnIndex = fullColumn.findIndex(
|
|
337
|
+
(item) => item.id === newColumn.id
|
|
338
|
+
);
|
|
339
|
+
const oldLeafColumn = fullColumn[oldColumnIndex];
|
|
340
|
+
const newLeafColumn = fullColumn[newColumnIndex];
|
|
341
|
+
let oldLeafTitle = oldLeafColumn.title;
|
|
342
|
+
let newLeafTitle = newLeafColumn.title;
|
|
328
343
|
if (oldColumnIndex === newColumnIndex) {
|
|
329
344
|
return;
|
|
330
345
|
}
|
|
@@ -357,25 +372,25 @@ function getSelfConfig() {
|
|
|
357
372
|
function initColumnDefaulAttrs(columns, opts) {
|
|
358
373
|
let tableConfig = configUtil.tableConfig || {};
|
|
359
374
|
let selfConfig = getSelfConfig();
|
|
360
|
-
let lockCheckboxWidth
|
|
361
|
-
opts.lockCheckboxWidth !== false
|
|
375
|
+
let lockCheckboxWidth
|
|
376
|
+
= opts.lockCheckboxWidth !== false
|
|
362
377
|
? opts.lockCheckboxWidth || selfConfig.lockCheckboxWidth
|
|
363
378
|
: null;
|
|
364
|
-
let filterType
|
|
365
|
-
opts.filterType !== false && !opts.treeNodeUrl
|
|
379
|
+
let filterType
|
|
380
|
+
= opts.filterType !== false && !opts.treeNodeUrl
|
|
366
381
|
? opts.filterType || selfConfig.filterType || "filterContent"
|
|
367
382
|
: null;
|
|
368
|
-
let sortAll
|
|
369
|
-
opts.sortAll === true || (opts.sortAll !== false && !opts.treeNodeUrl);
|
|
383
|
+
let sortAll
|
|
384
|
+
= opts.sortAll === true || (opts.sortAll !== false && !opts.treeNodeUrl);
|
|
370
385
|
|
|
371
386
|
columns.forEach((column) => {
|
|
372
387
|
// 只有最底层的列(没有 children)才设置默认属性
|
|
373
388
|
if (!column.children || column.children.length === 0) {
|
|
374
389
|
// 设置 sortable
|
|
375
390
|
if (
|
|
376
|
-
sortAll
|
|
377
|
-
column.title
|
|
378
|
-
(column.sortable === null || column.sortable === undefined)
|
|
391
|
+
sortAll
|
|
392
|
+
&& column.title
|
|
393
|
+
&& (column.sortable === null || column.sortable === undefined)
|
|
379
394
|
) {
|
|
380
395
|
column.sortable = true;
|
|
381
396
|
}
|
|
@@ -383,9 +398,9 @@ function initColumnDefaulAttrs(columns, opts) {
|
|
|
383
398
|
// 设置过滤器
|
|
384
399
|
if (filterType && column.title && column.field) {
|
|
385
400
|
if (
|
|
386
|
-
column.filterType === "filterContent"
|
|
387
|
-
((column.filterType === null || column.filterType === undefined)
|
|
388
|
-
filterType === "filterContent")
|
|
401
|
+
column.filterType === "filterContent"
|
|
402
|
+
|| ((column.filterType === null || column.filterType === undefined)
|
|
403
|
+
&& filterType === "filterContent")
|
|
389
404
|
) {
|
|
390
405
|
if (!column.filters) {
|
|
391
406
|
column.filters = [
|
|
@@ -400,9 +415,9 @@ function initColumnDefaulAttrs(columns, opts) {
|
|
|
400
415
|
};
|
|
401
416
|
}
|
|
402
417
|
} else if (
|
|
403
|
-
column.filterType === "filterInput"
|
|
404
|
-
((column.filterType === null || column.filterType === undefined)
|
|
405
|
-
filterType === "filterInput")
|
|
418
|
+
column.filterType === "filterInput"
|
|
419
|
+
|| ((column.filterType === null || column.filterType === undefined)
|
|
420
|
+
&& filterType === "filterInput")
|
|
406
421
|
) {
|
|
407
422
|
if (!column.filters) {
|
|
408
423
|
column.filters = [
|
|
@@ -551,8 +566,8 @@ function initOption(opts) {
|
|
|
551
566
|
},*/
|
|
552
567
|
columns: columns,
|
|
553
568
|
};
|
|
554
|
-
let tableDefaultConfig
|
|
555
|
-
corejsConfig?.componentConfig?.table?.defaultConfig || {};
|
|
569
|
+
let tableDefaultConfig
|
|
570
|
+
= corejsConfig?.componentConfig?.table?.defaultConfig || {};
|
|
556
571
|
defaultOptions = configUtil.extendDeeply(defaultOptions, tableConfig);
|
|
557
572
|
defaultOptions = configUtil.extendDeeply(defaultOptions, customConfig);
|
|
558
573
|
defaultOptions = configUtil.extendDeeply(defaultOptions, tableDefaultConfig);
|
|
@@ -602,12 +617,12 @@ function initOption(opts) {
|
|
|
602
617
|
}
|
|
603
618
|
|
|
604
619
|
let reqPath = typeof path === "function" ? path() : path;
|
|
605
|
-
let addUserForTableEnabled
|
|
606
|
-
settingConfig.addUserForTableDisabled !== true;
|
|
607
|
-
let addCreateInfo
|
|
608
|
-
opts.addCreateInfo === true || addUserForTableEnabled;
|
|
609
|
-
let queryCreateInfo
|
|
610
|
-
opts.queryCreateInfo === true || addUserForTableEnabled;
|
|
620
|
+
let addUserForTableEnabled
|
|
621
|
+
= settingConfig.addUserForTableDisabled !== true;
|
|
622
|
+
let addCreateInfo
|
|
623
|
+
= opts.addCreateInfo === true || addUserForTableEnabled;
|
|
624
|
+
let queryCreateInfo
|
|
625
|
+
= opts.queryCreateInfo === true || addUserForTableEnabled;
|
|
611
626
|
let reqData = queryParams;
|
|
612
627
|
if (opts.paramHandle) {
|
|
613
628
|
reqData = opts.paramHandle
|
|
@@ -634,10 +649,10 @@ function initOption(opts) {
|
|
|
634
649
|
.treeConditions || ["enabled"];
|
|
635
650
|
let treeFiled = Object.keys(formData).some((key) => {
|
|
636
651
|
return (
|
|
637
|
-
!treeConditions.includes(key)
|
|
638
|
-
formData[key] !== null
|
|
639
|
-
formData[key] !== undefined
|
|
640
|
-
formData[key] !== ""
|
|
652
|
+
!treeConditions.includes(key)
|
|
653
|
+
&& formData[key] !== null
|
|
654
|
+
&& formData[key] !== undefined
|
|
655
|
+
&& formData[key] !== ""
|
|
641
656
|
);
|
|
642
657
|
});
|
|
643
658
|
if (treeFiled) {
|
|
@@ -646,8 +661,8 @@ function initOption(opts) {
|
|
|
646
661
|
let isLazy = $t.treeConfig.lazy;
|
|
647
662
|
$t.treeConfig.lazy = false;
|
|
648
663
|
$t.setAllTreeExpand(true).then(() => {
|
|
649
|
-
let fullAllDataRowMap
|
|
650
|
-
$t.$refs.xTable.fullAllDataRowMap;
|
|
664
|
+
let fullAllDataRowMap
|
|
665
|
+
= $t.$refs.xTable.fullAllDataRowMap;
|
|
651
666
|
let fullData = $t.getTableData().fullData;
|
|
652
667
|
fullData.forEach((lineData) => {
|
|
653
668
|
if (
|
|
@@ -803,8 +818,8 @@ function initOption(opts) {
|
|
|
803
818
|
|
|
804
819
|
function getTableJson(tableName, that, success) {
|
|
805
820
|
if (
|
|
806
|
-
configUtil.tableConfig.disableTableName
|
|
807
|
-
settingConfig.tableStorageDisabled
|
|
821
|
+
configUtil.tableConfig.disableTableName
|
|
822
|
+
|| settingConfig.tableStorageDisabled
|
|
808
823
|
)
|
|
809
824
|
return false;
|
|
810
825
|
if (!tableName) return;
|
|
@@ -825,8 +840,8 @@ function addTableExportJson() {}
|
|
|
825
840
|
|
|
826
841
|
function addTableJson(that, $grid, tableName, columns, success) {
|
|
827
842
|
if (
|
|
828
|
-
configUtil.tableConfig.disableTableName
|
|
829
|
-
settingConfig.tableStorageDisabled
|
|
843
|
+
configUtil.tableConfig.disableTableName
|
|
844
|
+
|| settingConfig.tableStorageDisabled
|
|
830
845
|
)
|
|
831
846
|
return false;
|
|
832
847
|
if (!tableName) return;
|
|
@@ -927,8 +942,8 @@ function initColumn(option, syncColumns) {
|
|
|
927
942
|
if (!oldColumn) return;
|
|
928
943
|
matchedOld.add(oldColumn);
|
|
929
944
|
if (!oldColumn.params) oldColumn.params = {};
|
|
930
|
-
const visibleSync
|
|
931
|
-
option.visibleSync !== false && oldColumn.visibleSync !== false;
|
|
945
|
+
const visibleSync
|
|
946
|
+
= option.visibleSync !== false && oldColumn.visibleSync !== false;
|
|
932
947
|
if (visibleSync) {
|
|
933
948
|
oldColumn.visible = syncColumn.visible;
|
|
934
949
|
}
|
|
@@ -952,9 +967,9 @@ function initColumn(option, syncColumns) {
|
|
|
952
967
|
return syncCol.field === newColumn.field;
|
|
953
968
|
});
|
|
954
969
|
if (
|
|
955
|
-
syncParentColumn
|
|
956
|
-
syncParentColumn.children
|
|
957
|
-
syncParentColumn.children.length > 0
|
|
970
|
+
syncParentColumn
|
|
971
|
+
&& syncParentColumn.children
|
|
972
|
+
&& syncParentColumn.children.length > 0
|
|
958
973
|
) {
|
|
959
974
|
// 递归处理 children
|
|
960
975
|
newColumn.children = initColumn(
|
|
@@ -1089,8 +1104,8 @@ function changeSelectCount(checked) {
|
|
|
1089
1104
|
|
|
1090
1105
|
function getTableData(that, tableRef, type, success) {
|
|
1091
1106
|
if (
|
|
1092
|
-
configUtil.tableConfig.disableTableName
|
|
1093
|
-
settingConfig.tableStorageDisabled
|
|
1107
|
+
configUtil.tableConfig.disableTableName
|
|
1108
|
+
|| settingConfig.tableStorageDisabled
|
|
1094
1109
|
)
|
|
1095
1110
|
return false;
|
|
1096
1111
|
let $grid = getGrid(that, tableRef);
|
|
@@ -1112,8 +1127,8 @@ function getTableData(that, tableRef, type, success) {
|
|
|
1112
1127
|
|
|
1113
1128
|
function addTableData(that, tableRef, value, success) {
|
|
1114
1129
|
if (
|
|
1115
|
-
configUtil.tableConfig.disableTableName
|
|
1116
|
-
settingConfig.tableStorageDisabled
|
|
1130
|
+
configUtil.tableConfig.disableTableName
|
|
1131
|
+
|| settingConfig.tableStorageDisabled
|
|
1117
1132
|
)
|
|
1118
1133
|
return false;
|
|
1119
1134
|
let $grid = getGrid(that, tableRef);
|