@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
@@ -1,5 +1,5 @@
1
1
  import { QueryResult, TableSchema } from "@plasmicapp/data-sources";
2
- import { ContextDependentConfig } from "@plasmicapp/host";
2
+ import { ComponentContextConfig } from "@plasmicapp/host";
3
3
  import { PropType } from "@plasmicapp/host/registerComponent";
4
4
  export interface AutoSettings {
5
5
  dataType: "auto";
@@ -95,6 +95,6 @@ export declare function getFieldSubprops<ColumnConfig extends BaseColumnConfig>(
95
95
  export declare function buildFieldsPropType<ColumnConfig extends BaseColumnConfig, Props extends FieldfulProps<ColumnConfig>>({ advanced, displayName, minimalValue, ...opts }: {
96
96
  advanced?: boolean;
97
97
  displayName?: string;
98
- minimalValue?: ContextDependentConfig<Props, any>;
98
+ minimalValue?: ComponentContextConfig<Props, any>;
99
99
  } & FieldSubpropsOpts<ColumnConfig>): PropType<Props>;
100
100
  export {};
package/dist/index.js CHANGED
@@ -239,7 +239,7 @@ function getFieldSubprops(opts) {
239
239
  hidden: () => !!opts.noTitle
240
240
  },
241
241
  expr: __spreadProps$9(__spreadValues$c({}, rowDataType("Custom value")), {
242
- hidden: (ps, ctx, { item, path: _controlPath }) => {
242
+ hidden: (_ps, _ctx, { item, path: _controlPath }) => {
243
243
  return false;
244
244
  }
245
245
  }),
@@ -293,14 +293,14 @@ function getFieldSubprops(opts) {
293
293
  description: "Must be a valid currency code",
294
294
  type: "string",
295
295
  defaultValueHint: "USD",
296
- hidden: (ps, ctx, { item }) => item.dataType !== "currency"
296
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "currency"
297
297
  },
298
298
  locale: {
299
299
  displayName: "Locale",
300
300
  description: "Must be a valid locale code",
301
301
  type: "string",
302
302
  defaultValueHint: "en-US",
303
- hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES) && !isOneOf(item.dataType, DATETIME_TYPES)
303
+ hidden: (_ps, _ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES) && !isOneOf(item.dataType, DATETIME_TYPES)
304
304
  },
305
305
  notation: {
306
306
  displayName: "Notation",
@@ -320,7 +320,7 @@ function getFieldSubprops(opts) {
320
320
  }
321
321
  ],
322
322
  defaultValueHint: "standard",
323
- hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
323
+ hidden: (_ps, _ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
324
324
  },
325
325
  signDisplay: {
326
326
  type: "choice",
@@ -336,7 +336,7 @@ function getFieldSubprops(opts) {
336
336
  }
337
337
  ],
338
338
  defaultValueHint: "auto",
339
- hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
339
+ hidden: (_ps, _ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
340
340
  },
341
341
  maximumFractionDigits: {
342
342
  type: "number",
@@ -344,7 +344,7 @@ function getFieldSubprops(opts) {
344
344
  defaultValueHint: 3,
345
345
  min: 0,
346
346
  max: 20,
347
- hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
347
+ hidden: (_ps, _ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
348
348
  },
349
349
  minimumFractionDigits: {
350
350
  type: "number",
@@ -352,7 +352,7 @@ function getFieldSubprops(opts) {
352
352
  defaultValueHint: 0,
353
353
  min: 0,
354
354
  max: 20,
355
- hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
355
+ hidden: (_ps, _ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
356
356
  },
357
357
  showAs: {
358
358
  type: "choice",
@@ -372,7 +372,7 @@ function getFieldSubprops(opts) {
372
372
  ],
373
373
  displayName: "Show as",
374
374
  defaultValueHint: "checkbox",
375
- hidden: (ps, ctx, { item }) => item.dataType !== "boolean"
375
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "boolean"
376
376
  },
377
377
  dateStyle: {
378
378
  displayName: "Date style",
@@ -400,7 +400,7 @@ function getFieldSubprops(opts) {
400
400
  }
401
401
  ],
402
402
  defaultValueHint: DEFAULT_DATETIME_SETTINGS.dateStyle,
403
- hidden: (ps, ctx, { item }) => item.dataType !== "datetime"
403
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "datetime"
404
404
  },
405
405
  timeStyle: {
406
406
  displayName: "Time style",
@@ -428,14 +428,14 @@ function getFieldSubprops(opts) {
428
428
  }
429
429
  ],
430
430
  defaultValueHint: DEFAULT_DATETIME_SETTINGS.timeStyle,
431
- hidden: (ps, ctx, { item }) => item.dataType !== "datetime"
431
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "datetime"
432
432
  },
433
433
  hour12: {
434
434
  displayName: "Use AM/PM?",
435
435
  description: "Whether to use AM/PM or 24-hour clock",
436
436
  type: "boolean",
437
437
  defaultValueHint: DEFAULT_DATETIME_SETTINGS.hour12,
438
- hidden: (ps, ctx, { item }) => item.dataType !== "datetime"
438
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "datetime"
439
439
  },
440
440
  numeric: {
441
441
  type: "choice",
@@ -448,7 +448,7 @@ function getFieldSubprops(opts) {
448
448
  }
449
449
  ],
450
450
  defaultValueHint: DEFAULT_RELATIVE_DATETIME_SETTINGS.numeric,
451
- hidden: (ps, ctx, { item }) => item.dataType !== "relative-datetime"
451
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "relative-datetime"
452
452
  },
453
453
  unit: {
454
454
  type: "choice",
@@ -484,7 +484,7 @@ function getFieldSubprops(opts) {
484
484
  }
485
485
  ],
486
486
  defaultValueHint: DEFAULT_RELATIVE_DATETIME_SETTINGS.unit,
487
- hidden: (ps, ctx, { item }) => item.dataType !== "relative-datetime"
487
+ hidden: (_ps, _ctx, { item }) => item.dataType !== "relative-datetime"
488
488
  }
489
489
  } : {}), opts.fieldTypes);
