@faasjs/ant-design 0.0.3-beta.69 → 0.0.3-beta.70

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.js CHANGED
@@ -54,7 +54,7 @@ __export(src_exports, {
54
54
  Description: () => Description,
55
55
  Drawer: () => import_antd2.Drawer,
56
56
  ErrorBoundary: () => ErrorBoundary,
57
- FaasDataWrapper: () => FaasDataWrapper2,
57
+ FaasDataWrapper: () => FaasDataWrapper,
58
58
  Form: () => Form,
59
59
  FormItem: () => FormItem,
60
60
  Link: () => Link,
@@ -65,7 +65,7 @@ __export(src_exports, {
65
65
  Table: () => Table,
66
66
  Tabs: () => Tabs,
67
67
  Title: () => Title,
68
- lazy: () => import_react14.lazy,
68
+ lazy: () => import_react12.lazy,
69
69
  transferOptions: () => transferOptions,
70
70
  transferValue: () => transferValue,
71
71
  useApp: () => useApp,
@@ -75,20 +75,17 @@ __export(src_exports, {
75
75
  });
76
76
  module.exports = __toCommonJS(src_exports);
77
77
 
78
- // react-shim.js
79
- var import_react = __toESM(require("react"));
80
-
81
78
  // src/App.tsx
82
79
  var import_antd3 = require("antd");
83
80
  var import_cssinjs = require("@ant-design/cssinjs");
84
- var import_react4 = require("react");
81
+ var import_react3 = require("react");
85
82
 
86
83
  // src/Modal.tsx
87
84
  var import_antd = require("antd");
88
- var import_react2 = require("react");
85
+ var import_react = require("react");
89
86
  var import_jsx_runtime = require("react/jsx-runtime");
90
87
  function useModal(init) {
91
- const [props, setProps] = (0, import_react2.useState)(__spreadValues({
88
+ const [props, setProps] = (0, import_react.useState)(__spreadValues({
92
89
  open: false,
93
90
  onCancel: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
94
91
  open: false
@@ -105,10 +102,10 @@ function useModal(init) {
105
102
 
106
103
  // src/Drawer.tsx
107
104
  var import_antd2 = require("antd");
108
- var import_react3 = require("react");
105
+ var import_react2 = require("react");
109
106
  var import_jsx_runtime2 = require("react/jsx-runtime");
110
107
  function useDrawer(init) {
111
- const [props, setProps] = (0, import_react3.useState)(__spreadValues({
108
+ const [props, setProps] = (0, import_react2.useState)(__spreadValues({
112
109
  open: false,
113
110
  onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
114
111
  open: false
@@ -126,7 +123,7 @@ function useDrawer(init) {
126
123
  // src/App.tsx
127
124
  var import_react_router_dom = require("react-router-dom");
128
125
  var import_jsx_runtime3 = require("react/jsx-runtime");
129
- var AppContext = (0, import_react4.createContext)({
126
+ var AppContext = (0, import_react3.createContext)({
130
127
  message: {},
131
128
  notification: {},
132
129
  setModalProps: () => void 0,
@@ -135,7 +132,7 @@ var AppContext = (0, import_react4.createContext)({
135
132
  function RoutesApp(props) {
136
133
  const location = (0, import_react_router_dom.useLocation)();
137
134
  const { setDrawerProps, setModalProps } = useApp();
138
- (0, import_react4.useEffect)(() => {
135
+ (0, import_react3.useEffect)(() => {
139
136
  console.debug("location", location);
140
137
  setDrawerProps({ open: false });
141
138
  setModalProps({ open: false });
@@ -147,7 +144,7 @@ function App(props) {
147
144
  const [notificationApi, notificationContextHolder] = import_antd3.notification.useNotification();
148
145
  const { modal, setModalProps } = useModal();
149
146
  const { drawer, setDrawerProps } = useDrawer();
150
- const memoizedContextValue = (0, import_react4.useMemo)(
147
+ const memoizedContextValue = (0, import_react3.useMemo)(
151
148
  () => ({
152
149
  message: messageApi,
153
150
  notification: notificationApi,
@@ -178,7 +175,7 @@ function App(props) {
178
175
  );
179
176
  }
180
177
  function useApp() {
181
- return (0, import_react4.useContext)(AppContext);
178
+ return (0, import_react3.useContext)(AppContext);
182
179
  }
183
180
  App.useApp = useApp;
184
181
 
@@ -187,7 +184,7 @@ var import_antd4 = require("antd");
187
184
  var import_lodash_es2 = require("lodash-es");
188
185
 
189
186
  // src/Config.tsx
190
- var import_react5 = require("react");
187
+ var import_react4 = require("react");
191
188
  var import_lodash_es = require("lodash-es");
192
189
  var import_jsx_runtime4 = require("react/jsx-runtime");
193
190
  var isZH = /^zh/i.test(navigator.language);
@@ -228,13 +225,13 @@ var baseConfig = {
228
225
  },
229
226
  Link: { style: {} }
230
227
  };
231
- var ConfigContext = (0, import_react5.createContext)(baseConfig);
228
+ var ConfigContext = (0, import_react4.createContext)(baseConfig);
232
229
  function ConfigProvider2({
233
230
  config,
234
231
  children
235
232
  }) {
236
- const [values, setValues] = (0, import_react5.useState)(baseConfig);
237
- (0, import_react5.useEffect)(() => {
233
+ const [values, setValues] = (0, import_react4.useState)(baseConfig);
234
+ (0, import_react4.useEffect)(() => {
238
235
  if (config.lang === "zh") {
239
236
  setValues((0, import_lodash_es.defaultsDeep)(config, {
240
237
  lang: "zh",
@@ -248,7 +245,7 @@ function ConfigProvider2({
248
245
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ConfigContext.Provider, { value: values, children });
249
246
  }
250
247
  function useConfigContext() {
251
- return (0, import_react5.useContext)(ConfigContext);
248
+ return (0, import_react4.useContext)(ConfigContext);
252
249
  }
253
250
 
254
251
  // src/Blank.tsx
@@ -289,31 +286,10 @@ function transferValue(type, value) {
289
286
  var import_icons = require("@ant-design/icons");
290
287
  var import_antd6 = require("antd");
291
288
  var import_lodash_es4 = require("lodash-es");
292
- var import_react8 = require("react");
293
-
294
- // ../react/dist/index.mjs
295
289
  var import_react6 = require("react");
296
- var clients = {};
297
- function getClient(domain) {
298
- const client = clients[domain || Object.keys(clients)[0]];
299
- if (!client)
300
- throw Error("FaasReactClient is not initialized");
301
- return client;
302
- }
303
- async function faas(action, params) {
304
- return getClient().faas(action, params);
305
- }
306
- function FaasDataWrapper(props) {
307
- const [client, setClient] = (0, import_react6.useState)();
308
- (0, import_react6.useEffect)(() => {
309
- if (client)
310
- return;
311
- setClient(getClient());
312
- }, []);
313
- if (!client)
314
- return props.fallback || null;
315
- return (0, import_react6.createElement)(client.FaasDataWrapper, props);
316
- }
290
+
291
+ // src/FaasDataWrapper.tsx
292
+ var import_react5 = require("@faasjs/react");
317
293
 
318
294
  // src/Loading.tsx
319
295
  var import_antd5 = require("antd");
@@ -329,9 +305,9 @@ function Loading(props) {
329
305
 
330
306
  // src/FaasDataWrapper.tsx
331
307
  var import_jsx_runtime7 = require("react/jsx-runtime");
332
- function FaasDataWrapper2(props) {
308
+ function FaasDataWrapper(props) {
333
309
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
334
- FaasDataWrapper,
310
+ import_react5.FaasDataWrapper,
335
311
  __spreadValues({
336
312
  fallback: props.loading || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loading, __spreadValues({}, props.loadingProps))
337
313
  }, props)
@@ -342,8 +318,8 @@ function FaasDataWrapper2(props) {
342
318
  var import_jsx_runtime8 = require("react/jsx-runtime");
343
319
  function DescriptionItemContent(props) {
344
320
  var _a;
345
- const [computedProps, setComputedProps] = (0, import_react8.useState)();
346
- (0, import_react8.useEffect)(() => {
321
+ const [computedProps, setComputedProps] = (0, import_react6.useState)();
322
+ (0, import_react6.useEffect)(() => {
347
323
  var _a2, _b;
348
324
  const propsCopy = __spreadValues({}, props);
349
325
  if (!propsCopy.item.title)
@@ -373,7 +349,7 @@ function DescriptionItemContent(props) {
373
349
  return null;
374
350
  if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
375
351
  if (computedProps.extendTypes[computedProps.item.type].children)
376
- return (0, import_react8.cloneElement)(
352
+ return (0, import_react6.cloneElement)(
377
353
  computedProps.extendTypes[computedProps.item.type].children,
378
354
  {
379
355
  scene: "description",
@@ -388,7 +364,7 @@ function DescriptionItemContent(props) {
388
364
  if (computedProps.item.descriptionChildren === null)
389
365
  return null;
390
366
  if (computedProps.item.descriptionChildren)
391
- return (0, import_react8.cloneElement)(computedProps.item.descriptionChildren, {
367
+ return (0, import_react6.cloneElement)(computedProps.item.descriptionChildren, {
392
368
  scene: "description",
393
369
  value: computedProps.value,
394
370
  values: computedProps.values
@@ -396,7 +372,7 @@ function DescriptionItemContent(props) {
396
372
  if (computedProps.item.children === null)
397
373
  return null;
398
374
  if (computedProps.item.children)
399
- return (0, import_react8.cloneElement)(computedProps.item.children, {
375
+ return (0, import_react6.cloneElement)(computedProps.item.children, {
400
376
  scene: "description",
401
377
  value: computedProps.value,
402
378
  values: computedProps.values
@@ -480,7 +456,7 @@ function Description(props) {
480
456
  })
481
457
  );
482
458
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
483
- FaasDataWrapper2,
459
+ FaasDataWrapper,
484
460
  __spreadValues({
485
461
  render: ({ data }) => {
486
462
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
@@ -513,10 +489,10 @@ function Description(props) {
513
489
  }
514
490
 
515
491
  // src/ErrorBoundary.tsx
516
- var import_react9 = require("react");
492
+ var import_react7 = require("react");
517
493
  var import_antd7 = require("antd");
518
494
  var import_jsx_runtime9 = require("react/jsx-runtime");
519
- var ErrorBoundary = class extends import_react9.Component {
495
+ var ErrorBoundary = class extends import_react7.Component {
520
496
  constructor(props) {
521
497
  super(props);
522
498
  this.state = {
@@ -560,13 +536,14 @@ var ErrorBoundary = class extends import_react9.Component {
560
536
  };
561
537
 
562
538
  // src/Form.tsx
539
+ var import_react9 = require("@faasjs/react");
563
540
  var import_antd9 = require("antd");
564
- var import_react12 = require("react");
541
+ var import_react10 = require("react");
565
542
 
566
543
  // src/FormItem.tsx
567
544
  var import_antd8 = require("antd");
568
545
  var import_icons2 = require("@ant-design/icons");
569
- var import_react10 = require("react");
546
+ var import_react8 = require("react");
570
547
  var import_lodash_es5 = require("lodash-es");
571
548
  var import_jsx_runtime10 = require("react/jsx-runtime");
572
549
  function processProps(propsCopy, config) {
@@ -617,11 +594,11 @@ function processProps(propsCopy, config) {
617
594
  }
618
595
  function FormItem(props) {
619
596
  var _a;
620
- const [computedProps, setComputedProps] = (0, import_react10.useState)();
621
- const [extendTypes, setExtendTypes] = (0, import_react10.useState)();
597
+ const [computedProps, setComputedProps] = (0, import_react8.useState)();
598
+ const [extendTypes, setExtendTypes] = (0, import_react8.useState)();
622
599
  const { common: common2 } = useConfigContext();
623
- const [hidden, setHidden] = (0, import_react10.useState)(props.hidden || false);
624
- (0, import_react10.useEffect)(() => {
600
+ const [hidden, setHidden] = (0, import_react8.useState)(props.hidden || false);
601
+ (0, import_react8.useEffect)(() => {
625
602
  const propsCopy = __spreadValues({}, props);
626
603
  if (propsCopy.extendTypes) {
627
604
  setExtendTypes(propsCopy.extendTypes);
@@ -658,11 +635,11 @@ function FormItem(props) {
658
635
  if (computedProps.formChildren === null)
659
636
  return null;
660
637
  if (computedProps.formChildren)
661
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react10.cloneElement)(computedProps.formChildren, { scene: "form" }) }));
638
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react8.cloneElement)(computedProps.formChildren, { scene: "form" }) }));
662
639
  if (computedProps.children === null)
663
640
  return null;
664
641
  if (computedProps.children)
665
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react10.cloneElement)(computedProps.children, { scene: "form" }) }));
642
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react8.cloneElement)(computedProps.children, { scene: "form" }) }));
666
643
  if (computedProps.formRender)
667
644
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.formRender(null, null, 0, "form") }));
668
645
  if (computedProps.render)
@@ -897,13 +874,13 @@ FormItem.useStatus = import_antd8.Form.Item.useStatus;
897
874
  var import_jsx_runtime11 = require("react/jsx-runtime");
898
875
  function Form(props) {
899
876
  var _a, _b;
900
- const [loading, setLoading] = (0, import_react12.useState)(false);
901
- const [computedProps, setComputedProps] = (0, import_react12.useState)();
877
+ const [loading, setLoading] = (0, import_react10.useState)(false);
878
+ const [computedProps, setComputedProps] = (0, import_react10.useState)();
902
879
  const config = useConfigContext();
903
- const [extendTypes, setExtendTypes] = (0, import_react12.useState)();
880
+ const [extendTypes, setExtendTypes] = (0, import_react10.useState)();
904
881
  const [form] = import_antd9.Form.useForm(props.form);
905
- const [initialValues, setInitialValues] = (0, import_react12.useState)(props.initialValues);
906
- (0, import_react12.useEffect)(() => {
882
+ const [initialValues, setInitialValues] = (0, import_react10.useState)(props.initialValues);
883
+ (0, import_react10.useEffect)(() => {
907
884
  var _a2, _b2, _c;
908
885
  const propsCopy = __spreadProps(__spreadValues({}, props), {
909
886
  form
@@ -931,7 +908,7 @@ function Form(props) {
931
908
  setLoading(true);
932
909
  try {
933
910
  if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
934
- await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
911
+ await props.onFinish(values, async (values2) => (0, import_react9.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
935
912
  } else
936
913
  await props.onFinish(values);
937
914
  } catch (error) {
@@ -942,7 +919,7 @@ function Form(props) {
942
919
  } else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
943
920
  propsCopy.onFinish = async (values) => {
944
921
  setLoading(true);
945
- return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values), propsCopy.submit.to.params) : values).then((result) => {
922
+ return (0, import_react9.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values), propsCopy.submit.to.params) : values).then((result) => {
946
923
  if (propsCopy.submit.to.then)
947
924
  propsCopy.submit.to.then(result);
948
925
  return result;
@@ -963,7 +940,7 @@ function Form(props) {
963
940
  }
964
941
  setComputedProps(propsCopy);
965
942
  }, [props]);
966
- const onValuesChange = (0, import_react12.useCallback)((changedValues, allValues) => {
943
+ const onValuesChange = (0, import_react10.useCallback)((changedValues, allValues) => {
967
944
  console.debug("Form:onValuesChange", changedValues, allValues);
968
945
  if (props.onValuesChange) {
969
946
  props.onValuesChange(changedValues, allValues);
@@ -976,7 +953,7 @@ function Form(props) {
976
953
  item.onValueChange(changedValues[key], allValues, form);
977
954
  }
978
955
  }, [computedProps]);
979
- (0, import_react12.useEffect)(() => {
956
+ (0, import_react10.useEffect)(() => {
980
957
  if (!initialValues)
981
958
  return;
982
959
  console.debug("Form:initialValues", initialValues);
@@ -991,7 +968,7 @@ function Form(props) {
991
968
  onValuesChange,
992
969
  children: [
993
970
  computedProps.beforeItems,
994
- (_a = computedProps.items) == null ? void 0 : _a.map((item) => (0, import_react12.isValidElement)(item) ? item : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
971
+ (_a = computedProps.items) == null ? void 0 : _a.map((item) => (0, import_react10.isValidElement)(item) ? item : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
995
972
  FormItem,
996
973
  __spreadProps(__spreadValues({}, item), {
997
974
  extendTypes
@@ -1085,9 +1062,9 @@ function Link(props) {
1085
1062
 
1086
1063
  // src/Routers.tsx
1087
1064
  var import_antd11 = require("antd");
1088
- var import_react13 = require("react");
1065
+ var import_react11 = require("react");
1089
1066
  var import_react_router_dom3 = require("react-router-dom");
1090
- var import_react14 = require("react");
1067
+ var import_react12 = require("react");
1091
1068
  var import_jsx_runtime13 = require("react/jsx-runtime");
1092
1069
  function PageNotFound() {
1093
1070
  const config = useConfigContext();
@@ -1104,7 +1081,7 @@ function Routes(props) {
1104
1081
  props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1105
1082
  import_react_router_dom3.Route,
1106
1083
  __spreadProps(__spreadValues({}, r), {
1107
- element: r.element || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react13.Suspense, { fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { padding: "24px" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Skeleton, { active: true }) }), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(r.page, {}) })
1084
+ element: r.element || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react11.Suspense, { fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { padding: "24px" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Skeleton, { active: true }) }), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(r.page, {}) })
1108
1085
  }),
1109
1086
  r.path
1110
1087
  )),
@@ -1120,7 +1097,7 @@ function Routes(props) {
1120
1097
  }
1121
1098
 
1122
1099
  // src/Table.tsx
1123
- var import_react15 = require("react");
1100
+ var import_react13 = require("react");
1124
1101
  var import_antd12 = require("antd");
1125
1102
  var import_dayjs2 = __toESM(require("dayjs"));
1126
1103
  var import_icons3 = require("@ant-design/icons");
@@ -1151,7 +1128,7 @@ function processValue(item, value) {
1151
1128
  return value;
1152
1129
  }
1153
1130
  function Table(props) {
1154
- const [columns, setColumns] = (0, import_react15.useState)();
1131
+ const [columns, setColumns] = (0, import_react13.useState)();
1155
1132
  const { common: common2 } = useConfigContext();
1156
1133
  const generateFilterDropdown = (item) => {
1157
1134
  if (typeof item.filterDropdown !== "undefined")
@@ -1202,7 +1179,7 @@ function Table(props) {
1202
1179
  );
1203
1180
  return item;
1204
1181
  };
1205
- (0, import_react15.useEffect)(() => {
1182
+ (0, import_react13.useEffect)(() => {
1206
1183
  var _a;
1207
1184
  for (const item of props.items) {
1208
1185
  if (!item.key)
@@ -1227,7 +1204,7 @@ function Table(props) {
1227
1204
  if (item.tableChildren === null)
1228
1205
  item.render = () => null;
1229
1206
  else if (item.tableChildren)
1230
- item.render = (value, values) => (0, import_react15.cloneElement)(
1207
+ item.render = (value, values) => (0, import_react13.cloneElement)(
1231
1208
  item.tableChildren,
1232
1209
  {
1233
1210
  scene: "table",
@@ -1238,7 +1215,7 @@ function Table(props) {
1238
1215
  else if (item.children === null)
1239
1216
  item.render = () => null;
1240
1217
  else if (item.children)
1241
- item.render = (value, values) => (0, import_react15.cloneElement)(
1218
+ item.render = (value, values) => (0, import_react13.cloneElement)(
1242
1219
  item.children,
1243
1220
  {
1244
1221
  scene: "table",
@@ -1248,7 +1225,7 @@ function Table(props) {
1248
1225
  );
1249
1226
  if (props.extendTypes && props.extendTypes[item.type]) {
1250
1227
  if (props.extendTypes[item.type].children)
1251
- item.render = (value, values) => (0, import_react15.cloneElement)(
1228
+ item.render = (value, values) => (0, import_react13.cloneElement)(
1252
1229
  props.extendTypes[item.type].children,
1253
1230
  {
1254
1231
  scene: "table",
@@ -1563,7 +1540,7 @@ function Table(props) {
1563
1540
  }
1564
1541
  setColumns(props.items);
1565
1542
  }, [JSON.stringify(props.items)]);
1566
- (0, import_react15.useEffect)(() => {
1543
+ (0, import_react13.useEffect)(() => {
1567
1544
  if (!props.dataSource || !columns)
1568
1545
  return;
1569
1546
  for (const column of columns) {
@@ -1595,7 +1572,7 @@ function Table(props) {
1595
1572
  })
1596
1573
  );
1597
1574
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1598
- FaasDataWrapper2,
1575
+ FaasDataWrapper,
1599
1576
  __spreadProps(__spreadValues({}, props.faasData), {
1600
1577
  children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1601
1578
  FaasDataTable,
@@ -1614,8 +1591,8 @@ function FaasDataTable({
1614
1591
  params,
1615
1592
  reload
1616
1593
  }) {
1617
- const [currentColumns, setCurrentColumns] = (0, import_react15.useState)(columns);
1618
- (0, import_react15.useEffect)(() => {
1594
+ const [currentColumns, setCurrentColumns] = (0, import_react13.useState)(columns);
1595
+ (0, import_react13.useEffect)(() => {
1619
1596
  if (!data || Array.isArray(data))
1620
1597
  return;
1621
1598
  setCurrentColumns((prev) => {
@@ -1700,11 +1677,11 @@ function FaasDataTable({
1700
1677
 
1701
1678
  // src/Tabs.tsx
1702
1679
  var import_antd13 = require("antd");
1703
- var import_react16 = require("react");
1680
+ var import_react14 = require("react");
1704
1681
  var import_jsx_runtime15 = require("react/jsx-runtime");
1705
1682
  function Tabs(props) {
1706
- const [items, setItems] = (0, import_react16.useState)([]);
1707
- (0, import_react16.useEffect)(() => {
1683
+ const [items, setItems] = (0, import_react14.useState)([]);
1684
+ (0, import_react14.useEffect)(() => {
1708
1685
  setItems(props.items.filter(Boolean).map((item) => __spreadProps(__spreadValues({}, item), {
1709
1686
  key: item.id,
1710
1687
  label: item.title || item.id
@@ -1719,11 +1696,11 @@ function Tabs(props) {
1719
1696
  }
1720
1697
 
1721
1698
  // src/Title.tsx
1722
- var import_react17 = require("react");
1699
+ var import_react15 = require("react");
1723
1700
  var import_jsx_runtime16 = require("react/jsx-runtime");
1724
1701
  function Title(props) {
1725
1702
  const { Title: Title2 } = useConfigContext();
1726
- (0, import_react17.useEffect)(() => {
1703
+ (0, import_react15.useEffect)(() => {
1727
1704
  const title = Array.isArray(props.title) ? props.title : [props.title];
1728
1705
  document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
1729
1706
  }, [props]);
@@ -1742,7 +1719,7 @@ function Title(props) {
1742
1719
  if (props.plain)
1743
1720
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: Array.isArray(props.title) ? props.title[0] : props.title });
1744
1721
  if (props.children)
1745
- return (0, import_react17.cloneElement)(props.children, { title: props.title });
1722
+ return (0, import_react15.cloneElement)(props.children, { title: props.title });
1746
1723
  return null;
1747
1724
  }
1748
1725
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -18,9 +18,6 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
 
21
- // react-shim.js
22
- import React from "react";
23
-
24
21
  // src/App.tsx
25
22
  import {
26
23
  ConfigProvider,
@@ -250,39 +247,13 @@ import {
250
247
  } from "antd";
251
248
  import { isFunction, upperFirst as upperFirst2 } from "lodash-es";
252
249
  import {
253
- cloneElement as cloneElement2,
254
- useEffect as useEffect4,
255
- useState as useState5
256
- } from "react";
257
-
258
- // ../react/dist/index.mjs
259
- import {
260
- useState as useState4,
250
+ cloneElement,
261
251
  useEffect as useEffect3,
262
- createElement,
263
- cloneElement
252
+ useState as useState4
264
253
  } from "react";
265
- var clients = {};
266
- function getClient(domain) {
267
- const client = clients[domain || Object.keys(clients)[0]];
268
- if (!client)
269
- throw Error("FaasReactClient is not initialized");
270
- return client;
271
- }
272
- async function faas(action, params) {
273
- return getClient().faas(action, params);
274
- }
275
- function FaasDataWrapper(props) {
276
- const [client, setClient] = useState4();
277
- useEffect3(() => {
278
- if (client)
279
- return;
280
- setClient(getClient());
281
- }, []);
282
- if (!client)
283
- return props.fallback || null;
284
- return createElement(client.FaasDataWrapper, props);
285
- }
254
+
255
+ // src/FaasDataWrapper.tsx
256
+ import { FaasDataWrapper as Origin } from "@faasjs/react";
286
257
 
287
258
  // src/Loading.tsx
288
259
  import { Spin } from "antd";
@@ -298,9 +269,9 @@ function Loading(props) {
298
269
 
299
270
  // src/FaasDataWrapper.tsx
300
271
  import { jsx as jsx7 } from "react/jsx-runtime";
301
- function FaasDataWrapper2(props) {
272
+ function FaasDataWrapper(props) {
302
273
  return /* @__PURE__ */ jsx7(
303
- FaasDataWrapper,
274
+ Origin,
304
275
  __spreadValues({
305
276
  fallback: props.loading || /* @__PURE__ */ jsx7(Loading, __spreadValues({}, props.loadingProps))
306
277
  }, props)
@@ -311,8 +282,8 @@ function FaasDataWrapper2(props) {
311
282
  import { Fragment as Fragment3, jsx as jsx8 } from "react/jsx-runtime";
312
283
  function DescriptionItemContent(props) {
313
284
  var _a;
314
- const [computedProps, setComputedProps] = useState5();
315
- useEffect4(() => {
285
+ const [computedProps, setComputedProps] = useState4();
286
+ useEffect3(() => {
316
287
  var _a2, _b;
317
288
  const propsCopy = __spreadValues({}, props);
318
289
  if (!propsCopy.item.title)
@@ -342,7 +313,7 @@ function DescriptionItemContent(props) {
342
313
  return null;
343
314
  if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
344
315
  if (computedProps.extendTypes[computedProps.item.type].children)
345
- return cloneElement2(
316
+ return cloneElement(
346
317
  computedProps.extendTypes[computedProps.item.type].children,
347
318
  {
348
319
  scene: "description",
@@ -357,7 +328,7 @@ function DescriptionItemContent(props) {
357
328
  if (computedProps.item.descriptionChildren === null)
358
329
  return null;
359
330
  if (computedProps.item.descriptionChildren)
360
- return cloneElement2(computedProps.item.descriptionChildren, {
331
+ return cloneElement(computedProps.item.descriptionChildren, {
361
332
  scene: "description",
362
333
  value: computedProps.value,
363
334
  values: computedProps.values
@@ -365,7 +336,7 @@ function DescriptionItemContent(props) {
365
336
  if (computedProps.item.children === null)
366
337
  return null;
367
338
  if (computedProps.item.children)
368
- return cloneElement2(computedProps.item.children, {
339
+ return cloneElement(computedProps.item.children, {
369
340
  scene: "description",
370
341
  value: computedProps.value,
371
342
  values: computedProps.values
@@ -449,7 +420,7 @@ function Description(props) {
449
420
  })
450
421
  );
451
422
  return /* @__PURE__ */ jsx8(
452
- FaasDataWrapper2,
423
+ FaasDataWrapper,
453
424
  __spreadValues({
454
425
  render: ({ data }) => {
455
426
  return /* @__PURE__ */ jsx8(
@@ -529,13 +500,14 @@ var ErrorBoundary = class extends Component {
529
500
  };
530
501
 
531
502
  // src/Form.tsx
503
+ import { faas } from "@faasjs/react";
532
504
  import {
533
505
  Button as Button2,
534
506
  Form as AntdForm2
535
507
  } from "antd";
536
508
  import {
537
- useEffect as useEffect6,
538
- useState as useState7,
509
+ useEffect as useEffect5,
510
+ useState as useState6,
539
511
  useCallback,
540
512
  isValidElement
541
513
  } from "react";
@@ -555,9 +527,9 @@ import {
555
527
  } from "antd";
556
528
  import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
557
529
  import {
558
- cloneElement as cloneElement3,
559
- useEffect as useEffect5,
560
- useState as useState6
530
+ cloneElement as cloneElement2,
531
+ useEffect as useEffect4,
532
+ useState as useState5
561
533
  } from "react";
562
534
  import { upperFirst as upperFirst3 } from "lodash-es";
563
535
  import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
@@ -609,11 +581,11 @@ function processProps(propsCopy, config) {
609
581
  }
610
582
  function FormItem(props) {
611
583
  var _a;
612
- const [computedProps, setComputedProps] = useState6();
613
- const [extendTypes, setExtendTypes] = useState6();
584
+ const [computedProps, setComputedProps] = useState5();
585
+ const [extendTypes, setExtendTypes] = useState5();
614
586
  const { common: common2 } = useConfigContext();
615
- const [hidden, setHidden] = useState6(props.hidden || false);
616
- useEffect5(() => {
587
+ const [hidden, setHidden] = useState5(props.hidden || false);
588
+ useEffect4(() => {
617
589
  const propsCopy = __spreadValues({}, props);
618
590
  if (propsCopy.extendTypes) {
619
591
  setExtendTypes(propsCopy.extendTypes);
@@ -650,11 +622,11 @@ function FormItem(props) {
650
622
  if (computedProps.formChildren === null)
651
623
  return null;
652
624
  if (computedProps.formChildren)
653
- return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: cloneElement3(computedProps.formChildren, { scene: "form" }) }));
625
+ return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: cloneElement2(computedProps.formChildren, { scene: "form" }) }));
654
626
  if (computedProps.children === null)
655
627
  return null;
656
628
  if (computedProps.children)
657
- return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: cloneElement3(computedProps.children, { scene: "form" }) }));
629
+ return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: cloneElement2(computedProps.children, { scene: "form" }) }));
658
630
  if (computedProps.formRender)
659
631
  return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.formRender(null, null, 0, "form") }));
660
632
  if (computedProps.render)
@@ -889,13 +861,13 @@ FormItem.useStatus = AntdForm.Item.useStatus;
889
861
  import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
890
862
  function Form(props) {
891
863
  var _a, _b;
892
- const [loading, setLoading] = useState7(false);
893
- const [computedProps, setComputedProps] = useState7();
864
+ const [loading, setLoading] = useState6(false);
865
+ const [computedProps, setComputedProps] = useState6();
894
866
  const config = useConfigContext();
895
- const [extendTypes, setExtendTypes] = useState7();
867
+ const [extendTypes, setExtendTypes] = useState6();
896
868
  const [form] = AntdForm2.useForm(props.form);
897
- const [initialValues, setInitialValues] = useState7(props.initialValues);
898
- useEffect6(() => {
869
+ const [initialValues, setInitialValues] = useState6(props.initialValues);
870
+ useEffect5(() => {
899
871
  var _a2, _b2, _c;
900
872
  const propsCopy = __spreadProps(__spreadValues({}, props), {
901
873
  form
@@ -968,7 +940,7 @@ function Form(props) {
968
940
  item.onValueChange(changedValues[key], allValues, form);
969
941
  }
970
942
  }, [computedProps]);
971
- useEffect6(() => {
943
+ useEffect5(() => {
972
944
  if (!initialValues)
973
945
  return;
974
946
  console.debug("Form:initialValues", initialValues);
@@ -1118,9 +1090,9 @@ function Routes(props) {
1118
1090
 
1119
1091
  // src/Table.tsx
1120
1092
  import {
1121
- useState as useState8,
1122
- useEffect as useEffect7,
1123
- cloneElement as cloneElement4
1093
+ useState as useState7,
1094
+ useEffect as useEffect6,
1095
+ cloneElement as cloneElement3
1124
1096
  } from "react";
1125
1097
  import {
1126
1098
  Table as AntdTable,
@@ -1162,7 +1134,7 @@ function processValue(item, value) {
1162
1134
  return value;
1163
1135
  }
1164
1136
  function Table(props) {
1165
- const [columns, setColumns] = useState8();
1137
+ const [columns, setColumns] = useState7();
1166
1138
  const { common: common2 } = useConfigContext();
1167
1139
  const generateFilterDropdown = (item) => {
1168
1140
  if (typeof item.filterDropdown !== "undefined")
@@ -1213,7 +1185,7 @@ function Table(props) {
1213
1185
  );
1214
1186
  return item;
1215
1187
  };
1216
- useEffect7(() => {
1188
+ useEffect6(() => {
1217
1189
  var _a;
1218
1190
  for (const item of props.items) {
1219
1191
  if (!item.key)
@@ -1238,7 +1210,7 @@ function Table(props) {
1238
1210
  if (item.tableChildren === null)
1239
1211
  item.render = () => null;
1240
1212
  else if (item.tableChildren)
1241
- item.render = (value, values) => cloneElement4(
1213
+ item.render = (value, values) => cloneElement3(
1242
1214
  item.tableChildren,
1243
1215
  {
1244
1216
  scene: "table",
@@ -1249,7 +1221,7 @@ function Table(props) {
1249
1221
  else if (item.children === null)
1250
1222
  item.render = () => null;
1251
1223
  else if (item.children)
1252
- item.render = (value, values) => cloneElement4(
1224
+ item.render = (value, values) => cloneElement3(
1253
1225
  item.children,
1254
1226
  {
1255
1227
  scene: "table",
@@ -1259,7 +1231,7 @@ function Table(props) {
1259
1231
  );
1260
1232
  if (props.extendTypes && props.extendTypes[item.type]) {
1261
1233
  if (props.extendTypes[item.type].children)
1262
- item.render = (value, values) => cloneElement4(
1234
+ item.render = (value, values) => cloneElement3(
1263
1235
  props.extendTypes[item.type].children,
1264
1236
  {
1265
1237
  scene: "table",
@@ -1574,7 +1546,7 @@ function Table(props) {
1574
1546
  }
1575
1547
  setColumns(props.items);
1576
1548
  }, [JSON.stringify(props.items)]);
1577
- useEffect7(() => {
1549
+ useEffect6(() => {
1578
1550
  if (!props.dataSource || !columns)
1579
1551
  return;
1580
1552
  for (const column of columns) {
@@ -1606,7 +1578,7 @@ function Table(props) {
1606
1578
  })
1607
1579
  );
1608
1580
  return /* @__PURE__ */ jsx14(
1609
- FaasDataWrapper2,
1581
+ FaasDataWrapper,
1610
1582
  __spreadProps(__spreadValues({}, props.faasData), {
1611
1583
  children: /* @__PURE__ */ jsx14(
1612
1584
  FaasDataTable,
@@ -1625,8 +1597,8 @@ function FaasDataTable({
1625
1597
  params,
1626
1598
  reload
1627
1599
  }) {
1628
- const [currentColumns, setCurrentColumns] = useState8(columns);
1629
- useEffect7(() => {
1600
+ const [currentColumns, setCurrentColumns] = useState7(columns);
1601
+ useEffect6(() => {
1630
1602
  if (!data || Array.isArray(data))
1631
1603
  return;
1632
1604
  setCurrentColumns((prev) => {
@@ -1710,19 +1682,19 @@ function FaasDataTable({
1710
1682
  }
1711
1683
 
1712
1684
  // src/Tabs.tsx
1713
- import { Tabs as Origin } from "antd";
1714
- import { useEffect as useEffect8, useState as useState9 } from "react";
1685
+ import { Tabs as Origin2 } from "antd";
1686
+ import { useEffect as useEffect7, useState as useState8 } from "react";
1715
1687
  import { jsx as jsx15 } from "react/jsx-runtime";
1716
1688
  function Tabs(props) {
1717
- const [items, setItems] = useState9([]);
1718
- useEffect8(() => {
1689
+ const [items, setItems] = useState8([]);
1690
+ useEffect7(() => {
1719
1691
  setItems(props.items.filter(Boolean).map((item) => __spreadProps(__spreadValues({}, item), {
1720
1692
  key: item.id,
1721
1693
  label: item.title || item.id
1722
1694
  })));
1723
1695
  }, [props.items.filter(Boolean).map((i) => i.id).join("")]);
1724
1696
  return /* @__PURE__ */ jsx15(
1725
- Origin,
1697
+ Origin2,
1726
1698
  __spreadProps(__spreadValues({}, props), {
1727
1699
  items
1728
1700
  })
@@ -1730,11 +1702,11 @@ function Tabs(props) {
1730
1702
  }
1731
1703
 
1732
1704
  // src/Title.tsx
1733
- import { useEffect as useEffect9, cloneElement as cloneElement5 } from "react";
1705
+ import { useEffect as useEffect8, cloneElement as cloneElement4 } from "react";
1734
1706
  import { Fragment as Fragment6, jsx as jsx16 } from "react/jsx-runtime";
1735
1707
  function Title(props) {
1736
1708
  const { Title: Title2 } = useConfigContext();
1737
- useEffect9(() => {
1709
+ useEffect8(() => {
1738
1710
  const title = Array.isArray(props.title) ? props.title : [props.title];
1739
1711
  document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
1740
1712
  }, [props]);
@@ -1753,7 +1725,7 @@ function Title(props) {
1753
1725
  if (props.plain)
1754
1726
  return /* @__PURE__ */ jsx16(Fragment6, { children: Array.isArray(props.title) ? props.title[0] : props.title });
1755
1727
  if (props.children)
1756
- return cloneElement5(props.children, { title: props.title });
1728
+ return cloneElement4(props.children, { title: props.title });
1757
1729
  return null;
1758
1730
  }
1759
1731
  export {
@@ -1764,7 +1736,7 @@ export {
1764
1736
  Description,
1765
1737
  Drawer,
1766
1738
  ErrorBoundary,
1767
- FaasDataWrapper2 as FaasDataWrapper,
1739
+ FaasDataWrapper,
1768
1740
  Form,
1769
1741
  FormItem,
1770
1742
  Link,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.3-beta.69",
3
+ "version": "0.0.3-beta.70",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "funding": "https://github.com/sponsors/faasjs",
18
18
  "scripts": {
19
- "build": "tsup-node src/index.ts --format esm,cjs --inject react-shim.js --dts --clean"
19
+ "build": "tsup-node src/index.ts --format esm,cjs --tsconfig tsconfig.build.json --dts --clean"
20
20
  },
21
21
  "files": [
22
22
  "dist"