@faasjs/ant-design 0.0.2-beta.356 → 0.0.2-beta.360

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/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import * as react_use_lib_misc_hookState from 'react-use/lib/misc/hookState';
2
- import { DescriptionsProps, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, FormProps as FormProps$1, TableColumnProps, TableProps as TableProps$1 } from 'antd';
2
+ import { DescriptionsProps, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, FormProps as FormProps$1, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1 } from 'antd';
3
3
  export { Drawer } from 'antd';
4
4
  import { FaasDataWrapperProps } from '@faasjs/react';
5
5
  import * as antd_lib_form_Form from 'antd/lib/form/Form';
6
6
  import { RuleObject } from 'rc-field-form/lib/interface';
7
7
  import { LazyExoticComponent, ComponentType } from 'react';
8
8
  import { RouteProps } from 'react-router-dom';
9
+ import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/lib/table/interface';
9
10
 
10
11
  declare type BlankProps = {
11
12
  value?: any;
@@ -18,6 +19,7 @@ declare type FaasState = {
18
19
  blank: string;
19
20
  all: string;
20
21
  submit: string;
22
+ pageNotFound: string;
21
23
  };
22
24
  Blank: {
23
25
  text: string;
@@ -158,6 +160,7 @@ declare type RoutesProps = {
158
160
  routes: (RouteProps & {
159
161
  page?: LazyExoticComponent<ComponentType<any>>;
160
162
  })[];
163
+ fallback?: JSX.Element;
161
164
  notFound?: JSX.Element;
162
165
  };
163
166
  declare function Routes(props: RoutesProps): JSX.Element;
@@ -177,6 +180,12 @@ declare type TableProps<T = any, ExtendTypes = any> = {
177
180
  [key: string]: ExtendTableTypeProps;
178
181
  };
179
182
  faasData?: FaasDataWrapperProps<T>;
183
+ onChange?: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<T> | SorterResult<T>[], extra: TableCurrentDataSource<T>) => {
184
+ pagination: TablePaginationConfig;
185
+ filters: Record<string, FilterValue | null>;
186
+ sorter: SorterResult<T> | SorterResult<T>[];
187
+ extra: TableCurrentDataSource<T>;
188
+ };
180
189
  } & TableProps$1<T>;
181
190
  declare function Table<T = any, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): JSX.Element;
182
191
 
package/dist/index.js CHANGED
@@ -70,11 +70,17 @@ var import_lodash = require("lodash");
70
70
  // src/Config.tsx
71
71
  var import_react2 = require("react");
72
72
  var import_react_use = require("react-use");
