@plasmicpkgs/plasmic-rich-components 1.0.154 → 1.0.156
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 +271 -236
- package/dist/index.js.map +1 -1
- package/dist/plasmic-rich-components.esm.js +272 -237
- package/dist/plasmic-rich-components.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,7 @@ 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';
|
|
@@ -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
|
|
@@ -1077,7 +1077,7 @@ function RichLayout(_a) {
|
|
|
1077
1077
|
};
|
|
1078
1078
|
return /* @__PURE__ */ React.createElement("div", { className, style: { display: "flex" } }, /* @__PURE__ */ React.createElement("style", null, baseStyles), /* @__PURE__ */ React.createElement(
|
|
1079
1079
|
ProLayout,
|
|
1080
|
-
__spreadProps$
|
|
1080
|
+
__spreadProps$5(__spreadValues$8({}, layoutProps), {
|
|
1081
1081
|
pageTitleRender: () => "",
|
|
1082
1082
|
logo: logo != null ? logo : logoElement,
|
|
1083
1083
|
headerRender: (_props, defaultDom) => /* @__PURE__ */ React.createElement(
|
|
@@ -1088,7 +1088,7 @@ function RichLayout(_a) {
|
|
|
1088
1088
|
/* @__PURE__ */ React.createElement(ProConfigProvider, { dark: !isNavBgLight }, defaultDom)
|
|
1089
1089
|
),
|
|
1090
1090
|
token: {
|
|
1091
|
-
header: omitUndefined(__spreadValues$
|
|
1091
|
+
header: omitUndefined(__spreadValues$8({
|
|
1092
1092
|
colorBgHeader: navBgColor
|
|
1093
1093
|
}, layoutColorOverrides)),
|
|
1094
1094
|
// Ideally, we'd do something similar to headerRender above, and just specify general dark mode to specify
|
|
@@ -1158,19 +1158,19 @@ function RichLayout(_a) {
|
|
|
1158
1158
|
));
|
|
1159
1159
|
}
|
|
1160
1160
|
|
|
1161
|
-
var __defProp$
|
|
1162
|
-
var __getOwnPropSymbols$
|
|
1163
|
-
var __hasOwnProp$
|
|
1164
|
-
var __propIsEnum$
|
|
1165
|
-
var __defNormalProp$
|
|
1166
|
-
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) => {
|
|
1167
1167
|
for (var prop in b || (b = {}))
|
|
1168
|
-
if (__hasOwnProp$
|
|
1169
|
-
__defNormalProp$
|
|
1170
|
-
if (__getOwnPropSymbols$
|
|
1171
|
-
for (var prop of __getOwnPropSymbols$
|
|
1172
|
-
if (__propIsEnum$
|
|
1173
|
-
__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]);
|
|
1174
1174
|
}
|
|
1175
1175
|
return a;
|
|
1176
1176
|
};
|
|
@@ -1183,7 +1183,7 @@ function generateNavMenuType(isNested, remainingDepth, displayName, defaultValue
|
|
|
1183
1183
|
itemType: {
|
|
1184
1184
|
type: "object",
|
|
1185
1185
|
nameFunc: (item) => item.name || (!displayName ? "Unnamed nested item" : "Unnamed item"),
|
|
1186
|
-
fields: __spreadValues$
|
|
1186
|
+
fields: __spreadValues$7({
|
|
1187
1187
|
path: "href",
|
|
1188
1188
|
name: "string",
|
|
1189
1189
|
condition: {
|
|
@@ -1349,6 +1349,152 @@ function registerRichLayout(loader) {
|
|
|
1349
1349
|
registerComponentHelper(loader, RichLayout, richLayoutMeta);
|
|
1350
1350
|
}
|
|
1351
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));
|
|
1352
1498
|
function useSortedFilteredData(data, columns) {
|
|
1353
1499
|
const [search, setSearch] = useState("");
|
|
1354
1500
|
const [sortState, setSortState] = useState(void 0);
|
|
@@ -1385,11 +1531,19 @@ function useSortedFilteredData(data, columns) {
|
|
|
1385
1531
|
setSortState
|
|
1386
1532
|
};
|
|
1387
1533
|
}
|
|
1388
|
-
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) {
|
|
1389
1541
|
if (rowKey) {
|
|
1390
1542
|
return rowKey;
|
|
1391
1543
|
}
|
|
1392
|
-
return
|
|
1544
|
+
return (x) => {
|
|
1545
|
+
return ensure(getTag(x));
|
|
1546
|
+
};
|
|
1393
1547
|
}
|
|
1394
1548
|
function deriveKeyOfRow(row, rowKey) {
|
|
1395
1549
|
if (typeof rowKey === "function") {
|
|
@@ -1506,7 +1660,13 @@ function RichTable(props) {
|
|
|
1506
1660
|
rowKey,
|
|
1507
1661
|
scopeClassName
|
|
1508
1662
|
} = props;
|
|
1509
|
-
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]);
|
|
1510
1670
|
const { columnDefinitions, normalized } = useColumnDefinitions(data, props);
|
|
1511
1671
|
const actionRef = useRef();
|
|
1512
1672
|
const { finalData, search, setSearch, setSortState } = useSortedFilteredData(
|
|
@@ -1828,133 +1988,6 @@ function ExportMenu(props) {
|
|
|
1828
1988
|
);
|
|
1829
1989
|
}
|
|
1830
1990
|
|
|
1831
|
-
function roleProp({
|
|
1832
|
-
role,
|
|
1833
|
-
singular = false,
|
|
1834
|
-
advanced = false,
|
|
1835
|
-
displayName
|
|
1836
|
-
}) {
|
|
1837
|
-
return singular ? {
|
|
1838
|
-
type: "object",
|
|
1839
|
-
displayName: displayName || `${capitalize(role)} field`,
|
|
1840
|
-
advanced,
|
|
1841
|
-
hidden: (ps) => !ps.data,
|
|
1842
|
-
nameFunc: (item) => maybe(
|
|
1843
|
-
item,
|
|
1844
|
-
(i) => i.isHidden ? "Hidden" : i.fieldId || "Custom value"
|
|
1845
|
-
),
|
|
1846
|
-
fields: getFieldSubprops({
|
|
1847
|
-
canChangeField: true,
|
|
1848
|
-
noTitle: true
|
|
1849
|
-
}),
|
|
1850
|
-
defaultValueHint: (_props, contextData) => {
|
|
1851
|
-
var _a;
|
|
1852
|
-
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).find(
|
|
1853
|
-
(f) => f.role === role
|
|
1854
|
-
);
|
|
1855
|
-
}
|
|
1856
|
-
} : buildFieldsPropType({
|
|
1857
|
-
displayName: displayName || `${capitalize(role)} fields`,
|
|
1858
|
-
advanced,
|
|
1859
|
-
noTitle: true,
|
|
1860
|
-
canChangeField: true,
|
|
1861
|
-
minimalValue: (_props, contextData) => {
|
|
1862
|
-
var _a;
|
|
1863
|
-
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).filter(
|
|
1864
|
-
(f) => f.role === role
|
|
1865
|
-
);
|
|
1866
|
-
}
|
|
1867
|
-
});
|
|
1868
|
-
}
|
|
1869
|
-
function dataProp() {
|
|
1870
|
-
return {
|
|
1871
|
-
type: "dataSourceOpData",
|
|
1872
|
-
description: "The data to display"
|
|
1873
|
-
};
|
|
1874
|
-
}
|
|
1875
|
-
function commonProps() {
|
|
1876
|
-
return {
|
|
1877
|
-
pagination: {
|
|
1878
|
-
type: "boolean",
|
|
1879
|
-
advanced: true,
|
|
1880
|
-
defaultValueHint: true
|
|
1881
|
-
},
|
|
1882
|
-
pageSize: {
|
|
1883
|
-
type: "number",
|
|
1884
|
-
defaultValueHint: 10,
|
|
1885
|
-
advanced: true
|
|
1886
|
-
},
|
|
1887
|
-
hideSearch: {
|
|
1888
|
-
type: "boolean",
|
|
1889
|
-
description: "Hides the search toolbar",
|
|
1890
|
-
advanced: true
|
|
1891
|
-
}
|
|
1892
|
-
};
|
|
1893
|
-
}
|
|
1894
|
-
function rowActionsProp() {
|
|
1895
|
-
return {
|
|
1896
|
-
type: "array",
|
|
1897
|
-
displayName: "Row actions",
|
|
1898
|
-
advanced: true,
|
|
1899
|
-
itemType: {
|
|
1900
|
-
type: "object",
|
|
1901
|
-
nameFunc: (item) => item.label,
|
|
1902
|
-
fields: {
|
|
1903
|
-
type: {
|
|
1904
|
-
type: "choice",
|
|
1905
|
-
options: ["item", "menu"],
|
|
1906
|
-
defaultValue: "item"
|
|
1907
|
-
},
|
|
1908
|
-
label: {
|
|
1909
|
-
type: "string",
|
|
1910
|
-
displayName: "Action label"
|
|
1911
|
-
},
|
|
1912
|
-
children: {
|
|
1913
|
-
type: "array",
|
|
1914
|
-
displayName: "Menu items",
|
|
1915
|
-
itemType: {
|
|
1916
|
-
type: "object",
|
|
1917
|
-
fields: {
|
|
1918
|
-
label: {
|
|
1919
|
-
type: "string",
|
|
1920
|
-
displayName: "Action label"
|
|
1921
|
-
},
|
|
1922
|
-
onClick: {
|
|
1923
|
-
type: "eventHandler",
|
|
1924
|
-
argTypes: [
|
|
1925
|
-
{ name: "rowKey", type: "string" },
|
|
1926
|
-
{ name: "row", type: "object" }
|
|
1927
|
-
]
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
},
|
|
1931
|
-
hidden: (_ps, _ctx, { item }) => item.type !== "menu"
|
|
1932
|
-
},
|
|
1933
|
-
onClick: {
|
|
1934
|
-
type: "eventHandler",
|
|
1935
|
-
displayName: "Action",
|
|
1936
|
-
argTypes: [
|
|
1937
|
-
{ name: "rowKey", type: "string" },
|
|
1938
|
-
{ name: "row", type: "object" }
|
|
1939
|
-
],
|
|
1940
|
-
hidden: (_ps, _ctx, { item }) => item.type !== "item"
|
|
1941
|
-
}
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
};
|
|
1945
|
-
}
|
|
1946
|
-
function onRowClickProp() {
|
|
1947
|
-
return {
|
|
1948
|
-
type: "eventHandler",
|
|
1949
|
-
displayName: "On row clicked",
|
|
1950
|
-
argTypes: [
|
|
1951
|
-
{ name: "rowKey", type: "string" },
|
|
1952
|
-
{ name: "row", type: "object" },
|
|
1953
|
-
{ name: "event", type: "object" }
|
|
1954
|
-
]
|
|
1955
|
-
};
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
1991
|
var __defProp$4 = Object.defineProperty;
|
|
1959
1992
|
var __defProps$2 = Object.defineProperties;
|
|
1960
1993
|
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
@@ -2025,11 +2058,7 @@ const dataTableMeta = {
|
|
|
2025
2058
|
type: "string",
|
|
2026
2059
|
displayName: "Row key",
|
|
2027
2060
|
helpText: "Column key to use as row key; can also be a function that takes in a row and returns a key value",
|
|
2028
|
-
hidden: (ps) => !ps.canSelectRows || ps.canSelectRows === "none"
|
|
2029
|
-
defaultValueHint: (ps) => {
|
|
2030
|
-
const derivedRowKey = deriveRowKey(ps.data, ps.rowKey);
|
|
2031
|
-
return derivedRowKey !== void 0 ? `${derivedRowKey}` : void 0;
|
|
2032
|
-
}
|
|
2061
|
+
hidden: (ps) => !ps.canSelectRows || ps.canSelectRows === "none"
|
|
2033
2062
|
},
|
|
2034
2063
|
selectedRowKey: {
|
|
2035
2064
|
type: "string",
|
|
@@ -2269,7 +2298,13 @@ function RichList(props) {
|
|
|
2269
2298
|
"pagination",
|
|
2270
2299
|
"onRowClick"
|
|
2271
2300
|
]);
|
|
2272
|
-
const
|
|
2301
|
+
const normalizedData = useNormalizedData(rawData);
|
|
2302
|
+
const data = React.useMemo(() => {
|
|
2303
|
+
if (!(normalizedData == null ? void 0 : normalizedData.data)) {
|
|
2304
|
+
return normalizedData;
|
|
2305
|
+
}
|
|
2306
|
+
return __spreadProps$1(__spreadValues$3({}, normalizedData), { data: tagDataArray(normalizedData.data) });
|
|
2307
|
+
}, [normalizedData]);
|
|
2273
2308
|
const { normalized, finalRoles: roleConfigs } = useRoleDefinitions$1(
|
|
2274
2309
|
data,
|
|
2275
2310
|
props
|