@plasmicpkgs/plasmic-rich-components 1.0.89 → 1.0.90
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
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
var registerComponent = require('@plasmicapp/host/registerComponent');
|
|
4
4
|
require('@plasmicapp/host/registerGlobalContext');
|
|
5
5
|
require('lodash/get');
|
|
6
|
-
var proComponents = require('@ant-design/pro-components');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var antd = require('antd');
|
|
9
8
|
var tinycolor = require('@ctrl/tinycolor');
|
|
10
9
|
var icons = require('@ant-design/icons');
|
|
10
|
+
var proComponents = require('@ant-design/pro-components');
|
|
11
11
|
var csvWriterBrowser = require('csv-writer-browser');
|
|
12
12
|
var fastStringify = require('fast-stringify');
|
|
13
13
|
var classNames = require('classnames');
|
|
@@ -277,7 +277,7 @@ function getFieldSubprops(opts) {
|
|
|
277
277
|
type: "boolean",
|
|
278
278
|
displayName: "Is hidden",
|
|
279
279
|
defaultValueHint: getDefaultValueHint("isHidden"),
|
|
280
|
-
} }, (opts.noDataType
|
|
280
|
+
} }, (!opts.noDataType
|
|
281
281
|
? {
|
|
282
282
|
dataType: {
|
|
283
283
|
type: "choice",
|
|
@@ -929,14 +929,15 @@ function RichDetails(props) {
|
|
|
929
929
|
var className = props.className, rawData = props.data, size = props.size, bordered = props.bordered, layout = props.layout, _b = props.column, column = _b === void 0 ? 2 : _b;
|
|
930
930
|
var data = normalizeData(rawData);
|
|
931
931
|
var columnDefinitions = useColumnDefinitions$1(data, props).columnDefinitions;
|
|
932
|
-
if (!data) {
|
|
933
|
-
return React__default.default.createElement(antd.Empty, { className: className });
|
|
932
|
+
if (!data || !((_a = data.data) === null || _a === void 0 ? void 0 : _a[0])) {
|
|
933
|
+
return React__default.default.createElement(antd.Empty, { className: className, image: antd.Empty.PRESENTED_IMAGE_SIMPLE });
|
|
934
934
|
}
|
|
935
|
-
|
|
935
|
+
var row = data.data[0];
|
|
936
|
+
return (React__default.default.createElement(antd.Descriptions, { className: className, size: size, bordered: bordered, layout: layout, column: {
|
|
936
937
|
xs: 1,
|
|
937
938
|
sm: 1,
|
|
938
939
|
md: column,
|
|
939
|
-
} }));
|
|
940
|
+
} }, columnDefinitions.map(function (col) { return (React__default.default.createElement(antd.Descriptions.Item, { label: col.title, key: col.key, span: col.span }, col.render(row))); })));
|
|
940
941
|
}
|
|
941
942
|
function useColumnDefinitions$1(data, props) {
|
|
942
943
|
var fields = props.fields, setControlContextData = props.setControlContextData;
|
|
@@ -960,21 +961,8 @@ function useColumnDefinitions$1(data, props) {
|
|
|
960
961
|
dataIndex: cconfig.fieldId,
|
|
961
962
|
title: cconfig.title,
|
|
962
963
|
key: cconfig.key,
|
|
963
|
-
valueType: deriveValueType(cconfig),
|
|
964
964
|
span: cconfig.span,
|
|
965
|
-
|
|
966
|
-
copyable: false,
|
|
967
|
-
ellipsis: false,
|
|
968
|
-
tip: undefined,
|
|
969
|
-
formItemProps: {
|
|
970
|
-
rules: [],
|
|
971
|
-
},
|
|
972
|
-
valueEnum: undefined,
|
|
973
|
-
renderFormItem: function (_, _a) {
|
|
974
|
-
var defaultRender = _a.defaultRender;
|
|
975
|
-
return defaultRender(_);
|
|
976
|
-
},
|
|
977
|
-
render: function (value, record, rowIndex) {
|
|
965
|
+
render: function (record) {
|
|
978
966
|
return renderValue(record, cconfig);
|
|
979
967
|
},
|
|
980
968
|
};
|
|
@@ -1946,6 +1934,8 @@ function RichList(props) {
|
|
|
1946
1934
|
var data = normalizeData(rawData);
|
|
1947
1935
|
var _f = useRoleDefinitions(data, props), normalized = _f.normalized, roleConfigs = _f.finalRoles;
|
|
1948
1936
|
React.useRef();
|
|
1937
|
+
// Simply ignore the linkTo if it's not a function.
|
|
1938
|
+
var linkTo = typeof props.linkTo === "function" ? props.linkTo : undefined;
|
|
1949
1939
|
var _g = useSortedFilteredData(data, normalized), finalData = _g.finalData, search = _g.search, setSearch = _g.setSearch; _g.setSortState;
|
|
1950
1940
|
var actuallyBordered = type === "list" ? bordered : false;
|
|
1951
1941
|
return (React__default.default.createElement("div", { className: className },
|
|
@@ -1974,10 +1964,9 @@ function RichList(props) {
|
|
|
1974
1964
|
: "plasmic-list-item-card-cover" })); });
|
|
1975
1965
|
var content = (React__default.default.createElement(ListItemContent, { bordered: actuallyBordered, image: type === "list" ? image : undefined, title: multiRenderValue(record, roleConfigs.title), subtitle: multiRenderValue(record, roleConfigs.subtitle), beforeTitle: multiRenderValue(record, roleConfigs.beforeTitle), afterTitle: multiRenderValue(record, roleConfigs.afterTitle), content: multiRenderValue(record, roleConfigs.content) }));
|
|
1976
1966
|
function makeLinkWrapper() {
|
|
1977
|
-
var _a;
|
|
1978
1967
|
if ((actions !== null && actions !== void 0 ? actions : []).length > 0)
|
|
1979
1968
|
return undefined;
|
|
1980
|
-
var href =
|
|
1969
|
+
var href = linkTo === null || linkTo === void 0 ? void 0 : linkTo(record);
|
|
1981
1970
|
if (!href && !onRowClick)
|
|
1982
1971
|
return undefined;
|
|
1983
1972
|
var _linkWrapper = function (x) { return (React__default.default.createElement("a", { href: href, onClick: function (event) {
|
|
@@ -2034,7 +2023,6 @@ var defaultColumnConfig = function () {
|
|
|
2034
2023
|
});
|
|
2035
2024
|
};
|
|
2036
2025
|
var roles = [
|
|
2037
|
-
"linkTo",
|
|
2038
2026
|
"content",
|
|
2039
2027
|
"title",
|
|
2040
2028
|
"subtitle",
|
|
@@ -2076,7 +2064,7 @@ function useRoleDefinitions(data, props) {
|
|
|
2076
2064
|
}
|
|
2077
2065
|
}
|
|
2078
2066
|
// This is only being computed to get the default role choices.
|
|
2079
|
-
var _e = deriveFieldConfigs(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(
|
|
2067
|
+
var _e = deriveFieldConfigs(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], tagFieldConfigs("image"), true), tagFieldConfigs("content"), true), tagFieldConfigs("title"), true), tagFieldConfigs("beforeTitle"), true), tagFieldConfigs("afterTitle"), true), tagFieldConfigs("subtitle"), true), schema, function (field) { return (__assign(__assign({}, defaultColumnConfig()), (field && {
|
|
2080
2068
|
key: field.id,
|
|
2081
2069
|
fieldId: field.id,
|
|
2082
2070
|
title: field.label || field.id,
|
|
@@ -2206,7 +2194,7 @@ var richListMeta = {
|
|
|
2206
2194
|
}, footer: {
|
|
2207
2195
|
type: "slot",
|
|
2208
2196
|
hidePlaceholder: true,
|
|
2209
|
-
}, title: roleProp({ role: "title" }), content: roleProp({ role: "content" }), image: roleProp({ role: "image", singular: true }),
|
|
2197
|
+
}, title: roleProp({ role: "title" }), content: roleProp({ role: "content" }), image: roleProp({ role: "image", singular: true }), subtitle: roleProp({
|
|
2210
2198
|
role: "subtitle",
|
|
2211
2199
|
displayName: "Subtitle",
|
|
2212
2200
|
advanced: true,
|
|
@@ -2214,7 +2202,14 @@ var richListMeta = {
|
|
|
2214
2202
|
// Haven't styled these yet!
|
|
2215
2203
|
// beforeTitle: roleProp({ role: "beforeTitle", advanced: true }),
|
|
2216
2204
|
// afterTitle: roleProp({ role: "afterTitle", advanced: true }),
|
|
2217
|
-
|
|
2205
|
+
linkTo: {
|
|
2206
|
+
type: "function",
|
|
2207
|
+
control: {
|
|
2208
|
+
type: "href",
|
|
2209
|
+
},
|
|
2210
|
+
argNames: ["currentItem"],
|
|
2211
|
+
argValues: function (_props, ctx) { var _a; return [(_a = ctx === null || ctx === void 0 ? void 0 : ctx.data) === null || _a === void 0 ? void 0 : _a[0]]; },
|
|
2212
|
+
}, onRowClick: onRowClickProp(), rowActions: rowActionsProp(), bordered: {
|
|
2218
2213
|
type: "boolean",
|
|
2219
2214
|
defaultValue: true,
|
|
2220
2215
|
hidden: function (ps) { var _a; return ((_a = ps.type) !== null && _a !== void 0 ? _a : "list") !== "list"; },
|