490
490
  }
@@ -528,7 +528,7 @@ function buildFieldsPropType(_a) {
528
528
  hidden: (ps) => !ps.data,
529
529
  unstable__keyFunc: (x) => x.key,
530
530
  unstable__minimalValue: minimalValue,
531
- unstable__canDelete: (ps, _props, ctx, { item }) => {
531
+ unstable__canDelete: (_ps, _props, ctx, { item }) => {
532
532
  if (opts.canChangeField) {
533
533
  return true;
534
534
  }
@@ -986,7 +986,7 @@ var __objRest$2 = (source, exclude) => {
986
986
  };
987
987
  function omitUndefined(x) {
988
988
  return Object.fromEntries(
989
- Object.entries(x).filter(([k, v]) => v !== void 0)
989
+ Object.entries(x).filter(([_k, v]) => v !== void 0)
990
990
  );
991
991
  }
992
992
  function processNavItems(navMenuItems) {
@@ -1052,10 +1052,12 @@ function RichLayout(_a) {
1052
1052
  }
1053
1053
  }, []);
1054
1054
  React.useEffect(() => {
1055
- if (!ready)
1055
+ if (!ready) {
1056
1056
  return;
1057
- if (!ref.current)
1057
+ }
1058
+ if (!ref.current) {
1058
1059
  return;
1060
+ }
1059
1061
  const selectedSubmenus = Array.from(
1060
1062
  ref.current.querySelectorAll(
1061
1063
  "ul > li.ant-menu-submenu.ant-menu-submenu-selected > div"
@@ -1182,8 +1184,9 @@ function RichLayout(_a) {
1182
1184
  return [actionsChildren];
1183
1185
  },
1184
1186
  menuFooterRender: (props) => {
1185
- if (props == null ? void 0 : props.collapsed)
1187
+ if (props == null ? void 0 : props.collapsed) {
1186
1188
  return void 0;
1189
+ }
1187
1190
  return footerChildren;
1188
1191
  },
1189
1192
  onMenuHeaderClick: (e) => console.log(e),
@@ -2051,22 +2054,22 @@ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
2051
2054
  const tableHelpers = {
2052
2055
  states: {
2053
2056
  selectedRow: {
2054
- onChangeArgsToValue: (rowKeys, rows) => {
2057
+ onChangeArgsToValue: (_rowKeys, rows) => {
2055
2058
  return rows[0];
2056
2059
  }
2057
2060
  },
2058
2061
  selectedRows: {
2059
- onChangeArgsToValue: (rowKeys, rows) => {
2062
+ onChangeArgsToValue: (_rowKeys, rows) => {
2060
2063
  return rows;
2061
2064
  }
2062
2065
  },
2063
2066
  selectedRowKey: {
2064
- onChangeArgsToValue: (rowKeys, rows) => {
2067
+ onChangeArgsToValue: (rowKeys, _rows) => {
2065
2068
  return rowKeys[0];
2066
2069
  }
2067
2070
  },
2068
2071
  selectedRowKeys: {
2069
- onChangeArgsToValue: (rowKeys, rows) => {
2072
+ onChangeArgsToValue: (rowKeys, _rows) => {
2070
2073
  return rowKeys;
2071
2074
  }
2072
2075
  }
@@ -2329,7 +2332,6 @@ function RichList(props) {
2329
2332
  header,
2330
2333
  footer,
2331
2334
  rowActions = [],
2332
- title,
2333
2335
  pageSize = 10,
2334
2336
  hideSearch,
2335
2337
  rowKey,
@@ -2344,7 +2346,6 @@ function RichList(props) {
2344
2346
  "header",
2345
2347
  "footer",
2346
2348
  "rowActions",
2347
- "title",
2348
2349
  "pageSize",
2349
2350
  "hideSearch",
2350
2351
  "rowKey",
@@ -2362,9 +2363,8 @@ function RichList(props) {
2362
2363
  data,
2363
2364
  props
2364
2365
  );
2365
- React.useRef();
2366
2366
  const linkTo = typeof props.linkTo === "function" ? props.linkTo : void 0;
2367
- const { finalData, search, setSearch, setSortState } = useSortedFilteredData(
2367
+ const { finalData, search, setSearch } = useSortedFilteredData(
2368
2368
  data,
2369
2369
  normalized
2370
2370
  );
@@ -2394,7 +2394,7 @@ function RichList(props) {
2394
2394
  pageSize,
2395
2395
  showSizeChanger: false
2396
2396
  } : false,
2397
- renderItem: (record, index) => {
2397
+ renderItem: (record) => {
2398
2398
  var _a2;
2399
2399
  const actions = renderActions(rowActions, record, data, rowKey);
2400
2400
  const image = maybe(
@@ -2420,11 +2420,13 @@ function RichList(props) {
2420
2420
  }
2421
2421
  );
2422
2422
  function makeLinkWrapper() {
2423
- if ((actions != null ? actions : []).length > 0)
2423
+ if ((actions != null ? actions : []).length > 0) {
2424
2424
  return void 0;
2425
+ }
2425
2426
  const href = linkTo == null ? void 0 : linkTo(record);
2426
- if (!href && !onRowClick)
2427
+ if (!href && !onRowClick) {
2427
2428
  return void 0;
2429
+ }
2428
2430
  const _linkWrapper = (x) => /* @__PURE__ */ React__default.default.createElement(
2429
2431
  "a",
2430
2432
  {
@@ -2809,8 +2811,9 @@ dayjs__default.default.extend(weekday__default.default);
2809
2811
  dayjs__default.default.extend(localeData__default.default);
2810
2812
  function getEventFullDate(date) {
2811
2813
  const parsed = luxonParser.parseDate(date);
2812
- if (!parsed)
2814
+ if (!parsed) {
2813
2815
  return void 0;
2816
+ }
2814
2817
  const yyyy = parsed.getFullYear();
2815
2818
  const mm = (parsed.getMonth() + 1).toString().padStart(2, "0");
2816
2819
  const dd = parsed.getDate().toString().padStart(2, "0");
@@ -2821,8 +2824,9 @@ function getEventMonthYear(date) {
2821
2824
  return (_a = getEventFullDate(date)) == null ? void 0 : _a.substring(0, 7);
2822
2825
  }
2823
2826
  function EventCell({ events }) {
2824
- if (!events || !events.length)
2827
+ if (!events || !events.length) {
2825
2828
  return null;
2829
+ }
2826
2830
  return /* @__PURE__ */ React__default.default.createElement("ul", { style: { all: "unset" } }, events.map((e) => /* @__PURE__ */ React__default.default.createElement("li", { key: JSON.stringify(e), style: { all: "unset", display: "block" } }, /* @__PURE__ */ React__default.default.createElement(antd.Badge, { color: e.color || "green", text: e.title }))));
2827
2831
  }
2828
2832
  function RichCalendar(props) {
@@ -2858,16 +2862,14 @@ function RichCalendar(props) {
2858
2862
  "monthFullCellRender"
2859
2863
  ]);
2860
2864
  const data = dataSources.useNormalizedData(rawData);
2861
- const { normalized, finalRoles: roleConfigs } = useRoleDefinitions(
2862
- data,
2863
- props
2864
- );
2865
+ const { finalRoles: roleConfigs } = useRoleDefinitions(data, props);
2865
2866
  const {
2866
2867
  eventsByDate,
2867
2868
  eventsByMonth
2868
2869
  } = React.useMemo(() => {
2869
- if (!data)
2870
+ if (!data) {
2870
2871
  return { eventsByDate: {}, eventsByMonth: {} };
2872
+ }
2871
2873
  return data == null ? void 0 : data.data.reduce(
2872
2874
  (acc, item) => {
2873
2875
  const date = getFieldAggregateValue(item, roleConfigs.date);
@@ -2904,11 +2906,13 @@ function RichCalendar(props) {
2904
2906
  [isoDefaultValue]
2905
2907
  );
2906
2908
  const validRange = React.useMemo(() => {
2907
- if (!isoValidRange)
2909
+ if (!isoValidRange) {
2908
2910
  return void 0;
2911
+ }
2909
2912
  const range = isoValidRange.filter((dateIso) => isValidIsoDate(dateIso)).map((d) => dayjs__default.default(d));
2910
- if (range.length !== 2)
2913
+ if (range.length !== 2) {
2911
2914
  return void 0;
2915
+ }
2912
2916
  return [range[0], range[1]];
2913
2917
  }, [isoValidRange]);
2914
2918
  const key = React.useMemo(() => JSON.stringify(roleConfigs), [roleConfigs]);
@@ -2952,7 +2956,7 @@ const defaultColumnConfig = () => ({
2952
2956
  });
2953
2957
  const roles = ["date", "title", "color", "unset"];
2954
2958
  function useRoleDefinitions(data, props) {
2955
- const { fields, setControlContextData } = props;
2959
+ const { setControlContextData } = props;
2956
2960
  return React__default.default.useMemo(() => {
2957
2961
  var _a, _b, _c, _d, _e;
2958
2962
  const schema = data == null ? void 0 : data.schema;
@@ -3145,14 +3149,18 @@ function registerRichCalendar(loader) {
3145
3149
  type: "dateString",
3146
3150
  description: `The date selected by default as an ISO string`,
3147
3151
  validator: (value, ps) => {
3148
- if (!ps.value)
3152
+ if (!ps.value) {
3149
3153
  return true;
3150
- if (!ps.validRange)
3154
+ }
3155
+ if (!ps.validRange) {
3151
3156
  return true;
3152
- if (!isValidIsoDate(value))
3157
+ }
3158
+ if (!isValidIsoDate(value)) {
3153
3159
  return "Not a valid ISO string.";
3154
- if (dayjs__default.default(value).isBefore(ps.validRange[0]) || dayjs__default.default(value).isAfter(ps.validRange[1]))
3160
+ }
3161
+ if (dayjs__default.default(value).isBefore(ps.validRange[0]) || dayjs__default.default(value).isAfter(ps.validRange[1])) {
3155
3162
  return "Not within the valid range";
3163
+ }
3156
3164
  return true;
3157
3165
  }
3158
3166
  },
@@ -3166,13 +3174,16 @@ function registerRichCalendar(loader) {
3166
3174
  type: "dateRangeStrings",
3167
3175
  description: "Only allow selection of dates that lie within this range",
3168
3176
  advanced: true,
3169
- validator: (value, ps) => {
3170
- if (!value)
3177
+ validator: (value, _ps) => {
3178
+ if (!value) {
3171
3179
  return true;
3172
- if (!Array.isArray(value) || value.length !== 2)
3180
+ }
3181
+ if (!Array.isArray(value) || value.length !== 2) {
3173
3182
  return "Not an array with 2 items";
3174
- if (!isValidIsoDate(value[0]) || !isValidIsoDate(value[1]))
3183
+ }
3184
+ if (!isValidIsoDate(value[0]) || !isValidIsoDate(value[1])) {
3175
3185
  return "Min or max range is not in valid ISO date format.";
3186
+ }
3176
3187
  return true;
3177
3188
  }
3178
3189
  },