linkmore-design 1.0.100 → 1.1.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/dist/LmFilter/filterFns/index.d.ts +5 -5
- package/dist/LmTable/util.d.ts +10 -4
- package/dist/index.umd.js +163 -58
- package/dist/index.umd.min.js +2 -2
- package/dist/variables.css +12504 -0
- package/es/Form/style/form.css +3 -3
- package/es/Form/style/index.css +6063 -3
- package/es/Form/style/tooltip.css +2 -2
- package/es/Form/style/variables.css +6063 -3
- package/es/LmFilter/LmFilter.js +2 -0
- package/es/LmFilter/filterFns/index.d.ts +60 -0
- package/es/LmFilter/filterFns/index.js +72 -102
- package/es/LmTable/Table.js +80 -33
- package/es/LmTable/components/sheelTableCell.js +5 -3
- package/es/LmTable/style/index.css +19 -0
- package/es/LmTable/style/variables.css +19 -0
- package/es/LmTable/util.js +69 -16
- package/es/styles/variables.css +6082 -3
- package/lib/Form/style/form.css +3 -3
- package/lib/Form/style/index.css +6063 -3
- package/lib/Form/style/tooltip.css +2 -2
- package/lib/Form/style/variables.css +6063 -3
- package/lib/LmFilter/LmFilter.js +2 -0
- package/lib/LmFilter/filterFns/index.d.ts +60 -0
- package/lib/LmFilter/filterFns/index.js +41 -54
- package/lib/LmTable/Table.js +80 -33
- package/lib/LmTable/components/sheelTableCell.js +5 -3
- package/lib/LmTable/style/index.css +19 -0
- package/lib/LmTable/style/variables.css +19 -0
- package/lib/LmTable/util.js +69 -16
- package/lib/styles/variables.css +6082 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const initLocalization: (props: any) => {
|
|
2
2
|
searchFilter: any;
|
|
3
3
|
searchQuery: {};
|
|
4
4
|
basicFilter: any;
|
|
@@ -6,12 +6,11 @@ export function initLocalization(props: any): {
|
|
|
6
6
|
customFilter: any;
|
|
7
7
|
customQuery: {};
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
declare function useCoreOptions({ state, dispatch, props }: {
|
|
9
|
+
declare const useCoreOptions: ({ state, dispatch, props }: {
|
|
11
10
|
state: any;
|
|
12
11
|
dispatch: any;
|
|
13
12
|
props: any;
|
|
14
|
-
})
|
|
13
|
+
}) => {
|
|
15
14
|
CoreMethods: {
|
|
16
15
|
onQuery: ({ complexFilter, type, basicFilter, basicQuery, searchFilter, searchQuery, customFilter, }?: {
|
|
17
16
|
complexFilter?: {};
|
|
@@ -23,7 +22,7 @@ declare function useCoreOptions({ state, dispatch, props }: {
|
|
|
23
22
|
customFilter?: any;
|
|
24
23
|
}) => void;
|
|
25
24
|
setCustomFilter: (val: any) => void;
|
|
26
|
-
setSearchFilter: (itemValue: any
|
|
25
|
+
setSearchFilter: (itemValue: any) => void;
|
|
27
26
|
};
|
|
28
27
|
RefMethods: {
|
|
29
28
|
getState: () => any;
|
|
@@ -58,3 +57,4 @@ declare function useCoreOptions({ state, dispatch, props }: {
|
|
|
58
57
|
onClearChange: () => void;
|
|
59
58
|
};
|
|
60
59
|
};
|
|
60
|
+
export default useCoreOptions;
|
package/dist/LmTable/util.d.ts
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
* 列分组数据转换
|
|
3
3
|
* @param columns 表格的columns属性值
|
|
4
4
|
* @param dataSource 表格数据源
|
|
5
|
-
* @param
|
|
5
|
+
* @param groupColKeys 列分组的keys
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
|
-
export function transformWithColGroup(columns: any, dataSource: any,
|
|
8
|
+
export function transformWithColGroup(columns: any, dataSource: any, groupColKeys: any): {
|
|
9
9
|
columns: any;
|
|
10
10
|
dataSource: any;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* 行分组
|
|
14
14
|
* @param {Array} dataSource 数据源
|
|
15
|
-
* @param {Array}
|
|
15
|
+
* @param {Array} groupRowKeys 行分组的keys
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
|
-
export function transformWithRowGroup(dataSource: any[],
|
|
18
|
+
export function transformWithRowGroup(dataSource: any[], groupRowKeys: any[]): any;
|
|
19
19
|
export function checkIsSelectd(i: any, j: any, start?: {}, end?: {}): boolean;
|
|
20
20
|
export function checkStatus(i: any, j: any, commiting: any): {
|
|
21
21
|
/** 是否有效拉伸 */
|
|
@@ -44,4 +44,10 @@ export function getSelectionRowText({ selection, columnsKeysList, dataSource }:
|
|
|
44
44
|
* @returns {Array}
|
|
45
45
|
*/
|
|
46
46
|
export function getSelectionColText({ selection, columns, dataSource }: any): any[];
|
|
47
|
+
/**
|
|
48
|
+
* 获取key所对应的原始数据的索引
|
|
49
|
+
* @param {Object} {key, dataSource}
|
|
50
|
+
* @returns {number}
|
|
51
|
+
*/
|
|
52
|
+
export function getDataSourceIndex({ key, dataSource }: any): number;
|
|
47
53
|
export function range(start: number, end: number): Array<number>;
|
package/dist/index.umd.js
CHANGED
|
@@ -92727,7 +92727,8 @@
|
|
|
92727
92727
|
dataSource = props.dataSource,
|
|
92728
92728
|
searchKey = props.searchKey,
|
|
92729
92729
|
searchConfig = props.searchConfig,
|
|
92730
|
-
customOptions = props.customOptions
|
|
92730
|
+
customOptions = props.customOptions,
|
|
92731
|
+
enableAutoString = props.enableAutoString; // 转换一级查询结构 object => array
|
|
92731
92732
|
|
|
92732
92733
|
var tranformGlobalQuery = React.useCallback(function (obj) {
|
|
92733
92734
|
var _Object$keys3;
|
|
@@ -92756,8 +92757,7 @@
|
|
|
92756
92757
|
var tranformQuery = React.useCallback(function (_ref2) {
|
|
92757
92758
|
var _Object$keys4, _Object$keys5;
|
|
92758
92759
|
|
|
92759
|
-
var
|
|
92760
|
-
customFilter = _ref2$customFilter === void 0 ? {} : _ref2$customFilter,
|
|
92760
|
+
var customFilter = _ref2.customFilter,
|
|
92761
92761
|
_ref2$searchQuery = _ref2.searchQuery,
|
|
92762
92762
|
searchQuery = _ref2$searchQuery === void 0 ? {} : _ref2$searchQuery,
|
|
92763
92763
|
_ref2$basicQuery = _ref2.basicQuery,
|
|
@@ -93053,15 +93053,17 @@
|
|
|
93053
93053
|
var field = item.field;
|
|
93054
93054
|
|
|
93055
93055
|
if (field) {
|
|
93056
|
-
//
|
|
93057
|
-
var
|
|
93056
|
+
// 将结果转换为字符串
|
|
93057
|
+
var stringValue = enableAutoString ? String(itemValue) : itemValue; // 基础查询数据(受控数据)
|
|
93058
|
+
|
|
93059
|
+
var basicFilter = _objectSpread(_objectSpread({}, state.basicFilter), {}, _defineProperty$1({}, field, stringValue)); // 外部查询数据结构
|
|
93058
93060
|
|
|
93059
93061
|
|
|
93060
93062
|
var basicQuery = _objectSpread(_objectSpread({}, state.basicQuery), {}, _defineProperty$1({}, field, {
|
|
93061
93063
|
fieldName: field,
|
|
93062
93064
|
fieldType: item.valueType || 'string',
|
|
93063
93065
|
type: item.type,
|
|
93064
|
-
value: Array.isArray(
|
|
93066
|
+
value: Array.isArray(stringValue) ? stringValue : [stringValue],
|
|
93065
93067
|
operator: item.operator || 'equal'
|
|
93066
93068
|
})); // 数据清除时不返回结构体
|
|
93067
93069
|
|
|
@@ -93126,7 +93128,7 @@
|
|
|
93126
93128
|
});
|
|
93127
93129
|
}, [props]); // 模糊查询结构
|
|
93128
93130
|
|
|
93129
|
-
var setSearchFilter = React.useCallback(function (itemValue
|
|
93131
|
+
var setSearchFilter = React.useCallback(function (itemValue) {
|
|
93130
93132
|
var searchFilter = searchKey === null || searchKey === void 0 ? void 0 : searchKey.reduce(function (pre, cur) {
|
|
93131
93133
|
pre[cur] = itemValue;
|
|
93132
93134
|
return pre;
|
|
@@ -93427,6 +93429,8 @@
|
|
|
93427
93429
|
// 是否启用自定义筛选
|
|
93428
93430
|
enableClear: true,
|
|
93429
93431
|
// 是否展示一件清空
|
|
93432
|
+
enableAutoString: true,
|
|
93433
|
+
// 是否自动将筛选结构值转换为字符串
|
|
93430
93434
|
size: 'middle',
|
|
93431
93435
|
// 尺寸
|
|
93432
93436
|
searchKey: 'search',
|
|
@@ -232941,13 +232945,16 @@
|
|
|
232941
232945
|
|
|
232942
232946
|
var renderEditor = function renderEditor() {
|
|
232943
232947
|
if (isEditing) {
|
|
232948
|
+
console.log(isEditing, '-----isEditing-----');
|
|
232944
232949
|
var Editor = (col === null || col === void 0 ? void 0 : col.dataEditor) || InputDataEdit;
|
|
232945
232950
|
return /*#__PURE__*/React__default['default'].createElement(Editor, {
|
|
232946
232951
|
cell: col,
|
|
232947
232952
|
row: rowIndex,
|
|
232948
232953
|
col: colIndex,
|
|
232949
232954
|
value: value,
|
|
232950
|
-
onChange:
|
|
232955
|
+
onChange: function onChange(value) {
|
|
232956
|
+
setValue(value);
|
|
232957
|
+
},
|
|
232951
232958
|
handleSave: saveRenderValue
|
|
232952
232959
|
});
|
|
232953
232960
|
}
|
|
@@ -232959,12 +232966,11 @@
|
|
|
232959
232966
|
var content = renderComponent() || renderEditor() || renderViewer;
|
|
232960
232967
|
return /*#__PURE__*/React__default['default'].createElement("td", _objectSpread(_objectSpread({}, lodash.omit(clearProps, ['commitIng', 'editIng'])), {}, {
|
|
232961
232968
|
// style={{ userSelect: 'none' }}
|
|
232962
|
-
className: classnames('unselection', sd && selectIng && 'selected', isEnd && 'end', isRightEnd && 'right_end', isEditing && 'editing', isVaildCommit && 'commiting'),
|
|
232969
|
+
className: classnames(colIndex === undefined && 'row_selection_td', 'unselection', sd && selectIng && 'selected', isEnd && 'end', isRightEnd && 'right_end', isEditing && 'editing', isVaildCommit && 'commiting'),
|
|
232963
232970
|
onMouseDown: handleMouseDown,
|
|
232964
232971
|
onMouseOver: handleMouseOver,
|
|
232965
232972
|
onContextMenu: handleContextMenu,
|
|
232966
232973
|
onDoubleClick: handleDoubleClick,
|
|
232967
|
-
// onKeyUp={onKeyUp}
|
|
232968
232974
|
key: "".concat(rowIndex, "_").concat(colIndex)
|
|
232969
232975
|
}), content, isRightEnd && isEnd && !isEditing && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
232970
232976
|
ref: endCellRef,
|
|
@@ -303603,13 +303609,13 @@
|
|
|
303603
303609
|
* 列分组数据转换
|
|
303604
303610
|
* @param columns 表格的columns属性值
|
|
303605
303611
|
* @param dataSource 表格数据源
|
|
303606
|
-
* @param
|
|
303612
|
+
* @param groupColKeys 列分组的keys
|
|
303607
303613
|
* @returns
|
|
303608
303614
|
*/
|
|
303609
303615
|
|
|
303610
303616
|
|
|
303611
|
-
function transformWithColGroup(columns, dataSource,
|
|
303612
|
-
if (!Array.isArray(
|
|
303617
|
+
function transformWithColGroup(columns, dataSource, groupColKeys) {
|
|
303618
|
+
if (!Array.isArray(groupColKeys) || !groupColKeys.length) {
|
|
303613
303619
|
return {
|
|
303614
303620
|
columns: columns,
|
|
303615
303621
|
dataSource: dataSource
|
|
@@ -303621,7 +303627,7 @@
|
|
|
303621
303627
|
var dataSourceCopy = lodash.cloneDeep(dataSource); // 去重
|
|
303622
303628
|
|
|
303623
303629
|
|
|
303624
|
-
var
|
|
303630
|
+
var groupColKeysCopy = _toConsumableArray$1(new Set(groupColKeys));
|
|
303625
303631
|
/**
|
|
303626
303632
|
* @param {Array} source source数据源,树状结构,行分组会有children子级结构
|
|
303627
303633
|
* @param {Array} columns 列数据,用于表头,当列分组时会有children子级结构
|
|
@@ -303639,7 +303645,7 @@
|
|
|
303639
303645
|
source.forEach(function (souItem, i) {
|
|
303640
303646
|
handledColumns = handledColumns.concat(columns.filter(function (c) {
|
|
303641
303647
|
// 过滤掉(表头操作) 使用列分组作为key的项
|
|
303642
|
-
return
|
|
303648
|
+
return groupColKeysCopy.indexOf(c.dataIndex) === -1;
|
|
303643
303649
|
}).map(function (item) {
|
|
303644
303650
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
303645
303651
|
dataIndex: "".concat(markStr, "_").concat(item.dataIndex, "_").concat(i)
|
|
@@ -303664,7 +303670,7 @@
|
|
|
303664
303670
|
});
|
|
303665
303671
|
};
|
|
303666
303672
|
|
|
303667
|
-
var tempColumns = groupBy(dataSourceCopy, columnsCopy,
|
|
303673
|
+
var tempColumns = groupBy(dataSourceCopy, columnsCopy, groupColKeysCopy, null);
|
|
303668
303674
|
var keyMap = new Map();
|
|
303669
303675
|
|
|
303670
303676
|
var dataSourceBy = function dataSourceBy(source) {
|
|
@@ -303680,7 +303686,7 @@
|
|
|
303680
303686
|
} else {
|
|
303681
303687
|
var str = ''; // 根据筛选条件生成对应的前缀key值,比如[name, age] => 'name_xiaoming_age_18'
|
|
303682
303688
|
|
|
303683
|
-
|
|
303689
|
+
groupColKeysCopy.forEach(function (dataIndex, i) {
|
|
303684
303690
|
if (i !== 0) {
|
|
303685
303691
|
str += '_';
|
|
303686
303692
|
}
|
|
@@ -303701,6 +303707,7 @@
|
|
|
303701
303707
|
}
|
|
303702
303708
|
|
|
303703
303709
|
sItem[newKey] = sItem[key];
|
|
303710
|
+
sItem["".concat(newKey, "_originIndex")] = sItem.__index;
|
|
303704
303711
|
});
|
|
303705
303712
|
}
|
|
303706
303713
|
|
|
@@ -303721,31 +303728,43 @@
|
|
|
303721
303728
|
/**
|
|
303722
303729
|
* 行分组
|
|
303723
303730
|
* @param {Array} dataSource 数据源
|
|
303724
|
-
* @param {Array}
|
|
303731
|
+
* @param {Array} groupRowKeys 行分组的keys
|
|
303725
303732
|
* @returns
|
|
303726
303733
|
*/
|
|
303727
303734
|
|
|
303728
|
-
function transformWithRowGroup(dataSource,
|
|
303729
|
-
var groupBy = function groupBy(lastFilter, oGroup) {
|
|
303735
|
+
function transformWithRowGroup(dataSource, groupRowKeys) {
|
|
303736
|
+
var groupBy = function groupBy(lastFilter, oGroup, preKey) {
|
|
303730
303737
|
if (!(oGroup === null || oGroup === void 0 ? void 0 : oGroup.length)) return lastFilter;
|
|
303731
303738
|
var group = oGroup.slice();
|
|
303732
|
-
var filterKey = group.shift();
|
|
303739
|
+
var filterKey = group.shift(); // i:保证顺序
|
|
303740
|
+
|
|
303741
|
+
var i = 0;
|
|
303733
303742
|
var map = lastFilter.reduce(function (acc, el) {
|
|
303743
|
+
el.__index = i;
|
|
303744
|
+
i += 1;
|
|
303734
303745
|
var value = el[filterKey];
|
|
303735
303746
|
acc[value] = [].concat(_toConsumableArray$1(acc[value] || []), [el]);
|
|
303736
303747
|
return acc;
|
|
303737
303748
|
}, {});
|
|
303738
303749
|
return Object.keys(map).map(function (item) {
|
|
303750
|
+
var key;
|
|
303751
|
+
|
|
303752
|
+
if (preKey) {
|
|
303753
|
+
key = "".concat(preKey, "_").concat(filterKey, "_").concat(item);
|
|
303754
|
+
} else {
|
|
303755
|
+
key = "".concat(filterKey, "_").concat(item);
|
|
303756
|
+
}
|
|
303757
|
+
|
|
303739
303758
|
return {
|
|
303740
303759
|
type: filterKey,
|
|
303741
303760
|
_group: item,
|
|
303742
|
-
key:
|
|
303743
|
-
children: groupBy(map[item], group)
|
|
303761
|
+
key: key,
|
|
303762
|
+
children: groupBy(map[item], group, key)
|
|
303744
303763
|
};
|
|
303745
303764
|
});
|
|
303746
303765
|
};
|
|
303747
303766
|
|
|
303748
|
-
return groupBy(dataSource,
|
|
303767
|
+
return groupBy(dataSource, groupRowKeys);
|
|
303749
303768
|
}
|
|
303750
303769
|
function checkIsSelectd(i, j) {
|
|
303751
303770
|
var start = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -303777,10 +303796,10 @@
|
|
|
303777
303796
|
function getSkipList(dataSourceWithGroup) {
|
|
303778
303797
|
var skipList = dataSourceWithGroup.reduce(function (prev, cur) {
|
|
303779
303798
|
if (!prev.length) {
|
|
303780
|
-
return cur.
|
|
303799
|
+
return cur._group ? [1] : [0];
|
|
303781
303800
|
}
|
|
303782
303801
|
|
|
303783
|
-
if (cur.
|
|
303802
|
+
if (cur._group) {
|
|
303784
303803
|
return [].concat(_toConsumableArray$1(prev), [prev[prev.length - 1] + 1]);
|
|
303785
303804
|
}
|
|
303786
303805
|
|
|
@@ -303842,6 +303861,44 @@
|
|
|
303842
303861
|
});
|
|
303843
303862
|
return coltext;
|
|
303844
303863
|
}
|
|
303864
|
+
/**
|
|
303865
|
+
* 获取key所对应的原始数据的索引
|
|
303866
|
+
* @param {Object} {key, dataSource}
|
|
303867
|
+
* @returns {number}
|
|
303868
|
+
*/
|
|
303869
|
+
|
|
303870
|
+
function getDataSourceIndex(_ref3) {
|
|
303871
|
+
var key = _ref3.key,
|
|
303872
|
+
_ref3$dataSource = _ref3.dataSource,
|
|
303873
|
+
dataSource = _ref3$dataSource === void 0 ? [] : _ref3$dataSource;
|
|
303874
|
+
var index = -1;
|
|
303875
|
+
|
|
303876
|
+
var dfs = function dfs(arr) {
|
|
303877
|
+
if (!Array.isArray(arr)) {
|
|
303878
|
+
return;
|
|
303879
|
+
}
|
|
303880
|
+
|
|
303881
|
+
if (index !== -1) {
|
|
303882
|
+
return;
|
|
303883
|
+
}
|
|
303884
|
+
|
|
303885
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
303886
|
+
var item = arr[i];
|
|
303887
|
+
|
|
303888
|
+
if (item["".concat(key, "_originIndex")] !== undefined) {
|
|
303889
|
+
index = item["".concat(key, "_originIndex")];
|
|
303890
|
+
return;
|
|
303891
|
+
}
|
|
303892
|
+
|
|
303893
|
+
if (item.children) {
|
|
303894
|
+
dfs(item.children);
|
|
303895
|
+
}
|
|
303896
|
+
}
|
|
303897
|
+
};
|
|
303898
|
+
|
|
303899
|
+
dfs(dataSource);
|
|
303900
|
+
return index;
|
|
303901
|
+
}
|
|
303845
303902
|
|
|
303846
303903
|
// 表格基础配置文件
|
|
303847
303904
|
// 行选择
|
|
@@ -304113,7 +304170,7 @@
|
|
|
304113
304170
|
}), fixedColumns.fixedRight);
|
|
304114
304171
|
});
|
|
304115
304172
|
|
|
304116
|
-
var _excluded$29 = ["columns", "dataSource", "autoSize", "rowClick", "onDoubleClick", "checkConfig", "summary", "pagination", "hiddenPage", "loading", "virtual", "sortOpen", "colSortOpen", "resizeable", "customCheck", "components", "rowSelection", "columnsState", "onChange", "filterChange", "tableRowType", "size", "openSheet", "editSheet", "dataChange", "
|
|
304173
|
+
var _excluded$29 = ["columns", "dataSource", "autoSize", "rowClick", "onDoubleClick", "checkConfig", "summary", "pagination", "hiddenPage", "loading", "virtual", "sortOpen", "colSortOpen", "resizeable", "customCheck", "components", "rowSelection", "columnsState", "onChange", "filterChange", "tableRowType", "size", "openSheet", "editSheet", "dataChange", "groupRowKeys", "groupColKeys", "emptyProps"],
|
|
304117
304174
|
_excluded2$w = ["className", "style"],
|
|
304118
304175
|
_excluded3$7 = ["onResize", "width", "onResizeStop"];
|
|
304119
304176
|
var Summary$1 = ProviderWarp.Summary;
|
|
@@ -304184,9 +304241,9 @@
|
|
|
304184
304241
|
_props$editSheet = props.editSheet,
|
|
304185
304242
|
editSheet = _props$editSheet === void 0 ? false : _props$editSheet,
|
|
304186
304243
|
dataChange = props.dataChange,
|
|
304187
|
-
|
|
304244
|
+
groupRowKeys = props.groupRowKeys,
|
|
304245
|
+
groupColKeys = props.groupColKeys,
|
|
304188
304246
|
emptyProps = props.emptyProps,
|
|
304189
|
-
columnKeys = props.columnKeys,
|
|
304190
304247
|
resetProps = _objectWithoutProperties$1(props, _excluded$29);
|
|
304191
304248
|
|
|
304192
304249
|
var _resetProps$rowKey = resetProps.rowKey,
|
|
@@ -304225,6 +304282,12 @@
|
|
|
304225
304282
|
|
|
304226
304283
|
var deepDataSourceRef = React.useRef([]);
|
|
304227
304284
|
var deepColumnsRef = React.useRef([]);
|
|
304285
|
+
/** 行分组表格对应数据的隐藏数列表 */
|
|
304286
|
+
|
|
304287
|
+
var hideListRef = React.useRef([]);
|
|
304288
|
+
/** 行分组的空行列表数据 */
|
|
304289
|
+
|
|
304290
|
+
var skipListRef = React.useRef([]);
|
|
304228
304291
|
/** 记录最原始数据 */
|
|
304229
304292
|
|
|
304230
304293
|
React.useEffect(function () {
|
|
@@ -304233,30 +304296,33 @@
|
|
|
304233
304296
|
/** 行分组 */
|
|
304234
304297
|
|
|
304235
304298
|
var groupDataSource = React.useMemo(function () {
|
|
304236
|
-
if (!(
|
|
304299
|
+
if (!(groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length)) {
|
|
304237
304300
|
return customizeDataSource;
|
|
304238
304301
|
}
|
|
304239
304302
|
|
|
304240
|
-
return transformWithRowGroup(customizeDataSource,
|
|
304241
|
-
}, [customizeDataSource,
|
|
304303
|
+
return transformWithRowGroup(customizeDataSource, groupRowKeys);
|
|
304304
|
+
}, [customizeDataSource, groupRowKeys]);
|
|
304242
304305
|
/** 列分组 */
|
|
304243
304306
|
|
|
304244
304307
|
var _useMemo = React.useMemo(function () {
|
|
304245
|
-
if (!(
|
|
304308
|
+
if (!(groupColKeys === null || groupColKeys === void 0 ? void 0 : groupColKeys.length)) {
|
|
304246
304309
|
return {
|
|
304247
304310
|
dataSource: groupDataSource,
|
|
304248
304311
|
columns: customizeColumns
|
|
304249
304312
|
};
|
|
304250
304313
|
}
|
|
304251
304314
|
|
|
304252
|
-
return transformWithColGroup(customizeColumns, groupDataSource,
|
|
304253
|
-
}, [customizeColumns, groupDataSource,
|
|
304315
|
+
return transformWithColGroup(customizeColumns, groupDataSource, groupColKeys);
|
|
304316
|
+
}, [customizeColumns, groupDataSource, groupColKeys]),
|
|
304254
304317
|
columns = _useMemo.columns,
|
|
304255
304318
|
dataSource = _useMemo.dataSource;
|
|
304256
304319
|
|
|
304257
304320
|
React.useEffect(function () {
|
|
304258
304321
|
setExpandedRowKeys([]);
|
|
304259
|
-
|
|
304322
|
+
deepDataSourceRef.current = [];
|
|
304323
|
+
deepColumnsRef.current = [];
|
|
304324
|
+
hideListRef.current = [];
|
|
304325
|
+
}, [groupRowKeys]);
|
|
304260
304326
|
/** sheel数据的表格 */
|
|
304261
304327
|
|
|
304262
304328
|
var _useState9 = React.useState({
|
|
@@ -304340,18 +304406,46 @@
|
|
|
304340
304406
|
React.useEffect(function () {
|
|
304341
304407
|
var source = [];
|
|
304342
304408
|
|
|
304409
|
+
var dfs = function dfs(children) {
|
|
304410
|
+
var num = 0;
|
|
304411
|
+
children.forEach(function (item) {
|
|
304412
|
+
if (item.children) {
|
|
304413
|
+
num += dfs(item.children);
|
|
304414
|
+
} else {
|
|
304415
|
+
num += 1;
|
|
304416
|
+
}
|
|
304417
|
+
});
|
|
304418
|
+
return num;
|
|
304419
|
+
};
|
|
304420
|
+
|
|
304421
|
+
var hideList = [];
|
|
304422
|
+
|
|
304343
304423
|
var deepChildren = function deepChildren(arr) {
|
|
304344
304424
|
arr.forEach(function (item) {
|
|
304345
304425
|
source.push(lodash.omit(item, 'children'));
|
|
304426
|
+
var prev = hideList.length ? hideList[hideList.length - 1] : 0; // 展开
|
|
304346
304427
|
|
|
304347
304428
|
if ((item === null || item === void 0 ? void 0 : item.children) && expandedRowKeys.includes(item.key)) {
|
|
304429
|
+
hideList.push(prev);
|
|
304348
304430
|
deepChildren(item === null || item === void 0 ? void 0 : item.children);
|
|
304431
|
+
} // 隐藏
|
|
304432
|
+
|
|
304433
|
+
|
|
304434
|
+
if ((item === null || item === void 0 ? void 0 : item.children) && !expandedRowKeys.includes(item.key)) {
|
|
304435
|
+
var count = dfs(item.children);
|
|
304436
|
+
hideList.push(count + prev);
|
|
304437
|
+
}
|
|
304438
|
+
|
|
304439
|
+
if (!(item === null || item === void 0 ? void 0 : item.children)) {
|
|
304440
|
+
hideList.push(prev);
|
|
304349
304441
|
}
|
|
304350
304442
|
});
|
|
304351
304443
|
};
|
|
304352
304444
|
|
|
304353
304445
|
deepChildren(dataSource);
|
|
304354
304446
|
deepDataSourceRef.current = source;
|
|
304447
|
+
hideListRef.current = hideList;
|
|
304448
|
+
skipListRef.current = getSkipList((groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length) ? deepDataSourceRef.current : dataSource);
|
|
304355
304449
|
}, [dataSource, expandedRowKeys]); // 列分组数据铺平,在框选时获取数据使用
|
|
304356
304450
|
|
|
304357
304451
|
React.useEffect(function () {
|
|
@@ -304369,7 +304463,7 @@
|
|
|
304369
304463
|
|
|
304370
304464
|
deepChildren(columns);
|
|
304371
304465
|
deepColumnsRef.current = source;
|
|
304372
|
-
}, [columns,
|
|
304466
|
+
}, [columns, groupColKeys]);
|
|
304373
304467
|
|
|
304374
304468
|
var onSortEnd = function onSortEnd(_ref) {
|
|
304375
304469
|
var oldIndex = _ref.oldIndex,
|
|
@@ -304475,8 +304569,8 @@
|
|
|
304475
304569
|
return range$1(start.j, end.j).map(function (j) {
|
|
304476
304570
|
var _columns$j, _columns$j2;
|
|
304477
304571
|
|
|
304478
|
-
var columnKey = (
|
|
304479
|
-
var dataItem = (
|
|
304572
|
+
var columnKey = (groupColKeys === null || groupColKeys === void 0 ? void 0 : groupColKeys.length) ? deepColumnsRef.current[j].dataIndex : (_columns$j = columns[j]) === null || _columns$j === void 0 ? void 0 : _columns$j.dataIndex;
|
|
304573
|
+
var dataItem = (groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length) ? deepDataSourceRef.current[i] : dataSource[i];
|
|
304480
304574
|
var cell = dataItem === null || dataItem === void 0 ? void 0 : dataItem[columnKey];
|
|
304481
304575
|
|
|
304482
304576
|
if ((_columns$j2 = columns[j]) === null || _columns$j2 === void 0 ? void 0 : _columns$j2.render) {
|
|
@@ -304573,14 +304667,13 @@
|
|
|
304573
304667
|
end = _shellStatusRef$curre10.end,
|
|
304574
304668
|
commiting = _shellStatusRef$curre10.commiting; //
|
|
304575
304669
|
|
|
304576
|
-
var innerColumns = (
|
|
304577
|
-
var innerDataSource = (
|
|
304670
|
+
var innerColumns = (groupColKeys === null || groupColKeys === void 0 ? void 0 : groupColKeys.length) ? deepColumnsRef.current : columns;
|
|
304671
|
+
var innerDataSource = (groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length) ? deepDataSourceRef.current : dataSource; //
|
|
304578
304672
|
|
|
304579
304673
|
var columnsKeysList = innerColumns.map(function (item) {
|
|
304580
304674
|
return item.dataIndex;
|
|
304581
|
-
}); //
|
|
304675
|
+
}); // 空行值数组
|
|
304582
304676
|
|
|
304583
|
-
var skipList = getSkipList(innerDataSource);
|
|
304584
304677
|
var rowtext = getSelectionRowText({
|
|
304585
304678
|
selection: commiting,
|
|
304586
304679
|
columnsKeysList: columnsKeysList,
|
|
@@ -304633,9 +304726,20 @@
|
|
|
304633
304726
|
|
|
304634
304727
|
if ((_isSelected = isSelected(tri, tdj)) === null || _isSelected === void 0 ? void 0 : _isSelected.isSelected) {
|
|
304635
304728
|
var key = columnsKeysList[tdj];
|
|
304636
|
-
var sourceIndex
|
|
304729
|
+
var sourceIndex; // 列分组的情况下
|
|
304637
304730
|
|
|
304638
|
-
if (
|
|
304731
|
+
if (groupColKeys === null || groupColKeys === void 0 ? void 0 : groupColKeys.length) {
|
|
304732
|
+
sourceIndex = getDataSourceIndex({
|
|
304733
|
+
key: key,
|
|
304734
|
+
dataSource: dataSource
|
|
304735
|
+
});
|
|
304736
|
+
var arr = key.split('_');
|
|
304737
|
+
key = arr[arr.length - 2];
|
|
304738
|
+
} else {
|
|
304739
|
+
sourceIndex = tri - skipListRef.current[tri] + hideListRef.current[tri];
|
|
304740
|
+
}
|
|
304741
|
+
|
|
304742
|
+
if (sourceIndex < 0 || sourceIndex >= data.length) {
|
|
304639
304743
|
return;
|
|
304640
304744
|
} // 行替换
|
|
304641
304745
|
|
|
@@ -304721,9 +304825,8 @@
|
|
|
304721
304825
|
pasteData = parse(window.clipboardData.getData('Text'));
|
|
304722
304826
|
} else if (e.clipboardData && e.clipboardData.getData) {
|
|
304723
304827
|
pasteData = parse(e.clipboardData.getData('text/plain'));
|
|
304724
|
-
}
|
|
304828
|
+
} // in order of preference
|
|
304725
304829
|
|
|
304726
|
-
var data = dataSourceRef.current; // in order of preference
|
|
304727
304830
|
|
|
304728
304831
|
var resultEnd = [];
|
|
304729
304832
|
pasteData.forEach(function (row, i) {
|
|
@@ -304900,8 +305003,10 @@
|
|
|
304900
305003
|
};
|
|
304901
305004
|
|
|
304902
305005
|
var dataSourceChange = function dataSourceChange(i, j, newRecord) {
|
|
305006
|
+
// 表格中的行数 转化为 对应的数据源索引
|
|
305007
|
+
var rowIndex = i - skipListRef.current[i] + hideListRef.current[i];
|
|
304903
305008
|
var res = fn(dataSourceRef.current, function (draft) {
|
|
304904
|
-
draft[
|
|
305009
|
+
draft[rowIndex] = newRecord;
|
|
304905
305010
|
});
|
|
304906
305011
|
dataChange === null || dataChange === void 0 ? void 0 : dataChange(res);
|
|
304907
305012
|
shellStatusRef.current = _objectSpread(_objectSpread({}, shellStatusRef.current), {}, {
|
|
@@ -304974,18 +305079,19 @@
|
|
|
304974
305079
|
var innerColumns = lodash.cloneDeep(useColumns);
|
|
304975
305080
|
traverseColumns(innerColumns);
|
|
304976
305081
|
|
|
304977
|
-
if (
|
|
305082
|
+
if (groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length) {
|
|
304978
305083
|
/** 如果是进行了行分组,则会生成一列dataIndex为Group的Col, 如果需要修改此处,请备注原因 */
|
|
304979
305084
|
innerColumns = [{
|
|
304980
305085
|
type: 'name',
|
|
304981
305086
|
title: '分组',
|
|
305087
|
+
dataIndex: '_group',
|
|
304982
305088
|
key: '_group',
|
|
304983
|
-
|
|
305089
|
+
width: 100
|
|
304984
305090
|
}].concat(_toConsumableArray$1(innerColumns));
|
|
304985
305091
|
}
|
|
304986
305092
|
|
|
304987
305093
|
return sortOpen ? [sortDefaultColumnItem].concat(_toConsumableArray$1(innerColumns)) : innerColumns;
|
|
304988
|
-
}, [useColumns, sortOpen, selectIng, dataSource,
|
|
305094
|
+
}, [useColumns, sortOpen, selectIng, dataSource, groupRowKeys, commitIng]);
|
|
304989
305095
|
React.useEffect(function () {
|
|
304990
305096
|
setColumns(columns);
|
|
304991
305097
|
}, [columns]); // 行点击事件
|
|
@@ -305077,8 +305183,8 @@
|
|
|
305077
305183
|
}),
|
|
305078
305184
|
|
|
305079
305185
|
/** 如果开启了行分组,则需要把checkStrictly关闭,变成受控模式 */
|
|
305080
|
-
checkStrictly: !
|
|
305081
|
-
onChange: function onChange(selectedRowKeys, selectedRows
|
|
305186
|
+
checkStrictly: !(groupRowKeys === null || groupRowKeys === void 0 ? void 0 : groupRowKeys.length),
|
|
305187
|
+
onChange: function onChange(selectedRowKeys, selectedRows) {
|
|
305082
305188
|
console.log(selectedRows, '----selectedRows');
|
|
305083
305189
|
setSelectedRows({
|
|
305084
305190
|
selectedRows: selectedRows
|
|
@@ -305088,7 +305194,7 @@
|
|
|
305088
305194
|
}, rowSelection),
|
|
305089
305195
|
onRow: function onRow(record) {
|
|
305090
305196
|
return {
|
|
305091
|
-
onClick: function onClick(
|
|
305197
|
+
onClick: function onClick() {
|
|
305092
305198
|
onRecord(record);
|
|
305093
305199
|
},
|
|
305094
305200
|
onDoubleClick: function onDoubleClick() {
|
|
@@ -305290,7 +305396,7 @@
|
|
|
305290
305396
|
dataSource: dataSource,
|
|
305291
305397
|
components: tableComponents,
|
|
305292
305398
|
onChange: onTableChange,
|
|
305293
|
-
expandable: {
|
|
305399
|
+
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
305294
305400
|
onExpand: function onExpand() {
|
|
305295
305401
|
shellStatusRef.current = {
|
|
305296
305402
|
start: {},
|
|
@@ -305316,7 +305422,7 @@
|
|
|
305316
305422
|
dataSource: dataSource,
|
|
305317
305423
|
components: tableComponents,
|
|
305318
305424
|
onChange: onTableChange,
|
|
305319
|
-
expandable: {
|
|
305425
|
+
expandable: (resetProps === null || resetProps === void 0 ? void 0 : resetProps.expandable) || {
|
|
305320
305426
|
onExpand: function onExpand() {
|
|
305321
305427
|
shellStatusRef.current = {
|
|
305322
305428
|
start: {},
|
|
@@ -305428,8 +305534,7 @@
|
|
|
305428
305534
|
return h;
|
|
305429
305535
|
}, [props.hiddenPage, props.customCheck, props.columns, tableSize]);
|
|
305430
305536
|
var throttleSize = React.useCallback(function () {
|
|
305431
|
-
var width = tableSize.width
|
|
305432
|
-
height = tableSize.height;
|
|
305537
|
+
var width = tableSize.width;
|
|
305433
305538
|
return /*#__PURE__*/React__default['default'].createElement(ResetTable, _extends$2({
|
|
305434
305539
|
ref: defaultRef
|
|
305435
305540
|
}, props, {
|