@plasmicpkgs/plasmic-rich-components 1.0.219 → 1.0.221

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.
Files changed (38) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/field-mappings.d.ts +2 -2
  3. package/dist/index.js +58 -47
  4. package/dist/index.js.map +1 -1
  5. package/dist/plasmic-rich-components.esm.js +58 -47
  6. package/dist/plasmic-rich-components.esm.js.map +1 -1
  7. package/dist/rich-table/index.d.ts +4 -4
  8. package/package.json +4 -4
  9. package/skinny/{common-prop-types-988c65db.esm.js → common-prop-types-82f3a4ed.esm.js} +2 -2
  10. package/skinny/{common-prop-types-988c65db.esm.js.map → common-prop-types-82f3a4ed.esm.js.map} +1 -1
  11. package/skinny/{common-prop-types-193ce561.cjs.js → common-prop-types-94b20130.cjs.js} +2 -2
  12. package/skinny/{common-prop-types-193ce561.cjs.js.map → common-prop-types-94b20130.cjs.js.map} +1 -1
  13. package/skinny/field-mappings.d.ts +2 -2
  14. package/skinny/{formatting-0acc57f5.esm.js → formatting-6f22c9d6.esm.js} +15 -15
  15. package/skinny/formatting-6f22c9d6.esm.js.map +1 -0
  16. package/skinny/{formatting-6dc71cdd.cjs.js → formatting-939d0aa3.cjs.js} +15 -15
  17. package/skinny/formatting-939d0aa3.cjs.js.map +1 -0
  18. package/skinny/rich-calendar/index.cjs.js +29 -20
  19. package/skinny/rich-calendar/index.cjs.js.map +1 -1
  20. package/skinny/rich-calendar/index.esm.js +29 -20
  21. package/skinny/rich-calendar/index.esm.js.map +1 -1
  22. package/skinny/rich-details/index.cjs.js +1 -1
  23. package/skinny/rich-details/index.esm.js +1 -1
  24. package/skinny/rich-layout/index.cjs.js +7 -4
  25. package/skinny/rich-layout/index.cjs.js.map +1 -1
  26. package/skinny/rich-layout/index.esm.js +7 -4
  27. package/skinny/rich-layout/index.esm.js.map +1 -1
  28. package/skinny/rich-list/index.cjs.js +8 -9
  29. package/skinny/rich-list/index.cjs.js.map +1 -1
  30. package/skinny/rich-list/index.esm.js +9 -10
  31. package/skinny/rich-list/index.esm.js.map +1 -1
  32. package/skinny/rich-table/index.cjs.js +6 -6
  33. package/skinny/rich-table/index.cjs.js.map +1 -1
  34. package/skinny/rich-table/index.d.ts +4 -4
  35. package/skinny/rich-table/index.esm.js +6 -6
  36. package/skinny/rich-table/index.esm.js.map +1 -1
  37. package/skinny/formatting-0acc57f5.esm.js.map +0 -1
  38. package/skinny/formatting-6dc71cdd.cjs.js.map +0 -1
@@ -225,7 +225,7 @@ function getFieldSubprops(opts) {
225
225
  hidden: () => !!opts.noTitle
226
226
  },
227
227
  expr: __spreadProps$9(__spreadValues$c({}, rowDataType("Custom value")), {
228
- hidden: (ps, ctx, { item, path: _controlPath }) => {
228
+ hidden: (_ps, _ctx, { item, path: _controlPath }) => {
229
229
  return false;
230
230
  }
231
231
  }),
@@ -279,14 +279,14 @@ function getFieldSubprops(opts) {
279
279
  description: "Must be a valid currency code",
280
280
  type: "string",
281
281
  defaultValueHint: "USD",
282
- hidden: (ps, ctx, { item }) => item.dataType !== "currency"
282
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "currency"
283
283
  },
284
284
  locale: {
285
285
  displayName: "Locale",
286
286
  description: "Must be a valid locale code",
287
287
  type: "string",
288
288
  defaultValueHint: "en-US",
289
- hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES) && !isOneOf(item.dataType, DATETIME_TYPES)
289
+ hidden: (_ps, _ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES) && !isOneOf(item.dataType, DATETIME_TYPES)
290
290
  },
291
291
  notation: {
292
292
  displayName: "Notation",
@@ -306,7 +306,7 @@ function getFieldSubprops(opts) {
306
306
  }
307
307
  ],
308
308
  defaultValueHint: "standard",
309
- hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
309
+ hidden: (_ps, _ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
310
310
  },
311
311
  signDisplay: {
312
312
  type: "choice",
@@ -322,7 +322,7 @@ function getFieldSubprops(opts) {
322
322
  }
323
323
  ],
324
324
  defaultValueHint: "auto",
