@plasmicpkgs/plasmic-rich-components 1.0.104 → 1.0.106
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/.tsbuildinfo +1 -1
- package/dist/index.js +36 -4
- package/dist/index.js.map +1 -1
- package/dist/plasmic-rich-components.esm.js +36 -4
- package/dist/plasmic-rich-components.esm.js.map +1 -1
- package/dist/utils.d.ts +22 -0
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
2
2
|
import '@plasmicapp/host/registerGlobalContext';
|
|
3
|
-
import 'lodash/get';
|
|
4
3
|
import React, { useState, useEffect, useRef } from 'react';
|
|
4
|
+
import { Result, Checkbox, Switch, Empty, Descriptions, theme, ConfigProvider, Dropdown, Button, Input, List, Tag, Card } from 'antd';
|
|
5
|
+
import 'lodash/get';
|
|
5
6
|
import { normalizeData, deriveFieldConfigs } from '@plasmicapp/data-sources';
|
|
6
|
-
import { Checkbox, Switch, Empty, Descriptions, theme, ConfigProvider, Dropdown, Button, Input, List, Tag, Card } from 'antd';
|
|
7
7
|
import { tinycolor } from '@ctrl/tinycolor';
|
|
8
8
|
import { LogoutOutlined, PlusOutlined, EllipsisOutlined } from '@ant-design/icons';
|
|
9
9
|
import { ProLayout, ProConfigProvider, ProTable } from '@ant-design/pro-components';
|
|
@@ -53,6 +53,36 @@ const mkShortId = () => `${Math.random()}`;
|
|
|
53
53
|
function withoutFalsey(xs) {
|
|
54
54
|
return xs.filter((x) => !!x);
|
|
55
55
|
}
|
|
56
|
+
class ErrorBoundary extends React.Component {
|
|
57
|
+
constructor() {
|
|
58
|
+
super(...arguments);
|
|
59
|
+
this.state = { hasError: false, errorInfo: "" };
|
|
60
|
+
}
|
|
61
|
+
static getDerivedStateFromError(error) {
|
|
62
|
+
return { hasError: true, errorInfo: error.message };
|
|
63
|
+
}
|
|
64
|
+
componentDidCatch(error, errorInfo) {
|
|
65
|
+
console.log(error, errorInfo);
|
|
66
|
+
}
|
|
67
|
+
componentDidUpdate(prevProps, prevState) {
|
|
68
|
+
if (prevProps.canvasEnvId !== this.props.canvasEnvId && prevState.hasError) {
|
|
69
|
+
this.setState({ hasError: false });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
if (this.state.hasError) {
|
|
74
|
+
return /* @__PURE__ */ React.createElement(
|
|
75
|
+
Result,
|
|
76
|
+
{
|
|
77
|
+
status: "error",
|
|
78
|
+
title: "Something went wrong.",
|
|
79
|
+
extra: this.state.errorInfo
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
return this.props.children;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
56
86
|
|
|
57
87
|
var __defProp$9 = Object.defineProperty;
|
|
58
88
|
var __defProps$7 = Object.defineProperties;
|
|
@@ -1449,9 +1479,10 @@ function RichTable(props) {
|
|
|
1449
1479
|
if (!isClient) {
|
|
1450
1480
|
return null;
|
|
1451
1481
|
}
|
|
1452
|
-
return /* @__PURE__ */ React.createElement("div", { className: `${className} ${scopeClassName != null ? scopeClassName : ""}` }, /* @__PURE__ */ React.createElement(
|
|
1482
|
+
return /* @__PURE__ */ React.createElement("div", { className: `${className} ${scopeClassName != null ? scopeClassName : ""}` }, /* @__PURE__ */ React.createElement(ErrorBoundary, { canvasEnvId: props["data-plasmic-canvas-envs"] }, /* @__PURE__ */ React.createElement(
|
|
1453
1483
|
ProTable,
|
|
1454
1484
|
__spreadProps$2(__spreadValues$3({
|
|
1485
|
+
ErrorBoundary: false,
|
|
1455
1486
|
rowClassName: props.onRowClick || props.canSelectRows === "click" ? "plasmic-table-row-clickable" : void 0,
|
|
1456
1487
|
actionRef,
|
|
1457
1488
|
columns: columnDefinitions,
|
|
@@ -1508,7 +1539,7 @@ function RichTable(props) {
|
|
|
1508
1539
|
!hideExports && /* @__PURE__ */ React.createElement(ExportMenu, { data })
|
|
1509
1540
|
].filter((x) => !!x)
|
|
1510
1541
|
})
|
|
1511
|
-
), /* @__PURE__ */ React.createElement(
|
|
1542
|
+
)), /* @__PURE__ */ React.createElement(
|
|
1512
1543
|
"style",
|
|
1513
1544
|
{
|
|
1514
1545
|
dangerouslySetInnerHTML: {
|
|
@@ -2560,6 +2591,7 @@ const richListMeta = {
|
|
|
2560
2591
|
padding: "16px",
|
|
2561
2592
|
maxHeight: "100%"
|
|
2562
2593
|
},
|
|
2594
|
+
defaultDisplay: "block",
|
|
2563
2595
|
props: __spreadValues({
|
|
2564
2596
|
data: dataProp(),
|
|
2565
2597
|
type: {
|