@plasmicpkgs/antd5 0.0.92 → 0.0.93

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.
Files changed (48) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/antd.esm.js +57 -16
  3. package/dist/antd.esm.js.map +1 -1
  4. package/dist/index.js +56 -15
  5. package/dist/index.js.map +1 -1
  6. package/dist/utils.d.ts +23 -0
  7. package/package.json +2 -2
  8. package/skinny/registerButton.cjs.js +1 -1
  9. package/skinny/registerButton.esm.js +1 -1
  10. package/skinny/registerCheckbox.cjs.js +1 -1
  11. package/skinny/registerCheckbox.esm.js +1 -1
  12. package/skinny/registerConfigProvider.cjs.js +1 -1
  13. package/skinny/registerConfigProvider.esm.js +1 -1
  14. package/skinny/registerDatePicker.cjs.js +1 -1
  15. package/skinny/registerDatePicker.esm.js +1 -1
  16. package/skinny/registerDropdown.cjs.js +1 -1
  17. package/skinny/registerDropdown.esm.js +1 -1
  18. package/skinny/registerForm.cjs.js +27 -17
  19. package/skinny/registerForm.cjs.js.map +1 -1
  20. package/skinny/registerForm.esm.js +27 -17
  21. package/skinny/registerForm.esm.js.map +1 -1
  22. package/skinny/registerInput.cjs.js +1 -1
  23. package/skinny/registerInput.esm.js +1 -1
  24. package/skinny/registerMenu.cjs.js +1 -1
  25. package/skinny/registerMenu.esm.js +1 -1
  26. package/skinny/registerModal.cjs.js +1 -1
  27. package/skinny/registerModal.esm.js +1 -1
  28. package/skinny/registerRadio.cjs.js +1 -1
  29. package/skinny/registerRadio.esm.js +1 -1
  30. package/skinny/{registerSelect-2c9dfc05.cjs.js → registerSelect-40844a74.cjs.js} +2 -2
  31. package/skinny/{registerSelect-2c9dfc05.cjs.js.map → registerSelect-40844a74.cjs.js.map} +1 -1
  32. package/skinny/{registerSelect-3ef48596.esm.js → registerSelect-6b399103.esm.js} +2 -2
  33. package/skinny/{registerSelect-3ef48596.esm.js.map → registerSelect-6b399103.esm.js.map} +1 -1
  34. package/skinny/registerSelect.cjs.js +2 -2
  35. package/skinny/registerSelect.esm.js +2 -2
  36. package/skinny/registerSwitch.cjs.js +1 -1
  37. package/skinny/registerSwitch.esm.js +1 -1
  38. package/skinny/registerTable.cjs.js +1 -1
  39. package/skinny/registerTable.esm.js +1 -1
  40. package/skinny/registerUpload.cjs.js +1 -1
  41. package/skinny/registerUpload.esm.js +1 -1
  42. package/skinny/{utils-838eeae8.cjs.js → utils-833cc295.cjs.js} +34 -1
  43. package/skinny/utils-833cc295.cjs.js.map +1 -0
  44. package/skinny/{utils-02582d7f.esm.js → utils-94ad8c63.esm.js} +34 -2
  45. package/skinny/utils-94ad8c63.esm.js.map +1 -0
  46. package/skinny/utils.d.ts +23 -0
  47. package/skinny/utils-02582d7f.esm.js.map +0 -1
  48. package/skinny/utils-838eeae8.cjs.js.map +0 -1
package/dist/antd.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { isValidElement, cloneElement, useState } from 'react';
2
- import { Button, Checkbox, ConfigProvider, theme, message, notification, Menu, Dropdown, Input, InputNumber, Radio, Select, Switch, Form, DatePicker, Modal, Table, Upload } from 'antd';
2
+ import { Result, Button, Checkbox, ConfigProvider, theme, message, notification, Menu, Dropdown, Input, InputNumber, Radio, Select, Switch, Form, DatePicker, Modal, Table, Upload } from 'antd';
3
3
  import registerComponent from '@plasmicapp/host/registerComponent';
4
4
  import registerGlobalContext from '@plasmicapp/host/registerGlobalContext';
5
5
  import { GlobalActionsProvider, usePlasmicCanvasContext, DataProvider, repeatedElement } from '@plasmicapp/host';
@@ -79,6 +79,37 @@ function setFieldsToUndefined(obj) {
79
79
  }
80
80
  }
81
81
  }
82
+ class ErrorBoundary extends React.Component {
83
+ constructor() {
84
+ super(...arguments);
85
+ this.state = { hasError: false, errorInfo: "" };
86
+ }
87
+ static getDerivedStateFromError(error) {
88
+ return { hasError: true, errorInfo: error.message };
89
+ }
90
+ componentDidCatch(error, errorInfo) {
91
+ console.log(error, errorInfo);
92
+ }
93
+ componentDidUpdate(prevProps, prevState) {
94
+ if (prevProps.canvasEnvId !== this.props.canvasEnvId && prevState.hasError) {
95
+ this.setState({ hasError: false });
96
+ }
97
+ }
98
+ render() {
99
+ var _a;
100
+ if (this.state.hasError) {
101
+ return /* @__PURE__ */ React.createElement(
102
+ Result,
103
+ {
104
+ status: "error",
105
+ title: (_a = this.props.message) != null ? _a : "Something went wrong.",
106
+ extra: this.state.errorInfo
107
+ }
108
+ );
109
+ }
110
+ return this.props.children;
111
+ }
112
+ }
82
113
 
