@opentinyvue/vue-grid 2.27.0 → 2.28.0
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/lib/index.js +494 -332
- package/package.json +17 -17
- package/src/composable/index.d.ts +1 -0
- package/src/composable/useNormalData.d.ts +7 -0
- package/src/table/src/methods.d.ts +15 -1
package/lib/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { Interceptor, StoreMap } from '@opentinyvue/vue-renderless/grid/core';
|
|
|
4
4
|
import { throttle, addClass, removeClass, debounce, PopupManager, PopperJS, extend, browserInfo, isObject, isEmptyObject, isServer, getDataset, random, isNull, getActualTarget, fastdom, toDecimal, logger, tryToCurrency, tryToDecimal, tryToInt, toFileSize, truncate, toRate, isNumber as isNumber$1, toBoolValue, on, toDate, getDateWithNewTimezone, isDate, formatDateByPattern, toDateStr, off, Validator as Validator$1, getObj, getStyle, preventDefault, callInterceptor, hasClass } from '@opentinyvue/utils';
|
|
5
5
|
import { iconError, iconSortTriangleDescending, iconSortTriangleAscending, iconSortTriangle, iconUnfilter, iconEdit, iconConmentRefresh, iconMinscreen, iconFullscreen, iconSetting, iconChevronRight, iconChevronDown, iconGridNoData, iconRadio, iconRadioselected, iconSearch, iconCheckedSur, iconCheck, iconHalfselect, iconArrowBottom, IconEllipsis, iconClose, iconYes, iconExpand, iconPutAway, iconEllipsis, iconMarkOn } from '@opentinyvue/vue-icon';
|
|
6
6
|
import { $prefix, hooks, defineComponent, h, $install, isVue2, isVnode, $props, mergeClass, resolveTheme, useInstanceSlots, useRelation, emitter, resolveMode, useBreakpoint, setup as setup$1 } from '@opentinyvue/vue-common';
|
|
7
|
-
import { uniqueId, toNumber as toNumber$1, isBoolean, each, isObject as isObject$1, isFunction, isArray, findIndexOf, get, set, clone, clear, destructuring, mapTree, has, isUndefined, find as find$1,
|
|
8
|
-
import { emitEvent, getOffsetPos, getFuncText, getDomNode, getRowid, getEventTargetNode, isScale, hasChildrenList, getListeners, updateCellTitle, getFilters, getColumnConfig, formatText, getRowkey,
|
|
7
|
+
import { uniqueId, toNumber as toNumber$1, isBoolean, each, isObject as isObject$1, isFunction, isArray, findIndexOf, get, set, clone, clear, destructuring, mapTree, eachTree, has, isUndefined, isEqual, find as find$1, filterTree, arrayEach, isNumber, findTree as findTree$1, sum, template, assign, objectMap, sortBy, isString, remove, toStringJSON, toArray, arrayIndexOf } from '@opentinyvue/vue-renderless/grid/static/';
|
|
8
|
+
import { emitEvent, getOffsetPos, getFuncText, getDomNode, getRowid, getEventTargetNode, isScale, hasChildrenList, getListeners, updateCellTitle, getFilters, getColumnConfig, formatText, getRowkey, getRowUniqueId, setCellValue, getColumnList, repairFixed, rowToVisible, colToVisible, getCell, assemColumn, GlobalEvent, getCellValue, getClass, isPx, getRowNodes, getCellNodeIndex } from '@opentinyvue/vue-renderless/grid/utils';
|
|
9
9
|
import Tooltip$1 from '@opentinyvue/vue-tooltip';
|
|
10
10
|
import { toNumber, findTree, find, isEqual as isEqual$1, arrayEach as arrayEach$1 } from '@opentinyvue/vue-renderless/grid/static';
|
|
11
11
|
import { AutoTip } from '@opentinyvue/vue-directive';
|
|
@@ -1833,7 +1833,7 @@ var useData = function useData2(props) {
|
|
|
1833
1833
|
}], function(_ref15) {
|
|
1834
1834
|
_ref15[0]; var length = _ref15[1];
|
|
1835
1835
|
tiledLength.value = length;
|
|
1836
|
-
$table
|
|
1836
|
+
$table.updateRawData(props.data);
|
|
1837
1837
|
});
|
|
1838
1838
|
return {
|
|
1839
1839
|
tiledLength
|
|
@@ -1856,7 +1856,7 @@ var calcHeader = function calcHeader2(collectColumn2) {
|
|
|
1856
1856
|
levelMap.set(item, level);
|
|
1857
1857
|
_traverseTree(item.children, level + 1, item);
|
|
1858
1858
|
});
|
|
1859
|
-
} else {
|
|
1859
|
+
} else if (parent) {
|
|
1860
1860
|
leafColumns.push(parent);
|
|
1861
1861
|
}
|
|
1862
1862
|
};
|
|
@@ -1942,12 +1942,12 @@ var useHeader = function useHeader2(props, bodyVm, headerRowHeight) {
|
|
|
1942
1942
|
};
|
|
1943
1943
|
};
|
|
1944
1944
|
var getEventSource = function getEventSource2(e, $table) {
|
|
1945
|
-
var _tableEl$dataset, _$table$getColumnNode, _rowEl$dataset,
|
|
1945
|
+
var _tableEl$dataset, _$table$getColumnNode, _rowEl$dataset, _rowid;
|
|
1946
1946
|
var target = e.target;
|
|
1947
1947
|
var tableEl = target.closest(".tiny-grid__body");
|
|
1948
1948
|
if (((_tableEl$dataset = tableEl.dataset) == null ? void 0 : _tableEl$dataset.tableid) !== String($table.id)) return;
|
|
1949
1949
|
var cellEl = target.closest(".tiny-grid-header__column");
|
|
1950
|
-
var rowEl, part, rowType, row2, column;
|
|
1950
|
+
var rowEl, part, rowType, row2, column, rowid2;
|
|
1951
1951
|
if (cellEl) {
|
|
1952
1952
|
rowEl = cellEl.parentNode;
|
|
1953
1953
|
part = "header";
|
|
@@ -1960,12 +1960,17 @@ var getEventSource = function getEventSource2(e, $table) {
|
|
|
1960
1960
|
}
|
|
1961
1961
|
if (!part || !cellEl || !rowEl) return;
|
|
1962
1962
|
column = (_$table$getColumnNode = $table.getColumnNode(cellEl)) == null ? void 0 : _$table$getColumnNode.item;
|
|
1963
|
-
|
|
1963
|
+
rowid2 = (_rowEl$dataset = rowEl.dataset) == null ? void 0 : _rowEl$dataset.rowid;
|
|
1964
|
+
if ((_rowid = rowid2) != null && _rowid.startsWith("row_g_")) {
|
|
1964
1965
|
rowType = "virtual";
|
|
1965
1966
|
} else if (part === "body") {
|
|
1966
|
-
var _$table$getRowNode;
|
|
1967
1967
|
rowType = "normal";
|
|
1968
|
-
|
|
1968
|
+
if ($table.editStore.insertMap.has(rowid2)) {
|
|
1969
|
+
row2 = $table.editStore.insertMap.get(rowid2);
|
|
1970
|
+
} else {
|
|
1971
|
+
var _$table$getRowNode;
|
|
1972
|
+
row2 = (_$table$getRowNode = $table.getRowNode(rowEl)) == null ? void 0 : _$table$getRowNode.item;
|
|
1973
|
+
}
|
|
1969
1974
|
}
|
|
1970
1975
|
return {
|
|
1971
1976
|
part,
|
|
@@ -2544,6 +2549,69 @@ var adjustColspan = function adjustColspan2(table, pos, isLeft) {
|
|
|
2544
2549
|
}
|
|
2545
2550
|
}
|
|
2546
2551
|
};
|
|
2552
|
+
var useNormalData = function useNormalData2(_ref34) {
|
|
2553
|
+
var _hooks$getCurrentInst4;
|
|
2554
|
+
var props = _ref34.props, tableFullColumn = _ref34.tableFullColumn;
|
|
2555
|
+
var $table = (_hooks$getCurrentInst4 = hooks.getCurrentInstance()) == null ? void 0 : _hooks$getCurrentInst4.proxy;
|
|
2556
|
+
var rawData = hooks.ref([]);
|
|
2557
|
+
var rawDataVersion = hooks.ref(0);
|
|
2558
|
+
var editorColumns = hooks.ref([]);
|
|
2559
|
+
var editorColumnKey = hooks.ref("");
|
|
2560
|
+
hooks.watch(tableFullColumn, function(_tableFullColumn) {
|
|
2561
|
+
var columns2 = [];
|
|
2562
|
+
var columnKeys = [];
|
|
2563
|
+
for (var i = 0; i < _tableFullColumn.length; i++) {
|
|
2564
|
+
var column = _tableFullColumn[i];
|
|
2565
|
+
if (column.property && column.editor) {
|
|
2566
|
+
columns2.push(column);
|
|
2567
|
+
columnKeys.push(column.propety);
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
var keyString = columnKeys.sort().join();
|
|
2571
|
+
if (editorColumnKey.value !== keyString) {
|
|
2572
|
+
editorColumnKey.value = keyString;
|
|
2573
|
+
editorColumns.value = columns2;
|
|
2574
|
+
}
|
|
2575
|
+
});
|
|
2576
|
+
hooks.watch(editorColumns, function(_editorColumns) {
|
|
2577
|
+
if (props.editConfig && _editorColumns.length > 0) {
|
|
2578
|
+
var _insertData = $table.editStore.insertList || [];
|
|
2579
|
+
var _rawData = rawData.value || [];
|
|
2580
|
+
var _data = [].concat(_insertData, _rawData);
|
|
2581
|
+
if (Array.isArray(_data)) {
|
|
2582
|
+
_data.forEach(function(row2) {
|
|
2583
|
+
return $table.defineField(row2, false, _editorColumns, true);
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
});
|
|
2588
|
+
hooks.watch(rawData, function(_rawData) {
|
|
2589
|
+
var _editorColumns = editorColumns.value;
|
|
2590
|
+
if (props.editConfig && _editorColumns.length > 0) {
|
|
2591
|
+
var _data = _rawData || [];
|
|
2592
|
+
if (Array.isArray(_data)) {
|
|
2593
|
+
_data.forEach(function(row2) {
|
|
2594
|
+
return $table.defineField(row2, false, _editorColumns);
|
|
2595
|
+
});
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
rawDataVersion.value += 1;
|
|
2599
|
+
});
|
|
2600
|
+
hooks.watch(rawDataVersion, function() {
|
|
2601
|
+
var optimizeOpts = $table.optimizeOpts;
|
|
2602
|
+
var scrollY = optimizeOpts.scrollY;
|
|
2603
|
+
var _rawData = rawData.value || [];
|
|
2604
|
+
var tableFullData = Array.isArray(_rawData) ? _rawData.slice(0) : [];
|
|
2605
|
+
$table.tableFullData = tableFullData;
|
|
2606
|
+
$table.scrollYLoad = scrollY && scrollY.gt > 0 && scrollY.gt <= tableFullData.length;
|
|
2607
|
+
$table.updateCache(true, props.saveSource === "deep");
|
|
2608
|
+
$table.handleDataChange();
|
|
2609
|
+
});
|
|
2610
|
+
return {
|
|
2611
|
+
rawData,
|
|
2612
|
+
rawDataVersion
|
|
2613
|
+
};
|
|
2614
|
+
};
|
|
2547
2615
|
var toRaw = hooks.toRaw;
|
|
2548
2616
|
var VIRTUAL_ROW_KEY = "_$virtual_";
|
|
2549
2617
|
var difference$1 = function difference$12(arr, other) {
|
|
@@ -2643,7 +2711,7 @@ var orderingGroupBy = function orderingGroupBy2(arr, key, equals, active, rowKey
|
|
|
2643
2711
|
};
|
|
2644
2712
|
var buildRowGroupFullData = function buildRowGroupFullData2(fullData, _vm) {
|
|
2645
2713
|
var treeConfig = _vm.treeConfig, rowGroup = _vm.rowGroup;
|
|
2646
|
-
var
|
|
2714
|
+
var _ref35 = rowGroup || {}, field = _ref35.field, equals = _ref35.equals, activeMethod = _ref35.activeMethod;
|
|
2647
2715
|
_vm.hasVirtualRow = !treeConfig && rowGroup && field && fullData.length > 0;
|
|
2648
2716
|
if (_vm.hasVirtualRow) {
|
|
2649
2717
|
_vm.groupFullData = orderingGroupBy(fullData, field, equals || isEqual$1, activeMethod, getRowkey(_vm));
|
|
@@ -2667,14 +2735,14 @@ var handleRowGroupFold = function handleRowGroupFold2(row2, _vm) {
|
|
|
2667
2735
|
buildRenderGraph(_vm);
|
|
2668
2736
|
_vm.handleTableData().then(_vm.recalculate);
|
|
2669
2737
|
};
|
|
2670
|
-
var getFixedStyle = function getFixedStyle2(
|
|
2671
|
-
var fixedDetails =
|
|
2672
|
-
var overflowX =
|
|
2738
|
+
var getFixedStyle = function getFixedStyle2(_ref36, _ref37) {
|
|
2739
|
+
var fixedDetails = _ref36.fixedDetails;
|
|
2740
|
+
var overflowX = _ref37.overflowX;
|
|
2673
2741
|
return fixedDetails && overflowX ? fixedDetails.getStyle() : {};
|
|
2674
2742
|
};
|
|
2675
|
-
var getFixedClass = function getFixedClass2(
|
|
2676
|
-
var fixedDetails =
|
|
2677
|
-
var overflowX =
|
|
2743
|
+
var getFixedClass = function getFixedClass2(_ref38, _ref39) {
|
|
2744
|
+
var fixedDetails = _ref38.fixedDetails;
|
|
2745
|
+
var overflowX = _ref39.overflowX;
|
|
2678
2746
|
return _extends({
|
|
2679
2747
|
"fixed__column": fixedDetails && overflowX
|
|
2680
2748
|
}, fixedDetails && overflowX ? fixedDetails.getClass() : {});
|
|
@@ -2801,21 +2869,21 @@ var renderBorder = function renderBorder2(type) {
|
|
|
2801
2869
|
"class": "tiny-grid-border-left"
|
|
2802
2870
|
})]);
|
|
2803
2871
|
};
|
|
2804
|
-
function renderColumn(
|
|
2805
|
-
var _normalRows$rowid,
|
|
2806
|
-
var $columnIndex =
|
|
2872
|
+
function renderColumn(_ref40) {
|
|
2873
|
+
var _normalRows$rowid, _ref42;
|
|
2874
|
+
var $columnIndex = _ref40.$columnIndex, $table = _ref40.$table, _vm = _ref40._vm, column = _ref40.column, id3 = _ref40.id, row2 = _ref40.row, rowid2 = _ref40.rowid, seq = _ref40.seq, used = _ref40.used;
|
|
2807
2875
|
var allAlign = $table.align, cellClassName = $table.cellClassName, _$table$dropConfig = $table.dropConfig, dropConfig = _$table$dropConfig === void 0 ? {} : _$table$dropConfig, editConfig = $table.editConfig, editRules = $table.editRules, editStore = $table.editStore;
|
|
2808
2876
|
var height2 = $table.height, rowId = $table.rowId, scrollXLoad = $table.scrollXLoad, scrollYLoad = $table.scrollYLoad, validOpts2 = $table.validOpts, validStore = $table.validStore, validatedMap = $table.validatedMap;
|
|
2809
2877
|
var normalRows = _vm.normalRows;
|
|
2810
|
-
var
|
|
2878
|
+
var _ref41 = ((_normalRows$rowid = normalRows[rowid2]) == null ? void 0 : _normalRows$rowid[column.id]) || {}, _ref41$attrs = _ref41.attrs, attrs = _ref41$attrs === void 0 ? {
|
|
2811
2879
|
rowspan: 1,
|
|
2812
2880
|
colspan: 1,
|
|
2813
2881
|
visible: true
|
|
2814
|
-
} :
|
|
2882
|
+
} : _ref41$attrs, _ref41$params = _ref41.params, params = _ref41$params === void 0 ? {
|
|
2815
2883
|
$table,
|
|
2816
2884
|
row: row2,
|
|
2817
2885
|
column
|
|
2818
|
-
} :
|
|
2886
|
+
} : _ref41$params;
|
|
2819
2887
|
var isMessageDefault = validOpts2.isMessageDefault, isMessageInline = validOpts2.isMessageInline, highlightError = validOpts2.highlightError;
|
|
2820
2888
|
var actived = editStore.actived;
|
|
2821
2889
|
var validated = validatedMap[column.id + "-" + row2[rowId]];
|
|
@@ -2845,7 +2913,7 @@ function renderColumn(_ref39) {
|
|
|
2845
2913
|
"rowspan": attrs.rowspan > 1 ? attrs.rowspan : void 0,
|
|
2846
2914
|
"colspan": attrs.colspan > 1 ? attrs.colspan : void 0
|
|
2847
2915
|
},
|
|
2848
|
-
"class": ["tiny-grid-body__column", column.id, (
|
|
2916
|
+
"class": ["tiny-grid-body__column", column.id, (_ref42 = {}, _ref42["col__" + cellAlign] = cellAlign, _ref42["col__edit"] = editor, _ref42["col__index"] = column.type === "index", _ref42["col__radio"] = column.type === "radio", _ref42["col__selection"] = column.type === "selection", _ref42["col__ellipsis"] = cellOverflowHint, _ref42["edit__visible"] = editor && editor.type === "visible", _ref42["col__dirty"] = isDirty, _ref42["col__actived"] = columnActived, _ref42["col__highlight-error"] = highlightError && validated, _ref42["col__valid-error"] = validError && validated, _ref42["col__valid-success"] = columnActived ? !validError && !validated : isDirty && !validated, _ref42["col__treenode"] = column.treeNode, _ref42), getClass(className, params), getClass(cellClassName, params), getFixedClass(column, $table), attrs._stickyClass || ""]
|
|
2849
2917
|
}, [[
|
|
2850
2918
|
// 行拖拽手柄
|
|
2851
2919
|
dropConfig.rowHandle === "index" && column.type === "index" ? h("div", {
|
|
@@ -2892,9 +2960,9 @@ function renderHeaderRows(_vm) {
|
|
|
2892
2960
|
$table,
|
|
2893
2961
|
$rowIndex
|
|
2894
2962
|
}) : headerRowClassName : ""]
|
|
2895
|
-
}, [cols.map(function(
|
|
2896
|
-
var _column$children,
|
|
2897
|
-
var id3 =
|
|
2963
|
+
}, [cols.map(function(_ref43, $columnIndex) {
|
|
2964
|
+
var _column$children, _ref44;
|
|
2965
|
+
var id3 = _ref43.id, column = _ref43.column, colspan = _ref43.colspan, rowspan = _ref43.rowspan, height2 = _ref43.height, top = _ref43.top;
|
|
2898
2966
|
var isColGroup = (_column$children = column.children) == null ? void 0 : _column$children.length;
|
|
2899
2967
|
var headerAlign = column.headerAlign, align = column.align, headerClassName = column.headerClassName;
|
|
2900
2968
|
var _getConfigOverflow3 = getConfigOverflow(column, $table), headerTip = _getConfigOverflow3.headerTip, headerOverflowTitle = _getConfigOverflow3.headerOverflowTitle, headerOverflowTooltip = _getConfigOverflow3.headerOverflowTooltip, headerOverflowEllipsis = _getConfigOverflow3.headerOverflowEllipsis, headerOverflowHint = _getConfigOverflow3.headerOverflowHint;
|
|
@@ -2925,7 +2993,7 @@ function renderHeaderRows(_vm) {
|
|
|
2925
2993
|
top: top + "px",
|
|
2926
2994
|
zIndex: column.fixed ? 20 : 10
|
|
2927
2995
|
}],
|
|
2928
|
-
"class": ["tiny-grid-header__column", column.id, (
|
|
2996
|
+
"class": ["tiny-grid-header__column", column.id, (_ref44 = {}, _ref44["col__" + headAlign] = headAlign, _ref44["col__fixed"] = column.fixed, _ref44["col__index"] = column.type === "index", _ref44["col__radio"] = column.type === "radio", _ref44["col__selection"] = column.type === "selection", _ref44["col__group"] = isColGroup, _ref44["col__ellipsis"] = headerOverflowHint, _ref44["is__sortable"] = !["index", "radio", "selection"].includes(column.type) && column.sortable, _ref44["is__editable"] = column.editor, _ref44["is__filter"] = isObject(column.filter), _ref44["filter__active"] = column.filter && column.filter.hasFilter, _ref44["is__multilevel"] = rowspan > 1, _ref44), getClass(headerClassName, params), getClass(headerCellClassName, params), getFixedClass(column, $table)]
|
|
2929
2997
|
}, [[
|
|
2930
2998
|
!isColGroup && !(isBoolean(column.resizable) ? column.resizable : resizable) && column.type !== "index" ? h("div", {
|
|
2931
2999
|
"class": {
|
|
@@ -2981,20 +3049,20 @@ function renderFooterRows(_vm) {
|
|
|
2981
3049
|
$table,
|
|
2982
3050
|
$rowIndex
|
|
2983
3051
|
}) : footerRowClassName : ""]
|
|
2984
|
-
}, [columnPool.map(function(
|
|
2985
|
-
var _footerRows$$rowIndex,
|
|
2986
|
-
var id3 =
|
|
3052
|
+
}, [columnPool.map(function(_ref45, $columnIndex) {
|
|
3053
|
+
var _footerRows$$rowIndex, _ref47;
|
|
3054
|
+
var id3 = _ref45.id, column = _ref45.item, used = _ref45.used;
|
|
2987
3055
|
var footerAlign = column.footerAlign, align = column.align, footerClassName = column.footerClassName;
|
|
2988
3056
|
var ftAlign = footerAlign || align || allFooterAlign || allAlign;
|
|
2989
3057
|
var _getConfigOverflow4 = getConfigOverflow(column, $table), cellOverflowHint = _getConfigOverflow4.cellOverflowHint;
|
|
2990
|
-
var
|
|
3058
|
+
var _ref46 = ((_footerRows$$rowIndex = footerRows[$rowIndex]) == null ? void 0 : _footerRows$$rowIndex[column.id]) || {}, _ref46$attrs = _ref46.attrs, attrs = _ref46$attrs === void 0 ? {
|
|
2991
3059
|
rowspan: 1,
|
|
2992
3060
|
colspan: 1,
|
|
2993
3061
|
visible: true
|
|
2994
|
-
} :
|
|
3062
|
+
} : _ref46$attrs, _ref46$params = _ref46.params, params = _ref46$params === void 0 ? {
|
|
2995
3063
|
$table,
|
|
2996
3064
|
column
|
|
2997
|
-
} :
|
|
3065
|
+
} : _ref46$params;
|
|
2998
3066
|
var rowspan = (attrs == null ? void 0 : attrs.rowspan) || 1;
|
|
2999
3067
|
var tdBottom = trBottom - (rowspan > 1 ? (rowspan - 1) * rowHeight : 0);
|
|
3000
3068
|
params.$columnIndex = $columnIndex;
|
|
@@ -3011,7 +3079,7 @@ function renderFooterRows(_vm) {
|
|
|
3011
3079
|
zIndex: column.fixed ? 20 : 10,
|
|
3012
3080
|
display: used && attrs.visible ? void 0 : "none"
|
|
3013
3081
|
}],
|
|
3014
|
-
"class": ["tiny-grid-footer__column", column.id, (
|
|
3082
|
+
"class": ["tiny-grid-footer__column", column.id, (_ref47 = {}, _ref47["col__" + ftAlign] = ftAlign, _ref47["col__ellipsis"] = cellOverflowHint, _ref47["filter__active"] = column.filter && column.filter.hasFilter, _ref47), getClass(footerClassName, params), getClass(footerCellClassName, params), getFixedClass(column, $table), attrs._stickyClass || ""]
|
|
3015
3083
|
}, [h("div", {
|
|
3016
3084
|
"class": {
|
|
3017
3085
|
"tiny-grid-cell": true,
|
|
@@ -3028,17 +3096,13 @@ function renderRows(_vm) {
|
|
|
3028
3096
|
var expandMethod = expandConfig.activeMethod;
|
|
3029
3097
|
var startIndex = scrollYStore.startIndex;
|
|
3030
3098
|
var isOrdered = treeConfig ? !!treeOrdered : false;
|
|
3031
|
-
var
|
|
3099
|
+
var _ref48 = treeConfig || {}, hideMethod = _ref48.hideMethod;
|
|
3032
3100
|
var actived = editStore.actived;
|
|
3033
3101
|
var rows = [];
|
|
3034
3102
|
var seqCount = {
|
|
3035
3103
|
value: 0
|
|
3036
3104
|
};
|
|
3037
3105
|
var $seq = "";
|
|
3038
|
-
var lastVisibleIndex = rowPool.findLastIndex(function(_ref48) {
|
|
3039
|
-
var used = _ref48.used;
|
|
3040
|
-
return Boolean(used);
|
|
3041
|
-
});
|
|
3042
3106
|
rowPool.forEach(function(_ref49, $rowIndex) {
|
|
3043
3107
|
var id3 = _ref49.id, _ref49$item = _ref49.item, row2 = _ref49$item.payload, rowLevel = _ref49$item.level, used = _ref49.used;
|
|
3044
3108
|
var rowActived = editConfig && actived.row === row2;
|
|
@@ -3077,8 +3141,7 @@ function renderRows(_vm) {
|
|
|
3077
3141
|
isSkipRowRender,
|
|
3078
3142
|
row: row2,
|
|
3079
3143
|
rowActived,
|
|
3080
|
-
rowClassName
|
|
3081
|
-
lastVisibleIndex
|
|
3144
|
+
rowClassName
|
|
3082
3145
|
};
|
|
3083
3146
|
Object.assign(args, {
|
|
3084
3147
|
rowIndex,
|
|
@@ -3177,7 +3240,7 @@ function renderRowAfter(_ref50) {
|
|
|
3177
3240
|
function renderRow(args) {
|
|
3178
3241
|
var _ref51;
|
|
3179
3242
|
var $rowIndex = args.$rowIndex, $seq = args.$seq, $table = args.$table, _vm = args._vm, editStore = args.editStore, id3 = args.id, isSkipRowRender = args.isSkipRowRender, row2 = args.row, rowActived = args.rowActived, rowClassName = args.rowClassName;
|
|
3180
|
-
var rowIndex = args.rowIndex, rowLevel = args.rowLevel, rowid2 = args.rowid, rows = args.rows, selection = args.selection, selectRow = args.selectRow, seq = args.seq, treeConfig = args.treeConfig, used = args.used
|
|
3243
|
+
var rowIndex = args.rowIndex, rowLevel = args.rowLevel, rowid2 = args.rowid, rows = args.rows, selection = args.selection, selectRow = args.selectRow, seq = args.seq, treeConfig = args.treeConfig, used = args.used;
|
|
3181
3244
|
if (isSkipRowRender) {
|
|
3182
3245
|
return;
|
|
3183
3246
|
}
|
|
@@ -3201,7 +3264,7 @@ function renderRow(args) {
|
|
|
3201
3264
|
"style": {
|
|
3202
3265
|
display: used ? void 0 : "none"
|
|
3203
3266
|
},
|
|
3204
|
-
"class": ["tiny-grid-body__row", (_ref51 = {}, _ref51["row__level-" + rowLevel] = treeConfig, _ref51["row__new"] = editStore.insertList.includes(row2), _ref51["row__selected"] = selection.includes(row2), _ref51["row__radio"] = selectRow === row2, _ref51["row__actived"] = rowActived, _ref51
|
|
3267
|
+
"class": ["tiny-grid-body__row", (_ref51 = {}, _ref51["row__level-" + rowLevel] = treeConfig, _ref51["row__new"] = editStore.insertList.includes(row2), _ref51["row__selected"] = selection.includes(row2), _ref51["row__radio"] = selectRow === row2, _ref51["row__actived"] = rowActived, _ref51), rowClassName ? isFunction(rowClassName) ? rowClassName({
|
|
3205
3268
|
$table,
|
|
3206
3269
|
$seq,
|
|
3207
3270
|
seq,
|
|
@@ -3440,9 +3503,9 @@ var Body = defineComponent({
|
|
|
3440
3503
|
footerData: Array
|
|
3441
3504
|
},
|
|
3442
3505
|
setup: function setup3(props, _ref57) {
|
|
3443
|
-
var _hooks$
|
|
3506
|
+
var _hooks$getCurrentInst5;
|
|
3444
3507
|
var slots = _ref57.slots;
|
|
3445
|
-
var vm = (_hooks$
|
|
3508
|
+
var vm = (_hooks$getCurrentInst5 = hooks.getCurrentInstance()) == null ? void 0 : _hooks$getCurrentInst5.proxy;
|
|
3446
3509
|
var $table = vm == null ? void 0 : vm.$parent;
|
|
3447
3510
|
var rowHeight = hooks.computed(function() {
|
|
3448
3511
|
return $table.rowHeight;
|
|
@@ -3595,8 +3658,6 @@ var Body = defineComponent({
|
|
|
3595
3658
|
"no-data": isNoData && $table.isShapeTable
|
|
3596
3659
|
},
|
|
3597
3660
|
"style": {
|
|
3598
|
-
"--body-container-scroll-height": containerScrollHeight + "px",
|
|
3599
|
-
"--body-container-scroll-width": containerScrollWidth + "px",
|
|
3600
3661
|
height: bodyWrapperHeight ? bodyWrapperHeight + "px" : void 0,
|
|
3601
3662
|
minHeight: bodyWrapperMinHeight ? bodyWrapperMinHeight + "px" : void 0,
|
|
3602
3663
|
maxHeight: bodyWrapperMaxHeight ? bodyWrapperMaxHeight + "px" : void 0
|
|
@@ -7645,7 +7706,7 @@ var Methods$d = {
|
|
|
7645
7706
|
_this16.tableData = [];
|
|
7646
7707
|
_this16.cellStatus.clear();
|
|
7647
7708
|
_this16.clearValidateMap();
|
|
7648
|
-
return _this16.
|
|
7709
|
+
return _this16.updateRawData(data7 || _this16.tableFullData);
|
|
7649
7710
|
};
|
|
7650
7711
|
return this.$nextTick().then(next);
|
|
7651
7712
|
},
|
|
@@ -7697,18 +7758,10 @@ var Methods$d = {
|
|
|
7697
7758
|
// 全量加载表格数据
|
|
7698
7759
|
loadTableData: function loadTableData(datas, notRefresh) {
|
|
7699
7760
|
var _this18 = this;
|
|
7700
|
-
var editStore = this.editStore, height2 = this.height, maxHeight = this.maxHeight, lastScrollLeft = this.lastScrollLeft, lastScrollTop = this.lastScrollTop,
|
|
7701
|
-
var scrollY = optimizeOpts.scrollY;
|
|
7702
|
-
var tableFullData = isArray(datas) ? datas.slice(0) : [];
|
|
7703
|
-
var scrollYLoad = scrollY && scrollY.gt > 0 && scrollY.gt <= tableFullData.length;
|
|
7761
|
+
var editStore = this.editStore, height2 = this.height, maxHeight = this.maxHeight, lastScrollLeft = this.lastScrollLeft, lastScrollTop = this.lastScrollTop, scrollYLoad = this.scrollYLoad;
|
|
7704
7762
|
editStore.insertList = [];
|
|
7763
|
+
editStore.insertMap = /* @__PURE__ */ new Map();
|
|
7705
7764
|
editStore.removeList = [];
|
|
7706
|
-
Object.assign(this, {
|
|
7707
|
-
tableFullData,
|
|
7708
|
-
tableSynchData: datas,
|
|
7709
|
-
scrollYLoad
|
|
7710
|
-
});
|
|
7711
|
-
this.updateCache(true, true);
|
|
7712
7765
|
if (scrollYLoad && !(height2 || maxHeight)) {
|
|
7713
7766
|
error("ui.grid.error.scrollYHeight");
|
|
7714
7767
|
}
|
|
@@ -7724,31 +7777,51 @@ var Methods$d = {
|
|
|
7724
7777
|
lastScrollTop
|
|
7725
7778
|
});
|
|
7726
7779
|
}
|
|
7780
|
+
}).then(function() {
|
|
7781
|
+
var _this18$resolveMap$lo;
|
|
7782
|
+
if (((_this18$resolveMap$lo = _this18.resolveMap.loadDataResolve) == null ? void 0 : _this18$resolveMap$lo.data) === datas) {
|
|
7783
|
+
_this18.resolveMap.loadDataResolve.resolveQueue.forEach(function(resolve) {
|
|
7784
|
+
return resolve();
|
|
7785
|
+
});
|
|
7786
|
+
_this18.resolveMap.loadDataResolve = null;
|
|
7787
|
+
}
|
|
7727
7788
|
});
|
|
7728
7789
|
},
|
|
7729
7790
|
// 重新加载数据
|
|
7730
7791
|
reloadData: function reloadData(datas) {
|
|
7731
7792
|
var _this19 = this;
|
|
7732
7793
|
return this.clearAll().then(function() {
|
|
7733
|
-
return _this19.
|
|
7794
|
+
return _this19.updateRawData(datas);
|
|
7734
7795
|
});
|
|
7735
7796
|
},
|
|
7736
7797
|
// 加载全量数据
|
|
7737
7798
|
loadData: function loadData(datas) {
|
|
7738
7799
|
var _this20 = this;
|
|
7739
7800
|
return new Promise(function(resolve) {
|
|
7740
|
-
_this20.
|
|
7741
|
-
|
|
7801
|
+
_this20.updateRawData(datas);
|
|
7802
|
+
if (_this20.resolveMap.loadDataResolve) {
|
|
7803
|
+
_this20.resolveMap.loadDataResolve.data = datas;
|
|
7804
|
+
_this20.resolveMap.loadDataResolve.resolveQueue.push(resolve);
|
|
7805
|
+
} else {
|
|
7806
|
+
_this20.resolveMap.loadDataResolve = {
|
|
7807
|
+
data: datas,
|
|
7808
|
+
resolveQueue: [resolve]
|
|
7809
|
+
};
|
|
7810
|
+
}
|
|
7742
7811
|
});
|
|
7743
7812
|
},
|
|
7813
|
+
updateRawData: function updateRawData(datas) {
|
|
7814
|
+
this.rawData = datas;
|
|
7815
|
+
this.rawDataVersion += 1;
|
|
7816
|
+
},
|
|
7744
7817
|
getOriginRow: function getOriginRow(row2) {
|
|
7745
|
-
var
|
|
7746
|
-
return
|
|
7818
|
+
var rowid2 = getRowid(this, row2);
|
|
7819
|
+
return rowid2 ? this.rowidCacheMap.get(rowid2) : null;
|
|
7747
7820
|
},
|
|
7748
7821
|
setOriginRow: function setOriginRow(row2, record) {
|
|
7749
|
-
var
|
|
7750
|
-
if (
|
|
7751
|
-
|
|
7822
|
+
var rowid2 = getRowid(this, row2);
|
|
7823
|
+
if (rowid2 && record) {
|
|
7824
|
+
this.rowidCacheMap.set(rowid2, record);
|
|
7752
7825
|
}
|
|
7753
7826
|
},
|
|
7754
7827
|
reloadRow: function reloadRow(row2, record, field) {
|
|
@@ -7822,14 +7895,14 @@ var Methods$d = {
|
|
|
7822
7895
|
if (deepCopy === void 0) {
|
|
7823
7896
|
deepCopy = false;
|
|
7824
7897
|
}
|
|
7825
|
-
var tableFullData = this.tableFullData, treeConfig = this.treeConfig, treeOrdered = this.treeOrdered;
|
|
7898
|
+
var tableFullData = this.tableFullData, treeConfig = this.treeConfig, treeOrdered = this.treeOrdered, editConfig = this.editConfig, _this$saveSource = this.saveSource, saveSource = _this$saveSource === void 0 ? false : _this$saveSource;
|
|
7826
7899
|
var rowKey = getRowkey(this);
|
|
7827
7900
|
var _ref157 = treeConfig || {}, childrenKey = _ref157.children, _ref157$temporaryInde = _ref157.temporaryIndex, temporaryIndex = _ref157$temporaryInde === void 0 ? "_$index_" : _ref157$temporaryInde;
|
|
7828
7901
|
var isTreeOrderedFalse = treeConfig && !treeOrdered;
|
|
7829
|
-
var
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7902
|
+
var fullDataRowIdData = this.fullDataRowIdData = {};
|
|
7903
|
+
var fullDataRowMap = this.fullDataRowMap;
|
|
7904
|
+
fullDataRowMap.clear();
|
|
7905
|
+
eachTree(tableFullData, function(row2, index2, _array, _path, parent) {
|
|
7833
7906
|
var rowId = getRowid(_this23, row2);
|
|
7834
7907
|
if (!rowId) {
|
|
7835
7908
|
rowId = getRowUniqueId();
|
|
@@ -7840,31 +7913,78 @@ var Methods$d = {
|
|
|
7840
7913
|
rowid: rowId,
|
|
7841
7914
|
index: index2
|
|
7842
7915
|
};
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
set(row2, temporaryIndex, (parentIndex ? parentIndex + "." : "") + (index2 + 1));
|
|
7916
|
+
if (fullDataRowIdData[rowId]) {
|
|
7917
|
+
warn("ui.grid.error.duplicateRowId", rowId);
|
|
7918
|
+
}
|
|
7919
|
+
fullDataRowIdData[rowId] = rowCache;
|
|
7920
|
+
fullDataRowMap.set(_this23.getRaw(row2), rowCache);
|
|
7921
|
+
if (isTreeOrderedFalse) {
|
|
7922
|
+
var parentIndex;
|
|
7923
|
+
if (parent) {
|
|
7924
|
+
parentIndex = get(parent, temporaryIndex);
|
|
7853
7925
|
}
|
|
7854
|
-
|
|
7855
|
-
var backupRow = deepCopy ? clone(_extends({}, row2, childrenField), true) : _extends({}, row2, childrenField);
|
|
7856
|
-
backupMap.set(row2, backupRow);
|
|
7857
|
-
return backupRow;
|
|
7926
|
+
set(row2, temporaryIndex, (parentIndex ? parentIndex + "." : "") + (index2 + 1));
|
|
7858
7927
|
}
|
|
7859
|
-
};
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7928
|
+
}, treeConfig);
|
|
7929
|
+
if (backup && (editConfig || saveSource)) {
|
|
7930
|
+
requestIdleCallback(function() {
|
|
7931
|
+
var rowidCacheMap = /* @__PURE__ */ new Map();
|
|
7932
|
+
var callback = function callback2(row2) {
|
|
7933
|
+
var _extends6;
|
|
7934
|
+
return rowidCacheMap.set(getRowid(_this23, row2), clone(childrenKey ? _extends({}, row2, (_extends6 = {}, _extends6[childrenKey] = null, _extends6)) : _extends({}, row2), deepCopy));
|
|
7935
|
+
};
|
|
7936
|
+
eachTree(tableFullData, callback, treeConfig);
|
|
7937
|
+
_this23.rowidCacheMap = rowidCacheMap;
|
|
7865
7938
|
});
|
|
7866
7939
|
}
|
|
7867
7940
|
},
|
|
7941
|
+
getRaw: function getRaw(object) {
|
|
7942
|
+
var hooks_vue = hooks;
|
|
7943
|
+
return !isVue2 && hooks_vue.isProxy(object) ? hooks.toRaw(object) : object;
|
|
7944
|
+
},
|
|
7945
|
+
/**
|
|
7946
|
+
* 递归地将 Proxy 对象(如 Vue 3 的响应式对象)转换为普通对象。
|
|
7947
|
+
* @param {any} data 待处理的数据
|
|
7948
|
+
* @returns {any} 转换后的普通对象或原始数据
|
|
7949
|
+
*/
|
|
7950
|
+
deepUnwrap: function deepUnwrap(data7) {
|
|
7951
|
+
if (data7 === null || typeof data7 !== "object") {
|
|
7952
|
+
return data7;
|
|
7953
|
+
}
|
|
7954
|
+
if (data7 instanceof Map) {
|
|
7955
|
+
return this.cloneMapAndUnwrap(data7);
|
|
7956
|
+
}
|
|
7957
|
+
if (data7 instanceof Set) {
|
|
7958
|
+
return new Set(Array.from(data7).map(this.deepUnwrap));
|
|
7959
|
+
}
|
|
7960
|
+
if (Array.isArray(data7)) {
|
|
7961
|
+
return data7.map(this.deepUnwrap);
|
|
7962
|
+
}
|
|
7963
|
+
var result = {};
|
|
7964
|
+
for (var key in data7) {
|
|
7965
|
+
if (Object.prototype.hasOwnProperty.call(data7, key)) {
|
|
7966
|
+
result[key] = this.deepUnwrap(data7[key]);
|
|
7967
|
+
}
|
|
7968
|
+
}
|
|
7969
|
+
return result;
|
|
7970
|
+
},
|
|
7971
|
+
/**
|
|
7972
|
+
* 复制 Map,并递归地将 Map 的值中包含的 Proxy 转换为普通对象。
|
|
7973
|
+
* @param {Map<any, any>} originalMap 原始 Map
|
|
7974
|
+
* @returns {Map<any, any>} 复制并解包后的新 Map
|
|
7975
|
+
*/
|
|
7976
|
+
cloneMapAndUnwrap: function cloneMapAndUnwrap(originalMap) {
|
|
7977
|
+
if (!(originalMap instanceof Map)) {
|
|
7978
|
+
return originalMap;
|
|
7979
|
+
}
|
|
7980
|
+
var newMap = /* @__PURE__ */ new Map();
|
|
7981
|
+
for (var _iterator0 = _createForOfIteratorHelperLoose(originalMap.entries()), _step0; !(_step0 = _iterator0()).done; ) {
|
|
7982
|
+
var _step0$value = _step0.value, key = _step0$value[0], value = _step0$value[1];
|
|
7983
|
+
var unwrappedValue = this.deepUnwrap(value);
|
|
7984
|
+
newMap.set(key, unwrappedValue);
|
|
7985
|
+
}
|
|
7986
|
+
return newMap;
|
|
7987
|
+
},
|
|
7868
7988
|
// 更新列的 Map
|
|
7869
7989
|
cacheColumnMap: function cacheColumnMap(options) {
|
|
7870
7990
|
var fullColumnMap = this.fullColumnMap;
|
|
@@ -7892,9 +8012,7 @@ var Methods$d = {
|
|
|
7892
8012
|
return null;
|
|
7893
8013
|
},
|
|
7894
8014
|
getColumnNode: function getColumnNode(cell) {
|
|
7895
|
-
if (!cell)
|
|
7896
|
-
return null;
|
|
7897
|
-
}
|
|
8015
|
+
if (!cell) return null;
|
|
7898
8016
|
var fullColumnIdData = this.fullColumnIdData, tableFullColumn = this.tableFullColumn;
|
|
7899
8017
|
var dataColid = cell.dataset.colid;
|
|
7900
8018
|
var colCache = fullColumnIdData[dataColid];
|
|
@@ -7908,31 +8026,41 @@ var Methods$d = {
|
|
|
7908
8026
|
return null;
|
|
7909
8027
|
},
|
|
7910
8028
|
getRowIndex: function getRowIndex(row2) {
|
|
7911
|
-
var rawRow = hooks.toRaw(row2);
|
|
7912
8029
|
var fullDataRowMap = this.fullDataRowMap;
|
|
7913
|
-
|
|
8030
|
+
row2 = this.getRaw(row2);
|
|
8031
|
+
return fullDataRowMap.has(row2) ? fullDataRowMap.get(row2).index : -1;
|
|
7914
8032
|
},
|
|
7915
8033
|
getColumnIndex: function getColumnIndex(column) {
|
|
7916
8034
|
var fullColumnMap = this.fullColumnMap;
|
|
7917
|
-
return fullColumnMap.has(column) ? fullColumnMap.get(column).
|
|
8035
|
+
return fullColumnMap.has(column) ? fullColumnMap.get(column).columnIndex : -1;
|
|
7918
8036
|
},
|
|
7919
8037
|
hasIndexColumn: function hasIndexColumn(column) {
|
|
7920
8038
|
return (column == null ? void 0 : column.type) === "index";
|
|
7921
8039
|
},
|
|
7922
|
-
defineField: function defineField(row2, copy) {
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
}
|
|
8040
|
+
defineField: function defineField(row2, copy, editorColumns, cache) {
|
|
8041
|
+
var _this24 = this;
|
|
8042
|
+
if (!row2 || typeof row2 !== "object") return row2;
|
|
7926
8043
|
if (copy) {
|
|
7927
8044
|
row2 = clone(row2, true);
|
|
7928
8045
|
}
|
|
7929
8046
|
var rowKey = getRowkey(this);
|
|
7930
|
-
this.visibleColumn
|
|
7931
|
-
|
|
8047
|
+
var columns2 = editorColumns || this.visibleColumn;
|
|
8048
|
+
columns2.forEach(function(column) {
|
|
8049
|
+
var property = column.property, editor = column.editor;
|
|
7932
8050
|
var propNotExist = property && !has(row2, property);
|
|
7933
8051
|
var propDefaultValue = editor && !isUndefined(editor.defaultValue) ? editor.defaultValue : null;
|
|
7934
8052
|
if (propNotExist) {
|
|
7935
|
-
|
|
8053
|
+
if (cache) {
|
|
8054
|
+
var originRow = _this24.getOriginRow(row2);
|
|
8055
|
+
if (originRow) {
|
|
8056
|
+
originRow[property] = propDefaultValue;
|
|
8057
|
+
}
|
|
8058
|
+
}
|
|
8059
|
+
if (isVue2) {
|
|
8060
|
+
_this24.$set(row2, property, propDefaultValue);
|
|
8061
|
+
} else {
|
|
8062
|
+
set(row2, property, propDefaultValue);
|
|
8063
|
+
}
|
|
7936
8064
|
}
|
|
7937
8065
|
});
|
|
7938
8066
|
var rowId = get(row2, rowKey);
|
|
@@ -7942,11 +8070,8 @@ var Methods$d = {
|
|
|
7942
8070
|
return row2;
|
|
7943
8071
|
},
|
|
7944
8072
|
isTemporaryRow: function isTemporaryRow(row2) {
|
|
7945
|
-
var _this24 = this;
|
|
7946
8073
|
var rowid2 = getRowid(this, row2);
|
|
7947
|
-
return
|
|
7948
|
-
return rowid2 === getRowid(_this24, r);
|
|
7949
|
-
});
|
|
8074
|
+
return this.editStore.insertMap.has(rowid2);
|
|
7950
8075
|
},
|
|
7951
8076
|
createData: function createData(records, copy) {
|
|
7952
8077
|
var _this25 = this;
|
|
@@ -7986,7 +8111,7 @@ var Methods$d = {
|
|
|
7986
8111
|
return this.$nextTick();
|
|
7987
8112
|
},
|
|
7988
8113
|
hasRowInsert: function hasRowInsert(row2) {
|
|
7989
|
-
return this.
|
|
8114
|
+
return this.isTemporaryRow(row2);
|
|
7990
8115
|
},
|
|
7991
8116
|
compareRow: function compareRow(row2, originalRow, field) {
|
|
7992
8117
|
var value = get(row2, field);
|
|
@@ -8012,20 +8137,20 @@ var Methods$d = {
|
|
|
8012
8137
|
},
|
|
8013
8138
|
hasRowChange: function hasRowChange(row2, field) {
|
|
8014
8139
|
var _editConfig$insertCha;
|
|
8015
|
-
var treeConfig = this.treeConfig, visibleColumn = this.visibleColumn,
|
|
8140
|
+
var treeConfig = this.treeConfig, visibleColumn = this.visibleColumn, _this$editConfig2 = this.editConfig, editConfig = _this$editConfig2 === void 0 ? {} : _this$editConfig2;
|
|
8016
8141
|
var insertChanged = (_editConfig$insertCha = editConfig == null ? void 0 : editConfig.insertChanged) != null ? _editConfig$insertCha : false;
|
|
8017
8142
|
var argsLength = arguments.length;
|
|
8018
8143
|
var originRow;
|
|
8019
8144
|
if (this.isTemporaryRow(row2)) {
|
|
8020
8145
|
return insertChanged;
|
|
8021
8146
|
}
|
|
8022
|
-
var cacheRow =
|
|
8147
|
+
var cacheRow = this.getOriginRow(row2);
|
|
8023
8148
|
if (cacheRow) {
|
|
8024
8149
|
if (treeConfig) {
|
|
8025
|
-
var
|
|
8150
|
+
var _extends7, _extends8;
|
|
8026
8151
|
var children = treeConfig.children;
|
|
8027
|
-
row2 = _extends({}, row2, (
|
|
8028
|
-
originRow = _extends({}, cacheRow, (
|
|
8152
|
+
row2 = _extends({}, row2, (_extends7 = {}, _extends7[children] = null, _extends7));
|
|
8153
|
+
originRow = _extends({}, cacheRow, (_extends8 = {}, _extends8[children] = null, _extends8));
|
|
8029
8154
|
} else {
|
|
8030
8155
|
originRow = _extends({}, cacheRow);
|
|
8031
8156
|
}
|
|
@@ -8072,7 +8197,7 @@ var Methods$d = {
|
|
|
8072
8197
|
},
|
|
8073
8198
|
// 获取表格所有数据
|
|
8074
8199
|
getData: function getData(rowIndex) {
|
|
8075
|
-
var allRows = this.
|
|
8200
|
+
var allRows = this.rawData || [];
|
|
8076
8201
|
if (!arguments.length) {
|
|
8077
8202
|
return allRows.slice(0);
|
|
8078
8203
|
}
|
|
@@ -8086,7 +8211,7 @@ var Methods$d = {
|
|
|
8086
8211
|
var _this$selectConfig = this.selectConfig, selectConfig = _this$selectConfig === void 0 ? {} : _this$selectConfig, selection = this.selection;
|
|
8087
8212
|
var tableFullData = this.tableFullData, treeConfig = this.treeConfig;
|
|
8088
8213
|
var checkField = selectConfig.checkField;
|
|
8089
|
-
var
|
|
8214
|
+
var _ref158 = {}, _ref158$rowList = _ref158.rowList, rowList = _ref158$rowList === void 0 ? [] : _ref158$rowList;
|
|
8090
8215
|
if (checkField && treeConfig) {
|
|
8091
8216
|
rowList = filterTree(tableFullData, function(row2) {
|
|
8092
8217
|
return get(row2, checkField);
|
|
@@ -8115,8 +8240,8 @@ var Methods$d = {
|
|
|
8115
8240
|
var tableData = this.tableFullData;
|
|
8116
8241
|
var updateFilter = function updateFilter2(tableData2) {
|
|
8117
8242
|
var remoteFilter = _this27.remoteFilter, visibleColumn = _this27.visibleColumn;
|
|
8118
|
-
var filterColumn = visibleColumn.filter(function(
|
|
8119
|
-
var filter2 =
|
|
8243
|
+
var filterColumn = visibleColumn.filter(function(_ref159) {
|
|
8244
|
+
var filter2 = _ref159.filter;
|
|
8120
8245
|
return !!filter2;
|
|
8121
8246
|
});
|
|
8122
8247
|
return tableData2.filter(function(row2) {
|
|
@@ -8145,8 +8270,8 @@ var Methods$d = {
|
|
|
8145
8270
|
} else {
|
|
8146
8271
|
var sortedFlag = false;
|
|
8147
8272
|
if (sortOpts2.multipleColumnSort) {
|
|
8148
|
-
var sortColumns = visibleColumn.filter(function(
|
|
8149
|
-
var order2 =
|
|
8273
|
+
var sortColumns = visibleColumn.filter(function(_ref160) {
|
|
8274
|
+
var order2 = _ref160.order;
|
|
8150
8275
|
return !!order2;
|
|
8151
8276
|
});
|
|
8152
8277
|
if (sortColumns.length > 1) {
|
|
@@ -8208,9 +8333,10 @@ var Methods$d = {
|
|
|
8208
8333
|
return this.scrollLoad ? this.scrollLoad.pageSize || 10 : ((_this$_graphInfo = this._graphInfo) == null ? void 0 : _this$_graphInfo.graphed.length) || 0;
|
|
8209
8334
|
},
|
|
8210
8335
|
getRowById: function getRowById(rowid2) {
|
|
8211
|
-
var
|
|
8212
|
-
var
|
|
8213
|
-
|
|
8336
|
+
var _fullDataRowIdData$ro, _editStore$insertMap;
|
|
8337
|
+
var fullDataRowIdData = this.fullDataRowIdData, editStore = this.editStore;
|
|
8338
|
+
var rowCache = ((_fullDataRowIdData$ro = fullDataRowIdData[rowid2]) == null ? void 0 : _fullDataRowIdData$ro.row) || (editStore == null ? void 0 : (_editStore$insertMap = editStore.insertMap) == null ? void 0 : _editStore$insertMap.get(rowid2));
|
|
8339
|
+
return rowCache || null;
|
|
8214
8340
|
},
|
|
8215
8341
|
// 获取处理后的表格数据
|
|
8216
8342
|
getTableData: function getTableData() {
|
|
@@ -8254,7 +8380,7 @@ var Methods$d = {
|
|
|
8254
8380
|
});
|
|
8255
8381
|
}
|
|
8256
8382
|
if (hasCustomsOrColWidth && !isGroupOrNonSort) {
|
|
8257
|
-
var
|
|
8383
|
+
var _ref161 = {}, _ref161$collectColumn = _ref161.collectColumn, collectColumn2 = _ref161$collectColumn === void 0 ? [] : _ref161$collectColumn, _ref161$customMap = _ref161.customMap, customMap = _ref161$customMap === void 0 ? {} : _ref161$customMap, _ref161$orderColumn = _ref161.orderColumn, orderColumn = _ref161$orderColumn === void 0 ? [] : _ref161$orderColumn;
|
|
8258
8384
|
mapTree(customColumns, function(customCol) {
|
|
8259
8385
|
var targetCol = find$1(fullColumn, function(item) {
|
|
8260
8386
|
return customCol.property && item.property === customCol.property;
|
|
@@ -8320,7 +8446,8 @@ var Methods$d = {
|
|
|
8320
8446
|
var options = {
|
|
8321
8447
|
columnCaches: []
|
|
8322
8448
|
};
|
|
8323
|
-
|
|
8449
|
+
this.markColumnIndex = 0;
|
|
8450
|
+
var fullColumn = getColumnList(this, value, options);
|
|
8324
8451
|
if (options.isGroup && options.hasFixed) {
|
|
8325
8452
|
value.forEach(function(root) {
|
|
8326
8453
|
return repairFixed(root);
|
|
@@ -8591,8 +8718,8 @@ var Methods$d = {
|
|
|
8591
8718
|
}
|
|
8592
8719
|
end && end();
|
|
8593
8720
|
},
|
|
8594
|
-
blurOutside: function blurOutside(
|
|
8595
|
-
var row2 =
|
|
8721
|
+
blurOutside: function blurOutside(_ref162, event) {
|
|
8722
|
+
var row2 = _ref162.row, args = _ref162.args, column = _ref162.column;
|
|
8596
8723
|
var editConfig = this.editConfig, getEventTargetNode2 = this.getEventTargetNode, $el = this.$el;
|
|
8597
8724
|
if (column && row2) {
|
|
8598
8725
|
var editor = column.editor;
|
|
@@ -8652,7 +8779,7 @@ var Methods$d = {
|
|
|
8652
8779
|
// 处理单选框默认勾选
|
|
8653
8780
|
handleRadioDefChecked: function handleRadioDefChecked() {
|
|
8654
8781
|
var fullDataRowIdData = this.fullDataRowIdData;
|
|
8655
|
-
var
|
|
8782
|
+
var _ref163 = this.radioConfig || {}, checkRowKey = _ref163.checkRowKey;
|
|
8656
8783
|
var rowid2 = checkRowKey && encodeURIComponent(checkRowKey);
|
|
8657
8784
|
var rowCache = fullDataRowIdData[rowid2];
|
|
8658
8785
|
if (rowid2 && rowCache) {
|
|
@@ -8662,7 +8789,7 @@ var Methods$d = {
|
|
|
8662
8789
|
// 单选,行选中事件
|
|
8663
8790
|
triggerRadioRowEvent: function triggerRadioRowEvent(event, params) {
|
|
8664
8791
|
var selectRow = this.selectRow;
|
|
8665
|
-
var
|
|
8792
|
+
var _ref164 = this.radioConfig || {}, checkMethod = _ref164.checkMethod;
|
|
8666
8793
|
if (checkMethod && !checkMethod(params)) {
|
|
8667
8794
|
return;
|
|
8668
8795
|
}
|
|
@@ -8917,8 +9044,8 @@ var Methods$d = {
|
|
|
8917
9044
|
this.groupExpandeds.push(row2);
|
|
8918
9045
|
},
|
|
8919
9046
|
// 展开行事件
|
|
8920
|
-
triggerRowExpandEvent: function triggerRowExpandEvent(event,
|
|
8921
|
-
var row2 =
|
|
9047
|
+
triggerRowExpandEvent: function triggerRowExpandEvent(event, _ref165) {
|
|
9048
|
+
var row2 = _ref165.row;
|
|
8922
9049
|
var rest = this.toggleRowExpansion(row2);
|
|
8923
9050
|
var eventParams = {
|
|
8924
9051
|
$table: this,
|
|
@@ -8935,7 +9062,7 @@ var Methods$d = {
|
|
|
8935
9062
|
// 处理默认展开行
|
|
8936
9063
|
handleDefaultRowExpand: function handleDefaultRowExpand() {
|
|
8937
9064
|
var fullDataRowIdData = this.fullDataRowIdData, tableFullData = this.tableFullData;
|
|
8938
|
-
var
|
|
9065
|
+
var _ref166 = this.expandConfig || {}, expandAll = _ref166.expandAll, expandRowKeys = _ref166.expandRowKeys;
|
|
8939
9066
|
if (expandAll) {
|
|
8940
9067
|
this.expandeds = tableFullData.slice(0);
|
|
8941
9068
|
return;
|
|
@@ -8956,7 +9083,7 @@ var Methods$d = {
|
|
|
8956
9083
|
// 设置展开行,二个参数设置这一行展开与否;支持单行;支持多行
|
|
8957
9084
|
setRowExpansion: function setRowExpansion(rows, expanded) {
|
|
8958
9085
|
var expandeds = this.expandeds;
|
|
8959
|
-
var
|
|
9086
|
+
var _ref167 = this.expandConfig || {}, accordion = _ref167.accordion;
|
|
8960
9087
|
var isToggle = arguments.length === 1;
|
|
8961
9088
|
var isAccordionCloseAll = false;
|
|
8962
9089
|
if (!rows) {
|
|
@@ -9032,7 +9159,7 @@ var Methods$d = {
|
|
|
9032
9159
|
var scrollXStore = this.scrollXStore, visibleColumn = this.visibleColumn;
|
|
9033
9160
|
var offsetSize = scrollXStore.offsetSize, renderSize = scrollXStore.renderSize, startIndex = scrollXStore.startIndex, visibleIndex = scrollXStore.visibleIndex, visibleSize = scrollXStore.visibleSize;
|
|
9034
9161
|
var scrollLeft = this.$refs.tableBody.$el.scrollLeft;
|
|
9035
|
-
var
|
|
9162
|
+
var _ref168 = {}, _ref168$preload = _ref168.preload, preload = _ref168$preload === void 0 ? false : _ref168$preload, _ref168$toVisibleInde = _ref168.toVisibleIndex, toVisibleIndex = _ref168$toVisibleInde === void 0 ? 0 : _ref168$toVisibleInde, _ref168$width = _ref168.width, width = _ref168$width === void 0 ? 0 : _ref168$width;
|
|
9036
9163
|
for (var i = 0; i < visibleColumn.length; i++) {
|
|
9037
9164
|
width += visibleColumn[i].renderWidth;
|
|
9038
9165
|
if (scrollLeft < width) {
|
|
@@ -9222,7 +9349,7 @@ var Methods$d = {
|
|
|
9222
9349
|
return this.$nextTick();
|
|
9223
9350
|
},
|
|
9224
9351
|
scrollToRow: function scrollToRow(row2, column, isDelay, move) {
|
|
9225
|
-
var hasRowCache = this.fullDataRowMap.has(
|
|
9352
|
+
var hasRowCache = this.fullDataRowMap.has(this.getRaw(row2));
|
|
9226
9353
|
var isDelayArg = isDelay || isBoolean(column);
|
|
9227
9354
|
row2 && hasRowCache && rowToVisible(this, row2);
|
|
9228
9355
|
return this.scrollToColumn(column, isDelayArg, move);
|
|
@@ -9363,8 +9490,8 @@ var Methods$d = {
|
|
|
9363
9490
|
return _this44.validCellRules(type, row2, column, cellValue).then(function() {
|
|
9364
9491
|
refreshStatus();
|
|
9365
9492
|
_this44.clearValidate();
|
|
9366
|
-
}).catch(function(
|
|
9367
|
-
var rule =
|
|
9493
|
+
}).catch(function(_ref169) {
|
|
9494
|
+
var rule = _ref169.rule;
|
|
9368
9495
|
refreshStatus();
|
|
9369
9496
|
_this44.showValidTooltip({
|
|
9370
9497
|
rule,
|
|
@@ -9411,8 +9538,8 @@ var Methods$d = {
|
|
|
9411
9538
|
return fetchColumns;
|
|
9412
9539
|
}
|
|
9413
9540
|
tableColumn2.forEach(function(col) {
|
|
9414
|
-
var
|
|
9415
|
-
var
|
|
9541
|
+
var _ref170 = col.format || {}, async = _ref170.async;
|
|
9542
|
+
var _ref171 = async || {}, fetch = _ref171.fetch, _ref171$splitConfig = _ref171.splitConfig, splitConfig = _ref171$splitConfig === void 0 ? {} : _ref171$splitConfig;
|
|
9416
9543
|
if (typeof fetch === "function") {
|
|
9417
9544
|
var columnValues = [];
|
|
9418
9545
|
tableData.forEach(function(row2) {
|
|
@@ -9472,8 +9599,8 @@ var Methods$d = {
|
|
|
9472
9599
|
}, this));
|
|
9473
9600
|
},
|
|
9474
9601
|
// Publish methods 与工具栏对接
|
|
9475
|
-
connect: function connect(
|
|
9476
|
-
var toolbar =
|
|
9602
|
+
connect: function connect(_ref172) {
|
|
9603
|
+
var toolbar = _ref172.toolbar;
|
|
9477
9604
|
this.$toolbar = toolbar;
|
|
9478
9605
|
},
|
|
9479
9606
|
// 检查触发源是否属于目标节点
|
|
@@ -9498,8 +9625,8 @@ var Methods$d = {
|
|
|
9498
9625
|
return column.order ? column.order === "asc" ? "desc" : null : "asc";
|
|
9499
9626
|
},
|
|
9500
9627
|
handleDataChange: function handleDataChange() {
|
|
9501
|
-
if (Array.isArray(this.
|
|
9502
|
-
!this._isUpdateData && this.loadTableData(this.
|
|
9628
|
+
if (Array.isArray(this.rawData)) {
|
|
9629
|
+
!this._isUpdateData && this.loadTableData(this.rawData);
|
|
9503
9630
|
this._isUpdateData = false;
|
|
9504
9631
|
}
|
|
9505
9632
|
},
|
|
@@ -9533,7 +9660,7 @@ var Methods$d = {
|
|
|
9533
9660
|
// 尝试恢复滚动位置,规范了最大滚动位置的取值
|
|
9534
9661
|
attemptRestoreScroll: function attemptRestoreScroll(options) {
|
|
9535
9662
|
var _this47 = this;
|
|
9536
|
-
var
|
|
9663
|
+
var _ref173 = options || this, lastScrollTop = _ref173.lastScrollTop, lastScrollLeft = _ref173.lastScrollLeft;
|
|
9537
9664
|
var scrollXLoad = this.scrollXLoad, scrollYLoad = this.scrollYLoad, elemStore = this.elemStore;
|
|
9538
9665
|
var tableBodyElem = elemStore["main-body-wrapper"];
|
|
9539
9666
|
if ((lastScrollTop || lastScrollLeft) && tableBodyElem) {
|
|
@@ -9805,8 +9932,8 @@ var __vue2_script$7 = defineComponent({
|
|
|
9805
9932
|
return typeof hidden === "boolean" && hidden || typeof hidden === "function" && hidden(row2);
|
|
9806
9933
|
};
|
|
9807
9934
|
var handleItemClick = function handleItemClick2(name) {
|
|
9808
|
-
var buttonConfig = visibleButtons.find(function(
|
|
9809
|
-
var buttonName =
|
|
9935
|
+
var buttonConfig = visibleButtons.find(function(_ref174) {
|
|
9936
|
+
var buttonName = _ref174.name;
|
|
9810
9937
|
return buttonName === name;
|
|
9811
9938
|
});
|
|
9812
9939
|
buttonConfig.click(window.event || {}, _extends({
|
|
@@ -10621,7 +10748,7 @@ function mergeScrollDirStore(scrollDir, scrollDirStore) {
|
|
|
10621
10748
|
}
|
|
10622
10749
|
function loadStatic(data7, _vm) {
|
|
10623
10750
|
if (data7 && data7.length > 0) {
|
|
10624
|
-
_vm.
|
|
10751
|
+
_vm.updateRawData(data7);
|
|
10625
10752
|
_vm.updateStyle();
|
|
10626
10753
|
}
|
|
10627
10754
|
}
|
|
@@ -11025,6 +11152,7 @@ var Table = defineComponent({
|
|
|
11025
11152
|
columns: []
|
|
11026
11153
|
},
|
|
11027
11154
|
insertList: [],
|
|
11155
|
+
insertMap: /* @__PURE__ */ new Map(),
|
|
11028
11156
|
removeList: [],
|
|
11029
11157
|
// 选中源
|
|
11030
11158
|
selected: {
|
|
@@ -11106,15 +11234,7 @@ var Table = defineComponent({
|
|
|
11106
11234
|
// 在编辑模式下 单元格在失去焦点验证的状态
|
|
11107
11235
|
validatedMap: {},
|
|
11108
11236
|
// 表格父容器的高度
|
|
11109
|
-
parentHeight: 0
|
|
11110
|
-
// 水平滚动条的状态
|
|
11111
|
-
horizonScroll: {
|
|
11112
|
-
fixed: false,
|
|
11113
|
-
threshold: 2,
|
|
11114
|
-
max: 0,
|
|
11115
|
-
isLeft: true,
|
|
11116
|
-
isRight: false
|
|
11117
|
-
}
|
|
11237
|
+
parentHeight: 0
|
|
11118
11238
|
};
|
|
11119
11239
|
},
|
|
11120
11240
|
computed: {
|
|
@@ -11239,9 +11359,10 @@ var Table = defineComponent({
|
|
|
11239
11359
|
// 选项式监控在vue2可以检测到顶层数组splice项替换/$set项替换
|
|
11240
11360
|
// array.splice(index, 1, newItem)
|
|
11241
11361
|
// this.$set(array, index, newItem)
|
|
11362
|
+
// 在数组中的行对象上动态添加字段也会触发此选项式监听
|
|
11242
11363
|
data: function data5(array1, array2) {
|
|
11243
11364
|
if (isVue2 && array1 === array2 && array1.length === array2.length) {
|
|
11244
|
-
this.
|
|
11365
|
+
this.updateRawData(this.data);
|
|
11245
11366
|
}
|
|
11246
11367
|
}
|
|
11247
11368
|
},
|
|
@@ -11258,8 +11379,6 @@ var Table = defineComponent({
|
|
|
11258
11379
|
fullColumnMap: /* @__PURE__ */ new Map(),
|
|
11259
11380
|
fullDataRowIdData: {},
|
|
11260
11381
|
fullDataRowMap: /* @__PURE__ */ new Map(),
|
|
11261
|
-
// 临时插入数据集
|
|
11262
|
-
temporaryRows: [],
|
|
11263
11382
|
// 最后滚动位置
|
|
11264
11383
|
lastScrollLeft: 0,
|
|
11265
11384
|
lastScrollTop: 0,
|
|
@@ -11353,6 +11472,13 @@ var Table = defineComponent({
|
|
|
11353
11472
|
// 百分比最小宽度列表集合
|
|
11354
11473
|
scaleMinList: []
|
|
11355
11474
|
});
|
|
11475
|
+
var horizonScroll = hooks.ref({
|
|
11476
|
+
fixed: false,
|
|
11477
|
+
threshold: 2,
|
|
11478
|
+
max: 0,
|
|
11479
|
+
isLeft: true,
|
|
11480
|
+
isRight: false
|
|
11481
|
+
});
|
|
11356
11482
|
var bodyProps = hooks.computed(function() {
|
|
11357
11483
|
return {
|
|
11358
11484
|
collectColumn: collectColumn2.value,
|
|
@@ -11372,6 +11498,10 @@ var Table = defineComponent({
|
|
|
11372
11498
|
};
|
|
11373
11499
|
});
|
|
11374
11500
|
var tableWrapper = hooks.ref();
|
|
11501
|
+
var _useNormalData = useNormalData({
|
|
11502
|
+
props,
|
|
11503
|
+
tableFullColumn
|
|
11504
|
+
}), rawData = _useNormalData.rawData, rawDataVersion = _useNormalData.rawDataVersion;
|
|
11375
11505
|
var tinyTheme = hooks.ref(resolveTheme(props, context));
|
|
11376
11506
|
var $table = hooks.getCurrentInstance().proxy;
|
|
11377
11507
|
var $grid = hooks.inject("$grid", null);
|
|
@@ -11417,6 +11547,38 @@ var Table = defineComponent({
|
|
|
11417
11547
|
columnStore
|
|
11418
11548
|
});
|
|
11419
11549
|
var _useData = useData(props), tiledLength = _useData.tiledLength;
|
|
11550
|
+
var updateFixedClasses = function updateFixedClasses2(isLeft, isRight) {
|
|
11551
|
+
if (!$table.$el) return;
|
|
11552
|
+
var el = $table.$el;
|
|
11553
|
+
var hasLeftClass = el.classList.contains("tiny-grid-fixed__left");
|
|
11554
|
+
var hasRightClass = el.classList.contains("tiny-grid-fixed__right");
|
|
11555
|
+
var shouldHaveLeft = !isLeft;
|
|
11556
|
+
var shouldHaveRight = !isRight;
|
|
11557
|
+
if (hasLeftClass !== shouldHaveLeft) {
|
|
11558
|
+
if (shouldHaveLeft) {
|
|
11559
|
+
el.classList.add("tiny-grid-fixed__left");
|
|
11560
|
+
} else {
|
|
11561
|
+
el.classList.remove("tiny-grid-fixed__left");
|
|
11562
|
+
}
|
|
11563
|
+
}
|
|
11564
|
+
if (hasRightClass !== shouldHaveRight) {
|
|
11565
|
+
if (shouldHaveRight) {
|
|
11566
|
+
el.classList.add("tiny-grid-fixed__right");
|
|
11567
|
+
} else {
|
|
11568
|
+
el.classList.remove("tiny-grid-fixed__right");
|
|
11569
|
+
}
|
|
11570
|
+
}
|
|
11571
|
+
};
|
|
11572
|
+
var resolveMap = {};
|
|
11573
|
+
hooks.watch(function() {
|
|
11574
|
+
var _horizonScroll$value, _horizonScroll$value2;
|
|
11575
|
+
return [(_horizonScroll$value = horizonScroll.value) == null ? void 0 : _horizonScroll$value.isLeft, (_horizonScroll$value2 = horizonScroll.value) == null ? void 0 : _horizonScroll$value2.isRight];
|
|
11576
|
+
}, function(_ref175) {
|
|
11577
|
+
var newIsLeft = _ref175[0], newIsRight = _ref175[1];
|
|
11578
|
+
hooks.nextTick(function() {
|
|
11579
|
+
return updateFixedClasses(newIsLeft, newIsRight);
|
|
11580
|
+
});
|
|
11581
|
+
});
|
|
11420
11582
|
hooks.onMounted(function() {
|
|
11421
11583
|
$table.addIntersectionObserver();
|
|
11422
11584
|
if (tableWrapper.value) {
|
|
@@ -11424,6 +11586,18 @@ var Table = defineComponent({
|
|
|
11424
11586
|
}
|
|
11425
11587
|
hooks.nextTick(function() {
|
|
11426
11588
|
$table.afterMounted = true;
|
|
11589
|
+
setTimeout(function() {
|
|
11590
|
+
if ($table.$el && $table.horizonScroll) {
|
|
11591
|
+
var _horizonScroll$value3, _horizonScroll$value4;
|
|
11592
|
+
var el = $table.$el;
|
|
11593
|
+
if (!((_horizonScroll$value3 = horizonScroll.value) != null && _horizonScroll$value3.isLeft)) {
|
|
11594
|
+
el.classList.add("tiny-grid-fixed__left");
|
|
11595
|
+
}
|
|
11596
|
+
if (!((_horizonScroll$value4 = horizonScroll.value) != null && _horizonScroll$value4.isRight)) {
|
|
11597
|
+
el.classList.add("tiny-grid-fixed__right");
|
|
11598
|
+
}
|
|
11599
|
+
}
|
|
11600
|
+
});
|
|
11427
11601
|
if (props.autoResize && Grid$1._resize) {
|
|
11428
11602
|
$table.bindResize();
|
|
11429
11603
|
}
|
|
@@ -11447,6 +11621,7 @@ var Table = defineComponent({
|
|
|
11447
11621
|
}
|
|
11448
11622
|
unbindEvent($table);
|
|
11449
11623
|
$table._tileInfo = $table._graphInfo = null;
|
|
11624
|
+
$table.rowidCacheMap = null;
|
|
11450
11625
|
});
|
|
11451
11626
|
hooks.onActivated(function() {
|
|
11452
11627
|
var lastScrollLeft = $table.lastScrollLeft, lastScrollTop = $table.lastScrollTop;
|
|
@@ -11465,6 +11640,8 @@ var Table = defineComponent({
|
|
|
11465
11640
|
unbindEvent($table);
|
|
11466
11641
|
});
|
|
11467
11642
|
var tableListeners = getListeners(attrs, listeners);
|
|
11643
|
+
var markColumnIndex = hooks.ref(0);
|
|
11644
|
+
var rowidCacheMap = /* @__PURE__ */ new Map();
|
|
11468
11645
|
return {
|
|
11469
11646
|
slots,
|
|
11470
11647
|
tableListeners,
|
|
@@ -11497,7 +11674,13 @@ var Table = defineComponent({
|
|
|
11497
11674
|
bodyTableWidth,
|
|
11498
11675
|
scrollLoadScrollHeight,
|
|
11499
11676
|
columnStore,
|
|
11500
|
-
tiledLength
|
|
11677
|
+
tiledLength,
|
|
11678
|
+
rawDataVersion,
|
|
11679
|
+
rawData,
|
|
11680
|
+
markColumnIndex,
|
|
11681
|
+
rowidCacheMap,
|
|
11682
|
+
horizonScroll,
|
|
11683
|
+
resolveMap
|
|
11501
11684
|
};
|
|
11502
11685
|
},
|
|
11503
11686
|
render: function render16() {
|
|
@@ -11515,7 +11698,7 @@ var Table = defineComponent({
|
|
|
11515
11698
|
return h("div", {
|
|
11516
11699
|
class: (_class4 = {
|
|
11517
11700
|
"tiny-grid h-full sm:h-auto !bg-transparent sm:!bg-color-bg-1 after:border-none sm:after:border-solid": true
|
|
11518
|
-
}, _class4["row__valid-" + validOpts2.message] = true, _class4["size__" + vSize3] = vSize3, _class4["tiny-grid-editable"] = editConfig, _class4["show__head"] = showHeader, _class4["show__foot"] = showFooter, _class4["scroll__y"] = overflowY, _class4["scroll__x"] = overflowX, _class4["all-overflow"] = showOverflow, _class4["all-head-overflow"] = showHeaderOverflow, _class4["tiny-grid-cell__highlight"] = highlightCell, _class4["tiny-grid__animat"] = optimizeOpts.animat, _class4["tiny-grid__stripe"] = !isThemeSaas3 && stripe, _class4["tiny-grid__stripe-saas"] = isThemeSaas3 && stripeSaas, _class4["tiny-grid__border"] = border || isGroup2, _class4["tiny-grid__border-saas"] = isThemeSaas3 && borderSaas, _class4["tiny-grid__group-saas"] = isThemeSaas3 && isGroup2, _class4["tiny-grid__border-vertical"] = borderVertical, _class4["tiny-grid__checked"] = mouseConfig.checked, _class4["tiny-grid__hover-align"] = mouseConfig.hover, _class4["mark-insert"] = editConfig && editConfig.markInsert, _class4["edit__no-border"] = editConfig && editConfig.showBorder === false, _class4["is__loading"] = loading, _class4["row__highlight"] = highlightHoverRow, _class4["column__highlight"] = highlightHoverColumn, _class4["is__row-span"] = rowSpan && rowSpan.length > 0 || typeof spanMethod === "function", _class4["row__drop-handle--index"] = dropConfig.rowHandle === "index", _class4["fixed__sticky"] = horizonScroll.fixed, _class4
|
|
11701
|
+
}, _class4["row__valid-" + validOpts2.message] = true, _class4["size__" + vSize3] = vSize3, _class4["tiny-grid-editable"] = editConfig, _class4["show__head"] = showHeader, _class4["show__foot"] = showFooter, _class4["scroll__y"] = overflowY, _class4["scroll__x"] = overflowX, _class4["all-overflow"] = showOverflow, _class4["all-head-overflow"] = showHeaderOverflow, _class4["tiny-grid-cell__highlight"] = highlightCell, _class4["tiny-grid__animat"] = optimizeOpts.animat, _class4["tiny-grid__stripe"] = !isThemeSaas3 && stripe, _class4["tiny-grid__stripe-saas"] = isThemeSaas3 && stripeSaas, _class4["tiny-grid__border"] = border || isGroup2, _class4["tiny-grid__border-saas"] = isThemeSaas3 && borderSaas, _class4["tiny-grid__group-saas"] = isThemeSaas3 && isGroup2, _class4["tiny-grid__border-vertical"] = borderVertical, _class4["tiny-grid__checked"] = mouseConfig.checked, _class4["tiny-grid__hover-align"] = mouseConfig.hover, _class4["mark-insert"] = editConfig && editConfig.markInsert, _class4["edit__no-border"] = editConfig && editConfig.showBorder === false, _class4["is__loading"] = loading, _class4["row__highlight"] = highlightHoverRow, _class4["column__highlight"] = highlightHoverColumn, _class4["is__row-span"] = rowSpan && rowSpan.length > 0 || typeof spanMethod === "function", _class4["row__drop-handle--index"] = dropConfig.rowHandle === "index", _class4["fixed__sticky"] = horizonScroll.fixed, _class4)
|
|
11519
11702
|
}, [
|
|
11520
11703
|
// 隐藏列
|
|
11521
11704
|
h("div", {
|
|
@@ -11746,8 +11929,8 @@ var Column = defineComponent({
|
|
|
11746
11929
|
default: null
|
|
11747
11930
|
}
|
|
11748
11931
|
},
|
|
11749
|
-
setup: function setup7(props,
|
|
11750
|
-
var slots =
|
|
11932
|
+
setup: function setup7(props, _ref176) {
|
|
11933
|
+
var slots = _ref176.slots;
|
|
11751
11934
|
var reactive = hooks.reactive, inject = hooks.inject, getCurrentInstance = hooks.getCurrentInstance, onUpdated = hooks.onUpdated, watch = hooks.watch, nextTick = hooks.nextTick;
|
|
11752
11935
|
var currentInstance = getCurrentInstance();
|
|
11753
11936
|
var instance = currentInstance.proxy;
|
|
@@ -11801,7 +11984,7 @@ var Column = defineComponent({
|
|
|
11801
11984
|
warn("ui.grid.error.chainCallError");
|
|
11802
11985
|
}
|
|
11803
11986
|
var hasSubColumn = findTree(slotVnode, function(node) {
|
|
11804
|
-
var
|
|
11987
|
+
var _ref177 = node || {}, componentOptions = _ref177.componentOptions, type = _ref177.type;
|
|
11805
11988
|
var componentName = type && type.name || componentOptions && componentOptions.Ctor.extendOptions.name;
|
|
11806
11989
|
return $table.isValidCustomColumn(componentName);
|
|
11807
11990
|
}, null, null);
|
|
@@ -12049,8 +12232,8 @@ var Grid = defineComponent({
|
|
|
12049
12232
|
var tinyTheme = hooks.ref(resolveTheme(props, context));
|
|
12050
12233
|
var tinyMode = hooks.ref(resolveMode(props, context));
|
|
12051
12234
|
var breakpoint = useBreakpoint();
|
|
12052
|
-
var renderless = function renderless2(props2, hooks2,
|
|
12053
|
-
var
|
|
12235
|
+
var renderless = function renderless2(props2, hooks2, _ref178) {
|
|
12236
|
+
var _ref178$designConfig = _ref178.designConfig, designConfig = _ref178$designConfig === void 0 ? null : _ref178$designConfig;
|
|
12054
12237
|
return {
|
|
12055
12238
|
tableListeners,
|
|
12056
12239
|
designConfig,
|
|
@@ -12157,8 +12340,8 @@ var Grid = defineComponent({
|
|
|
12157
12340
|
this.tasks.updateParentHeight();
|
|
12158
12341
|
},
|
|
12159
12342
|
// 向缓存添加实例
|
|
12160
|
-
connect: function connect2(
|
|
12161
|
-
var name =
|
|
12343
|
+
connect: function connect2(_ref179) {
|
|
12344
|
+
var name = _ref179.name, vm = _ref179.vm;
|
|
12162
12345
|
if (name && typeof name === "string" && vm) {
|
|
12163
12346
|
this.vmStore[name] = vm;
|
|
12164
12347
|
}
|
|
@@ -12230,30 +12413,25 @@ var Grid = defineComponent({
|
|
|
12230
12413
|
Grid.install = function(Vue) {
|
|
12231
12414
|
Vue.component(Grid.name, Grid);
|
|
12232
12415
|
};
|
|
12233
|
-
function operArrs(
|
|
12234
|
-
var _vm =
|
|
12416
|
+
function operArrs(_ref180) {
|
|
12417
|
+
var _vm = _ref180._vm, editStore = _ref180.editStore, newRecords = _ref180.newRecords, row2 = _ref180.row, tableFullData = _ref180.tableFullData;
|
|
12235
12418
|
if (row2 === -1) {
|
|
12236
|
-
Array.prototype.push.apply(nowData, newRecords);
|
|
12237
12419
|
Array.prototype.push.apply(tableFullData, newRecords);
|
|
12238
|
-
Array.prototype.push.apply(tableSourceData, newRecordsCopy);
|
|
12239
12420
|
}
|
|
12240
12421
|
if (row2 && row2 !== -1) {
|
|
12241
|
-
var
|
|
12242
|
-
if (
|
|
12422
|
+
var insertIndex = tableFullData.indexOf(row2);
|
|
12423
|
+
if (insertIndex === -1) {
|
|
12243
12424
|
throw new Error(error("ui.grid.error.unableInsert"));
|
|
12244
12425
|
}
|
|
12245
|
-
var insertIndex = tableFullData.indexOf(row2);
|
|
12246
|
-
Array.prototype.splice.apply(nowData, [targetIndex, 0].concat(newRecords));
|
|
12247
12426
|
Array.prototype.splice.apply(tableFullData, [insertIndex, 0].concat(newRecords));
|
|
12248
|
-
Array.prototype.splice.apply(tableSourceData, [insertIndex, 0].concat(newRecordsCopy));
|
|
12249
12427
|
}
|
|
12250
12428
|
if (!row2) {
|
|
12251
|
-
Array.prototype.unshift.apply(nowData, newRecords);
|
|
12252
12429
|
Array.prototype.unshift.apply(tableFullData, newRecords);
|
|
12253
|
-
Array.prototype.unshift.apply(tableSourceData, newRecordsCopy);
|
|
12254
12430
|
}
|
|
12255
12431
|
Array.prototype.unshift.apply(editStore.insertList, newRecords);
|
|
12256
|
-
|
|
12432
|
+
newRecords.forEach(function(row22) {
|
|
12433
|
+
return editStore.insertMap.set(getRowid(_vm, row22), row22);
|
|
12434
|
+
});
|
|
12257
12435
|
}
|
|
12258
12436
|
var _setActiveCell = function _setActiveCell2(row2, field) {
|
|
12259
12437
|
var _this53 = this;
|
|
@@ -12298,35 +12476,27 @@ var Methods$c = {
|
|
|
12298
12476
|
// 根据位置从指定行添加数据
|
|
12299
12477
|
_insertAt: function _insertAt(records, row2) {
|
|
12300
12478
|
var _this54 = this;
|
|
12301
|
-
var
|
|
12479
|
+
var editStore = this.editStore, isAsyncColumn = this.isAsyncColumn, scrollYLoad = this.scrollYLoad, tableFullData = this.tableFullData, treeConfig = this.treeConfig, visibleColumn = this.visibleColumn;
|
|
12302
12480
|
if (treeConfig) {
|
|
12303
12481
|
throw new Error(error("ui.grid.error.treeInsert"));
|
|
12304
12482
|
}
|
|
12305
|
-
if (isAsyncColumn) {
|
|
12306
|
-
var columnSet = this.getColumns();
|
|
12307
|
-
columnSet.forEach(function(column) {
|
|
12308
|
-
if (column.format && column.format.async && column.format.async.fetch) {
|
|
12309
|
-
records[GlobalConfig$1.constant.insertedField] = true;
|
|
12310
|
-
}
|
|
12311
|
-
});
|
|
12312
|
-
}
|
|
12313
12483
|
if (!isArray(records)) {
|
|
12314
12484
|
records = [records];
|
|
12315
12485
|
}
|
|
12316
|
-
var
|
|
12486
|
+
var isColumnFormat = isAsyncColumn && visibleColumn.some(function(column) {
|
|
12487
|
+
var _column$format, _column$format$async;
|
|
12488
|
+
return (_column$format = column.format) == null ? void 0 : (_column$format$async = _column$format.async) == null ? void 0 : _column$format$async.fetch;
|
|
12489
|
+
});
|
|
12317
12490
|
var newRecords = records.map(function(record) {
|
|
12318
|
-
|
|
12491
|
+
isColumnFormat && (record[GlobalConfig$1.constant.insertedField] = true);
|
|
12492
|
+
return hooks.reactive(_this54.defineField(Object.assign({}, record)));
|
|
12319
12493
|
});
|
|
12320
|
-
var newRecordsCopy = clone(newRecords, true);
|
|
12321
12494
|
operArrs({
|
|
12322
12495
|
_vm: this,
|
|
12323
12496
|
editStore,
|
|
12324
|
-
newRecords,
|
|
12325
|
-
newRecordsCopy,
|
|
12326
|
-
nowData,
|
|
12327
12497
|
row: row2,
|
|
12328
12498
|
tableFullData,
|
|
12329
|
-
|
|
12499
|
+
newRecords
|
|
12330
12500
|
});
|
|
12331
12501
|
this.updateCache();
|
|
12332
12502
|
this.handleTableData(true);
|
|
@@ -12351,9 +12521,9 @@ var Methods$c = {
|
|
|
12351
12521
|
*/
|
|
12352
12522
|
_remove: function _remove(rows) {
|
|
12353
12523
|
var _this55 = this;
|
|
12354
|
-
var afterFullData = this.afterFullData,
|
|
12355
|
-
var selection = this.selection, tableFullData = this.tableFullData, treeConfig = this.treeConfig
|
|
12356
|
-
var _this$editStore = this.editStore, insertList = _this$editStore.insertList, removeList = _this$editStore.removeList;
|
|
12524
|
+
var afterFullData = this.afterFullData, _this$selectConfig3 = this.selectConfig, selectConfig = _this$selectConfig3 === void 0 ? {} : _this$selectConfig3;
|
|
12525
|
+
var selection = this.selection, tableFullData = this.tableFullData, treeConfig = this.treeConfig;
|
|
12526
|
+
var _this$editStore = this.editStore, insertList = _this$editStore.insertList, insertMap = _this$editStore.insertMap, removeList = _this$editStore.removeList;
|
|
12357
12527
|
var checkField = selectConfig.checkField;
|
|
12358
12528
|
var nowData = afterFullData;
|
|
12359
12529
|
var rest = [];
|
|
@@ -12372,7 +12542,7 @@ var Methods$c = {
|
|
|
12372
12542
|
}
|
|
12373
12543
|
for (var i = 0; i < rows.length; i++) {
|
|
12374
12544
|
var row2 = rows[i];
|
|
12375
|
-
if (this.
|
|
12545
|
+
if (this.isTemporaryRow(row2)) continue;
|
|
12376
12546
|
removeList.push(row2);
|
|
12377
12547
|
}
|
|
12378
12548
|
if (!checkField) {
|
|
@@ -12392,23 +12562,15 @@ var Methods$c = {
|
|
|
12392
12562
|
return inArr(row3, rows);
|
|
12393
12563
|
});
|
|
12394
12564
|
}
|
|
12395
|
-
remove(tableSourceData, function(row3) {
|
|
12396
|
-
return find$1(insertList, function(r) {
|
|
12397
|
-
return getRowid(_this55, r) === getRowid(_this55, row3);
|
|
12398
|
-
}) && find$1(rows, function(r) {
|
|
12399
|
-
return getRowid(_this55, r) === getRowid(_this55, row3);
|
|
12400
|
-
});
|
|
12401
|
-
});
|
|
12402
12565
|
remove(insertList, function(row3) {
|
|
12403
|
-
|
|
12566
|
+
var exist = inArr(row3, rows);
|
|
12567
|
+
exist && insertMap.delete(getRowid(_this55, row3));
|
|
12568
|
+
return exist;
|
|
12404
12569
|
});
|
|
12405
12570
|
this.updateCache();
|
|
12406
12571
|
this.handleTableData(true);
|
|
12407
12572
|
this.checkSelectionStatus();
|
|
12408
12573
|
this.updateFooter();
|
|
12409
|
-
if (scrollYLoad) {
|
|
12410
|
-
this.updateScrollYSpace();
|
|
12411
|
-
}
|
|
12412
12574
|
var res = {
|
|
12413
12575
|
row: rows && rows.length ? rows[rows.length - 1] : null,
|
|
12414
12576
|
rows: rest
|
|
@@ -12442,12 +12604,12 @@ var Methods$c = {
|
|
|
12442
12604
|
* 如果还额外传了field则还原指定单元格。
|
|
12443
12605
|
*/
|
|
12444
12606
|
_revertData: function _revertData(rows, field) {
|
|
12445
|
-
var
|
|
12607
|
+
var rawData = this.rawData;
|
|
12446
12608
|
if (arguments.length && rows && !isArray(rows)) {
|
|
12447
12609
|
rows = [rows];
|
|
12448
12610
|
}
|
|
12449
12611
|
if (!arguments.length) {
|
|
12450
|
-
rows =
|
|
12612
|
+
rows = rawData || [];
|
|
12451
12613
|
}
|
|
12452
12614
|
for (var i = 0; i < rows.length; i++) {
|
|
12453
12615
|
var row2 = rows[i];
|
|
@@ -12464,7 +12626,7 @@ var Methods$c = {
|
|
|
12464
12626
|
if (arguments.length) {
|
|
12465
12627
|
return this.$nextTick();
|
|
12466
12628
|
}
|
|
12467
|
-
return this.reloadData(
|
|
12629
|
+
return this.reloadData(rawData || []);
|
|
12468
12630
|
},
|
|
12469
12631
|
/**
|
|
12470
12632
|
* 获取表格操作数据集
|
|
@@ -12599,7 +12761,7 @@ var Methods$c = {
|
|
|
12599
12761
|
*/
|
|
12600
12762
|
_clearActived: function _clearActived(event) {
|
|
12601
12763
|
var _this59 = this;
|
|
12602
|
-
var _this$
|
|
12764
|
+
var _this$editConfig3 = this.editConfig, editConfig = _this$editConfig3 === void 0 ? {} : _this$editConfig3, editStore = this.editStore, tableColumn2 = this.tableColumn;
|
|
12603
12765
|
var actived = editStore.actived;
|
|
12604
12766
|
var args = actived.args, column = actived.column, row2 = actived.row;
|
|
12605
12767
|
var isActived = row2 || column;
|
|
@@ -12616,7 +12778,7 @@ var Methods$c = {
|
|
|
12616
12778
|
this.updateRowStatus(actived.row);
|
|
12617
12779
|
this.updateFooter();
|
|
12618
12780
|
var row22 = args.row, column2 = args.column;
|
|
12619
|
-
var
|
|
12781
|
+
var _ref181 = column2 || {}, editor = _ref181.editor;
|
|
12620
12782
|
if ((editor == null ? void 0 : editor.component) === "input" && (editor == null ? void 0 : (_editor$attrs = editor.attrs) == null ? void 0 : _editor$attrs.type) === "number") {
|
|
12621
12783
|
row22[column2.property] = +row22[column2.property];
|
|
12622
12784
|
}
|
|
@@ -12737,7 +12899,7 @@ var Methods$c = {
|
|
|
12737
12899
|
var _this61 = this;
|
|
12738
12900
|
var editConfig = this.editConfig, editStore = this.editStore, elemStore = this.elemStore, _this$mouseConfig3 = this.mouseConfig, mouseConfig = _this$mouseConfig3 === void 0 ? {} : _this$mouseConfig3;
|
|
12739
12901
|
var actived = editStore.actived, selected = editStore.selected;
|
|
12740
|
-
var
|
|
12902
|
+
var _ref182 = params || {}, cell = _ref182.cell, column = _ref182.column, row2 = _ref182.row;
|
|
12741
12903
|
var selectMethod = function selectMethod2() {
|
|
12742
12904
|
var _cell$parentNode;
|
|
12743
12905
|
if (selected.row === row2 && selected.column === column || actived.row === row2 && (editConfig.mode !== "cell" || actived.column === column)) {
|
|
@@ -12918,7 +13080,7 @@ function handleCellMousedownEvent(args1) {
|
|
|
12918
13080
|
var $el = args1.$el, _vm = args1._vm, bodyList = args1.bodyList, cell = args1.cell, cellFirstElementChild = args1.cellFirstElementChild;
|
|
12919
13081
|
var cellLastElementChild = args1.cellLastElementChild, headStart = args1.headStart, headerList = args1.headerList, isIndex = args1.isIndex, startCellNode = args1.startCellNode;
|
|
12920
13082
|
var _vm$mouseConfig2 = _vm.mouseConfig, mouseConfig = _vm$mouseConfig2 === void 0 ? {} : _vm$mouseConfig2;
|
|
12921
|
-
var
|
|
13083
|
+
var _ref183 = mouseConfig || {}, _ref183$updateInterva = _ref183.updateInterval, updateInterval = _ref183$updateInterva === void 0 ? 10 : _ref183$updateInterva;
|
|
12922
13084
|
var oldMousemove = document.onmousemove;
|
|
12923
13085
|
var oldMouseup = document.onmouseup;
|
|
12924
13086
|
var updateEvent = function updateEvent2(event) {
|
|
@@ -12957,8 +13119,8 @@ function onCellMousedownSelectEditable(args) {
|
|
|
12957
13119
|
_vm.handleSelected(params, event);
|
|
12958
13120
|
}
|
|
12959
13121
|
}
|
|
12960
|
-
function onCellMousedownSelect(
|
|
12961
|
-
var _vm =
|
|
13122
|
+
function onCellMousedownSelect(_ref184) {
|
|
13123
|
+
var _vm = _ref184._vm, editConfig = _ref184.editConfig, event = _ref184.event, mouseConfig = _ref184.mouseConfig, params = _ref184.params;
|
|
12962
13124
|
if (!editConfig && mouseConfig.selected) {
|
|
12963
13125
|
_vm.handleSelected(params, event);
|
|
12964
13126
|
}
|
|
@@ -12977,8 +13139,8 @@ function onCellMousedownIndexColumn(args) {
|
|
|
12977
13139
|
_vm.handleIndexChecked(getRowNodes(bodyList, getCellNodeIndex(firstCell), getCellNodeIndex(cell)));
|
|
12978
13140
|
}
|
|
12979
13141
|
}
|
|
12980
|
-
function onCellMousedownNotIndexColumn(
|
|
12981
|
-
var _vm =
|
|
13142
|
+
function onCellMousedownNotIndexColumn(_ref185) {
|
|
13143
|
+
var _vm = _ref185._vm, cell = _ref185.cell, column = _ref185.column, event = _ref185.event, headerList = _ref185.headerList, isIndex = _ref185.isIndex, params = _ref185.params;
|
|
12982
13144
|
if (!isIndex) {
|
|
12983
13145
|
var firstCell = cell.parentNode.firstElementChild;
|
|
12984
13146
|
_vm.handleSelected(params, event);
|
|
@@ -12986,8 +13148,8 @@ function onCellMousedownNotIndexColumn(_ref186) {
|
|
|
12986
13148
|
_vm.handleIndexChecked([[firstCell]]);
|
|
12987
13149
|
}
|
|
12988
13150
|
}
|
|
12989
|
-
function handleHeaderCellMousedownEvent(
|
|
12990
|
-
var $el =
|
|
13151
|
+
function handleHeaderCellMousedownEvent(_ref186) {
|
|
13152
|
+
var $el = _ref186.$el, _vm = _ref186._vm, bodyList = _ref186.bodyList, cell = _ref186.cell, headerList = _ref186.headerList, startCell = _ref186.startCell;
|
|
12991
13153
|
var oldMousemove = document.onmousemove;
|
|
12992
13154
|
var oldMouseup = document.onmouseup;
|
|
12993
13155
|
var updateEvent = function updateEvent2(event) {
|
|
@@ -13020,8 +13182,8 @@ var removeCellClass = function removeCellClass2(bodyRef, clazz) {
|
|
|
13020
13182
|
return removeClass(elem, clazz);
|
|
13021
13183
|
});
|
|
13022
13184
|
};
|
|
13023
|
-
var getCellIndex = function getCellIndex2(
|
|
13024
|
-
var cell =
|
|
13185
|
+
var getCellIndex = function getCellIndex2(_ref187) {
|
|
13186
|
+
var cell = _ref187.cell, bodyList = _ref187.bodyList;
|
|
13025
13187
|
var trElem = cell.parentNode;
|
|
13026
13188
|
var cIndex = arrayIndexOf(trElem.children, cell);
|
|
13027
13189
|
var rIndex = arrayIndexOf(bodyList, trElem);
|
|
@@ -13030,8 +13192,8 @@ var getCellIndex = function getCellIndex2(_ref188) {
|
|
|
13030
13192
|
cIndex
|
|
13031
13193
|
};
|
|
13032
13194
|
};
|
|
13033
|
-
var getModify = function getModify2(
|
|
13034
|
-
var offsetTop =
|
|
13195
|
+
var getModify = function getModify2(_ref188) {
|
|
13196
|
+
var offsetTop = _ref188.offsetTop, offsetLeft = _ref188.offsetLeft, cWidth = _ref188.cWidth, cHeight = _ref188.cHeight;
|
|
13035
13197
|
var modifyDomStyle = function modifyDomStyle2(dom, styleOptions) {
|
|
13036
13198
|
return dom && Object.assign(dom.style, styleOptions);
|
|
13037
13199
|
};
|
|
@@ -13058,8 +13220,8 @@ var getModify = function getModify2(_ref189) {
|
|
|
13058
13220
|
});
|
|
13059
13221
|
};
|
|
13060
13222
|
};
|
|
13061
|
-
var writeClipboardText = function writeClipboardText2(
|
|
13062
|
-
var $table =
|
|
13223
|
+
var writeClipboardText = function writeClipboardText2(_ref189) {
|
|
13224
|
+
var $table = _ref189.$table, columns2 = _ref189.columns, rows = _ref189.rows, rowNodes = _ref189.rowNodes;
|
|
13063
13225
|
var _$table$keyboardConfi = $table.keyboardConfig, keyboardConfig = _$table$keyboardConfi === void 0 ? {} : _$table$keyboardConfi;
|
|
13064
13226
|
var _keyboardConfig$clipb = keyboardConfig.clipboard, clipboard = _keyboardConfig$clipb === void 0 ? {} : _keyboardConfig$clipb;
|
|
13065
13227
|
var writeMethod = clipboard.writeMethod, _clipboard$cellSplit = clipboard.cellSplit, cellSplit = _clipboard$cellSplit === void 0 ? "," : _clipboard$cellSplit, _clipboard$rowSplit = clipboard.rowSplit, rowSplit = _clipboard$rowSplit === void 0 ? ";" : _clipboard$rowSplit;
|
|
@@ -13106,7 +13268,7 @@ var Methods$b = {
|
|
|
13106
13268
|
var params = _extends({}, args);
|
|
13107
13269
|
var columnIndex = visibleColumn.indexOf(params.column);
|
|
13108
13270
|
var rowIndex = tableData.indexOf(params.row);
|
|
13109
|
-
var
|
|
13271
|
+
var _ref190 = {}, targetColumn = _ref190.targetColumn, targetColumnIndex = _ref190.targetColumnIndex, targetRow = _ref190.targetRow, targetRowIndex = _ref190.targetRowIndex;
|
|
13110
13272
|
event.preventDefault();
|
|
13111
13273
|
var checkColumn = function checkColumn2(column) {
|
|
13112
13274
|
return !hasIndexColumn2(column) && (edit ? column.editor : true);
|
|
@@ -13200,9 +13362,9 @@ var Methods$b = {
|
|
|
13200
13362
|
}
|
|
13201
13363
|
},
|
|
13202
13364
|
// 可编辑方向键移动处理
|
|
13203
|
-
moveSelected: function moveSelected(
|
|
13365
|
+
moveSelected: function moveSelected(_ref191) {
|
|
13204
13366
|
var _this63 = this;
|
|
13205
|
-
var args =
|
|
13367
|
+
var args = _ref191.args, isLeftArrow = _ref191.isLeftArrow, isUpArrow = _ref191.isUpArrow, isRightArrow = _ref191.isRightArrow, isDownArrow = _ref191.isDownArrow, event = _ref191.event;
|
|
13206
13368
|
var hasIndexColumn2 = this.hasIndexColumn, visibleColumn = this.tableColumn, tableData = this.tableFullData;
|
|
13207
13369
|
var params = _extends({}, args);
|
|
13208
13370
|
var column = params.column;
|
|
@@ -13424,7 +13586,7 @@ var Methods$b = {
|
|
|
13424
13586
|
_getMouseCheckeds: function _getMouseCheckeds() {
|
|
13425
13587
|
var _this65 = this;
|
|
13426
13588
|
var _this$editStore$check = this.editStore.checked.rowNodes, rowNodes = _this$editStore$check === void 0 ? [] : _this$editStore$check;
|
|
13427
|
-
var
|
|
13589
|
+
var _ref192 = {}, _ref192$rows = _ref192.rows, rows = _ref192$rows === void 0 ? [] : _ref192$rows, _ref192$columns = _ref192.columns, columns2 = _ref192$columns === void 0 ? [] : _ref192$columns;
|
|
13428
13590
|
var res = {
|
|
13429
13591
|
rows,
|
|
13430
13592
|
columns: columns2,
|
|
@@ -13453,7 +13615,7 @@ var Methods$b = {
|
|
|
13453
13615
|
if (!mouseConfig || !mouseConfig.checked) {
|
|
13454
13616
|
return;
|
|
13455
13617
|
}
|
|
13456
|
-
var
|
|
13618
|
+
var _ref193 = {}, cHeight = _ref193.cHeight, cWidth = _ref193.cWidth, offsetLeft = _ref193.offsetLeft, offsetTop = _ref193.offsetTop;
|
|
13457
13619
|
cWidth = cHeight = -2;
|
|
13458
13620
|
offsetTop = offsetLeft = 0;
|
|
13459
13621
|
this.clearChecked();
|
|
@@ -13582,7 +13744,7 @@ var Methods$b = {
|
|
|
13582
13744
|
var editStore = this.editStore, tableColumn2 = this.tableColumn, tableData = this.tableData;
|
|
13583
13745
|
var copyed = editStore.copyed;
|
|
13584
13746
|
var rowNodes = editStore.checked.rowNodes;
|
|
13585
|
-
var
|
|
13747
|
+
var _ref194 = {}, cHeight = _ref194.cHeight, cWidth = _ref194.cWidth, offsetLeft = _ref194.offsetLeft, offsetTop = _ref194.offsetTop, _ref194$rows = _ref194.rows, rows = _ref194$rows === void 0 ? [] : _ref194$rows, _ref194$columns = _ref194.columns, columns2 = _ref194$columns === void 0 ? [] : _ref194$columns;
|
|
13586
13748
|
cWidth = cHeight = -3;
|
|
13587
13749
|
offsetTop = offsetLeft = 0;
|
|
13588
13750
|
this.clearCopyed();
|
|
@@ -13705,13 +13867,13 @@ function adjustParams(rows, cb, vaildDatas) {
|
|
|
13705
13867
|
vaildDatas
|
|
13706
13868
|
};
|
|
13707
13869
|
}
|
|
13708
|
-
var columnHandler = function columnHandler2(
|
|
13709
|
-
var _vm =
|
|
13870
|
+
var columnHandler = function columnHandler2(_ref195) {
|
|
13871
|
+
var _vm = _ref195._vm, colValidPromiseArr = _ref195.colValidPromiseArr, editRules = _ref195.editRules, isAll = _ref195.isAll, row2 = _ref195.row, validRest = _ref195.validRest;
|
|
13710
13872
|
return function(column, columnIndex) {
|
|
13711
13873
|
if (has(editRules, column.property)) {
|
|
13712
13874
|
colValidPromiseArr.push(new Promise(function(resolve, reject) {
|
|
13713
|
-
_vm.validCellRules("all", row2, column).then(resolve).catch(function(
|
|
13714
|
-
var rule =
|
|
13875
|
+
_vm.validCellRules("all", row2, column).then(resolve).catch(function(_ref196) {
|
|
13876
|
+
var rule = _ref196.rule, rules = _ref196.rules;
|
|
13715
13877
|
var rowIndex = _vm.getRowIndex(row2);
|
|
13716
13878
|
var rest = {
|
|
13717
13879
|
rule,
|
|
@@ -13735,8 +13897,8 @@ var columnHandler = function columnHandler2(_ref196) {
|
|
|
13735
13897
|
}
|
|
13736
13898
|
};
|
|
13737
13899
|
};
|
|
13738
|
-
function validTree(
|
|
13739
|
-
var treeConfig =
|
|
13900
|
+
function validTree(_ref197) {
|
|
13901
|
+
var treeConfig = _ref197.treeConfig, handleVaild = _ref197.handleVaild, hasTreeExpand2 = _ref197.hasTreeExpand, vaildDatas = _ref197.vaildDatas, treeOpts = _ref197.treeOpts;
|
|
13740
13902
|
if (treeConfig.validHidden === false) {
|
|
13741
13903
|
var _recurValid = function recurValid(row2) {
|
|
13742
13904
|
var children = row2[treeConfig.children || "children"];
|
|
@@ -13750,8 +13912,8 @@ function validTree(_ref198) {
|
|
|
13750
13912
|
eachTree(vaildDatas, handleVaild, treeOpts);
|
|
13751
13913
|
}
|
|
13752
13914
|
}
|
|
13753
|
-
var realValid = function realValid2(
|
|
13754
|
-
var _vm =
|
|
13915
|
+
var realValid = function realValid2(_ref198) {
|
|
13916
|
+
var _vm = _ref198._vm, editRules = _ref198.editRules, isAll = _ref198.isAll, validRest = _ref198.validRest, treeConfig = _ref198.treeConfig, hasTreeExpand2 = _ref198.hasTreeExpand, vaildDatas = _ref198.vaildDatas, treeOpts = _ref198.treeOpts;
|
|
13755
13917
|
var rowValids = [];
|
|
13756
13918
|
var columns2 = _vm.getColumns();
|
|
13757
13919
|
var handleVaild = function handleVaild2(row2) {
|
|
@@ -13803,8 +13965,8 @@ var Rule = /* @__PURE__ */ (function() {
|
|
|
13803
13965
|
var onRejected = function onRejected2(opt, _this) {
|
|
13804
13966
|
var isAll = opt.isAll, validRest = opt.validRest, cb = opt.cb, afterFullData = opt.afterFullData, treeConfig = opt.treeConfig;
|
|
13805
13967
|
return function(params) {
|
|
13806
|
-
var
|
|
13807
|
-
var args = isAll ? validRest : (
|
|
13968
|
+
var _ref199;
|
|
13969
|
+
var args = isAll ? validRest : (_ref199 = {}, _ref199[params.column.property] = params, _ref199);
|
|
13808
13970
|
var funcFinish = function funcFinish2(args2, reject, resolve) {
|
|
13809
13971
|
return function() {
|
|
13810
13972
|
opt.status = false;
|
|
@@ -13871,10 +14033,10 @@ var Methods$a = {
|
|
|
13871
14033
|
},
|
|
13872
14034
|
validatePromise: function validatePromise(row2, column, columnIndex, isAll, validRest) {
|
|
13873
14035
|
var _this68 = this;
|
|
13874
|
-
function onrejected(
|
|
13875
|
-
var _vm =
|
|
13876
|
-
return function(
|
|
13877
|
-
var rule =
|
|
14036
|
+
function onrejected(_ref201) {
|
|
14037
|
+
var _vm = _ref201._vm, reject = _ref201.reject, resolve = _ref201.resolve;
|
|
14038
|
+
return function(_ref202) {
|
|
14039
|
+
var rule = _ref202.rule, rules = _ref202.rules;
|
|
13878
14040
|
var rest = {
|
|
13879
14041
|
$table: _vm,
|
|
13880
14042
|
column,
|
|
@@ -13910,7 +14072,7 @@ var Methods$a = {
|
|
|
13910
14072
|
*/
|
|
13911
14073
|
beginValidate: function beginValidate(rows, callback, isAll) {
|
|
13912
14074
|
var afterFullData = this.afterFullData, editRules = this.editRules, hasTreeExpand2 = this.hasTreeExpand, treeConfig = this.treeConfig, treeOpts = this.treeOpts;
|
|
13913
|
-
var
|
|
14075
|
+
var _ref203 = {}, _ref203$status = _ref203.status, status = _ref203$status === void 0 ? true : _ref203$status, _ref203$validRest = _ref203.validRest, validRest = _ref203$validRest === void 0 ? {} : _ref203$validRest;
|
|
13914
14076
|
var _adjustParams = adjustParams(rows, callback, afterFullData), vaildDatas = _adjustParams.vaildDatas, cb = _adjustParams.cb;
|
|
13915
14077
|
var opt = {
|
|
13916
14078
|
isAll,
|
|
@@ -13948,8 +14110,8 @@ var Methods$a = {
|
|
|
13948
14110
|
};
|
|
13949
14111
|
return Promise.all(rowValids).then(onFulfilled).catch(onRejected(opt, this));
|
|
13950
14112
|
},
|
|
13951
|
-
hasCellRules: function hasCellRules(type, row2,
|
|
13952
|
-
var property =
|
|
14113
|
+
hasCellRules: function hasCellRules(type, row2, _ref204) {
|
|
14114
|
+
var property = _ref204.property;
|
|
13953
14115
|
if (!property || !this.editRules) {
|
|
13954
14116
|
return false;
|
|
13955
14117
|
}
|
|
@@ -13982,7 +14144,7 @@ var Methods$a = {
|
|
|
13982
14144
|
var _this69 = this;
|
|
13983
14145
|
var editRules = this.editRules, rowId = this.rowId;
|
|
13984
14146
|
var property = column.property;
|
|
13985
|
-
var
|
|
14147
|
+
var _ref205 = {}, _ref205$descriptor = _ref205.descriptor, descriptor = _ref205$descriptor === void 0 ? {} : _ref205$descriptor, _ref205$model = _ref205.model, model = _ref205$model === void 0 ? {} : _ref205$model;
|
|
13986
14148
|
if (property && editRules) {
|
|
13987
14149
|
var rules = get(editRules, property);
|
|
13988
14150
|
var cellValue = isUndefined(defaultValue) ? get(row2, property) : defaultValue;
|
|
@@ -14007,8 +14169,8 @@ var Methods$a = {
|
|
|
14007
14169
|
column
|
|
14008
14170
|
}
|
|
14009
14171
|
};
|
|
14010
|
-
var onRejected3 = function onRejected32(
|
|
14011
|
-
var fields =
|
|
14172
|
+
var onRejected3 = function onRejected32(_ref206) {
|
|
14173
|
+
var fields = _ref206.fields;
|
|
14012
14174
|
var cellErrors = Object.keys(fields).map(function(prop) {
|
|
14013
14175
|
var rules2 = _descriptor[prop];
|
|
14014
14176
|
_descriptor[prop] = !rules2.message ? Object.assign(rules2, {
|
|
@@ -14067,8 +14229,8 @@ var Methods$a = {
|
|
|
14067
14229
|
var onfulfilled = function onfulfilled2() {
|
|
14068
14230
|
editConfig.mode === "row" && validStore.visible && validStore.row === row2 && validStore.column === column && _this70.clearValidate();
|
|
14069
14231
|
};
|
|
14070
|
-
var onrejected = function onrejected2(
|
|
14071
|
-
var rule =
|
|
14232
|
+
var onrejected = function onrejected2(_ref207) {
|
|
14233
|
+
var rule = _ref207.rule;
|
|
14072
14234
|
if (rule.trigger && type !== rule.trigger) {
|
|
14073
14235
|
return Promise.resolve();
|
|
14074
14236
|
}
|
|
@@ -14162,7 +14324,7 @@ var Methods$8 = {
|
|
|
14162
14324
|
initFetchOption: function initFetchOption() {
|
|
14163
14325
|
var _this$fetchData = this.fetchData, fetchData = _this$fetchData === void 0 ? {} : _this$fetchData, _this$dataset = this.dataset, dataset = _this$dataset === void 0 ? {} : _this$dataset;
|
|
14164
14326
|
if (fetchData.api || dataset.source || dataset.value || dataset.api) {
|
|
14165
|
-
var
|
|
14327
|
+
var _ref208 = fetchData || dataset.source || dataset.api || {}, loading = _ref208.loading, fields = _ref208.fields, api = _ref208.api, reloadConfig = _ref208.reloadConfig;
|
|
14166
14328
|
var isReloadFilter = false;
|
|
14167
14329
|
var isReloadScroll = false;
|
|
14168
14330
|
if (reloadConfig) {
|
|
@@ -14200,7 +14362,7 @@ var Methods$8 = {
|
|
|
14200
14362
|
error("ui.grid.error.notQuery");
|
|
14201
14363
|
return this.$nextTick();
|
|
14202
14364
|
}
|
|
14203
|
-
var
|
|
14365
|
+
var _ref209 = fetchData || dataset.source || dataset.api || {}, args = _ref209.args, loading = _ref209.loading;
|
|
14204
14366
|
var field = sortData.field, order = sortData.order, prop = sortData.prop, property = sortData.property;
|
|
14205
14367
|
var sortByData = {
|
|
14206
14368
|
field,
|
|
@@ -14308,8 +14470,8 @@ var Methods$7 = {
|
|
|
14308
14470
|
}
|
|
14309
14471
|
},
|
|
14310
14472
|
// 表格内置分页渲染器
|
|
14311
|
-
renderPager: function renderPager(
|
|
14312
|
-
var $slots =
|
|
14473
|
+
renderPager: function renderPager(_ref210) {
|
|
14474
|
+
var $slots = _ref210.$slots, _vm = _ref210._vm, loading = _ref210.loading, pager = _ref210.pager, pagerConfig = _ref210.pagerConfig, tableLoading = _ref210.tableLoading, vSize3 = _ref210.vSize;
|
|
14313
14475
|
var res = null;
|
|
14314
14476
|
var fetchData = _vm.fetchData;
|
|
14315
14477
|
if ($slots.pager) {
|
|
@@ -14403,8 +14565,8 @@ var Pager = {
|
|
|
14403
14565
|
Object.assign(host.methods, Methods$7);
|
|
14404
14566
|
}
|
|
14405
14567
|
};
|
|
14406
|
-
function setBodyRecords(
|
|
14407
|
-
var body =
|
|
14568
|
+
function setBodyRecords(_ref211) {
|
|
14569
|
+
var body = _ref211.body, insertRecords = _ref211.insertRecords, pendingRecords = _ref211.pendingRecords;
|
|
14408
14570
|
if (insertRecords.length) {
|
|
14409
14571
|
body.pendingRecords = pendingRecords.filter(function(row2) {
|
|
14410
14572
|
return !insertRecords.includes(row2);
|
|
@@ -14419,8 +14581,8 @@ function setBodyRecords(_ref212) {
|
|
|
14419
14581
|
function canInvokeSaveDataApi(body, removeRecords, updateRecords) {
|
|
14420
14582
|
return body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length;
|
|
14421
14583
|
}
|
|
14422
|
-
function doRemoveOrShowMsg(
|
|
14423
|
-
var _vm =
|
|
14584
|
+
function doRemoveOrShowMsg(_ref212) {
|
|
14585
|
+
var _vm = _ref212._vm, canInvoke = _ref212.canInvoke, code = _ref212.code, isMsg2 = _ref212.isMsg, pendingRecords = _ref212.pendingRecords, resolve = _ref212.resolve, valid = _ref212.valid;
|
|
14424
14586
|
if (valid && !canInvoke) {
|
|
14425
14587
|
if (isMsg2) {
|
|
14426
14588
|
if (pendingRecords.length) {
|
|
@@ -14436,8 +14598,8 @@ function doRemoveOrShowMsg(_ref213) {
|
|
|
14436
14598
|
resolve();
|
|
14437
14599
|
}
|
|
14438
14600
|
}
|
|
14439
|
-
function invokeSaveDataApi(
|
|
14440
|
-
var _vm =
|
|
14601
|
+
function invokeSaveDataApi(_ref213) {
|
|
14602
|
+
var _vm = _ref213._vm, args = _ref213.args, body = _ref213.body, code = _ref213.code, removeRecords = _ref213.removeRecords, resolve = _ref213.resolve, saveData = _ref213.saveData, updateRecords = _ref213.updateRecords, valid = _ref213.valid;
|
|
14441
14603
|
var canInvoke = false;
|
|
14442
14604
|
if (valid) {
|
|
14443
14605
|
canInvoke = canInvokeSaveDataApi(body, removeRecords, updateRecords);
|
|
@@ -14464,8 +14626,8 @@ function invokeSaveDataApi(_ref214) {
|
|
|
14464
14626
|
}
|
|
14465
14627
|
var Methods$6 = {
|
|
14466
14628
|
// 表格工具栏渲染器
|
|
14467
|
-
getRenderedToolbar: function getRenderedToolbar(
|
|
14468
|
-
var $slots =
|
|
14629
|
+
getRenderedToolbar: function getRenderedToolbar(_ref214) {
|
|
14630
|
+
var $slots = _ref214.$slots, _vm = _ref214._vm, loading = _ref214.loading, tableLoading = _ref214.tableLoading, toolbar = _ref214.toolbar;
|
|
14469
14631
|
return _vm.renderedToolbar = (function() {
|
|
14470
14632
|
var res = null;
|
|
14471
14633
|
if ($slots.toolbar) {
|
|
@@ -14567,9 +14729,9 @@ var Methods$6 = {
|
|
|
14567
14729
|
};
|
|
14568
14730
|
this.remove(selecteds).then(afterRemove);
|
|
14569
14731
|
},
|
|
14570
|
-
handleFullScreen: function handleFullScreen(
|
|
14732
|
+
handleFullScreen: function handleFullScreen(_ref215) {
|
|
14571
14733
|
var _this78 = this;
|
|
14572
|
-
var show2 =
|
|
14734
|
+
var show2 = _ref215[0];
|
|
14573
14735
|
this.fullScreenClass = show2 ? "tiny-fullscreen-full" : "";
|
|
14574
14736
|
this.$nextTick(function() {
|
|
14575
14737
|
_this78.recalculate();
|
|
@@ -14586,8 +14748,8 @@ var Methods$6 = {
|
|
|
14586
14748
|
if (code === "insert") {
|
|
14587
14749
|
this.insert();
|
|
14588
14750
|
} else if (code === "insert_actived") {
|
|
14589
|
-
this.insert().then(function(
|
|
14590
|
-
var row2 =
|
|
14751
|
+
this.insert().then(function(_ref216) {
|
|
14752
|
+
var row2 = _ref216.row;
|
|
14591
14753
|
return _this79.setActiveRow(row2);
|
|
14592
14754
|
});
|
|
14593
14755
|
} else if (code === "mark_cancel") {
|
|
@@ -14674,7 +14836,7 @@ var Methods$6 = {
|
|
|
14674
14836
|
});
|
|
14675
14837
|
}
|
|
14676
14838
|
if (selecteds.length) {
|
|
14677
|
-
var
|
|
14839
|
+
var _ref217 = {}, _ref217$plus = _ref217.plus, plus = _ref217$plus === void 0 ? [] : _ref217$plus, _ref217$minus = _ref217.minus, minus = _ref217$minus === void 0 ? [] : _ref217$minus, tmp = _ref217.tmp;
|
|
14678
14840
|
selecteds.forEach(function(data7) {
|
|
14679
14841
|
var selectedPending = pendings.includes(data7);
|
|
14680
14842
|
tmp = selectedPending ? minus : plus;
|
|
@@ -14697,8 +14859,8 @@ var Toolbar = {
|
|
|
14697
14859
|
};
|
|
14698
14860
|
var Methods$5 = {
|
|
14699
14861
|
renderColumnAnchor: function renderColumnAnchor(params, _vm) {
|
|
14700
|
-
var
|
|
14701
|
-
} :
|
|
14862
|
+
var _ref218 = params || {}, _ref218$anchors = _ref218.anchors, anchors = _ref218$anchors === void 0 ? [] : _ref218$anchors, _ref218$action = _ref218.action, action = _ref218$action === void 0 ? function() {
|
|
14863
|
+
} : _ref218$action;
|
|
14702
14864
|
var viewType2 = _vm.viewType;
|
|
14703
14865
|
return h("div", {
|
|
14704
14866
|
class: ["tiny-grid__column-anchor", _vm.viewCls("columnAnchor")],
|
|
@@ -14733,8 +14895,8 @@ var Methods$5 = {
|
|
|
14733
14895
|
}, [iconVnode, spanVnode]);
|
|
14734
14896
|
}));
|
|
14735
14897
|
},
|
|
14736
|
-
buildColumnAnchor: function buildColumnAnchor(
|
|
14737
|
-
var property =
|
|
14898
|
+
buildColumnAnchor: function buildColumnAnchor(_ref219) {
|
|
14899
|
+
var property = _ref219.property, label = _ref219.label, anchors = _ref219.anchors, activeAnchor = _ref219.activeAnchor;
|
|
14738
14900
|
var visibleColumn = this.getColumns();
|
|
14739
14901
|
var column = visibleColumn.find(function(col) {
|
|
14740
14902
|
return !col.type && col.property === property;
|
|
@@ -14825,8 +14987,8 @@ var Methods$5 = {
|
|
|
14825
14987
|
}, activeAnchor.delay);
|
|
14826
14988
|
};
|
|
14827
14989
|
},
|
|
14828
|
-
anchorAction: function anchorAction(
|
|
14829
|
-
var field =
|
|
14990
|
+
anchorAction: function anchorAction(_ref220) {
|
|
14991
|
+
var field = _ref220.field, anchors = _ref220.anchors, _vm = _ref220._vm;
|
|
14830
14992
|
var fromAnchor = anchors.find(function(anchor) {
|
|
14831
14993
|
return anchor.active;
|
|
14832
14994
|
});
|
|
@@ -14872,8 +15034,8 @@ var ColumnAnchor = {
|
|
|
14872
15034
|
Object.assign(host.methods, Methods$5);
|
|
14873
15035
|
}
|
|
14874
15036
|
};
|
|
14875
|
-
var createHandlerOnEnd = function createHandlerOnEnd2(
|
|
14876
|
-
var _vm =
|
|
15037
|
+
var createHandlerOnEnd = function createHandlerOnEnd2(_ref221) {
|
|
15038
|
+
var _vm = _ref221._vm, refresh = _ref221.refresh;
|
|
14877
15039
|
return function(event) {
|
|
14878
15040
|
var insertRecords = _vm.getInsertRecords();
|
|
14879
15041
|
if (insertRecords.length) {
|
|
@@ -14885,7 +15047,7 @@ var createHandlerOnEnd = function createHandlerOnEnd2(_ref222) {
|
|
|
14885
15047
|
var targetTrElem = event.item;
|
|
14886
15048
|
var wrapperElem = targetTrElem.parentNode, prevEl = targetTrElem.previousElementSibling, nextEl = targetTrElem.nextElementSibling;
|
|
14887
15049
|
var prevTrElem = prevEl && prevEl.classList.contains("tiny-grid-body__row") ? prevEl : prevEl && prevEl.previousElementSibling;
|
|
14888
|
-
var tableTreeData = _vm.
|
|
15050
|
+
var tableTreeData = _vm.rawData || _vm.tableData;
|
|
14889
15051
|
var selfRow = _vm.getRowNode(targetTrElem).item;
|
|
14890
15052
|
var selfNode = findTree$1(tableTreeData, function(row2) {
|
|
14891
15053
|
return row2 === selfRow;
|
|
@@ -14919,7 +15081,7 @@ var createHandlerOnEnd = function createHandlerOnEnd2(_ref222) {
|
|
|
14919
15081
|
_vm.tableFullData = [].concat(tableTreeData);
|
|
14920
15082
|
}
|
|
14921
15083
|
_vm.$emit("row-drop-end", event, _vm, _vm.scrollYLoad ? tableTreeData : _vm.tableFullData);
|
|
14922
|
-
refresh && _vm.
|
|
15084
|
+
refresh && _vm.rawData && _vm.refreshData(_vm.rawData);
|
|
14923
15085
|
};
|
|
14924
15086
|
};
|
|
14925
15087
|
var getSortColumns = function getSortColumns2(columns2) {
|
|
@@ -14942,7 +15104,7 @@ var Methods$4 = {
|
|
|
14942
15104
|
// 处理列拖拽
|
|
14943
15105
|
columnDrop: function columnDrop(headerEl) {
|
|
14944
15106
|
var _this81 = this;
|
|
14945
|
-
var
|
|
15107
|
+
var _ref222 = this.dropConfig || {}, plugin = _ref222.plugin, onBeforeMove = _ref222.onBeforeMove, filter2 = _ref222.filter;
|
|
14946
15108
|
var columnDropContainer = headerEl.querySelector(".tiny-grid-header__row");
|
|
14947
15109
|
var columnDropOptions = _extends({}, this.dropConfig, {
|
|
14948
15110
|
handle: ".tiny-grid-header__column:not(.col__fixed)",
|
|
@@ -15035,8 +15197,8 @@ var Sort = {
|
|
|
15035
15197
|
Object.assign(host.methods, Methods$3);
|
|
15036
15198
|
}
|
|
15037
15199
|
};
|
|
15038
|
-
function createTooltipRange(
|
|
15039
|
-
var _vm =
|
|
15200
|
+
function createTooltipRange(_ref223) {
|
|
15201
|
+
var _vm = _ref223._vm, cell = _ref223.cell, column = _ref223.column, isHeader = _ref223.isHeader;
|
|
15040
15202
|
var range = document.createRange();
|
|
15041
15203
|
var rangeEnd;
|
|
15042
15204
|
range.setStart(cell, 0);
|
|
@@ -15054,8 +15216,8 @@ function createTooltipRange(_ref224) {
|
|
|
15054
15216
|
range.setEnd(cell, rangeEnd);
|
|
15055
15217
|
return range;
|
|
15056
15218
|
}
|
|
15057
|
-
function processContentMethod(
|
|
15058
|
-
var _vm =
|
|
15219
|
+
function processContentMethod(_ref224) {
|
|
15220
|
+
var _vm = _ref224._vm, column = _ref224.column, content = _ref224.content, contentMethod = _ref224.contentMethod, event = _ref224.event, isHeader = _ref224.isHeader, row2 = _ref224.row, showTip = _ref224.showTip;
|
|
15059
15221
|
if (contentMethod) {
|
|
15060
15222
|
_vm.tooltipContent = contentMethod({
|
|
15061
15223
|
event,
|
|
@@ -15207,15 +15369,15 @@ var Tooltip = {
|
|
|
15207
15369
|
Object.assign(host.methods, Methods$2);
|
|
15208
15370
|
}
|
|
15209
15371
|
};
|
|
15210
|
-
function onHalfSelectionProperty(
|
|
15211
|
-
var checkStrictly =
|
|
15372
|
+
function onHalfSelectionProperty(_ref225) {
|
|
15373
|
+
var checkStrictly = _ref225.checkStrictly, property = _ref225.property, row2 = _ref225.row, treeConfig = _ref225.treeConfig, treeIndeterminates = _ref225.treeIndeterminates, value = _ref225.value;
|
|
15212
15374
|
if (property && treeConfig && !checkStrictly && value === -1) {
|
|
15213
15375
|
treeIndeterminates.push(row2);
|
|
15214
15376
|
set(row2, property, false);
|
|
15215
15377
|
}
|
|
15216
15378
|
}
|
|
15217
|
-
function onFullSelectionProperty(
|
|
15218
|
-
var checkMethod =
|
|
15379
|
+
function onFullSelectionProperty(_ref226) {
|
|
15380
|
+
var checkMethod = _ref226.checkMethod, checkStrictly = _ref226.checkStrictly, property = _ref226.property, row2 = _ref226.row, treeConfig = _ref226.treeConfig, treeIndeterminates = _ref226.treeIndeterminates, value = _ref226.value;
|
|
15219
15381
|
if (property && treeConfig && !checkStrictly && value !== -1) {
|
|
15220
15382
|
eachTree([row2], function(item, $rowIndex) {
|
|
15221
15383
|
if (row2 === item || !checkMethod || checkMethod({
|
|
@@ -15230,8 +15392,8 @@ function onFullSelectionProperty(_ref227) {
|
|
|
15230
15392
|
}, treeConfig);
|
|
15231
15393
|
}
|
|
15232
15394
|
}
|
|
15233
|
-
function getVItemsOnParentSlctProp(
|
|
15234
|
-
var checkMethod =
|
|
15395
|
+
function getVItemsOnParentSlctProp(_ref227) {
|
|
15396
|
+
var checkMethod = _ref227.checkMethod, matchObj = _ref227.matchObj;
|
|
15235
15397
|
var tinyItems;
|
|
15236
15398
|
if (checkMethod) {
|
|
15237
15399
|
tinyItems = matchObj.items.filter(function(item, $rowIndex) {
|
|
@@ -15245,8 +15407,8 @@ function getVItemsOnParentSlctProp(_ref228) {
|
|
|
15245
15407
|
}
|
|
15246
15408
|
return tinyItems;
|
|
15247
15409
|
}
|
|
15248
|
-
function getParentStatusOnParentSlctProp(
|
|
15249
|
-
var indeterminatesItem =
|
|
15410
|
+
function getParentStatusOnParentSlctProp(_ref228) {
|
|
15411
|
+
var indeterminatesItem = _ref228.indeterminatesItem, matchObj = _ref228.matchObj, property = _ref228.property, vItems = _ref228.vItems, value = _ref228.value;
|
|
15250
15412
|
var parentStatus;
|
|
15251
15413
|
if (indeterminatesItem) {
|
|
15252
15414
|
parentStatus = -1;
|
|
@@ -15261,8 +15423,8 @@ function getParentStatusOnParentSlctProp(_ref229) {
|
|
|
15261
15423
|
}
|
|
15262
15424
|
return parentStatus;
|
|
15263
15425
|
}
|
|
15264
|
-
function onHalfSelection(
|
|
15265
|
-
var checkStrictly =
|
|
15426
|
+
function onHalfSelection(_ref229) {
|
|
15427
|
+
var checkStrictly = _ref229.checkStrictly, property = _ref229.property, row2 = _ref229.row, selection = _ref229.selection, treeConfig = _ref229.treeConfig, treeIndeterminates = _ref229.treeIndeterminates, value = _ref229.value;
|
|
15266
15428
|
if (!property && treeConfig && !checkStrictly && value === -1) {
|
|
15267
15429
|
treeIndeterminates.push(row2);
|
|
15268
15430
|
remove(selection, function(item) {
|
|
@@ -15273,8 +15435,8 @@ function onHalfSelection(_ref230) {
|
|
|
15273
15435
|
var addSelection = function addSelection2(selection, item) {
|
|
15274
15436
|
return !selection.includes(item) && selection.push(item);
|
|
15275
15437
|
};
|
|
15276
|
-
function onFullSelection(
|
|
15277
|
-
var checkMethod =
|
|
15438
|
+
function onFullSelection(_ref230) {
|
|
15439
|
+
var checkMethod = _ref230.checkMethod, checkStrictly = _ref230.checkStrictly, property = _ref230.property, row2 = _ref230.row, selection = _ref230.selection, treeConfig = _ref230.treeConfig, treeIndeterminates = _ref230.treeIndeterminates, value = _ref230.value;
|
|
15278
15440
|
if (!property && treeConfig && !checkStrictly && value !== -1) {
|
|
15279
15441
|
eachTree([row2], function(item, $rowIndex) {
|
|
15280
15442
|
if (row2 === item || !checkMethod || checkMethod({
|
|
@@ -15295,8 +15457,8 @@ function onFullSelection(_ref231) {
|
|
|
15295
15457
|
}, treeConfig);
|
|
15296
15458
|
}
|
|
15297
15459
|
}
|
|
15298
|
-
function getParentStatusOnParentSelection(
|
|
15299
|
-
var indeterminatesItem =
|
|
15460
|
+
function getParentStatusOnParentSelection(_ref231) {
|
|
15461
|
+
var indeterminatesItem = _ref231.indeterminatesItem, matchObj = _ref231.matchObj, selection = _ref231.selection, vItems = _ref231.vItems, value = _ref231.value;
|
|
15300
15462
|
var parentStatus;
|
|
15301
15463
|
if (indeterminatesItem) {
|
|
15302
15464
|
parentStatus = -1;
|
|
@@ -15309,8 +15471,8 @@ function getParentStatusOnParentSelection(_ref232) {
|
|
|
15309
15471
|
}
|
|
15310
15472
|
return parentStatus;
|
|
15311
15473
|
}
|
|
15312
|
-
function hasCheckField(
|
|
15313
|
-
var row2 =
|
|
15474
|
+
function hasCheckField(_ref232, value, _vm) {
|
|
15475
|
+
var row2 = _ref232.row;
|
|
15314
15476
|
var tableFullData = _vm.tableFullData, _vm$selectConfig = _vm.selectConfig, selectConfig = _vm$selectConfig === void 0 ? {} : _vm$selectConfig, treeConfig = _vm.treeConfig, treeIndeterminates = _vm.treeIndeterminates;
|
|
15315
15477
|
var property = selectConfig.checkField, checkStrictly = selectConfig.checkStrictly, checkMethod = selectConfig.checkMethod;
|
|
15316
15478
|
onHalfSelectionProperty({
|
|
@@ -15358,8 +15520,8 @@ function hasCheckField(_ref233, value, _vm) {
|
|
|
15358
15520
|
set(row2, property, value);
|
|
15359
15521
|
}
|
|
15360
15522
|
}
|
|
15361
|
-
function onSelectTreeCheckStrictly(
|
|
15362
|
-
var row2 =
|
|
15523
|
+
function onSelectTreeCheckStrictly(_ref233, value, _vm) {
|
|
15524
|
+
var row2 = _ref233.row;
|
|
15363
15525
|
var selection = _vm.selection, tableFullData = _vm.tableFullData, _vm$selectConfig2 = _vm.selectConfig, selectConfig = _vm$selectConfig2 === void 0 ? {} : _vm$selectConfig2, treeConfig = _vm.treeConfig, treeIndeterminates = _vm.treeIndeterminates;
|
|
15364
15526
|
var property = selectConfig.checkField, checkStrictly = selectConfig.checkStrictly, checkMethod = selectConfig.checkMethod;
|
|
15365
15527
|
onHalfSelection({
|
|
@@ -15403,8 +15565,8 @@ function onSelectTreeCheckStrictly(_ref234, value, _vm) {
|
|
|
15403
15565
|
}
|
|
15404
15566
|
}
|
|
15405
15567
|
}
|
|
15406
|
-
function onSelectOther(
|
|
15407
|
-
var row2 =
|
|
15568
|
+
function onSelectOther(_ref234, value, _vm) {
|
|
15569
|
+
var row2 = _ref234.row;
|
|
15408
15570
|
var selection = _vm.selection, _vm$selectConfig3 = _vm.selectConfig, selectConfig = _vm$selectConfig3 === void 0 ? {} : _vm$selectConfig3, treeConfig = _vm.treeConfig;
|
|
15409
15571
|
var property = selectConfig.checkField, checkStrictly = selectConfig.checkStrictly;
|
|
15410
15572
|
if (!property && !(treeConfig && !checkStrictly)) {
|
|
@@ -15417,8 +15579,8 @@ function onSelectOther(_ref235, value, _vm) {
|
|
|
15417
15579
|
}
|
|
15418
15580
|
}
|
|
15419
15581
|
}
|
|
15420
|
-
function hasNoCheckField(
|
|
15421
|
-
var row2 =
|
|
15582
|
+
function hasNoCheckField(_ref235, value, _vm) {
|
|
15583
|
+
var row2 = _ref235.row;
|
|
15422
15584
|
onSelectTreeCheckStrictly({
|
|
15423
15585
|
row: row2
|
|
15424
15586
|
}, value, _vm);
|
|
@@ -15426,8 +15588,8 @@ function hasNoCheckField(_ref236, value, _vm) {
|
|
|
15426
15588
|
row: row2
|
|
15427
15589
|
}, value, _vm);
|
|
15428
15590
|
}
|
|
15429
|
-
function pushSelectRow(
|
|
15430
|
-
var afterFullData =
|
|
15591
|
+
function pushSelectRow(_ref236) {
|
|
15592
|
+
var afterFullData = _ref236.afterFullData, checkMethod = _ref236.checkMethod, checkStrictly = _ref236.checkStrictly; _ref236.property; var selectRows = _ref236.selectRows, selection = _ref236.selection, treeConfig = _ref236.treeConfig, value = _ref236.value;
|
|
15431
15593
|
if (!checkStrictly && value) {
|
|
15432
15594
|
eachTree(afterFullData, function(row2, $rowIndex) {
|
|
15433
15595
|
if (!checkMethod || checkMethod({
|
|
@@ -15449,8 +15611,8 @@ function pushSelectRow(_ref237) {
|
|
|
15449
15611
|
}, treeConfig);
|
|
15450
15612
|
}
|
|
15451
15613
|
}
|
|
15452
|
-
function hasCheckFieldNoStrictly(
|
|
15453
|
-
var afterFullData =
|
|
15614
|
+
function hasCheckFieldNoStrictly(_ref237) {
|
|
15615
|
+
var afterFullData = _ref237.afterFullData, checkMethod = _ref237.checkMethod, checkStrictly = _ref237.checkStrictly, property = _ref237.property, selection = _ref237.selection, treeConfig = _ref237.treeConfig, value = _ref237.value;
|
|
15454
15616
|
if (!checkStrictly && property) {
|
|
15455
15617
|
var indexKey = (treeConfig ? "$" : "") + "rowIndex";
|
|
15456
15618
|
var setValFn = function setValFn2(row2, rowIndex) {
|
|
@@ -15476,8 +15638,8 @@ function hasCheckFieldNoStrictly(_ref238) {
|
|
|
15476
15638
|
}
|
|
15477
15639
|
}
|
|
15478
15640
|
}
|
|
15479
|
-
function filterSelectRow(
|
|
15480
|
-
var afterFullData =
|
|
15641
|
+
function filterSelectRow(_ref238) {
|
|
15642
|
+
var afterFullData = _ref238.afterFullData, checkMethod = _ref238.checkMethod, checkStrictly = _ref238.checkStrictly, selectRows = _ref238.selectRows, selection = _ref238.selection, value = _ref238.value;
|
|
15481
15643
|
if (!checkStrictly && value && checkMethod) {
|
|
15482
15644
|
selectRows = afterFullData.filter(function(row2, rowIndex) {
|
|
15483
15645
|
return selection.includes(row2) || checkMethod({
|
|
@@ -15499,8 +15661,8 @@ function filterSelectRow(_ref239) {
|
|
|
15499
15661
|
}
|
|
15500
15662
|
return selectRows;
|
|
15501
15663
|
}
|
|
15502
|
-
function hasNoCheckFieldNoStrictly(
|
|
15503
|
-
var afterFullData =
|
|
15664
|
+
function hasNoCheckFieldNoStrictly(_ref239) {
|
|
15665
|
+
var afterFullData = _ref239.afterFullData, checkMethod = _ref239.checkMethod, checkStrictly = _ref239.checkStrictly, property = _ref239.property, selection = _ref239.selection, treeConfig = _ref239.treeConfig, value = _ref239.value;
|
|
15504
15666
|
var selectRows = [];
|
|
15505
15667
|
if (treeConfig) {
|
|
15506
15668
|
pushSelectRow({
|
|
@@ -15525,8 +15687,8 @@ function hasNoCheckFieldNoStrictly(_ref240) {
|
|
|
15525
15687
|
}
|
|
15526
15688
|
return selectRows;
|
|
15527
15689
|
}
|
|
15528
|
-
function setSelectionNoStrictly(
|
|
15529
|
-
var _vm =
|
|
15690
|
+
function setSelectionNoStrictly(_ref240) {
|
|
15691
|
+
var _vm = _ref240._vm, checkStrictly = _ref240.checkStrictly, reserve = _ref240.reserve, selectRows = _ref240.selectRows, selection = _ref240.selection, value = _ref240.value, afterFullData = _ref240.afterFullData;
|
|
15530
15692
|
if (!checkStrictly) {
|
|
15531
15693
|
if (reserve) {
|
|
15532
15694
|
var unCheckedRows = afterFullData.filter(function(row2) {
|
|
@@ -15546,7 +15708,7 @@ var Methods$1 = {
|
|
|
15546
15708
|
// 处理默认勾选
|
|
15547
15709
|
handleSelectionDefChecked: function handleSelectionDefChecked() {
|
|
15548
15710
|
var fullDataRowIdData = this.fullDataRowIdData;
|
|
15549
|
-
var
|
|
15711
|
+
var _ref241 = this.selectConfig || {}, checkAll = _ref241.checkAll, checkRowKeys = _ref241.checkRowKeys;
|
|
15550
15712
|
if (checkAll) {
|
|
15551
15713
|
this.setAllSelection(true);
|
|
15552
15714
|
return;
|
|
@@ -15580,8 +15742,8 @@ var Methods$1 = {
|
|
|
15580
15742
|
return this.$nextTick();
|
|
15581
15743
|
},
|
|
15582
15744
|
// 多选,行选中事件。value:选中true、不选false、不确定-1
|
|
15583
|
-
handleSelectRow: function handleSelectRow(
|
|
15584
|
-
var row2 =
|
|
15745
|
+
handleSelectRow: function handleSelectRow(_ref242, value) {
|
|
15746
|
+
var row2 = _ref242.row;
|
|
15585
15747
|
hasCheckField({
|
|
15586
15748
|
row: row2
|
|
15587
15749
|
}, value, this);
|
|
@@ -15592,7 +15754,7 @@ var Methods$1 = {
|
|
|
15592
15754
|
},
|
|
15593
15755
|
handleToggleCheckRowEvent: function handleToggleCheckRowEvent(params, event) {
|
|
15594
15756
|
var selection = this.selection;
|
|
15595
|
-
var
|
|
15757
|
+
var _ref243 = this.selectConfig || {}, checkField = _ref243.checkField;
|
|
15596
15758
|
var row2 = params.row;
|
|
15597
15759
|
var value = checkField ? !get(row2, checkField) : !~selection.indexOf(row2);
|
|
15598
15760
|
if (event) {
|
|
@@ -15660,8 +15822,8 @@ var Methods$1 = {
|
|
|
15660
15822
|
// 根据表格选中状态,给头部复现框赋值状态(全选,半选,未选)
|
|
15661
15823
|
checkSelectionStatus: function checkSelectionStatus() {
|
|
15662
15824
|
var afterFullData = this.afterFullData, selection = this.selection, treeIndeterminates = this.treeIndeterminates;
|
|
15663
|
-
var
|
|
15664
|
-
var
|
|
15825
|
+
var _ref244 = this.selectConfig || {}, checkField = _ref244.checkField, checkMethod = _ref244.checkMethod;
|
|
15826
|
+
var _ref245 = {}, everyHandler = _ref245.everyHandler, someHandler = _ref245.someHandler;
|
|
15665
15827
|
if (checkField) {
|
|
15666
15828
|
everyHandler = checkMethod ? function(row2, rowIndex) {
|
|
15667
15829
|
return !checkMethod({
|
|
@@ -15710,7 +15872,7 @@ var Methods$1 = {
|
|
|
15710
15872
|
// 保留选中状态
|
|
15711
15873
|
reserveCheckSelection: function reserveCheckSelection() {
|
|
15712
15874
|
var fullDataRowIdData = this.fullDataRowIdData, selection = this.selection;
|
|
15713
|
-
var
|
|
15875
|
+
var _ref246 = this.selectConfig || {}, reserve = _ref246.reserve;
|
|
15714
15876
|
var rowkey = getRowkey(this);
|
|
15715
15877
|
if (reserve && selection.length) {
|
|
15716
15878
|
this.selection = selection.map(function(row2) {
|
|
@@ -15738,7 +15900,7 @@ var Methods$1 = {
|
|
|
15738
15900
|
},
|
|
15739
15901
|
clearSelection: function clearSelection() {
|
|
15740
15902
|
var tableFullData = this.tableFullData, treeConfig = this.treeConfig;
|
|
15741
|
-
var
|
|
15903
|
+
var _ref247 = this.selectConfig || {}, checkField = _ref247.checkField;
|
|
15742
15904
|
if (checkField) {
|
|
15743
15905
|
treeConfig ? eachTree(tableFullData, function(item) {
|
|
15744
15906
|
return set(item, checkField, false);
|
|
@@ -15864,9 +16026,9 @@ var Checkbox = {
|
|
|
15864
16026
|
};
|
|
15865
16027
|
var Methods = {
|
|
15866
16028
|
// 展开树节点事件
|
|
15867
|
-
triggerTreeExpandEvent: function triggerTreeExpandEvent(event,
|
|
16029
|
+
triggerTreeExpandEvent: function triggerTreeExpandEvent(event, _ref248) {
|
|
15868
16030
|
var _this84 = this;
|
|
15869
|
-
var row2 =
|
|
16031
|
+
var row2 = _ref248.row;
|
|
15870
16032
|
var currentColumn = this.currentColumn, currentRow = this.currentRow;
|
|
15871
16033
|
var rest = this.toggleTreeExpansion(row2);
|
|
15872
16034
|
var eventParams = {
|