@plasmicpkgs/plasmic-rich-components 1.0.153 → 1.0.155
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/field-react-utils.d.ts +8 -1
- package/dist/index.js +268 -241
- package/dist/index.js.map +1 -1
- package/dist/plasmic-rich-components.esm.js +270 -243
- package/dist/plasmic-rich-components.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -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,
|
|
6
|
+
import React, { useState, useEffect, useMemo, useRef } 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 {
|
|
13
|
+
import { 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';
|
|
@@ -126,33 +126,33 @@ class ErrorBoundary extends React.Component {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
var __defProp$
|
|
130
|
-
var __defProps$
|
|
131
|
-
var __getOwnPropDescs$
|
|
132
|
-
var __getOwnPropSymbols$
|
|
133
|
-
var __hasOwnProp$
|
|
134
|
-
var __propIsEnum$
|
|
135
|
-
var __defNormalProp$
|
|
136
|
-
var __spreadValues$
|
|
129
|
+
var __defProp$c = Object.defineProperty;
|
|
130
|
+
var __defProps$9 = Object.defineProperties;
|
|
131
|
+
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
132
|
+
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
133
|
+
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
134
|
+
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
135
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
136
|
+
var __spreadValues$c = (a, b) => {
|
|
137
137
|
for (var prop in b || (b = {}))
|
|
138
|
-
if (__hasOwnProp$
|
|
139
|
-
__defNormalProp$
|
|
140
|
-
if (__getOwnPropSymbols$
|
|
141
|
-
for (var prop of __getOwnPropSymbols$
|
|
142
|
-
if (__propIsEnum$
|
|
143
|
-
__defNormalProp$
|
|
138
|
+
if (__hasOwnProp$c.call(b, prop))
|
|
139
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
140
|
+
if (__getOwnPropSymbols$c)
|
|
141
|
+
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
142
|
+
if (__propIsEnum$c.call(b, prop))
|
|
143
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
144
144
|
}
|
|
145
145
|
return a;
|
|
146
146
|
};
|
|
147
|
-
var __spreadProps$
|
|
147
|
+
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
148
148
|
var __objRest$3 = (source, exclude) => {
|
|
149
149
|
var target = {};
|
|
150
150
|
for (var prop in source)
|
|
151
|
-
if (__hasOwnProp$
|
|
151
|
+
if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
152
152
|
target[prop] = source[prop];
|
|
153
|
-
if (source != null && __getOwnPropSymbols$
|
|
154
|
-
for (var prop of __getOwnPropSymbols$
|
|
155
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
153
|
+
if (source != null && __getOwnPropSymbols$c)
|
|
154
|
+
for (var prop of __getOwnPropSymbols$c(source)) {
|
|
155
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
|
|
156
156
|
target[prop] = source[prop];
|
|
157
157
|
}
|
|
158
158
|
return target;
|
|
@@ -188,7 +188,7 @@ function deriveValueType(cconfig) {
|
|
|
188
188
|
const NoneField = "||NoneField||";
|
|
189
189
|
const CustomField = "";
|
|
190
190
|
function getFieldSubprops(opts) {
|
|
191
|
-
return __spreadValues$
|
|
191
|
+
return __spreadValues$c(__spreadValues$c({
|
|
192
192
|
key: {
|
|
193
193
|
type: "string",
|
|
194
194
|
hidden: () => true
|
|
@@ -224,7 +224,7 @@ function getFieldSubprops(opts) {
|
|
|
224
224
|
defaultValueHint: getDefaultValueHint("title"),
|
|
225
225
|
hidden: () => !!opts.noTitle
|
|
226
226
|
},
|
|
227
|
-
expr: __spreadProps$
|
|
227
|
+
expr: __spreadProps$9(__spreadValues$c({}, rowDataType("Custom value")), {
|
|
228
228
|
hidden: (ps, ctx, { item, path: _controlPath }) => {
|
|
229
229
|
return false;
|
|
230
230
|
}
|
|
@@ -536,25 +536,25 @@ function buildFieldsPropType(_a) {
|
|
|
536
536
|
};
|
|
537
537
|
}
|
|
538
538
|
|
|
539
|
-
var __defProp$
|
|
540
|
-
var __defProps$
|
|
541
|
-
var __getOwnPropDescs$
|
|
542
|
-
var __getOwnPropSymbols$
|
|
543
|
-
var __hasOwnProp$
|
|
544
|
-
var __propIsEnum$
|
|
545
|
-
var __defNormalProp$
|
|
546
|
-
var __spreadValues$
|
|
539
|
+
var __defProp$b = Object.defineProperty;
|
|
540
|
+
var __defProps$8 = Object.defineProperties;
|
|
541
|
+
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
542
|
+
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
543
|
+
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
544
|
+
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
545
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
546
|
+
var __spreadValues$b = (a, b) => {
|
|
547
547
|
for (var prop in b || (b = {}))
|
|
548
|
-
if (__hasOwnProp$
|
|
549
|
-
__defNormalProp$
|
|
550
|
-
if (__getOwnPropSymbols$
|
|
551
|
-
for (var prop of __getOwnPropSymbols$
|
|
552
|
-
if (__propIsEnum$
|
|
553
|
-
__defNormalProp$
|
|
548
|
+
if (__hasOwnProp$b.call(b, prop))
|
|
549
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
550
|
+
if (__getOwnPropSymbols$b)
|
|
551
|
+
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
552
|
+
if (__propIsEnum$b.call(b, prop))
|
|
553
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
554
554
|
}
|
|
555
555
|
return a;
|
|
556
556
|
};
|
|
557
|
-
var __spreadProps$
|
|
557
|
+
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
558
558
|
function multiRenderValue(record, cconfigs) {
|
|
559
559
|
return cconfigs == null ? void 0 : cconfigs.flatMap(
|
|
560
560
|
(cc) => cc.isHidden ? [] : [` \u2022 `, /* @__PURE__ */ React.createElement(React.Fragment, null, renderValue(record, cc))]
|
|
@@ -628,11 +628,11 @@ function renderNumber(value, cconfig) {
|
|
|
628
628
|
if (cconfig.dataType === "number") {
|
|
629
629
|
return new Intl.NumberFormat(cconfig.locale, cconfig).format(value);
|
|
630
630
|
} else if (cconfig.dataType === "percent") {
|
|
631
|
-
return new Intl.NumberFormat(cconfig.locale, __spreadProps$
|
|
631
|
+
return new Intl.NumberFormat(cconfig.locale, __spreadProps$8(__spreadValues$b({}, cconfig), {
|
|
632
632
|
style: "percent"
|
|
633
633
|
})).format(value);
|
|
634
634
|
} else if (cconfig.dataType === "currency") {
|
|
635
|
-
return new Intl.NumberFormat(cconfig.locale, __spreadProps$
|
|
635
|
+
return new Intl.NumberFormat(cconfig.locale, __spreadProps$8(__spreadValues$b(__spreadValues$b({}, DEFAULT_CURRENCY_SETTINGS), cconfig), {
|
|
636
636
|
style: "currency"
|
|
637
637
|
})).format(value);
|
|
638
638
|
} else {
|
|
@@ -640,7 +640,7 @@ function renderNumber(value, cconfig) {
|
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
function renderDate(value, cconfig) {
|
|
643
|
-
const opts = __spreadValues$
|
|
643
|
+
const opts = __spreadValues$b(__spreadValues$b({}, DEFAULT_DATETIME_SETTINGS), cconfig);
|
|
644
644
|
if (opts.dateStyle === "none") {
|
|
645
645
|
delete opts["dateStyle"];
|
|
646
646
|
}
|
|
@@ -664,7 +664,7 @@ const UNIT_TO_MS = {
|
|
|
664
664
|
const UNITS_BY_MS = Object.keys(UNIT_TO_MS);
|
|
665
665
|
function renderRelativeDate(value, cconfig) {
|
|
666
666
|
var _a;
|
|
667
|
-
const opts = __spreadValues$
|
|
667
|
+
const opts = __spreadValues$b(__spreadValues$b({}, DEFAULT_RELATIVE_DATETIME_SETTINGS), cconfig);
|
|
668
668
|
const unit = (_a = cconfig.unit) != null ? _a : "day";
|
|
669
669
|
const formatter = new Intl.RelativeTimeFormat(cconfig.locale, opts);
|
|
670
670
|
if (isOneOf(unit, UNITS_BY_MS)) {
|
|
@@ -751,25 +751,25 @@ function asString(value) {
|
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
753
|
|
|
754
|
-
var __defProp$
|
|
755
|
-
var __defProps$
|
|
756
|
-
var __getOwnPropDescs$
|
|
757
|
-
var __getOwnPropSymbols$
|
|
758
|
-
var __hasOwnProp$
|
|
759
|
-
var __propIsEnum$
|
|
760
|
-
var __defNormalProp$
|
|
761
|
-
var __spreadValues$
|
|
754
|
+
var __defProp$a = Object.defineProperty;
|
|
755
|
+
var __defProps$7 = Object.defineProperties;
|
|
756
|
+
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
757
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
758
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
759
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
760
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
761
|
+
var __spreadValues$a = (a, b) => {
|
|
762
762
|
for (var prop in b || (b = {}))
|
|
763
|
-
if (__hasOwnProp$
|
|
764
|
-
__defNormalProp$
|
|
765
|
-
if (__getOwnPropSymbols$
|
|
766
|
-
for (var prop of __getOwnPropSymbols$
|
|
767
|
-
if (__propIsEnum$
|
|
768
|
-
__defNormalProp$
|
|
763
|
+
if (__hasOwnProp$a.call(b, prop))
|
|
764
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
765
|
+
if (__getOwnPropSymbols$a)
|
|
766
|
+
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
767
|
+
if (__propIsEnum$a.call(b, prop))
|
|
768
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
769
769
|
}
|
|
770
770
|
return a;
|
|
771
771
|
};
|
|
772
|
-
var __spreadProps$
|
|
772
|
+
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
773
773
|
function RichDetails(props) {
|
|
774
774
|
var _a;
|
|
775
775
|
const {
|
|
@@ -812,7 +812,7 @@ function useColumnDefinitions$1(data, props) {
|
|
|
812
812
|
const { mergedFields, minimalFullLengthFields } = deriveFieldConfigs(
|
|
813
813
|
fields != null ? fields : [],
|
|
814
814
|
schema,
|
|
815
|
-
(field) => __spreadValues$
|
|
815
|
+
(field) => __spreadValues$a({
|
|
816
816
|
key: mkShortId(),
|
|
817
817
|
isHidden: false,
|
|
818
818
|
dataType: "auto"
|
|
@@ -823,7 +823,7 @@ function useColumnDefinitions$1(data, props) {
|
|
|
823
823
|
expr: (currentItem) => currentItem[field.id]
|
|
824
824
|
})
|
|
825
825
|
);
|
|
826
|
-
setControlContextData == null ? void 0 : setControlContextData(__spreadProps$
|
|
826
|
+
setControlContextData == null ? void 0 : setControlContextData(__spreadProps$7(__spreadValues$a({}, data), { mergedFields, minimalFullLengthFields }));
|
|
827
827
|
const normalized = mergedFields;
|
|
828
828
|
const columnDefinitions = normalized.filter((cconfig) => !cconfig.isHidden).map((cconfig, _columnIndex, _columnsArray) => {
|
|
829
829
|
const columnDefinition = {
|
|
@@ -916,6 +916,29 @@ function isLight(color) {
|
|
|
916
916
|
return r * 0.299 + g * 0.587 + b * 0.114 > 186;
|
|
917
917
|
}
|
|
918
918
|
|
|
919
|
+
var __defProp$9 = Object.defineProperty;
|
|
920
|
+
var __defProps$6 = Object.defineProperties;
|
|
921
|
+
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
922
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
923
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
924
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
925
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
926
|
+
var __spreadValues$9 = (a, b) => {
|
|
927
|
+
for (var prop in b || (b = {}))
|
|
928
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
929
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
930
|
+
if (__getOwnPropSymbols$9)
|
|
931
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
932
|
+
if (__propIsEnum$9.call(b, prop))
|
|
933
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
934
|
+
}
|
|
935
|
+
return a;
|
|
936
|
+
};
|
|
937
|
+
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
938
|
+
const AnchorLink = React.forwardRef(function AnchorLink2(props, ref) {
|
|
939
|
+
return /* @__PURE__ */ React.createElement("a", __spreadProps$6(__spreadValues$9({}, props), { ref }));
|
|
940
|
+
});
|
|
941
|
+
|
|
919
942
|
var __defProp$8 = Object.defineProperty;
|
|
920
943
|
var __defProps$5 = Object.defineProperties;
|
|
921
944
|
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
@@ -935,37 +958,14 @@ var __spreadValues$8 = (a, b) => {
|
|
|
935
958
|
return a;
|
|
936
959
|
};
|
|
937
960
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
938
|
-
const AnchorLink = React.forwardRef(function AnchorLink2(props, ref) {
|
|
939
|
-
return /* @__PURE__ */ React.createElement("a", __spreadProps$5(__spreadValues$8({}, props), { ref }));
|
|
940
|
-
});
|
|
941
|
-
|
|
942
|
-
var __defProp$7 = Object.defineProperty;
|
|
943
|
-
var __defProps$4 = Object.defineProperties;
|
|
944
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
945
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
946
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
947
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
948
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
949
|
-
var __spreadValues$7 = (a, b) => {
|
|
950
|
-
for (var prop in b || (b = {}))
|
|
951
|
-
if (__hasOwnProp$7.call(b, prop))
|
|
952
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
953
|
-
if (__getOwnPropSymbols$7)
|
|
954
|
-
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
955
|
-
if (__propIsEnum$7.call(b, prop))
|
|
956
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
957
|
-
}
|
|
958
|
-
return a;
|
|
959
|
-
};
|
|
960
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
961
961
|
var __objRest$2 = (source, exclude) => {
|
|
962
962
|
var target = {};
|
|
963
963
|
for (var prop in source)
|
|
964
|
-
if (__hasOwnProp$
|
|
964
|
+
if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
965
965
|
target[prop] = source[prop];
|
|
966
|
-
if (source != null && __getOwnPropSymbols$
|
|
967
|
-
for (var prop of __getOwnPropSymbols$
|
|
968
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
966
|
+
if (source != null && __getOwnPropSymbols$8)
|
|
967
|
+
for (var prop of __getOwnPropSymbols$8(source)) {
|
|
968
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
|
|
969
969
|
target[prop] = source[prop];
|
|
970
970
|
}
|
|
971
971
|
return target;
|
|
@@ -976,7 +976,7 @@ function omitUndefined(x) {
|
|
|
976
976
|
);
|
|
977
977
|
}
|
|
978
978
|
function processNavItems(navMenuItems) {
|
|
979
|
-
return navMenuItems.filter((item) => item.condition === void 0 || item.condition).map((item) => __spreadProps$
|
|
979
|
+
return navMenuItems.filter((item) => item.condition === void 0 || item.condition).map((item) => __spreadProps$5(__spreadValues$8({}, item), {
|
|
980
980
|
// We fill a default path because otherwise the item doesn't appear at all.
|
|
981
981
|
path: item.path || "/",
|
|
982
982
|
routes: item.routes ? processNavItems(item.routes) : void 0
|
|
@@ -1023,7 +1023,6 @@ function RichLayout(_a) {
|
|
|
1023
1023
|
"logoElement"
|
|
1024
1024
|
]);
|
|
1025
1025
|
var _a2, _b2, _c, _d, _e;
|
|
1026
|
-
const $ctx = useDataEnv();
|
|
1027
1026
|
const isClient = useIsClient();
|
|
1028
1027
|
const [pathname, setPathname] = useState(void 0);
|
|
1029
1028
|
useEffect(() => {
|
|
@@ -1031,7 +1030,7 @@ function RichLayout(_a) {
|
|
|
1031
1030
|
setPathname(location.pathname);
|
|
1032
1031
|
}
|
|
1033
1032
|
}, []);
|
|
1034
|
-
const
|
|
1033
|
+
const Link = (_b2 = (_a2 = usePlasmicLink) == null ? void 0 : _a2()) != null ? _b2 : AnchorLink;
|
|
1035
1034
|
const { token } = theme.useToken();
|
|
1036
1035
|
const origTextColor = token.colorTextBase;
|
|
1037
1036
|
function getNavBgColor() {
|
|
@@ -1078,7 +1077,7 @@ function RichLayout(_a) {
|
|
|
1078
1077
|
};
|
|
1079
1078
|
return /* @__PURE__ */ React.createElement("div", { className, style: { display: "flex" } }, /* @__PURE__ */ React.createElement("style", null, baseStyles), /* @__PURE__ */ React.createElement(
|
|
1080
1079
|
ProLayout,
|
|
1081
|
-
__spreadProps$
|
|
1080
|
+
__spreadProps$5(__spreadValues$8({}, layoutProps), {
|
|
1082
1081
|
pageTitleRender: () => "",
|
|
1083
1082
|
logo: logo != null ? logo : logoElement,
|
|
1084
1083
|
headerRender: (_props, defaultDom) => /* @__PURE__ */ React.createElement(
|
|
@@ -1089,7 +1088,7 @@ function RichLayout(_a) {
|
|
|
1089
1088
|
/* @__PURE__ */ React.createElement(ProConfigProvider, { dark: !isNavBgLight }, defaultDom)
|
|
1090
1089
|
),
|
|
1091
1090
|
token: {
|
|
1092
|
-
header: omitUndefined(__spreadValues$
|
|
1091
|
+
header: omitUndefined(__spreadValues$8({
|
|
1093
1092
|
colorBgHeader: navBgColor
|
|
1094
1093
|
}, layoutColorOverrides)),
|
|
1095
1094
|
// Ideally, we'd do something similar to headerRender above, and just specify general dark mode to specify
|
|
@@ -1150,29 +1149,28 @@ function RichLayout(_a) {
|
|
|
1150
1149
|
return footerChildren;
|
|
1151
1150
|
},
|
|
1152
1151
|
onMenuHeaderClick: (e) => console.log(e),
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
return /* @__PURE__ */ React.createElement(PlasmicLink, { href: rootUrl }, logoEl, title);
|
|
1152
|
+
menuItemRender: (item, dom) => /* @__PURE__ */ React.createElement(Link, { href: item.path }, dom),
|
|
1153
|
+
headerTitleRender: (logo2, title, _) => {
|
|
1154
|
+
return /* @__PURE__ */ React.createElement(Link, { href: rootUrl }, logo2, title);
|
|
1157
1155
|
}
|
|
1158
1156
|
}),
|
|
1159
1157
|
children
|
|
1160
1158
|
));
|
|
1161
1159
|
}
|
|
1162
1160
|
|
|
1163
|
-
var __defProp$
|
|
1164
|
-
var __getOwnPropSymbols$
|
|
1165
|
-
var __hasOwnProp$
|
|
1166
|
-
var __propIsEnum$
|
|
1167
|
-
var __defNormalProp$
|
|
1168
|
-
var __spreadValues$
|
|
1161
|
+
var __defProp$7 = Object.defineProperty;
|
|
1162
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1163
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1164
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1165
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1166
|
+
var __spreadValues$7 = (a, b) => {
|
|
1169
1167
|
for (var prop in b || (b = {}))
|
|
1170
|
-
if (__hasOwnProp$
|
|
1171
|
-
__defNormalProp$
|
|
1172
|
-
if (__getOwnPropSymbols$
|
|
1173
|
-
for (var prop of __getOwnPropSymbols$
|
|
1174
|
-
if (__propIsEnum$
|
|
1175
|
-
__defNormalProp$
|
|
1168
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
1169
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
1170
|
+
if (__getOwnPropSymbols$7)
|
|
1171
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
1172
|
+
if (__propIsEnum$7.call(b, prop))
|
|
1173
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
1176
1174
|
}
|
|
1177
1175
|
return a;
|
|
1178
1176
|
};
|
|
@@ -1185,7 +1183,7 @@ function generateNavMenuType(isNested, remainingDepth, displayName, defaultValue
|
|
|
1185
1183
|
itemType: {
|
|
1186
1184
|
type: "object",
|
|
1187
1185
|
nameFunc: (item) => item.name || (!displayName ? "Unnamed nested item" : "Unnamed item"),
|
|
1188
|
-
fields: __spreadValues$
|
|
1186
|
+
fields: __spreadValues$7({
|
|
1189
1187
|
path: "href",
|
|
1190
1188
|
name: "string",
|
|
1191
1189
|
condition: {
|
|
@@ -1351,6 +1349,152 @@ function registerRichLayout(loader) {
|
|
|
1351
1349
|
registerComponentHelper(loader, RichLayout, richLayoutMeta);
|
|
1352
1350
|
}
|
|
1353
1351
|
|
|
1352
|
+
function roleProp({
|
|
1353
|
+
role,
|
|
1354
|
+
singular = false,
|
|
1355
|
+
advanced = false,
|
|
1356
|
+
displayName
|
|
1357
|
+
}) {
|
|
1358
|
+
return singular ? {
|
|
1359
|
+
type: "object",
|
|
1360
|
+
displayName: displayName || `${capitalize(role)} field`,
|
|
1361
|
+
advanced,
|
|
1362
|
+
hidden: (ps) => !ps.data,
|
|
1363
|
+
nameFunc: (item) => maybe(
|
|
1364
|
+
item,
|
|
1365
|
+
(i) => i.isHidden ? "Hidden" : i.fieldId || "Custom value"
|
|
1366
|
+
),
|
|
1367
|
+
fields: getFieldSubprops({
|
|
1368
|
+
canChangeField: true,
|
|
1369
|
+
noTitle: true
|
|
1370
|
+
}),
|
|
1371
|
+
defaultValueHint: (_props, contextData) => {
|
|
1372
|
+
var _a;
|
|
1373
|
+
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).find(
|
|
1374
|
+
(f) => f.role === role
|
|
1375
|
+
);
|
|
1376
|
+
}
|
|
1377
|
+
} : buildFieldsPropType({
|
|
1378
|
+
displayName: displayName || `${capitalize(role)} fields`,
|
|
1379
|
+
advanced,
|
|
1380
|
+
noTitle: true,
|
|
1381
|
+
canChangeField: true,
|
|
1382
|
+
minimalValue: (_props, contextData) => {
|
|
1383
|
+
var _a;
|
|
1384
|
+
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).filter(
|
|
1385
|
+
(f) => f.role === role
|
|
1386
|
+
);
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
function dataProp() {
|
|
1391
|
+
return {
|
|
1392
|
+
type: "dataSourceOpData",
|
|
1393
|
+
description: "The data to display"
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1396
|
+
function commonProps() {
|
|
1397
|
+
return {
|
|
1398
|
+
pagination: {
|
|
1399
|
+
type: "boolean",
|
|
1400
|
+
advanced: true,
|
|
1401
|
+
defaultValueHint: true
|
|
1402
|
+
},
|
|
1403
|
+
pageSize: {
|
|
1404
|
+
type: "number",
|
|
1405
|
+
defaultValueHint: 10,
|
|
1406
|
+
advanced: true
|
|
1407
|
+
},
|
|
1408
|
+
hideSearch: {
|
|
1409
|
+
type: "boolean",
|
|
1410
|
+
description: "Hides the search toolbar",
|
|
1411
|
+
advanced: true
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
function rowActionsProp() {
|
|
1416
|
+
return {
|
|
1417
|
+
type: "array",
|
|
1418
|
+
displayName: "Row actions",
|
|
1419
|
+
advanced: true,
|
|
1420
|
+
itemType: {
|
|
1421
|
+
type: "object",
|
|
1422
|
+
nameFunc: (item) => item.label,
|
|
1423
|
+
fields: {
|
|
1424
|
+
type: {
|
|
1425
|
+
type: "choice",
|
|
1426
|
+
options: ["item", "menu"],
|
|
1427
|
+
defaultValue: "item"
|
|
1428
|
+
},
|
|
1429
|
+
label: {
|
|
1430
|
+
type: "string",
|
|
1431
|
+
displayName: "Action label"
|
|
1432
|
+
},
|
|
1433
|
+
children: {
|
|
1434
|
+
type: "array",
|
|
1435
|
+
displayName: "Menu items",
|
|
1436
|
+
itemType: {
|
|
1437
|
+
type: "object",
|
|
1438
|
+
fields: {
|
|
1439
|
+
label: {
|
|
1440
|
+
type: "string",
|
|
1441
|
+
displayName: "Action label"
|
|
1442
|
+
},
|
|
1443
|
+
onClick: {
|
|
1444
|
+
type: "eventHandler",
|
|
1445
|
+
argTypes: [
|
|
1446
|
+
{ name: "rowKey", type: "string" },
|
|
1447
|
+
{ name: "row", type: "object" }
|
|
1448
|
+
]
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
},
|
|
1452
|
+
hidden: (_ps, _ctx, { item }) => item.type !== "menu"
|
|
1453
|
+
},
|
|
1454
|
+
onClick: {
|
|
1455
|
+
type: "eventHandler",
|
|
1456
|
+
displayName: "Action",
|
|
1457
|
+
argTypes: [
|
|
1458
|
+
{ name: "rowKey", type: "string" },
|
|
1459
|
+
{ name: "row", type: "object" }
|
|
1460
|
+
],
|
|
1461
|
+
hidden: (_ps, _ctx, { item }) => item.type !== "item"
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
function onRowClickProp() {
|
|
1468
|
+
return {
|
|
1469
|
+
type: "eventHandler",
|
|
1470
|
+
displayName: "On row clicked",
|
|
1471
|
+
argTypes: [
|
|
1472
|
+
{ name: "rowKey", type: "string" },
|
|
1473
|
+
{ name: "row", type: "object" },
|
|
1474
|
+
{ name: "event", type: "object" }
|
|
1475
|
+
]
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
var __defProp$6 = Object.defineProperty;
|
|
1480
|
+
var __defProps$4 = Object.defineProperties;
|
|
1481
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1482
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1483
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1484
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1485
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1486
|
+
var __spreadValues$6 = (a, b) => {
|
|
1487
|
+
for (var prop in b || (b = {}))
|
|
1488
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
1489
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1490
|
+
if (__getOwnPropSymbols$6)
|
|
1491
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1492
|
+
if (__propIsEnum$6.call(b, prop))
|
|
1493
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1494
|
+
}
|
|
1495
|
+
return a;
|
|
1496
|
+
};
|
|
1497
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1354
1498
|
function useSortedFilteredData(data, columns) {
|
|
1355
1499
|
const [search, setSearch] = useState("");
|
|
1356
1500
|
const [sortState, setSortState] = useState(void 0);
|
|
@@ -1387,11 +1531,19 @@ function useSortedFilteredData(data, columns) {
|
|
|
1387
1531
|
setSortState
|
|
1388
1532
|
};
|
|
1389
1533
|
}
|
|
1390
|
-
function
|
|
1534
|
+
function tagDataArray(xs) {
|
|
1535
|
+
return xs.map((x, i) => __spreadProps$4(__spreadValues$6({}, x), { __tag: i + 1 }));
|
|
1536
|
+
}
|
|
1537
|
+
function getTag(x) {
|
|
1538
|
+
return x.__tag;
|
|
1539
|
+
}
|
|
1540
|
+
function deriveRowKey(_data, rowKey) {
|
|
1391
1541
|
if (rowKey) {
|
|
1392
1542
|
return rowKey;
|
|
1393
1543
|
}
|
|
1394
|
-
return
|
|
1544
|
+
return (x) => {
|
|
1545
|
+
return ensure(getTag(x));
|
|
1546
|
+
};
|
|
1395
1547
|
}
|
|
1396
1548
|
function deriveKeyOfRow(row, rowKey) {
|
|
1397
1549
|
if (typeof rowKey === "function") {
|
|
@@ -1508,7 +1660,13 @@ function RichTable(props) {
|
|
|
1508
1660
|
rowKey,
|
|
1509
1661
|
scopeClassName
|
|
1510
1662
|
} = props;
|
|
1511
|
-
const
|
|
1663
|
+
const normalizedData = useNormalizedData(rawData);
|
|
1664
|
+
const data = useMemo(() => {
|
|
1665
|
+
if (!(normalizedData == null ? void 0 : normalizedData.data)) {
|
|
1666
|
+
return normalizedData;
|
|
1667
|
+
}
|
|
1668
|
+
return __spreadProps$3(__spreadValues$5({}, normalizedData), { data: tagDataArray(normalizedData.data) });
|
|
1669
|
+
}, [normalizedData]);
|
|
1512
1670
|
const { columnDefinitions, normalized } = useColumnDefinitions(data, props);
|
|
1513
1671
|
const actionRef = useRef();
|
|
1514
1672
|
const { finalData, search, setSearch, setSortState } = useSortedFilteredData(
|
|
@@ -1830,133 +1988,6 @@ function ExportMenu(props) {
|
|
|
1830
1988
|
);
|
|
1831
1989
|
}
|
|
1832
1990
|
|
|
1833
|
-
function roleProp({
|
|
1834
|
-
role,
|
|
1835
|
-
singular = false,
|
|
1836
|
-
advanced = false,
|
|
1837
|
-
displayName
|
|
1838
|
-
}) {
|
|
1839
|
-
return singular ? {
|
|
1840
|
-
type: "object",
|
|
1841
|
-
displayName: displayName || `${capitalize(role)} field`,
|
|
1842
|
-
advanced,
|
|
1843
|
-
hidden: (ps) => !ps.data,
|
|
1844
|
-
nameFunc: (item) => maybe(
|
|
1845
|
-
item,
|
|
1846
|
-
(i) => i.isHidden ? "Hidden" : i.fieldId || "Custom value"
|
|
1847
|
-
),
|
|
1848
|
-
fields: getFieldSubprops({
|
|
1849
|
-
canChangeField: true,
|
|
1850
|
-
noTitle: true
|
|
1851
|
-
}),
|
|
1852
|
-
defaultValueHint: (_props, contextData) => {
|
|
1853
|
-
var _a;
|
|
1854
|
-
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).find(
|
|
1855
|
-
(f) => f.role === role
|
|
1856
|
-
);
|
|
1857
|
-
}
|
|
1858
|
-
} : buildFieldsPropType({
|
|
1859
|
-
displayName: displayName || `${capitalize(role)} fields`,
|
|
1860
|
-
advanced,
|
|
1861
|
-
noTitle: true,
|
|
1862
|
-
canChangeField: true,
|
|
1863
|
-
minimalValue: (_props, contextData) => {
|
|
1864
|
-
var _a;
|
|
1865
|
-
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).filter(
|
|
1866
|
-
(f) => f.role === role
|
|
1867
|
-
);
|
|
1868
|
-
}
|
|
1869
|
-
});
|
|
1870
|
-
}
|
|
1871
|
-
function dataProp() {
|
|
1872
|
-
return {
|
|
1873
|
-
type: "dataSourceOpData",
|
|
1874
|
-
description: "The data to display"
|
|
1875
|
-
};
|
|
1876
|
-
}
|
|
1877
|
-
function commonProps() {
|
|
1878
|
-
return {
|
|
1879
|
-
pagination: {
|
|
1880
|
-
type: "boolean",
|
|
1881
|
-
advanced: true,
|
|
1882
|
-
defaultValueHint: true
|
|
1883
|
-
},
|
|
1884
|
-
pageSize: {
|
|
1885
|
-
type: "number",
|
|
1886
|
-
defaultValueHint: 10,
|
|
1887
|
-
advanced: true
|
|
1888
|
-
},
|
|
1889
|
-
hideSearch: {
|
|
1890
|
-
type: "boolean",
|
|
1891
|
-
description: "Hides the search toolbar",
|
|
1892
|
-
advanced: true
|
|
1893
|
-
}
|
|
1894
|
-
};
|
|
1895
|
-
}
|
|
1896
|
-
function rowActionsProp() {
|
|
1897
|
-
return {
|
|
1898
|
-
type: "array",
|
|
1899
|
-
displayName: "Row actions",
|
|
1900
|
-
advanced: true,
|
|
1901
|
-
itemType: {
|
|
1902
|
-
type: "object",
|
|
1903
|
-
nameFunc: (item) => item.label,
|
|
1904
|
-
fields: {
|
|
1905
|
-
type: {
|
|
1906
|
-
type: "choice",
|
|
1907
|
-
options: ["item", "menu"],
|
|
1908
|
-
defaultValue: "item"
|
|
1909
|
-
},
|
|
1910
|
-
label: {
|
|
1911
|
-
type: "string",
|
|
1912
|
-
displayName: "Action label"
|
|
1913
|
-
},
|
|
1914
|
-
children: {
|
|
1915
|
-
type: "array",
|
|
1916
|
-
displayName: "Menu items",
|
|
1917
|
-
itemType: {
|
|
1918
|
-
type: "object",
|
|
1919
|
-
fields: {
|
|
1920
|
-
label: {
|
|
1921
|
-
type: "string",
|
|
1922
|
-
displayName: "Action label"
|
|
1923
|
-
},
|
|
1924
|
-
onClick: {
|
|
1925
|
-
type: "eventHandler",
|
|
1926
|
-
argTypes: [
|
|
1927
|
-
{ name: "rowKey", type: "string" },
|
|
1928
|
-
{ name: "row", type: "object" }
|
|
1929
|
-
]
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
},
|
|
1933
|
-
hidden: (_ps, _ctx, { item }) => item.type !== "menu"
|
|
1934
|
-
},
|
|
1935
|
-
onClick: {
|
|
1936
|
-
type: "eventHandler",
|
|
1937
|
-
displayName: "Action",
|
|
1938
|
-
argTypes: [
|
|
1939
|
-
{ name: "rowKey", type: "string" },
|
|
1940
|
-
{ name: "row", type: "object" }
|
|
1941
|
-
],
|
|
1942
|
-
hidden: (_ps, _ctx, { item }) => item.type !== "item"
|
|
1943
|
-
}
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
};
|
|
1947
|
-
}
|
|
1948
|
-
function onRowClickProp() {
|
|
1949
|
-
return {
|
|
1950
|
-
type: "eventHandler",
|
|
1951
|
-
displayName: "On row clicked",
|
|
1952
|
-
argTypes: [
|
|
1953
|
-
{ name: "rowKey", type: "string" },
|
|
1954
|
-
{ name: "row", type: "object" },
|
|
1955
|
-
{ name: "event", type: "object" }
|
|
1956
|
-
]
|
|
1957
|
-
};
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
1991
|
var __defProp$4 = Object.defineProperty;
|
|
1961
1992
|
var __defProps$2 = Object.defineProperties;
|
|
1962
1993
|
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
@@ -2027,11 +2058,7 @@ const dataTableMeta = {
|
|
|
2027
2058
|
type: "string",
|
|
2028
2059
|
displayName: "Row key",
|
|
2029
2060
|
helpText: "Column key to use as row key; can also be a function that takes in a row and returns a key value",
|
|
2030
|
-
hidden: (ps) => !ps.canSelectRows || ps.canSelectRows === "none"
|
|
2031
|
-
defaultValueHint: (ps) => {
|
|
2032
|
-
const derivedRowKey = deriveRowKey(ps.data, ps.rowKey);
|
|
2033
|
-
return derivedRowKey !== void 0 ? `${derivedRowKey}` : void 0;
|
|
2034
|
-
}
|
|
2061
|
+
hidden: (ps) => !ps.canSelectRows || ps.canSelectRows === "none"
|
|
2035
2062
|
},
|
|
2036
2063
|
selectedRowKey: {
|
|
2037
2064
|
type: "string",
|