83
114
  var __defProp$e = Object.defineProperty;
84
115
  var __defProps$b = Object.defineProperties;
@@ -2429,21 +2460,31 @@ const Internal = React.forwardRef(
2429
2460
  if (props.mode !== "simplified") {
2430
2461
  childrenNode = typeof props.children === "function" ? props.children(values, form) : props.children;
2431
2462
  } else {
2432
- childrenNode = /* @__PURE__ */ React.createElement(React.Fragment, null, ((_b = props.formItems) != null ? _b : []).map((formItem) => /* @__PURE__ */ React.createElement(
2433
- FormItemWrapper,
2434
- __spreadProps$3(__spreadValues$4({}, formItem), {
2435
- noLabel: formItem.inputType === "Checkbox" /* Checkbox */ || formItem.noLabel,
2436
- style: { width: "100%" }
2437
- }),
2438
- formItem.inputType === "Text" /* Text */ ? /* @__PURE__ */ React.createElement(Input, null) : formItem.inputType === "Password" /* Password */ ? /* @__PURE__ */ React.createElement(Input.Password, null) : formItem.inputType === "Text Area" /* TextArea */ ? /* @__PURE__ */ React.createElement(Input.TextArea, null) : formItem.inputType === "Number" /* Number */ ? /* @__PURE__ */ React.createElement(InputNumber, null) : formItem.inputType === "Checkbox" /* Checkbox */ ? /* @__PURE__ */ React.createElement(Checkbox, null, formItem.label) : formItem.inputType === "Select" /* Select */ ? /* @__PURE__ */ React.createElement(Select, { options: formItem.options }) : formItem.inputType === "DatePicker" /* DatePicker */ ? /* @__PURE__ */ React.createElement(DatePicker, null) : formItem.inputType === "Radio Group" /* RadioGroup */ ? /* @__PURE__ */ React.createElement(
2439
- Radio.Group,
2440
- {
2441
- options: formItem.options,
2442
- optionType: formItem.optionType,
2443
- style: { padding: "8px" }
2444
- }
2445
- ) : null
2446
- )), props.submitSlot);
2463
+ childrenNode = /* @__PURE__ */ React.createElement(React.Fragment, null, ((_b = props.formItems) != null ? _b : []).map((formItem) => {
2464
+ var _a2, _b2;
2465
+ return /* @__PURE__ */ React.createElement(
2466
+ FormItemWrapper,
2467
+ __spreadProps$3(__spreadValues$4({}, formItem), {
2468
+ noLabel: formItem.inputType === "Checkbox" /* Checkbox */ || formItem.noLabel,
2469
+ style: { width: "100%" }
2470
+ }),
2471
+ /* @__PURE__ */ React.createElement(
2472
+ ErrorBoundary,
2473
+ {
2474
+ canvasEnvId: props["data-plasmic-canvas-envs"],
2475
+ message: `Error rendering input for ${(_b2 = (_a2 = formItem.label) != null ? _a2 : formItem.name) != null ? _b2 : "undefined"}`
2476
+ },
2477
+ formItem.inputType === "Text" /* Text */ ? /* @__PURE__ */ React.createElement(Input, null) : formItem.inputType === "Password" /* Password */ ? /* @__PURE__ */ React.createElement(Input.Password, null) : formItem.inputType === "Text Area" /* TextArea */ ? /* @__PURE__ */ React.createElement(Input.TextArea, null) : formItem.inputType === "Number" /* Number */ ? /* @__PURE__ */ React.createElement(InputNumber, null) : formItem.inputType === "Checkbox" /* Checkbox */ ? /* @__PURE__ */ React.createElement(Checkbox, null, formItem.label) : formItem.inputType === "Select" /* Select */ ? /* @__PURE__ */ React.createElement(Select, { options: formItem.options }) : formItem.inputType === "DatePicker" /* DatePicker */ ? /* @__PURE__ */ React.createElement(DatePicker, null) : formItem.inputType === "Radio Group" /* RadioGroup */ ? /* @__PURE__ */ React.createElement(
2478
+ Radio.Group,
2479
+ {
2480
+ options: formItem.options,
2481
+ optionType: formItem.optionType,
2482
+ style: { padding: "8px" }
2483
+ }
2484
+ ) : null
2485
+ )
2486
+ );
2487
+ }), props.submitSlot);
2447
2488
  }
2448
2489
  const fireOnValuesChange = React.useCallback(() => {
2449
2490
  const values2 = form.getFieldsValue(true);