@plasmicpkgs/plasmic-rich-components 1.0.159 → 1.0.161
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.
|
@@ -3,14 +3,14 @@ import '@plasmicapp/host/registerGlobalContext';
|
|
|
3
3
|
import { parseDate } from '@plasmicpkgs/luxon-parser';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
6
|
-
import React, { useState, useEffect, useMemo
|
|
6
|
+
import React, { useRef, useState, useEffect, useMemo } from 'react';
|
|
7
7
|
import { Result, Checkbox, Switch, Empty, Descriptions, theme, ConfigProvider, Dropdown, Button, Input, List, Tag, Card, Calendar, Badge } from 'antd';
|
|
8
8
|
import 'lodash/get';
|
|
9
9
|
import { useNormalizedData, deriveFieldConfigs } from '@plasmicapp/data-sources';
|
|
10
10
|
import { tinycolor } from '@ctrl/tinycolor';
|
|
11
11
|
import { LogoutOutlined, PlusOutlined, EllipsisOutlined } from '@ant-design/icons';
|
|
12
12
|
import { ProLayout, ProConfigProvider, ProTable } from '@ant-design/pro-components';
|
|
13
|
-
import { usePlasmicLink } from '@plasmicapp/host';
|
|
13
|
+
import { useDataEnv, usePlasmicLink } from '@plasmicapp/host';
|
|
14
14
|
import { createObjectCsvStringifier } from 'csv-writer-browser';
|
|
15
15
|
import fastStringify from 'fast-stringify';
|
|
16
16
|
import classNames from 'classnames';
|
|
@@ -1023,14 +1023,36 @@ function RichLayout(_a) {
|
|
|
1023
1023
|
"logoElement"
|
|
1024
1024
|
]);
|
|
1025
1025
|
var _a2, _b2, _c, _d, _e;
|
|
1026
|
+
const $ctx = useDataEnv();
|
|
1027
|
+
const ref = useRef(null);
|
|
1026
1028
|
const isClient = useIsClient();
|
|
1027
1029
|
const [pathname, setPathname] = useState(void 0);
|
|
1030
|
+
const [openKeys, setOpenKeys] = useState([]);
|
|
1031
|
+
const [ready, setReady] = useState(false);
|
|
1028
1032
|
useEffect(() => {
|
|
1033
|
+
setTimeout(() => {
|
|
1034
|
+
setReady(true);
|
|
1035
|
+
}, 500);
|
|
1029
1036
|
if (typeof location !== "undefined") {
|
|
1030
1037
|
setPathname(location.pathname);
|
|
1031
1038
|
}
|
|
1032
1039
|
}, []);
|
|
1033
|
-
|
|
1040
|
+
useEffect(() => {
|
|
1041
|
+
if (!ready)
|
|
1042
|
+
return;
|
|
1043
|
+
if (!ref.current)
|
|
1044
|
+
return;
|
|
1045
|
+
const selectedSubmenus = Array.from(
|
|
1046
|
+
ref.current.querySelectorAll(
|
|
1047
|
+
"ul > li.ant-menu-submenu.ant-menu-submenu-selected > div"
|
|
1048
|
+
)
|
|
1049
|
+
).map((el) => {
|
|
1050
|
+
var _a3;
|
|
1051
|
+
return (_a3 = el.getAttribute("data-menu-id")) == null ? void 0 : _a3.split("/").pop();
|
|
1052
|
+
}).filter((i) => i).map((i) => `/${i}`) || [];
|
|
1053
|
+
setOpenKeys(selectedSubmenus);
|
|
1054
|
+
}, [ready]);
|
|
1055
|
+
const PlasmicLink = (_b2 = (_a2 = usePlasmicLink) == null ? void 0 : _a2()) != null ? _b2 : AnchorLink;
|
|
1034
1056
|
const { token } = theme.useToken();
|
|
1035
1057
|
const origTextColor = token.colorTextBase;
|
|
1036
1058
|
function getNavBgColor() {
|
|
@@ -1075,7 +1097,7 @@ function RichLayout(_a) {
|
|
|
1075
1097
|
colorTextMenuActive: "rgba(255,255,255,0.95)",
|
|
1076
1098
|
colorTextSubMenuSelected: "#fff"
|
|
1077
1099
|
};
|
|
1078
|
-
return /* @__PURE__ */ React.createElement("div", { className, style: { display: "flex" } }, /* @__PURE__ */ React.createElement("style", null, baseStyles), /* @__PURE__ */ React.createElement(
|
|
1100
|
+
return /* @__PURE__ */ React.createElement("div", { ref, className, style: { display: "flex" } }, /* @__PURE__ */ React.createElement("style", null, baseStyles), /* @__PURE__ */ React.createElement(
|
|
1079
1101
|
ProLayout,
|
|
1080
1102
|
__spreadProps$5(__spreadValues$8({}, layoutProps), {
|
|
1081
1103
|
pageTitleRender: () => "",
|
|
@@ -1117,7 +1139,7 @@ function RichLayout(_a) {
|
|
|
1117
1139
|
},
|
|
1118
1140
|
menu: {
|
|
1119
1141
|
// collapsedShowGroupTitle: true,
|
|
1120
|
-
defaultOpenAll:
|
|
1142
|
+
defaultOpenAll: false
|
|
1121
1143
|
// hideMenuWhenCollapsed: true,
|
|
1122
1144
|
},
|
|
1123
1145
|
avatarProps: showAvatarMenu ? {
|
|
@@ -1151,9 +1173,12 @@ function RichLayout(_a) {
|
|
|
1151
1173
|
return footerChildren;
|
|
1152
1174
|
},
|
|
1153
1175
|
onMenuHeaderClick: (e) => console.log(e),
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1176
|
+
openKeys,
|
|
1177
|
+
onOpenChange: (keys) => keys === false || !ready ? [] : setOpenKeys(keys),
|
|
1178
|
+
selectedKeys: [$ctx == null ? void 0 : $ctx.pagePath],
|
|
1179
|
+
menuItemRender: (item, dom) => /* @__PURE__ */ React.createElement(PlasmicLink, { href: item.path }, dom),
|
|
1180
|
+
headerTitleRender: (logoEl, title, _) => {
|
|
1181
|
+
return /* @__PURE__ */ React.createElement(PlasmicLink, { href: rootUrl }, logoEl, title);
|
|
1157
1182
|
}
|
|
1158
1183
|
}),
|
|
1159
1184
|
children
|
|
@@ -2142,23 +2167,27 @@ const dataTableMeta = {
|
|
|
2142
2167
|
type: "writable",
|
|
2143
2168
|
valueProp: "selectedRowKey",
|
|
2144
2169
|
onChangeProp: "onRowSelectionChanged",
|
|
2145
|
-
variableType: "text"
|
|
2170
|
+
variableType: "text",
|
|
2171
|
+
hidden: (ps) => !(ps.canSelectRows === "click" || ps.canSelectRows === "single")
|
|
2146
2172
|
}, tableHelpers.states.selectedRowKey),
|
|
2147
2173
|
selectedRowKeys: __spreadValues$4({
|
|
2148
2174
|
type: "writable",
|
|
2149
2175
|
valueProp: "selectedRowKeys",
|
|
2150
2176
|
onChangeProp: "onRowSelectionChanged",
|
|
2151
|
-
variableType: "array"
|
|
2177
|
+
variableType: "array",
|
|
2178
|
+
hidden: (ps) => !(ps.canSelectRows === "multiple")
|
|
2152
2179
|
}, tableHelpers.states.selectedRowKeys),
|
|
2153
2180
|
selectedRow: __spreadValues$4({
|
|
2154
2181
|
type: "readonly",
|
|
2155
2182
|
onChangeProp: "onRowSelectionChanged",
|
|
2156
|
-
variableType: "object"
|
|
2183
|
+
variableType: "object",
|
|
2184
|
+
hidden: (ps) => !(ps.canSelectRows === "click" || ps.canSelectRows === "single")
|
|
2157
2185
|
}, tableHelpers.states.selectedRow),
|
|
2158
2186
|
selectedRows: __spreadValues$4({
|
|
2159
2187
|
type: "readonly",
|
|
2160
2188
|
onChangeProp: "onRowSelectionChanged",
|
|
2161
|
-
variableType: "array"
|
|
2189
|
+
variableType: "array",
|
|
2190
|
+
hidden: (ps) => !(ps.canSelectRows === "multiple")
|
|
2162
2191
|
}, tableHelpers.states.selectedRows)
|
|
2163
2192
|
},
|
|
2164
2193
|
componentHelpers: {
|