@plasmicpkgs/plasmic-rich-components 1.0.78 → 1.0.79
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
|
@@ -6,8 +6,6 @@ var proComponents = require('@ant-design/pro-components');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var antd = require('antd');
|
|
8
8
|
var icons = require('@ant-design/icons');
|
|
9
|
-
var lib = require('@ant-design/pro-utils/lib');
|
|
10
|
-
var configProvider = require('antd/es/config-provider');
|
|
11
9
|
var csvWriterBrowser = require('csv-writer-browser');
|
|
12
10
|
var fastStringify = require('fast-stringify');
|
|
13
11
|
|
|
@@ -209,10 +207,11 @@ function buildFieldsPropType(opts) {
|
|
|
209
207
|
displayName: displayName,
|
|
210
208
|
control: control,
|
|
211
209
|
argNames: ["currentItem", "currentValue"],
|
|
212
|
-
argValues: function (_props, ctx) {
|
|
213
|
-
var
|
|
214
|
-
var
|
|
215
|
-
var
|
|
210
|
+
argValues: function (_props, ctx, _a) {
|
|
211
|
+
var _b;
|
|
212
|
+
var item = _a.item;
|
|
213
|
+
var row = (_b = ctx === null || ctx === void 0 ? void 0 : ctx.data) === null || _b === void 0 ? void 0 : _b[0];
|
|
214
|
+
var cell = item.fieldId ? row === null || row === void 0 ? void 0 : row[item.fieldId] : undefined;
|
|
216
215
|
return [row, cell];
|
|
217
216
|
},
|
|
218
217
|
});
|
|
@@ -259,7 +258,7 @@ function buildFieldsPropType(opts) {
|
|
|
259
258
|
type: "string",
|
|
260
259
|
displayName: "Title",
|
|
261
260
|
defaultValueHint: getDefaultValueHint("title"),
|
|
262
|
-
}, expr: rowDataType("Customize data"), isHidden: {
|
|
261
|
+
}, expr: rowDataType("Customize cell data"), isHidden: {
|
|
263
262
|
type: "boolean",
|
|
264
263
|
displayName: "Is hidden",
|
|
265
264
|
defaultValueHint: getDefaultValueHint("isHidden"),
|
|
@@ -873,7 +872,10 @@ function useColumnDefinitions$1(data, props) {
|
|
|
873
872
|
return defaultRender(_);
|
|
874
873
|
},
|
|
875
874
|
render: function (value, record, rowIndex) {
|
|
876
|
-
|
|
875
|
+
var cellValue = cconfig.fieldId
|
|
876
|
+
? record[cconfig.fieldId]
|
|
877
|
+
: undefined;
|
|
878
|
+
return renderValue(cellValue, record, cconfig);
|
|
877
879
|
},
|
|
878
880
|
};
|
|
879
881
|
return columnDefinition;
|
|
@@ -951,12 +953,9 @@ function capitalize(text) {
|
|
|
951
953
|
return text.slice(0, 1).toUpperCase() + text.slice(1);
|
|
952
954
|
}
|
|
953
955
|
|
|
954
|
-
function ensureArray(xs) {
|
|
955
|
-
return Array.isArray(xs) ? xs : [xs];
|
|
956
|
-
}
|
|
957
956
|
function RichLayout(_a) {
|
|
958
957
|
var _b, _c, _d;
|
|
959
|
-
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,
|
|
958
|
+
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, layoutProps = __rest(_a, ["children", "navMenuItems", "rootUrl", "actionsChildren", "footerChildren", "avatarLabel", "avatarImage", "showAvatarMenu", "className"]);
|
|
960
959
|
var isClient = useIsClient();
|
|
961
960
|
var _f = React.useState(undefined), pathname = _f[0], setPathname = _f[1];
|
|
962
961
|
React.useEffect(function () {
|
|
@@ -964,58 +963,12 @@ function RichLayout(_a) {
|
|
|
964
963
|
setPathname(location.pathname);
|
|
965
964
|
}
|
|
966
965
|
}, []);
|
|
967
|
-
var _g = React.useContext(configProvider.ConfigContext); _g.locale; var th = _g.theme; __rest(_g, ["locale", "theme"]);
|
|
968
|
-
var token = antd.theme.useToken().token;
|
|
969
|
-
var inDarkMode = ensureArray(th === null || th === void 0 ? void 0 : th.algorithm).includes(antd.theme.darkAlgorithm);
|
|
970
|
-
var bgColor = (simpleNavTheme === null || simpleNavTheme === void 0 ? void 0 : simpleNavTheme.scheme) === "accent"
|
|
971
|
-
? token.colorPrimary
|
|
972
|
-
: (simpleNavTheme === null || simpleNavTheme === void 0 ? void 0 : simpleNavTheme.scheme) === "dark"
|
|
973
|
-
? // This is the default dark Menu color in Ant.
|
|
974
|
-
"#011528"
|
|
975
|
-
: inDarkMode
|
|
976
|
-
? // Just use this sorta ugly gray if using 'light' scheme in 'dark' mode....
|
|
977
|
-
"rgba(0,0,0,0.6)"
|
|
978
|
-
: // Using 'light' scheme in 'light' mode
|
|
979
|
-
undefined;
|
|
980
966
|
if (!isClient) {
|
|
981
967
|
return null;
|
|
982
968
|
}
|
|
983
969
|
return (React__default.default.createElement("div", { className: className },
|
|
984
970
|
React__default.default.createElement("style", null, ".ant-pro-layout-bg-list {\n display: none;\n }"),
|
|
985
971
|
React__default.default.createElement(proComponents.ProLayout, __assign({}, layoutProps, {
|
|
986
|
-
// Theme just the header. If you simply pass in navTheme=realDark, it affects all main content as well.
|
|
987
|
-
headerRender: function (props, defaultDom) { return (React__default.default.createElement(proComponents.ProConfigProvider, { dark: (simpleNavTheme === null || simpleNavTheme === void 0 ? void 0 : simpleNavTheme.scheme) !== "light" }, defaultDom)); }, token: {
|
|
988
|
-
header: lib.omitUndefined({
|
|
989
|
-
colorBgHeader: bgColor,
|
|
990
|
-
}),
|
|
991
|
-
// Ideally, we'd do something similar to headerRender above, and just specify general dark mode to specify
|
|
992
|
-
// whether all components/text should be light.
|
|
993
|
-
// But for some reason it doesn't work, causing the bg color to be ignored (just the default dark Menu color),
|
|
994
|
-
// *and* the text is just dark as well.
|
|
995
|
-
// Haven't bothered debugging the pro components code to figure out the proper way to do this, so just
|
|
996
|
-
// bluntly specifying tokens here.
|
|
997
|
-
sider: !inDarkMode && (simpleNavTheme === null || simpleNavTheme === void 0 ? void 0 : simpleNavTheme.scheme) === "light"
|
|
998
|
-
? undefined
|
|
999
|
-
: {
|
|
1000
|
-
colorBgCollapsedButton: "#fff",
|
|
1001
|
-
colorTextCollapsedButtonHover: "rgba(0,0,0,0.65)",
|
|
1002
|
-
colorTextCollapsedButton: "rgba(0,0,0,0.45)",
|
|
1003
|
-
colorMenuBackground: bgColor,
|
|
1004
|
-
colorBgMenuItemCollapsedHover: "rgba(0,0,0,0.06)",
|
|
1005
|
-
colorBgMenuItemCollapsedSelected: "rgba(0,0,0,0.15)",
|
|
1006
|
-
colorBgMenuItemCollapsedElevated: "rgba(0,0,0,0.85)",
|
|
1007
|
-
colorMenuItemDivider: "rgba(255,255,255,0.15)",
|
|
1008
|
-
colorBgMenuItemHover: "rgba(0,0,0,0.06)",
|
|
1009
|
-
colorBgMenuItemSelected: "rgba(0,0,0,0.15)",
|
|
1010
|
-
colorTextMenuSelected: "#fff",
|
|
1011
|
-
colorTextMenuItemHover: "rgba(255,255,255,0.75)",
|
|
1012
|
-
colorTextMenu: "rgba(255,255,255,0.75)",
|
|
1013
|
-
colorTextMenuSecondary: "rgba(255,255,255,0.65)",
|
|
1014
|
-
colorTextMenuTitle: "rgba(255,255,255,0.95)",
|
|
1015
|
-
colorTextMenuActive: "rgba(255,255,255,0.95)",
|
|
1016
|
-
colorTextSubMenuSelected: "#fff",
|
|
1017
|
-
},
|
|
1018
|
-
},
|
|
1019
972
|
// Tweak defaults. ProLayout is janky and has terrible docs!
|
|
1020
973
|
layout: (_b = layoutProps.layout) !== null && _b !== void 0 ? _b : "top", fixedHeader: (_c = layoutProps.fixedHeader) !== null && _c !== void 0 ? _c : false, fixSiderbar:
|
|
1021
974
|
// Doesn't stretch full height if you set this to false and you're in mix mode.
|
|
@@ -1032,7 +985,7 @@ function RichLayout(_a) {
|
|
|
1032
985
|
// collapsedShowGroupTitle: true,
|
|
1033
986
|
defaultOpenAll: true,
|
|
1034
987
|
// hideMenuWhenCollapsed: true,
|
|
1035
|
-
}, avatarProps: showAvatarMenu &&
|
|
988
|
+
}, avatarProps: showAvatarMenu && false
|
|
1036
989
|
? {
|
|
1037
990
|
src: avatarImage,
|
|
1038
991
|
size: "small",
|
|
@@ -1072,7 +1025,7 @@ function generateNavMenuType(remainingDepth, displayName, defaultValue) {
|
|
|
1072
1025
|
nameFunc: function (item) {
|
|
1073
1026
|
return item.name || (!displayName ? "Unnamed nested item" : "Unnamed item");
|
|
1074
1027
|
},
|
|
1075
|
-
fields: __assign({ path: "
|
|
1028
|
+
fields: __assign({ path: "href", name: "string" }, (remainingDepth === 0
|
|
1076
1029
|
? {}
|
|
1077
1030
|
: {
|
|
1078
1031
|
routes: generateNavMenuType(remainingDepth - 1),
|
|
@@ -1121,21 +1074,6 @@ var richLayoutMeta = {
|
|
|
1121
1074
|
}); }),
|
|
1122
1075
|
defaultValueHint: "top",
|
|
1123
1076
|
},
|
|
1124
|
-
simpleNavTheme: {
|
|
1125
|
-
displayName: "Theme",
|
|
1126
|
-
advanced: true,
|
|
1127
|
-
type: "object",
|
|
1128
|
-
fields: {
|
|
1129
|
-
scheme: {
|
|
1130
|
-
type: "choice",
|
|
1131
|
-
options: ["light", "accent", "dark"].map(function (v) { return ({
|
|
1132
|
-
label: capitalize(v),
|
|
1133
|
-
value: v,
|
|
1134
|
-
}); }),
|
|
1135
|
-
defaultValue: "accent",
|
|
1136
|
-
},
|
|
1137
|
-
},
|
|
1138
|
-
},
|
|
1139
1077
|
// Advanced, show later
|
|
1140
1078
|
/*
|
|
1141
1079
|
siderMenuType: {
|
|
@@ -1153,6 +1091,18 @@ var richLayoutMeta = {
|
|
|
1153
1091
|
options: ["Fluid", "Fixed"],
|
|
1154
1092
|
defaultValueHint: "Fluid",
|
|
1155
1093
|
},
|
|
1094
|
+
navTheme: {
|
|
1095
|
+
displayName: "Theme",
|
|
1096
|
+
type: "choice",
|
|
1097
|
+
options: [
|
|
1098
|
+
{ value: "realDark", label: "Dark" },
|
|
1099
|
+
{ value: "light", label: "Light" },
|
|
1100
|
+
],
|
|
1101
|
+
},
|
|
1102
|
+
colorPrimary: {
|
|
1103
|
+
displayName: "Primary color",
|
|
1104
|
+
type: "color",
|
|
1105
|
+
},
|
|
1156
1106
|
*/
|
|
1157
1107
|
fixedHeader: {
|
|
1158
1108
|
displayName: "Sticky header",
|
|
@@ -1360,7 +1310,10 @@ function useColumnDefinitions(data, props) {
|
|
|
1360
1310
|
return defaultRender(_);
|
|
1361
1311
|
},
|
|
1362
1312
|
render: function (value, record, rowIndex) {
|
|
1363
|
-
|
|
1313
|
+
var cellValue = cconfig.fieldId
|
|
1314
|
+
? record[cconfig.fieldId]
|
|
1315
|
+
: undefined;
|
|
1316
|
+
return renderValue(cellValue, record, cconfig);
|
|
1364
1317
|
},
|
|
1365
1318
|
};
|
|
1366
1319
|
return columnDefinition;
|