@ccs-ui/rc-pro 2.3.6-beta-32 → 2.3.6-beta-34

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.
@@ -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" | "onOk" | "onClose" | "extraBtn" | "requestFieldNames" | "preventRequestHandle"> & {
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>;
@@ -25,9 +25,10 @@ type TableTitleType<T> = {
25
25
  data: T[];
26
26
  onClear: () => void;
27
27
  };
28
- /** 请求参数类型 */
29
28
  export type CcsTableProps<T> = Omit<TableProps<T>, 'columns' | 'title'> & {
30
29
  data?: CCS.TableData<T>;
30
+ /** 为空时,默认一条数据 */
31
+ emptyDefaultOne?: boolean;
31
32
  /** request 方法 */
32
33
  request?: (params: any) => Promise<any>;
33
34
  /** request 额外参数 */
@@ -49,17 +49,6 @@ function onSetObj(target, paths, value) {
49
49
  }
50
50
  }
51
51
  }
52
-
53
- /** 请求参数类型 */
54
- // export type CcsRequestProps = {
55
- // pageNo?: number;
56
- // pageSize?: number;
57
- // query?: Record<string, any>;
58
- // filters?: Record<string, any>;
59
- // orderProps?: { prop: string; ascending: boolean }[];
60
- // eventType?: SearchEventType;
61
- // };
62
-
63
52
  export var classPrefix = 'ccs-pl';
64
53
  export var TableSelectionContext = /*#__PURE__*/React.createContext({
65
54
  selectedRows: undefined
@@ -276,14 +265,17 @@ var InternalProTable = function InternalProTable(props) {
276
265
  case 23:
277
266
  requestResult = _context.sent;
278
267
  if (!requestResult) {
279
- _context.next = 33;
268
+ _context.next = 34;
280
269
  break;
281
270
  }
282
271
  // 获取table数据
283
- dataSource = getDataFromFields(requestResult, fieldNames.dataSource);
272
+ dataSource = getDataFromFields(requestResult, fieldNames.dataSource); // 默认添加一条数据
273
+ if (dataSource.length === 0 && table !== null && table !== void 0 && table.emptyDefaultOne) {
274
+ dataSource.push(_defineProperty({}, rowKey || 'id', '0'));
275
+ }
284
276
  total = getDataFromFields(requestResult, fieldNames.total);
285
277
  if (!(total === undefined || dataSource === undefined)) {
286
- _context.next = 30;
278
+ _context.next = 31;
287
279
  break;
288
280
  }
289
281
  setData({
@@ -294,7 +286,7 @@ var InternalProTable = function InternalProTable(props) {
294
286
  loading: false
295
287
  });
296
288
  return _context.abrupt("return");
297
- case 30:
289
+ case 31:
298
290
  // 当前页无数据,返回上一页
299
291
  if (!dataSource.length && pageNo !== 1) {
300
292
  onRequest('reload', pageNo - 1);
@@ -307,15 +299,15 @@ var InternalProTable = function InternalProTable(props) {
307
299
  total: total || 0
308
300
  });
309
301
  }
310
- _context.next = 34;
302
+ _context.next = 35;
311
303
  break;
312
- case 33:
304
+ case 34:
313
305
  setData(function (d) {
314
306
  return _objectSpread(_objectSpread({}, d), {}, {
315
307
  loading: false
316
308
  });
317
309
  });
318
- case 34:
310
+ case 35:
319
311
  case "end":
320
312
  return _context.stop();
321
313
  }
@@ -113,6 +113,7 @@ export default function CcsApiSelect(_ref) {
113
113
  loading: loading,
114
114
  style: {
115
115
  width: '100%'
116
- }
116
+ },
117
+ optionFilterProp: "label"
117
118
  }, restProps));
118
119
  }
package/es/table/index.js CHANGED
@@ -202,13 +202,16 @@ var CustomTable = function CustomTable(props) {
202
202
  };
203
203
  var _theme$useToken = theme.useToken(),
204
204
  token = _theme$useToken.token;
205
+ var tableRowKey = function tableRowKey(_, index) {
206
+ return index || 0;
207
+ };
205
208
  return /*#__PURE__*/_jsx("div", {
206
209
  className: "ccs-table-card",
207
210
  style: _objectSpread(_objectSpread({}, style), {}, {
208
211
  background: token.colorBgContainer
209
212
  }),
210
213
  children: /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({
211
- rowKey: rowKey,
214
+ rowKey: rowKey || tableRowKey,
212
215
  dataSource: dataSource,
213
216
  pagination: pagination === false ? false : _objectSpread({
214
217
  total: total,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "2.3.6-beta-32",
3
+ "version": "2.3.6-beta-34",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": {