@ai-matrx/records-ui 0.107.3 → 0.107.5
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 +12 -0
- package/dist/index.cjs +2698 -2372
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -7
- package/dist/index.d.ts +95 -7
- package/dist/index.js +1619 -1289
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +109 -76
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +34 -1
- package/dist/pickers.js.map +1 -1
- package/package.json +6 -5
package/dist/pickers.cjs
CHANGED
|
@@ -42,8 +42,8 @@ __export(pickers_exports, {
|
|
|
42
42
|
module.exports = __toCommonJS(pickers_exports);
|
|
43
43
|
|
|
44
44
|
// src/TablePickers.tsx
|
|
45
|
-
var
|
|
46
|
-
var
|
|
45
|
+
var import_react32 = require("react");
|
|
46
|
+
var import_react33 = require("@ai-matrx/records/react");
|
|
47
47
|
var import_design_system17 = require("@ai-matrx/design-system");
|
|
48
48
|
|
|
49
49
|
// src/askOnce.ts
|
|
@@ -81,9 +81,9 @@ function fieldOptionsOnce(client, fieldId) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// src/editors.tsx
|
|
84
|
-
var
|
|
84
|
+
var import_react26 = require("react");
|
|
85
85
|
var import_records10 = require("@ai-matrx/records");
|
|
86
|
-
var
|
|
86
|
+
var import_react27 = require("@ai-matrx/records/react");
|
|
87
87
|
var import_design_system15 = require("@ai-matrx/design-system");
|
|
88
88
|
|
|
89
89
|
// src/dates.ts
|
|
@@ -3067,9 +3067,41 @@ function formatControl(args) {
|
|
|
3067
3067
|
}
|
|
3068
3068
|
|
|
3069
3069
|
// src/typedDateHelper.tsx
|
|
3070
|
-
var
|
|
3070
|
+
var import_react23 = require("react");
|
|
3071
3071
|
var import_design_system14 = require("@ai-matrx/design-system");
|
|
3072
3072
|
var import_records9 = require("@ai-matrx/records");
|
|
3073
|
+
|
|
3074
|
+
// src/personTime.ts
|
|
3075
|
+
var import_react22 = require("react");
|
|
3076
|
+
var zone = null;
|
|
3077
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
3078
|
+
function usePersonTimeZone() {
|
|
3079
|
+
return (0, import_react22.useSyncExternalStore)(
|
|
3080
|
+
(cb) => {
|
|
3081
|
+
listeners.add(cb);
|
|
3082
|
+
return () => listeners.delete(cb);
|
|
3083
|
+
},
|
|
3084
|
+
() => zone,
|
|
3085
|
+
() => null
|
|
3086
|
+
);
|
|
3087
|
+
}
|
|
3088
|
+
function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
3089
|
+
if (!zone) return at;
|
|
3090
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
3091
|
+
timeZone: zone,
|
|
3092
|
+
year: "numeric",
|
|
3093
|
+
month: "2-digit",
|
|
3094
|
+
day: "2-digit",
|
|
3095
|
+
hour: "2-digit",
|
|
3096
|
+
minute: "2-digit",
|
|
3097
|
+
second: "2-digit",
|
|
3098
|
+
hourCycle: "h23"
|
|
3099
|
+
}).formatToParts(at);
|
|
3100
|
+
const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
|
|
3101
|
+
return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
|
|
3102
|
+
}
|
|
3103
|
+
|
|
3104
|
+
// src/typedDateHelper.tsx
|
|
3073
3105
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3074
3106
|
var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
3075
3107
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
@@ -3117,11 +3149,12 @@ function TypedDateHelper({
|
|
|
3117
3149
|
label,
|
|
3118
3150
|
onPicked
|
|
3119
3151
|
}) {
|
|
3120
|
-
const [open, setOpen] = (0,
|
|
3152
|
+
const [open, setOpen] = (0, import_react23.useState)(false);
|
|
3121
3153
|
const held = readBox(text, kind);
|
|
3122
|
-
|
|
3154
|
+
usePersonTimeZone();
|
|
3155
|
+
const today = personWallNow();
|
|
3123
3156
|
const start = held.day ? new Date(Number(held.day.slice(0, 4)), Number(held.day.slice(5, 7)) - 1, 1) : new Date(today.getFullYear(), today.getMonth(), 1);
|
|
3124
|
-
const [month, setMonth] = (0,
|
|
3157
|
+
const [month, setMonth] = (0, import_react23.useState)(null);
|
|
3125
3158
|
const shown2 = month ?? { y: start.getFullYear(), m: start.getMonth() };
|
|
3126
3159
|
const first = new Date(shown2.y, shown2.m, 1).getDay();
|
|
3127
3160
|
const days = new Date(shown2.y, shown2.m + 1, 0).getDate();
|
|
@@ -3226,8 +3259,8 @@ function TypedDateHelper({
|
|
|
3226
3259
|
}
|
|
3227
3260
|
|
|
3228
3261
|
// src/choiceNudge.ts
|
|
3229
|
-
var
|
|
3230
|
-
var
|
|
3262
|
+
var import_react24 = require("react");
|
|
3263
|
+
var import_react25 = require("@ai-matrx/records/react");
|
|
3231
3264
|
var asked2 = /* @__PURE__ */ new WeakMap();
|
|
3232
3265
|
function choiceNudgeOf(client) {
|
|
3233
3266
|
let answer = asked2.get(client);
|
|
@@ -3241,9 +3274,9 @@ function choiceNudgeOf(client) {
|
|
|
3241
3274
|
return answer;
|
|
3242
3275
|
}
|
|
3243
3276
|
function useChoiceNudge(enabled = true) {
|
|
3244
|
-
const client = (0,
|
|
3245
|
-
const [nudge, setNudge] = (0,
|
|
3246
|
-
(0,
|
|
3277
|
+
const client = (0, import_react25.useOptionalRecordsClient)();
|
|
3278
|
+
const [nudge, setNudge] = (0, import_react24.useState)(null);
|
|
3279
|
+
(0, import_react24.useEffect)(() => {
|
|
3247
3280
|
if (!enabled || !client) return;
|
|
3248
3281
|
let live = true;
|
|
3249
3282
|
void choiceNudgeOf(client).then((answer) => {
|
|
@@ -3394,9 +3427,9 @@ function openingText(field, value) {
|
|
|
3394
3427
|
return format ? typedText(format, value) : String(value);
|
|
3395
3428
|
}
|
|
3396
3429
|
function ReadsAsNote({ typed, always, children }) {
|
|
3397
|
-
const note = (0,
|
|
3398
|
-
const [repeats, setRepeats] = (0,
|
|
3399
|
-
(0,
|
|
3430
|
+
const note = (0, import_react26.useRef)(null);
|
|
3431
|
+
const [repeats, setRepeats] = (0, import_react26.useState)(false);
|
|
3432
|
+
(0, import_react26.useLayoutEffect)(() => {
|
|
3400
3433
|
if (always) return;
|
|
3401
3434
|
const words = (t) => (t ?? "").replace(/^Reads as/, "").replace(/\s+/g, "").toLowerCase();
|
|
3402
3435
|
setRepeats(words(note.current?.textContent) === words(typed));
|
|
@@ -3405,12 +3438,12 @@ function ReadsAsNote({ typed, always, children }) {
|
|
|
3405
3438
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
|
|
3406
3439
|
}
|
|
3407
3440
|
function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCancel }) {
|
|
3408
|
-
const client = (0,
|
|
3441
|
+
const client = (0, import_react27.useOptionalRecordsClient)();
|
|
3409
3442
|
const kind = String(editorKindFor(field));
|
|
3410
3443
|
const needsChoices = kind === "select" || kind === "multi_select";
|
|
3411
3444
|
const nudge = useChoiceNudge(needsChoices);
|
|
3412
|
-
const [choices, setChoices] = (0,
|
|
3413
|
-
(0,
|
|
3445
|
+
const [choices, setChoices] = (0, import_react26.useState)(null);
|
|
3446
|
+
(0, import_react26.useEffect)(() => {
|
|
3414
3447
|
if (!needsChoices || !client) return;
|
|
3415
3448
|
let cancelled = false;
|
|
3416
3449
|
void fieldOptionsOnce(client, field.id).then((result) => {
|
|
@@ -3420,7 +3453,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
3420
3453
|
cancelled = true;
|
|
3421
3454
|
};
|
|
3422
3455
|
}, [client, field.id, needsChoices]);
|
|
3423
|
-
(0,
|
|
3456
|
+
(0, import_react26.useEffect)(() => {
|
|
3424
3457
|
if (choices && nudge && value.judged === null) onChange({ ...value, judged: judgeTyped(field, value.text, choices, nudge) });
|
|
3425
3458
|
}, [choices, nudge, value, field, onChange]);
|
|
3426
3459
|
const judged = value.judged;
|
|
@@ -3496,7 +3529,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
3496
3529
|
const host = useRecordsUi();
|
|
3497
3530
|
const kind = editorKindFor(field);
|
|
3498
3531
|
const inputId = id ?? `field-${field.key}`;
|
|
3499
|
-
const ownDetails = (0,
|
|
3532
|
+
const ownDetails = (0, import_react27.useOptionalRecordsClient)() === null;
|
|
3500
3533
|
if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
3501
3534
|
if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
3502
3535
|
const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
|
|
@@ -3604,11 +3637,11 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
3604
3637
|
}
|
|
3605
3638
|
}
|
|
3606
3639
|
function TypedWordsControl({ field, value, onChange, disabled, id }) {
|
|
3607
|
-
const [text, setText] = (0,
|
|
3608
|
-
const [refusal2, setRefusal] = (0,
|
|
3609
|
-
const [why, setWhy] = (0,
|
|
3610
|
-
const sent = (0,
|
|
3611
|
-
(0,
|
|
3640
|
+
const [text, setText] = (0, import_react26.useState)(() => openingText(field, value));
|
|
3641
|
+
const [refusal2, setRefusal] = (0, import_react26.useState)(null);
|
|
3642
|
+
const [why, setWhy] = (0, import_react26.useState)(void 0);
|
|
3643
|
+
const sent = (0, import_react26.useRef)(value);
|
|
3644
|
+
(0, import_react26.useEffect)(() => {
|
|
3612
3645
|
if (value === sent.current) return;
|
|
3613
3646
|
sent.current = value;
|
|
3614
3647
|
setText(openingText(field, value));
|
|
@@ -3688,8 +3721,8 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
|
|
|
3688
3721
|
}
|
|
3689
3722
|
function JsonControl({ field, value, onChange, disabled, id }) {
|
|
3690
3723
|
const initial = value === null || value === void 0 ? "" : typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
3691
|
-
const [text, setText] = (0,
|
|
3692
|
-
const [broken, setBroken] = (0,
|
|
3724
|
+
const [text, setText] = (0, import_react26.useState)(initial);
|
|
3725
|
+
const [broken, setBroken] = (0, import_react26.useState)(null);
|
|
3693
3726
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
3694
3727
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3695
3728
|
import_design_system15.BasicTextarea,
|
|
@@ -3750,11 +3783,11 @@ function inTheStoresOrder(options) {
|
|
|
3750
3783
|
return [...options].sort((a, b) => position(a) - position(b) || made(a).localeCompare(made(b)));
|
|
3751
3784
|
}
|
|
3752
3785
|
function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm, onChosen }) {
|
|
3753
|
-
const client = (0,
|
|
3754
|
-
const [options, setOptions] = (0,
|
|
3755
|
-
const [refusal2, setRefusal] = (0,
|
|
3756
|
-
const [reread, setReread] = (0,
|
|
3757
|
-
(0,
|
|
3786
|
+
const client = (0, import_react27.useOptionalRecordsClient)();
|
|
3787
|
+
const [options, setOptions] = (0, import_react26.useState)(null);
|
|
3788
|
+
const [refusal2, setRefusal] = (0, import_react26.useState)(null);
|
|
3789
|
+
const [reread, setReread] = (0, import_react26.useState)(0);
|
|
3790
|
+
(0, import_react26.useEffect)(() => {
|
|
3758
3791
|
if (!client) return;
|
|
3759
3792
|
let cancelled = false;
|
|
3760
3793
|
void fieldOptionsOnce(client, field.id).then((result) => {
|
|
@@ -3904,18 +3937,18 @@ function OpenChoicePicker({
|
|
|
3904
3937
|
allowOther = true,
|
|
3905
3938
|
onChoicesChanged
|
|
3906
3939
|
}) {
|
|
3907
|
-
const client = (0,
|
|
3940
|
+
const client = (0, import_react27.useOptionalRecordsClient)();
|
|
3908
3941
|
const nudge = useChoiceNudge();
|
|
3909
|
-
const [open, setOpenState] = (0,
|
|
3910
|
-
const onCloseRef = (0,
|
|
3942
|
+
const [open, setOpenState] = (0, import_react26.useState)(autoOpen === true);
|
|
3943
|
+
const onCloseRef = (0, import_react26.useRef)(onClose);
|
|
3911
3944
|
onCloseRef.current = onClose;
|
|
3912
|
-
const setOpen = (0,
|
|
3945
|
+
const setOpen = (0, import_react26.useCallback)((next) => {
|
|
3913
3946
|
setOpenState(next);
|
|
3914
3947
|
if (!next) onCloseRef.current?.();
|
|
3915
3948
|
}, []);
|
|
3916
|
-
const [search, setSearch] = (0,
|
|
3917
|
-
const [adding, setAdding] = (0,
|
|
3918
|
-
const [addRefused, setAddRefused] = (0,
|
|
3949
|
+
const [search, setSearch] = (0, import_react26.useState)(initialSearch ?? "");
|
|
3950
|
+
const [adding, setAdding] = (0, import_react26.useState)(false);
|
|
3951
|
+
const [addRefused, setAddRefused] = (0, import_react26.useState)(null);
|
|
3919
3952
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
3920
3953
|
const held = withoutAddition(value);
|
|
3921
3954
|
const current = (0, import_records10.choiceValuesOf)(held.value);
|
|
@@ -4072,7 +4105,7 @@ function ChoiceAnswer({
|
|
|
4072
4105
|
isChosen,
|
|
4073
4106
|
onChosen
|
|
4074
4107
|
}) {
|
|
4075
|
-
const [search, setSearch] = (0,
|
|
4108
|
+
const [search, setSearch] = (0, import_react26.useState)("");
|
|
4076
4109
|
const held = field.multi ? (0, import_records10.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
|
|
4077
4110
|
const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
|
|
4078
4111
|
const press = (choice) => {
|
|
@@ -4175,17 +4208,17 @@ function ChoiceAnswer({
|
|
|
4175
4208
|
}
|
|
4176
4209
|
|
|
4177
4210
|
// src/RecordsMount.tsx
|
|
4178
|
-
var
|
|
4179
|
-
var
|
|
4211
|
+
var import_react28 = require("react");
|
|
4212
|
+
var import_react29 = require("@ai-matrx/records/react");
|
|
4180
4213
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4181
4214
|
function personActor(userId) {
|
|
4182
4215
|
return userId ? { actor: "user", user_id: userId } : { actor: "user" };
|
|
4183
4216
|
}
|
|
4184
4217
|
|
|
4185
4218
|
// src/tablePicking.tsx
|
|
4186
|
-
var
|
|
4219
|
+
var import_react30 = require("react");
|
|
4187
4220
|
var import_records11 = require("@ai-matrx/records");
|
|
4188
|
-
var
|
|
4221
|
+
var import_react31 = require("@ai-matrx/records/react");
|
|
4189
4222
|
var import_design_system16 = require("@ai-matrx/design-system");
|
|
4190
4223
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4191
4224
|
var APP_TABLE_PREFIX = "records_ui_";
|
|
@@ -4262,8 +4295,8 @@ function readTablesAnywhere(dataSource) {
|
|
|
4262
4295
|
return read;
|
|
4263
4296
|
}
|
|
4264
4297
|
function useTablesAnywhere(dataSource) {
|
|
4265
|
-
const [state, setState] = (0,
|
|
4266
|
-
(0,
|
|
4298
|
+
const [state, setState] = (0, import_react32.useState)({ loading: true, error: null, rows: [] });
|
|
4299
|
+
(0, import_react32.useEffect)(() => {
|
|
4267
4300
|
let live = true;
|
|
4268
4301
|
void readTablesAnywhere(dataSource).then((result) => {
|
|
4269
4302
|
if (live) setState(result);
|
|
@@ -4333,14 +4366,14 @@ function TableScope({ dataSource, userId, tableId, children, fallback = null, un
|
|
|
4333
4366
|
const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
|
|
4334
4367
|
if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: unavailable ?? fallback });
|
|
4335
4368
|
if (!tableId || !organizationId) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: fallback });
|
|
4336
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react33.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children });
|
|
4337
4370
|
}
|
|
4338
4371
|
function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
4339
|
-
const fields = (0,
|
|
4340
|
-
const all = (0,
|
|
4341
|
-
const byKey = (0,
|
|
4372
|
+
const fields = (0, import_react33.useFields)(tableId);
|
|
4373
|
+
const all = (0, import_react32.useMemo)(() => fields.data ?? [], [fields.data]);
|
|
4374
|
+
const byKey = (0, import_react32.useMemo)(() => new Map(all.map((f) => [f.key, f])), [all]);
|
|
4342
4375
|
const keys = Object.keys(value);
|
|
4343
|
-
const [adding, setAdding] = (0,
|
|
4376
|
+
const [adding, setAdding] = (0, import_react32.useState)(false);
|
|
4344
4377
|
const optionsFor = (current) => all.filter((f) => f.key === current || !(f.key in value)).map((f) => ({ value: f.key, label: fieldName(f) }));
|
|
4345
4378
|
const rename = (from, to) => {
|
|
4346
4379
|
if (from === to) return;
|
|
@@ -4428,8 +4461,8 @@ function ColumnValueRow({
|
|
|
4428
4461
|
] });
|
|
4429
4462
|
}
|
|
4430
4463
|
function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
4431
|
-
const table = (0,
|
|
4432
|
-
const records = (0,
|
|
4464
|
+
const table = (0, import_react33.useTable)(tableId);
|
|
4465
|
+
const records = (0, import_react33.useRecords)(tableId, { pageSize: 200 });
|
|
4433
4466
|
const rows = records.data?.rows ?? [];
|
|
4434
4467
|
const options = rows.map((row) => ({
|
|
4435
4468
|
value: row.id,
|
|
@@ -4456,9 +4489,9 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
4456
4489
|
}
|
|
4457
4490
|
|
|
4458
4491
|
// src/DataBindingPicker.tsx
|
|
4459
|
-
var
|
|
4492
|
+
var import_react34 = require("react");
|
|
4460
4493
|
var import_records12 = require("@ai-matrx/records");
|
|
4461
|
-
var
|
|
4494
|
+
var import_react35 = require("@ai-matrx/records/react");
|
|
4462
4495
|
var import_design_system18 = require("@ai-matrx/design-system");
|
|
4463
4496
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4464
4497
|
var DATA_BINDING_SHAPES = [
|
|
@@ -4548,11 +4581,11 @@ function BindingDetails({
|
|
|
4548
4581
|
disabled,
|
|
4549
4582
|
defaultRowLimit
|
|
4550
4583
|
}) {
|
|
4551
|
-
const table = (0,
|
|
4552
|
-
const fields = (0,
|
|
4553
|
-
const fieldList = (0,
|
|
4584
|
+
const table = (0, import_react35.useTable)(tableId);
|
|
4585
|
+
const fields = (0, import_react35.useFields)(tableId);
|
|
4586
|
+
const fieldList = (0, import_react34.useMemo)(() => fields.data ?? [], [fields.data]);
|
|
4554
4587
|
const shape = binding.semantic_type;
|
|
4555
|
-
(0,
|
|
4588
|
+
(0, import_react34.useEffect)(() => {
|
|
4556
4589
|
if (disabled || shape === "value" || binding.transform || fields.loading || fieldList.length === 0) return;
|
|
4557
4590
|
onChange({
|
|
4558
4591
|
...binding,
|
|
@@ -4697,7 +4730,7 @@ function BindingDetails({
|
|
|
4697
4730
|
}
|
|
4698
4731
|
|
|
4699
4732
|
// src/PickedSummaries.tsx
|
|
4700
|
-
var
|
|
4733
|
+
var import_react38 = require("@ai-matrx/records/react");
|
|
4701
4734
|
|
|
4702
4735
|
// src/values.tsx
|
|
4703
4736
|
var import_data_table4 = require("@ai-matrx/design-system/data-table");
|
|
@@ -4705,11 +4738,11 @@ var import_field_formats5 = require("@ai-matrx/design-system/field-formats");
|
|
|
4705
4738
|
var import_design_system21 = require("@ai-matrx/design-system");
|
|
4706
4739
|
|
|
4707
4740
|
// src/embeddedLook.tsx
|
|
4708
|
-
var
|
|
4709
|
-
var EmbeddedLookContext = (0,
|
|
4741
|
+
var import_react36 = require("react");
|
|
4742
|
+
var EmbeddedLookContext = (0, import_react36.createContext)(null);
|
|
4710
4743
|
var EmbeddedLookProvider = EmbeddedLookContext.Provider;
|
|
4711
4744
|
function useEmbeddedLook() {
|
|
4712
|
-
return (0,
|
|
4745
|
+
return (0, import_react36.useContext)(EmbeddedLookContext);
|
|
4713
4746
|
}
|
|
4714
4747
|
var EMBEDDED_TABLE_CLASS = [
|
|
4715
4748
|
"[&_tbody_td]:h-10",
|
|
@@ -4757,7 +4790,7 @@ var ABSENCE_WORD_LABEL = {
|
|
|
4757
4790
|
var import_core2 = require("@ai-matrx/records/core");
|
|
4758
4791
|
|
|
4759
4792
|
// src/WholeValue.tsx
|
|
4760
|
-
var
|
|
4793
|
+
var import_react37 = require("react");
|
|
4761
4794
|
var import_core = require("@ai-matrx/records/core");
|
|
4762
4795
|
var import_design_system19 = require("@ai-matrx/design-system");
|
|
4763
4796
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
@@ -5182,7 +5215,7 @@ function ColumnValuesText({
|
|
|
5182
5215
|
);
|
|
5183
5216
|
}
|
|
5184
5217
|
function ColumnValuesWords({ tableId, value }) {
|
|
5185
|
-
const fields = (0,
|
|
5218
|
+
const fields = (0, import_react38.useFields)(tableId);
|
|
5186
5219
|
const labels = useRecordLabels(fields.data ?? void 0);
|
|
5187
5220
|
if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "\u2026" });
|
|
5188
5221
|
if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "Couldn't load this table's columns" });
|
|
@@ -5221,8 +5254,8 @@ function RecordNameText({
|
|
|
5221
5254
|
);
|
|
5222
5255
|
}
|
|
5223
5256
|
function RecordNameWords({ tableId, recordId }) {
|
|
5224
|
-
const table = (0,
|
|
5225
|
-
const record = (0,
|
|
5257
|
+
const table = (0, import_react38.useTable)(tableId);
|
|
5258
|
+
const record = (0, import_react38.useRecord)(recordId);
|
|
5226
5259
|
if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "\u2026" });
|
|
5227
5260
|
if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "Couldn't load this record" });
|
|
5228
5261
|
if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: "A record you cannot open" });
|
|
@@ -5230,19 +5263,19 @@ function RecordNameWords({ tableId, recordId }) {
|
|
|
5230
5263
|
}
|
|
5231
5264
|
|
|
5232
5265
|
// src/HeldChangeDecision.tsx
|
|
5233
|
-
var
|
|
5234
|
-
var
|
|
5266
|
+
var import_react39 = require("react");
|
|
5267
|
+
var import_react40 = require("@ai-matrx/records/react");
|
|
5235
5268
|
var import_design_system22 = require("@ai-matrx/design-system");
|
|
5236
5269
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5237
5270
|
function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided }) {
|
|
5238
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react40.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Decision, { approvalId, onDecided }) });
|
|
5239
5272
|
}
|
|
5240
5273
|
function Decision({ approvalId, onDecided }) {
|
|
5241
|
-
const client = (0,
|
|
5242
|
-
const [may, setMay] = (0,
|
|
5243
|
-
const [busy, setBusy] = (0,
|
|
5244
|
-
const [error, setError] = (0,
|
|
5245
|
-
(0,
|
|
5274
|
+
const client = (0, import_react40.useRecordsClient)();
|
|
5275
|
+
const [may, setMay] = (0, import_react39.useState)(null);
|
|
5276
|
+
const [busy, setBusy] = (0, import_react39.useState)(null);
|
|
5277
|
+
const [error, setError] = (0, import_react39.useState)(null);
|
|
5278
|
+
(0, import_react39.useEffect)(() => {
|
|
5246
5279
|
let live = true;
|
|
5247
5280
|
void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
|
|
5248
5281
|
if (!live) return;
|