@ai-matrx/records-ui 0.89.1 → 0.89.3

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
@@ -1728,7 +1728,9 @@ function FormattedValue({
1728
1728
  onRate
1729
1729
  }) {
1730
1730
  const def = getFieldFormat2(format.id);
1731
- if (def?.id === "rating" && onRate) {
1731
+ const score = numberOf(value);
1732
+ const max = format.options?.ratingMax ?? 5;
1733
+ if (def?.id === "rating" && onRate && (value === null || value === void 0 || value === "" || score !== null && score >= 0 && score <= max)) {
1732
1734
  return /* @__PURE__ */ jsx7(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate });
1733
1735
  }
1734
1736
  const result = formatFieldValue2(value, format);
@@ -4335,6 +4337,10 @@ var PLAIN_WORD = {
4335
4337
  date: "datetime",
4336
4338
  datetime: "datetime"
4337
4339
  };
4340
+ function storesWord(def) {
4341
+ if (KIND_WORD[def.id]) return def.label;
4342
+ return BASE_WORDS[def.base] ?? def.base;
4343
+ }
4338
4344
  var BASE_WORDS = {
4339
4345
  string: "Text",
4340
4346
  number: "Number",
@@ -4465,12 +4471,12 @@ function FieldFormatPicker({
4465
4471
  otherKinds.length > 0 ? /* @__PURE__ */ jsx20("optgroup", { label: "Other kinds \xB7 changes what the column stores", "data-records-other-kinds": "", children: otherKinds.map(({ def }) => /* @__PURE__ */ jsxs15("option", { value: def.id, children: [
4466
4472
  def.label,
4467
4473
  " \xB7 stores ",
4468
- BASE_WORDS[def.base] ?? def.base
4474
+ storesWord(def)
4469
4475
  ] }, def.id)) }) : null
4470
4476
  ]
4471
4477
  }
4472
4478
  ),
4473
- /* @__PURE__ */ jsx20("p", { className: "text-[11px] text-muted-foreground", children: retypedTo ? `This changes what the column stores, to ${BASE_WORDS[retypedTo.def.base] ?? retypedTo.def.base}. The store converts each value it can, and says so before it keeps anything it cannot.` : active ? active.description : "How every value in this column is written, wherever it appears." }),
4479
+ /* @__PURE__ */ jsx20("p", { className: "text-[11px] text-muted-foreground", children: retypedTo ? `This changes what the column stores, to ${storesWord(retypedTo.def)}. The store converts each value it can, and says so before it keeps anything it cannot.` : active ? active.description : "How every value in this column is written, wherever it appears." }),
4474
4480
  optionKeys.length > 0 ? /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-end gap-2", children: [
4475
4481
  option(
4476
4482
  "currency",