ztxkui 10.0.92 → 10.0.94
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.
|
@@ -931,6 +931,35 @@ var TableDemo = function () {
|
|
|
931
931
|
React.createElement(Button, { onClick: function () {
|
|
932
932
|
setRecords(function (state) { return __spreadArray([], state); });
|
|
933
933
|
} }, "clearKeys")),
|
|
934
|
+
React.createElement("div", null,
|
|
935
|
+
React.createElement("button", { onClick: function () { return console.log(records); } }, "\u83B7\u53D6\u6570\u636E"),
|
|
936
|
+
React.createElement(Button, { loading: btnLoading, onClick: function () {
|
|
937
|
+
console.log(111);
|
|
938
|
+
(function () {
|
|
939
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
940
|
+
var err_2, errorFields;
|
|
941
|
+
return __generator(this, function (_a) {
|
|
942
|
+
switch (_a.label) {
|
|
943
|
+
case 0:
|
|
944
|
+
_a.trys.push([0, 2, , 3]);
|
|
945
|
+
return [4 /*yield*/, tableHandleRef.current.validate()];
|
|
946
|
+
case 1:
|
|
947
|
+
_a.sent();
|
|
948
|
+
return [3 /*break*/, 3];
|
|
949
|
+
case 2:
|
|
950
|
+
err_2 = _a.sent();
|
|
951
|
+
console.log(err_2);
|
|
952
|
+
errorFields = err_2.errorFields;
|
|
953
|
+
if (errorFields) {
|
|
954
|
+
message.warning(errorFields[0].errors + '');
|
|
955
|
+
}
|
|
956
|
+
return [3 /*break*/, 3];
|
|
957
|
+
case 3: return [2 /*return*/];
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
});
|
|
961
|
+
})();
|
|
962
|
+
} }, "\u70B9\u51FB")),
|
|
934
963
|
React.createElement(Table
|
|
935
964
|
// 如果需要保留本地偏好,那么这里需要预处理一下columns数据
|
|
936
965
|
// columns={getTableLayoutFullData(columns, tableLayout)}
|
|
@@ -946,7 +975,7 @@ var TableDemo = function () {
|
|
|
946
975
|
showColumnDynamic: true, showColumnDynamicKey: "testkey",
|
|
947
976
|
// onDynamicChange={onDynamicChange}
|
|
948
977
|
// 表格项可输入
|
|
949
|
-
|
|
978
|
+
onEditableSave: onEditableSaveHandle, virtualTableKey: "virtualTableKey",
|
|
950
979
|
// 新增删除行
|
|
951
980
|
onAddAndDelHandle: onAddAndDelHandle,
|
|
952
981
|
// 表格行拖拽
|
|
@@ -66,6 +66,12 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
|
|
|
66
66
|
* 更新只能通过刷新页面来实现,或者查询条件发生改变
|
|
67
67
|
*/
|
|
68
68
|
isCatch?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* 通过request做接口缓存的时候 isCatch 还会有一些条件过滤
|
|
71
|
+
* 比如page结尾的接口不会缓存 需要传入 mustCatch 才会必须缓存
|
|
72
|
+
* 因为不是所有的接口都是page结尾就不缓存的 所以这里默认使用缓存
|
|
73
|
+
*/
|
|
74
|
+
mustCatch?: boolean;
|
|
69
75
|
/**
|
|
70
76
|
* 数据加载完毕触发
|
|
71
77
|
*/
|
|
@@ -170,6 +176,6 @@ export declare function clearCatchData(url: string): void;
|
|
|
170
176
|
* { code: 200, data: { records: [] } } || { status: 200, data: { code: 200, data: { records: [] } } }
|
|
171
177
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
172
178
|
*/
|
|
173
|
-
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, transformRenderData, joinKey, joinStr, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, isCopy, onBlur, onFocus, isClickRequest, handleRef, isPaste, pasteRule, dropdownRenderBtns, dropdownMatchSelectWidth, onContextMenuCapture, isPinyinSearch, ...restProps }: IProps<VT>): JSX.Element;
|
|
179
|
+
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, mustCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, transformRenderData, joinKey, joinStr, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, isCopy, onBlur, onFocus, isClickRequest, handleRef, isPaste, pasteRule, dropdownRenderBtns, dropdownMatchSelectWidth, onContextMenuCapture, isPinyinSearch, ...restProps }: IProps<VT>): JSX.Element;
|
|
174
180
|
declare const _default: React.MemoExoticComponent<typeof EnhanceSelect>;
|
|
175
181
|
export default _default;
|
|
@@ -168,7 +168,7 @@ function clearNullData(arr, dataKey, titleKey) {
|
|
|
168
168
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
169
169
|
*/
|
|
170
170
|
function EnhanceSelect(_a) {
|
|
171
|
-
var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.timeout, timeout = _c === void 0 ? 60000 : _c, _d = _a.dataKey, dataKey = _d === void 0 ? 'id' : _d, componentKey = _a.componentKey, _e = _a.titleKey, titleKey = _e === void 0 ? 'name' : _e, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, onSearch = _a.onSearch, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _f = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _f === void 0 ? true : _f, transformData = _a.transformData, transformRenderData = _a.transformRenderData, joinKey = _a.joinKey, _g = _a.joinStr, joinStr = _g === void 0 ? '-' : _g, lineFeedKey = _a.lineFeedKey, _h = _a.lineFeedStr, lineFeedStr = _h === void 0 ? '-' : _h, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, searchDeleteKeys = _a.searchDeleteKeys, isHandAddItem = _a.isHandAddItem, isPage = _a.isPage, _j = _a.currentSize, currentSize = _j === void 0 ? 30 : _j, isCopy = _a.isCopy, onBlur = _a.onBlur, onFocus = _a.onFocus, isClickRequest = _a.isClickRequest, handleRef = _a.handleRef, isPaste = _a.isPaste, _k = _a.pasteRule, pasteRule = _k === void 0 ? [',', '-', '\r\n', '\r', '\n', ' '] : _k, dropdownRenderBtns = _a.dropdownRenderBtns, _l = _a.dropdownMatchSelectWidth, dropdownMatchSelectWidth = _l === void 0 ? 150 : _l, onContextMenuCapture = _a.onContextMenuCapture, _m = _a.isPinyinSearch, isPinyinSearch = _m === void 0 ? true : _m, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "transformRenderData", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "mustHasParams", "disabledValues", "searchDeleteKeys", "isHandAddItem", "isPage", "currentSize", "isCopy", "onBlur", "onFocus", "isClickRequest", "handleRef", "isPaste", "pasteRule", "dropdownRenderBtns", "dropdownMatchSelectWidth", "onContextMenuCapture", "isPinyinSearch"]);
|
|
171
|
+
var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.timeout, timeout = _c === void 0 ? 60000 : _c, _d = _a.dataKey, dataKey = _d === void 0 ? 'id' : _d, componentKey = _a.componentKey, _e = _a.titleKey, titleKey = _e === void 0 ? 'name' : _e, showAll = _a.showAll, isCatch = _a.isCatch, mustCatch = _a.mustCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, onSearch = _a.onSearch, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _f = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _f === void 0 ? true : _f, transformData = _a.transformData, transformRenderData = _a.transformRenderData, joinKey = _a.joinKey, _g = _a.joinStr, joinStr = _g === void 0 ? '-' : _g, lineFeedKey = _a.lineFeedKey, _h = _a.lineFeedStr, lineFeedStr = _h === void 0 ? '-' : _h, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, searchDeleteKeys = _a.searchDeleteKeys, isHandAddItem = _a.isHandAddItem, isPage = _a.isPage, _j = _a.currentSize, currentSize = _j === void 0 ? 30 : _j, isCopy = _a.isCopy, onBlur = _a.onBlur, onFocus = _a.onFocus, isClickRequest = _a.isClickRequest, handleRef = _a.handleRef, isPaste = _a.isPaste, _k = _a.pasteRule, pasteRule = _k === void 0 ? [',', '-', '\r\n', '\r', '\n', ' '] : _k, dropdownRenderBtns = _a.dropdownRenderBtns, _l = _a.dropdownMatchSelectWidth, dropdownMatchSelectWidth = _l === void 0 ? 150 : _l, onContextMenuCapture = _a.onContextMenuCapture, _m = _a.isPinyinSearch, isPinyinSearch = _m === void 0 ? true : _m, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "mustCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "transformRenderData", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "mustHasParams", "disabledValues", "searchDeleteKeys", "isHandAddItem", "isPage", "currentSize", "isCopy", "onBlur", "onFocus", "isClickRequest", "handleRef", "isPaste", "pasteRule", "dropdownRenderBtns", "dropdownMatchSelectWidth", "onContextMenuCapture", "isPinyinSearch"]);
|
|
172
172
|
// TODO: 注释动态设置open逻辑 start
|
|
173
173
|
// const currentClick = useRef<boolean>(true);
|
|
174
174
|
// TODO: 注释动态设置open逻辑 end
|
|
@@ -250,7 +250,7 @@ function EnhanceSelect(_a) {
|
|
|
250
250
|
// 利用闭包,存到当前请求的id
|
|
251
251
|
fetchId.current++;
|
|
252
252
|
var fetchIdClosure = fetchId.current;
|
|
253
|
-
getData(request, options)
|
|
253
|
+
getData(request, __assign(__assign({}, options), { mustCatch: mustCatch }))
|
|
254
254
|
.then(function (resData) {
|
|
255
255
|
var _a, _b;
|
|
256
256
|
(_a = otherObj === null || otherObj === void 0 ? void 0 : otherObj.successCallback) === null || _a === void 0 ? void 0 : _a.call(otherObj);
|
|
@@ -291,7 +291,7 @@ function EnhanceSelect(_a) {
|
|
|
291
291
|
},
|
|
292
292
|
// 去掉 transformData 作为依赖,这个会触发副作用
|
|
293
293
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
294
|
-
[setSelectList, setLoading, mustHasParams]);
|
|
294
|
+
[setSelectList, setLoading, mustHasParams, mustCatch]);
|
|
295
295
|
// 分词粘贴
|
|
296
296
|
function pasteHandle(value) {
|
|
297
297
|
if (isPaste && restProps.mode === 'multiple') {
|
|
@@ -361,7 +361,8 @@ function EnhanceSelect(_a) {
|
|
|
361
361
|
searchParams[searchDataKey] = dataKeyValue + '';
|
|
362
362
|
}
|
|
363
363
|
getData(request, __assign({ url: url,
|
|
364
|
-
method: method,
|
|
364
|
+
method: method,
|
|
365
|
+
mustCatch: mustCatch, params: __assign(__assign({ size: Array.isArray(dataKeyValue) && dataKeyValue.length > currentSize
|
|
365
366
|
? dataKeyValue.length
|
|
366
367
|
: currentSize, current: (otherObj === null || otherObj === void 0 ? void 0 : otherObj.currentPage) ? otherObj === null || otherObj === void 0 ? void 0 : otherObj.currentPage : 1 }, outParams), searchParams) }, ((otherObj === null || otherObj === void 0 ? void 0 : otherObj.options) || {})))
|
|
367
368
|
.then(function (resData) {
|
|
@@ -427,6 +428,7 @@ function EnhanceSelect(_a) {
|
|
|
427
428
|
setMultipleList,
|
|
428
429
|
searchDeleteKeys,
|
|
429
430
|
currentSize,
|
|
431
|
+
mustCatch,
|
|
430
432
|
]);
|
|
431
433
|
var searchHandle = function (value) {
|
|
432
434
|
var _a;
|
|
@@ -719,8 +719,7 @@ function Table(props) {
|
|
|
719
719
|
return myScroll;
|
|
720
720
|
}, [scroll, isFlex, virtual]);
|
|
721
721
|
useEffect(function () {
|
|
722
|
-
if (onEditableSave)
|
|
723
|
-
return;
|
|
722
|
+
// if (onEditableSave) return;
|
|
724
723
|
if (virtualTableKey) {
|
|
725
724
|
if (isVirtialInit.current) {
|
|
726
725
|
setVirtual(virtualTableKey);
|
|
@@ -728,7 +727,9 @@ function Table(props) {
|
|
|
728
727
|
isVirtialInit.current = false;
|
|
729
728
|
}
|
|
730
729
|
}
|
|
731
|
-
else if (expandableDataSource &&
|
|
730
|
+
else if (expandableDataSource &&
|
|
731
|
+
(expandableDataSource === null || expandableDataSource === void 0 ? void 0 : expandableDataSource.length) > 400 &&
|
|
732
|
+
!onEditableSave) {
|
|
732
733
|
var key_1 = Math.random().toString(36).slice(-10);
|
|
733
734
|
setVirtual(function (item) {
|
|
734
735
|
return item || key_1;
|