@ccs-ui/rc-pro 2.3.6-beta-15 → 2.3.6-beta-16
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/es/context/index.d.ts +0 -2
- package/es/dialog/button.d.ts +1 -1
- package/es/hooks/use-app.d.ts +0 -2
- package/es/hooks/use-app.js +2 -2
- package/es/pro-table/table.d.ts +2 -1
- package/es/pro-table/table.js +44 -25
- package/package.json +1 -1
package/es/context/index.d.ts
CHANGED
package/es/dialog/button.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type DialogButtonsProps<T> = Pick<CcsDialogModalProps, 'okText' | 'onClos
|
|
|
16
16
|
export type DialogButtonRef = {
|
|
17
17
|
onSetButtons: (e: React.ReactElement) => void;
|
|
18
18
|
};
|
|
19
|
-
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "auth" | "request" | "
|
|
19
|
+
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "auth" | "request" | "onClose" | "onOk" | "extraBtn" | "requestFieldNames" | "preventRequestHandle"> & {
|
|
20
20
|
formRef: React.RefObject<DialogFormRef<TParams>>;
|
|
21
21
|
formInitialValues: FormProps['initialValues'];
|
|
22
22
|
buttonRef: RefObject<DialogButtonRef>;
|
package/es/hooks/use-app.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ declare const useAppConfig: () => import("../context").CssAppConfigType;
|
|
|
6
6
|
export declare const useProTableFields: () => {
|
|
7
7
|
dataSource: string[];
|
|
8
8
|
total: string[];
|
|
9
|
-
current: string[];
|
|
10
|
-
pageSize: string[];
|
|
11
9
|
};
|
|
12
10
|
export declare const useProTableTreeFields: () => {
|
|
13
11
|
dataSource: string[];
|
package/es/hooks/use-app.js
CHANGED
|
@@ -23,8 +23,8 @@ export var useProTableFields = function useProTableFields() {
|
|
|
23
23
|
var context = useContext(AppConfigContext) || {};
|
|
24
24
|
return _objectSpread({
|
|
25
25
|
dataSource: ['data', 'result'],
|
|
26
|
-
current: ['data', 'pageNo'],
|
|
27
|
-
pageSize: ['data', 'pageSize'],
|
|
26
|
+
// current: ['data', 'pageNo'],
|
|
27
|
+
// pageSize: ['data', 'pageSize'],
|
|
28
28
|
total: ['data', 'totalNum']
|
|
29
29
|
}, context === null || context === void 0 || (_context$fieldNames = context.fieldNames) === null || _context$fieldNames === void 0 ? void 0 : _context$fieldNames.proTable);
|
|
30
30
|
};
|
package/es/pro-table/table.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ type TableTitleType<T> = {
|
|
|
24
24
|
data: T[];
|
|
25
25
|
onClear: () => void;
|
|
26
26
|
};
|
|
27
|
+
/** 请求参数类型 */
|
|
27
28
|
export type CcsRequestProps = {
|
|
28
29
|
pageNo?: number;
|
|
29
30
|
pageSize?: number;
|
|
@@ -39,7 +40,7 @@ export type CcsTableProps<T> = Omit<TableProps<T>, 'columns' | 'title'> & {
|
|
|
39
40
|
data?: CCS.TableData<T>;
|
|
40
41
|
/** request 方法 */
|
|
41
42
|
request?: (params: CcsRequestProps) => Promise<any>;
|
|
42
|
-
/** request 额外参数
|
|
43
|
+
/** request 额外参数 */
|
|
43
44
|
requestParam?: ParamType;
|
|
44
45
|
/** 接口字段指定,默认: */
|
|
45
46
|
fieldNames?: CcsFieldNamesType;
|
package/es/pro-table/table.js
CHANGED
|
@@ -31,6 +31,8 @@ import HeadComponent from "./head";
|
|
|
31
31
|
import "./index.less";
|
|
32
32
|
import TableOperation from "./operation";
|
|
33
33
|
import TableTree from "./tree";
|
|
34
|
+
|
|
35
|
+
/** 请求参数类型 */
|
|
34
36
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
35
37
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
36
38
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -176,11 +178,12 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
176
178
|
var formValues,
|
|
177
179
|
pageValue,
|
|
178
180
|
params,
|
|
181
|
+
_filtersRef$current,
|
|
182
|
+
filters,
|
|
183
|
+
orderProps,
|
|
179
184
|
_treeRef$current,
|
|
180
185
|
requestResult,
|
|
181
186
|
dataSource,
|
|
182
|
-
_pageSize,
|
|
183
|
-
current,
|
|
184
187
|
total,
|
|
185
188
|
_args = arguments;
|
|
186
189
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -198,75 +201,91 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
198
201
|
}
|
|
199
202
|
});
|
|
200
203
|
}
|
|
204
|
+
|
|
205
|
+
// 构建请求参数
|
|
201
206
|
pageValue = pagination === false ? {} : {
|
|
202
207
|
pageNo: pageNo,
|
|
203
208
|
pageSize: pageSize
|
|
204
209
|
};
|
|
205
|
-
params = _objectSpread(_objectSpread(
|
|
210
|
+
params = _objectSpread(_objectSpread({
|
|
206
211
|
query: _objectSpread(_objectSpread({}, requestParam), formValues)
|
|
207
|
-
}, pageValue),
|
|
212
|
+
}, pageValue), {}, {
|
|
208
213
|
eventType: eventType
|
|
209
|
-
}); //
|
|
214
|
+
}); // 列过滤或排序参数
|
|
215
|
+
_filtersRef$current = filtersRef.current, filters = _filtersRef$current.filters, orderProps = _filtersRef$current.orderProps;
|
|
216
|
+
if (Object.keys(filters).length > 0) {
|
|
217
|
+
params.filters = filters;
|
|
218
|
+
}
|
|
219
|
+
if (orderProps.length > 0) {
|
|
220
|
+
params.orderProps = orderProps;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// 异步树
|
|
210
224
|
if (!parentFieldName) {
|
|
211
|
-
_context.next =
|
|
225
|
+
_context.next = 10;
|
|
212
226
|
break;
|
|
213
227
|
}
|
|
214
228
|
(_treeRef$current = treeRef.current) === null || _treeRef$current === void 0 || _treeRef$current.onRequestTree(params.query, record);
|
|
215
229
|
return _context.abrupt("return");
|
|
216
|
-
case
|
|
230
|
+
case 10:
|
|
217
231
|
// 发起请求
|
|
218
232
|
setData(function (d) {
|
|
219
233
|
return _objectSpread(_objectSpread({}, d), {}, {
|
|
220
234
|
loading: true
|
|
221
235
|
});
|
|
222
236
|
});
|
|
223
|
-
_context.next =
|
|
237
|
+
_context.next = 13;
|
|
224
238
|
return httpRequest(params);
|
|
225
|
-
case
|
|
239
|
+
case 13:
|
|
226
240
|
requestResult = _context.sent;
|
|
227
241
|
if (!requestResult) {
|
|
228
|
-
_context.next =
|
|
242
|
+
_context.next = 23;
|
|
229
243
|
break;
|
|
230
244
|
}
|
|
231
245
|
// 获取table数据
|
|
232
|
-
dataSource = getDataFromFields(requestResult, fieldNames.dataSource);
|
|
233
|
-
|
|
234
|
-
|
|
246
|
+
dataSource = getDataFromFields(requestResult, fieldNames.dataSource); // const pageSize = getDataFromFields(
|
|
247
|
+
// requestResult,
|
|
248
|
+
// fieldNames.pageSize,
|
|
249
|
+
// );
|
|
250
|
+
// const current = getDataFromFields(requestResult, fieldNames.current);
|
|
235
251
|
total = getDataFromFields(requestResult, fieldNames.total);
|
|
236
|
-
if (!(total === undefined ||
|
|
237
|
-
|
|
252
|
+
if (!(total === undefined ||
|
|
253
|
+
// pageSize === undefined ||
|
|
254
|
+
// current === undefined ||
|
|
255
|
+
dataSource === undefined)) {
|
|
256
|
+
_context.next = 20;
|
|
238
257
|
break;
|
|
239
258
|
}
|
|
240
259
|
setData({
|
|
241
260
|
dataSource: dataSource,
|
|
242
|
-
pageSize:
|
|
243
|
-
current:
|
|
261
|
+
pageSize: pageSize,
|
|
262
|
+
current: pageNo,
|
|
244
263
|
total: total,
|
|
245
264
|
loading: false
|
|
246
265
|
});
|
|
247
266
|
return _context.abrupt("return");
|
|
248
|
-
case
|
|
267
|
+
case 20:
|
|
249
268
|
// 当前页无数据,返回上一页
|
|
250
|
-
if (!dataSource.length &&
|
|
251
|
-
onRequest('reload',
|
|
269
|
+
if (!dataSource.length && pageNo !== 1) {
|
|
270
|
+
onRequest('reload', pageNo - 1);
|
|
252
271
|
} else {
|
|
253
272
|
setData({
|
|
254
|
-
current:
|
|
255
|
-
pageSize:
|
|
273
|
+
current: pageNo,
|
|
274
|
+
pageSize: pageSize,
|
|
256
275
|
loading: false,
|
|
257
276
|
dataSource: dataSource,
|
|
258
277
|
total: total || 0
|
|
259
278
|
});
|
|
260
279
|
}
|
|
261
|
-
_context.next =
|
|
280
|
+
_context.next = 24;
|
|
262
281
|
break;
|
|
263
|
-
case
|
|
282
|
+
case 23:
|
|
264
283
|
setData(function (d) {
|
|
265
284
|
return _objectSpread(_objectSpread({}, d), {}, {
|
|
266
285
|
loading: false
|
|
267
286
|
});
|
|
268
287
|
});
|
|
269
|
-
case
|
|
288
|
+
case 24:
|
|
270
289
|
case "end":
|
|
271
290
|
return _context.stop();
|
|
272
291
|
}
|