@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/index.js CHANGED
@@ -140,33 +140,33 @@ class ErrorBoundary extends React__default.default.Component {
140
140
  }
141
141
  }
142
142
 
143
- var __defProp$b = Object.defineProperty;
144
- var __defProps$8 = Object.defineProperties;
145
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
146
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
147
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
148
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
149
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
150
- var __spreadValues$b = (a, b) => {
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$b.call(b, prop))
153
- __defNormalProp$b(a, prop, b[prop]);
154
- if (__getOwnPropSymbols$b)
155
- for (var prop of __getOwnPropSymbols$b(b)) {
156
- if (__propIsEnum$b.call(b, prop))
157
- __defNormalProp$b(a, prop, b[prop]);
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$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
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$b.call(source, prop) && exclude.indexOf(prop) < 0)
165
+ if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
166
166
  target[prop] = source[prop];
167
- if (source != null && __getOwnPropSymbols$b)
168
- for (var prop of __getOwnPropSymbols$b(source)) {
169
- if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
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$b(__spreadValues$b({
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$8(__spreadValues$b({}, rowDataType("Custom value")), {
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$a = Object.defineProperty;
554
- var __defProps$7 = Object.defineProperties;
555
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
556
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
557
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
558
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
559
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
560
- var __spreadValues$a = (a, b) => {
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$a.call(b, prop))
563
- __defNormalProp$a(a, prop, b[prop]);
564
- if (__getOwnPropSymbols$a)
565
- for (var prop of __getOwnPropSymbols$a(b)) {
566
- if (__propIsEnum$a.call(b, prop))
567
- __defNormalProp$a(a, prop, b[prop]);
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$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
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$7(__spreadValues$a({}, cconfig), {
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$7(__spreadValues$a(__spreadValues$a({}, DEFAULT_CURRENCY_SETTINGS), cconfig), {
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$a(__spreadValues$a({}, DEFAULT_DATETIME_SETTINGS), cconfig);
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$a(__spreadValues$a({}, DEFAULT_RELATIVE_DATETIME_SETTINGS), cconfig);
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$9 = Object.defineProperty;
769
- var __defProps$6 = Object.defineProperties;
770
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
771
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
772
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
773
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
774
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
775
- var __spreadValues$9 = (a, b) => {
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$9.call(b, prop))
778
- __defNormalProp$9(a, prop, b[prop]);
779
- if (__getOwnPropSymbols$9)
780
- for (var prop of __getOwnPropSymbols$9(b)) {
781
- if (__propIsEnum$9.call(b, prop))
782
- __defNormalProp$9(a, prop, b[prop]);
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$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
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$9({
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$6(__spreadValues$9({}, data), { mergedFields, minimalFullLengthFields }));
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$7.call(source, prop) && exclude.indexOf(prop) < 0)
978
+ if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
979
979
  target[prop] = source[prop];
980
- if (source != null && __getOwnPropSymbols$7)
981
- for (var prop of __getOwnPropSymbols$7(source)) {
982
- if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
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$4(__spreadValues$7({}, item), {
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
@@ -1091,7 +1091,7 @@ function RichLayout(_a) {
1091
1091
  };
1092
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(
1093
1093
  proComponents.ProLayout,
1094
- __spreadProps$4(__spreadValues$7({}, layoutProps), {
1094
+ __spreadProps$5(__spreadValues$8({}, layoutProps), {
1095
1095
  pageTitleRender: () => "",
1096
1096
  logo: logo != null ? logo : logoElement,
1097
1097
  headerRender: (_props, defaultDom) => /* @__PURE__ */ React__default.default.createElement(
@@ -1102,7 +1102,7 @@ function RichLayout(_a) {
1102
1102
  /* @__PURE__ */ React__default.default.createElement(proComponents.ProConfigProvider, { dark: !isNavBgLight }, defaultDom)
1103
1103
  ),
1104
1104
  token: {
1105
- header: omitUndefined(__spreadValues$7({
1105
+ header: omitUndefined(__spreadValues$8({
1106
1106
  colorBgHeader: navBgColor
1107
1107
  }, layoutColorOverrides)),
1108
1108
  // Ideally, we'd do something similar to headerRender above, and just specify general dark mode to specify
@@ -1172,19 +1172,19 @@ function RichLayout(_a) {
1172
1172
  ));
1173
1173
  }
1174
1174
 
1175
- var __defProp$6 = Object.defineProperty;
1176
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
1177
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
1178
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
1179
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1180
- var __spreadValues$6 = (a, b) => {
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) => {
1181
1181
  for (var prop in b || (b = {}))
1182
- if (__hasOwnProp$6.call(b, prop))
1183
- __defNormalProp$6(a, prop, b[prop]);
1184
- if (__getOwnPropSymbols$6)
1185
- for (var prop of __getOwnPropSymbols$6(b)) {
1186
- if (__propIsEnum$6.call(b, prop))
1187
- __defNormalProp$6(a, prop, b[prop]);
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]);
1188
1188
  }
1189
1189
  return a;
1190
1190
  };
@@ -1197,7 +1197,7 @@ function generateNavMenuType(isNested, remainingDepth, displayName, defaultValue
1197
1197
  itemType: {
1198
1198
  type: "object",
1199
1199
  nameFunc: (item) => item.name || (!displayName ? "Unnamed nested item" : "Unnamed item"),
1200
- fields: __spreadValues$6({
1200
+ fields: __spreadValues$7({
1201
1201
  path: "href",
1202
1202
  name: "string",
1203
1203
  condition: {
@@ -1363,6 +1363,152 @@ function registerRichLayout(loader) {
1363
1363
  registerComponentHelper(loader, RichLayout, richLayoutMeta);
1364
1364
  }
1365
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));
1366
1512
  function useSortedFilteredData(data, columns) {
1367
1513
  const [search, setSearch] = React.useState("");
1368
1514
  const [sortState, setSortState] = React.useState(void 0);
@@ -1399,11 +1545,19 @@ function useSortedFilteredData(data, columns) {
1399
1545
  setSortState
1400
1546
  };
1401
1547
  }
1402
- function deriveRowKey(data, rowKey) {
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) {
1403
1555
  if (rowKey) {
1404
1556
  return rowKey;
1405
1557
  }
1406
- return void 0;
1558
+ return (x) => {
1559
+ return ensure(getTag(x));
1560
+ };
1407
1561
  }
1408
1562
  function deriveKeyOfRow(row, rowKey) {
1409
1563
  if (typeof rowKey === "function") {
@@ -1520,7 +1674,13 @@ function RichTable(props) {
1520
1674
  rowKey,
1521
1675
  scopeClassName
1522
1676
  } = props;
1523
- const data = dataSources.useNormalizedData(rawData);
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]);
1524
1684
  const { columnDefinitions, normalized } = useColumnDefinitions(data, props);
1525
1685
  const actionRef = React.useRef();
1526
1686
  const { finalData, search, setSearch, setSortState } = useSortedFilteredData(
@@ -1842,133 +2002,6 @@ function ExportMenu(props) {
1842
2002
  );
1843
2003
  }
1844
2004
 
1845
- function roleProp({
1846
- role,
1847
- singular = false,
1848
- advanced = false,
1849
- displayName
1850
- }) {
1851
- return singular ? {
1852
- type: "object",
1853
- displayName: displayName || `${capitalize(role)} field`,
1854
- advanced,
1855
- hidden: (ps) => !ps.data,
1856
- nameFunc: (item) => maybe(
1857
- item,
1858
- (i) => i.isHidden ? "Hidden" : i.fieldId || "Custom value"
1859
- ),
1860
- fields: getFieldSubprops({
1861
- canChangeField: true,
1862
- noTitle: true
1863
- }),
1864
- defaultValueHint: (_props, contextData) => {
1865
- var _a;
1866
- return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).find(
1867
- (f) => f.role === role
1868
- );
1869
- }
1870
- } : buildFieldsPropType({
1871
- displayName: displayName || `${capitalize(role)} fields`,
1872
- advanced,
1873
- noTitle: true,
1874
- canChangeField: true,
1875
- minimalValue: (_props, contextData) => {
1876
- var _a;
1877
- return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).filter(
1878
- (f) => f.role === role
1879
- );
1880
- }
1881
- });
1882
- }
1883
- function dataProp() {
1884
- return {
1885
- type: "dataSourceOpData",
1886
- description: "The data to display"
1887
- };
1888
- }
1889
- function commonProps() {
1890
- return {
1891
- pagination: {
1892
- type: "boolean",
1893
- advanced: true,
1894
- defaultValueHint: true
1895
- },
1896
- pageSize: {
1897
- type: "number",
1898
- defaultValueHint: 10,
1899
- advanced: true
1900
- },
1901
- hideSearch: {
1902
- type: "boolean",
1903
- description: "Hides the search toolbar",
1904
- advanced: true
1905
- }
1906
- };
1907
- }
1908
- function rowActionsProp() {
1909
- return {
1910
- type: "array",
1911
- displayName: "Row actions",
1912
- advanced: true,
1913
- itemType: {
1914
- type: "object",
1915
- nameFunc: (item) => item.label,
1916
- fields: {
1917
- type: {
1918
- type: "choice",
1919
- options: ["item", "menu"],
1920
- defaultValue: "item"
1921
- },
1922
- label: {
1923
- type: "string",
1924
- displayName: "Action label"
1925
- },
1926
- children: {
1927
- type: "array",
1928
- displayName: "Menu items",
1929
- itemType: {
1930
- type: "object",
1931
- fields: {
1932
- label: {
1933
- type: "string",
1934
- displayName: "Action label"
1935
- },
1936
- onClick: {
1937
- type: "eventHandler",
1938
- argTypes: [
1939
- { name: "rowKey", type: "string" },
1940
- { name: "row", type: "object" }
1941
- ]
1942
- }
1943
- }
1944
- },
1945
- hidden: (_ps, _ctx, { item }) => item.type !== "menu"
1946
- },
1947
- onClick: {
1948
- type: "eventHandler",
1949
- displayName: "Action",
1950
- argTypes: [
1951
- { name: "rowKey", type: "string" },
1952
- { name: "row", type: "object" }
1953
- ],
1954
- hidden: (_ps, _ctx, { item }) => item.type !== "item"
1955
- }
1956
- }
1957
- }
1958
- };
1959
- }
1960
- function onRowClickProp() {
1961
- return {
1962
- type: "eventHandler",
1963
- displayName: "On row clicked",
1964
- argTypes: [
1965
- { name: "rowKey", type: "string" },
1966
- { name: "row", type: "object" },
1967
- { name: "event", type: "object" }
1968
- ]
1969
- };
1970
- }
1971
-
1972
2005
  var __defProp$4 = Object.defineProperty;
1973
2006
  var __defProps$2 = Object.defineProperties;
1974
2007
  var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
@@ -2039,11 +2072,7 @@ const dataTableMeta = {
2039
2072
  type: "string",
2040
2073
  displayName: "Row key",
2041
2074
  helpText: "Column key to use as row key; can also be a function that takes in a row and returns a key value",
2042
- hidden: (ps) => !ps.canSelectRows || ps.canSelectRows === "none",
2043
- defaultValueHint: (ps) => {
2044
- const derivedRowKey = deriveRowKey(ps.data, ps.rowKey);
2045
- return derivedRowKey !== void 0 ? `${derivedRowKey}` : void 0;
2046
- }
2075
+ hidden: (ps) => !ps.canSelectRows || ps.canSelectRows === "none"
2047
2076
  },
2048
2077
  selectedRowKey: {
2049
2078
  type: "string",
@@ -2283,7 +2312,13 @@ function RichList(props) {
2283
2312
  "pagination",
2284
2313
  "onRowClick"
2285
2314
  ]);
2286
- const data = dataSources.useNormalizedData(rawData);
2315
+ const normalizedData = dataSources.useNormalizedData(rawData);
2316
+ const data = React__default.default.useMemo(() => {
2317
+ if (!(normalizedData == null ? void 0 : normalizedData.data)) {
2318
+ return normalizedData;
2319
+ }
2320
+ return __spreadProps$1(__spreadValues$3({}, normalizedData), { data: tagDataArray(normalizedData.data) });
2321
+ }, [normalizedData]);
2287
2322
  const { normalized, finalRoles: roleConfigs } = useRoleDefinitions$1(
2288
2323
  data,
2289
2324
  props