325
- hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
325
+ hidden: (_ps, _ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
326
326
  },
327
327
  maximumFractionDigits: {
328
328
  type: "number",
@@ -330,7 +330,7 @@ function getFieldSubprops(opts) {
330
330
  defaultValueHint: 3,
331
331
  min: 0,
332
332
  max: 20,
333
- hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
333
+ hidden: (_ps, _ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
334
334
  },
335
335
  minimumFractionDigits: {
336
336
  type: "number",
@@ -338,7 +338,7 @@ function getFieldSubprops(opts) {
338
338
  defaultValueHint: 0,
339
339
  min: 0,
340
340
  max: 20,
341
- hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
341
+ hidden: (_ps, _ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
342
342
  },
343
343
  showAs: {
344
344
  type: "choice",
@@ -358,7 +358,7 @@ function getFieldSubprops(opts) {
358
358
  ],
359
359
  displayName: "Show as",
360
360
  defaultValueHint: "checkbox",
361
- hidden: (ps, ctx, { item }) => item.dataType !== "boolean"
361
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "boolean"
362
362
  },
363
363
  dateStyle: {
364
364
  displayName: "Date style",
@@ -386,7 +386,7 @@ function getFieldSubprops(opts) {
386
386
  }
387
387
  ],
388
388
  defaultValueHint: DEFAULT_DATETIME_SETTINGS.dateStyle,
389
- hidden: (ps, ctx, { item }) => item.dataType !== "datetime"
389
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "datetime"
390
390
  },
391
391
  timeStyle: {
392
392
  displayName: "Time style",
@@ -414,14 +414,14 @@ function getFieldSubprops(opts) {
414
414
  }
415
415
  ],
416
416
  defaultValueHint: DEFAULT_DATETIME_SETTINGS.timeStyle,
417
- hidden: (ps, ctx, { item }) => item.dataType !== "datetime"
417
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "datetime"
418
418
  },
419
419
  hour12: {
420
420
  displayName: "Use AM/PM?",
421
421
  description: "Whether to use AM/PM or 24-hour clock",
422
422
  type: "boolean",
423
423
  defaultValueHint: DEFAULT_DATETIME_SETTINGS.hour12,
424
- hidden: (ps, ctx, { item }) => item.dataType !== "datetime"
424
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "datetime"
425
425
  },
426
426
  numeric: {
427
427
  type: "choice",
@@ -434,7 +434,7 @@ function getFieldSubprops(opts) {
434
434
  }
435
435
  ],
436
436
  defaultValueHint: DEFAULT_RELATIVE_DATETIME_SETTINGS.numeric,
437
- hidden: (ps, ctx, { item }) => item.dataType !== "relative-datetime"
437
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "relative-datetime"
438
438
  },
439
439
  unit: {
440
440
  type: "choice",
@@ -470,7 +470,7 @@ function getFieldSubprops(opts) {
470
470
  }
471
471
  ],
472
472
  defaultValueHint: DEFAULT_RELATIVE_DATETIME_SETTINGS.unit,
473
- hidden: (ps, ctx, { item }) => item.dataType !== "relative-datetime"
473
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "relative-datetime"
474
474
  }
475
475
  } : {}), opts.fieldTypes);
476
476
  }