73
- var _a, _b, _c;
74
- var common = {
75
- blank: ((_a = navigator.language) == null ? void 0 : _a.includes("CN")) ? "\u7A7A" : "Empty",
76
- all: ((_b = navigator.language) == null ? void 0 : _b.includes("CN")) ? "\u5168\u90E8" : "All",
77
- submit: ((_c = navigator.language) == null ? void 0 : _c.includes("CN")) ? "\u63D0\u4EA4" : "Submit"
73
+ var isCN = /^zh/i.test(navigator.language);
74
+ var common = isCN ? {
75
+ blank: "\u7A7A",
76
+ all: "\u5168\u90E8",
77
+ submit: "\u63D0\u4EA4",
78
+ pageNotFound: "\u9875\u9762\u672A\u627E\u5230"
79
+ } : {
80
+ blank: "Empty",
81
+ all: "All",
82
+ submit: "Submit",
83
+ pageNotFound: "Page Not Found"
78
84
  };
79
85
  var useFaasState = (0, import_react_use.createGlobalState)({
80
86
  common,
@@ -121,23 +127,23 @@ var import_react4 = require("@faasjs/react");
121
127
  function DescriptionItemContent(props) {
122
128
  const [computedProps, setComputedProps] = (0, import_react3.useState)();
123
129
  (0, import_react3.useEffect)(() => {
124
- var _a2, _b2;
130
+ var _a, _b;
125
131
  const propsCopy = __spreadValues({}, props);
126
132
  if (!propsCopy.item.title)
127
133
  propsCopy.item.title = (0, import_lodash3.upperFirst)(propsCopy.item.id);
128
134
  if (!propsCopy.item.type)
129
135
  propsCopy.item.type = "string";
130
- if ((_a2 = propsCopy.item.options) == null ? void 0 : _a2.length) {
136
+ if ((_a = propsCopy.item.options) == null ? void 0 : _a.length) {
131
137
  propsCopy.item.options = transferOptions(propsCopy.item.options);
132
138
  }
133
139
  if (propsCopy.item.options && typeof propsCopy.value !== "undefined" && propsCopy.value !== null) {
134
140
  if (propsCopy.item.type.endsWith("[]"))
135
141
  propsCopy.value = propsCopy.value.map((v) => {
136
- var _a3;
137
- return ((_a3 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a3.label) || v;
142
+ var _a2;
143
+ return ((_a2 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
138
144
  });
139
145
  else
140
- propsCopy.value = ((_b2 = props.item.options.find((option) => option.value === props.value)) == null ? void 0 : _b2.label) || props.value;
146
+ propsCopy.value = ((_b = props.item.options.find((option) => option.value === props.value)) == null ? void 0 : _b.label) || props.value;
141
147
  }
142
148
  setComputedProps(propsCopy);
143
149
  }, [props]);
@@ -194,6 +200,11 @@ function Description(props) {
194
200
  extendTypes: props.extendTypes
195
201
  }))));
196
202
  return /* @__PURE__ */ import_react.default.createElement(import_react4.FaasDataWrapper, __spreadValues({
203
+ fallback: props.faasData.fallback || /* @__PURE__ */ import_react.default.createElement("div", {
204
+ style: { padding: "24px" }
205
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd2.Skeleton, {
206
+ active: true
207
+ })),
197
208
  render: ({ data }) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions.Item, {
198
209
  key: item.id,
199
210
  label: item.title || (0, import_lodash3.upperFirst)(item.id)
@@ -334,11 +345,11 @@ function FormItem(props) {
334
345
  name: computedProps.name,
335
346
  rules: computedProps.rules
336
347
  }, (fields, { add, remove }, { errors }) => {
337
- var _a2;
348
+ var _a;
338
349
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, computedProps.label && /* @__PURE__ */ import_react.default.createElement("div", {
339
350
  className: "ant-form-item-label"
340
351
  }, /* @__PURE__ */ import_react.default.createElement("label", {
341
- className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required"
352
+ className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required"
342
353
  }, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
343
354
  key: field.key
344
355
  }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Row, {
@@ -375,7 +386,7 @@ function FormItem(props) {
375
386
 
376
387
  // src/Form.tsx
377
388
  function Form(props) {
378
- var _a2, _b2;
389
+ var _a, _b;
379
390
  const [loading, setLoading] = (0, import_react7.useState)(false);
380
391
  const [computedProps, setComputedProps] = (0, import_react7.useState)();
381
392
  const [config] = useFaasState();
@@ -396,7 +407,7 @@ function Form(props) {
396
407
  }, []);
397
408
  if (!computedProps)
398
409
  return null;
399
- return /* @__PURE__ */ import_react.default.createElement(import_antd5.Form, __spreadValues({}, computedProps), (_a2 = props.items) == null ? void 0 : _a2.map((item) => /* @__PURE__ */ import_react.default.createElement(FormItem, __spreadProps(__spreadValues({
410
+ return /* @__PURE__ */ import_react.default.createElement(import_antd5.Form, __spreadValues({}, computedProps), (_a = props.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ import_react.default.createElement(FormItem, __spreadProps(__spreadValues({
400
411
  key: item.id
401
412
  }, item), {
402
413
  extendTypes: props.extendTypes
@@ -404,7 +415,7 @@ function Form(props) {
404
415
  htmlType: "submit",
405
416
  type: "primary",
406
417
  loading
407
- }, ((_b2 = props.submit) == null ? void 0 : _b2.text) || config.Form.submit.text));
418
+ }, ((_b = props.submit) == null ? void 0 : _b.text) || config.Form.submit.text));
408
419
  }
409
420
  Form.useForm = import_antd5.Form.useForm;
410
421
  Form.Item = FormItem;
@@ -413,11 +424,11 @@ Form.Item = FormItem;
413
424
  var import_antd6 = require("antd");
414
425
  var import_react8 = require("react");
415
426
  var import_react_router_dom = require("react-router-dom");
416
- function NoMatch() {
427
+ function NotFound() {
428
+ const [config] = useFaasState();
417
429
  return /* @__PURE__ */ import_react.default.createElement(import_antd6.Result, {
418
430
  status: "404",
419
- title: "404",
420
- subTitle: "Page not found"
431
+ title: config.common.pageNotFound
421
432
  });
422
433
  }
423
434
  function Routes(props) {
@@ -425,14 +436,16 @@ function Routes(props) {
425
436
  key: r.path
426
437
  }, r), {
427
438
  element: r.element || /* @__PURE__ */ import_react.default.createElement(import_react8.Suspense, {
428
- fallback: /* @__PURE__ */ import_react.default.createElement(import_antd6.Skeleton, {
439
+ fallback: props.fallback || /* @__PURE__ */ import_react.default.createElement("div", {
440
+ style: { padding: "24px" }
441
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd6.Skeleton, {
429
442
  active: true
430
- })
443
+ }))
431
444
  }, /* @__PURE__ */ import_react.default.createElement(r.page, null))
432
445
  }))), /* @__PURE__ */ import_react.default.createElement(import_react_router_dom.Route, {
433
446
  key: "*",
434
447
  path: "*",
435
- element: props.notFound || /* @__PURE__ */ import_react.default.createElement(NoMatch, null)
448
+ element: props.notFound || /* @__PURE__ */ import_react.default.createElement(NotFound, null)
436
449
  }));
437
450
  }
438
451
 
@@ -443,15 +456,15 @@ var import_icons3 = require("@ant-design/icons");
443
456
  var import_lodash5 = require("lodash");
444
457
  var import_react10 = require("@faasjs/react");
445
458
  function processValue(item, value) {
446
- var _a2;
459
+ var _a;
447
460
  if (item.options && typeof value !== "undefined" && value !== null) {
448
461
  if (item.type.endsWith("[]"))
449
462
  return value.map((v) => {
450
- var _a3;
451
- return ((_a3 = item.options.find((option) => option.value === v)) == null ? void 0 : _a3.label) || v;
463
+ var _a2;
464
+ return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
452
465
  });
453
466
  else
454
- return ((_a2 = item.options.find((option) => option.value === value)) == null ? void 0 : _a2.label) || value;
467
+ return ((_a = item.options.find((option) => option.value === value)) == null ? void 0 : _a.label) || value;
455
468
  }
456
469
  return value;
457
470
  }
@@ -459,7 +472,7 @@ function Table(props) {
459
472
  const [columns, setColumns] = (0, import_react9.useState)();
460
473
  const [config] = useFaasState();
461
474
  (0, import_react9.useEffect)(() => {
462
- var _a2;
475
+ var _a;
463
476
  for (const item of props.items) {
464
477
  if (!item.key)
465
478
  item.key = item.id;
@@ -469,7 +482,7 @@ function Table(props) {
469
482
  item.title = (0, import_lodash5.upperFirst)(item.id);
470
483
  if (!item.type)
471
484
  item.type = "string";
472
- if ((_a2 = item.options) == null ? void 0 : _a2.length) {
485
+ if ((_a = item.options) == null ? void 0 : _a.length) {
473
486
  item.options = transferOptions(item.options);
474
487
  item.filters = item.options.map((o) => ({
475
488
  text: o.label,
@@ -584,6 +597,11 @@ function Table(props) {
584
597
  dataSource: props.dataSource
585
598
  }));
586
599
  return /* @__PURE__ */ import_react.default.createElement(import_react10.FaasDataWrapper, __spreadValues({
600
+ fallback: props.faasData.fallback || /* @__PURE__ */ import_react.default.createElement("div", {
601
+ style: { padding: "24px" }
602
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd7.Skeleton, {
603
+ active: true
604
+ })),
587
605
  render: ({
588
606
  data,
589
607
  params,
@@ -605,8 +623,17 @@ function Table(props) {
605
623
  rowKey: props.rowKey || "id",
606
624
  columns,
607
625
  dataSource: data.rows,
608
- pagination: data.pagination,
609
- onChange: (pagination, filters, sorter) => {
626
+ pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
627
+ onChange: (pagination, filters, sorter, extra) => {
628
+ if (props.onChange) {
629
+ const processed = props.onChange(pagination, filters, sorter, extra);
630
+ reload(__spreadProps(__spreadValues({}, params), {
631
+ pagination: processed.pagination,
632
+ filters: processed.filters,
633
+ sorter: processed.sorter
634
+ }));
635
+ return;
636
+ }
610
637
  reload(__spreadProps(__spreadValues({}, params), {
611
638
  pagination,
612
639
  filters,
package/dist/index.mjs CHANGED
@@ -28,11 +28,17 @@ import { isNil } from "lodash";
28
28
  // src/Config.tsx
29
29
  import { useEffect } from "react";
30
30
  import { createGlobalState } from "react-use";
31
- var _a, _b, _c;
32
- var common = {
33
- blank: ((_a = navigator.language) == null ? void 0 : _a.includes("CN")) ? "\u7A7A" : "Empty",
34
- all: ((_b = navigator.language) == null ? void 0 : _b.includes("CN")) ? "\u5168\u90E8" : "All",
35
- submit: ((_c = navigator.language) == null ? void 0 : _c.includes("CN")) ? "\u63D0\u4EA4" : "Submit"
31
+ var isCN = /^zh/i.test(navigator.language);
32
+ var common = isCN ? {
33
+ blank: "\u7A7A",
34
+ all: "\u5168\u90E8",
35
+ submit: "\u63D0\u4EA4",
36
+ pageNotFound: "\u9875\u9762\u672A\u627E\u5230"
37
+ } : {
38
+ blank: "Empty",
39
+ all: "All",
40
+ submit: "Submit",
41
+ pageNotFound: "Page Not Found"
36
42
  };
37
43
  var useFaasState = createGlobalState({
38
44
  common,
@@ -72,7 +78,10 @@ function transferOptions(options) {
72
78
 
73
79
  // src/Description.tsx
74
80
  import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
75
- import { Descriptions } from "antd";
81
+ import {
82
+ Descriptions,
83
+ Skeleton
84
+ } from "antd";
76
85
  import { upperFirst as upperFirst2 } from "lodash";
77
86
  import {
78
87
  cloneElement,
@@ -83,23 +92,23 @@ import { FaasDataWrapper } from "@faasjs/react";
83
92
  function DescriptionItemContent(props) {
84
93
  const [computedProps, setComputedProps] = useState();
85
94
  useEffect2(() => {
86
- var _a2, _b2;
95
+ var _a, _b;
87
96
  const propsCopy = __spreadValues({}, props);
88
97
  if (!propsCopy.item.title)
89
98
  propsCopy.item.title = upperFirst2(propsCopy.item.id);
90
99
  if (!propsCopy.item.type)
91
100
  propsCopy.item.type = "string";
92
- if ((_a2 = propsCopy.item.options) == null ? void 0 : _a2.length) {
101
+ if ((_a = propsCopy.item.options) == null ? void 0 : _a.length) {
93
102
  propsCopy.item.options = transferOptions(propsCopy.item.options);
94
103
  }
95
104
  if (propsCopy.item.options && typeof propsCopy.value !== "undefined" && propsCopy.value !== null) {
96
105
  if (propsCopy.item.type.endsWith("[]"))
97
106
  propsCopy.value = propsCopy.value.map((v) => {
98
- var _a3;
99
- return ((_a3 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a3.label) || v;
107
+ var _a2;
108
+ return ((_a2 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
100
109
  });
101
110
  else
102
- propsCopy.value = ((_b2 = props.item.options.find((option) => option.value === props.value)) == null ? void 0 : _b2.label) || props.value;
111
+ propsCopy.value = ((_b = props.item.options.find((option) => option.value === props.value)) == null ? void 0 : _b.label) || props.value;
103
112
  }
104
113
  setComputedProps(propsCopy);
105
114
  }, [props]);
@@ -156,6 +165,11 @@ function Description(props) {
156
165
  extendTypes: props.extendTypes
157
166
  }))));
158
167
  return /* @__PURE__ */ React.createElement(FaasDataWrapper, __spreadValues({
168
+ fallback: props.faasData.fallback || /* @__PURE__ */ React.createElement("div", {
169
+ style: { padding: "24px" }
170
+ }, /* @__PURE__ */ React.createElement(Skeleton, {
171
+ active: true
172
+ })),
159
173
  render: ({ data }) => /* @__PURE__ */ React.createElement(Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ React.createElement(Descriptions.Item, {
160
174
  key: item.id,
161
175
  label: item.title || upperFirst2(item.id)
@@ -308,11 +322,11 @@ function FormItem(props) {
308
322
  name: computedProps.name,
309
323
  rules: computedProps.rules
310
324
  }, (fields, { add, remove }, { errors }) => {
311
- var _a2;
325
+ var _a;
312
326
  return /* @__PURE__ */ React.createElement(React.Fragment, null, computedProps.label && /* @__PURE__ */ React.createElement("div", {
313
327
  className: "ant-form-item-label"
314
328
  }, /* @__PURE__ */ React.createElement("label", {
315
- className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required"
329
+ className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required"
316
330
  }, computedProps.label)), fields.map((field) => /* @__PURE__ */ React.createElement(AntdForm.Item, {
317
331
  key: field.key
318
332
  }, /* @__PURE__ */ React.createElement(Row, {
@@ -349,7 +363,7 @@ function FormItem(props) {
349
363
 
350
364
  // src/Form.tsx
351
365
  function Form(props) {
352
- var _a2, _b2;
366
+ var _a, _b;
353
367
  const [loading, setLoading] = useState4(false);
354
368
  const [computedProps, setComputedProps] = useState4();
355
369
  const [config] = useFaasState();
@@ -370,7 +384,7 @@ function Form(props) {
370
384
  }, []);
371
385
  if (!computedProps)
372
386
  return null;
373
- return /* @__PURE__ */ React.createElement(AntdForm2, __spreadValues({}, computedProps), (_a2 = props.items) == null ? void 0 : _a2.map((item) => /* @__PURE__ */ React.createElement(FormItem, __spreadProps(__spreadValues({
387
+ return /* @__PURE__ */ React.createElement(AntdForm2, __spreadValues({}, computedProps), (_a = props.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ React.createElement(FormItem, __spreadProps(__spreadValues({
374
388
  key: item.id
375
389
  }, item), {
376
390
  extendTypes: props.extendTypes
@@ -378,13 +392,13 @@ function Form(props) {
378
392
  htmlType: "submit",
379
393
  type: "primary",
380
394
  loading
381
- }, ((_b2 = props.submit) == null ? void 0 : _b2.text) || config.Form.submit.text));
395
+ }, ((_b = props.submit) == null ? void 0 : _b.text) || config.Form.submit.text));
382
396
  }
383
397
  Form.useForm = AntdForm2.useForm;
384
398
  Form.Item = FormItem;
385
399
 
386
400
  // src/Routers.tsx
387
- import { Result, Skeleton } from "antd";
401
+ import { Result, Skeleton as Skeleton2 } from "antd";
388
402
  import {
389
403
  Suspense
390
404
  } from "react";
@@ -392,11 +406,11 @@ import {
392
406
  Routes as OriginRoutes,
393
407
  Route
394
408
  } from "react-router-dom";
395
- function NoMatch() {
409
+ function NotFound() {
410
+ const [config] = useFaasState();
396
411
  return /* @__PURE__ */ React.createElement(Result, {
397
412
  status: "404",
398
- title: "404",
399
- subTitle: "Page not found"
413
+ title: config.common.pageNotFound
400
414
  });
401
415
  }
402
416
  function Routes(props) {
@@ -404,14 +418,16 @@ function Routes(props) {
404
418
  key: r.path
405
419
  }, r), {
406
420
  element: r.element || /* @__PURE__ */ React.createElement(Suspense, {
407
- fallback: /* @__PURE__ */ React.createElement(Skeleton, {
421
+ fallback: props.fallback || /* @__PURE__ */ React.createElement("div", {
422
+ style: { padding: "24px" }
423
+ }, /* @__PURE__ */ React.createElement(Skeleton2, {
408
424
  active: true
409
- })
425
+ }))
410
426
  }, /* @__PURE__ */ React.createElement(r.page, null))
411
427
  }))), /* @__PURE__ */ React.createElement(Route, {
412
428
  key: "*",
413
429
  path: "*",
414
- element: props.notFound || /* @__PURE__ */ React.createElement(NoMatch, null)
430
+ element: props.notFound || /* @__PURE__ */ React.createElement(NotFound, null)
415
431
  }));
416
432
  }
417
433
 
@@ -423,21 +439,22 @@ import {
423
439
  } from "react";
424
440
  import {
425
441
  Table as AntdTable,
426
- Radio
442
+ Radio,
443
+ Skeleton as Skeleton3
427
444
  } from "antd";
428
445
  import { CheckOutlined as CheckOutlined2, CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
429
446
  import { isNil as isNil2, upperFirst as upperFirst4 } from "lodash";
430
447
  import { FaasDataWrapper as FaasDataWrapper2 } from "@faasjs/react";
431
448
  function processValue(item, value) {
432
- var _a2;
449
+ var _a;
433
450
  if (item.options && typeof value !== "undefined" && value !== null) {
434
451
  if (item.type.endsWith("[]"))
435
452
  return value.map((v) => {
436
- var _a3;
437
- return ((_a3 = item.options.find((option) => option.value === v)) == null ? void 0 : _a3.label) || v;
453
+ var _a2;
454
+ return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
438
455
  });
439
456
  else
440
- return ((_a2 = item.options.find((option) => option.value === value)) == null ? void 0 : _a2.label) || value;
457
+ return ((_a = item.options.find((option) => option.value === value)) == null ? void 0 : _a.label) || value;
441
458
  }
442
459
  return value;
443
460
  }
@@ -445,7 +462,7 @@ function Table(props) {
445
462
  const [columns, setColumns] = useState5();
446
463
  const [config] = useFaasState();
447
464
  useEffect5(() => {
448
- var _a2;
465
+ var _a;
449
466
  for (const item of props.items) {
450
467
  if (!item.key)
451
468
  item.key = item.id;
@@ -455,7 +472,7 @@ function Table(props) {
455
472
  item.title = upperFirst4(item.id);
456
473
  if (!item.type)
457
474
  item.type = "string";
458
- if ((_a2 = item.options) == null ? void 0 : _a2.length) {
475
+ if ((_a = item.options) == null ? void 0 : _a.length) {
459
476
  item.options = transferOptions(item.options);
460
477
  item.filters = item.options.map((o) => ({
461
478
  text: o.label,
@@ -570,6 +587,11 @@ function Table(props) {
570
587
  dataSource: props.dataSource
571
588
  }));
572
589
  return /* @__PURE__ */ React.createElement(FaasDataWrapper2, __spreadValues({
590
+ fallback: props.faasData.fallback || /* @__PURE__ */ React.createElement("div", {
591
+ style: { padding: "24px" }
592
+ }, /* @__PURE__ */ React.createElement(Skeleton3, {
593
+ active: true
594
+ })),
573
595
  render: ({
574
596
  data,
575
597
  params,
@@ -591,8 +613,17 @@ function Table(props) {
591
613
  rowKey: props.rowKey || "id",
592
614
  columns,
593
615
  dataSource: data.rows,
594
- pagination: data.pagination,
595
- onChange: (pagination, filters, sorter) => {
616
+ pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
617
+ onChange: (pagination, filters, sorter, extra) => {
618
+ if (props.onChange) {
619
+ const processed = props.onChange(pagination, filters, sorter, extra);
620
+ reload(__spreadProps(__spreadValues({}, params), {
621
+ pagination: processed.pagination,
622
+ filters: processed.filters,
623
+ sorter: processed.sorter
624
+ }));
625
+ return;
626
+ }
596
627
  reload(__spreadProps(__spreadValues({}, params), {
597
628
  pagination,
598
629
  filters,
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.356",
3
+ "version": "0.0.2-beta.360",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
6
7
  "types": "dist/index.d.ts",
7
8
  "homepage": "https://faasjs.com/doc/ant-design.html",
8
9
  "repository": {
@@ -27,7 +28,7 @@
27
28
  "lodash": "*",
28
29
  "react": "*",
29
30
  "react-dom": "*",
30
- "@faasjs/react": "^0.0.2-beta.356",
31
+ "@faasjs/react": "^0.0.2-beta.360",
31
32
  "react-use": "*",
32
33
  "react-router-dom": "*"
33
34
  },