@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
package/dist/index.js
CHANGED
|
@@ -140,33 +140,33 @@ class ErrorBoundary extends React__default.default.Component {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
var __defProp$
|
|
144
|
-
var __defProps$
|
|
145
|
-
var __getOwnPropDescs$
|
|
146
|
-
var __getOwnPropSymbols$
|
|
147
|
-
var __hasOwnProp$
|
|
148
|
-
var __propIsEnum$
|
|
149
|
-
var __defNormalProp$
|
|
150
|
-
var __spreadValues$
|
|
143
|
+
var __defProp$c = Object.defineProperty;
|
|
144
|
+
var __defProps$9 = Object.defineProperties;
|
|
145
|
+
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
146
|
+
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
147
|
+
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
148
|
+
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
149
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
150
|
+
var __spreadValues$c = (a, b) => {
|
|
151
151
|
for (var prop in b || (b = {}))
|
|
152
|
-
if (__hasOwnProp$
|
|
153
|
-
__defNormalProp$
|
|
154
|
-
if (__getOwnPropSymbols$
|
|
155
|
-
for (var prop of __getOwnPropSymbols$
|
|
156
|
-
if (__propIsEnum$
|
|
157
|
-
__defNormalProp$
|
|
152
|
+
if (__hasOwnProp$c.call(b, prop))
|
|
153
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
154
|
+
if (__getOwnPropSymbols$c)
|
|
155
|
+
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
156
|
+
if (__propIsEnum$c.call(b, prop))
|
|
157
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
158
158
|
}
|
|
159
159
|
return a;
|
|
160
160
|
};
|
|
161
|
-
var __spreadProps$
|
|
161
|
+
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
162
162
|
var __objRest$3 = (source, exclude) => {
|
|
163
163
|
var target = {};
|
|
164
164
|
for (var prop in source)
|
|
165
|
-
if (__hasOwnProp$
|
|
165
|
+
if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
166
166
|
target[prop] = source[prop];
|
|
167
|
-
if (source != null && __getOwnPropSymbols$
|
|
168
|
-
for (var prop of __getOwnPropSymbols$
|
|
169
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
167
|
+
if (source != null && __getOwnPropSymbols$c)
|
|
168
|
+
for (var prop of __getOwnPropSymbols$c(source)) {
|
|
169
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
|
|
170
170
|
target[prop] = source[prop];
|
|
171
171
|
}
|
|
172
172
|
return target;
|
|
@@ -202,7 +202,7 @@ function deriveValueType(cconfig) {
|
|
|
202
202
|
const NoneField = "||NoneField||";
|
|
203
203
|
const CustomField = "";
|
|
204
204
|
function getFieldSubprops(opts) {
|
|
205
|
-
return __spreadValues$
|
|
205
|
+
return __spreadValues$c(__spreadValues$c({
|
|
206
206
|
key: {
|
|
207
207
|
type: "string",
|
|
208
208
|
hidden: () => true
|
|
@@ -238,7 +238,7 @@ function getFieldSubprops(opts) {
|
|
|
238
238
|
defaultValueHint: getDefaultValueHint("title"),
|
|
239
239
|
hidden: () => !!opts.noTitle
|
|
240
240
|
},
|
|
241
|
-
expr: __spreadProps$
|
|
241
|
+
expr: __spreadProps$9(__spreadValues$c({}, rowDataType("Custom value")), {
|
|
242
242
|
hidden: (ps, ctx, { item, path: _controlPath }) => {
|
|
243
243
|
return false;
|
|
244
244
|
}
|
|
@@ -550,25 +550,25 @@ function buildFieldsPropType(_a) {
|
|
|
550
550
|
};
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
var __defProp$
|
|
554
|
-
var __defProps$
|
|
555
|
-
var __getOwnPropDescs$
|
|
556
|
-
var __getOwnPropSymbols$
|
|
557
|
-
var __hasOwnProp$
|
|
558
|
-
var __propIsEnum$
|
|
559
|
-
var __defNormalProp$
|
|
560
|
-
var __spreadValues$
|
|
553
|
+
var __defProp$b = Object.defineProperty;
|
|
554
|
+
var __defProps$8 = Object.defineProperties;
|
|
555
|
+
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
556
|
+
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
557
|
+
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
558
|
+
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
559
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
560
|
+
var __spreadValues$b = (a, b) => {
|
|
561
561
|
for (var prop in b || (b = {}))
|
|
562
|
-
if (__hasOwnProp$
|
|
563
|
-
__defNormalProp$
|
|
564
|
-
if (__getOwnPropSymbols$
|
|
565
|
-
for (var prop of __getOwnPropSymbols$
|
|
566
|
-
if (__propIsEnum$
|
|
567
|
-
__defNormalProp$
|
|
562
|
+
if (__hasOwnProp$b.call(b, prop))
|
|
563
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
564
|
+
if (__getOwnPropSymbols$b)
|
|
565
|
+
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
566
|
+
if (__propIsEnum$b.call(b, prop))
|
|
567
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
568
568
|
}
|
|
569
569
|
return a;
|
|
570
570
|
};
|
|
571
|
-
var __spreadProps$
|
|
571
|
+
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
572
572
|
function multiRenderValue(record, cconfigs) {
|
|
573
573
|
return cconfigs == null ? void 0 : cconfigs.flatMap(
|
|
574
574
|
(cc) => cc.isHidden ? [] : [` \u2022 `, /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, renderValue(record, cc))]
|
|
@@ -642,11 +642,11 @@ function renderNumber(value, cconfig) {
|
|
|
642
642
|
if (cconfig.dataType === "number") {
|
|
643
643
|
return new Intl.NumberFormat(cconfig.locale, cconfig).format(value);
|
|
644
644
|
} else if (cconfig.dataType === "percent") {
|
|
645
|
-
return new Intl.NumberFormat(cconfig.locale, __spreadProps$
|
|
645
|
+
return new Intl.NumberFormat(cconfig.locale, __spreadProps$8(__spreadValues$b({}, cconfig), {
|
|
646
646
|
style: "percent"
|
|
647
647
|
})).format(value);
|
|
648
648
|
} else if (cconfig.dataType === "currency") {
|
|
649
|
-
return new Intl.NumberFormat(cconfig.locale, __spreadProps$
|
|
649
|
+
return new Intl.NumberFormat(cconfig.locale, __spreadProps$8(__spreadValues$b(__spreadValues$b({}, DEFAULT_CURRENCY_SETTINGS), cconfig), {
|
|
650
650
|
style: "currency"
|
|
651
651
|
})).format(value);
|
|
652
652
|
} else {
|
|
@@ -654,7 +654,7 @@ function renderNumber(value, cconfig) {
|
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
656
|
function renderDate(value, cconfig) {
|
|
657
|
-
const opts = __spreadValues$
|
|
657
|
+
const opts = __spreadValues$b(__spreadValues$b({}, DEFAULT_DATETIME_SETTINGS), cconfig);
|
|
658
658
|
if (opts.dateStyle === "none") {
|
|
659
659
|
delete opts["dateStyle"];
|
|
660
660
|
}
|
|
@@ -678,7 +678,7 @@ const UNIT_TO_MS = {
|
|
|
678
678
|
const UNITS_BY_MS = Object.keys(UNIT_TO_MS);
|
|
679
679
|
function renderRelativeDate(value, cconfig) {
|
|
680
680
|
var _a;
|
|
681
|
-
const opts = __spreadValues$
|
|
681
|
+
const opts = __spreadValues$b(__spreadValues$b({}, DEFAULT_RELATIVE_DATETIME_SETTINGS), cconfig);
|
|
682
682
|
const unit = (_a = cconfig.unit) != null ? _a : "day";
|
|
683
683
|
const formatter = new Intl.RelativeTimeFormat(cconfig.locale, opts);
|
|
684
684
|
if (isOneOf(unit, UNITS_BY_MS)) {
|
|
@@ -765,25 +765,25 @@ function asString(value) {
|
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
767
|
|
|
768
|
-
var __defProp$
|
|
769
|
-
var __defProps$
|
|
770
|
-
var __getOwnPropDescs$
|
|
771
|
-
var __getOwnPropSymbols$
|
|
772
|
-
var __hasOwnProp$
|
|
773
|
-
var __propIsEnum$
|
|
774
|
-
var __defNormalProp$
|
|
775
|
-
var __spreadValues$
|
|
768
|
+
var __defProp$a = Object.defineProperty;
|
|
769
|
+
var __defProps$7 = Object.defineProperties;
|
|
770
|
+
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
771
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
772
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
773
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
774
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
775
|
+
var __spreadValues$a = (a, b) => {
|
|
776
776
|
for (var prop in b || (b = {}))
|
|
777
|
-
if (__hasOwnProp$
|
|
778
|
-
__defNormalProp$
|
|
779
|
-
if (__getOwnPropSymbols$
|
|
780
|
-
for (var prop of __getOwnPropSymbols$
|
|
781
|
-
if (__propIsEnum$
|
|
782
|
-
__defNormalProp$
|
|
777
|
+
if (__hasOwnProp$a.call(b, prop))
|
|
778
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
779
|
+
if (__getOwnPropSymbols$a)
|
|
780
|
+
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
781
|
+
if (__propIsEnum$a.call(b, prop))
|
|
782
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
783
783
|
}
|
|
784
784
|
return a;
|
|
785
785
|
};
|
|
786
|
-
var __spreadProps$
|
|
786
|
+
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
787
787
|
function RichDetails(props) {
|
|
788
788
|
var _a;
|
|
789
789
|
const {
|
|
@@ -826,7 +826,7 @@ function useColumnDefinitions$1(data, props) {
|
|
|
826
826
|
const { mergedFields, minimalFullLengthFields } = dataSources.deriveFieldConfigs(
|
|
827
827
|
fields != null ? fields : [],
|
|
828
828
|
schema,
|
|
829
|
-
(field) => __spreadValues$
|
|
829
|
+
(field) => __spreadValues$a({
|
|
830
830
|
key: mkShortId(),
|
|
831
831
|
isHidden: false,
|
|
832
832
|
dataType: "auto"
|
|
@@ -837,7 +837,7 @@ function useColumnDefinitions$1(data, props) {
|
|
|
837
837
|
expr: (currentItem) => currentItem[field.id]
|
|
838
838
|
})
|
|
839
839
|
);
|
|
840
|
-
setControlContextData == null ? void 0 : setControlContextData(__spreadProps$
|
|
840
|
+
setControlContextData == null ? void 0 : setControlContextData(__spreadProps$7(__spreadValues$a({}, data), { mergedFields, minimalFullLengthFields }));
|
|
841
841
|
const normalized = mergedFields;
|
|
842
842
|
const columnDefinitions = normalized.filter((cconfig) => !cconfig.isHidden).map((cconfig, _columnIndex, _columnsArray) => {
|
|
843
843
|
const columnDefinition = {
|
|
@@ -930,6 +930,29 @@ function isLight(color) {
|
|
|
930
930
|
return r * 0.299 + g * 0.587 + b * 0.114 > 186;
|
|
931
931
|
}
|
|
932
932
|
|
|
933
|
+
var __defProp$9 = Object.defineProperty;
|
|
934
|
+
var __defProps$6 = Object.defineProperties;
|
|
935
|
+
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
936
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
937
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
938
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
939
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
940
|
+
var __spreadValues$9 = (a, b) => {
|
|
941
|
+
for (var prop in b || (b = {}))
|
|
942
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
943
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
944
|
+
if (__getOwnPropSymbols$9)
|
|
945
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
946
|
+
if (__propIsEnum$9.call(b, prop))
|
|
947
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
948
|
+
}
|
|
949
|
+
return a;
|
|
950
|
+
};
|
|
951
|
+
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
952
|
+
const AnchorLink = React__default.default.forwardRef(function AnchorLink2(props, ref) {
|
|
953
|
+
return /* @__PURE__ */ React__default.default.createElement("a", __spreadProps$6(__spreadValues$9({}, props), { ref }));
|
|
954
|
+
});
|
|
955
|
+
|
|
933
956
|
var __defProp$8 = Object.defineProperty;
|
|
934
957
|
var __defProps$5 = Object.defineProperties;
|
|
935
958
|
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
@@ -949,37 +972,14 @@ var __spreadValues$8 = (a, b) => {
|
|
|
949
972
|
return a;
|
|
950
973
|
};
|
|
951
974
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
952
|
-
const AnchorLink = React__default.default.forwardRef(function AnchorLink2(props, ref) {
|
|
953
|
-
return /* @__PURE__ */ React__default.default.createElement("a", __spreadProps$5(__spreadValues$8({}, props), { ref }));
|
|
954
|
-
});
|
|
955
|
-
|
|
956
|
-
var __defProp$7 = Object.defineProperty;
|
|
957
|
-
var __defProps$4 = Object.defineProperties;
|
|
958
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
959
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
960
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
961
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
962
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
963
|
-
var __spreadValues$7 = (a, b) => {
|
|
964
|
-
for (var prop in b || (b = {}))
|
|
965
|
-
if (__hasOwnProp$7.call(b, prop))
|
|
966
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
967
|
-
if (__getOwnPropSymbols$7)
|
|
968
|
-
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
969
|
-
if (__propIsEnum$7.call(b, prop))
|
|
970
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
971
|
-
}
|
|
972
|
-
return a;
|
|
973
|
-
};
|
|
974
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
975
975
|
var __objRest$2 = (source, exclude) => {
|
|
976
976
|
var target = {};
|
|
977
977
|
for (var prop in source)
|
|
978
|
-
if (__hasOwnProp$
|
|
978
|
+
if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
979
979
|
target[prop] = source[prop];
|
|
980
|
-
if (source != null && __getOwnPropSymbols$
|
|
981
|
-
for (var prop of __getOwnPropSymbols$
|
|
982
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
980
|
+
if (source != null && __getOwnPropSymbols$8)
|
|
981
|
+
for (var prop of __getOwnPropSymbols$8(source)) {
|
|
982
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
|
|
983
983
|
target[prop] = source[prop];
|
|
984
984
|
}
|
|
985
985
|
return target;
|
|
@@ -990,7 +990,7 @@ function omitUndefined(x) {
|
|
|
990
990
|
);
|
|
991
991
|
}
|
|
992
992
|
function processNavItems(navMenuItems) {
|
|
993
|
-
return navMenuItems.filter((item) => item.condition === void 0 || item.condition).map((item) => __spreadProps$
|
|
993
|
+
return navMenuItems.filter((item) => item.condition === void 0 || item.condition).map((item) => __spreadProps$5(__spreadValues$8({}, item), {
|
|
994
994
|
// We fill a default path because otherwise the item doesn't appear at all.
|
|
995
995
|
path: item.path || "/",
|
|
996
996
|
routes: item.routes ? processNavItems(item.routes) : void 0
|
|
@@ -1037,7 +1037,6 @@ function RichLayout(_a) {
|
|
|
1037
1037
|
"logoElement"
|
|
1038
1038
|
]);
|
|
1039
1039
|
var _a2, _b2, _c, _d, _e;
|
|
1040
|
-
const $ctx = host.useDataEnv();
|
|
1041
1040
|
const isClient = useIsClient();
|
|
1042
1041
|
const [pathname, setPathname] = React.useState(void 0);
|
|
1043
1042
|
React.useEffect(() => {
|
|
@@ -1045,7 +1044,7 @@ function RichLayout(_a) {
|
|
|
1045
1044
|
setPathname(location.pathname);
|
|
1046
1045
|
}
|
|
1047
1046
|
}, []);
|
|
1048
|
-
const
|
|
1047
|
+
const Link = (_b2 = (_a2 = host.usePlasmicLink) == null ? void 0 : _a2()) != null ? _b2 : AnchorLink;
|
|
1049
1048
|
const { token } = antd.theme.useToken();
|
|
1050
1049
|
const origTextColor = token.colorTextBase;
|
|
1051
1050
|
function getNavBgColor() {
|
|
@@ -1092,7 +1091,7 @@ function RichLayout(_a) {
|
|
|
1092
1091
|
};
|
|
1093
1092
|
return /* @__PURE__ */ React__default.default.createElement("div", { className, style: { display: "flex" } }, /* @__PURE__ */ React__default.default.createElement("style", null, baseStyles), /* @__PURE__ */ React__default.default.createElement(
|
|
1094
1093
|
proComponents.ProLayout,
|
|
1095
|
-
__spreadProps$
|
|
1094
|
+
__spreadProps$5(__spreadValues$8({}, layoutProps), {
|
|
1096
1095
|
pageTitleRender: () => "",
|
|
1097
1096
|
logo: logo != null ? logo : logoElement,
|
|
1098
1097
|
headerRender: (_props, defaultDom) => /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -1103,7 +1102,7 @@ function RichLayout(_a) {
|
|
|
1103
1102
|
/* @__PURE__ */ React__default.default.createElement(proComponents.ProConfigProvider, { dark: !isNavBgLight }, defaultDom)
|
|
1104
1103
|
),
|
|
1105
1104
|
token: {
|
|
1106
|
-
header: omitUndefined(__spreadValues$
|
|
1105
|
+
header: omitUndefined(__spreadValues$8({
|
|
1107
1106
|
colorBgHeader: navBgColor
|
|
1108
1107
|
}, layoutColorOverrides)),
|
|
1109
1108
|
// Ideally, we'd do something similar to headerRender above, and just specify general dark mode to specify
|
|
@@ -1164,29 +1163,28 @@ function RichLayout(_a) {
|
|
|
1164
1163
|
return footerChildren;
|
|
1165
1164
|
},
|
|
1166
1165
|
onMenuHeaderClick: (e) => console.log(e),
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
return /* @__PURE__ */ React__default.default.createElement(PlasmicLink, { href: rootUrl }, logoEl, title);
|
|
1166
|
+
menuItemRender: (item, dom) => /* @__PURE__ */ React__default.default.createElement(Link, { href: item.path }, dom),
|
|
1167
|
+
headerTitleRender: (logo2, title, _) => {
|
|
1168
|
+
return /* @__PURE__ */ React__default.default.createElement(Link, { href: rootUrl }, logo2, title);
|
|
1171
1169
|
}
|
|
1172
1170
|
}),
|
|
1173
1171
|
children
|
|
1174
1172
|
));
|
|
1175
1173
|
}
|
|
1176
1174
|
|
|
1177
|
-
var __defProp$
|
|
1178
|
-
var __getOwnPropSymbols$
|
|
1179
|
-
var __hasOwnProp$
|
|
1180
|
-
var __propIsEnum$
|
|
1181
|
-
var __defNormalProp$
|
|
1182
|
-
var __spreadValues$
|
|
1175
|
+
var __defProp$7 = Object.defineProperty;
|
|
1176
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1177
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1178
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1179
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1180
|
+
var __spreadValues$7 = (a, b) => {
|
|
1183
1181
|
for (var prop in b || (b = {}))
|
|
1184
|
-
if (__hasOwnProp$
|
|
1185
|
-
__defNormalProp$
|
|
1186
|
-
if (__getOwnPropSymbols$
|
|
1187
|
-
for (var prop of __getOwnPropSymbols$
|
|
1188
|
-
if (__propIsEnum$
|
|
1189
|
-
__defNormalProp$
|
|
1182
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
1183
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
1184
|
+
if (__getOwnPropSymbols$7)
|
|
1185
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
1186
|
+
if (__propIsEnum$7.call(b, prop))
|
|
1187
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
1190
1188
|
}
|
|
1191
1189
|
return a;
|
|
1192
1190
|
};
|
|
@@ -1199,7 +1197,7 @@ function generateNavMenuType(isNested, remainingDepth, displayName, defaultValue
|
|
|
1199
1197
|
itemType: {
|
|
1200
1198
|
type: "object",
|
|
1201
1199
|
nameFunc: (item) => item.name || (!displayName ? "Unnamed nested item" : "Unnamed item"),
|
|
1202
|
-
fields: __spreadValues$
|
|
1200
|
+
fields: __spreadValues$7({
|
|
1203
1201
|
path: "href",
|
|
1204
1202
|
name: "string",
|
|
1205
1203
|
condition: {
|
|
@@ -1365,6 +1363,152 @@ function registerRichLayout(loader) {
|
|
|
1365
1363
|
registerComponentHelper(loader, RichLayout, richLayoutMeta);
|
|
1366
1364
|
}
|
|
1367
1365
|
|
|
1366
|
+
function roleProp({
|
|
1367
|
+
role,
|
|
1368
|
+
singular = false,
|
|
1369
|
+
advanced = false,
|
|
1370
|
+
displayName
|
|
1371
|
+
}) {
|
|
1372
|
+
return singular ? {
|
|
1373
|
+
type: "object",
|
|
1374
|
+
displayName: displayName || `${capitalize(role)} field`,
|
|
1375
|
+
advanced,
|
|
1376
|
+
hidden: (ps) => !ps.data,
|
|
1377
|
+
nameFunc: (item) => maybe(
|
|
1378
|
+
item,
|
|
1379
|
+
(i) => i.isHidden ? "Hidden" : i.fieldId || "Custom value"
|
|
1380
|
+
),
|
|
1381
|
+
fields: getFieldSubprops({
|
|
1382
|
+
canChangeField: true,
|
|
1383
|
+
noTitle: true
|
|
1384
|
+
}),
|
|
1385
|
+
defaultValueHint: (_props, contextData) => {
|
|
1386
|
+
var _a;
|
|
1387
|
+
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).find(
|
|
1388
|
+
(f) => f.role === role
|
|
1389
|
+
);
|
|
1390
|
+
}
|
|
1391
|
+
} : buildFieldsPropType({
|
|
1392
|
+
displayName: displayName || `${capitalize(role)} fields`,
|
|
1393
|
+
advanced,
|
|
1394
|
+
noTitle: true,
|
|
1395
|
+
canChangeField: true,
|
|
1396
|
+
minimalValue: (_props, contextData) => {
|
|
1397
|
+
var _a;
|
|
1398
|
+
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).filter(
|
|
1399
|
+
(f) => f.role === role
|
|
1400
|
+
);
|
|
1401
|
+
}
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
function dataProp() {
|
|
1405
|
+
return {
|
|
1406
|
+
type: "dataSourceOpData",
|
|
1407
|
+
description: "The data to display"
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
function commonProps() {
|
|
1411
|
+
return {
|
|
1412
|
+
pagination: {
|
|
1413
|
+
type: "boolean",
|
|
1414
|
+
advanced: true,
|
|
1415
|
+
defaultValueHint: true
|
|
1416
|
+
},
|
|
1417
|
+
pageSize: {
|
|
1418
|
+
type: "number",
|
|
1419
|
+
defaultValueHint: 10,
|
|
1420
|
+
advanced: true
|
|
1421
|
+
},
|
|
1422
|
+
hideSearch: {
|
|
1423
|
+
type: "boolean",
|
|
1424
|
+
description: "Hides the search toolbar",
|
|
1425
|
+
advanced: true
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
function rowActionsProp() {
|
|
1430
|
+
return {
|
|
1431
|
+
type: "array",
|
|
1432
|
+
displayName: "Row actions",
|
|
1433
|
+
advanced: true,
|
|
1434
|
+
itemType: {
|
|
1435
|
+
type: "object",
|
|
1436
|
+
nameFunc: (item) => item.label,
|
|
1437
|
+
fields: {
|
|
1438
|
+
type: {
|
|
1439
|
+
type: "choice",
|
|
1440
|
+
options: ["item", "menu"],
|
|
1441
|
+
defaultValue: "item"
|
|
1442
|
+
},
|
|
1443
|
+
label: {
|
|
1444
|
+
type: "string",
|
|
1445
|
+
displayName: "Action label"
|
|
1446
|
+
},
|
|
1447
|
+
children: {
|
|
1448
|
+
type: "array",
|
|
1449
|
+
displayName: "Menu items",
|
|
1450
|
+
itemType: {
|
|
1451
|
+
type: "object",
|
|
1452
|
+
fields: {
|
|
1453
|
+
label: {
|
|
1454
|
+
type: "string",
|
|
1455
|
+
displayName: "Action label"
|
|
1456
|
+
},
|
|
1457
|
+
onClick: {
|
|
1458
|
+
type: "eventHandler",
|
|
1459
|
+
argTypes: [
|
|
1460
|
+
{ name: "rowKey", type: "string" },
|
|
1461
|
+
{ name: "row", type: "object" }
|
|
1462
|
+
]
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
},
|
|
1466
|
+
hidden: (_ps, _ctx, { item }) => item.type !== "menu"
|
|
1467
|
+
},
|
|
1468
|
+
onClick: {
|
|
1469
|
+
type: "eventHandler",
|
|
1470
|
+
displayName: "Action",
|
|
1471
|
+
argTypes: [
|
|
1472
|
+
{ name: "rowKey", type: "string" },
|
|
1473
|
+
{ name: "row", type: "object" }
|
|
1474
|
+
],
|
|
1475
|
+
hidden: (_ps, _ctx, { item }) => item.type !== "item"
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
function onRowClickProp() {
|
|
1482
|
+
return {
|
|
1483
|
+
type: "eventHandler",
|
|
1484
|
+
displayName: "On row clicked",
|
|
1485
|
+
argTypes: [
|
|
1486
|
+
{ name: "rowKey", type: "string" },
|
|
1487
|
+
{ name: "row", type: "object" },
|
|
1488
|
+
{ name: "event", type: "object" }
|
|
1489
|
+
]
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
var __defProp$6 = Object.defineProperty;
|
|
1494
|
+
var __defProps$4 = Object.defineProperties;
|
|
1495
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1496
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1497
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1498
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1499
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1500
|
+
var __spreadValues$6 = (a, b) => {
|
|
1501
|
+
for (var prop in b || (b = {}))
|
|
1502
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
1503
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1504
|
+
if (__getOwnPropSymbols$6)
|
|
1505
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1506
|
+
if (__propIsEnum$6.call(b, prop))
|
|
1507
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1508
|
+
}
|
|
1509
|
+
return a;
|
|
1510
|
+
};
|
|
1511
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1368
1512
|
function useSortedFilteredData(data, columns) {
|
|
1369
1513
|
const [search, setSearch] = React.useState("");
|
|
1370
1514
|
const [sortState, setSortState] = React.useState(void 0);
|
|
@@ -1401,11 +1545,19 @@ function useSortedFilteredData(data, columns) {
|
|
|
1401
1545
|
setSortState
|
|
1402
1546
|
};
|
|
1403
1547
|
}
|
|
1404
|
-
function
|
|
1548
|
+
function tagDataArray(xs) {
|
|
1549
|
+
return xs.map((x, i) => __spreadProps$4(__spreadValues$6({}, x), { __tag: i + 1 }));
|
|
1550
|
+
}
|
|
1551
|
+
function getTag(x) {
|
|
1552
|
+
return x.__tag;
|
|
1553
|
+
}
|
|
1554
|
+
function deriveRowKey(_data, rowKey) {
|
|
1405
1555
|
if (rowKey) {
|
|
1406
1556
|
return rowKey;
|
|
1407
1557
|
}
|
|
1408
|
-
return
|
|
1558
|
+
return (x) => {
|
|
1559
|
+
return ensure(getTag(x));
|
|
1560
|
+
};
|
|
1409
1561
|
}
|
|
1410
1562
|
function deriveKeyOfRow(row, rowKey) {
|
|
1411
1563
|
if (typeof rowKey === "function") {
|
|
@@ -1522,7 +1674,13 @@ function RichTable(props) {
|
|
|
1522
1674
|
rowKey,
|
|
1523
1675
|
scopeClassName
|
|
1524
1676
|
} = props;
|
|
1525
|
-
const
|
|
1677
|
+
const normalizedData = dataSources.useNormalizedData(rawData);
|
|
1678
|
+
const data = React.useMemo(() => {
|
|
1679
|
+
if (!(normalizedData == null ? void 0 : normalizedData.data)) {
|
|
1680
|
+
return normalizedData;
|
|
1681
|
+
}
|
|
1682
|
+
return __spreadProps$3(__spreadValues$5({}, normalizedData), { data: tagDataArray(normalizedData.data) });
|
|
1683
|
+
}, [normalizedData]);
|
|
1526
1684
|
const { columnDefinitions, normalized } = useColumnDefinitions(data, props);
|
|
1527
1685
|
const actionRef = React.useRef();
|
|
1528
1686
|
const { finalData, search, setSearch, setSortState } = useSortedFilteredData(
|
|
@@ -1844,133 +2002,6 @@ function ExportMenu(props) {
|
|
|
1844
2002
|
);
|
|
1845
2003
|
}
|
|
1846
2004
|
|
|
1847
|
-
function roleProp({
|
|
1848
|
-
role,
|
|
1849
|
-
singular = false,
|
|
1850
|
-
advanced = false,
|
|
1851
|
-
displayName
|
|
1852
|
-
}) {
|
|
1853
|
-
return singular ? {
|
|
1854
|
-
type: "object",
|
|
1855
|
-
displayName: displayName || `${capitalize(role)} field`,
|
|
1856
|
-
advanced,
|
|
1857
|
-
hidden: (ps) => !ps.data,
|
|
1858
|
-
nameFunc: (item) => maybe(
|
|
1859
|
-
item,
|
|
1860
|
-
(i) => i.isHidden ? "Hidden" : i.fieldId || "Custom value"
|
|
1861
|
-
),
|
|
1862
|
-
fields: getFieldSubprops({
|
|
1863
|
-
canChangeField: true,
|
|
1864
|
-
noTitle: true
|
|
1865
|
-
}),
|
|
1866
|
-
defaultValueHint: (_props, contextData) => {
|
|
1867
|
-
var _a;
|
|
1868
|
-
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).find(
|
|
1869
|
-
(f) => f.role === role
|
|
1870
|
-
);
|
|
1871
|
-
}
|
|
1872
|
-
} : buildFieldsPropType({
|
|
1873
|
-
displayName: displayName || `${capitalize(role)} fields`,
|
|
1874
|
-
advanced,
|
|
1875
|
-
noTitle: true,
|
|
1876
|
-
canChangeField: true,
|
|
1877
|
-
minimalValue: (_props, contextData) => {
|
|
1878
|
-
var _a;
|
|
1879
|
-
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).filter(
|
|
1880
|
-
(f) => f.role === role
|
|
1881
|
-
);
|
|
1882
|
-
}
|
|
1883
|
-
});
|
|
1884
|
-
}
|
|
1885
|
-
function dataProp() {
|
|
1886
|
-
return {
|
|
1887
|
-
type: "dataSourceOpData",
|
|
1888
|
-
description: "The data to display"
|
|
1889
|
-
};
|
|
1890
|
-
}
|
|
1891
|
-
function commonProps() {
|
|
1892
|
-
return {
|
|
1893
|
-
pagination: {
|
|
1894
|
-
type: "boolean",
|
|
1895
|
-
advanced: true,
|
|
1896
|
-
defaultValueHint: true
|
|
1897
|
-
},
|
|
1898
|
-
pageSize: {
|
|
1899
|
-
type: "number",
|
|
1900
|
-
defaultValueHint: 10,
|
|
1901
|
-
advanced: true
|
|
1902
|
-
},
|
|
1903
|
-
hideSearch: {
|
|
1904
|
-
type: "boolean",
|
|
1905
|
-
description: "Hides the search toolbar",
|
|
1906
|
-
advanced: true
|
|
1907
|
-
}
|
|
1908
|
-
};
|
|
1909
|
-
}
|
|
1910
|
-
function rowActionsProp() {
|
|
1911
|
-
return {
|
|
1912
|
-
type: "array",
|
|
1913
|
-
displayName: "Row actions",
|
|
1914
|
-
advanced: true,
|
|
1915
|
-
itemType: {
|
|
1916
|
-
type: "object",
|
|
1917
|
-
nameFunc: (item) => item.label,
|
|
1918
|
-
fields: {
|
|
1919
|
-
type: {
|
|
1920
|
-
type: "choice",
|
|
1921
|
-
options: ["item", "menu"],
|
|
1922
|
-
defaultValue: "item"
|
|
1923
|
-
},
|
|
1924
|
-
label: {
|
|
1925
|
-
type: "string",
|
|
1926
|
-
displayName: "Action label"
|
|
1927
|
-
},
|
|
1928
|
-
children: {
|
|
1929
|
-
type: "array",
|
|
1930
|
-
displayName: "Menu items",
|
|
1931
|
-
itemType: {
|
|
1932
|
-
type: "object",
|
|
1933
|
-
fields: {
|
|
1934
|
-
label: {
|
|
1935
|
-
type: "string",
|
|
1936
|
-
displayName: "Action label"
|
|
1937
|
-
},
|
|
1938
|
-
onClick: {
|
|
1939
|
-
type: "eventHandler",
|
|
1940
|
-
argTypes: [
|
|
1941
|
-
{ name: "rowKey", type: "string" },
|
|
1942
|
-
{ name: "row", type: "object" }
|
|
1943
|
-
]
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
},
|
|
1947
|
-
hidden: (_ps, _ctx, { item }) => item.type !== "menu"
|
|
1948
|
-
},
|
|
1949
|
-
onClick: {
|
|
1950
|
-
type: "eventHandler",
|
|
1951
|
-
displayName: "Action",
|
|
1952
|
-
argTypes: [
|
|
1953
|
-
{ name: "rowKey", type: "string" },
|
|
1954
|
-
{ name: "row", type: "object" }
|
|
1955
|
-
],
|
|
1956
|
-
hidden: (_ps, _ctx, { item }) => item.type !== "item"
|
|
1957
|
-
}
|
|
1958
|
-
}
|
|
1959
|
-
}
|
|
1960
|
-
};
|
|
1961
|
-
}
|
|
1962
|
-
function onRowClickProp() {
|
|
1963
|
-
return {
|
|
1964
|
-
type: "eventHandler",
|
|
1965
|
-
displayName: "On row clicked",
|
|
1966
|
-
argTypes: [
|
|
1967
|
-
{ name: "rowKey", type: "string" },
|
|
1968
|
-
{ name: "row", type: "object" },
|
|
1969
|
-
{ name: "event", type: "object" }
|
|
1970
|
-
]
|
|
1971
|
-
};
|
|
1972
|
-
}
|
|
1973
|
-
|
|
1974
2005
|
var __defProp$4 = Object.defineProperty;
|
|
1975
2006
|
var __defProps$2 = Object.defineProperties;
|
|
1976
2007
|
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
@@ -2041,11 +2072,7 @@ const dataTableMeta = {
|
|
|
2041
2072
|
type: "string",
|
|
2042
2073
|
displayName: "Row key",
|
|
2043
2074
|
helpText: "Column key to use as row key; can also be a function that takes in a row and returns a key value",
|
|
2044
|
-
hidden: (ps) => !ps.canSelectRows || ps.canSelectRows === "none"
|
|
2045
|
-
defaultValueHint: (ps) => {
|
|
2046
|
-
const derivedRowKey = deriveRowKey(ps.data, ps.rowKey);
|
|
2047
|
-
return derivedRowKey !== void 0 ? `${derivedRowKey}` : void 0;
|
|
2048
|
-
}
|
|
2075
|
+
hidden: (ps) => !ps.canSelectRows || ps.canSelectRows === "none"
|
|
2049
2076
|
},
|
|
2050
2077
|
selectedRowKey: {
|
|
2051
2078
|
type: "string",
|