@ai-matrx/records-ui 0.113.2 → 0.113.6
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/CHANGELOG.md +27 -1
- package/dist/index.cjs +291 -265
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +49 -23
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +95 -79
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.d.cts +1 -1
- package/dist/pickers.d.ts +1 -1
- package/dist/pickers.js +26 -10
- package/dist/pickers.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3782,7 +3782,7 @@ declare function SignaturePad({ value, onChange, disabled, id, className, }: {
|
|
|
3782
3782
|
interface PickerTable {
|
|
3783
3783
|
id: string;
|
|
3784
3784
|
name: string;
|
|
3785
|
-
|
|
3785
|
+
platform_owned?: boolean | null | undefined;
|
|
3786
3786
|
/** `custom.table_facts`: which feature keeps it (`choices` for a value set). */
|
|
3787
3787
|
kept_for?: string | null | undefined;
|
|
3788
3788
|
/** `custom.data_home_tables`: the store's one word for what it is (`list` for a value set). */
|
|
@@ -3823,7 +3823,7 @@ declare function tablePickerEntries<T extends PickerTable>(tables: readonly T[],
|
|
|
3823
3823
|
/**
|
|
3824
3824
|
* The organization's tables with the store's placement facts folded on (`kept_for`,
|
|
3825
3825
|
* `used_in_table_id`), for a picker that reads `tableList()`. A store with no facts door, or one
|
|
3826
|
-
* that did not answer, leaves each table as `tableList()` gave it — its own `
|
|
3826
|
+
* that did not answer, leaves each table as `tableList()` gave it — its own `platform_owned`.
|
|
3827
3827
|
*/
|
|
3828
3828
|
declare function usePickerTables(): {
|
|
3829
3829
|
loading: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -3782,7 +3782,7 @@ declare function SignaturePad({ value, onChange, disabled, id, className, }: {
|
|
|
3782
3782
|
interface PickerTable {
|
|
3783
3783
|
id: string;
|
|
3784
3784
|
name: string;
|
|
3785
|
-
|
|
3785
|
+
platform_owned?: boolean | null | undefined;
|
|
3786
3786
|
/** `custom.table_facts`: which feature keeps it (`choices` for a value set). */
|
|
3787
3787
|
kept_for?: string | null | undefined;
|
|
3788
3788
|
/** `custom.data_home_tables`: the store's one word for what it is (`list` for a value set). */
|
|
@@ -3823,7 +3823,7 @@ declare function tablePickerEntries<T extends PickerTable>(tables: readonly T[],
|
|
|
3823
3823
|
/**
|
|
3824
3824
|
* The organization's tables with the store's placement facts folded on (`kept_for`,
|
|
3825
3825
|
* `used_in_table_id`), for a picker that reads `tableList()`. A store with no facts door, or one
|
|
3826
|
-
* that did not answer, leaves each table as `tableList()` gave it — its own `
|
|
3826
|
+
* that did not answer, leaves each table as `tableList()` gave it — its own `platform_owned`.
|
|
3827
3827
|
*/
|
|
3828
3828
|
declare function usePickerTables(): {
|
|
3829
3829
|
loading: boolean;
|
package/dist/index.js
CHANGED
|
@@ -671,6 +671,7 @@ function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
|
671
671
|
}
|
|
672
672
|
|
|
673
673
|
// src/choiceLooks.ts
|
|
674
|
+
import { newerKindOf } from "@ai-matrx/records";
|
|
674
675
|
import {
|
|
675
676
|
CHOICE_CHIP_CLASS,
|
|
676
677
|
NEUTRAL_CHIP_CLASS,
|
|
@@ -709,6 +710,20 @@ function choiceLooksOf(field2) {
|
|
|
709
710
|
function choiceWord(value) {
|
|
710
711
|
return String(value ?? "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
711
712
|
}
|
|
713
|
+
var STATUS_GROUP_COLOR = { todo: "gray", in_progress: "blue", done: "green" };
|
|
714
|
+
function statusGroupColor(field2, value) {
|
|
715
|
+
if (newerKindOf(field2) !== "status" || value === null || value === void 0 || value === "") return void 0;
|
|
716
|
+
const word = choiceWord(value);
|
|
717
|
+
if (word === "") return void 0;
|
|
718
|
+
const groups = (field2.config ?? {})["status_groups"];
|
|
719
|
+
if (groups && typeof groups === "object") {
|
|
720
|
+
for (const [key, group] of Object.entries(groups)) {
|
|
721
|
+
if (choiceWord(key) !== word) continue;
|
|
722
|
+
return group === "in_progress" ? STATUS_GROUP_COLOR.in_progress : group === "done" ? STATUS_GROUP_COLOR.done : STATUS_GROUP_COLOR.todo;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
return STATUS_GROUP_COLOR.todo;
|
|
726
|
+
}
|
|
712
727
|
function storedChoiceColor(field2, value) {
|
|
713
728
|
if (value === null || value === void 0 || value === "") return void 0;
|
|
714
729
|
const word = choiceWord(value);
|
|
@@ -717,7 +732,7 @@ function storedChoiceColor(field2, value) {
|
|
|
717
732
|
if (!look.color) continue;
|
|
718
733
|
if (choiceWord(look.value) === word || look.label && choiceWord(look.label) === word) return look.color;
|
|
719
734
|
}
|
|
720
|
-
return
|
|
735
|
+
return statusGroupColor(field2, value);
|
|
721
736
|
}
|
|
722
737
|
function storedChoiceColorLookup(fields, fallback) {
|
|
723
738
|
const byKey = new Map(fields.map((f) => [f.key, f]));
|
|
@@ -745,7 +760,7 @@ import {
|
|
|
745
760
|
KERNEL_TABLES,
|
|
746
761
|
PARITY_FIELD_TYPES as PARITY_FIELD_TYPES2,
|
|
747
762
|
fieldKindFor,
|
|
748
|
-
newerKindOf
|
|
763
|
+
newerKindOf as newerKindOf2
|
|
749
764
|
} from "@ai-matrx/records";
|
|
750
765
|
import { humanizeIdentifier as humanizeIdentifier2 } from "@ai-matrx/kit/text-case";
|
|
751
766
|
|
|
@@ -892,7 +907,7 @@ function editorKindFor(field2) {
|
|
|
892
907
|
}
|
|
893
908
|
function pickableTypeOf(field2) {
|
|
894
909
|
if (isSignatureField(field2)) return "signature";
|
|
895
|
-
const newer =
|
|
910
|
+
const newer = newerKindOf2(field2);
|
|
896
911
|
if (newer) return newer;
|
|
897
912
|
const look = displayFormatOf(field2)?.id;
|
|
898
913
|
if (look === "rating" && field2.type === "range") return "rating";
|
|
@@ -3170,10 +3185,10 @@ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
|
3170
3185
|
var PLATFORM_TABLE_PREFIX = "records_ui_";
|
|
3171
3186
|
function isValueSet(table) {
|
|
3172
3187
|
if (table.kept_for === "choices") return true;
|
|
3173
|
-
return table.kept_for == null && table.kind === "list" && table.
|
|
3188
|
+
return table.kept_for == null && table.kind === "list" && table.platform_owned === true;
|
|
3174
3189
|
}
|
|
3175
3190
|
function isKeptTable(table) {
|
|
3176
|
-
return table.
|
|
3191
|
+
return table.platform_owned === true || isValueSet(table) || Boolean(table.work_kind) || (table.slug ?? "").startsWith(PLATFORM_TABLE_PREFIX);
|
|
3177
3192
|
}
|
|
3178
3193
|
var CHOICES_SUFFIX = / choices$/i;
|
|
3179
3194
|
function tablePickerEntries(tables, options = {}) {
|
|
@@ -3785,7 +3800,7 @@ import {
|
|
|
3785
3800
|
COLOR_ROTATION
|
|
3786
3801
|
} from "@ai-matrx/design-system/data-table";
|
|
3787
3802
|
import { getFieldFormat } from "@ai-matrx/design-system/field-formats";
|
|
3788
|
-
import { newerKindOf as
|
|
3803
|
+
import { newerKindOf as newerKindOf3, ratingMaxOf } from "@ai-matrx/records";
|
|
3789
3804
|
|
|
3790
3805
|
// src/dates.ts
|
|
3791
3806
|
import { formatFieldValue } from "@ai-matrx/design-system/field-formats";
|
|
@@ -4063,7 +4078,7 @@ function shownAsOf(field2) {
|
|
|
4063
4078
|
}
|
|
4064
4079
|
function formatForField(field2) {
|
|
4065
4080
|
const shownAs = shownAsOf(field2);
|
|
4066
|
-
if (
|
|
4081
|
+
if (newerKindOf3(field2) === "rating" && (!shownAs || shownAs.id === "rating")) {
|
|
4067
4082
|
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: ratingMaxOf(field2) } };
|
|
4068
4083
|
}
|
|
4069
4084
|
if (shownAs) return shownAs;
|
|
@@ -4186,7 +4201,7 @@ function resolveTableStyle(decorations, fields, viewStyle) {
|
|
|
4186
4201
|
|
|
4187
4202
|
// src/editors.tsx
|
|
4188
4203
|
import { useCallback as useCallback7, useEffect as useEffect14, useLayoutEffect as useLayoutEffect2, useRef as useRef14, useState as useState19 } from "react";
|
|
4189
|
-
import { allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as
|
|
4204
|
+
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";
|
|
4190
4205
|
import { useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
|
|
4191
4206
|
import {
|
|
4192
4207
|
BasicInput as BasicInput6,
|
|
@@ -4218,7 +4233,7 @@ import {
|
|
|
4218
4233
|
durationText,
|
|
4219
4234
|
isAddressValue,
|
|
4220
4235
|
isPersonStamp,
|
|
4221
|
-
newerKindOf as
|
|
4236
|
+
newerKindOf as newerKindOf4,
|
|
4222
4237
|
personStampText,
|
|
4223
4238
|
readTypedDuration,
|
|
4224
4239
|
safeLinkHref,
|
|
@@ -4228,7 +4243,7 @@ import { BasicInput as BasicInput3, cn as cn9 } from "@ai-matrx/design-system";
|
|
|
4228
4243
|
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4229
4244
|
var own = (event) => event.stopPropagation();
|
|
4230
4245
|
function newerKindValue(field2, value, opts = {}) {
|
|
4231
|
-
switch (
|
|
4246
|
+
switch (newerKindOf4(field2)) {
|
|
4232
4247
|
case "duration": {
|
|
4233
4248
|
const words2 = durationText(value);
|
|
4234
4249
|
return words2 === null ? void 0 : /* @__PURE__ */ jsx13("span", { className: "tabular-nums", "data-records-duration": "", children: words2 });
|
|
@@ -4291,7 +4306,7 @@ function AddressLink({ value }) {
|
|
|
4291
4306
|
}
|
|
4292
4307
|
var STATUS_GROUP_MARK = { todo: "\u25CB", in_progress: "\u25D0", done: "\u25CF" };
|
|
4293
4308
|
function statusMarkOf(field2, value, document2) {
|
|
4294
|
-
if (
|
|
4309
|
+
if (newerKindOf4(field2) !== "status" || typeof value !== "string") return null;
|
|
4295
4310
|
const chosen = document2?.["_choices"]?.[field2.key];
|
|
4296
4311
|
const key = chosen && typeof chosen === "object" && typeof chosen.key === "string" ? chosen.key : value;
|
|
4297
4312
|
const group = statusGroupOf(field2, key);
|
|
@@ -4388,7 +4403,7 @@ function SafeMarkdown({ text: text2, clipped }) {
|
|
|
4388
4403
|
);
|
|
4389
4404
|
}
|
|
4390
4405
|
function newerKindControl(props) {
|
|
4391
|
-
switch (
|
|
4406
|
+
switch (newerKindOf4(props.field)) {
|
|
4392
4407
|
case "duration":
|
|
4393
4408
|
return /* @__PURE__ */ jsx13(DurationControl, { ...props });
|
|
4394
4409
|
case "address":
|
|
@@ -5643,9 +5658,10 @@ function TypedDateHelper({
|
|
|
5643
5658
|
text: text2,
|
|
5644
5659
|
onText,
|
|
5645
5660
|
label,
|
|
5646
|
-
onPicked
|
|
5661
|
+
onPicked,
|
|
5662
|
+
startOpen = false
|
|
5647
5663
|
}) {
|
|
5648
|
-
const [open, setOpen] = useState17(
|
|
5664
|
+
const [open, setOpen] = useState17(startOpen);
|
|
5649
5665
|
const held = readBox(text2, kind);
|
|
5650
5666
|
usePersonTimeZone();
|
|
5651
5667
|
const today = personWallNow();
|
|
@@ -5831,7 +5847,7 @@ function FieldLabel({ field: field2, htmlFor, children }) {
|
|
|
5831
5847
|
return /* @__PURE__ */ jsxs20("div", { className: "flex items-baseline gap-1.5", children: [
|
|
5832
5848
|
/* @__PURE__ */ jsx22(Label2, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
|
|
5833
5849
|
field2.required ? /* @__PURE__ */ jsx22("span", { className: "text-xs text-destructive", children: "required" }) : null,
|
|
5834
|
-
field2.unit &&
|
|
5850
|
+
field2.unit && newerKindOf5(field2) !== "duration" ? /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
|
|
5835
5851
|
children
|
|
5836
5852
|
] });
|
|
5837
5853
|
}
|
|
@@ -6012,7 +6028,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
6012
6028
|
return /* @__PURE__ */ jsxs20("span", { className: "flex flex-col gap-0.5", children: [
|
|
6013
6029
|
helper && !disabled ? /* @__PURE__ */ jsxs20("span", { className: "flex min-w-0 items-center gap-0.5", children: [
|
|
6014
6030
|
box,
|
|
6015
|
-
/* @__PURE__ */ jsx22(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field2), onPicked: onCommit })
|
|
6031
|
+
/* @__PURE__ */ jsx22(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field2), onPicked: onCommit, startOpen: value.openedAs !== void 0 })
|
|
6016
6032
|
] }) : box,
|
|
6017
6033
|
judged === null ? /* @__PURE__ */ jsxs20("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
|
|
6018
6034
|
"Reading ",
|
|
@@ -9231,6 +9247,10 @@ function GridCell({
|
|
|
9231
9247
|
openThisCell(event);
|
|
9232
9248
|
return;
|
|
9233
9249
|
}
|
|
9250
|
+
if (dateHelperKind(field2, value) !== null) {
|
|
9251
|
+
if (wasActive.current || event.target !== closedControl.current && event.target instanceof Node && closedControl.current?.contains(event.target)) openThisCell(event);
|
|
9252
|
+
return;
|
|
9253
|
+
}
|
|
9234
9254
|
if (!opensAsAList(field2, hostTakesFiles(ui))) return;
|
|
9235
9255
|
if (wasActive.current || clickLandsOnAChip(event.target)) openThisCell(event);
|
|
9236
9256
|
};
|
|
@@ -9483,7 +9503,7 @@ function closesOnBlur(field2) {
|
|
|
9483
9503
|
return true;
|
|
9484
9504
|
}
|
|
9485
9505
|
}
|
|
9486
|
-
var LIST_CELL_CHIP = "[data-records-choice-chip], [data-records-person-chip]
|
|
9506
|
+
var LIST_CELL_CHIP = "[data-records-choice-chip], [data-records-person-chip]";
|
|
9487
9507
|
function clickLandsOnAChip(target) {
|
|
9488
9508
|
return target instanceof Element && target.closest(LIST_CELL_CHIP) !== null;
|
|
9489
9509
|
}
|
|
@@ -18602,9 +18622,15 @@ var TYPE_ICON = {
|
|
|
18602
18622
|
rollup: FORMULA,
|
|
18603
18623
|
json: [["path", { d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1" }], ["path", { d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1" }]]
|
|
18604
18624
|
};
|
|
18625
|
+
var CLOCK = [["circle", { cx: 12, cy: 12, r: 10 }], ["path", { d: "M12 6v6l4 2" }]];
|
|
18626
|
+
var PERSON_PLUS = [["path", { d: "M2 21a8 8 0 0 1 13.292-6" }], ["circle", { cx: 10, cy: 8, r: 5 }], ["path", { d: "M19 16v6" }], ["path", { d: "M22 19h-6" }]];
|
|
18627
|
+
var PERSON_PEN = [["path", { d: "M11.5 15H7a4 4 0 0 0-4 4v2" }], ["path", { d: "M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z" }], ["circle", { cx: 10, cy: 7, r: 4 }]];
|
|
18628
|
+
var STAMP_ICON = { created_time: CLOCK, modified_time: CLOCK, created_by: PERSON_PLUS, modified_by: PERSON_PEN };
|
|
18605
18629
|
function withTypeMark(field2, header) {
|
|
18606
|
-
const
|
|
18607
|
-
const
|
|
18630
|
+
const picked = pickableTypeOf(field2);
|
|
18631
|
+
const stamp = picked !== void 0 && picked in STAMP_ICON ? picked : void 0;
|
|
18632
|
+
const kind = stamp ?? editorKindFor(field2);
|
|
18633
|
+
const parts = (stamp ? STAMP_ICON[stamp] : TYPE_ICON[editorKindFor(field2)]) ?? TYPE_ICON.text;
|
|
18608
18634
|
return /* @__PURE__ */ jsxs55("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-type-mark": kind, children: [
|
|
18609
18635
|
/* @__PURE__ */ jsx60(
|
|
18610
18636
|
"svg",
|
|
@@ -30071,12 +30097,12 @@ function ShareForSomebodyElse({
|
|
|
30071
30097
|
// src/RecordBody.tsx
|
|
30072
30098
|
import { useEffect as useEffect69, useRef as useRef42, useState as useState80 } from "react";
|
|
30073
30099
|
import { Button as Button61, cn as cn49 } from "@ai-matrx/design-system";
|
|
30074
|
-
import { newerKindOf as
|
|
30100
|
+
import { newerKindOf as newerKindOf6 } from "@ai-matrx/records";
|
|
30075
30101
|
import { tableShapeChanged as tableShapeChanged11, useFieldMutation as useFieldMutation5, useFields as useFields14, useRecord as useRecord2, useRecordsClient as useRecordsClient58, useTable as useTable14 } from "@ai-matrx/records/react";
|
|
30076
30102
|
import { Fragment as Fragment37, jsx as jsx99, jsxs as jsxs90 } from "react/jsx-runtime";
|
|
30077
30103
|
var BODY_NAMES = /^(notes?|page|body|content|page content|details|description)$/i;
|
|
30078
30104
|
function bodyFieldOf(fields) {
|
|
30079
|
-
const rich2 = fields.filter((field2) =>
|
|
30105
|
+
const rich2 = fields.filter((field2) => newerKindOf6(field2) === "rich_text");
|
|
30080
30106
|
return rich2.find((field2) => BODY_NAMES.test((field2.label ?? field2.key).trim()) || BODY_NAMES.test(field2.key.replace(/_/g, " "))) ?? rich2[0];
|
|
30081
30107
|
}
|
|
30082
30108
|
var BODY_COLUMN_NAME = "Notes";
|
|
@@ -30483,7 +30509,7 @@ function usePlatformTable(spec) {
|
|
|
30483
30509
|
// src/ViewSwitcher.tsx
|
|
30484
30510
|
import { useEffect as useEffect78, useMemo as useMemo56, useState as useState90 } from "react";
|
|
30485
30511
|
import { mayDrag as mayDrag4, useFields as useFields18, useRecordPage as useRecordPage2, useRecordsClient as useRecordsClient65, useTable as useTable18 } from "@ai-matrx/records/react";
|
|
30486
|
-
import { newerKindOf as
|
|
30512
|
+
import { newerKindOf as newerKindOf7, stableFilterKey as stableFilterKey4 } from "@ai-matrx/records";
|
|
30487
30513
|
import { Button as Button68, Select as Select16, SelectContent as SelectContent16, SelectItem as SelectItem16, SelectTrigger as SelectTrigger16, SelectValue as SelectValue16, cn as cn56 } from "@ai-matrx/design-system";
|
|
30488
30514
|
import {
|
|
30489
30515
|
CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS4,
|
|
@@ -34807,7 +34833,7 @@ function cardHiddenOf(presentation) {
|
|
|
34807
34833
|
}
|
|
34808
34834
|
var STATUS_WORDS = /^(status|stage|state|progress|phase)$/i;
|
|
34809
34835
|
function boardDefaultGroupField(eligible) {
|
|
34810
|
-
return eligible.find((f) =>
|
|
34836
|
+
return eligible.find((f) => newerKindOf7(f) === "status") ?? eligible.find((f) => STATUS_WORDS.test(fieldName(f).trim()) || STATUS_WORDS.test(f.key)) ?? eligible[0] ?? null;
|
|
34811
34837
|
}
|
|
34812
34838
|
|
|
34813
34839
|
// src/ArchivedView.tsx
|