@ai-matrx/records-ui 0.115.70 → 0.115.72
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 +11 -0
- package/dist/first-page.cjs +0 -1
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.js +0 -1
- package/dist/first-page.js.map +1 -1
- package/dist/helpers.cjs +618 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/helpers.d.cts +1258 -0
- package/dist/helpers.d.ts +1258 -0
- package/dist/helpers.js +559 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.cjs +309 -285
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.js +182 -164
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +94 -72
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +69 -53
- package/dist/pickers.js.map +1 -1
- package/package.json +16 -6
package/dist/pickers.js
CHANGED
|
@@ -50,11 +50,7 @@ import { STYLE_COLORS as STYLE_COLORS2, STYLE_COLOR_LABELS, SWATCH_CLASS } from
|
|
|
50
50
|
|
|
51
51
|
// src/choiceLooks.ts
|
|
52
52
|
import { newerKindOf } from "@ai-matrx/records";
|
|
53
|
-
import {
|
|
54
|
-
CHOICE_CHIP_CLASS,
|
|
55
|
-
NEUTRAL_CHIP_CLASS,
|
|
56
|
-
STYLE_COLORS
|
|
57
|
-
} from "@ai-matrx/design-system/data-table";
|
|
53
|
+
import { CHOICE_CHIP_CLASS, NEUTRAL_CHIP_CLASS, STYLE_COLORS } from "@ai-matrx/design-system/data-table/table-style";
|
|
58
54
|
function displayFormatOf(field) {
|
|
59
55
|
const raw = field.display_format;
|
|
60
56
|
if (!raw || typeof raw !== "object") return null;
|
|
@@ -656,8 +652,7 @@ function lockedStructure(base) {
|
|
|
656
652
|
return { ...base, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base.why(what) };
|
|
657
653
|
}
|
|
658
654
|
|
|
659
|
-
// src/
|
|
660
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
655
|
+
// src/tableRights.ts
|
|
661
656
|
function tableRights(may, overallReason) {
|
|
662
657
|
return {
|
|
663
658
|
...may,
|
|
@@ -666,6 +661,9 @@ function tableRights(may, overallReason) {
|
|
|
666
661
|
};
|
|
667
662
|
}
|
|
668
663
|
var NO_RIGHTS = tableRights(NOT_ANSWERED_YET);
|
|
664
|
+
|
|
665
|
+
// src/host.tsx
|
|
666
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
669
667
|
var NO_MEMBERS_REASON = "This app cannot offer the people in your organization on this screen yet, so there is nobody to pick. Type the person's name into a text field for now, and tell us \u2014 it is on our list, not yours.";
|
|
670
668
|
var NO_UPLOAD_REASON = "This screen cannot take a file yet, so there is no chooser here rather than one that loses what you pick. Put a link to the file in a text field for now. It is on our list, not yours.";
|
|
671
669
|
var HostContext = createContext(null);
|
|
@@ -2139,7 +2137,8 @@ import { useCallback as useCallback2, useEffect as useEffect6, useMemo as useMem
|
|
|
2139
2137
|
import { withTablePlacement } from "@ai-matrx/records";
|
|
2140
2138
|
import { useRecordsClient as useRecordsClient2, useTables } from "@ai-matrx/records/react";
|
|
2141
2139
|
import { Checkbox, cn as cn8 } from "@ai-matrx/design-system";
|
|
2142
|
-
|
|
2140
|
+
|
|
2141
|
+
// src/tablePickerEntries.ts
|
|
2143
2142
|
var PLATFORM_TABLE_PREFIX = "records_ui_";
|
|
2144
2143
|
function keptByPlatform(table) {
|
|
2145
2144
|
return table.platform_owned === true || table.kept_by_the_app === true;
|
|
@@ -2183,6 +2182,9 @@ function madeOn(stamp) {
|
|
|
2183
2182
|
if (Number.isNaN(at.getTime())) return null;
|
|
2184
2183
|
return new Intl.DateTimeFormat(void 0, { month: "short", day: "numeric", year: "numeric" }).format(at);
|
|
2185
2184
|
}
|
|
2185
|
+
|
|
2186
|
+
// src/tablePicking.tsx
|
|
2187
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2186
2188
|
function usePickerTables() {
|
|
2187
2189
|
const client = useRecordsClient2();
|
|
2188
2190
|
const tables = useTables();
|
|
@@ -2847,10 +2849,7 @@ import { Badge as Badge5, cn as cn18 } from "@ai-matrx/design-system";
|
|
|
2847
2849
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
2848
2850
|
|
|
2849
2851
|
// src/presentation.ts
|
|
2850
|
-
import { parseTableStyle, tableStyleIsEmpty } from "@ai-matrx/design-system/data-table/table-style";
|
|
2851
|
-
import {
|
|
2852
|
-
COLOR_ROTATION
|
|
2853
|
-
} from "@ai-matrx/design-system/data-table";
|
|
2852
|
+
import { COLOR_ROTATION, parseTableStyle, tableStyleIsEmpty } from "@ai-matrx/design-system/data-table/table-style";
|
|
2854
2853
|
import { getFieldFormat } from "@ai-matrx/design-system/field-formats";
|
|
2855
2854
|
import { newerKindOf as newerKindOf4, ratingMaxOf } from "@ai-matrx/records";
|
|
2856
2855
|
var DRAWN_KINDS = /* @__PURE__ */ new Set(["select", "multi_select", "relation", "member", "person", "attachment", "file", "entity_reference", "checkbox", "boolean", "signature", "json"]);
|
|
@@ -4390,8 +4389,8 @@ function formulaSourceArchived(field, document2) {
|
|
|
4390
4389
|
const keys = (field.config ?? {})[FORMULA_INPUT_KEYS];
|
|
4391
4390
|
if (!Array.isArray(keys) || !document2) return null;
|
|
4392
4391
|
for (const key of keys) {
|
|
4393
|
-
const
|
|
4394
|
-
if (
|
|
4392
|
+
const state2 = sourceArchivedOf(document2[String(key)]);
|
|
4393
|
+
if (state2) return state2;
|
|
4395
4394
|
}
|
|
4396
4395
|
return null;
|
|
4397
4396
|
}
|
|
@@ -4443,12 +4442,12 @@ function computedEmptyOf(field, document2) {
|
|
|
4443
4442
|
return { kind: "formula" };
|
|
4444
4443
|
}
|
|
4445
4444
|
var SOURCE_ARCHIVED_WORDS = "Source archived";
|
|
4446
|
-
function sourceArchivedSentence(
|
|
4447
|
-
if (!
|
|
4448
|
-
return
|
|
4445
|
+
function sourceArchivedSentence(state2) {
|
|
4446
|
+
if (!state2.label) return "A column it reads is archived";
|
|
4447
|
+
return state2.table ? `${state2.label} on ${state2.table} is archived` : `${state2.label} is archived`;
|
|
4449
4448
|
}
|
|
4450
|
-
function SourceArchivedValue({ state }) {
|
|
4451
|
-
return /* @__PURE__ */ jsx23("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(
|
|
4449
|
+
function SourceArchivedValue({ state: state2 }) {
|
|
4450
|
+
return /* @__PURE__ */ jsx23("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state2), "data-records-source-archived": state2.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
|
|
4452
4451
|
}
|
|
4453
4452
|
var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
|
|
4454
4453
|
function renderValue(field, value, document2, labels, stillWaitingFor, look) {
|
|
@@ -4600,12 +4599,12 @@ function scalarText(field, value, labels, stillWaitingFor) {
|
|
|
4600
4599
|
|
|
4601
4600
|
// src/SourceArchivedNotice.tsx
|
|
4602
4601
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4603
|
-
function bringBackLabel(
|
|
4604
|
-
return
|
|
4602
|
+
function bringBackLabel(state2) {
|
|
4603
|
+
return state2.label ? `Bring back ${state2.label}` : "Bring it back";
|
|
4605
4604
|
}
|
|
4606
4605
|
function SourceArchivedNotice({ fieldId, tableId }) {
|
|
4607
4606
|
const client = useRecordsClient6();
|
|
4608
|
-
const [
|
|
4607
|
+
const [state2, setState] = useState18(null);
|
|
4609
4608
|
const [busy, setBusy] = useState18(false);
|
|
4610
4609
|
const [refused, setRefused] = useState18(null);
|
|
4611
4610
|
const read = useCallback5(async () => {
|
|
@@ -4616,19 +4615,19 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
4616
4615
|
useEffect12(() => {
|
|
4617
4616
|
void read();
|
|
4618
4617
|
}, [read]);
|
|
4619
|
-
if (refused && !
|
|
4620
|
-
if (!
|
|
4618
|
+
if (refused && !state2) return /* @__PURE__ */ jsx24(RefusalNotice, { error: refused });
|
|
4619
|
+
if (!state2) return null;
|
|
4621
4620
|
const restore = async () => {
|
|
4622
|
-
if (!
|
|
4621
|
+
if (!state2.field_id) return;
|
|
4623
4622
|
setBusy(true);
|
|
4624
4623
|
setRefused(null);
|
|
4625
|
-
const done = await client.fieldRestore({ field_id:
|
|
4624
|
+
const done = await client.fieldRestore({ field_id: state2.field_id });
|
|
4626
4625
|
setBusy(false);
|
|
4627
4626
|
if (!done.ok) {
|
|
4628
4627
|
setRefused(done.error);
|
|
4629
4628
|
return;
|
|
4630
4629
|
}
|
|
4631
|
-
if (
|
|
4630
|
+
if (state2.table_id) tableShapeChanged(state2.table_id);
|
|
4632
4631
|
tableShapeChanged(tableId);
|
|
4633
4632
|
await read();
|
|
4634
4633
|
};
|
|
@@ -4637,13 +4636,13 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
4637
4636
|
{
|
|
4638
4637
|
className: "flex flex-wrap items-center gap-2 rounded-md border border-border px-3 py-2",
|
|
4639
4638
|
"data-testid": "source-archived-notice",
|
|
4640
|
-
"data-field-id":
|
|
4639
|
+
"data-field-id": state2.field_id ?? "",
|
|
4641
4640
|
children: [
|
|
4642
4641
|
/* @__PURE__ */ jsxs22("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
4643
4642
|
/* @__PURE__ */ jsx24("span", { className: "text-sm", children: SOURCE_ARCHIVED_WORDS }),
|
|
4644
|
-
/* @__PURE__ */ jsx24("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(
|
|
4643
|
+
/* @__PURE__ */ jsx24("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state2) })
|
|
4645
4644
|
] }),
|
|
4646
|
-
|
|
4645
|
+
state2.field_id ? /* @__PURE__ */ jsx24(Button11, { type: "button", size: "sm", variant: "secondary", disabled: busy, onClick: () => void restore(), children: bringBackLabel(state2) }) : null,
|
|
4647
4646
|
refused ? /* @__PURE__ */ jsx24(RefusalNotice, { error: refused, className: "basis-full" }) : null
|
|
4648
4647
|
]
|
|
4649
4648
|
}
|
|
@@ -4658,23 +4657,25 @@ import { useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx
|
|
|
4658
4657
|
|
|
4659
4658
|
// src/personTime.ts
|
|
4660
4659
|
import { useSyncExternalStore } from "react";
|
|
4660
|
+
|
|
4661
|
+
// src/personZone.ts
|
|
4661
4662
|
import { setColorRuleTimeZone } from "@ai-matrx/design-system/data-table/table-style";
|
|
4662
|
-
|
|
4663
|
-
var
|
|
4663
|
+
import { globalSlot } from "@ai-matrx/kit/global-slot";
|
|
4664
|
+
var state = globalSlot("ai-matrx.records-ui.person-time-zone", () => ({
|
|
4665
|
+
zone: null,
|
|
4666
|
+
listeners: /* @__PURE__ */ new Set()
|
|
4667
|
+
}));
|
|
4664
4668
|
function getPersonTimeZone() {
|
|
4665
|
-
return zone;
|
|
4669
|
+
return state.zone;
|
|
4666
4670
|
}
|
|
4667
|
-
function
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
},
|
|
4673
|
-
() => zone,
|
|
4674
|
-
() => null
|
|
4675
|
-
);
|
|
4671
|
+
function subscribePersonTimeZone(listener) {
|
|
4672
|
+
state.listeners.add(listener);
|
|
4673
|
+
return () => {
|
|
4674
|
+
state.listeners.delete(listener);
|
|
4675
|
+
};
|
|
4676
4676
|
}
|
|
4677
4677
|
function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
4678
|
+
const zone = state.zone;
|
|
4678
4679
|
if (!zone) return at;
|
|
4679
4680
|
const parts = new Intl.DateTimeFormat("en-US", {
|
|
4680
4681
|
timeZone: zone,
|
|
@@ -4690,6 +4691,15 @@ function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
|
4690
4691
|
return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
|
|
4691
4692
|
}
|
|
4692
4693
|
|
|
4694
|
+
// src/personTime.ts
|
|
4695
|
+
function usePersonTimeZone() {
|
|
4696
|
+
return useSyncExternalStore(
|
|
4697
|
+
subscribePersonTimeZone,
|
|
4698
|
+
getPersonTimeZone,
|
|
4699
|
+
() => null
|
|
4700
|
+
);
|
|
4701
|
+
}
|
|
4702
|
+
|
|
4693
4703
|
// src/Condition.tsx
|
|
4694
4704
|
import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4695
4705
|
var CONDITION_OPS = [
|
|
@@ -4717,10 +4727,10 @@ var RELATIVE_DAY_TERMS = [
|
|
|
4717
4727
|
{ kind: "past_days", label: "is in the past \u2026 days", takesDays: true }
|
|
4718
4728
|
];
|
|
4719
4729
|
function relativeDayNode(fieldId, kind, days) {
|
|
4720
|
-
const
|
|
4730
|
+
const zone = getPersonTimeZone();
|
|
4721
4731
|
const window2 = { relative: kind };
|
|
4722
4732
|
if (RELATIVE_DAY_TERMS.find((t) => t.kind === kind)?.takesDays) window2["n"] = days ?? 7;
|
|
4723
|
-
if (
|
|
4733
|
+
if (zone) window2["tz"] = zone;
|
|
4724
4734
|
return { op: "within", args: [{ field: fieldId }, { const: window2 }] };
|
|
4725
4735
|
}
|
|
4726
4736
|
function relativeDayOf(expr) {
|
|
@@ -7087,12 +7097,12 @@ function sourceKindOf(field) {
|
|
|
7087
7097
|
if (kind === "attachment") return "file";
|
|
7088
7098
|
return null;
|
|
7089
7099
|
}
|
|
7090
|
-
function whatIsMissing(
|
|
7091
|
-
const noun =
|
|
7092
|
-
const { type, label, via, pick, agg, of, relations, formulaFields } =
|
|
7093
|
-
const relationTarget =
|
|
7100
|
+
function whatIsMissing(state2) {
|
|
7101
|
+
const noun = state2.noun ?? "column";
|
|
7102
|
+
const { type, label, via, pick, agg, of, relations, formulaFields } = state2;
|
|
7103
|
+
const relationTarget = state2.relationTarget ?? "";
|
|
7094
7104
|
if (label.trim() === "") return `Give the ${noun} a name.`;
|
|
7095
|
-
if (type === "entity_reference") return whatIsMissingForEntityReference(
|
|
7105
|
+
if (type === "entity_reference") return whatIsMissingForEntityReference(state2.allowedTypes ?? []);
|
|
7096
7106
|
if (type === "relation") {
|
|
7097
7107
|
if (relationTarget.trim() === "") return `Choose the table this ${noun} points at.`;
|
|
7098
7108
|
return null;
|
|
@@ -9030,11 +9040,17 @@ function ChoiceAnswer({
|
|
|
9030
9040
|
|
|
9031
9041
|
// src/RecordsMount.tsx
|
|
9032
9042
|
import { useRef as useRef17 } from "react";
|
|
9033
|
-
|
|
9034
|
-
|
|
9043
|
+
|
|
9044
|
+
// src/dataSource.ts
|
|
9045
|
+
import { globalSlot as globalSlot2 } from "@ai-matrx/kit/global-slot";
|
|
9035
9046
|
function personActor(userId) {
|
|
9036
9047
|
return userId ? { actor: "user", user_id: userId } : { actor: "user" };
|
|
9037
9048
|
}
|
|
9049
|
+
var dataSources = globalSlot2("ai-matrx.records-ui.data-sources", () => /* @__PURE__ */ new WeakMap());
|
|
9050
|
+
|
|
9051
|
+
// src/RecordsMount.tsx
|
|
9052
|
+
import { RecordsProvider } from "@ai-matrx/records/react";
|
|
9053
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
9038
9054
|
|
|
9039
9055
|
// src/TablePickers.tsx
|
|
9040
9056
|
import { Fragment as Fragment14, jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
@@ -9069,7 +9085,7 @@ function readTablesAnywhere(dataSource) {
|
|
|
9069
9085
|
return read;
|
|
9070
9086
|
}
|
|
9071
9087
|
function useTablesAnywhere(dataSource) {
|
|
9072
|
-
const [
|
|
9088
|
+
const [state2, setState] = useState31({ loading: true, error: null, rows: [] });
|
|
9073
9089
|
useEffect22(() => {
|
|
9074
9090
|
let live = true;
|
|
9075
9091
|
void readTablesAnywhere(dataSource).then((result) => {
|
|
@@ -9079,7 +9095,7 @@ function useTablesAnywhere(dataSource) {
|
|
|
9079
9095
|
live = false;
|
|
9080
9096
|
};
|
|
9081
9097
|
}, [dataSource]);
|
|
9082
|
-
return
|
|
9098
|
+
return state2;
|
|
9083
9099
|
}
|
|
9084
9100
|
function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
9085
9101
|
const own3 = useTablesAnywhere(dataSource);
|