@@ -514,7 +514,7 @@ function buildFieldsPropType(_a) {
514
514
  hidden: (ps) => !ps.data,
515
515
  unstable__keyFunc: (x) => x.key,
516
516
  unstable__minimalValue: minimalValue,
517
- unstable__canDelete: (ps, _props, ctx, { item }) => {
517
+ unstable__canDelete: (_ps, _props, ctx, { item }) => {
518
518
  if (opts.canChangeField) {
519
519
  return true;
520
520
  }
@@ -972,7 +972,7 @@ var __objRest$2 = (source, exclude) => {
972
972
  };
973
973
  function omitUndefined(x) {
974
974
  return Object.fromEntries(
975
- Object.entries(x).filter(([k, v]) => v !== void 0)
975
+ Object.entries(x).filter(([_k, v]) => v !== void 0)
976
976
  );
977
977
  }
978
978
  function processNavItems(navMenuItems) {
@@ -1038,10 +1038,12 @@ function RichLayout(_a) {
1038
1038
  }
1039
1039
  }, []);
1040
1040
  useEffect(() => {
1041
- if (!ready)
1041
+ if (!ready) {
1042
1042
  return;
1043
- if (!ref.current)
1043
+ }
1044
+ if (!ref.current) {
1044
1045
  return;
1046
+ }
1045
1047
  const selectedSubmenus = Array.from(
1046
1048
  ref.current.querySelectorAll(
1047
1049
  "ul > li.ant-menu-submenu.ant-menu-submenu-selected > div"
@@ -1168,8 +1170,9 @@ function RichLayout(_a) {
1168
1170
  return [actionsChildren];
1169
1171
  },
1170
1172
  menuFooterRender: (props) => {
1171
- if (props == null ? void 0 : props.collapsed)
1173
+ if (props == null ? void 0 : props.collapsed) {
1172
1174
  return void 0;
1175
+ }
1173
1176
  return footerChildren;
1174
1177
  },
1175
1178
  onMenuHeaderClick: (e) => console.log(e),
@@ -2037,22 +2040,22 @@ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
2037
2040
  const tableHelpers = {
2038
2041
  states: {
2039
2042
  selectedRow: {
2040
- onChangeArgsToValue: (rowKeys, rows) => {
2043
+ onChangeArgsToValue: (_rowKeys, rows) => {
2041
2044
  return rows[0];
2042
2045
  }
2043
2046
  },
2044
2047
  selectedRows: {
2045
- onChangeArgsToValue: (rowKeys, rows) => {
2048
+ onChangeArgsToValue: (_rowKeys, rows) => {
2046
2049
  return rows;
2047
2050
  }
2048
2051
  },
2049
2052
  selectedRowKey: {
2050
- onChangeArgsToValue: (rowKeys, rows) => {
2053
+ onChangeArgsToValue: (rowKeys, _rows) => {
2051
2054
  return rowKeys[0];
2052
2055
  }
2053
2056
  },
2054
2057
  selectedRowKeys: {
2055
- onChangeArgsToValue: (rowKeys, rows) => {
2058
+ onChangeArgsToValue: (rowKeys, _rows) => {
2056
2059
  return rowKeys;
2057
2060
  }
2058
2061
  }
@@ -2315,7 +2318,6 @@ function RichList(props) {
2315
2318
  header,
2316
2319
  footer,
2317
2320
  rowActions = [],
2318
- title,
2319
2321
  pageSize = 10,
2320
2322
  hideSearch,
2321
2323
  rowKey,
@@ -2330,7 +2332,6 @@ function RichList(props) {
2330
2332
  "header",
2331
2333
  "footer",
2332
2334
  "rowActions",
2333
- "title",
2334
2335
  "pageSize",
2335
2336
  "hideSearch",
2336
2337
  "rowKey",
@@ -2348,9 +2349,8 @@ function RichList(props) {
2348
2349
  data,
2349
2350
  props
2350
2351
  );
2351
- useRef();
2352
2352
  const linkTo = typeof props.linkTo === "function" ? props.linkTo : void 0;
2353
- const { finalData, search, setSearch, setSortState } = useSortedFilteredData(
2353
+ const { finalData, search, setSearch } = useSortedFilteredData(
2354
2354
  data,
2355
2355
  normalized
2356
2356
  );
@@ -2380,7 +2380,7 @@ function RichList(props) {
2380
2380
  pageSize,
2381
2381
  showSizeChanger: false
2382
2382
  } : false,
2383
- renderItem: (record, index) => {
2383
+ renderItem: (record) => {
2384
2384
  var _a2;
2385
2385
  const actions = renderActions(rowActions, record, data, rowKey);
2386
2386
  const image = maybe(
@@ -2406,11 +2406,13 @@ function RichList(props) {
2406
2406
  }
2407
2407
  );
2408
2408
  function makeLinkWrapper() {
2409
- if ((actions != null ? actions : []).length > 0)
2409
+ if ((actions != null ? actions : []).length > 0) {
2410
2410
  return void 0;
2411
+ }
2411
2412
  const href = linkTo == null ? void 0 : linkTo(record);
2412
- if (!href && !onRowClick)
2413
+ if (!href && !onRowClick) {
2413
2414
  return void 0;
2415
+ }
2414
2416
  const _linkWrapper = (x) => /* @__PURE__ */ React.createElement(
2415
2417
  "a",
2416
2418
  {
@@ -2795,8 +2797,9 @@ dayjs.extend(weekday);
2795
2797
  dayjs.extend(localeData);
2796
2798
  function getEventFullDate(date) {
2797
2799
  const parsed = parseDate(date);
2798
- if (!parsed)
2800
+ if (!parsed) {
2799
2801
  return void 0;
2802
+ }
2800
2803
  const yyyy = parsed.getFullYear();
2801
2804
  const mm = (parsed.getMonth() + 1).toString().padStart(2, "0");
2802
2805
  const dd = parsed.getDate().toString().padStart(2, "0");
@@ -2807,8 +2810,9 @@ function getEventMonthYear(date) {
2807
2810
  return (_a = getEventFullDate(date)) == null ? void 0 : _a.substring(0, 7);
2808
2811
  }
2809
2812
  function EventCell({ events }) {
2810
- if (!events || !events.length)
2813
+ if (!events || !events.length) {
2811
2814
  return null;
2815
+ }
2812
2816
  return /* @__PURE__ */ React.createElement("ul", { style: { all: "unset" } }, events.map((e) => /* @__PURE__ */ React.createElement("li", { key: JSON.stringify(e), style: { all: "unset", display: "block" } }, /* @__PURE__ */ React.createElement(Badge, { color: e.color || "green", text: e.title }))));
2813
2817
  }
2814
2818
  function RichCalendar(props) {
@@ -2844,16 +2848,14 @@ function RichCalendar(props) {
2844
2848
  "monthFullCellRender"
2845
2849
  ]);
2846
2850
  const data = useNormalizedData(rawData);
2847
- const { normalized, finalRoles: roleConfigs } = useRoleDefinitions(
2848
- data,
2849
- props
2850
- );
2851
+ const { finalRoles: roleConfigs } = useRoleDefinitions(data, props);
2851
2852
  const {
2852
2853
  eventsByDate,
2853
2854
  eventsByMonth
2854
2855
  } = useMemo(() => {
2855
- if (!data)
2856
+ if (!data) {
2856
2857
  return { eventsByDate: {}, eventsByMonth: {} };
2858
+ }
2857
2859
  return data == null ? void 0 : data.data.reduce(
2858
2860
  (acc, item) => {
2859
2861
  const date = getFieldAggregateValue(item, roleConfigs.date);
@@ -2890,11 +2892,13 @@ function RichCalendar(props) {
2890
2892
  [isoDefaultValue]
2891
2893
  );
2892
2894
  const validRange = useMemo(() => {
2893
- if (!isoValidRange)
2895
+ if (!isoValidRange) {
2894
2896
  return void 0;
2897
+ }
2895
2898
  const range = isoValidRange.filter((dateIso) => isValidIsoDate(dateIso)).map((d) => dayjs(d));
2896
- if (range.length !== 2)
2899
+ if (range.length !== 2) {
2897
2900
  return void 0;
2901
+ }
2898
2902
  return [range[0], range[1]];
2899
2903
  }, [isoValidRange]);
2900
2904
  const key = useMemo(() => JSON.stringify(roleConfigs), [roleConfigs]);
@@ -2938,7 +2942,7 @@ const defaultColumnConfig = () => ({
2938
2942
  });
2939
2943
  const roles = ["date", "title", "color", "unset"];
2940
2944
  function useRoleDefinitions(data, props) {
2941
- const { fields, setControlContextData } = props;
2945
+ const { setControlContextData } = props;
2942
2946
  return React.useMemo(() => {
2943
2947
  var _a, _b, _c, _d, _e;
2944
2948
  const schema = data == null ? void 0 : data.schema;
@@ -3131,14 +3135,18 @@ function registerRichCalendar(loader) {
3131
3135
  type: "dateString",
3132
3136
  description: `The date selected by default as an ISO string`,
3133
3137
  validator: (value, ps) => {
3134
- if (!ps.value)
3138
+ if (!ps.value) {
3135
3139
  return true;
3136
- if (!ps.validRange)
3140
+ }
3141
+ if (!ps.validRange) {
3137
3142
  return true;
3138
- if (!isValidIsoDate(value))
3143
+ }
3144
+ if (!isValidIsoDate(value)) {
3139
3145
  return "Not a valid ISO string.";
3140
- if (dayjs(value).isBefore(ps.validRange[0]) || dayjs(value).isAfter(ps.validRange[1]))
3146
+ }
3147
+ if (dayjs(value).isBefore(ps.validRange[0]) || dayjs(value).isAfter(ps.validRange[1])) {
3141
3148
  return "Not within the valid range";
3149
+ }
3142
3150
  return true;
3143
3151
  }
3144
3152
  },
@@ -3152,13 +3160,16 @@ function registerRichCalendar(loader) {
3152
3160
  type: "dateRangeStrings",
3153
3161
  description: "Only allow selection of dates that lie within this range",
3154
3162
  advanced: true,
3155
- validator: (value, ps) => {
3156
- if (!value)
3163
+ validator: (value, _ps) => {
3164
+ if (!value) {
3157
3165
  return true;
3158
- if (!Array.isArray(value) || value.length !== 2)
3166
+ }
3167
+ if (!Array.isArray(value) || value.length !== 2) {
3159
3168
  return "Not an array with 2 items";
3160
- if (!isValidIsoDate(value[0]) || !isValidIsoDate(value[1]))
3169
+ }
3170
+ if (!isValidIsoDate(value[0]) || !isValidIsoDate(value[1])) {
3161
3171
  return "Min or max range is not in valid ISO date format.";
3172
+ }
3162
3173
  return true;
3163
3174
  }
3164
3175
  },