@ai-matrx/records-ui 0.113.3 → 0.113.4

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/pickers.js CHANGED
@@ -66,7 +66,7 @@ function fieldOptionsOnce(client, fieldId) {
66
66
 
67
67
  // src/editors.tsx
68
68
  import { useCallback as useCallback5, useEffect as useEffect10, useLayoutEffect as useLayoutEffect2, useRef as useRef12, useState as useState15 } from "react";
69
- import { allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as newerKindOf4, decideTypedChoice, isTheChosen, optionKey as optionKey2, rankTypedMatches as rankTypedMatches3, readTypedTime as readTypedTime2, typedDateText as typedDateText2, typedTimeText as typedTimeText2 } from "@ai-matrx/records";
69
+ import { allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as newerKindOf5, decideTypedChoice, isTheChosen, optionKey as optionKey2, rankTypedMatches as rankTypedMatches3, readTypedTime as readTypedTime2, typedDateText as typedDateText2, typedTimeText as typedTimeText2 } from "@ai-matrx/records";
70
70
  import { useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
71
71
  import {
72
72
  BasicInput as BasicInput5,
@@ -458,6 +458,7 @@ function BarcodeControl({ value, onChange, disabled, id }) {
458
458
  }
459
459
 
460
460
  // src/choiceLooks.ts
461
+ import { newerKindOf as newerKindOf2 } from "@ai-matrx/records";
461
462
  import {
462
463
  CHOICE_CHIP_CLASS,
463
464
  NEUTRAL_CHIP_CLASS,
@@ -496,6 +497,20 @@ function choiceLooksOf(field) {
496
497
  function choiceWord(value) {
497
498
  return String(value ?? "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
498
499
  }
500
+ var STATUS_GROUP_COLOR = { todo: "gray", in_progress: "blue", done: "green" };
501
+ function statusGroupColor(field, value) {
502
+ if (newerKindOf2(field) !== "status" || value === null || value === void 0 || value === "") return void 0;
503
+ const word = choiceWord(value);
504
+ if (word === "") return void 0;
505
+ const groups = (field.config ?? {})["status_groups"];
506
+ if (groups && typeof groups === "object") {
507
+ for (const [key, group] of Object.entries(groups)) {
508
+ if (choiceWord(key) !== word) continue;
509
+ return group === "in_progress" ? STATUS_GROUP_COLOR.in_progress : group === "done" ? STATUS_GROUP_COLOR.done : STATUS_GROUP_COLOR.todo;
510
+ }
511
+ }
512
+ return STATUS_GROUP_COLOR.todo;
513
+ }
499
514
  function storedChoiceColor(field, value) {
500
515
  if (value === null || value === void 0 || value === "") return void 0;
501
516
  const word = choiceWord(value);
@@ -504,7 +519,7 @@ function storedChoiceColor(field, value) {
504
519
  if (!look.color) continue;
505
520
  if (choiceWord(look.value) === word || look.label && choiceWord(look.label) === word) return look.color;
506
521
  }
507
- return void 0;
522
+ return statusGroupColor(field, value);
508
523
  }
509
524
  function choiceChipLookOf(field, ...words) {
510
525
  for (const word of words) {
@@ -519,7 +534,7 @@ import {
519
534
  KERNEL_TABLES,
520
535
  PARITY_FIELD_TYPES,
521
536
  fieldKindFor,
522
- newerKindOf as newerKindOf2
537
+ newerKindOf as newerKindOf3
523
538
  } from "@ai-matrx/records";
524
539
  import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
525
540
 
@@ -2781,7 +2796,7 @@ import {
2781
2796
  COLOR_ROTATION
2782
2797
  } from "@ai-matrx/design-system/data-table";
2783
2798
  import { getFieldFormat } from "@ai-matrx/design-system/field-formats";
2784
- import { newerKindOf as newerKindOf3, ratingMaxOf } from "@ai-matrx/records";
2799
+ import { newerKindOf as newerKindOf4, ratingMaxOf } from "@ai-matrx/records";
2785
2800
  var DRAWN_KINDS = /* @__PURE__ */ new Set(["select", "multi_select", "relation", "member", "person", "attachment", "file", "entity_reference", "checkbox", "boolean", "signature", "json"]);
2786
2801
  function shownAsOf(field) {
2787
2802
  if (DRAWN_KINDS.has(String(editorKindFor(field)))) return void 0;
@@ -2794,7 +2809,7 @@ function shownAsOf(field) {
2794
2809
  }
2795
2810
  function formatForField(field) {
2796
2811
  const shownAs = shownAsOf(field);
2797
- if (newerKindOf3(field) === "rating" && (!shownAs || shownAs.id === "rating")) {
2812
+ if (newerKindOf4(field) === "rating" && (!shownAs || shownAs.id === "rating")) {
2798
2813
  return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: ratingMaxOf(field) } };
2799
2814
  }
2800
2815
  if (shownAs) return shownAs;