@plasmicpkgs/plasmic-rich-components 1.0.91 → 1.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.
|
@@ -1041,8 +1041,15 @@ function omitUndefined(x) {
|
|
|
1041
1041
|
return v !== undefined;
|
|
1042
1042
|
}));
|
|
1043
1043
|
}
|
|
1044
|
+
function filterNavMenuItemsByConditions(navMenuItems) {
|
|
1045
|
+
return navMenuItems
|
|
1046
|
+
.filter(function (item) { return item.condition === undefined || item.condition; })
|
|
1047
|
+
.map(function (item) { return (__assign(__assign({}, item), { routes: item.routes
|
|
1048
|
+
? filterNavMenuItemsByConditions(item.routes)
|
|
1049
|
+
: undefined })); });
|
|
1050
|
+
}
|
|
1044
1051
|
// width: 100% needed because parent is display: flex, which is needed for the min-height behavior.
|
|
1045
|
-
var baseStyles = "\n.ant-pro-layout-bg-list {\n display: none;\n}\n.ant-pro-layout {\n display: flex;\n width: 100%;\n}\n";
|
|
1052
|
+
var baseStyles = "\n.ant-pro-layout-bg-list {\n display: none;\n}\n.ant-pro-layout {\n display: flex;\n width: 100%;\n}\n.ant-pro-layout .ant-pro-layout-content {\n padding: 0;\n}\n";
|
|
1046
1053
|
function RichLayout(_a) {
|
|
1047
1054
|
var _b, _c, _d;
|
|
1048
1055
|
var children = _a.children, navMenuItems = _a.navMenuItems, _e = _a.rootUrl, rootUrl = _e === void 0 ? "/" : _e, actionsChildren = _a.actionsChildren, footerChildren = _a.footerChildren, avatarLabel = _a.avatarLabel, avatarImage = _a.avatarImage, showAvatarMenu = _a.showAvatarMenu, className = _a.className, simpleNavTheme = _a.simpleNavTheme, layoutProps = __rest(_a, ["children", "navMenuItems", "rootUrl", "actionsChildren", "footerChildren", "avatarLabel", "avatarImage", "showAvatarMenu", "className", "simpleNavTheme"]);
|
|
@@ -1085,6 +1092,27 @@ function RichLayout(_a) {
|
|
|
1085
1092
|
if (!isClient) {
|
|
1086
1093
|
return null;
|
|
1087
1094
|
}
|
|
1095
|
+
var layoutColorOverrides = isNavBgLight
|
|
1096
|
+
? undefined
|
|
1097
|
+
: {
|
|
1098
|
+
colorBgCollapsedButton: navBgColor,
|
|
1099
|
+
colorTextCollapsedButtonHover: "rgba(255,255,255,0.85)",
|
|
1100
|
+
colorTextCollapsedButton: "rgba(255,255,255,0.65)",
|
|
1101
|
+
colorMenuBackground: navBgColor,
|
|
1102
|
+
colorBgMenuItemCollapsedHover: "rgba(0,0,0,0.06)",
|
|
1103
|
+
colorBgMenuItemCollapsedSelected: "rgba(0,0,0,0.15)",
|
|
1104
|
+
colorBgMenuItemCollapsedElevated: "rgba(0,0,0,0.85)",
|
|
1105
|
+
colorMenuItemDivider: "rgba(255,255,255,0.15)",
|
|
1106
|
+
colorBgMenuItemHover: "rgba(0,0,0,0.06)",
|
|
1107
|
+
colorBgMenuItemSelected: "rgba(0,0,0,0.15)",
|
|
1108
|
+
colorTextMenuSelected: "#fff",
|
|
1109
|
+
colorTextMenuItemHover: "rgba(255,255,255,0.75)",
|
|
1110
|
+
colorTextMenu: "rgba(255,255,255,0.75)",
|
|
1111
|
+
colorTextMenuSecondary: "rgba(255,255,255,0.65)",
|
|
1112
|
+
colorTextMenuTitle: "rgba(255,255,255,0.95)",
|
|
1113
|
+
colorTextMenuActive: "rgba(255,255,255,0.95)",
|
|
1114
|
+
colorTextSubMenuSelected: "#fff",
|
|
1115
|
+
};
|
|
1088
1116
|
return (React.createElement("div", { className: className, style: { display: "flex" } },
|
|
1089
1117
|
React.createElement("style", null, baseStyles),
|
|
1090
1118
|
React.createElement(ProLayout, __assign({}, layoutProps, {
|
|
@@ -1104,36 +1132,14 @@ function RichLayout(_a) {
|
|
|
1104
1132
|
// ProConfigProvider does first read/inherit the theme/tokens from the surrounding ConfigProvider.
|
|
1105
1133
|
headerRender: function (_props, defaultDom) { return (React.createElement(ConfigProvider, { theme: { token: omitUndefined({ colorTextBase: navTextColor }) } },
|
|
1106
1134
|
React.createElement(ProConfigProvider, { dark: !isNavBgLight }, defaultDom))); }, token: {
|
|
1107
|
-
header: omitUndefined({
|
|
1108
|
-
colorBgHeader: navBgColor,
|
|
1109
|
-
}),
|
|
1135
|
+
header: omitUndefined(__assign({ colorBgHeader: navBgColor }, layoutColorOverrides)),
|
|
1110
1136
|
// Ideally, we'd do something similar to headerRender above, and just specify general dark mode to specify
|
|
1111
1137
|
// whether all components/text should be light.
|
|
1112
1138
|
// But for some reason it doesn't work, causing the bg color to be ignored (just the default dark Menu color),
|
|
1113
1139
|
// *and* the text is just dark as well.
|
|
1114
1140
|
// Haven't yet been able to unravel the pro components code to figure out the proper way to do this, so just
|
|
1115
1141
|
// bluntly specifying tokens here, as recommended in some GitHub issue.
|
|
1116
|
-
sider:
|
|
1117
|
-
? undefined
|
|
1118
|
-
: {
|
|
1119
|
-
colorBgCollapsedButton: navBgColor,
|
|
1120
|
-
colorTextCollapsedButtonHover: "rgba(255,255,255,0.85)",
|
|
1121
|
-
colorTextCollapsedButton: "rgba(255,255,255,0.65)",
|
|
1122
|
-
colorMenuBackground: navBgColor,
|
|
1123
|
-
colorBgMenuItemCollapsedHover: "rgba(0,0,0,0.06)",
|
|
1124
|
-
colorBgMenuItemCollapsedSelected: "rgba(0,0,0,0.15)",
|
|
1125
|
-
colorBgMenuItemCollapsedElevated: "rgba(0,0,0,0.85)",
|
|
1126
|
-
colorMenuItemDivider: "rgba(255,255,255,0.15)",
|
|
1127
|
-
colorBgMenuItemHover: "rgba(0,0,0,0.06)",
|
|
1128
|
-
colorBgMenuItemSelected: "rgba(0,0,0,0.15)",
|
|
1129
|
-
colorTextMenuSelected: "#fff",
|
|
1130
|
-
colorTextMenuItemHover: "rgba(255,255,255,0.75)",
|
|
1131
|
-
colorTextMenu: "rgba(255,255,255,0.75)",
|
|
1132
|
-
colorTextMenuSecondary: "rgba(255,255,255,0.65)",
|
|
1133
|
-
colorTextMenuTitle: "rgba(255,255,255,0.95)",
|
|
1134
|
-
colorTextMenuActive: "rgba(255,255,255,0.95)",
|
|
1135
|
-
colorTextSubMenuSelected: "#fff",
|
|
1136
|
-
},
|
|
1142
|
+
sider: layoutColorOverrides,
|
|
1137
1143
|
},
|
|
1138
1144
|
// Tweak defaults. ProLayout is janky and has terrible docs!
|
|
1139
1145
|
layout: (_b = layoutProps.layout) !== null && _b !== void 0 ? _b : "top", fixedHeader: (_c = layoutProps.fixedHeader) !== null && _c !== void 0 ? _c : false, fixSiderbar:
|
|
@@ -1144,7 +1150,9 @@ function RichLayout(_a) {
|
|
|
1144
1150
|
// This is always needed if you want layout mix to have effect and look any different from layout side - not clear why this should ever be false.
|
|
1145
1151
|
splitMenus: layoutProps.layout === "mix", route: {
|
|
1146
1152
|
path: rootUrl,
|
|
1147
|
-
routes: navMenuItems
|
|
1153
|
+
routes: navMenuItems
|
|
1154
|
+
? filterNavMenuItemsByConditions(navMenuItems)
|
|
1155
|
+
: undefined,
|
|
1148
1156
|
}, location: {
|
|
1149
1157
|
pathname: pathname,
|
|
1150
1158
|
}, menu: {
|
|
@@ -1181,20 +1189,25 @@ function RichLayout(_a) {
|
|
|
1181
1189
|
} }), children)));
|
|
1182
1190
|
}
|
|
1183
1191
|
|
|
1184
|
-
function generateNavMenuType(remainingDepth, displayName, defaultValue) {
|
|
1192
|
+
function generateNavMenuType(isNested, remainingDepth, displayName, defaultValue) {
|
|
1185
1193
|
return {
|
|
1186
1194
|
displayName: displayName ? displayName : "Nested items",
|
|
1187
1195
|
type: "array",
|
|
1188
1196
|
defaultValue: defaultValue,
|
|
1197
|
+
advanced: isNested,
|
|
1189
1198
|
itemType: {
|
|
1190
1199
|
type: "object",
|
|
1191
1200
|
nameFunc: function (item) {
|
|
1192
1201
|
return item.name || (!displayName ? "Unnamed nested item" : "Unnamed item");
|
|
1193
1202
|
},
|
|
1194
|
-
fields: __assign({ path: "href", name: "string"
|
|
1203
|
+
fields: __assign({ path: "href", name: "string", condition: {
|
|
1204
|
+
advanced: true,
|
|
1205
|
+
displayName: "Show only if",
|
|
1206
|
+
type: "exprEditor",
|
|
1207
|
+
} }, (remainingDepth === 0
|
|
1195
1208
|
? {}
|
|
1196
1209
|
: {
|
|
1197
|
-
routes: generateNavMenuType(remainingDepth - 1),
|
|
1210
|
+
routes: generateNavMenuType(true, remainingDepth - 1),
|
|
1198
1211
|
})),
|
|
1199
1212
|
},
|
|
1200
1213
|
};
|
|
@@ -1221,7 +1234,7 @@ var richLayoutMeta = {
|
|
|
1221
1234
|
type: "imageUrl",
|
|
1222
1235
|
defaultValue: "https://www.plasmic.app/favicon.ico",
|
|
1223
1236
|
},
|
|
1224
|
-
navMenuItems: generateNavMenuType(2, "Nav menu items", [
|
|
1237
|
+
navMenuItems: generateNavMenuType(false, 2, "Nav menu items", [
|
|
1225
1238
|
{
|
|
1226
1239
|
path: "/",
|
|
1227
1240
|
name: "Link 1",
|