@ai-matrx/records-ui 0.116.82 → 0.116.84
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 +15 -0
- package/dist/{chunk-5DELD6DC.js → chunk-PDIM4BLZ.js} +983 -903
- package/dist/chunk-PDIM4BLZ.js.map +1 -0
- package/dist/entity-doors.cjs +4 -4
- package/dist/entity-doors.cjs.map +1 -1
- package/dist/entity-doors.d.cts +2 -21
- package/dist/entity-doors.d.ts +2 -21
- package/dist/entity-doors.js +2 -5
- package/dist/entity-doors.js.map +1 -1
- package/dist/entity-ref.cjs +1 -4
- package/dist/entity-ref.cjs.map +1 -1
- package/dist/entity-ref.d.cts +2 -21
- package/dist/entity-ref.d.ts +2 -21
- package/dist/entity-ref.js +1 -4
- package/dist/entity-ref.js.map +1 -1
- package/dist/index.cjs +8662 -8581
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/pickers.cjs +930 -849
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-5DELD6DC.js.map +0 -1
package/dist/pickers.cjs
CHANGED
|
@@ -4770,9 +4770,9 @@ __export(pickers_exports, {
|
|
|
4770
4770
|
module.exports = __toCommonJS(pickers_exports);
|
|
4771
4771
|
|
|
4772
4772
|
// src/TablePickers.tsx
|
|
4773
|
-
var
|
|
4774
|
-
var
|
|
4775
|
-
var
|
|
4773
|
+
var import_react82 = require("react");
|
|
4774
|
+
var import_react83 = require("@ai-matrx/records/react");
|
|
4775
|
+
var import_design_system49 = require("@ai-matrx/design-system");
|
|
4776
4776
|
|
|
4777
4777
|
// src/askOnce.ts
|
|
4778
4778
|
var askOnce_exports = {};
|
|
@@ -5085,10 +5085,10 @@ function AddChoicesInline({ field, onAdded, disabled = false }) {
|
|
|
5085
5085
|
}
|
|
5086
5086
|
|
|
5087
5087
|
// src/editors.tsx
|
|
5088
|
-
var
|
|
5088
|
+
var import_react78 = require("react");
|
|
5089
5089
|
var import_records29 = require("@ai-matrx/records");
|
|
5090
|
-
var
|
|
5091
|
-
var
|
|
5090
|
+
var import_react79 = require("@ai-matrx/records/react");
|
|
5091
|
+
var import_design_system48 = require("@ai-matrx/design-system");
|
|
5092
5092
|
init_dates();
|
|
5093
5093
|
|
|
5094
5094
|
// src/newerKindValues.tsx
|
|
@@ -5813,11 +5813,11 @@ function readableLink(raw) {
|
|
|
5813
5813
|
}
|
|
5814
5814
|
|
|
5815
5815
|
// src/buttonCell.tsx
|
|
5816
|
-
var
|
|
5817
|
-
var
|
|
5816
|
+
var import_react73 = require("react");
|
|
5817
|
+
var import_design_system45 = require("@ai-matrx/design-system");
|
|
5818
5818
|
var import_data_table6 = require("@ai-matrx/design-system/data-table");
|
|
5819
5819
|
var import_records27 = require("@ai-matrx/records");
|
|
5820
|
-
var
|
|
5820
|
+
var import_react74 = require("@ai-matrx/records/react");
|
|
5821
5821
|
init_host();
|
|
5822
5822
|
|
|
5823
5823
|
// src/gridOpen.tsx
|
|
@@ -5866,10 +5866,10 @@ function columnNameProblemLine(name, noun = "column") {
|
|
|
5866
5866
|
}
|
|
5867
5867
|
|
|
5868
5868
|
// src/FieldEditor.tsx
|
|
5869
|
-
var
|
|
5870
|
-
var
|
|
5869
|
+
var import_react71 = require("react");
|
|
5870
|
+
var import_react72 = require("@ai-matrx/records/react");
|
|
5871
5871
|
var import_core9 = require("@ai-matrx/records/core");
|
|
5872
|
-
var
|
|
5872
|
+
var import_design_system44 = require("@ai-matrx/design-system");
|
|
5873
5873
|
|
|
5874
5874
|
// src/WatchFieldsPicker.tsx
|
|
5875
5875
|
var import_design_system10 = require("@ai-matrx/design-system");
|
|
@@ -11076,10 +11076,78 @@ function choiceLookForNewList(multi, rows) {
|
|
|
11076
11076
|
return choices.length === 0 ? null : { id: multi ? "multi_choice" : "choice", options: { choices } };
|
|
11077
11077
|
}
|
|
11078
11078
|
|
|
11079
|
-
// src/
|
|
11080
|
-
var
|
|
11079
|
+
// src/PickListLink.tsx
|
|
11080
|
+
var import_react63 = require("react");
|
|
11081
|
+
var import_react64 = require("@ai-matrx/records/react");
|
|
11081
11082
|
var import_design_system36 = require("@ai-matrx/design-system");
|
|
11083
|
+
init_plainWords();
|
|
11082
11084
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
11085
|
+
var OWN_LIST = "__own__";
|
|
11086
|
+
function PickListLink({
|
|
11087
|
+
field,
|
|
11088
|
+
value,
|
|
11089
|
+
onChange
|
|
11090
|
+
}) {
|
|
11091
|
+
const client = (0, import_react64.useRecordsClient)();
|
|
11092
|
+
const [lists, setLists] = (0, import_react63.useState)(null);
|
|
11093
|
+
const [refused, setRefused] = (0, import_react63.useState)(null);
|
|
11094
|
+
const [asked3, setAsked] = (0, import_react63.useState)(false);
|
|
11095
|
+
const current = field.options_table_id ?? field.config?.["options_table_id"] ?? null;
|
|
11096
|
+
const read = () => {
|
|
11097
|
+
if (asked3) return;
|
|
11098
|
+
setAsked(true);
|
|
11099
|
+
void client.pickListIndex({ organization_id: field.organization_id ?? client.config.organizationId }).then(
|
|
11100
|
+
(got) => {
|
|
11101
|
+
if (!got.ok) {
|
|
11102
|
+
setRefused(refusalSentence(got.error));
|
|
11103
|
+
setAsked(false);
|
|
11104
|
+
return;
|
|
11105
|
+
}
|
|
11106
|
+
setLists(
|
|
11107
|
+
(got.data?.lists ?? []).map((l) => ({
|
|
11108
|
+
id: l.id,
|
|
11109
|
+
name: (l.list_name ?? "").trim() || "Untitled list",
|
|
11110
|
+
count: typeof l.item_count === "number" ? l.item_count : null
|
|
11111
|
+
}))
|
|
11112
|
+
);
|
|
11113
|
+
},
|
|
11114
|
+
(error) => {
|
|
11115
|
+
setRefused(refusalSentence({ message: error instanceof Error ? error.message : "The pick lists could not be read." }));
|
|
11116
|
+
setAsked(false);
|
|
11117
|
+
}
|
|
11118
|
+
);
|
|
11119
|
+
};
|
|
11120
|
+
const linked = lists?.some((l) => l.id === current) ?? null;
|
|
11121
|
+
const shown2 = value ?? (linked === false ? OWN_LIST : current ?? void 0);
|
|
11122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-1", "data-records-pick-list-link": "", children: [
|
|
11123
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system36.Label, { className: "text-xs", children: "Choices come from" }),
|
|
11124
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
11125
|
+
import_design_system36.Select,
|
|
11126
|
+
{
|
|
11127
|
+
...shown2 !== void 0 ? { value: shown2 } : {},
|
|
11128
|
+
onValueChange: (next) => onChange(next === current || next === OWN_LIST && linked === false ? null : next),
|
|
11129
|
+
onOpenChange: (open) => {
|
|
11130
|
+
if (open) read();
|
|
11131
|
+
},
|
|
11132
|
+
children: [
|
|
11133
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system36.SelectTrigger, { size: "sm", "aria-label": "Pick list for this column", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system36.SelectValue, { placeholder: "This column only" }) }),
|
|
11134
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_design_system36.SelectContent, { children: [
|
|
11135
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system36.SelectItem, { value: OWN_LIST, children: "This column only" }),
|
|
11136
|
+
current && lists === null ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system36.SelectItem, { value: current, children: "Its current choices" }) : null,
|
|
11137
|
+
(lists ?? []).map((l) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_design_system36.SelectItem, { value: l.id, children: l.count === null ? l.name : `${l.name} (${l.count})` }, l.id)),
|
|
11138
|
+
lists !== null && lists.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: "No pick lists yet." }) : null
|
|
11139
|
+
] })
|
|
11140
|
+
]
|
|
11141
|
+
}
|
|
11142
|
+
),
|
|
11143
|
+
refused ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-[11px] text-muted-foreground", role: "alert", children: refused }) : null
|
|
11144
|
+
] });
|
|
11145
|
+
}
|
|
11146
|
+
|
|
11147
|
+
// src/NewerKindQuestions.tsx
|
|
11148
|
+
var import_records21 = require("@ai-matrx/records");
|
|
11149
|
+
var import_design_system37 = require("@ai-matrx/design-system");
|
|
11150
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
11083
11151
|
var STATUS_STARTING_CHOICES = [
|
|
11084
11152
|
{ words: "Not started", group: "todo" },
|
|
11085
11153
|
{ words: "In progress", group: "in_progress" },
|
|
@@ -11108,13 +11176,13 @@ function StatusGroupsQuestion({
|
|
|
11108
11176
|
onGroup
|
|
11109
11177
|
}) {
|
|
11110
11178
|
if (rows.length === 0) return null;
|
|
11111
|
-
return /* @__PURE__ */ (0,
|
|
11112
|
-
/* @__PURE__ */ (0,
|
|
11113
|
-
rows.map((r) => /* @__PURE__ */ (0,
|
|
11114
|
-
/* @__PURE__ */ (0,
|
|
11115
|
-
/* @__PURE__ */ (0,
|
|
11116
|
-
/* @__PURE__ */ (0,
|
|
11117
|
-
/* @__PURE__ */ (0,
|
|
11179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-col gap-1", "data-records-status-groups": "", children: [
|
|
11180
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.Label, { className: "text-xs", children: "Groups" }),
|
|
11181
|
+
rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
11182
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
|
|
11183
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.Select, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
|
|
11184
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectTrigger, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectValue, {}) }),
|
|
11185
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectContent, { children: import_records21.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.SelectItem, { value: g, children: [
|
|
11118
11186
|
STATUS_GROUP_MARK[g],
|
|
11119
11187
|
" ",
|
|
11120
11188
|
import_records21.STATUS_GROUP_WORDS[g]
|
|
@@ -11124,11 +11192,11 @@ function StatusGroupsQuestion({
|
|
|
11124
11192
|
] });
|
|
11125
11193
|
}
|
|
11126
11194
|
function RatingMaxQuestion({ value, onChange }) {
|
|
11127
|
-
return /* @__PURE__ */ (0,
|
|
11128
|
-
/* @__PURE__ */ (0,
|
|
11129
|
-
/* @__PURE__ */ (0,
|
|
11130
|
-
/* @__PURE__ */ (0,
|
|
11131
|
-
/* @__PURE__ */ (0,
|
|
11195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
11196
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.Label, { className: "text-xs", children: "Out of" }),
|
|
11197
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.Select, { value: String(value), onValueChange: (next) => onChange(Number(next)), children: [
|
|
11198
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectTrigger, { size: "sm", "aria-label": "Out of", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectValue, {}) }),
|
|
11199
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectContent, { children: Array.from({ length: 10 }, (_, i) => i + 1).map((n) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.SelectItem, { value: String(n), children: [
|
|
11132
11200
|
n,
|
|
11133
11201
|
" ",
|
|
11134
11202
|
n === 1 ? "star" : "stars"
|
|
@@ -11149,25 +11217,25 @@ var SYMBOLOGY_WORDS = {
|
|
|
11149
11217
|
pdf417: "PDF417"
|
|
11150
11218
|
};
|
|
11151
11219
|
function BarcodeSymbologyQuestion({ value, onChange }) {
|
|
11152
|
-
return /* @__PURE__ */ (0,
|
|
11153
|
-
/* @__PURE__ */ (0,
|
|
11154
|
-
/* @__PURE__ */ (0,
|
|
11155
|
-
/* @__PURE__ */ (0,
|
|
11156
|
-
/* @__PURE__ */ (0,
|
|
11157
|
-
/* @__PURE__ */ (0,
|
|
11158
|
-
import_records21.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0,
|
|
11220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
11221
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.Label, { className: "text-xs", children: "Code type" }),
|
|
11222
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.Select, { value: value === "" ? "any" : value, onValueChange: (next) => onChange(next === "any" ? "" : next), children: [
|
|
11223
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectTrigger, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectValue, {}) }),
|
|
11224
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.SelectContent, { children: [
|
|
11225
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectItem, { value: "any", children: "Any code" }),
|
|
11226
|
+
import_records21.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
|
|
11159
11227
|
] })
|
|
11160
11228
|
] })
|
|
11161
11229
|
] });
|
|
11162
11230
|
}
|
|
11163
11231
|
|
|
11164
11232
|
// src/FieldFormatPicker.tsx
|
|
11165
|
-
var
|
|
11233
|
+
var import_design_system38 = require("@ai-matrx/design-system");
|
|
11166
11234
|
var import_field_formats11 = require("@ai-matrx/design-system/field-formats");
|
|
11167
11235
|
init_PickOne();
|
|
11168
11236
|
init_choiceLooks();
|
|
11169
11237
|
init_parity();
|
|
11170
|
-
var
|
|
11238
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
11171
11239
|
var KIND_WORD = {
|
|
11172
11240
|
choice: "select",
|
|
11173
11241
|
multi_choice: "multi_select",
|
|
@@ -11290,13 +11358,13 @@ function FieldFormatPicker({
|
|
|
11290
11358
|
else merged[key] = next;
|
|
11291
11359
|
onValue({ ...value, format: Object.keys(merged).length > 0 ? { id: value.format.id, options: merged } : { id: value.format.id } });
|
|
11292
11360
|
};
|
|
11293
|
-
const option = (key, label, control) => optionKeys.includes(key) ? /* @__PURE__ */ (0,
|
|
11361
|
+
const option = (key, label, control) => optionKeys.includes(key) ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex min-w-[6rem] flex-col gap-0.5 text-[11px] text-muted-foreground", children: [
|
|
11294
11362
|
label,
|
|
11295
11363
|
control
|
|
11296
11364
|
] }, key) : null;
|
|
11297
|
-
return /* @__PURE__ */ (0,
|
|
11298
|
-
/* @__PURE__ */ (0,
|
|
11299
|
-
/* @__PURE__ */ (0,
|
|
11365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col gap-1", "data-records-format-picker": "", children: [
|
|
11366
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system38.Label, { className: "text-xs", htmlFor: `records-shows-as-${field.id}`, children: "Shows as" }),
|
|
11367
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11300
11368
|
PickOne,
|
|
11301
11369
|
{
|
|
11302
11370
|
id: `records-shows-as-${field.id}`,
|
|
@@ -11322,12 +11390,12 @@ function FieldFormatPicker({
|
|
|
11322
11390
|
]
|
|
11323
11391
|
}
|
|
11324
11392
|
),
|
|
11325
|
-
/* @__PURE__ */ (0,
|
|
11326
|
-
optionKeys.length > 0 ? /* @__PURE__ */ (0,
|
|
11393
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-[11px] text-muted-foreground", children: retypedTo ? `This changes what the column holds, to ${storesWord(retypedTo.def)}. Each value that can convert does; you are told before anything that cannot is lost.` : active ? active.description : "How every value in this column is written, wherever it appears." }),
|
|
11394
|
+
optionKeys.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-wrap items-end gap-2", children: [
|
|
11327
11395
|
option(
|
|
11328
11396
|
"currency",
|
|
11329
11397
|
"Currency",
|
|
11330
|
-
/* @__PURE__ */ (0,
|
|
11398
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11331
11399
|
PickOne,
|
|
11332
11400
|
{
|
|
11333
11401
|
label: "Currency",
|
|
@@ -11342,7 +11410,7 @@ function FieldFormatPicker({
|
|
|
11342
11410
|
option(
|
|
11343
11411
|
"percentScale",
|
|
11344
11412
|
"Stored as",
|
|
11345
|
-
/* @__PURE__ */ (0,
|
|
11413
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11346
11414
|
PickOne,
|
|
11347
11415
|
{
|
|
11348
11416
|
label: "Stored as",
|
|
@@ -11360,7 +11428,7 @@ function FieldFormatPicker({
|
|
|
11360
11428
|
option(
|
|
11361
11429
|
"durationUnit",
|
|
11362
11430
|
"Unit",
|
|
11363
|
-
/* @__PURE__ */ (0,
|
|
11431
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11364
11432
|
PickOne,
|
|
11365
11433
|
{
|
|
11366
11434
|
label: "Unit",
|
|
@@ -11380,7 +11448,7 @@ function FieldFormatPicker({
|
|
|
11380
11448
|
option(
|
|
11381
11449
|
"precision",
|
|
11382
11450
|
"Decimals",
|
|
11383
|
-
/* @__PURE__ */ (0,
|
|
11451
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11384
11452
|
"input",
|
|
11385
11453
|
{
|
|
11386
11454
|
"data-records-format-option": "precision",
|
|
@@ -11397,7 +11465,7 @@ function FieldFormatPicker({
|
|
|
11397
11465
|
option(
|
|
11398
11466
|
"ratingMax",
|
|
11399
11467
|
"Out of",
|
|
11400
|
-
/* @__PURE__ */ (0,
|
|
11468
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11401
11469
|
"input",
|
|
11402
11470
|
{
|
|
11403
11471
|
"data-records-format-option": "ratingMax",
|
|
@@ -11413,7 +11481,7 @@ function FieldFormatPicker({
|
|
|
11413
11481
|
option(
|
|
11414
11482
|
"dateStyle",
|
|
11415
11483
|
"Style",
|
|
11416
|
-
/* @__PURE__ */ (0,
|
|
11484
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11417
11485
|
PickOne,
|
|
11418
11486
|
{
|
|
11419
11487
|
label: "Style",
|
|
@@ -11432,15 +11500,15 @@ function FieldFormatPicker({
|
|
|
11432
11500
|
option(
|
|
11433
11501
|
"prefix",
|
|
11434
11502
|
"Prefix",
|
|
11435
|
-
/* @__PURE__ */ (0,
|
|
11503
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { "data-records-format-option": "prefix", className: BOX, value: options.prefix ?? "", onChange: (e) => setOption("prefix", e.target.value) })
|
|
11436
11504
|
),
|
|
11437
11505
|
option(
|
|
11438
11506
|
"suffix",
|
|
11439
11507
|
"Suffix",
|
|
11440
|
-
/* @__PURE__ */ (0,
|
|
11508
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { "data-records-format-option": "suffix", className: BOX, placeholder: "e.g. kg", value: options.suffix ?? "", onChange: (e) => setOption("suffix", e.target.value) })
|
|
11441
11509
|
),
|
|
11442
|
-
optionKeys.includes("useGrouping") ? /* @__PURE__ */ (0,
|
|
11443
|
-
/* @__PURE__ */ (0,
|
|
11510
|
+
optionKeys.includes("useGrouping") ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "flex items-center gap-1.5 pb-1 text-[11px] text-muted-foreground", children: [
|
|
11511
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11444
11512
|
"input",
|
|
11445
11513
|
{
|
|
11446
11514
|
type: "checkbox",
|
|
@@ -11459,10 +11527,10 @@ function FieldFormatPicker({
|
|
|
11459
11527
|
init_names();
|
|
11460
11528
|
|
|
11461
11529
|
// src/AlsoPointsAt.tsx
|
|
11462
|
-
var
|
|
11530
|
+
var import_design_system39 = require("@ai-matrx/design-system");
|
|
11463
11531
|
init_tablePicking();
|
|
11464
11532
|
init_names();
|
|
11465
|
-
var
|
|
11533
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
11466
11534
|
function AlsoPointsAt({ own: own3, value, onChange }) {
|
|
11467
11535
|
const tables = usePickerTables();
|
|
11468
11536
|
const entries = tablePickerEntries(
|
|
@@ -11471,12 +11539,12 @@ function AlsoPointsAt({ own: own3, value, onChange }) {
|
|
|
11471
11539
|
).entries.filter((e) => e.id !== own3);
|
|
11472
11540
|
const unseen = tables.loading ? [] : value.filter((id) => !entries.some((e) => e.id === id));
|
|
11473
11541
|
const toggle = (id, on) => onChange(on ? [...value.filter((v) => v !== id), id] : value.filter((v) => v !== id));
|
|
11474
|
-
return /* @__PURE__ */ (0,
|
|
11475
|
-
/* @__PURE__ */ (0,
|
|
11476
|
-
tables.loading && entries.length === 0 ? /* @__PURE__ */ (0,
|
|
11477
|
-
entries.map((e) => /* @__PURE__ */ (0,
|
|
11478
|
-
/* @__PURE__ */ (0,
|
|
11479
|
-
|
|
11542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-col gap-1", "data-records-link-also-points-at": "", children: [
|
|
11543
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system39.Label, { className: "text-xs", children: "Also points at" }),
|
|
11544
|
+
tables.loading && entries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "text-xs text-muted-foreground", children: "Reading tables\u2026" }) : entries.length === 0 && unseen.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "text-xs text-muted-foreground", children: "No other tables yet." }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex max-h-40 flex-col gap-1 overflow-y-auto", children: [
|
|
11545
|
+
entries.map((e) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", children: [
|
|
11546
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
11547
|
+
import_design_system39.Checkbox,
|
|
11480
11548
|
{
|
|
11481
11549
|
checked: value.includes(e.id),
|
|
11482
11550
|
"aria-label": `Also points at ${e.label}`,
|
|
@@ -11484,11 +11552,11 @@ function AlsoPointsAt({ own: own3, value, onChange }) {
|
|
|
11484
11552
|
onCheckedChange: (v) => toggle(e.id, v === true)
|
|
11485
11553
|
}
|
|
11486
11554
|
),
|
|
11487
|
-
/* @__PURE__ */ (0,
|
|
11555
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "truncate", children: e.label })
|
|
11488
11556
|
] }, e.id)),
|
|
11489
|
-
unseen.map((id) => /* @__PURE__ */ (0,
|
|
11490
|
-
/* @__PURE__ */ (0,
|
|
11491
|
-
/* @__PURE__ */ (0,
|
|
11557
|
+
unseen.map((id) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", children: [
|
|
11558
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system39.Checkbox, { checked: true, "aria-label": "Also points at a table you cannot open", "data-records-also-target": id, onCheckedChange: (v) => toggle(id, v === true) }),
|
|
11559
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "truncate text-muted-foreground", children: "A table you cannot open" })
|
|
11492
11560
|
] }, id))
|
|
11493
11561
|
] })
|
|
11494
11562
|
] });
|
|
@@ -11521,34 +11589,34 @@ init_enumLabels();
|
|
|
11521
11589
|
var import_records25 = require("@ai-matrx/records");
|
|
11522
11590
|
|
|
11523
11591
|
// src/ButtonSettings.tsx
|
|
11524
|
-
var
|
|
11525
|
-
var
|
|
11592
|
+
var import_react67 = require("react");
|
|
11593
|
+
var import_design_system42 = require("@ai-matrx/design-system");
|
|
11526
11594
|
var import_data_table5 = require("@ai-matrx/design-system/data-table");
|
|
11527
11595
|
var import_records23 = require("@ai-matrx/records");
|
|
11528
|
-
var
|
|
11596
|
+
var import_react68 = require("@ai-matrx/records/react");
|
|
11529
11597
|
|
|
11530
11598
|
// src/AccentSwatches.tsx
|
|
11531
11599
|
var import_records22 = require("@ai-matrx/records");
|
|
11532
|
-
var
|
|
11600
|
+
var import_design_system40 = require("@ai-matrx/design-system");
|
|
11533
11601
|
var import_data_table4 = require("@ai-matrx/design-system/data-table");
|
|
11534
|
-
var
|
|
11602
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
11535
11603
|
function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACCENTS, noneLabel = "App color" }) {
|
|
11536
|
-
return /* @__PURE__ */ (0,
|
|
11537
|
-
/* @__PURE__ */ (0,
|
|
11604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Color", children: [
|
|
11605
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11538
11606
|
"button",
|
|
11539
11607
|
{
|
|
11540
11608
|
type: "button",
|
|
11541
11609
|
role: "radio",
|
|
11542
11610
|
"aria-checked": value === "",
|
|
11543
11611
|
onClick: () => onChange(""),
|
|
11544
|
-
className: (0,
|
|
11612
|
+
className: (0, import_design_system40.cn)(
|
|
11545
11613
|
"h-7 rounded border px-2 text-xs",
|
|
11546
11614
|
value === "" ? "border-foreground" : "border-border text-muted-foreground"
|
|
11547
11615
|
),
|
|
11548
11616
|
children: noneLabel
|
|
11549
11617
|
}
|
|
11550
11618
|
),
|
|
11551
|
-
options.map((c) => /* @__PURE__ */ (0,
|
|
11619
|
+
options.map((c) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11552
11620
|
"button",
|
|
11553
11621
|
{
|
|
11554
11622
|
type: "button",
|
|
@@ -11557,7 +11625,7 @@ function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACC
|
|
|
11557
11625
|
"aria-label": import_data_table4.STYLE_COLOR_LABELS[c],
|
|
11558
11626
|
title: import_data_table4.STYLE_COLOR_LABELS[c],
|
|
11559
11627
|
onClick: () => onChange(c),
|
|
11560
|
-
className: (0,
|
|
11628
|
+
className: (0, import_design_system40.cn)("h-7 w-7 rounded-full border-2", import_data_table4.SWATCH_CLASS[c], value === c ? "border-foreground" : "border-transparent")
|
|
11561
11629
|
},
|
|
11562
11630
|
c
|
|
11563
11631
|
))
|
|
@@ -11568,13 +11636,13 @@ function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACC
|
|
|
11568
11636
|
init_PickOne();
|
|
11569
11637
|
|
|
11570
11638
|
// src/AddRowSettings.tsx
|
|
11571
|
-
var
|
|
11572
|
-
var
|
|
11573
|
-
var
|
|
11639
|
+
var import_design_system41 = require("@ai-matrx/design-system");
|
|
11640
|
+
var import_react65 = require("@ai-matrx/records/react");
|
|
11641
|
+
var import_react66 = require("react");
|
|
11574
11642
|
init_tablePicking();
|
|
11575
11643
|
init_tablePickerEntries();
|
|
11576
11644
|
init_PickOne();
|
|
11577
|
-
var
|
|
11645
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
11578
11646
|
var THIS_ROW = "@row";
|
|
11579
11647
|
var NOTHING = "";
|
|
11580
11648
|
function prefillWith(prefill, key, from) {
|
|
@@ -11586,12 +11654,12 @@ function prefillWith(prefill, key, from) {
|
|
|
11586
11654
|
function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
11587
11655
|
const tables = usePickerTables();
|
|
11588
11656
|
const target = value.table_id ?? tableId;
|
|
11589
|
-
const targetFields = (0,
|
|
11657
|
+
const targetFields = (0, import_react65.useFields)(target);
|
|
11590
11658
|
const typed = (targetFields.data ?? []).filter((f) => f.type !== "formula" && typeof f.config?.["system"] !== "string");
|
|
11591
11659
|
const sources = [{ value: NOTHING, label: "Nothing" }, { value: THIS_ROW, label: "This row" }, ...fields.map((f) => ({ value: f.key, label: f.label }))];
|
|
11592
|
-
const client = (0,
|
|
11593
|
-
const [templates, setTemplates] = (0,
|
|
11594
|
-
(0,
|
|
11660
|
+
const client = (0, import_react65.useOptionalRecordsClient)();
|
|
11661
|
+
const [templates, setTemplates] = (0, import_react66.useState)([]);
|
|
11662
|
+
(0, import_react66.useEffect)(() => {
|
|
11595
11663
|
if (!client || !target) return;
|
|
11596
11664
|
let live = true;
|
|
11597
11665
|
void client.rowTemplates({ table_id: target }).then((got) => live && setTemplates(got.ok ? got.data : []));
|
|
@@ -11599,10 +11667,10 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
11599
11667
|
live = false;
|
|
11600
11668
|
};
|
|
11601
11669
|
}, [client, target]);
|
|
11602
|
-
return /* @__PURE__ */ (0,
|
|
11603
|
-
/* @__PURE__ */ (0,
|
|
11604
|
-
/* @__PURE__ */ (0,
|
|
11605
|
-
/* @__PURE__ */ (0,
|
|
11670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-2", "data-records-button-add-row": "", children: [
|
|
11671
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11672
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system41.Label, { className: "text-xs", children: "Adds to" }),
|
|
11673
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11606
11674
|
PickOne,
|
|
11607
11675
|
{
|
|
11608
11676
|
label: "Table the new row goes in",
|
|
@@ -11613,9 +11681,9 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
11613
11681
|
}
|
|
11614
11682
|
)
|
|
11615
11683
|
] }),
|
|
11616
|
-
templates.length || value.template_id ? /* @__PURE__ */ (0,
|
|
11617
|
-
/* @__PURE__ */ (0,
|
|
11618
|
-
/* @__PURE__ */ (0,
|
|
11684
|
+
templates.length || value.template_id ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11685
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_design_system41.Label, { className: "text-xs", children: "Starts from" }),
|
|
11686
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11619
11687
|
PickOne,
|
|
11620
11688
|
{
|
|
11621
11689
|
label: "Row template the new row starts from",
|
|
@@ -11626,9 +11694,9 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
11626
11694
|
}
|
|
11627
11695
|
)
|
|
11628
11696
|
] }) : null,
|
|
11629
|
-
typed.length ? /* @__PURE__ */ (0,
|
|
11630
|
-
/* @__PURE__ */ (0,
|
|
11631
|
-
/* @__PURE__ */ (0,
|
|
11697
|
+
typed.length ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "grid grid-cols-[auto_1fr] items-center gap-x-2 gap-y-1", children: typed.map((f) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "contents", children: [
|
|
11698
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-sm", children: f.label }),
|
|
11699
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11632
11700
|
PickOne,
|
|
11633
11701
|
{
|
|
11634
11702
|
label: `${f.label} starts with`,
|
|
@@ -11646,7 +11714,7 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
11646
11714
|
init_names();
|
|
11647
11715
|
init_Refusal();
|
|
11648
11716
|
init_parity();
|
|
11649
|
-
var
|
|
11717
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
11650
11718
|
var DOES_WORDS = {
|
|
11651
11719
|
none: "Nothing yet",
|
|
11652
11720
|
open_url: "Open a link",
|
|
@@ -11668,11 +11736,11 @@ function ButtonSettingsEditor({
|
|
|
11668
11736
|
tableId,
|
|
11669
11737
|
fields
|
|
11670
11738
|
}) {
|
|
11671
|
-
const client = (0,
|
|
11672
|
-
const [actions, setActions] = (0,
|
|
11673
|
-
const [actionsRefused, setActionsRefused] = (0,
|
|
11674
|
-
const [automations, setAutomations] = (0,
|
|
11675
|
-
(0,
|
|
11739
|
+
const client = (0, import_react68.useOptionalRecordsClient)();
|
|
11740
|
+
const [actions, setActions] = (0, import_react67.useState)(null);
|
|
11741
|
+
const [actionsRefused, setActionsRefused] = (0, import_react67.useState)(null);
|
|
11742
|
+
const [automations, setAutomations] = (0, import_react67.useState)(null);
|
|
11743
|
+
(0, import_react67.useEffect)(() => {
|
|
11676
11744
|
if (!client || !tableId) return;
|
|
11677
11745
|
let live = true;
|
|
11678
11746
|
if (value.do === "run_action" && actions === null) {
|
|
@@ -11693,15 +11761,15 @@ function ButtonSettingsEditor({
|
|
|
11693
11761
|
}, [client, tableId, value.do, actions, automations]);
|
|
11694
11762
|
const set = (patch) => onChange({ ...value, ...patch });
|
|
11695
11763
|
const columns = fields.filter((f) => !(f.type === "text" && f.format === "button"));
|
|
11696
|
-
return /* @__PURE__ */ (0,
|
|
11697
|
-
/* @__PURE__ */ (0,
|
|
11698
|
-
/* @__PURE__ */ (0,
|
|
11699
|
-
/* @__PURE__ */ (0,
|
|
11700
|
-
/* @__PURE__ */ (0,
|
|
11764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-2 rounded-md border p-2", "data-records-button-settings": "", children: [
|
|
11765
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "grid gap-2 sm:grid-cols-2", children: [
|
|
11766
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
11767
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "Button label" }),
|
|
11768
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.BasicInput, { className: "h-8 text-xs", value: value.label, "data-records-button-label": "", onChange: (e) => set({ label: e.target.value }) })
|
|
11701
11769
|
] }),
|
|
11702
|
-
/* @__PURE__ */ (0,
|
|
11703
|
-
/* @__PURE__ */ (0,
|
|
11704
|
-
/* @__PURE__ */ (0,
|
|
11770
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11771
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "Does" }),
|
|
11772
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11705
11773
|
PickOne,
|
|
11706
11774
|
{
|
|
11707
11775
|
label: "What a press does",
|
|
@@ -11713,9 +11781,9 @@ function ButtonSettingsEditor({
|
|
|
11713
11781
|
)
|
|
11714
11782
|
] })
|
|
11715
11783
|
] }),
|
|
11716
|
-
/* @__PURE__ */ (0,
|
|
11717
|
-
/* @__PURE__ */ (0,
|
|
11718
|
-
/* @__PURE__ */ (0,
|
|
11784
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11785
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "Color" }),
|
|
11786
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11719
11787
|
AccentSwatches,
|
|
11720
11788
|
{
|
|
11721
11789
|
value: value.color ?? "",
|
|
@@ -11725,11 +11793,11 @@ function ButtonSettingsEditor({
|
|
|
11725
11793
|
}
|
|
11726
11794
|
)
|
|
11727
11795
|
] }),
|
|
11728
|
-
value.do === "open_url" ? /* @__PURE__ */ (0,
|
|
11729
|
-
/* @__PURE__ */ (0,
|
|
11730
|
-
/* @__PURE__ */ (0,
|
|
11731
|
-
/* @__PURE__ */ (0,
|
|
11732
|
-
|
|
11796
|
+
value.do === "open_url" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11797
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "Link" }),
|
|
11798
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex gap-1", children: [
|
|
11799
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11800
|
+
import_design_system42.BasicInput,
|
|
11733
11801
|
{
|
|
11734
11802
|
className: "h-8 flex-1 font-mono text-xs",
|
|
11735
11803
|
placeholder: "https://",
|
|
@@ -11738,7 +11806,7 @@ function ButtonSettingsEditor({
|
|
|
11738
11806
|
onChange: (e) => set({ url: e.target.value })
|
|
11739
11807
|
}
|
|
11740
11808
|
),
|
|
11741
|
-
columns.length > 0 ? /* @__PURE__ */ (0,
|
|
11809
|
+
columns.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11742
11810
|
PickOne,
|
|
11743
11811
|
{
|
|
11744
11812
|
label: "Add a column's value",
|
|
@@ -11751,11 +11819,11 @@ function ButtonSettingsEditor({
|
|
|
11751
11819
|
}
|
|
11752
11820
|
) : null
|
|
11753
11821
|
] }),
|
|
11754
|
-
value.url && (0, import_records23.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0,
|
|
11822
|
+
value.url && (0, import_records23.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
|
|
11755
11823
|
] }) : null,
|
|
11756
|
-
value.do === "add_row" ? /* @__PURE__ */ (0,
|
|
11757
|
-
value.do === "run_action" ? !tableId ? /* @__PURE__ */ (0,
|
|
11758
|
-
actions === null || actions.length > 0 ? /* @__PURE__ */ (0,
|
|
11824
|
+
value.do === "add_row" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AddRowSettings, { value, onChange, tableId, fields }) : null,
|
|
11825
|
+
value.do === "run_action" ? !tableId ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
|
|
11826
|
+
actions === null || actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11759
11827
|
PickOne,
|
|
11760
11828
|
{
|
|
11761
11829
|
label: "Row action",
|
|
@@ -11766,7 +11834,7 @@ function ButtonSettingsEditor({
|
|
|
11766
11834
|
options: (actions ?? []).map((a) => ({ value: a.id, label: a.name }))
|
|
11767
11835
|
}
|
|
11768
11836
|
) : null,
|
|
11769
|
-
actions !== null ? /* @__PURE__ */ (0,
|
|
11837
|
+
actions !== null ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11770
11838
|
NewRowAction,
|
|
11771
11839
|
{
|
|
11772
11840
|
tableId,
|
|
@@ -11780,7 +11848,7 @@ function ButtonSettingsEditor({
|
|
|
11780
11848
|
}
|
|
11781
11849
|
) : null
|
|
11782
11850
|
] }) : null,
|
|
11783
|
-
value.do === "run_automation" ? automations && automations.length === 0 ? /* @__PURE__ */ (0,
|
|
11851
|
+
value.do === "run_automation" ? automations && automations.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-xs text-muted-foreground", children: "No automations yet. Add one in Table \u22EF \u2192 Automations." }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11784
11852
|
PickOne,
|
|
11785
11853
|
{
|
|
11786
11854
|
label: "Automation",
|
|
@@ -11805,13 +11873,13 @@ function NewRowAction({
|
|
|
11805
11873
|
columns,
|
|
11806
11874
|
onMade
|
|
11807
11875
|
}) {
|
|
11808
|
-
const client = (0,
|
|
11876
|
+
const client = (0, import_react68.useOptionalRecordsClient)();
|
|
11809
11877
|
const settable = settableColumns(columns);
|
|
11810
|
-
const [fieldId, setFieldId] = (0,
|
|
11811
|
-
const [setTo, setSetTo] = (0,
|
|
11812
|
-
const [busy, setBusy] = (0,
|
|
11813
|
-
const [refused, setRefused] = (0,
|
|
11814
|
-
if (settable.length === 0) return /* @__PURE__ */ (0,
|
|
11878
|
+
const [fieldId, setFieldId] = (0, import_react67.useState)("");
|
|
11879
|
+
const [setTo, setSetTo] = (0, import_react67.useState)("");
|
|
11880
|
+
const [busy, setBusy] = (0, import_react67.useState)(false);
|
|
11881
|
+
const [refused, setRefused] = (0, import_react67.useState)(null);
|
|
11882
|
+
if (settable.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-xs text-muted-foreground", children: "No column to set" });
|
|
11815
11883
|
const make = async () => {
|
|
11816
11884
|
if (!client || fieldId === "") return;
|
|
11817
11885
|
setBusy(true);
|
|
@@ -11835,10 +11903,10 @@ function NewRowAction({
|
|
|
11835
11903
|
if (!made?.id) return setRefused({ code: "internal", message: "The row action was saved but could not be read back.", hint: "Reopen this column's settings and pick it from the list." });
|
|
11836
11904
|
onMade(made.id, all);
|
|
11837
11905
|
};
|
|
11838
|
-
return /* @__PURE__ */ (0,
|
|
11839
|
-
/* @__PURE__ */ (0,
|
|
11840
|
-
/* @__PURE__ */ (0,
|
|
11841
|
-
/* @__PURE__ */ (0,
|
|
11906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-1", "data-records-button-new-action": "", children: [
|
|
11907
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Label, { className: "text-xs", children: "New row action" }),
|
|
11908
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
11909
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11842
11910
|
PickOne,
|
|
11843
11911
|
{
|
|
11844
11912
|
label: "Column to set",
|
|
@@ -11850,10 +11918,10 @@ function NewRowAction({
|
|
|
11850
11918
|
options: settable.map((f) => ({ value: f.id, label: fieldName(f) }))
|
|
11851
11919
|
}
|
|
11852
11920
|
),
|
|
11853
|
-
/* @__PURE__ */ (0,
|
|
11854
|
-
/* @__PURE__ */ (0,
|
|
11921
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.BasicInput, { className: "h-8 w-32 text-xs", placeholder: "Value", "aria-label": "Value", "data-records-button-action-value": "", value: setTo, onChange: (e) => setSetTo(e.target.value) }),
|
|
11922
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_design_system42.Button, { type: "button", size: "sm", variant: "outline", disabled: busy || fieldId === "", "data-records-button-action-make": "", onClick: () => void make(), children: busy ? "Making\u2026" : "Make" })
|
|
11855
11923
|
] }),
|
|
11856
|
-
refused ? /* @__PURE__ */ (0,
|
|
11924
|
+
refused ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RefusalLine, { error: refused }) : null
|
|
11857
11925
|
] });
|
|
11858
11926
|
}
|
|
11859
11927
|
|
|
@@ -11861,10 +11929,10 @@ function NewRowAction({
|
|
|
11861
11929
|
var import_records26 = require("@ai-matrx/records");
|
|
11862
11930
|
|
|
11863
11931
|
// src/RecordTypes.tsx
|
|
11864
|
-
var
|
|
11932
|
+
var import_react69 = require("react");
|
|
11865
11933
|
var import_records24 = require("@ai-matrx/records");
|
|
11866
|
-
var
|
|
11867
|
-
var
|
|
11934
|
+
var import_react70 = require("@ai-matrx/records/react");
|
|
11935
|
+
var import_design_system43 = require("@ai-matrx/design-system");
|
|
11868
11936
|
|
|
11869
11937
|
// src/standardFieldChoices.ts
|
|
11870
11938
|
var import_field_kinds7 = require("@ai-matrx/records/field-kinds");
|
|
@@ -11884,13 +11952,13 @@ var ADDABLE_TYPES = STANDARD_TABLE_FIELD_CHOICES.map((choice) => ({
|
|
|
11884
11952
|
}));
|
|
11885
11953
|
|
|
11886
11954
|
// src/RecordTypes.tsx
|
|
11887
|
-
var
|
|
11888
|
-
var TypeFieldContext = (0,
|
|
11955
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
11956
|
+
var TypeFieldContext = (0, import_react69.createContext)(null);
|
|
11889
11957
|
function useTypeChoices(typeField) {
|
|
11890
|
-
const client = (0,
|
|
11891
|
-
const [choices, setChoices] = (0,
|
|
11958
|
+
const client = (0, import_react70.useRecordsClient)();
|
|
11959
|
+
const [choices, setChoices] = (0, import_react69.useState)([]);
|
|
11892
11960
|
const id = typeField?.id ?? null;
|
|
11893
|
-
(0,
|
|
11961
|
+
(0, import_react69.useEffect)(() => {
|
|
11894
11962
|
if (!id) {
|
|
11895
11963
|
setChoices([]);
|
|
11896
11964
|
return void 0;
|
|
@@ -11913,11 +11981,11 @@ function AppliesToTypes({
|
|
|
11913
11981
|
const choices = useTypeChoices(typeField);
|
|
11914
11982
|
if (!typeField || choices.length === 0) return null;
|
|
11915
11983
|
const has = (key, label) => value.some((v) => (0, import_records24.fieldAppliesToType)({ applies_to_types: [v] }, key) || (0, import_records24.fieldAppliesToType)({ applies_to_types: [v] }, label));
|
|
11916
|
-
return /* @__PURE__ */ (0,
|
|
11917
|
-
/* @__PURE__ */ (0,
|
|
11918
|
-
/* @__PURE__ */ (0,
|
|
11919
|
-
/* @__PURE__ */ (0,
|
|
11920
|
-
|
|
11984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-1", "data-records-field-applies-to": "", children: [
|
|
11985
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-muted-foreground", children: "Applies to" }),
|
|
11986
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1", children: choices.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
11987
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11988
|
+
import_design_system43.Checkbox,
|
|
11921
11989
|
{
|
|
11922
11990
|
checked: has(choice.key, choice.label),
|
|
11923
11991
|
"aria-label": `Applies to ${choice.label}`,
|
|
@@ -11934,7 +12002,7 @@ function AppliesToTypes({
|
|
|
11934
12002
|
}
|
|
11935
12003
|
|
|
11936
12004
|
// src/FieldEditor.tsx
|
|
11937
|
-
var
|
|
12005
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
11938
12006
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
|
|
11939
12007
|
var SENSITIVITIES = import_records26.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
11940
12008
|
var AGENT_VISIBILITY = import_records26.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
|
|
@@ -12019,16 +12087,16 @@ function FieldEditor(props) {
|
|
|
12019
12087
|
const entityToken = props.entityToken ?? null;
|
|
12020
12088
|
const onEntity = entityToken !== null;
|
|
12021
12089
|
const tableId = props.tableId ?? "";
|
|
12022
|
-
const table = (0,
|
|
12023
|
-
const tableFields = (0,
|
|
12024
|
-
const entityFields = (0,
|
|
12090
|
+
const table = (0, import_react72.useTable)(onEntity ? null : tableId);
|
|
12091
|
+
const tableFields = (0, import_react72.useFields)(onEntity ? null : tableId, import_records26.EVERY_RECORD_TYPE);
|
|
12092
|
+
const entityFields = (0, import_react72.useEntityFields)(entityToken);
|
|
12025
12093
|
const fields = onEntity ? entityFields : tableFields;
|
|
12026
12094
|
const tableRights2 = useTableRights(onEntity ? null : table.data);
|
|
12027
|
-
const entityRights = (0,
|
|
12028
|
-
const tableMutation = (0,
|
|
12029
|
-
const entityMutation = (0,
|
|
12095
|
+
const entityRights = (0, import_react72.useEntityFieldRights)(entityToken);
|
|
12096
|
+
const tableMutation = (0, import_react72.useFieldMutation)();
|
|
12097
|
+
const entityMutation = (0, import_react72.useEntityFieldMutation)();
|
|
12030
12098
|
const mutation = onEntity ? { saving: entityMutation.saving, error: entityMutation.error } : { saving: tableMutation.saving, error: tableMutation.error };
|
|
12031
|
-
const client = (0,
|
|
12099
|
+
const client = (0, import_react72.useRecordsClient)();
|
|
12032
12100
|
const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights2.structure;
|
|
12033
12101
|
const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights2.why("structure");
|
|
12034
12102
|
const storeLabel = onEntity ? entityRights.data?.label ?? null : table.data?.name ?? null;
|
|
@@ -12038,54 +12106,54 @@ function FieldEditor(props) {
|
|
|
12038
12106
|
const copyOf = field ? void 0 : props.copyOf;
|
|
12039
12107
|
const start = field ?? copyOf;
|
|
12040
12108
|
const startAs = start ? void 0 : props.startAs;
|
|
12041
|
-
const [label, setLabel] = (0,
|
|
12042
|
-
const [type, setType] = (0,
|
|
12043
|
-
const [required, setRequired] = (0,
|
|
12044
|
-
const [appliesTo, setAppliesTo] = (0,
|
|
12045
|
-
const [multi, setMulti] = (0,
|
|
12046
|
-
const [dated, setDated] = (0,
|
|
12047
|
-
const [sensitivity, setSensitivity] = (0,
|
|
12048
|
-
const [contextPolicy, setContextPolicy] = (0,
|
|
12049
|
-
const [rules, setRules] = (0,
|
|
12050
|
-
const [startsWith, setStartsWith] = (0,
|
|
12051
|
-
const [ratingMax, setRatingMax] = (0,
|
|
12052
|
-
const savedRules = (0,
|
|
12109
|
+
const [label, setLabel] = (0, import_react71.useState)(field?.label ?? (copyOf ? `${copyOf.label} (1)` : startAs?.label ?? ""));
|
|
12110
|
+
const [type, setType] = (0, import_react71.useState)(() => startAs ? startAs.type : startingType(start));
|
|
12111
|
+
const [required, setRequired] = (0, import_react71.useState)(start?.required ?? false);
|
|
12112
|
+
const [appliesTo, setAppliesTo] = (0, import_react71.useState)(() => (0, import_records26.typesOfField)(start ?? { applies_to_types: [] }));
|
|
12113
|
+
const [multi, setMulti] = (0, import_react71.useState)(start?.multi ?? false);
|
|
12114
|
+
const [dated, setDated] = (0, import_react71.useState)(start?.dated ?? false);
|
|
12115
|
+
const [sensitivity, setSensitivity] = (0, import_react71.useState)(String(start?.sensitivity ?? "internal"));
|
|
12116
|
+
const [contextPolicy, setContextPolicy] = (0, import_react71.useState)(String(start?.context_policy ?? "include"));
|
|
12117
|
+
const [rules, setRules] = (0, import_react71.useState)(start?.rules ?? []);
|
|
12118
|
+
const [startsWith, setStartsWith] = (0, import_react71.useState)(start?.default ?? null);
|
|
12119
|
+
const [ratingMax, setRatingMax] = (0, import_react71.useState)(() => start ? (0, import_records26.ratingMaxOf)(start) : 5);
|
|
12120
|
+
const savedRules = (0, import_react71.useMemo)(
|
|
12053
12121
|
() => field ? type === "rating" ? (0, import_records26.rulesWithTopStar)(field.rules ?? [], (0, import_records26.ratingMaxOf)(field)) : field.rules ?? [] : [],
|
|
12054
12122
|
[field, type]
|
|
12055
12123
|
);
|
|
12056
|
-
const editedRules = (0,
|
|
12057
|
-
const [statusGroups, setStatusGroups] = (0,
|
|
12058
|
-
const [statusKeys, setStatusKeys] = (0,
|
|
12059
|
-
const [symbology, setSymbology] = (0,
|
|
12124
|
+
const editedRules = (0, import_react71.useMemo)(() => type === "rating" ? (0, import_records26.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
|
|
12125
|
+
const [statusGroups, setStatusGroups] = (0, import_react71.useState)({});
|
|
12126
|
+
const [statusKeys, setStatusKeys] = (0, import_react71.useState)({});
|
|
12127
|
+
const [symbology, setSymbology] = (0, import_react71.useState)(String(start?.config?.["symbology"] ?? ""));
|
|
12060
12128
|
const descriptionStart = String(start?.config?.["description"] ?? "");
|
|
12061
|
-
const [description, setDescription] = (0,
|
|
12062
|
-
const buttonStart = (0,
|
|
12063
|
-
const [buttonSettings, setButtonSettings] = (0,
|
|
12129
|
+
const [description, setDescription] = (0, import_react71.useState)(descriptionStart);
|
|
12130
|
+
const buttonStart = (0, import_react71.useMemo)(() => (0, import_records25.buttonOf)(start) ?? { label: "" }, [start]);
|
|
12131
|
+
const [buttonSettings, setButtonSettings] = (0, import_react71.useState)(buttonStart);
|
|
12064
12132
|
const prefixStart = (0, import_records25.autonumberPrefixOf)(start);
|
|
12065
|
-
const [numberPrefix, setNumberPrefix] = (0,
|
|
12133
|
+
const [numberPrefix, setNumberPrefix] = (0, import_react71.useState)(prefixStart);
|
|
12066
12134
|
const dependencyStart = start?.config?.["dependency"] === true;
|
|
12067
|
-
const watchStart = (0,
|
|
12068
|
-
const [watchFields, setWatchFields] = (0,
|
|
12069
|
-
const [dependency, setDependency] = (0,
|
|
12135
|
+
const watchStart = (0, import_react71.useMemo)(() => watchedFieldsOf(start), [start]);
|
|
12136
|
+
const [watchFields, setWatchFields] = (0, import_react71.useState)(watchStart);
|
|
12137
|
+
const [dependency, setDependency] = (0, import_react71.useState)(dependencyStart);
|
|
12070
12138
|
const limitViewStart = typeof start?.config?.["limit_to_view"] === "string" ? String(start.config["limit_to_view"]) : "";
|
|
12071
|
-
const [limitView, setLimitView] = (0,
|
|
12139
|
+
const [limitView, setLimitView] = (0, import_react71.useState)(limitViewStart);
|
|
12072
12140
|
const bindingStart = start?.config?.["binding"] === "snapshot" ? "snapshot" : "live";
|
|
12073
|
-
const [binding, setBinding] = (0,
|
|
12141
|
+
const [binding, setBinding] = (0, import_react71.useState)(bindingStart);
|
|
12074
12142
|
const carriesStart = start?.config?.["carries"] === true;
|
|
12075
|
-
const [carries, setCarries] = (0,
|
|
12143
|
+
const [carries, setCarries] = (0, import_react71.useState)(carriesStart);
|
|
12076
12144
|
const carriesMaxStart = start?.config?.["carries_max"] === "editor" ? "editor" : "viewer";
|
|
12077
|
-
const [carriesMax, setCarriesMax] = (0,
|
|
12145
|
+
const [carriesMax, setCarriesMax] = (0, import_react71.useState)(carriesMaxStart);
|
|
12078
12146
|
const loopsStart = start?.config?.["loops"] === true;
|
|
12079
|
-
const [loops, setLoops] = (0,
|
|
12080
|
-
const [targetViews, setTargetViews] = (0,
|
|
12081
|
-
const alsoStart = (0,
|
|
12147
|
+
const [loops, setLoops] = (0, import_react71.useState)(loopsStart);
|
|
12148
|
+
const [targetViews, setTargetViews] = (0, import_react71.useState)(null);
|
|
12149
|
+
const alsoStart = (0, import_react71.useMemo)(() => {
|
|
12082
12150
|
const listed = start?.config?.["target_tables"];
|
|
12083
12151
|
const own3 = String(start?.relation_target ?? "");
|
|
12084
12152
|
return start?.config?.["target_mode"] === "several" && Array.isArray(listed) ? listed.map(String).filter((t) => t !== own3) : [];
|
|
12085
12153
|
}, [start]);
|
|
12086
|
-
const [alsoTargets, setAlsoTargets] = (0,
|
|
12154
|
+
const [alsoTargets, setAlsoTargets] = (0, import_react71.useState)(alsoStart);
|
|
12087
12155
|
const limitTarget = field?.type === "relation" && field.relation_target && !onEntity ? String(field.relation_target) : null;
|
|
12088
|
-
(0,
|
|
12156
|
+
(0, import_react71.useEffect)(() => {
|
|
12089
12157
|
if (!limitTarget) return;
|
|
12090
12158
|
let live = true;
|
|
12091
12159
|
void client.views({ table_id: limitTarget }).then((read) => {
|
|
@@ -12095,11 +12163,11 @@ function FieldEditor(props) {
|
|
|
12095
12163
|
live = false;
|
|
12096
12164
|
};
|
|
12097
12165
|
}, [client, limitTarget]);
|
|
12098
|
-
const [notifyStart, setNotifyStart] = (0,
|
|
12099
|
-
const [notify, setNotify] = (0,
|
|
12100
|
-
const [notifyReadError, setNotifyReadError] = (0,
|
|
12166
|
+
const [notifyStart, setNotifyStart] = (0, import_react71.useState)(field ? null : false);
|
|
12167
|
+
const [notify, setNotify] = (0, import_react71.useState)(false);
|
|
12168
|
+
const [notifyReadError, setNotifyReadError] = (0, import_react71.useState)(null);
|
|
12101
12169
|
const personColumn = !onEntity && type === "member";
|
|
12102
|
-
(0,
|
|
12170
|
+
(0, import_react71.useEffect)(() => {
|
|
12103
12171
|
if (!field || onEntity || type !== "member") return;
|
|
12104
12172
|
let live = true;
|
|
12105
12173
|
void client.fieldNotifyOnAssign({ field_id: field.id, on: null }).then((got) => {
|
|
@@ -12114,7 +12182,7 @@ function FieldEditor(props) {
|
|
|
12114
12182
|
live = false;
|
|
12115
12183
|
};
|
|
12116
12184
|
}, [client, field, onEntity, type]);
|
|
12117
|
-
(0,
|
|
12185
|
+
(0, import_react71.useEffect)(() => {
|
|
12118
12186
|
if (!field || type !== "status") return;
|
|
12119
12187
|
let live = true;
|
|
12120
12188
|
void client.fieldOptions({ field_id: field.id }).then((got) => {
|
|
@@ -12124,20 +12192,20 @@ function FieldEditor(props) {
|
|
|
12124
12192
|
live = false;
|
|
12125
12193
|
};
|
|
12126
12194
|
}, [client, field, type]);
|
|
12127
|
-
(0,
|
|
12195
|
+
(0, import_react71.useEffect)(() => {
|
|
12128
12196
|
if (field || type !== "status") return;
|
|
12129
12197
|
setNewChoices(
|
|
12130
12198
|
(rows) => rows.length > 0 ? rows : STATUS_STARTING_CHOICES.map((c, i) => ({ id: null, words: c.words, row: `status-${i}` }))
|
|
12131
12199
|
);
|
|
12132
12200
|
}, [field, type]);
|
|
12133
|
-
(0,
|
|
12201
|
+
(0, import_react71.useEffect)(() => {
|
|
12134
12202
|
if (field || type !== "select" && type !== "multi_select") return;
|
|
12135
12203
|
setNewChoices((rows) => rows.length > 0 ? rows : [newChoiceRow([])]);
|
|
12136
12204
|
}, [field, type]);
|
|
12137
|
-
const [allowOther, setAllowOther] = (0,
|
|
12138
|
-
const [newChoices, setNewChoices] = (0,
|
|
12205
|
+
const [allowOther, setAllowOther] = (0, import_react71.useState)(start?.config?.["allow_other"] === true);
|
|
12206
|
+
const [newChoices, setNewChoices] = (0, import_react71.useState)([]);
|
|
12139
12207
|
const copyOfId = copyOf?.id ?? null;
|
|
12140
|
-
(0,
|
|
12208
|
+
(0, import_react71.useEffect)(() => {
|
|
12141
12209
|
if (!copyOf || !copyOfId) return;
|
|
12142
12210
|
let live = true;
|
|
12143
12211
|
void client.fieldOptions({ field_id: copyOfId }).then((got) => {
|
|
@@ -12149,53 +12217,54 @@ function FieldEditor(props) {
|
|
|
12149
12217
|
live = false;
|
|
12150
12218
|
};
|
|
12151
12219
|
}, [client, copyOfId]);
|
|
12152
|
-
const [choiceList, setChoiceList] = (0,
|
|
12153
|
-
const [
|
|
12154
|
-
const [
|
|
12155
|
-
const [
|
|
12156
|
-
const [
|
|
12157
|
-
const [
|
|
12158
|
-
const [
|
|
12159
|
-
const [
|
|
12160
|
-
const [
|
|
12161
|
-
const [
|
|
12220
|
+
const [choiceList, setChoiceList] = (0, import_react71.useState)(null);
|
|
12221
|
+
const [pickedList, setPickedList] = (0, import_react71.useState)(null);
|
|
12222
|
+
const [choiceListStart, setChoiceListStart] = (0, import_react71.useState)(null);
|
|
12223
|
+
const [rehome, setRehome] = (0, import_react71.useState)({});
|
|
12224
|
+
const [rehomed, setRehomed] = (0, import_react71.useState)(null);
|
|
12225
|
+
const [rehomeRefused, setRehomeRefused] = (0, import_react71.useState)(null);
|
|
12226
|
+
const [unit, setUnit] = (0, import_react71.useState)(start?.unit ?? "$");
|
|
12227
|
+
const [withTime, setWithTime] = (0, import_react71.useState)(String(start?.config?.["kind"] ?? "date") === "datetime");
|
|
12228
|
+
const [via, setVia] = (0, import_react71.useState)(String(start?.config?.["via"] ?? ""));
|
|
12229
|
+
const [pick, setPick] = (0, import_react71.useState)(String(start?.config?.["pick"] ?? ""));
|
|
12230
|
+
const [agg, setAgg] = (0, import_react71.useState)(
|
|
12162
12231
|
start?.config?.["agg"] ?? "count"
|
|
12163
12232
|
);
|
|
12164
|
-
const [of, setOf] = (0,
|
|
12233
|
+
const [of, setOf] = (0, import_react71.useState)(String(start?.config?.["of"] ?? ""));
|
|
12165
12234
|
const savedRollupFilter = field?.config?.["filter"] ?? null;
|
|
12166
|
-
const [rollupFilter, setRollupFilter] = (0,
|
|
12235
|
+
const [rollupFilter, setRollupFilter] = (0, import_react71.useState)(
|
|
12167
12236
|
field ? savedRollupFilter : copyOf?.config?.["filter"] ?? null
|
|
12168
12237
|
);
|
|
12169
12238
|
const rollupFilterChanged = JSON.stringify(rollupFilter) !== JSON.stringify(savedRollupFilter);
|
|
12170
|
-
const [relationTarget, setRelationTarget] = (0,
|
|
12171
|
-
const [showOnOther, setShowOnOther] = (0,
|
|
12172
|
-
const [nestsSubItems, setNestsSubItems] = (0,
|
|
12173
|
-
const [reverseRefused, setReverseRefused] = (0,
|
|
12174
|
-
const otherTable = (0,
|
|
12175
|
-
const [display, setDisplay] = (0,
|
|
12176
|
-
const [formulaOp, setFormulaOp] = (0,
|
|
12177
|
-
const [formulaFields, setFormulaFields] = (0,
|
|
12178
|
-
const [formulaSeparator, setFormulaSeparator] = (0,
|
|
12179
|
-
const [allowedTypes, setAllowedTypes] = (0,
|
|
12239
|
+
const [relationTarget, setRelationTarget] = (0, import_react71.useState)(String(start?.relation_target ?? ""));
|
|
12240
|
+
const [showOnOther, setShowOnOther] = (0, import_react71.useState)(true);
|
|
12241
|
+
const [nestsSubItems, setNestsSubItems] = (0, import_react71.useState)(false);
|
|
12242
|
+
const [reverseRefused, setReverseRefused] = (0, import_react71.useState)(null);
|
|
12243
|
+
const otherTable = (0, import_react72.useTable)(!field && type === "relation" && relationTarget !== "" ? relationTarget : null);
|
|
12244
|
+
const [display, setDisplay] = (0, import_react71.useState)(start?.display ?? null);
|
|
12245
|
+
const [formulaOp, setFormulaOp] = (0, import_react71.useState)(() => formulaOpOf(start));
|
|
12246
|
+
const [formulaFields, setFormulaFields] = (0, import_react71.useState)(() => formulaFieldIdsOf(start));
|
|
12247
|
+
const [formulaSeparator, setFormulaSeparator] = (0, import_react71.useState)(() => formulaSeparatorOf(start));
|
|
12248
|
+
const [allowedTypes, setAllowedTypes] = (0, import_react71.useState)(() => entityReferenceKindsOf(start));
|
|
12180
12249
|
const startingFormulaText = start ? formulaTextNow(String(start.config?.["formula_text"] ?? ""), start.config?.["expr"] ?? start.expr, fields.data) : "";
|
|
12181
|
-
const [formulaText, setFormulaText] = (0,
|
|
12182
|
-
const shownFormula = (0,
|
|
12183
|
-
(0,
|
|
12250
|
+
const [formulaText, setFormulaText] = (0, import_react71.useState)(startingFormulaText);
|
|
12251
|
+
const shownFormula = (0, import_react71.useRef)(startingFormulaText);
|
|
12252
|
+
(0, import_react71.useEffect)(() => {
|
|
12184
12253
|
if (shownFormula.current === startingFormulaText) return;
|
|
12185
12254
|
setFormulaText((typed) => typed === shownFormula.current ? startingFormulaText : typed);
|
|
12186
12255
|
shownFormula.current = startingFormulaText;
|
|
12187
12256
|
}, [startingFormulaText]);
|
|
12188
|
-
const [formulaWritten, setFormulaWritten] = (0,
|
|
12189
|
-
const [formulaOk, setFormulaOk] = (0,
|
|
12190
|
-
const [askingToRemove, setAskingToRemove] = (0,
|
|
12191
|
-
const [attempted, setAttempted] = (0,
|
|
12192
|
-
const [showsAs, setShowsAs] = (0,
|
|
12193
|
-
const [backfillError, setBackfillError] = (0,
|
|
12194
|
-
const [notLanded, setNotLanded] = (0,
|
|
12257
|
+
const [formulaWritten, setFormulaWritten] = (0, import_react71.useState)(() => startingFormulaText.trim() !== "" || Boolean(field) || startAs?.type === "formula");
|
|
12258
|
+
const [formulaOk, setFormulaOk] = (0, import_react71.useState)(null);
|
|
12259
|
+
const [askingToRemove, setAskingToRemove] = (0, import_react71.useState)(false);
|
|
12260
|
+
const [attempted, setAttempted] = (0, import_react71.useState)(false);
|
|
12261
|
+
const [showsAs, setShowsAs] = (0, import_react71.useState)(() => start ? startingChoice(start) : { format: null, retype: null });
|
|
12262
|
+
const [backfillError, setBackfillError] = (0, import_react71.useState)(null);
|
|
12263
|
+
const [notLanded, setNotLanded] = (0, import_react71.useState)(false);
|
|
12195
12264
|
const liveField = field ? fields.data?.find((f) => f.id === field.id) ?? field : void 0;
|
|
12196
12265
|
const heldAs = liveField ? JSON.stringify([liveField.type, liveField.config?.["kind"] ?? null, liveField.format ?? null, liveField.multi ?? false, liveField.unit ?? null]) : "";
|
|
12197
|
-
const seededAs = (0,
|
|
12198
|
-
(0,
|
|
12266
|
+
const seededAs = (0, import_react71.useRef)(heldAs);
|
|
12267
|
+
(0, import_react71.useEffect)(() => {
|
|
12199
12268
|
if (!liveField || seededAs.current === heldAs) return;
|
|
12200
12269
|
seededAs.current = heldAs;
|
|
12201
12270
|
setType(startingType(liveField));
|
|
@@ -12204,24 +12273,24 @@ function FieldEditor(props) {
|
|
|
12204
12273
|
setUnit(liveField.unit ?? "$");
|
|
12205
12274
|
setWithTime(String(liveField.config?.["kind"] ?? "date") === "datetime");
|
|
12206
12275
|
}, [heldAs]);
|
|
12207
|
-
const others = (0,
|
|
12276
|
+
const others = (0, import_react71.useMemo)(
|
|
12208
12277
|
() => (fields.data ?? []).filter((f) => f.id !== field?.id),
|
|
12209
12278
|
[fields.data, field?.id]
|
|
12210
12279
|
);
|
|
12211
|
-
const relations = (0,
|
|
12212
|
-
const reverse = (0,
|
|
12213
|
-
const backLinks = (0,
|
|
12214
|
-
const totalSources = (0,
|
|
12280
|
+
const relations = (0, import_react71.useMemo)(() => others.filter((f) => sourceKindOf(f) !== null), [others]);
|
|
12281
|
+
const reverse = (0, import_react72.useReverseColumns)(onEntity ? null : tableId);
|
|
12282
|
+
const backLinks = (0, import_react71.useMemo)(() => (reverse.data ?? []).map(backLinkAsSource), [reverse.data]);
|
|
12283
|
+
const totalSources = (0, import_react71.useMemo)(() => [...relations, ...backLinks], [relations, backLinks]);
|
|
12215
12284
|
const sourcesFor = (kind) => kind === "rollup" || kind === "count" ? totalSources : relations;
|
|
12216
12285
|
const choice = fieldTypeChoice(type);
|
|
12217
12286
|
const editing = Boolean(field);
|
|
12218
|
-
(0,
|
|
12287
|
+
(0, import_react71.useEffect)(() => {
|
|
12219
12288
|
if (!editing) setStartsWith(null);
|
|
12220
12289
|
}, [type, editing]);
|
|
12221
12290
|
const newDefault = !editing && !onEntity && newColumnTakesADefault(type) ? defaultToKeep(startsWith) : null;
|
|
12222
|
-
const farFieldsOfLink = (0,
|
|
12223
|
-
const farTable = (0,
|
|
12224
|
-
const linkReaders = (0,
|
|
12291
|
+
const farFieldsOfLink = (0, import_react72.useFields)(field && sourceKindOf(field) === "link" && !onEntity ? field.relation_target ?? null : null);
|
|
12292
|
+
const farTable = (0, import_react72.useTable)(field && sourceKindOf(field) === "link" && !onEntity ? field.relation_target ?? null : null);
|
|
12293
|
+
const linkReaders = (0, import_react71.useMemo)(
|
|
12225
12294
|
() => field ? readingThroughLink(field, farFieldsOfLink.data ?? []) : [],
|
|
12226
12295
|
[field, farFieldsOfLink.data]
|
|
12227
12296
|
);
|
|
@@ -12233,7 +12302,7 @@ function FieldEditor(props) {
|
|
|
12233
12302
|
const offersMany = multiApplies(type) && !isTitle;
|
|
12234
12303
|
if (!mayShape) {
|
|
12235
12304
|
if (onEntity && entityRights.loading) return null;
|
|
12236
|
-
return /* @__PURE__ */ (0,
|
|
12305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: (0, import_design_system44.cn)("text-xs text-muted-foreground", className), children: props.tableLabel && storeLabel && whyNot ? whyNot.split(storeLabel).join(props.tableLabel) : whyNot });
|
|
12237
12306
|
}
|
|
12238
12307
|
const options = newChoices.map((r) => r.words.trim()).filter((word) => word !== "");
|
|
12239
12308
|
const shownStatusRows = type !== "status" ? [] : statusGroupRows(field, editing ? choiceList ?? [] : newChoices, statusKeys, statusGroups);
|
|
@@ -12304,10 +12373,19 @@ function FieldEditor(props) {
|
|
|
12304
12373
|
// choice in place, plain words add one, a choice left out is retired. Sent only when the
|
|
12305
12374
|
// list is not what the store already holds.
|
|
12306
12375
|
...(() => {
|
|
12307
|
-
if (!chooses || !choiceList || !choiceListStart) return {};
|
|
12376
|
+
if (!chooses || !choiceList || !choiceListStart || pickedList !== null) return {};
|
|
12308
12377
|
const edited = choiceListPatch(choiceListStart, choiceList);
|
|
12309
12378
|
return edited ? { options: edited } : {};
|
|
12310
12379
|
})(),
|
|
12380
|
+
// L58: THE LINK TO A NAMED PICK LIST. A pick list is a Table of choices, so the link is
|
|
12381
|
+
// the column's `options_table_id`. Going back to a list of its own sends the words it shows
|
|
12382
|
+
// now with the column's kind: the store makes the column a table of its own for them.
|
|
12383
|
+
...(() => {
|
|
12384
|
+
if (!chooses || pickedList === null) return {};
|
|
12385
|
+
if (pickedList !== OWN_LIST) return { options_table_id: pickedList };
|
|
12386
|
+
const words = (choiceList ?? []).map((r) => r.words.trim()).filter((w) => w !== "");
|
|
12387
|
+
return { type, options_table_id: "", options: words };
|
|
12388
|
+
})(),
|
|
12311
12389
|
// REL-DISP. Which of the other record's columns this one shows. Sent for
|
|
12312
12390
|
// every relation column, `null` included, because `null` is how the door
|
|
12313
12391
|
// REMOVES a spec and the column goes back to the target table's own
|
|
@@ -12329,7 +12407,7 @@ function FieldEditor(props) {
|
|
|
12329
12407
|
setRehomeRefused(done.error);
|
|
12330
12408
|
return;
|
|
12331
12409
|
}
|
|
12332
|
-
(0,
|
|
12410
|
+
(0, import_react72.tableShapeChanged)(tableId);
|
|
12333
12411
|
for (const c of done.data.undo.cells_back) (0, import_core9.announceRecordChanged)(c.record_id);
|
|
12334
12412
|
const n = done.data.rehomed.reduce((sum, r) => sum + r.records, 0);
|
|
12335
12413
|
setRehome({});
|
|
@@ -12415,7 +12493,7 @@ function FieldEditor(props) {
|
|
|
12415
12493
|
if (newDefault !== null && newColumnDefaultGoes(type) === "right-after") {
|
|
12416
12494
|
const defaulted = await client.fieldUpdate({ field_id: written, patch: { default: newDefault } });
|
|
12417
12495
|
if (!defaulted.ok) {
|
|
12418
|
-
(0,
|
|
12496
|
+
(0, import_react72.tableShapeChanged)(tableId);
|
|
12419
12497
|
setBackfillError(defaulted.error);
|
|
12420
12498
|
return;
|
|
12421
12499
|
}
|
|
@@ -12448,7 +12526,7 @@ function FieldEditor(props) {
|
|
|
12448
12526
|
setReverseRefused(made.error);
|
|
12449
12527
|
return;
|
|
12450
12528
|
}
|
|
12451
|
-
(0,
|
|
12529
|
+
(0, import_react72.tableShapeChanged)(relationTarget);
|
|
12452
12530
|
}
|
|
12453
12531
|
setReverseRefused(null);
|
|
12454
12532
|
onSaved?.();
|
|
@@ -12459,16 +12537,16 @@ function FieldEditor(props) {
|
|
|
12459
12537
|
if (gone) (onRemoved ?? onSaved)?.();
|
|
12460
12538
|
else setAskingToRemove(false);
|
|
12461
12539
|
};
|
|
12462
|
-
return /* @__PURE__ */ (0,
|
|
12463
|
-
/* @__PURE__ */ (0,
|
|
12464
|
-
/* @__PURE__ */ (0,
|
|
12465
|
-
/* @__PURE__ */ (0,
|
|
12540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: (0, import_design_system44.cn)("flex min-w-0 flex-col gap-3 text-xs", className), "data-records-field-editor": "", children: [
|
|
12541
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
12542
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "font-medium", children: field ? `Field \xB7 ${fieldName(field)}` : "New field" }),
|
|
12543
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "ml-auto text-muted-foreground", children: tableLabel })
|
|
12466
12544
|
] }),
|
|
12467
|
-
/* @__PURE__ */ (0,
|
|
12468
|
-
/* @__PURE__ */ (0,
|
|
12469
|
-
/* @__PURE__ */ (0,
|
|
12470
|
-
/* @__PURE__ */ (0,
|
|
12471
|
-
|
|
12545
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
12546
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
12547
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "Name" }),
|
|
12548
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12549
|
+
import_design_system44.BasicInput,
|
|
12472
12550
|
{
|
|
12473
12551
|
value: label,
|
|
12474
12552
|
autoFocus: true,
|
|
@@ -12483,7 +12561,7 @@ function FieldEditor(props) {
|
|
|
12483
12561
|
...nameLine ? { "aria-invalid": true, "aria-describedby": "field-editor-name-taken" } : {}
|
|
12484
12562
|
}
|
|
12485
12563
|
),
|
|
12486
|
-
nameLine ? /* @__PURE__ */ (0,
|
|
12564
|
+
nameLine ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12487
12565
|
"span",
|
|
12488
12566
|
{
|
|
12489
12567
|
id: "field-editor-name-taken",
|
|
@@ -12494,10 +12572,10 @@ function FieldEditor(props) {
|
|
|
12494
12572
|
}
|
|
12495
12573
|
) : null
|
|
12496
12574
|
] }),
|
|
12497
|
-
field ? /* @__PURE__ */ (0,
|
|
12498
|
-
/* @__PURE__ */ (0,
|
|
12499
|
-
/* @__PURE__ */ (0,
|
|
12500
|
-
|
|
12575
|
+
field ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex flex-col gap-1 sm:col-span-2", children: [
|
|
12576
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "Help text" }),
|
|
12577
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12578
|
+
import_design_system44.BasicInput,
|
|
12501
12579
|
{
|
|
12502
12580
|
value: description,
|
|
12503
12581
|
maxLength: 300,
|
|
@@ -12507,30 +12585,30 @@ function FieldEditor(props) {
|
|
|
12507
12585
|
}
|
|
12508
12586
|
)
|
|
12509
12587
|
] }) : null,
|
|
12510
|
-
/* @__PURE__ */ (0,
|
|
12511
|
-
/* @__PURE__ */ (0,
|
|
12512
|
-
/* @__PURE__ */ (0,
|
|
12513
|
-
|
|
12588
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
12589
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "What it holds" }),
|
|
12590
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
12591
|
+
import_design_system44.Select,
|
|
12514
12592
|
{
|
|
12515
12593
|
value: type,
|
|
12516
12594
|
disabled: editing,
|
|
12517
12595
|
onValueChange: (next) => setType(next),
|
|
12518
12596
|
children: [
|
|
12519
|
-
/* @__PURE__ */ (0,
|
|
12520
|
-
/* @__PURE__ */ (0,
|
|
12521
|
-
/* @__PURE__ */ (0,
|
|
12522
|
-
FIELD_TYPE_CATALOGUE.filter((c) => c.group === group && (c.id === type || offered.includes(c))).map((c) => /* @__PURE__ */ (0,
|
|
12597
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", "aria-label": "What this field holds", ...choice?.explanation ? { title: choice.explanation } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, {}) }),
|
|
12598
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectContent, { children: FIELD_TYPE_GROUPS.filter((group) => offered.some((c) => c.group === group)).map((group) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.SelectGroup, { children: [
|
|
12599
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectLabel, { children: group }),
|
|
12600
|
+
FIELD_TYPE_CATALOGUE.filter((c) => c.group === group && (c.id === type || offered.includes(c))).map((c) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: c.id, children: c.label }, c.id))
|
|
12523
12601
|
] }, group)) })
|
|
12524
12602
|
]
|
|
12525
12603
|
}
|
|
12526
12604
|
),
|
|
12527
|
-
editing && field ? /* @__PURE__ */ (0,
|
|
12605
|
+
editing && field ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FieldRetype, { field: liveField ?? field, tableId }) : null
|
|
12528
12606
|
] })
|
|
12529
12607
|
] }),
|
|
12530
|
-
type === "formula" && others.length > 0 ? /* @__PURE__ */ (0,
|
|
12531
|
-
editing ? startingFormulaText.trim() === "" ? /* @__PURE__ */ (0,
|
|
12532
|
-
/* @__PURE__ */ (0,
|
|
12533
|
-
|
|
12608
|
+
type === "formula" && others.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
12609
|
+
editing ? startingFormulaText.trim() === "" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-[11px] text-muted-foreground", children: EDITING_A_WORKED_OUT_COLUMN }) : null : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How to make this column", children: [
|
|
12610
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12611
|
+
import_design_system44.Button,
|
|
12534
12612
|
{
|
|
12535
12613
|
type: "button",
|
|
12536
12614
|
size: "sm",
|
|
@@ -12540,8 +12618,8 @@ function FieldEditor(props) {
|
|
|
12540
12618
|
children: "Pick the columns"
|
|
12541
12619
|
}
|
|
12542
12620
|
),
|
|
12543
|
-
/* @__PURE__ */ (0,
|
|
12544
|
-
|
|
12621
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12622
|
+
import_design_system44.Button,
|
|
12545
12623
|
{
|
|
12546
12624
|
type: "button",
|
|
12547
12625
|
size: "sm",
|
|
@@ -12552,7 +12630,7 @@ function FieldEditor(props) {
|
|
|
12552
12630
|
}
|
|
12553
12631
|
)
|
|
12554
12632
|
] }),
|
|
12555
|
-
formulaWritten ? /* @__PURE__ */ (0,
|
|
12633
|
+
formulaWritten ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12556
12634
|
FormulaTextEditor,
|
|
12557
12635
|
{
|
|
12558
12636
|
tableId,
|
|
@@ -12562,9 +12640,9 @@ function FieldEditor(props) {
|
|
|
12562
12640
|
columns: others
|
|
12563
12641
|
}
|
|
12564
12642
|
) : null
|
|
12565
|
-
] }) : editing && type === "formula" ? /* @__PURE__ */ (0,
|
|
12566
|
-
editing && field && !onEntity && (type === "lookup" || type === "rollup") ? /* @__PURE__ */ (0,
|
|
12567
|
-
!editing && !(type === "formula" && formulaWritten) || type === "select" || type === "multi_select" || type === "status" || type === "rating" || type === "barcode" || type === "relation" || type === "entity_reference" ? /* @__PURE__ */ (0,
|
|
12643
|
+
] }) : editing && type === "formula" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No other column to read." }) : null,
|
|
12644
|
+
editing && field && !onEntity && (type === "lookup" || type === "rollup") ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SourceArchivedNotice, { fieldId: field.id, tableId }) : null,
|
|
12645
|
+
!editing && !(type === "formula" && formulaWritten) || type === "select" || type === "multi_select" || type === "status" || type === "rating" || type === "barcode" || type === "relation" || type === "entity_reference" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12568
12646
|
TypeQuestions,
|
|
12569
12647
|
{
|
|
12570
12648
|
type,
|
|
@@ -12594,21 +12672,24 @@ function FieldEditor(props) {
|
|
|
12594
12672
|
setFormulaSeparator,
|
|
12595
12673
|
relations: sourcesFor(type),
|
|
12596
12674
|
others,
|
|
12597
|
-
choiceList: editing && field ? /* @__PURE__ */ (0,
|
|
12598
|
-
|
|
12599
|
-
|
|
12600
|
-
|
|
12601
|
-
|
|
12602
|
-
|
|
12603
|
-
|
|
12604
|
-
|
|
12605
|
-
|
|
12606
|
-
|
|
12607
|
-
|
|
12608
|
-
|
|
12675
|
+
choiceList: editing && field ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
12676
|
+
type === "select" || type === "multi_select" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PickListLink, { field, value: pickedList, onChange: setPickedList }) : null,
|
|
12677
|
+
pickedList !== null && pickedList !== OWN_LIST ? null : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12678
|
+
ChoiceListEditor,
|
|
12679
|
+
{
|
|
12680
|
+
field,
|
|
12681
|
+
rows: choiceList,
|
|
12682
|
+
onRows: setChoiceList,
|
|
12683
|
+
onStart: setChoiceListStart,
|
|
12684
|
+
allowOther,
|
|
12685
|
+
rehome,
|
|
12686
|
+
onRehome: setRehome
|
|
12687
|
+
}
|
|
12688
|
+
)
|
|
12689
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ChoiceListEditor, { isNew: true, rows: newChoices, onRows: setNewChoices }),
|
|
12609
12690
|
allowedTypes,
|
|
12610
12691
|
setAllowedTypes,
|
|
12611
|
-
newer: type === "rating" ? /* @__PURE__ */ (0,
|
|
12692
|
+
newer: type === "rating" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12612
12693
|
RatingMaxQuestion,
|
|
12613
12694
|
{
|
|
12614
12695
|
value: ratingMax,
|
|
@@ -12616,66 +12697,66 @@ function FieldEditor(props) {
|
|
|
12616
12697
|
setRatingMax(next);
|
|
12617
12698
|
}
|
|
12618
12699
|
}
|
|
12619
|
-
) : type === "status" ? /* @__PURE__ */ (0,
|
|
12700
|
+
) : type === "status" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(StatusGroupsQuestion, { rows: shownStatusRows, onGroup: (ref, next) => setStatusGroups({ ...statusGroups, [ref]: next }) }) : type === "barcode" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BarcodeSymbologyQuestion, { value: symbology, onChange: setSymbology }) : null
|
|
12620
12701
|
}
|
|
12621
12702
|
) : null,
|
|
12622
|
-
type === "button" ? /* @__PURE__ */ (0,
|
|
12623
|
-
type === "modified_time" ? /* @__PURE__ */ (0,
|
|
12624
|
-
type === "autonumber" ? /* @__PURE__ */ (0,
|
|
12625
|
-
/* @__PURE__ */ (0,
|
|
12626
|
-
/* @__PURE__ */ (0,
|
|
12703
|
+
type === "button" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ButtonSettingsEditor, { value: buttonSettings, onChange: setButtonSettings, tableId: onEntity ? null : tableId, fields: others }) : null,
|
|
12704
|
+
type === "modified_time" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(WatchFieldsPicker, { fields: others, value: watchFields, onChange: setWatchFields }) : null,
|
|
12705
|
+
type === "autonumber" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
12706
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "Prefix" }),
|
|
12707
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.BasicInput, { className: "h-8 text-xs", placeholder: "TASK-", maxLength: 16, "data-records-autonumber-prefix": "", value: numberPrefix, onChange: (e) => setNumberPrefix(e.target.value) })
|
|
12627
12708
|
] }) : null,
|
|
12628
|
-
editing && field?.type === "relation" && field.relation_target && field.relation_target === field.entity_definition_id ? /* @__PURE__ */ (0,
|
|
12629
|
-
/* @__PURE__ */ (0,
|
|
12630
|
-
/* @__PURE__ */ (0,
|
|
12709
|
+
editing && field?.type === "relation" && field.relation_target && field.relation_target === field.entity_definition_id ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", title: "A timeline draws a line to each record this one waits on", children: [
|
|
12710
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Checkbox, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
|
|
12711
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Waits on the linked records" })
|
|
12631
12712
|
] }) : null,
|
|
12632
|
-
editing && limitTarget ? /* @__PURE__ */ (0,
|
|
12633
|
-
/* @__PURE__ */ (0,
|
|
12634
|
-
/* @__PURE__ */ (0,
|
|
12635
|
-
/* @__PURE__ */ (0,
|
|
12636
|
-
/* @__PURE__ */ (0,
|
|
12637
|
-
/* @__PURE__ */ (0,
|
|
12638
|
-
(targetViews ?? []).map((v) => /* @__PURE__ */ (0,
|
|
12639
|
-
limitView !== "" && targetViews !== null && !targetViews.some((v) => v.id === limitView) ? /* @__PURE__ */ (0,
|
|
12713
|
+
editing && limitTarget ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", "data-records-limit-to-view": "", children: [
|
|
12714
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "Choices come from" }),
|
|
12715
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.Select, { value: limitView === "" ? "__all" : limitView, onValueChange: (next) => setLimitView(next === "__all" ? "" : next), disabled: targetViews === null, children: [
|
|
12716
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", "aria-label": "Limit the choices to a view", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, {}) }),
|
|
12717
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.SelectContent, { children: [
|
|
12718
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: "__all", children: "Every record" }),
|
|
12719
|
+
(targetViews ?? []).map((v) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: v.id, children: v.name }, v.id)),
|
|
12720
|
+
limitView !== "" && targetViews !== null && !targetViews.some((v) => v.id === limitView) ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: limitView, children: "A view that is gone" }) : null
|
|
12640
12721
|
] })
|
|
12641
12722
|
] })
|
|
12642
12723
|
] }) : null,
|
|
12643
|
-
editing && limitTarget ? /* @__PURE__ */ (0,
|
|
12644
|
-
editing && field?.type === "relation" ? /* @__PURE__ */ (0,
|
|
12645
|
-
/* @__PURE__ */ (0,
|
|
12646
|
-
/* @__PURE__ */ (0,
|
|
12647
|
-
/* @__PURE__ */ (0,
|
|
12648
|
-
/* @__PURE__ */ (0,
|
|
12649
|
-
/* @__PURE__ */ (0,
|
|
12650
|
-
/* @__PURE__ */ (0,
|
|
12724
|
+
editing && limitTarget ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(AlsoPointsAt, { own: limitTarget, value: alsoTargets, onChange: setAlsoTargets }) : null,
|
|
12725
|
+
editing && field?.type === "relation" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", "data-records-link-binding": "", children: [
|
|
12726
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "When a linked record changes" }),
|
|
12727
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.Select, { value: binding, onValueChange: (next) => setBinding(next === "snapshot" ? "snapshot" : "live"), children: [
|
|
12728
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", "aria-label": "When a linked record changes", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, {}) }),
|
|
12729
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.SelectContent, { children: [
|
|
12730
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: "live", children: "Show its changes" }),
|
|
12731
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: "snapshot", children: "Keep it as it was when linked" })
|
|
12651
12732
|
] })
|
|
12652
12733
|
] })
|
|
12653
12734
|
] }) : null,
|
|
12654
|
-
editing && field?.type === "relation" ? /* @__PURE__ */ (0,
|
|
12655
|
-
/* @__PURE__ */ (0,
|
|
12656
|
-
/* @__PURE__ */ (0,
|
|
12657
|
-
/* @__PURE__ */ (0,
|
|
12735
|
+
editing && field?.type === "relation" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1.5", "data-records-link-carries": "", children: [
|
|
12736
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", title: "Whoever can see a linked record can also see this one", children: [
|
|
12737
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Checkbox, { checked: carries, "aria-label": "Carries access", onCheckedChange: (v) => setCarries(v === true) }),
|
|
12738
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Whoever sees a linked record sees this one" })
|
|
12658
12739
|
] }),
|
|
12659
|
-
carries ? /* @__PURE__ */ (0,
|
|
12660
|
-
/* @__PURE__ */ (0,
|
|
12661
|
-
/* @__PURE__ */ (0,
|
|
12662
|
-
/* @__PURE__ */ (0,
|
|
12663
|
-
/* @__PURE__ */ (0,
|
|
12740
|
+
carries ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.Select, { value: carriesMax, onValueChange: (next) => setCarriesMax(next === "editor" ? "editor" : "viewer"), children: [
|
|
12741
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", "aria-label": "Carried access level", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, {}) }),
|
|
12742
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.SelectContent, { children: [
|
|
12743
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: "viewer", children: "Up to view" }),
|
|
12744
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: "editor", children: "Up to edit" })
|
|
12664
12745
|
] })
|
|
12665
12746
|
] }) : null,
|
|
12666
|
-
field.relation_target && field.relation_target === field.entity_definition_id ? /* @__PURE__ */ (0,
|
|
12667
|
-
/* @__PURE__ */ (0,
|
|
12668
|
-
/* @__PURE__ */ (0,
|
|
12747
|
+
field.relation_target && field.relation_target === field.entity_definition_id ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", title: "Two records may point at each other along this link", children: [
|
|
12748
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Checkbox, { checked: loops, "aria-label": "Two records can link each other", onCheckedChange: (v) => setLoops(v === true) }),
|
|
12749
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Two records can link each other" })
|
|
12669
12750
|
] }) : null,
|
|
12670
|
-
carries && loops ? /* @__PURE__ */ (0,
|
|
12751
|
+
carries && loops ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("p", { className: "text-xs text-muted-foreground", "data-records-loop-consequence": "", children: [
|
|
12671
12752
|
"Sharing one record shares the records it links to, and back again, ",
|
|
12672
12753
|
carriesMax === "editor" ? "up to edit" : "view only",
|
|
12673
12754
|
"."
|
|
12674
12755
|
] }) : null
|
|
12675
12756
|
] }) : null,
|
|
12676
|
-
personColumn ? /* @__PURE__ */ (0,
|
|
12677
|
-
/* @__PURE__ */ (0,
|
|
12678
|
-
|
|
12757
|
+
personColumn ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", title: "Each person added to this column gets a notice", children: [
|
|
12758
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12759
|
+
import_design_system44.Checkbox,
|
|
12679
12760
|
{
|
|
12680
12761
|
checked: notify,
|
|
12681
12762
|
disabled: notifyStart === null,
|
|
@@ -12684,10 +12765,10 @@ function FieldEditor(props) {
|
|
|
12684
12765
|
onCheckedChange: (v) => setNotify(v === true)
|
|
12685
12766
|
}
|
|
12686
12767
|
),
|
|
12687
|
-
/* @__PURE__ */ (0,
|
|
12768
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Notify people when they're added" })
|
|
12688
12769
|
] }) : null,
|
|
12689
|
-
notifyReadError ? /* @__PURE__ */ (0,
|
|
12690
|
-
type === "rollup" ? /* @__PURE__ */ (0,
|
|
12770
|
+
notifyReadError ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RefusalNotice, { error: notifyReadError }) : null,
|
|
12771
|
+
type === "rollup" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12691
12772
|
RollupFilterQuestion,
|
|
12692
12773
|
{
|
|
12693
12774
|
relation: totalSources.find((f) => f.key === via),
|
|
@@ -12697,23 +12778,23 @@ function FieldEditor(props) {
|
|
|
12697
12778
|
onChange: setRollupFilter
|
|
12698
12779
|
}
|
|
12699
12780
|
) : null,
|
|
12700
|
-
editing && field && !(type === "select" || type === "multi_select" || type === "status" || type === "autonumber") ? /* @__PURE__ */ (0,
|
|
12701
|
-
offersAppliesTo ? /* @__PURE__ */ (0,
|
|
12702
|
-
/* @__PURE__ */ (0,
|
|
12703
|
-
/* @__PURE__ */ (0,
|
|
12704
|
-
/* @__PURE__ */ (0,
|
|
12705
|
-
|
|
12781
|
+
editing && field && !(type === "select" || type === "multi_select" || type === "status" || type === "autonumber") ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FieldFormatPicker, { field, value: showsAs, onValue: setShowsAs }) : null,
|
|
12782
|
+
offersAppliesTo ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(AppliesToTypes, { typeField, value: appliesTo, onValue: setAppliesTo }) : null,
|
|
12783
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
12784
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12785
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12786
|
+
import_design_system44.Checkbox,
|
|
12706
12787
|
{
|
|
12707
12788
|
checked: required,
|
|
12708
12789
|
"aria-label": "Required",
|
|
12709
12790
|
onCheckedChange: (v) => setRequired(v === true)
|
|
12710
12791
|
}
|
|
12711
12792
|
),
|
|
12712
|
-
/* @__PURE__ */ (0,
|
|
12793
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { title: "Every record has to have one", children: "Required" })
|
|
12713
12794
|
] }),
|
|
12714
|
-
offersMany ? /* @__PURE__ */ (0,
|
|
12715
|
-
/* @__PURE__ */ (0,
|
|
12716
|
-
|
|
12795
|
+
offersMany ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12796
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12797
|
+
import_design_system44.Checkbox,
|
|
12717
12798
|
{
|
|
12718
12799
|
checked: multi,
|
|
12719
12800
|
"aria-label": "Can hold more than one",
|
|
@@ -12722,9 +12803,9 @@ function FieldEditor(props) {
|
|
|
12722
12803
|
),
|
|
12723
12804
|
"Can hold more than one"
|
|
12724
12805
|
] }) : null,
|
|
12725
|
-
/* @__PURE__ */ (0,
|
|
12726
|
-
/* @__PURE__ */ (0,
|
|
12727
|
-
|
|
12806
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12807
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12808
|
+
import_design_system44.Checkbox,
|
|
12728
12809
|
{
|
|
12729
12810
|
checked: dated,
|
|
12730
12811
|
"aria-label": "Each value has its own date",
|
|
@@ -12733,9 +12814,9 @@ function FieldEditor(props) {
|
|
|
12733
12814
|
),
|
|
12734
12815
|
"Each value has its own date"
|
|
12735
12816
|
] }),
|
|
12736
|
-
!field && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */ (0,
|
|
12737
|
-
/* @__PURE__ */ (0,
|
|
12738
|
-
|
|
12817
|
+
!field && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12818
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12819
|
+
import_design_system44.Checkbox,
|
|
12739
12820
|
{
|
|
12740
12821
|
checked: showOnOther,
|
|
12741
12822
|
"aria-label": `Show on ${otherTable.data.name ?? "the other table"}`,
|
|
@@ -12746,13 +12827,13 @@ function FieldEditor(props) {
|
|
|
12746
12827
|
"Show on ",
|
|
12747
12828
|
otherTable.data.name ?? "the other table"
|
|
12748
12829
|
] }) : null,
|
|
12749
|
-
!field && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ (0,
|
|
12750
|
-
/* @__PURE__ */ (0,
|
|
12751
|
-
/* @__PURE__ */ (0,
|
|
12830
|
+
!field && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5", title: "A timeline draws a line to each record this one waits on", children: [
|
|
12831
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Checkbox, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
|
|
12832
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Waits on the linked records" })
|
|
12752
12833
|
] }) : null,
|
|
12753
|
-
!field && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ (0,
|
|
12754
|
-
/* @__PURE__ */ (0,
|
|
12755
|
-
|
|
12834
|
+
!field && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12835
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12836
|
+
import_design_system44.Checkbox,
|
|
12756
12837
|
{
|
|
12757
12838
|
checked: nestsSubItems,
|
|
12758
12839
|
"aria-label": "Sub-items",
|
|
@@ -12763,11 +12844,11 @@ function FieldEditor(props) {
|
|
|
12763
12844
|
"data-records-sub-items": ""
|
|
12764
12845
|
}
|
|
12765
12846
|
),
|
|
12766
|
-
/* @__PURE__ */ (0,
|
|
12847
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { title: "Each record sits under the one this column names", children: "Sub-items" })
|
|
12767
12848
|
] }) : null,
|
|
12768
|
-
CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */ (0,
|
|
12769
|
-
/* @__PURE__ */ (0,
|
|
12770
|
-
|
|
12849
|
+
CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
12850
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12851
|
+
import_design_system44.Checkbox,
|
|
12771
12852
|
{
|
|
12772
12853
|
checked: allowOther,
|
|
12773
12854
|
"aria-label": "A value that is not one of the choices is added to them",
|
|
@@ -12777,10 +12858,10 @@ function FieldEditor(props) {
|
|
|
12777
12858
|
"A value that is not one of the choices is added to them"
|
|
12778
12859
|
] }) : null
|
|
12779
12860
|
] }),
|
|
12780
|
-
!editing && !onEntity && newColumnTakesADefault(type) ? /* @__PURE__ */ (0,
|
|
12781
|
-
editing && field && takesADefault(liveField ?? field) ? /* @__PURE__ */ (0,
|
|
12782
|
-
/* @__PURE__ */ (0,
|
|
12783
|
-
/* @__PURE__ */ (0,
|
|
12861
|
+
!editing && !onEntity && newColumnTakesADefault(type) ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(NewColumnDefault, { type, choices: options, value: startsWith, onChange: setStartsWith }) : null,
|
|
12862
|
+
editing && field && takesADefault(liveField ?? field) ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", "data-records-field-default": "", children: [
|
|
12863
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { htmlFor: "records-field-default", className: "text-xs", children: DEFAULT_LABEL }),
|
|
12864
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12784
12865
|
FieldControl,
|
|
12785
12866
|
{
|
|
12786
12867
|
id: "records-field-default",
|
|
@@ -12790,29 +12871,29 @@ function FieldEditor(props) {
|
|
|
12790
12871
|
}
|
|
12791
12872
|
)
|
|
12792
12873
|
] }) : null,
|
|
12793
|
-
/* @__PURE__ */ (0,
|
|
12794
|
-
/* @__PURE__ */ (0,
|
|
12795
|
-
/* @__PURE__ */ (0,
|
|
12796
|
-
/* @__PURE__ */ (0,
|
|
12797
|
-
/* @__PURE__ */ (0,
|
|
12798
|
-
/* @__PURE__ */ (0,
|
|
12799
|
-
/* @__PURE__ */ (0,
|
|
12874
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Separator, {}),
|
|
12875
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
12876
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
12877
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "Who can see what is in it" }),
|
|
12878
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.Select, { value: sensitivity, onValueChange: setSensitivity, children: [
|
|
12879
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", "aria-label": "Who can see what is in it", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, {}) }),
|
|
12880
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectContent, { children: sensitivities.map((row) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: row.value, children: row.label }, row.value)) })
|
|
12800
12881
|
] })
|
|
12801
12882
|
] }),
|
|
12802
|
-
/* @__PURE__ */ (0,
|
|
12803
|
-
/* @__PURE__ */ (0,
|
|
12804
|
-
/* @__PURE__ */ (0,
|
|
12805
|
-
/* @__PURE__ */ (0,
|
|
12806
|
-
/* @__PURE__ */ (0,
|
|
12883
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
12884
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "Can an assistant read it" }),
|
|
12885
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.Select, { value: contextPolicy, onValueChange: setContextPolicy, children: [
|
|
12886
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", "aria-label": "Can an assistant read it", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, {}) }),
|
|
12887
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectContent, { children: AGENT_VISIBILITY.map((row) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: row.value, children: row.label }, row.value)) })
|
|
12807
12888
|
] })
|
|
12808
12889
|
] })
|
|
12809
12890
|
] }),
|
|
12810
|
-
/* @__PURE__ */ (0,
|
|
12811
|
-
/* @__PURE__ */ (0,
|
|
12812
|
-
/* @__PURE__ */ (0,
|
|
12813
|
-
/* @__PURE__ */ (0,
|
|
12814
|
-
/* @__PURE__ */ (0,
|
|
12815
|
-
|
|
12891
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Separator, {}),
|
|
12892
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
12893
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
12894
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "font-medium", children: "What counts as a good value" }),
|
|
12895
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12896
|
+
import_design_system44.Button,
|
|
12816
12897
|
{
|
|
12817
12898
|
type: "button",
|
|
12818
12899
|
size: "sm",
|
|
@@ -12823,9 +12904,9 @@ function FieldEditor(props) {
|
|
|
12823
12904
|
}
|
|
12824
12905
|
)
|
|
12825
12906
|
] }),
|
|
12826
|
-
canBeUnique(type, multi) || rules.some((r) => r.kind === "unique") ? /* @__PURE__ */ (0,
|
|
12827
|
-
/* @__PURE__ */ (0,
|
|
12828
|
-
|
|
12907
|
+
canBeUnique(type, multi) || rules.some((r) => r.kind === "unique") ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5", "data-records-field-unique": "", children: [
|
|
12908
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12909
|
+
import_design_system44.Checkbox,
|
|
12829
12910
|
{
|
|
12830
12911
|
checked: rules.some((r) => r.kind === "unique"),
|
|
12831
12912
|
"aria-label": UNIQUE_LABEL,
|
|
@@ -12834,21 +12915,21 @@ function FieldEditor(props) {
|
|
|
12834
12915
|
),
|
|
12835
12916
|
UNIQUE_LABEL
|
|
12836
12917
|
] }) : null,
|
|
12837
|
-
rules.length === 0 ? /* @__PURE__ */ (0,
|
|
12838
|
-
rules.map((rule, index) => rule.kind === "unique" ? null : /* @__PURE__ */ (0,
|
|
12839
|
-
/* @__PURE__ */ (0,
|
|
12840
|
-
|
|
12918
|
+
rules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-muted-foreground", children: "No checks." }) : null,
|
|
12919
|
+
rules.map((rule, index) => rule.kind === "unique" ? null : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
12920
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
12921
|
+
import_design_system44.Select,
|
|
12841
12922
|
{
|
|
12842
12923
|
value: rule.kind,
|
|
12843
12924
|
onValueChange: (kind) => setRules(rules.map((r, i) => i === index ? { ...r, kind } : r)),
|
|
12844
12925
|
children: [
|
|
12845
|
-
/* @__PURE__ */ (0,
|
|
12846
|
-
/* @__PURE__ */ (0,
|
|
12926
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", className: "w-52", "aria-label": `Check ${index + 1}`, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, {}) }),
|
|
12927
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectContent, { children: RULE_KINDS.map((row) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: row.kind, children: row.label }, row.kind)) })
|
|
12847
12928
|
]
|
|
12848
12929
|
}
|
|
12849
12930
|
),
|
|
12850
|
-
rule.kind === "length" ? /* @__PURE__ */ (0,
|
|
12851
|
-
|
|
12931
|
+
rule.kind === "length" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12932
|
+
import_design_system44.BasicInput,
|
|
12852
12933
|
{
|
|
12853
12934
|
className: "h-8 w-24",
|
|
12854
12935
|
inputMode: "numeric",
|
|
@@ -12858,8 +12939,8 @@ function FieldEditor(props) {
|
|
|
12858
12939
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? withNumber(r, "min", e.target.value) : r))
|
|
12859
12940
|
}
|
|
12860
12941
|
) : null,
|
|
12861
|
-
/* @__PURE__ */ (0,
|
|
12862
|
-
|
|
12942
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12943
|
+
import_design_system44.BasicInput,
|
|
12863
12944
|
{
|
|
12864
12945
|
className: "h-8",
|
|
12865
12946
|
...rule.kind === "length" ? { inputMode: "numeric", placeholder: "most" } : {},
|
|
@@ -12868,8 +12949,8 @@ function FieldEditor(props) {
|
|
|
12868
12949
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? { ...r, value: e.target.value } : r))
|
|
12869
12950
|
}
|
|
12870
12951
|
),
|
|
12871
|
-
rule.kind === "pattern" ? /* @__PURE__ */ (0,
|
|
12872
|
-
|
|
12952
|
+
rule.kind === "pattern" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12953
|
+
import_design_system44.BasicInput,
|
|
12873
12954
|
{
|
|
12874
12955
|
className: "h-8",
|
|
12875
12956
|
placeholder: "for example 949-555-0142",
|
|
@@ -12878,8 +12959,8 @@ function FieldEditor(props) {
|
|
|
12878
12959
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? withText(r, "example", e.target.value) : r))
|
|
12879
12960
|
}
|
|
12880
12961
|
) : null,
|
|
12881
|
-
/* @__PURE__ */ (0,
|
|
12882
|
-
|
|
12962
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12963
|
+
import_design_system44.Button,
|
|
12883
12964
|
{
|
|
12884
12965
|
type: "button",
|
|
12885
12966
|
size: "sm",
|
|
@@ -12891,9 +12972,9 @@ function FieldEditor(props) {
|
|
|
12891
12972
|
)
|
|
12892
12973
|
] }, `${rule.kind}-${index}`))
|
|
12893
12974
|
] }),
|
|
12894
|
-
editing && field && !onEntity && rulesChanged(savedRules, editedRules) ? /* @__PURE__ */ (0,
|
|
12895
|
-
mutation.error ? /* @__PURE__ */ (0,
|
|
12896
|
-
notLanded ? /* @__PURE__ */ (0,
|
|
12975
|
+
editing && field && !onEntity && rulesChanged(savedRules, editedRules) ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FieldRulePreview, { field, tableId, rules: editedRules }) : null,
|
|
12976
|
+
mutation.error ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RefusalNotice, { error: mutation.error }) : null,
|
|
12977
|
+
notLanded ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12897
12978
|
RefusalNotice,
|
|
12898
12979
|
{
|
|
12899
12980
|
error: (0, refusals_exports.refusal)(
|
|
@@ -12903,11 +12984,11 @@ function FieldEditor(props) {
|
|
|
12903
12984
|
)
|
|
12904
12985
|
}
|
|
12905
12986
|
) : null,
|
|
12906
|
-
rehomeRefused ? /* @__PURE__ */ (0,
|
|
12907
|
-
rehomed ? /* @__PURE__ */ (0,
|
|
12908
|
-
/* @__PURE__ */ (0,
|
|
12909
|
-
rehomed.undo ? /* @__PURE__ */ (0,
|
|
12910
|
-
|
|
12987
|
+
rehomeRefused ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RefusalNotice, { error: rehomeRefused }) : null,
|
|
12988
|
+
rehomed ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { "data-records-choice-rehomed": "", className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
|
|
12989
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: rehomed.said }),
|
|
12990
|
+
rehomed.undo ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12991
|
+
import_design_system44.Button,
|
|
12911
12992
|
{
|
|
12912
12993
|
type: "button",
|
|
12913
12994
|
size: "sm",
|
|
@@ -12921,7 +13002,7 @@ function FieldEditor(props) {
|
|
|
12921
13002
|
setRehomeRefused(back.error);
|
|
12922
13003
|
return;
|
|
12923
13004
|
}
|
|
12924
|
-
(0,
|
|
13005
|
+
(0, import_react72.tableShapeChanged)(tableId);
|
|
12925
13006
|
for (const c of undo.cells_back) (0, import_core9.announceRecordChanged)(c.record_id);
|
|
12926
13007
|
setChoiceList(null);
|
|
12927
13008
|
setChoiceListStart(null);
|
|
@@ -12931,19 +13012,19 @@ function FieldEditor(props) {
|
|
|
12931
13012
|
children: "Undo"
|
|
12932
13013
|
}
|
|
12933
13014
|
) : null,
|
|
12934
|
-
/* @__PURE__ */ (0,
|
|
13015
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Button, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
|
|
12935
13016
|
] }) : null,
|
|
12936
|
-
reverseRefused ? /* @__PURE__ */ (0,
|
|
12937
|
-
/* @__PURE__ */ (0,
|
|
12938
|
-
/* @__PURE__ */ (0,
|
|
13017
|
+
reverseRefused ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { "data-records-reverse-field-refused": "", className: "flex flex-col gap-1", children: [
|
|
13018
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-[11px]", children: "The link is made. Its column on the other table was not:" }),
|
|
13019
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RefusalNotice, { error: reverseRefused })
|
|
12939
13020
|
] }) : null,
|
|
12940
|
-
backfillError ? /* @__PURE__ */ (0,
|
|
12941
|
-
/* @__PURE__ */ (0,
|
|
12942
|
-
/* @__PURE__ */ (0,
|
|
13021
|
+
backfillError ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { "data-records-autonumber-backfill-refused": "", className: "flex flex-col gap-1", children: [
|
|
13022
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
|
|
13023
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RefusalNotice, { error: backfillError })
|
|
12943
13024
|
] }) : null,
|
|
12944
|
-
/* @__PURE__ */ (0,
|
|
12945
|
-
/* @__PURE__ */ (0,
|
|
12946
|
-
|
|
13025
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex min-w-0 flex-nowrap items-center gap-2", "data-field-editor-footer": "", children: [
|
|
13026
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13027
|
+
import_design_system44.Button,
|
|
12947
13028
|
{
|
|
12948
13029
|
size: "sm",
|
|
12949
13030
|
disabled: mutation.saving || Boolean(formulaMissing) || Boolean(nameLine) && label.trim() !== (field?.label ?? "").trim(),
|
|
@@ -12958,8 +13039,8 @@ function FieldEditor(props) {
|
|
|
12958
13039
|
children: mutation.saving ? "Saving\u2026" : field ? EDIT_FIELD_SAVE_LABEL : onEntity ? ADD_STANDARD_FIELD_SAVE_LABEL : ADD_FIELD_SAVE_LABEL
|
|
12959
13040
|
}
|
|
12960
13041
|
),
|
|
12961
|
-
onCancel ? /* @__PURE__ */ (0,
|
|
12962
|
-
/* @__PURE__ */ (0,
|
|
13042
|
+
onCancel ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Button, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null,
|
|
13043
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
12963
13044
|
"span",
|
|
12964
13045
|
{
|
|
12965
13046
|
id: "field-editor-missing",
|
|
@@ -12975,12 +13056,12 @@ function FieldEditor(props) {
|
|
|
12975
13056
|
footer is always as wide and as tall as its larger state: opening the confirm moved
|
|
12976
13057
|
the dialog card 0.2278 and closing it 0.1303. The consequence is the tooltip of
|
|
12977
13058
|
"Remove it" (interface-text: the slot holds a label, never a paragraph). */
|
|
12978
|
-
/* @__PURE__ */ (0,
|
|
12979
|
-
/* @__PURE__ */ (0,
|
|
12980
|
-
/* @__PURE__ */ (0,
|
|
12981
|
-
/* @__PURE__ */ (0,
|
|
12982
|
-
/* @__PURE__ */ (0,
|
|
12983
|
-
|
|
13059
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "ml-auto grid shrink-0 items-center", "data-field-editor-remove": askingToRemove ? "asking" : "idle", children: [
|
|
13060
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: (0, import_design_system44.cn)("col-start-1 row-start-1 flex items-center justify-end gap-2", askingToRemove && "invisible"), "aria-hidden": askingToRemove || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Button, { size: "sm", variant: "outline", tabIndex: askingToRemove ? -1 : void 0, onClick: () => setAskingToRemove(true), children: "Remove this field" }) }),
|
|
13061
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: (0, import_design_system44.cn)("col-start-1 row-start-1 flex items-center justify-end gap-2", !askingToRemove && "invisible"), "aria-hidden": !askingToRemove || void 0, children: [
|
|
13062
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "whitespace-nowrap text-destructive", "data-field-editor-remove-ask": "", children: "Archive this field?" }),
|
|
13063
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13064
|
+
import_design_system44.Button,
|
|
12984
13065
|
{
|
|
12985
13066
|
size: "sm",
|
|
12986
13067
|
variant: "destructive",
|
|
@@ -12992,7 +13073,7 @@ function FieldEditor(props) {
|
|
|
12992
13073
|
children: "Remove it"
|
|
12993
13074
|
}
|
|
12994
13075
|
),
|
|
12995
|
-
/* @__PURE__ */ (0,
|
|
13076
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Button, { size: "sm", variant: "ghost", tabIndex: askingToRemove ? void 0 : -1, onClick: () => setAskingToRemove(false), children: "Keep it" })
|
|
12996
13077
|
] })
|
|
12997
13078
|
] })
|
|
12998
13079
|
) : null
|
|
@@ -13083,10 +13164,10 @@ function formulaSeparatorOf(field) {
|
|
|
13083
13164
|
function TypeQuestions(props) {
|
|
13084
13165
|
const { type } = props;
|
|
13085
13166
|
if (type === "entity_reference") {
|
|
13086
|
-
return /* @__PURE__ */ (0,
|
|
13167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(EntityReferenceKindPicker, { value: props.allowedTypes, onChange: props.setAllowedTypes, locked: props.editing });
|
|
13087
13168
|
}
|
|
13088
13169
|
if (type === "relation") {
|
|
13089
|
-
return /* @__PURE__ */ (0,
|
|
13170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13090
13171
|
ReferenceBuilder,
|
|
13091
13172
|
{
|
|
13092
13173
|
tableId: props.tableId,
|
|
@@ -13099,21 +13180,21 @@ function TypeQuestions(props) {
|
|
|
13099
13180
|
}
|
|
13100
13181
|
);
|
|
13101
13182
|
}
|
|
13102
|
-
if (type === "rating" || type === "barcode") return /* @__PURE__ */ (0,
|
|
13183
|
+
if (type === "rating" || type === "barcode") return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx_runtime49.Fragment, { children: props.newer });
|
|
13103
13184
|
if (type === "status") {
|
|
13104
|
-
return /* @__PURE__ */ (0,
|
|
13185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
13105
13186
|
props.choiceList,
|
|
13106
13187
|
props.newer
|
|
13107
13188
|
] });
|
|
13108
13189
|
}
|
|
13109
13190
|
if (type === "select" || type === "multi_select") {
|
|
13110
|
-
return /* @__PURE__ */ (0,
|
|
13191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx_runtime49.Fragment, { children: props.choiceList });
|
|
13111
13192
|
}
|
|
13112
13193
|
if (type === "currency") {
|
|
13113
|
-
return /* @__PURE__ */ (0,
|
|
13114
|
-
/* @__PURE__ */ (0,
|
|
13115
|
-
/* @__PURE__ */ (0,
|
|
13116
|
-
|
|
13194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
13195
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "The currency" }),
|
|
13196
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13197
|
+
import_design_system44.BasicInput,
|
|
13117
13198
|
{
|
|
13118
13199
|
value: props.unit,
|
|
13119
13200
|
"aria-label": "The currency",
|
|
@@ -13124,9 +13205,9 @@ function TypeQuestions(props) {
|
|
|
13124
13205
|
] });
|
|
13125
13206
|
}
|
|
13126
13207
|
if (type === "datetime") {
|
|
13127
|
-
return /* @__PURE__ */ (0,
|
|
13128
|
-
/* @__PURE__ */ (0,
|
|
13129
|
-
|
|
13208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
13209
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13210
|
+
import_design_system44.Checkbox,
|
|
13130
13211
|
{
|
|
13131
13212
|
checked: props.withTime,
|
|
13132
13213
|
"aria-label": "Include a time of day",
|
|
@@ -13139,14 +13220,14 @@ function TypeQuestions(props) {
|
|
|
13139
13220
|
if (type === "lookup" || type === "rollup" || type === "count") {
|
|
13140
13221
|
const usable = props.relations;
|
|
13141
13222
|
if (usable.length === 0) {
|
|
13142
|
-
return /* @__PURE__ */ (0,
|
|
13143
|
-
}
|
|
13144
|
-
return /* @__PURE__ */ (0,
|
|
13145
|
-
/* @__PURE__ */ (0,
|
|
13146
|
-
/* @__PURE__ */ (0,
|
|
13147
|
-
/* @__PURE__ */ (0,
|
|
13148
|
-
/* @__PURE__ */ (0,
|
|
13149
|
-
/* @__PURE__ */ (0,
|
|
13223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No link, Person or File column yet." });
|
|
13224
|
+
}
|
|
13225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
13226
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13227
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: type !== "lookup" ? "Across the records in" : "Read it from" }),
|
|
13228
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.Select, { value: props.via, onValueChange: props.setVia, children: [
|
|
13229
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", "aria-label": type !== "lookup" ? "Across the records in" : "Read it from", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, { placeholder: "Choose a column" }) }),
|
|
13230
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectContent, { children: usable.map((f) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.SelectItem, { value: f.key, children: [
|
|
13150
13231
|
fieldName(f),
|
|
13151
13232
|
isBackLinkSource(f) ? BACK_LINK_SOURCE_SUFFIX : "",
|
|
13152
13233
|
sourceKindOf(f) === "person" ? " \u2014 a person" : sourceKindOf(f) === "file" ? " \u2014 a file" : "",
|
|
@@ -13154,7 +13235,7 @@ function TypeQuestions(props) {
|
|
|
13154
13235
|
] }, f.id)) })
|
|
13155
13236
|
] })
|
|
13156
13237
|
] }),
|
|
13157
|
-
type === "lookup" ? /* @__PURE__ */ (0,
|
|
13238
|
+
type === "lookup" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13158
13239
|
ValueOnTheOtherSide,
|
|
13159
13240
|
{
|
|
13160
13241
|
label: "The value to read",
|
|
@@ -13163,13 +13244,13 @@ function TypeQuestions(props) {
|
|
|
13163
13244
|
value: props.pick,
|
|
13164
13245
|
onChange: props.setPick
|
|
13165
13246
|
}
|
|
13166
|
-
) : type === "count" ? null : /* @__PURE__ */ (0,
|
|
13167
|
-
/* @__PURE__ */ (0,
|
|
13168
|
-
/* @__PURE__ */ (0,
|
|
13169
|
-
/* @__PURE__ */ (0,
|
|
13170
|
-
/* @__PURE__ */ (0,
|
|
13247
|
+
) : type === "count" ? null : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13248
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "What to work out" }),
|
|
13249
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.Select, { value: props.agg, onValueChange: (v) => props.setAgg(v), children: [
|
|
13250
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", "aria-label": "What to work out", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, {}) }),
|
|
13251
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectContent, { children: ROLLUP_OPERATIONS.map((row) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: row.value, children: row.label }, row.value)) })
|
|
13171
13252
|
] }),
|
|
13172
|
-
props.agg !== "count" ? /* @__PURE__ */ (0,
|
|
13253
|
+
props.agg !== "count" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13173
13254
|
ValueOnTheOtherSide,
|
|
13174
13255
|
{
|
|
13175
13256
|
label: "Of which value",
|
|
@@ -13185,22 +13266,22 @@ function TypeQuestions(props) {
|
|
|
13185
13266
|
}
|
|
13186
13267
|
if (type === "formula") {
|
|
13187
13268
|
if (props.others.length === 0) {
|
|
13188
|
-
return /* @__PURE__ */ (0,
|
|
13189
|
-
}
|
|
13190
|
-
return /* @__PURE__ */ (0,
|
|
13191
|
-
/* @__PURE__ */ (0,
|
|
13192
|
-
/* @__PURE__ */ (0,
|
|
13193
|
-
/* @__PURE__ */ (0,
|
|
13194
|
-
/* @__PURE__ */ (0,
|
|
13195
|
-
/* @__PURE__ */ (0,
|
|
13269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No other columns yet." });
|
|
13270
|
+
}
|
|
13271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
13272
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13273
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "What to do" }),
|
|
13274
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.Select, { value: props.formulaOp, onValueChange: props.setFormulaOp, children: [
|
|
13275
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", className: "max-w-[18rem]", "aria-label": "What to do", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, {}) }),
|
|
13276
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectContent, { children: FORMULA_OPERATIONS.map((row) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: row.value, children: row.label }, row.value)) })
|
|
13196
13277
|
] })
|
|
13197
13278
|
] }),
|
|
13198
|
-
/* @__PURE__ */ (0,
|
|
13199
|
-
/* @__PURE__ */ (0,
|
|
13200
|
-
/* @__PURE__ */ (0,
|
|
13279
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13280
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "Which columns" }),
|
|
13281
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex flex-wrap gap-1", children: props.others.map((f) => {
|
|
13201
13282
|
const picked = props.formulaFields.includes(f.id);
|
|
13202
|
-
return /* @__PURE__ */ (0,
|
|
13203
|
-
|
|
13283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13284
|
+
import_design_system44.Button,
|
|
13204
13285
|
{
|
|
13205
13286
|
type: "button",
|
|
13206
13287
|
size: "sm",
|
|
@@ -13214,10 +13295,10 @@ function TypeQuestions(props) {
|
|
|
13214
13295
|
);
|
|
13215
13296
|
}) })
|
|
13216
13297
|
] }),
|
|
13217
|
-
props.formulaOp === "concat" ? /* @__PURE__ */ (0,
|
|
13218
|
-
/* @__PURE__ */ (0,
|
|
13219
|
-
/* @__PURE__ */ (0,
|
|
13220
|
-
|
|
13298
|
+
props.formulaOp === "concat" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13299
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: FORMULA_SEPARATOR_LABEL }),
|
|
13300
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13301
|
+
import_design_system44.BasicInput,
|
|
13221
13302
|
{
|
|
13222
13303
|
value: props.formulaSeparator,
|
|
13223
13304
|
"aria-label": FORMULA_SEPARATOR_LABEL,
|
|
@@ -13266,26 +13347,26 @@ function RollupFilterQuestion({
|
|
|
13266
13347
|
onChange
|
|
13267
13348
|
}) {
|
|
13268
13349
|
const far = relation?.relation_target ?? null;
|
|
13269
|
-
const farFields = (0,
|
|
13270
|
-
const conditionFields = (0,
|
|
13350
|
+
const farFields = (0, import_react72.useFields)(far);
|
|
13351
|
+
const conditionFields = (0, import_react71.useMemo)(
|
|
13271
13352
|
() => (farFields.data ?? []).filter((f) => f.type !== "formula").map((f) => ({ id: f.id, key: f.key, label: fieldName(f), field: f })),
|
|
13272
13353
|
[farFields.data]
|
|
13273
13354
|
);
|
|
13274
|
-
const lastFar = (0,
|
|
13275
|
-
(0,
|
|
13355
|
+
const lastFar = (0, import_react71.useRef)(far);
|
|
13356
|
+
(0, import_react71.useEffect)(() => {
|
|
13276
13357
|
if (lastFar.current !== null && far !== lastFar.current && !editing) onChange(null);
|
|
13277
13358
|
lastFar.current = far;
|
|
13278
13359
|
}, [far, editing, onChange]);
|
|
13279
13360
|
if (!relation || !far) return null;
|
|
13280
|
-
return /* @__PURE__ */ (0,
|
|
13281
|
-
/* @__PURE__ */ (0,
|
|
13361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex flex-col gap-1", "data-records-rollup-filter": "", children: !conditionIsDrawable(value) ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
|
|
13362
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
13282
13363
|
rollupFilterLead(agg),
|
|
13283
13364
|
" ",
|
|
13284
13365
|
conditionInWords(value, conditionFields),
|
|
13285
13366
|
"."
|
|
13286
13367
|
] }),
|
|
13287
|
-
/* @__PURE__ */ (0,
|
|
13288
|
-
] }) : /* @__PURE__ */ (0,
|
|
13368
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onChange(null), children: "Clear" })
|
|
13369
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ChoiceListTermsContext.Provider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13289
13370
|
ConditionGroup,
|
|
13290
13371
|
{
|
|
13291
13372
|
lead: rollupFilterLead(agg),
|
|
@@ -13305,19 +13386,19 @@ function ValueOnTheOtherSide({
|
|
|
13305
13386
|
compact
|
|
13306
13387
|
}) {
|
|
13307
13388
|
const target = relation?.relation_target ?? null;
|
|
13308
|
-
const columns = (0,
|
|
13389
|
+
const columns = (0, import_react72.useFields)(target);
|
|
13309
13390
|
const declared = (columns.data ?? []).filter((f) => f.type !== "formula");
|
|
13310
|
-
const sample = (0,
|
|
13391
|
+
const sample = (0, import_react72.useRecords)(declared.length === 0 && !columns.loading ? target : null, { pageSize: 1 });
|
|
13311
13392
|
const carried = sample.data?.rows[0]?.document ?? null;
|
|
13312
13393
|
const offered = declared.length > 0 ? declared.map((f) => ({ key: f.key, name: fieldName(f) })) : Object.keys(carried ?? {}).map((key) => ({ key, name: (0, import_text_case7.humanizeIdentifier)(key) }));
|
|
13313
13394
|
const stillAsking = columns.loading || declared.length === 0 && sample.loading;
|
|
13314
|
-
const body = !relation ? /* @__PURE__ */ (0,
|
|
13315
|
-
/* @__PURE__ */ (0,
|
|
13316
|
-
/* @__PURE__ */ (0,
|
|
13395
|
+
const body = !relation ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Choose the column above first." }) : stillAsking ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : offered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No columns to read yet." }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.Select, { value, onValueChange: onChange, children: [
|
|
13396
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", "aria-label": label, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, { placeholder: "Choose a column" }) }),
|
|
13397
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectContent, { children: offered.map((column) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: column.key, children: column.name }, column.key)) })
|
|
13317
13398
|
] });
|
|
13318
|
-
if (compact) return /* @__PURE__ */ (0,
|
|
13319
|
-
return /* @__PURE__ */ (0,
|
|
13320
|
-
/* @__PURE__ */ (0,
|
|
13399
|
+
if (compact) return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "mt-1 flex flex-col gap-1", children: body });
|
|
13400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
13401
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", title: help, children: label }),
|
|
13321
13402
|
body
|
|
13322
13403
|
] });
|
|
13323
13404
|
}
|
|
@@ -13343,19 +13424,19 @@ function NewColumnDefault({
|
|
|
13343
13424
|
onChange
|
|
13344
13425
|
}) {
|
|
13345
13426
|
const none = "__none__";
|
|
13346
|
-
return /* @__PURE__ */ (0,
|
|
13347
|
-
/* @__PURE__ */ (0,
|
|
13348
|
-
type === "checkbox" ? /* @__PURE__ */ (0,
|
|
13349
|
-
/* @__PURE__ */ (0,
|
|
13350
|
-
/* @__PURE__ */ (0,
|
|
13351
|
-
] }) : type === "select" || type === "multi_select" || type === "status" ? /* @__PURE__ */ (0,
|
|
13352
|
-
/* @__PURE__ */ (0,
|
|
13353
|
-
/* @__PURE__ */ (0,
|
|
13354
|
-
/* @__PURE__ */ (0,
|
|
13355
|
-
choices.map((c) => /* @__PURE__ */ (0,
|
|
13427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", "data-records-field-default": "", "data-records-new-field-default": "", children: [
|
|
13428
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { htmlFor: "records-new-field-default", className: "text-xs", children: DEFAULT_LABEL }),
|
|
13429
|
+
type === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-2", children: [
|
|
13430
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Checkbox, { id: "records-new-field-default", "aria-label": DEFAULT_LABEL, checked: value === true, onCheckedChange: (on) => onChange(on === true ? true : null) }),
|
|
13431
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Ticked" })
|
|
13432
|
+
] }) : type === "select" || type === "multi_select" || type === "status" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.Select, { value: typeof value === "string" && choices.includes(value) ? value : none, onValueChange: (v) => onChange(v === none ? null : v), children: [
|
|
13433
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { id: "records-new-field-default", size: "sm", "aria-label": DEFAULT_LABEL, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, {}) }),
|
|
13434
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.SelectContent, { children: [
|
|
13435
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: none, children: "Nothing" }),
|
|
13436
|
+
choices.map((c) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: c, children: c }, c))
|
|
13356
13437
|
] })
|
|
13357
|
-
] }) : /* @__PURE__ */ (0,
|
|
13358
|
-
|
|
13438
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
13439
|
+
import_design_system44.BasicInput,
|
|
13359
13440
|
{
|
|
13360
13441
|
id: "records-new-field-default",
|
|
13361
13442
|
value: typeof value === "string" ? value : value === null || value === void 0 ? "" : String(value),
|
|
@@ -13371,7 +13452,7 @@ init_names();
|
|
|
13371
13452
|
init_plainWords();
|
|
13372
13453
|
var import_outbound_react7 = require("@ai-matrx/kit/outbound-react");
|
|
13373
13454
|
var import_outbound2 = require("@ai-matrx/kit/outbound");
|
|
13374
|
-
var
|
|
13455
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
13375
13456
|
function buttonPressWords(label, pressed) {
|
|
13376
13457
|
if (pressed.do === "open_url") return `${label} opened ${readableLink(pressed.url)}`;
|
|
13377
13458
|
if (pressed.do === "add_row") return `${label}: a row was added.`;
|
|
@@ -13432,23 +13513,23 @@ function waitingRunsOf(pressed) {
|
|
|
13432
13513
|
}
|
|
13433
13514
|
var stop2 = (event) => event.stopPropagation();
|
|
13434
13515
|
function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
13435
|
-
const client = (0,
|
|
13516
|
+
const client = (0, import_react74.useOptionalRecordsClient)();
|
|
13436
13517
|
const b = (0, import_records27.buttonOf)(field);
|
|
13437
|
-
const [busy, setBusy] = (0,
|
|
13438
|
-
const [said2, setSaid] = (0,
|
|
13439
|
-
const [settingUp, setSettingUp] = (0,
|
|
13440
|
-
const [opening, setOpening] = (0,
|
|
13441
|
-
const here = (0,
|
|
13518
|
+
const [busy, setBusy] = (0, import_react73.useState)(false);
|
|
13519
|
+
const [said2, setSaid] = (0, import_react73.useState)(null);
|
|
13520
|
+
const [settingUp, setSettingUp] = (0, import_react73.useState)(false);
|
|
13521
|
+
const [opening, setOpening] = (0, import_react73.useState)(false);
|
|
13522
|
+
const here = (0, import_react73.useContext)(OpenRecordHereContext);
|
|
13442
13523
|
const host = useRecordsUi();
|
|
13443
|
-
const addsTo = (0,
|
|
13444
|
-
const waitingOn = (0,
|
|
13445
|
-
(0,
|
|
13524
|
+
const addsTo = (0, import_react74.useTable)(b?.do === "add_row" ? b.table_id ?? field.entity_definition_id : null);
|
|
13525
|
+
const waitingOn = (0, import_react73.useRef)(0);
|
|
13526
|
+
(0, import_react73.useEffect)(() => () => void (waitingOn.current += 1), []);
|
|
13446
13527
|
if (!b) return null;
|
|
13447
13528
|
const color = (0, import_data_table6.isStyleColor)(b.color) ? import_data_table6.CHOICE_CHIP_CLASS[b.color] : import_data_table6.NEUTRAL_CHIP_CLASS;
|
|
13448
13529
|
if (beforeSave) {
|
|
13449
|
-
return /* @__PURE__ */ (0,
|
|
13450
|
-
/* @__PURE__ */ (0,
|
|
13451
|
-
/* @__PURE__ */ (0,
|
|
13530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-2", "data-records-button-before-save": field.key, children: [
|
|
13531
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system45.Button, { type: "button", size: "xs", variant: "outline", disabled: true, "aria-describedby": `${field.key}-before-save`, "data-records-button": field.key, className: (0, import_design_system45.cn)("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "truncate", children: b.label }) }),
|
|
13532
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { id: `${field.key}-before-save`, className: "whitespace-nowrap text-xs text-muted-foreground", children: "Save the record first" })
|
|
13452
13533
|
] });
|
|
13453
13534
|
}
|
|
13454
13535
|
const needs = (0, import_records27.buttonNeeds)(b);
|
|
@@ -13544,9 +13625,9 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13544
13625
|
}
|
|
13545
13626
|
setSaid({ kind: "ran", says: words });
|
|
13546
13627
|
};
|
|
13547
|
-
return /* @__PURE__ */ (0,
|
|
13548
|
-
/* @__PURE__ */ (0,
|
|
13549
|
-
|
|
13628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
13629
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
13630
|
+
import_design_system45.Popover,
|
|
13550
13631
|
{
|
|
13551
13632
|
open: said2 !== null,
|
|
13552
13633
|
onOpenChange: (open) => {
|
|
@@ -13556,8 +13637,8 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13556
13637
|
setSaid(null);
|
|
13557
13638
|
},
|
|
13558
13639
|
children: [
|
|
13559
|
-
/* @__PURE__ */ (0,
|
|
13560
|
-
|
|
13640
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system45.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
13641
|
+
import_design_system45.Button,
|
|
13561
13642
|
{
|
|
13562
13643
|
type: "button",
|
|
13563
13644
|
size: "xs",
|
|
@@ -13567,7 +13648,7 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13567
13648
|
"aria-busy": busy || opening || void 0,
|
|
13568
13649
|
"data-records-button-pending": busy || opening ? "" : void 0,
|
|
13569
13650
|
disabled: busy || opening,
|
|
13570
|
-
className: (0,
|
|
13651
|
+
className: (0, import_design_system45.cn)("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color, needs && "border-dashed opacity-80"),
|
|
13571
13652
|
onPointerDown: stop2,
|
|
13572
13653
|
onDoubleClick: stop2,
|
|
13573
13654
|
onClick: (event) => {
|
|
@@ -13575,24 +13656,24 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13575
13656
|
event.preventDefault();
|
|
13576
13657
|
void press();
|
|
13577
13658
|
},
|
|
13578
|
-
children: /* @__PURE__ */ (0,
|
|
13659
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: (0, import_design_system45.cn)("truncate", (busy || opening) && "matrx-shimmer"), children: b.label })
|
|
13579
13660
|
}
|
|
13580
13661
|
) }),
|
|
13581
|
-
/* @__PURE__ */ (0,
|
|
13582
|
-
said2?.kind === "refused" ? /* @__PURE__ */ (0,
|
|
13583
|
-
said2?.kind === "waiting" ? /* @__PURE__ */ (0,
|
|
13584
|
-
said2?.kind === "failed" ? /* @__PURE__ */ (0,
|
|
13585
|
-
said2?.kind === "public" ? /* @__PURE__ */ (0,
|
|
13586
|
-
said2?.kind === "ran" ? /* @__PURE__ */ (0,
|
|
13587
|
-
said2.value ? /* @__PURE__ */ (0,
|
|
13662
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_design_system45.PopoverContent, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop2, onPointerDown: stop2, "data-records-button-said": said2?.kind, children: [
|
|
13663
|
+
said2?.kind === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RefusalLine, { error: said2.error }) : null,
|
|
13664
|
+
said2?.kind === "waiting" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
|
|
13665
|
+
said2?.kind === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system45.ErrorBox, { as: "p", className: "break-words text-destructive", message: said2.says, origin: "records-ui/buttonCell", children: said2.says }) : null,
|
|
13666
|
+
said2?.kind === "public" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { children: "Buttons run for signed-in people." }) : null,
|
|
13667
|
+
said2?.kind === "ran" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "break-words", children: [
|
|
13668
|
+
said2.value ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(StructuredValueView, { structured: said2.value, label: b.label }) : null,
|
|
13588
13669
|
said2.says,
|
|
13589
13670
|
" ",
|
|
13590
|
-
said2.link ? /* @__PURE__ */ (0,
|
|
13671
|
+
said2.link ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_outbound_react7.OutboundLink, { href: said2.link, className: "text-primary underline", children: readableLink(said2.link) }) : null
|
|
13591
13672
|
] }) : null,
|
|
13592
|
-
said2?.kind === "needs" ? /* @__PURE__ */ (0,
|
|
13593
|
-
/* @__PURE__ */ (0,
|
|
13594
|
-
tableId ? /* @__PURE__ */ (0,
|
|
13595
|
-
|
|
13673
|
+
said2?.kind === "needs" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
13674
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { children: said2.says }),
|
|
13675
|
+
tableId ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
13676
|
+
import_design_system45.Button,
|
|
13596
13677
|
{
|
|
13597
13678
|
type: "button",
|
|
13598
13679
|
size: "sm",
|
|
@@ -13612,12 +13693,12 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
|
13612
13693
|
]
|
|
13613
13694
|
}
|
|
13614
13695
|
),
|
|
13615
|
-
settingUp && tableId ? /* @__PURE__ */ (0,
|
|
13616
|
-
/* @__PURE__ */ (0,
|
|
13617
|
-
/* @__PURE__ */ (0,
|
|
13618
|
-
/* @__PURE__ */ (0,
|
|
13696
|
+
settingUp && tableId ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system45.Dialog, { open: true, onOpenChange: (open) => open ? null : setSettingUp(false), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_design_system45.DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", onClick: stop2, onPointerDown: stop2, children: [
|
|
13697
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_design_system45.DialogHeader, { children: [
|
|
13698
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system45.DialogTitle, { children: `Column settings \xB7 ${fieldName(field)}` }),
|
|
13699
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_design_system45.DialogDescription, { className: "sr-only", children: "What the button does" })
|
|
13619
13700
|
] }),
|
|
13620
|
-
/* @__PURE__ */ (0,
|
|
13701
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(FieldEditor, { tableId, field, onSaved: () => setSettingUp(false), onCancel: () => setSettingUp(false) })
|
|
13621
13702
|
] }) }) : null
|
|
13622
13703
|
] });
|
|
13623
13704
|
}
|
|
@@ -13628,9 +13709,9 @@ init_PickOrAdd();
|
|
|
13628
13709
|
init_Refusal();
|
|
13629
13710
|
|
|
13630
13711
|
// src/FloatingRefusal.tsx
|
|
13631
|
-
var
|
|
13712
|
+
var import_react75 = require("react");
|
|
13632
13713
|
var import_react_dom = require("react-dom");
|
|
13633
|
-
var
|
|
13714
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
13634
13715
|
var GAP = 4;
|
|
13635
13716
|
function placeFor(anchor, note) {
|
|
13636
13717
|
const a = anchor.getBoundingClientRect();
|
|
@@ -13646,11 +13727,11 @@ function placeFor(anchor, note) {
|
|
|
13646
13727
|
return { position: "fixed", top: a.top + (a.height - height) / 2, left: Math.max(a.left, a.right - width - 8) };
|
|
13647
13728
|
}
|
|
13648
13729
|
function FloatingRefusal({ text, why }) {
|
|
13649
|
-
const spot = (0,
|
|
13650
|
-
const note = (0,
|
|
13651
|
-
const [style, setStyle] = (0,
|
|
13652
|
-
const [floating, setFloating] = (0,
|
|
13653
|
-
(0,
|
|
13730
|
+
const spot = (0, import_react75.useRef)(null);
|
|
13731
|
+
const note = (0, import_react75.useRef)(null);
|
|
13732
|
+
const [style, setStyle] = (0, import_react75.useState)(null);
|
|
13733
|
+
const [floating, setFloating] = (0, import_react75.useState)(false);
|
|
13734
|
+
(0, import_react75.useLayoutEffect)(() => {
|
|
13654
13735
|
const here = spot.current;
|
|
13655
13736
|
if (!here) return;
|
|
13656
13737
|
const anchor = here.closest("[data-matrx-cell-editor]");
|
|
@@ -13668,12 +13749,12 @@ function FloatingRefusal({ text, why }) {
|
|
|
13668
13749
|
};
|
|
13669
13750
|
}, [text]);
|
|
13670
13751
|
if (!floating) {
|
|
13671
|
-
return /* @__PURE__ */ (0,
|
|
13752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { ref: spot, "data-records-typed-refusal": "", role: "status", title: why, className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: text });
|
|
13672
13753
|
}
|
|
13673
|
-
return /* @__PURE__ */ (0,
|
|
13674
|
-
/* @__PURE__ */ (0,
|
|
13754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
13755
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { ref: spot, "data-records-refusal-anchor": "", hidden: true }),
|
|
13675
13756
|
typeof document === "undefined" ? null : (0, import_react_dom.createPortal)(
|
|
13676
|
-
/* @__PURE__ */ (0,
|
|
13757
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13677
13758
|
"span",
|
|
13678
13759
|
{
|
|
13679
13760
|
ref: note,
|
|
@@ -13695,10 +13776,10 @@ function FloatingRefusal({ text, why }) {
|
|
|
13695
13776
|
init_refusals();
|
|
13696
13777
|
|
|
13697
13778
|
// src/formatControls.tsx
|
|
13698
|
-
var
|
|
13699
|
-
var
|
|
13779
|
+
var import_react76 = require("react");
|
|
13780
|
+
var import_design_system46 = require("@ai-matrx/design-system");
|
|
13700
13781
|
var import_field_formats12 = require("@ai-matrx/design-system/field-formats");
|
|
13701
|
-
var
|
|
13782
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
13702
13783
|
var TYPED_NUMBERS = /* @__PURE__ */ new Set(["currency", "percent", "progress", "decimal", "duration", "file_size", "integer"]);
|
|
13703
13784
|
function scaled(format) {
|
|
13704
13785
|
return (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction";
|
|
@@ -13715,14 +13796,14 @@ function keptValue(format, raw) {
|
|
|
13715
13796
|
return parsed;
|
|
13716
13797
|
}
|
|
13717
13798
|
function NumberInFormat({ format, value, onChange, disabled, id }) {
|
|
13718
|
-
const [text, setText] = (0,
|
|
13719
|
-
const lastSent = (0,
|
|
13720
|
-
(0,
|
|
13799
|
+
const [text, setText] = (0, import_react76.useState)(() => typedText(format, value));
|
|
13800
|
+
const lastSent = (0, import_react76.useRef)(void 0);
|
|
13801
|
+
(0, import_react76.useEffect)(() => {
|
|
13721
13802
|
if (value === lastSent.current) return;
|
|
13722
13803
|
setText(typedText(format, value));
|
|
13723
13804
|
}, [value, format]);
|
|
13724
|
-
return /* @__PURE__ */ (0,
|
|
13725
|
-
|
|
13805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
13806
|
+
import_design_system46.BasicInput,
|
|
13726
13807
|
{
|
|
13727
13808
|
id,
|
|
13728
13809
|
inputMode: "decimal",
|
|
@@ -13746,22 +13827,22 @@ function formatControl(args) {
|
|
|
13746
13827
|
const look = fieldLookFor(def.id);
|
|
13747
13828
|
if (look?.Editor) {
|
|
13748
13829
|
const Editor = look.Editor;
|
|
13749
|
-
return /* @__PURE__ */ (0,
|
|
13830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Editor, { value, format, onChange, disabled, id, label });
|
|
13750
13831
|
}
|
|
13751
13832
|
const text = value === null || value === void 0 ? "" : String(value);
|
|
13752
13833
|
const commit = (raw) => onChange(raw === "" ? null : (0, import_field_formats12.parseFieldInput)(raw, format));
|
|
13753
13834
|
if (def.id === "rating") {
|
|
13754
|
-
return disabled ? /* @__PURE__ */ (0,
|
|
13835
|
+
return disabled ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { id, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
|
|
13755
13836
|
}
|
|
13756
|
-
if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ (0,
|
|
13837
|
+
if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NumberInFormat, { ...args });
|
|
13757
13838
|
switch (def.editor) {
|
|
13758
13839
|
// A TIME OF DAY is not this file's: `FieldControl` draws the typed box and its helper
|
|
13759
13840
|
// (`TypedWordsControl`), never the browser's time control (grids review 3, 2026-09-30).
|
|
13760
13841
|
case "email":
|
|
13761
13842
|
case "url":
|
|
13762
13843
|
case "tel":
|
|
13763
|
-
return /* @__PURE__ */ (0,
|
|
13764
|
-
|
|
13844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
13845
|
+
import_design_system46.BasicInput,
|
|
13765
13846
|
{
|
|
13766
13847
|
id,
|
|
13767
13848
|
type: def.editor,
|
|
@@ -13773,9 +13854,9 @@ function formatControl(args) {
|
|
|
13773
13854
|
}
|
|
13774
13855
|
);
|
|
13775
13856
|
case "color":
|
|
13776
|
-
return /* @__PURE__ */ (0,
|
|
13777
|
-
/* @__PURE__ */ (0,
|
|
13778
|
-
|
|
13857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
13858
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
13859
|
+
import_design_system46.BasicInput,
|
|
13779
13860
|
{
|
|
13780
13861
|
id: `${id}-swatch`,
|
|
13781
13862
|
type: "color",
|
|
@@ -13786,20 +13867,20 @@ function formatControl(args) {
|
|
|
13786
13867
|
onChange: (e) => commit(e.target.value)
|
|
13787
13868
|
}
|
|
13788
13869
|
),
|
|
13789
|
-
/* @__PURE__ */ (0,
|
|
13870
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.BasicInput, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
|
|
13790
13871
|
] });
|
|
13791
13872
|
case "textarea":
|
|
13792
|
-
return /* @__PURE__ */ (0,
|
|
13873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.BasicTextarea, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
|
|
13793
13874
|
default:
|
|
13794
13875
|
return null;
|
|
13795
13876
|
}
|
|
13796
13877
|
}
|
|
13797
13878
|
|
|
13798
13879
|
// src/typedDateHelper.tsx
|
|
13799
|
-
var
|
|
13800
|
-
var
|
|
13880
|
+
var import_react77 = require("react");
|
|
13881
|
+
var import_design_system47 = require("@ai-matrx/design-system");
|
|
13801
13882
|
var import_records28 = require("@ai-matrx/records");
|
|
13802
|
-
var
|
|
13883
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
13803
13884
|
var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
13804
13885
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
13805
13886
|
function pad(n) {
|
|
@@ -13828,15 +13909,15 @@ function wordsFor2(kind, day, time) {
|
|
|
13828
13909
|
}
|
|
13829
13910
|
var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
|
|
13830
13911
|
function CalendarGlyph() {
|
|
13831
|
-
return /* @__PURE__ */ (0,
|
|
13832
|
-
/* @__PURE__ */ (0,
|
|
13833
|
-
/* @__PURE__ */ (0,
|
|
13912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
13913
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
13914
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
13834
13915
|
] });
|
|
13835
13916
|
}
|
|
13836
13917
|
function ClockGlyph() {
|
|
13837
|
-
return /* @__PURE__ */ (0,
|
|
13838
|
-
/* @__PURE__ */ (0,
|
|
13839
|
-
/* @__PURE__ */ (0,
|
|
13918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
13919
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
13920
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("path", { d: "M12 6v6l4 2" })
|
|
13840
13921
|
] });
|
|
13841
13922
|
}
|
|
13842
13923
|
function TypedDateHelper({
|
|
@@ -13847,12 +13928,12 @@ function TypedDateHelper({
|
|
|
13847
13928
|
onPicked,
|
|
13848
13929
|
startOpen = false
|
|
13849
13930
|
}) {
|
|
13850
|
-
const [open, setOpen] = (0,
|
|
13931
|
+
const [open, setOpen] = (0, import_react77.useState)(startOpen);
|
|
13851
13932
|
const held = readBox(text, kind);
|
|
13852
13933
|
usePersonTimeZone();
|
|
13853
13934
|
const today = personWallNow();
|
|
13854
13935
|
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);
|
|
13855
|
-
const [month, setMonth] = (0,
|
|
13936
|
+
const [month, setMonth] = (0, import_react77.useState)(null);
|
|
13856
13937
|
const shown2 = month ?? { y: start.getFullYear(), m: start.getMonth() };
|
|
13857
13938
|
const first = new Date(shown2.y, shown2.m, 1).getDay();
|
|
13858
13939
|
const days = new Date(shown2.y, shown2.m + 1, 0).getDate();
|
|
@@ -13877,8 +13958,8 @@ function TypedDateHelper({
|
|
|
13877
13958
|
const at = new Date(shown2.y, shown2.m + by, 1);
|
|
13878
13959
|
setMonth({ y: at.getFullYear(), m: at.getMonth() });
|
|
13879
13960
|
};
|
|
13880
|
-
return /* @__PURE__ */ (0,
|
|
13881
|
-
/* @__PURE__ */ (0,
|
|
13961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_design_system47.Popover, { open, onOpenChange: setOpen, children: [
|
|
13962
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_design_system47.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13882
13963
|
"button",
|
|
13883
13964
|
{
|
|
13884
13965
|
type: "button",
|
|
@@ -13887,11 +13968,11 @@ function TypedDateHelper({
|
|
|
13887
13968
|
"aria-label": kind === "time" ? `Pick a time for ${label}` : `Pick a date for ${label}`,
|
|
13888
13969
|
title: kind === "time" ? "Pick a time" : "Pick a date",
|
|
13889
13970
|
className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
13890
|
-
children: kind === "time" ? /* @__PURE__ */ (0,
|
|
13971
|
+
children: kind === "time" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ClockGlyph, {}) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(CalendarGlyph, {})
|
|
13891
13972
|
}
|
|
13892
13973
|
) }),
|
|
13893
|
-
/* @__PURE__ */ (0,
|
|
13894
|
-
|
|
13974
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13975
|
+
import_design_system47.PopoverContent,
|
|
13895
13976
|
{
|
|
13896
13977
|
sizing: "content",
|
|
13897
13978
|
align: "start",
|
|
@@ -13900,29 +13981,29 @@ function TypedDateHelper({
|
|
|
13900
13981
|
"data-records-date-helper-panel": "",
|
|
13901
13982
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
13902
13983
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
13903
|
-
children: /* @__PURE__ */ (0,
|
|
13904
|
-
kind === "time" ? null : /* @__PURE__ */ (0,
|
|
13905
|
-
/* @__PURE__ */ (0,
|
|
13906
|
-
/* @__PURE__ */ (0,
|
|
13907
|
-
/* @__PURE__ */ (0,
|
|
13984
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex gap-2", children: [
|
|
13985
|
+
kind === "time" ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
|
|
13986
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between text-xs font-medium", children: [
|
|
13987
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
|
|
13988
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { children: [
|
|
13908
13989
|
MONTHS[shown2.m],
|
|
13909
13990
|
" ",
|
|
13910
13991
|
shown2.y
|
|
13911
13992
|
] }),
|
|
13912
|
-
/* @__PURE__ */ (0,
|
|
13993
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
|
|
13913
13994
|
] }),
|
|
13914
|
-
/* @__PURE__ */ (0,
|
|
13915
|
-
WEEK.map((w) => /* @__PURE__ */ (0,
|
|
13995
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
|
|
13996
|
+
WEEK.map((w) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-muted-foreground", children: w }, w)),
|
|
13916
13997
|
cells.map((d, i) => {
|
|
13917
|
-
if (d === null) return /* @__PURE__ */ (0,
|
|
13998
|
+
if (d === null) return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", {}, `blank-${i}`);
|
|
13918
13999
|
const key = `${shown2.y}-${pad(shown2.m + 1)}-${pad(d)}`;
|
|
13919
|
-
return /* @__PURE__ */ (0,
|
|
14000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13920
14001
|
"button",
|
|
13921
14002
|
{
|
|
13922
14003
|
type: "button",
|
|
13923
14004
|
...keepFocus,
|
|
13924
14005
|
"data-records-date-helper-day": key,
|
|
13925
|
-
className: (0,
|
|
14006
|
+
className: (0, import_design_system47.cn)(
|
|
13926
14007
|
"h-6 w-6 rounded tabular-nums hover:bg-muted",
|
|
13927
14008
|
key === held.day ? "bg-primary text-primary-foreground hover:bg-primary" : "",
|
|
13928
14009
|
key === todayKey && key !== held.day ? "ring-1 ring-ring" : ""
|
|
@@ -13935,13 +14016,13 @@ function TypedDateHelper({
|
|
|
13935
14016
|
})
|
|
13936
14017
|
] })
|
|
13937
14018
|
] }),
|
|
13938
|
-
kind === "date" ? null : /* @__PURE__ */ (0,
|
|
14019
|
+
kind === "date" ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
13939
14020
|
"button",
|
|
13940
14021
|
{
|
|
13941
14022
|
type: "button",
|
|
13942
14023
|
...keepFocus,
|
|
13943
14024
|
"data-records-date-helper-time": `${pad(t.h)}:${pad(t.m)}`,
|
|
13944
|
-
className: (0,
|
|
14025
|
+
className: (0, import_design_system47.cn)(
|
|
13945
14026
|
"whitespace-nowrap rounded px-2 py-0.5 text-left tabular-nums hover:bg-muted",
|
|
13946
14027
|
held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
|
|
13947
14028
|
),
|
|
@@ -13959,7 +14040,7 @@ function TypedDateHelper({
|
|
|
13959
14040
|
// src/editors.tsx
|
|
13960
14041
|
init_choiceNudge();
|
|
13961
14042
|
init_choiceLooks();
|
|
13962
|
-
var
|
|
14043
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
13963
14044
|
var CHOICE_EDITOR_ADDS_WHAT_IS_TYPED = true;
|
|
13964
14045
|
function isChoiceAddition(value) {
|
|
13965
14046
|
return typeof value === "object" && value !== null && value.addingChoices === true;
|
|
@@ -13989,12 +14070,12 @@ function ChoiceAskButtons({
|
|
|
13989
14070
|
onCancel,
|
|
13990
14071
|
busy
|
|
13991
14072
|
}) {
|
|
13992
|
-
return /* @__PURE__ */ (0,
|
|
13993
|
-
/* @__PURE__ */ (0,
|
|
13994
|
-
/* @__PURE__ */ (0,
|
|
13995
|
-
/* @__PURE__ */ (0,
|
|
13996
|
-
keepOffered ? /* @__PURE__ */ (0,
|
|
13997
|
-
/* @__PURE__ */ (0,
|
|
14073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { "data-records-choice-ask": "", "data-records-cell-note": "", role: "group", "aria-label": choiceAskSentence(field, words), className: "flex flex-col gap-1", children: [
|
|
14074
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field, words) }),
|
|
14075
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
14076
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.Button, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
|
|
14077
|
+
keepOffered ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
|
|
14078
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
|
|
13998
14079
|
] })
|
|
13999
14080
|
] });
|
|
14000
14081
|
}
|
|
@@ -14095,23 +14176,23 @@ function openingText(field, value) {
|
|
|
14095
14176
|
return format ? typedText(format, value) : String(value);
|
|
14096
14177
|
}
|
|
14097
14178
|
function ReadsAsNote({ typed, always, children }) {
|
|
14098
|
-
const note = (0,
|
|
14099
|
-
const [repeats, setRepeats] = (0,
|
|
14100
|
-
(0,
|
|
14179
|
+
const note = (0, import_react78.useRef)(null);
|
|
14180
|
+
const [repeats, setRepeats] = (0, import_react78.useState)(false);
|
|
14181
|
+
(0, import_react78.useLayoutEffect)(() => {
|
|
14101
14182
|
if (always) return;
|
|
14102
14183
|
const words = (t) => (t ?? "").replace(/^Reads as/, "").replace(/\s+/g, "").toLowerCase();
|
|
14103
14184
|
setRepeats(words(note.current?.textContent) === words(typed));
|
|
14104
14185
|
}, [typed, always]);
|
|
14105
14186
|
if (repeats) return null;
|
|
14106
|
-
return /* @__PURE__ */ (0,
|
|
14187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
|
|
14107
14188
|
}
|
|
14108
14189
|
function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCancel }) {
|
|
14109
|
-
const client = (0,
|
|
14190
|
+
const client = (0, import_react79.useOptionalRecordsClient)();
|
|
14110
14191
|
const kind = String(editorKindFor(field));
|
|
14111
14192
|
const needsChoices = kind === "select" || kind === "multi_select";
|
|
14112
14193
|
const nudge = useChoiceNudge(needsChoices);
|
|
14113
|
-
const [choices, setChoices] = (0,
|
|
14114
|
-
(0,
|
|
14194
|
+
const [choices, setChoices] = (0, import_react78.useState)(null);
|
|
14195
|
+
(0, import_react78.useEffect)(() => {
|
|
14115
14196
|
if (!needsChoices || !client) return;
|
|
14116
14197
|
let cancelled = false;
|
|
14117
14198
|
void (0, askOnce_exports.fieldOptionsOnce)(client, field.id).then((result) => {
|
|
@@ -14121,7 +14202,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
14121
14202
|
cancelled = true;
|
|
14122
14203
|
};
|
|
14123
14204
|
}, [client, field.id, needsChoices]);
|
|
14124
|
-
(0,
|
|
14205
|
+
(0, import_react78.useEffect)(() => {
|
|
14125
14206
|
if (choices && nudge && value.judged === null) onChange({ ...value, judged: judgeTyped(field, value.text, choices, nudge) });
|
|
14126
14207
|
}, [choices, nudge, value, field, onChange]);
|
|
14127
14208
|
const judged = value.judged;
|
|
@@ -14133,8 +14214,8 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
14133
14214
|
judged: judgeTyped(field, text, needsChoices ? choices : void 0, needsChoices ? nudge : void 0),
|
|
14134
14215
|
...value.openedAs !== void 0 ? { openedAs: value.openedAs } : {}
|
|
14135
14216
|
});
|
|
14136
|
-
const box = /* @__PURE__ */ (0,
|
|
14137
|
-
|
|
14217
|
+
const box = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14218
|
+
import_design_system48.BasicInput,
|
|
14138
14219
|
{
|
|
14139
14220
|
id,
|
|
14140
14221
|
value: value.text,
|
|
@@ -14145,16 +14226,16 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
14145
14226
|
onChange: (e) => retype(e.target.value)
|
|
14146
14227
|
}
|
|
14147
14228
|
);
|
|
14148
|
-
return /* @__PURE__ */ (0,
|
|
14149
|
-
helper && !disabled ? /* @__PURE__ */ (0,
|
|
14229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
|
|
14230
|
+
helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
|
|
14150
14231
|
box,
|
|
14151
|
-
/* @__PURE__ */ (0,
|
|
14232
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field), onPicked: onCommit, startOpen: value.openedAs !== void 0 })
|
|
14152
14233
|
] }) : box,
|
|
14153
|
-
judged === null ? /* @__PURE__ */ (0,
|
|
14234
|
+
judged === null ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
|
|
14154
14235
|
"Reading ",
|
|
14155
14236
|
fieldName(field),
|
|
14156
14237
|
"'s choices\u2026"
|
|
14157
|
-
] }) : "ask" in judged ? /* @__PURE__ */ (0,
|
|
14238
|
+
] }) : "ask" in judged ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14158
14239
|
ChoiceAskButtons,
|
|
14159
14240
|
{
|
|
14160
14241
|
field,
|
|
@@ -14170,10 +14251,10 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
14170
14251
|
},
|
|
14171
14252
|
onCancel: () => onCancel?.()
|
|
14172
14253
|
}
|
|
14173
|
-
) : "refusal" in judged ? /* @__PURE__ */ (0,
|
|
14174
|
-
/* @__PURE__ */ (0,
|
|
14175
|
-
judged.cancelOnly && onCancel ? /* @__PURE__ */ (0,
|
|
14176
|
-
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ (0,
|
|
14254
|
+
) : "refusal" in judged ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
14255
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FloatingRefusal, { text: judged.refusal, why: "why" in judged ? judged.why : void 0 }),
|
|
14256
|
+
judged.cancelOnly && onCancel ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "data-records-cell-note": "", "data-records-choice-ask": "", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
|
|
14257
|
+
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(ReadsAsNote, { typed: value.text, always: isChoiceAddition(judged.value), children: [
|
|
14177
14258
|
isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field)}. ` : null,
|
|
14178
14259
|
"Reads as",
|
|
14179
14260
|
" ",
|
|
@@ -14184,7 +14265,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
14184
14265
|
}).join(", ")
|
|
14185
14266
|
) : (() => {
|
|
14186
14267
|
const shown2 = format ?? (kind === "datetime" ? { id: carriesTimeOfDay(field, judged.value) ? "datetime" : "date" } : void 0);
|
|
14187
|
-
return shown2 ? /* @__PURE__ */ (0,
|
|
14268
|
+
return shown2 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
|
|
14188
14269
|
})()
|
|
14189
14270
|
] }, value.text)
|
|
14190
14271
|
] });
|
|
@@ -14197,34 +14278,34 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14197
14278
|
const host = useRecordsUi();
|
|
14198
14279
|
const kind = editorKindFor(field);
|
|
14199
14280
|
const inputId = id ?? `field-${field.key}`;
|
|
14200
|
-
const ownDetails = (0,
|
|
14201
|
-
if (isTypedDraft(value)) return /* @__PURE__ */ (0,
|
|
14202
|
-
if (isSignatureField(field)) return /* @__PURE__ */ (0,
|
|
14203
|
-
if ((0, import_records29.isButtonField)(field)) return /* @__PURE__ */ (0,
|
|
14281
|
+
const ownDetails = (0, import_react79.useOptionalRecordsClient)() === null;
|
|
14282
|
+
if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
14283
|
+
if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
14284
|
+
if ((0, import_records29.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ButtonValue, { field, recordId: recordId ?? null, beforeSave: !recordId });
|
|
14204
14285
|
const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
|
|
14205
14286
|
if (newerControl !== void 0) return newerControl;
|
|
14206
14287
|
const format = formatForField(field);
|
|
14207
|
-
if (format && format.id === "time") return /* @__PURE__ */ (0,
|
|
14288
|
+
if (format && format.id === "time") return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
|
|
14208
14289
|
if (format && !FORMAT_BLIND_KINDS.has(String(kind))) {
|
|
14209
14290
|
const own3 = formatControl({ format, value, onChange, disabled, id: inputId, label: fieldName(field), ownDetails });
|
|
14210
14291
|
if (own3) return own3;
|
|
14211
14292
|
}
|
|
14212
14293
|
if ((kind === "text" || kind === "long_text") && typeof value === "string" && /^\s*(?:\[|\{|```json)/.test(value)) {
|
|
14213
|
-
return /* @__PURE__ */ (0,
|
|
14294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(StructuredTextControl, { field, value, onChange, disabled, id: inputId, rows: asForm ? 8 : 3 });
|
|
14214
14295
|
}
|
|
14215
14296
|
switch (kind) {
|
|
14216
14297
|
case "formula":
|
|
14217
14298
|
case "lookup":
|
|
14218
14299
|
case "rollup":
|
|
14219
|
-
return /* @__PURE__ */ (0,
|
|
14300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
|
|
14220
14301
|
value === null || value === void 0 ? "\u2014" : String(value),
|
|
14221
|
-
/* @__PURE__ */ (0,
|
|
14302
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "ml-2 italic", children: [
|
|
14222
14303
|
fieldName(field),
|
|
14223
14304
|
" is calculated, so it cannot be typed in"
|
|
14224
14305
|
] })
|
|
14225
14306
|
] });
|
|
14226
14307
|
case "json":
|
|
14227
|
-
return /* @__PURE__ */ (0,
|
|
14308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(JsonControl, { field, value, onChange, disabled, id: inputId });
|
|
14228
14309
|
case "long_text":
|
|
14229
14310
|
if (host.textBox) {
|
|
14230
14311
|
return host.textBox({
|
|
@@ -14237,8 +14318,8 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14237
14318
|
disabled
|
|
14238
14319
|
});
|
|
14239
14320
|
}
|
|
14240
|
-
return /* @__PURE__ */ (0,
|
|
14241
|
-
|
|
14321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14322
|
+
import_design_system48.BasicTextarea,
|
|
14242
14323
|
{
|
|
14243
14324
|
id: inputId,
|
|
14244
14325
|
rows: 3,
|
|
@@ -14250,8 +14331,8 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14250
14331
|
case "number":
|
|
14251
14332
|
case "currency":
|
|
14252
14333
|
case "percent":
|
|
14253
|
-
return /* @__PURE__ */ (0,
|
|
14254
|
-
|
|
14334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14335
|
+
import_design_system48.BasicInput,
|
|
14255
14336
|
{
|
|
14256
14337
|
id: inputId,
|
|
14257
14338
|
type: "number",
|
|
@@ -14263,12 +14344,12 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14263
14344
|
}
|
|
14264
14345
|
);
|
|
14265
14346
|
case "datetime":
|
|
14266
|
-
return /* @__PURE__ */ (0,
|
|
14347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
|
|
14267
14348
|
case "email":
|
|
14268
14349
|
case "phone":
|
|
14269
14350
|
case "url":
|
|
14270
|
-
return /* @__PURE__ */ (0,
|
|
14271
|
-
|
|
14351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14352
|
+
import_design_system48.BasicInput,
|
|
14272
14353
|
{
|
|
14273
14354
|
id: inputId,
|
|
14274
14355
|
type: kind === "email" ? "email" : kind === "phone" ? "tel" : "url",
|
|
@@ -14280,25 +14361,25 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14280
14361
|
}
|
|
14281
14362
|
);
|
|
14282
14363
|
case "checkbox":
|
|
14283
|
-
return /* @__PURE__ */ (0,
|
|
14364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CheckboxControl, { field, value, onChange, disabled, id: inputId });
|
|
14284
14365
|
case "select":
|
|
14285
14366
|
case "multi_select":
|
|
14286
|
-
return /* @__PURE__ */ (0,
|
|
14367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(OptionControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm, onChosen });
|
|
14287
14368
|
case "member":
|
|
14288
|
-
return /* @__PURE__ */ (0,
|
|
14369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PersonPicker, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
14289
14370
|
case "entity_reference":
|
|
14290
|
-
return /* @__PURE__ */ (0,
|
|
14371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(EntityReferenceControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
14291
14372
|
case "attachment":
|
|
14292
14373
|
if (hostTakesFiles(host)) {
|
|
14293
|
-
return /* @__PURE__ */ (0,
|
|
14374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
|
|
14294
14375
|
}
|
|
14295
|
-
return /* @__PURE__ */ (0,
|
|
14376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId, excludeId: recordId });
|
|
14296
14377
|
case "relation":
|
|
14297
|
-
return /* @__PURE__ */ (0,
|
|
14378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel, excludeId: recordId });
|
|
14298
14379
|
default:
|
|
14299
14380
|
if (typeof value === "boolean" || field.config?.["kind"] === "boolean") {
|
|
14300
|
-
return /* @__PURE__ */ (0,
|
|
14301
|
-
|
|
14381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14382
|
+
import_design_system48.Checkbox,
|
|
14302
14383
|
{
|
|
14303
14384
|
id: inputId,
|
|
14304
14385
|
checked: value === true,
|
|
@@ -14307,8 +14388,8 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14307
14388
|
}
|
|
14308
14389
|
);
|
|
14309
14390
|
}
|
|
14310
|
-
return /* @__PURE__ */ (0,
|
|
14311
|
-
|
|
14391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14392
|
+
import_design_system48.BasicInput,
|
|
14312
14393
|
{
|
|
14313
14394
|
id: inputId,
|
|
14314
14395
|
...ownDetails && isPersonsName(field) ? { autoComplete: "name" } : {},
|
|
@@ -14320,11 +14401,11 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
14320
14401
|
}
|
|
14321
14402
|
}
|
|
14322
14403
|
function TypedWordsControl({ field, value, onChange, disabled, id }) {
|
|
14323
|
-
const [text, setText] = (0,
|
|
14324
|
-
const [refusal, setRefusal] = (0,
|
|
14325
|
-
const [why, setWhy] = (0,
|
|
14326
|
-
const sent = (0,
|
|
14327
|
-
(0,
|
|
14404
|
+
const [text, setText] = (0, import_react78.useState)(() => openingText(field, value));
|
|
14405
|
+
const [refusal, setRefusal] = (0, import_react78.useState)(null);
|
|
14406
|
+
const [why, setWhy] = (0, import_react78.useState)(void 0);
|
|
14407
|
+
const sent = (0, import_react78.useRef)(value);
|
|
14408
|
+
(0, import_react78.useEffect)(() => {
|
|
14328
14409
|
if (value === sent.current) return;
|
|
14329
14410
|
sent.current = value;
|
|
14330
14411
|
setText(openingText(field, value));
|
|
@@ -14343,10 +14424,10 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
|
|
|
14343
14424
|
setWhy("why" in judged ? judged.why : void 0);
|
|
14344
14425
|
}
|
|
14345
14426
|
};
|
|
14346
|
-
return /* @__PURE__ */ (0,
|
|
14347
|
-
/* @__PURE__ */ (0,
|
|
14348
|
-
/* @__PURE__ */ (0,
|
|
14349
|
-
|
|
14427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "flex flex-col gap-0.5", children: [
|
|
14428
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "flex min-w-0 items-center gap-0.5", children: [
|
|
14429
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14430
|
+
import_design_system48.BasicInput,
|
|
14350
14431
|
{
|
|
14351
14432
|
id,
|
|
14352
14433
|
value: text,
|
|
@@ -14362,9 +14443,9 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
|
|
|
14362
14443
|
}
|
|
14363
14444
|
}
|
|
14364
14445
|
),
|
|
14365
|
-
helper && !disabled ? /* @__PURE__ */ (0,
|
|
14446
|
+
helper && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field) }) : null
|
|
14366
14447
|
] }),
|
|
14367
|
-
refusal ? /* @__PURE__ */ (0,
|
|
14448
|
+
refusal ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FloatingRefusal, { text: refusal, why }) : null
|
|
14368
14449
|
] });
|
|
14369
14450
|
}
|
|
14370
14451
|
function typedDatePlaceholder(helper) {
|
|
@@ -14375,9 +14456,9 @@ function typedDatePlaceholder(helper) {
|
|
|
14375
14456
|
}
|
|
14376
14457
|
function CheckboxControl({ field, value, onChange, disabled, id }) {
|
|
14377
14458
|
const unanswered = value === null || value === void 0;
|
|
14378
|
-
return /* @__PURE__ */ (0,
|
|
14379
|
-
/* @__PURE__ */ (0,
|
|
14380
|
-
|
|
14459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14460
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14461
|
+
import_design_system48.Checkbox,
|
|
14381
14462
|
{
|
|
14382
14463
|
id,
|
|
14383
14464
|
checked: value === true,
|
|
@@ -14386,10 +14467,10 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
|
|
|
14386
14467
|
onCheckedChange: (next) => onChange(next === true)
|
|
14387
14468
|
}
|
|
14388
14469
|
),
|
|
14389
|
-
unanswered ? /* @__PURE__ */ (0,
|
|
14390
|
-
/* @__PURE__ */ (0,
|
|
14391
|
-
field.required ? null : /* @__PURE__ */ (0,
|
|
14392
|
-
|
|
14470
|
+
unanswered ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
14471
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
|
|
14472
|
+
field.required ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14473
|
+
import_design_system48.Button,
|
|
14393
14474
|
{
|
|
14394
14475
|
size: "sm",
|
|
14395
14476
|
variant: "ghost",
|
|
@@ -14405,9 +14486,9 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
|
|
|
14405
14486
|
function StructuredTextControl({ field, value, onChange, disabled, id, rows }) {
|
|
14406
14487
|
const text = typeof value === "string" ? value : "";
|
|
14407
14488
|
const reads = structuredOf(text) !== null;
|
|
14408
|
-
return /* @__PURE__ */ (0,
|
|
14409
|
-
/* @__PURE__ */ (0,
|
|
14410
|
-
|
|
14489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", "data-records-structured-editor": "", children: [
|
|
14490
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14491
|
+
import_design_system48.BasicTextarea,
|
|
14411
14492
|
{
|
|
14412
14493
|
id,
|
|
14413
14494
|
rows,
|
|
@@ -14418,8 +14499,8 @@ function StructuredTextControl({ field, value, onChange, disabled, id, rows }) {
|
|
|
14418
14499
|
onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
|
|
14419
14500
|
}
|
|
14420
14501
|
),
|
|
14421
|
-
/* @__PURE__ */ (0,
|
|
14422
|
-
|
|
14502
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "flex h-6 items-center gap-2 text-xs", children: reads ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14503
|
+
import_design_system48.Button,
|
|
14423
14504
|
{
|
|
14424
14505
|
type: "button",
|
|
14425
14506
|
variant: "ghost",
|
|
@@ -14430,16 +14511,16 @@ function StructuredTextControl({ field, value, onChange, disabled, id, rows }) {
|
|
|
14430
14511
|
"data-records-structured-format": "",
|
|
14431
14512
|
children: "Format"
|
|
14432
14513
|
}
|
|
14433
|
-
) : /* @__PURE__ */ (0,
|
|
14514
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-amber-700 dark:text-amber-400", "data-records-structured-broken": "", children: "Not valid JSON \u2014 saves as plain text" }) })
|
|
14434
14515
|
] });
|
|
14435
14516
|
}
|
|
14436
14517
|
function JsonControl({ field, value, onChange, disabled, id }) {
|
|
14437
14518
|
const initial = value === null || value === void 0 ? "" : typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
14438
|
-
const [text, setText] = (0,
|
|
14439
|
-
const [broken, setBroken] = (0,
|
|
14440
|
-
return /* @__PURE__ */ (0,
|
|
14441
|
-
/* @__PURE__ */ (0,
|
|
14442
|
-
|
|
14519
|
+
const [text, setText] = (0, import_react78.useState)(initial);
|
|
14520
|
+
const [broken, setBroken] = (0, import_react78.useState)(null);
|
|
14521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
14522
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14523
|
+
import_design_system48.BasicTextarea,
|
|
14443
14524
|
{
|
|
14444
14525
|
id,
|
|
14445
14526
|
rows: 4,
|
|
@@ -14473,7 +14554,7 @@ function JsonControl({ field, value, onChange, disabled, id }) {
|
|
|
14473
14554
|
broken ? (
|
|
14474
14555
|
// The typed text is still in the box: the notice owns the two doors out. In a grid cell it
|
|
14475
14556
|
// floats over the table (`data-records-cell-note`), so the row never grows.
|
|
14476
|
-
/* @__PURE__ */ (0,
|
|
14557
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "data-records-cell-note": "", className: "block", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14477
14558
|
RefusalNotice,
|
|
14478
14559
|
{
|
|
14479
14560
|
error: broken,
|
|
@@ -14497,11 +14578,11 @@ function inTheStoresOrder(options) {
|
|
|
14497
14578
|
return [...options].sort((a, b) => position(a) - position(b) || made(a).localeCompare(made(b)));
|
|
14498
14579
|
}
|
|
14499
14580
|
function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm, onChosen }) {
|
|
14500
|
-
const client = (0,
|
|
14501
|
-
const [options, setOptions] = (0,
|
|
14502
|
-
const [refusal, setRefusal] = (0,
|
|
14503
|
-
const [reread, setReread] = (0,
|
|
14504
|
-
(0,
|
|
14581
|
+
const client = (0, import_react79.useOptionalRecordsClient)();
|
|
14582
|
+
const [options, setOptions] = (0, import_react78.useState)(null);
|
|
14583
|
+
const [refusal, setRefusal] = (0, import_react78.useState)(null);
|
|
14584
|
+
const [reread, setReread] = (0, import_react78.useState)(0);
|
|
14585
|
+
(0, import_react78.useEffect)(() => {
|
|
14505
14586
|
if (!client) return;
|
|
14506
14587
|
let cancelled = false;
|
|
14507
14588
|
void (0, askOnce_exports.fieldOptionsOnce)(client, field.id).then((result) => {
|
|
@@ -14515,12 +14596,12 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14515
14596
|
}, [client, field.id, reread]);
|
|
14516
14597
|
const handed = publicChoicesOf(field);
|
|
14517
14598
|
if (!client && handed.length > 0) {
|
|
14518
|
-
return /* @__PURE__ */ (0,
|
|
14599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ChoiceAnswer, { field, choices: handed, value, onChange, disabled, id, onChosen });
|
|
14519
14600
|
}
|
|
14520
14601
|
if (!client) {
|
|
14521
|
-
return /* @__PURE__ */ (0,
|
|
14522
|
-
/* @__PURE__ */ (0,
|
|
14523
|
-
|
|
14602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
14603
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14604
|
+
import_design_system48.BasicInput,
|
|
14524
14605
|
{
|
|
14525
14606
|
id,
|
|
14526
14607
|
value: value === null || value === void 0 ? "" : String(value),
|
|
@@ -14528,15 +14609,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14528
14609
|
onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
|
|
14529
14610
|
}
|
|
14530
14611
|
),
|
|
14531
|
-
/* @__PURE__ */ (0,
|
|
14612
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-xs text-muted-foreground", children: "This is normally picked from a list. A page answered without an account cannot read that list, so type your answer and whoever receives it will match it up." })
|
|
14532
14613
|
] });
|
|
14533
14614
|
}
|
|
14534
14615
|
if (refusal)
|
|
14535
|
-
return /* @__PURE__ */ (0,
|
|
14536
|
-
if (!options) return /* @__PURE__ */ (0,
|
|
14616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RefusalLine, { error: refusal }) });
|
|
14617
|
+
if (!options) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
|
|
14537
14618
|
if (asForm && options.length > 0) {
|
|
14538
14619
|
const titled = (option) => recordName(option.data, null, "Unnamed choice");
|
|
14539
|
-
return /* @__PURE__ */ (0,
|
|
14620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14540
14621
|
ChoiceAnswer,
|
|
14541
14622
|
{
|
|
14542
14623
|
field,
|
|
@@ -14554,7 +14635,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14554
14635
|
);
|
|
14555
14636
|
}
|
|
14556
14637
|
const noChoicesYet = client && options.length === 0 && !disabled;
|
|
14557
|
-
const offerChoices = noChoicesYet ? /* @__PURE__ */ (0,
|
|
14638
|
+
const offerChoices = noChoicesYet ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14558
14639
|
AddChoicesInline,
|
|
14559
14640
|
{
|
|
14560
14641
|
field,
|
|
@@ -14565,9 +14646,9 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14565
14646
|
}
|
|
14566
14647
|
) : null;
|
|
14567
14648
|
if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED) {
|
|
14568
|
-
return /* @__PURE__ */ (0,
|
|
14649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
14569
14650
|
offerChoices,
|
|
14570
|
-
/* @__PURE__ */ (0,
|
|
14651
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14571
14652
|
OpenChoicePicker,
|
|
14572
14653
|
{
|
|
14573
14654
|
field,
|
|
@@ -14591,14 +14672,14 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14591
14672
|
] });
|
|
14592
14673
|
}
|
|
14593
14674
|
if (options.length === 0) {
|
|
14594
|
-
return /* @__PURE__ */ (0,
|
|
14675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { id, className: "text-xs text-muted-foreground", children: field.options_table_id ? `${fieldName(field)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field)} does not name the Table its choices come from yet, so there is nothing to choose. A table admin sets it in the field editor.` });
|
|
14595
14676
|
}
|
|
14596
14677
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
14597
14678
|
if (field.multi) {
|
|
14598
14679
|
const chosen = options.filter((option) => (0, import_records29.choiceValuesOf)(value).some((v) => (0, import_records29.isTheChosen)(option, v)));
|
|
14599
14680
|
const picked = new Set(chosen.map((option) => (0, import_records29.optionKey)(option)));
|
|
14600
|
-
const toggles = /* @__PURE__ */ (0,
|
|
14601
|
-
|
|
14681
|
+
const toggles = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14682
|
+
import_design_system48.Button,
|
|
14602
14683
|
{
|
|
14603
14684
|
type: "button",
|
|
14604
14685
|
size: "sm",
|
|
@@ -14615,23 +14696,23 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14615
14696
|
option.id
|
|
14616
14697
|
)) });
|
|
14617
14698
|
if (!autoOpen) return toggles;
|
|
14618
|
-
return /* @__PURE__ */ (0,
|
|
14619
|
-
|
|
14699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14700
|
+
import_design_system48.Popover,
|
|
14620
14701
|
{
|
|
14621
14702
|
defaultOpen: true,
|
|
14622
14703
|
onOpenChange: (open) => {
|
|
14623
14704
|
if (!open) onClose?.();
|
|
14624
14705
|
},
|
|
14625
14706
|
children: [
|
|
14626
|
-
/* @__PURE__ */ (0,
|
|
14627
|
-
/* @__PURE__ */ (0,
|
|
14707
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.Button, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
|
|
14708
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.PopoverContent, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
|
|
14628
14709
|
]
|
|
14629
14710
|
}
|
|
14630
14711
|
);
|
|
14631
14712
|
}
|
|
14632
14713
|
const current = options.find((option) => (0, import_records29.isTheChosen)(option, value));
|
|
14633
|
-
return /* @__PURE__ */ (0,
|
|
14634
|
-
|
|
14714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14715
|
+
import_design_system48.Select,
|
|
14635
14716
|
{
|
|
14636
14717
|
value: current ? (0, import_records29.optionKey)(current) : "",
|
|
14637
14718
|
disabled: disabled ?? false,
|
|
@@ -14644,8 +14725,8 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
14644
14725
|
}
|
|
14645
14726
|
} : {},
|
|
14646
14727
|
children: [
|
|
14647
|
-
/* @__PURE__ */ (0,
|
|
14648
|
-
/* @__PURE__ */ (0,
|
|
14728
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectValue, { placeholder: "Choose" }) }),
|
|
14729
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectItem, { value: (0, import_records29.optionKey)(option), children: titleOf(option) }, option.id)) })
|
|
14649
14730
|
]
|
|
14650
14731
|
}
|
|
14651
14732
|
);
|
|
@@ -14665,18 +14746,18 @@ function OpenChoicePicker({
|
|
|
14665
14746
|
allowOther = true,
|
|
14666
14747
|
onChoicesChanged
|
|
14667
14748
|
}) {
|
|
14668
|
-
const client = (0,
|
|
14749
|
+
const client = (0, import_react79.useOptionalRecordsClient)();
|
|
14669
14750
|
const nudge = useChoiceNudge();
|
|
14670
|
-
const [open, setOpenState] = (0,
|
|
14671
|
-
const onCloseRef = (0,
|
|
14751
|
+
const [open, setOpenState] = (0, import_react78.useState)(autoOpen === true);
|
|
14752
|
+
const onCloseRef = (0, import_react78.useRef)(onClose);
|
|
14672
14753
|
onCloseRef.current = onClose;
|
|
14673
|
-
const setOpen = (0,
|
|
14754
|
+
const setOpen = (0, import_react78.useCallback)((next) => {
|
|
14674
14755
|
setOpenState(next);
|
|
14675
14756
|
if (!next) onCloseRef.current?.();
|
|
14676
14757
|
}, []);
|
|
14677
|
-
const [search, setSearch] = (0,
|
|
14678
|
-
const [adding, setAdding] = (0,
|
|
14679
|
-
const [addRefused, setAddRefused] = (0,
|
|
14758
|
+
const [search, setSearch] = (0, import_react78.useState)(initialSearch ?? "");
|
|
14759
|
+
const [adding, setAdding] = (0, import_react78.useState)(false);
|
|
14760
|
+
const [addRefused, setAddRefused] = (0, import_react78.useState)(null);
|
|
14680
14761
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
14681
14762
|
const held = withoutAddition(value);
|
|
14682
14763
|
const current = (0, import_records29.choiceValuesOf)(held.value);
|
|
@@ -14734,7 +14815,7 @@ function OpenChoicePicker({
|
|
|
14734
14815
|
const pickedOptions = current.map((v) => options.find((o) => (0, import_records29.isTheChosen)(o, v)));
|
|
14735
14816
|
const cellChips = pickedWords.map((word, i) => {
|
|
14736
14817
|
const chip = chipOf(pickedOptions[i], word);
|
|
14737
|
-
return /* @__PURE__ */ (0,
|
|
14818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.Badge, { variant: "outline", className: (0, import_design_system48.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
|
|
14738
14819
|
});
|
|
14739
14820
|
const headChips = pickedWords.map((word, i) => {
|
|
14740
14821
|
const option = pickedOptions[i];
|
|
@@ -14749,12 +14830,12 @@ function OpenChoicePicker({
|
|
|
14749
14830
|
};
|
|
14750
14831
|
});
|
|
14751
14832
|
const anchored = autoOpen === true;
|
|
14752
|
-
return /* @__PURE__ */ (0,
|
|
14833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { id, className: "flex flex-wrap items-center gap-1", children: [
|
|
14753
14834
|
anchored || disabled ? null : cellChips,
|
|
14754
14835
|
disabled ? cellChips : (
|
|
14755
14836
|
// THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the relation picker draws the same one.
|
|
14756
14837
|
// In a grid cell it hangs from the cell's own chips; no button is drawn in the cell.
|
|
14757
|
-
/* @__PURE__ */ (0,
|
|
14838
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14758
14839
|
PickOrAdd,
|
|
14759
14840
|
{
|
|
14760
14841
|
anchored,
|
|
@@ -14780,14 +14861,14 @@ function OpenChoicePicker({
|
|
|
14780
14861
|
const option = options.find((o) => o.id === optionId);
|
|
14781
14862
|
if (option) choose((0, import_records29.optionKey)(option));
|
|
14782
14863
|
},
|
|
14783
|
-
empty: q === "" ? /* @__PURE__ */ (0,
|
|
14864
|
+
empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
|
|
14784
14865
|
add,
|
|
14785
14866
|
foot,
|
|
14786
|
-
footNote: addRefused ? /* @__PURE__ */ (0,
|
|
14867
|
+
footNote: addRefused ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
|
|
14787
14868
|
// never_add on a column that takes only its choices: said, never a silent nothing.
|
|
14788
|
-
/* @__PURE__ */ (0,
|
|
14789
|
-
/* @__PURE__ */ (0,
|
|
14790
|
-
autoOpen ? /* @__PURE__ */ (0,
|
|
14869
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
14870
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field, [q]) }),
|
|
14871
|
+
autoOpen ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
|
|
14791
14872
|
] })
|
|
14792
14873
|
) : null,
|
|
14793
14874
|
children: anchored ? cellChips : null
|
|
@@ -14807,9 +14888,9 @@ function RecordChip({
|
|
|
14807
14888
|
// name. So it caps at its container and ends in an ellipsis with the whole name in
|
|
14808
14889
|
// its tooltip, rather than being cut mid-word by whatever box it landed in
|
|
14809
14890
|
// (lane FIX-14, 2026-09-22).
|
|
14810
|
-
/* @__PURE__ */ (0,
|
|
14811
|
-
/* @__PURE__ */ (0,
|
|
14812
|
-
onRemove ? /* @__PURE__ */ (0,
|
|
14891
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_design_system48.Badge, { variant: "secondary", className: (0, import_design_system48.cn)("max-w-full gap-1 text-[11px]", className), title, children: [
|
|
14892
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "min-w-0 truncate", children: title }),
|
|
14893
|
+
onRemove ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
|
|
14813
14894
|
] })
|
|
14814
14895
|
);
|
|
14815
14896
|
}
|
|
@@ -14833,7 +14914,7 @@ function ChoiceAnswer({
|
|
|
14833
14914
|
isChosen,
|
|
14834
14915
|
onChosen
|
|
14835
14916
|
}) {
|
|
14836
|
-
const [search, setSearch] = (0,
|
|
14917
|
+
const [search, setSearch] = (0, import_react78.useState)("");
|
|
14837
14918
|
const held = field.multi ? (0, import_records29.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
|
|
14838
14919
|
const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
|
|
14839
14920
|
const press = (choice) => {
|
|
@@ -14851,7 +14932,7 @@ function ChoiceAnswer({
|
|
|
14851
14932
|
const option = (choice) => {
|
|
14852
14933
|
const chosen = on(choice);
|
|
14853
14934
|
const letter = lettered ? CHOICE_LETTERS[choices.indexOf(choice)] : null;
|
|
14854
|
-
return /* @__PURE__ */ (0,
|
|
14935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14855
14936
|
"button",
|
|
14856
14937
|
{
|
|
14857
14938
|
type: "button",
|
|
@@ -14862,24 +14943,24 @@ function ChoiceAnswer({
|
|
|
14862
14943
|
tabIndex: field.multi || choice.key === tabStop ? 0 : -1,
|
|
14863
14944
|
onClick: () => press(choice),
|
|
14864
14945
|
"data-records-choice-answer": choice.key,
|
|
14865
|
-
className: (0,
|
|
14946
|
+
className: (0, import_design_system48.cn)(
|
|
14866
14947
|
"flex min-h-11 w-full items-center gap-3 rounded-md border px-3 py-2 text-left text-base font-medium text-foreground transition-colors sm:min-h-10 sm:text-sm",
|
|
14867
14948
|
chosen ? "border-primary bg-primary/10" : "border-primary/30 bg-primary/[0.03] hover:bg-primary/10"
|
|
14868
14949
|
),
|
|
14869
14950
|
children: [
|
|
14870
|
-
letter ? /* @__PURE__ */ (0,
|
|
14951
|
+
letter ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14871
14952
|
"kbd",
|
|
14872
14953
|
{
|
|
14873
14954
|
"aria-hidden": "true",
|
|
14874
|
-
className: (0,
|
|
14955
|
+
className: (0, import_design_system48.cn)(
|
|
14875
14956
|
"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border font-sans text-xs font-semibold",
|
|
14876
14957
|
chosen ? "border-primary bg-primary text-primary-foreground" : "border-primary/40 text-primary"
|
|
14877
14958
|
),
|
|
14878
14959
|
children: letter
|
|
14879
14960
|
}
|
|
14880
14961
|
) : null,
|
|
14881
|
-
/* @__PURE__ */ (0,
|
|
14882
|
-
chosen ? /* @__PURE__ */ (0,
|
|
14962
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
|
|
14963
|
+
chosen ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
|
|
14883
14964
|
]
|
|
14884
14965
|
},
|
|
14885
14966
|
choice.key
|
|
@@ -14912,13 +14993,13 @@ function ChoiceAnswer({
|
|
|
14912
14993
|
};
|
|
14913
14994
|
const group = { role: field.multi ? "group" : "radiogroup", "aria-label": fieldName(field), onKeyDown };
|
|
14914
14995
|
if (choices.length <= FORM_SEARCH_AFTER) {
|
|
14915
|
-
return /* @__PURE__ */ (0,
|
|
14996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
|
|
14916
14997
|
}
|
|
14917
14998
|
const q = search.trim().toLowerCase();
|
|
14918
14999
|
const shown2 = q === "" ? choices : choices.filter((c) => c.label.toLowerCase().includes(q));
|
|
14919
|
-
return /* @__PURE__ */ (0,
|
|
14920
|
-
/* @__PURE__ */ (0,
|
|
14921
|
-
|
|
15000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
|
|
15001
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
15002
|
+
import_design_system48.BasicInput,
|
|
14922
15003
|
{
|
|
14923
15004
|
value: search,
|
|
14924
15005
|
onChange: (e) => setSearch(e.target.value),
|
|
@@ -14928,9 +15009,9 @@ function ChoiceAnswer({
|
|
|
14928
15009
|
className: "h-11 text-base sm:h-9 sm:text-sm"
|
|
14929
15010
|
}
|
|
14930
15011
|
),
|
|
14931
|
-
/* @__PURE__ */ (0,
|
|
15012
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
|
|
14932
15013
|
shown2.map(option),
|
|
14933
|
-
shown2.length === 0 ? /* @__PURE__ */ (0,
|
|
15014
|
+
shown2.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
|
|
14934
15015
|
] })
|
|
14935
15016
|
] });
|
|
14936
15017
|
}
|
|
@@ -14939,7 +15020,7 @@ function ChoiceAnswer({
|
|
|
14939
15020
|
init_names();
|
|
14940
15021
|
|
|
14941
15022
|
// src/RecordsMount.tsx
|
|
14942
|
-
var
|
|
15023
|
+
var import_react80 = require("react");
|
|
14943
15024
|
|
|
14944
15025
|
// src/dataSource.ts
|
|
14945
15026
|
var import_global_slot2 = require("@ai-matrx/kit/global-slot");
|
|
@@ -14949,8 +15030,8 @@ function personActor(userId) {
|
|
|
14949
15030
|
var dataSources = (0, import_global_slot2.globalSlot)("ai-matrx.records-ui.data-sources", () => /* @__PURE__ */ new WeakMap());
|
|
14950
15031
|
|
|
14951
15032
|
// src/RecordsMount.tsx
|
|
14952
|
-
var
|
|
14953
|
-
var
|
|
15033
|
+
var import_react81 = require("@ai-matrx/records/react");
|
|
15034
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
14954
15035
|
|
|
14955
15036
|
// src/TablePickers.tsx
|
|
14956
15037
|
init_tablePicking();
|
|
@@ -14958,7 +15039,7 @@ init_Refusal();
|
|
|
14958
15039
|
init_refusals();
|
|
14959
15040
|
init_plainWords();
|
|
14960
15041
|
var import_field_formats13 = require("@ai-matrx/design-system/field-formats");
|
|
14961
|
-
var
|
|
15042
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
14962
15043
|
var SHARED_FOR_MS = 5e3;
|
|
14963
15044
|
var sharedReads = /* @__PURE__ */ new WeakMap();
|
|
14964
15045
|
function readTablesAnywhere(dataSource) {
|
|
@@ -14990,8 +15071,8 @@ function readTablesAnywhere(dataSource) {
|
|
|
14990
15071
|
return read;
|
|
14991
15072
|
}
|
|
14992
15073
|
function useTablesAnywhere(dataSource) {
|
|
14993
|
-
const [state2, setState] = (0,
|
|
14994
|
-
(0,
|
|
15074
|
+
const [state2, setState] = (0, import_react82.useState)({ loading: true, error: null, rows: [] });
|
|
15075
|
+
(0, import_react82.useEffect)(() => {
|
|
14995
15076
|
let live = true;
|
|
14996
15077
|
void readTablesAnywhere(dataSource).then((result) => {
|
|
14997
15078
|
if (live) setState(result);
|
|
@@ -15020,7 +15101,7 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
15020
15101
|
const secondOf = (r) => [r.created_by_name ? `by ${r.created_by_name}` : null, r.updated_at ? `changed ${new Date(r.updated_at).toLocaleDateString(void 0, (0, import_field_formats13.momentZoneOptions)(r.updated_at))}` : null].filter(Boolean).join(" \xB7 ");
|
|
15021
15102
|
const base = secondOf(row);
|
|
15022
15103
|
const alike = options.filter((o) => o.organization_id === t.organization_id && o.table_name.trim().toLowerCase() === t.table_name.trim().toLowerCase() && secondOf(o) === base).length;
|
|
15023
|
-
const second = alike > 1 ? [base, `#${(0,
|
|
15104
|
+
const second = alike > 1 ? [base, `#${(0, import_design_system49.displayId)(t.table_id)}`].filter(Boolean).join(" \xB7 ") : base;
|
|
15024
15105
|
return {
|
|
15025
15106
|
value: t.table_id,
|
|
15026
15107
|
// The organization hint already tells two same-named tables apart across organizations.
|
|
@@ -15028,17 +15109,17 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
15028
15109
|
hint: t.organization_name,
|
|
15029
15110
|
keywords: t.organization_name,
|
|
15030
15111
|
...twin && second ? {
|
|
15031
|
-
render: /* @__PURE__ */ (0,
|
|
15032
|
-
/* @__PURE__ */ (0,
|
|
15033
|
-
/* @__PURE__ */ (0,
|
|
15112
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
|
|
15113
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "truncate", children: t.table_name }),
|
|
15114
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
|
|
15034
15115
|
] })
|
|
15035
15116
|
} : {}
|
|
15036
15117
|
};
|
|
15037
15118
|
});
|
|
15038
15119
|
const missing = Boolean(value) && !list.loading && !list.error && !list.rows.some((t) => t.table_id === value);
|
|
15039
|
-
return /* @__PURE__ */ (0,
|
|
15040
|
-
/* @__PURE__ */ (0,
|
|
15041
|
-
|
|
15120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
15121
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15122
|
+
import_design_system49.CreatablePicker,
|
|
15042
15123
|
{
|
|
15043
15124
|
value: value || null,
|
|
15044
15125
|
options: pickerOptions,
|
|
@@ -15051,24 +15132,24 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
15051
15132
|
ariaLabel: "Table"
|
|
15052
15133
|
}
|
|
15053
15134
|
),
|
|
15054
|
-
list.error && /* @__PURE__ */ (0,
|
|
15055
|
-
missing && /* @__PURE__ */ (0,
|
|
15135
|
+
list.error && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RefusalLine, { error: (0, refusals_exports.refusal)("door", list.error, "Try again in a moment.") }),
|
|
15136
|
+
missing && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
|
|
15056
15137
|
] });
|
|
15057
15138
|
}
|
|
15058
15139
|
function TableScope({ dataSource, userId, tableId, children, fallback = null, unavailable, tables }) {
|
|
15059
15140
|
const own3 = useTablesAnywhere(dataSource);
|
|
15060
15141
|
const list = tables ?? own3;
|
|
15061
15142
|
const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
|
|
15062
|
-
if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ (0,
|
|
15063
|
-
if (!tableId || !organizationId) return /* @__PURE__ */ (0,
|
|
15064
|
-
return /* @__PURE__ */ (0,
|
|
15143
|
+
if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: unavailable ?? fallback });
|
|
15144
|
+
if (!tableId || !organizationId) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: fallback });
|
|
15145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react83.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children });
|
|
15065
15146
|
}
|
|
15066
15147
|
function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
15067
|
-
const fields = (0,
|
|
15068
|
-
const all = (0,
|
|
15069
|
-
const byKey = (0,
|
|
15148
|
+
const fields = (0, import_react83.useFields)(tableId);
|
|
15149
|
+
const all = (0, import_react82.useMemo)(() => fields.data ?? [], [fields.data]);
|
|
15150
|
+
const byKey = (0, import_react82.useMemo)(() => new Map(all.map((f) => [f.key, f])), [all]);
|
|
15070
15151
|
const keys = Object.keys(value);
|
|
15071
|
-
const [adding, setAdding] = (0,
|
|
15152
|
+
const [adding, setAdding] = (0, import_react82.useState)(false);
|
|
15072
15153
|
const optionsFor = (current) => all.filter((f) => f.key === current || !(f.key in value)).map((f) => ({ value: f.key, label: fieldName(f) }));
|
|
15073
15154
|
const rename = (from, to) => {
|
|
15074
15155
|
if (from === to) return;
|
|
@@ -15081,11 +15162,11 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
15081
15162
|
void _gone;
|
|
15082
15163
|
onChange(rest);
|
|
15083
15164
|
};
|
|
15084
|
-
return /* @__PURE__ */ (0,
|
|
15085
|
-
fields.error && /* @__PURE__ */ (0,
|
|
15165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
15166
|
+
fields.error && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RefusalLine, { error: fields.error }),
|
|
15086
15167
|
keys.map((key) => {
|
|
15087
15168
|
const field = byKey.get(key);
|
|
15088
|
-
return /* @__PURE__ */ (0,
|
|
15169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15089
15170
|
ColumnValueRow,
|
|
15090
15171
|
{
|
|
15091
15172
|
columnKey: key,
|
|
@@ -15101,7 +15182,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
15101
15182
|
key
|
|
15102
15183
|
);
|
|
15103
15184
|
}),
|
|
15104
|
-
adding && /* @__PURE__ */ (0,
|
|
15185
|
+
adding && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15105
15186
|
ColumnValueRow,
|
|
15106
15187
|
{
|
|
15107
15188
|
columnKey: null,
|
|
@@ -15118,7 +15199,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
15118
15199
|
onRemove: () => setAdding(false)
|
|
15119
15200
|
}
|
|
15120
15201
|
),
|
|
15121
|
-
!disabled && !adding && keys.length < all.length && /* @__PURE__ */ (0,
|
|
15202
|
+
!disabled && !adding && keys.length < all.length && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_design_system49.Button, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
|
|
15122
15203
|
] });
|
|
15123
15204
|
}
|
|
15124
15205
|
function ColumnValueRow({
|
|
@@ -15134,10 +15215,10 @@ function ColumnValueRow({
|
|
|
15134
15215
|
}) {
|
|
15135
15216
|
const orphan = columnKey !== null && !loading && field === void 0;
|
|
15136
15217
|
const shown2 = orphan ? [{ value: columnKey, label: columnKey, hint: "Not a column" }, ...options] : options;
|
|
15137
|
-
return /* @__PURE__ */ (0,
|
|
15138
|
-
/* @__PURE__ */ (0,
|
|
15139
|
-
/* @__PURE__ */ (0,
|
|
15140
|
-
|
|
15218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
|
|
15219
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
15220
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15221
|
+
import_design_system49.CreatablePicker,
|
|
15141
15222
|
{
|
|
15142
15223
|
value: columnKey,
|
|
15143
15224
|
options: shown2,
|
|
@@ -15150,23 +15231,23 @@ function ColumnValueRow({
|
|
|
15150
15231
|
ariaLabel: "Column"
|
|
15151
15232
|
}
|
|
15152
15233
|
) }),
|
|
15153
|
-
!disabled && /* @__PURE__ */ (0,
|
|
15234
|
+
!disabled && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_design_system49.Button, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
|
|
15154
15235
|
] }),
|
|
15155
|
-
field ? /* @__PURE__ */ (0,
|
|
15236
|
+
field ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(FieldControl, { field, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
|
|
15156
15237
|
] });
|
|
15157
15238
|
}
|
|
15158
15239
|
function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
15159
|
-
const table = (0,
|
|
15160
|
-
const records = (0,
|
|
15240
|
+
const table = (0, import_react83.useTable)(tableId);
|
|
15241
|
+
const records = (0, import_react83.useRecords)(tableId, { pageSize: 200 });
|
|
15161
15242
|
const rows = records.data?.rows ?? [];
|
|
15162
15243
|
const options = rows.map((row) => ({
|
|
15163
15244
|
value: row.id,
|
|
15164
15245
|
label: rowNameIn(table.data ?? null, row)
|
|
15165
15246
|
}));
|
|
15166
15247
|
const missing = Boolean(value) && !records.loading && !records.error && !rows.some((r) => r.id === value);
|
|
15167
|
-
return /* @__PURE__ */ (0,
|
|
15168
|
-
/* @__PURE__ */ (0,
|
|
15169
|
-
|
|
15248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
15249
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15250
|
+
import_design_system49.CreatablePicker,
|
|
15170
15251
|
{
|
|
15171
15252
|
value: value || null,
|
|
15172
15253
|
options,
|
|
@@ -15179,17 +15260,17 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
15179
15260
|
ariaLabel: "Record"
|
|
15180
15261
|
}
|
|
15181
15262
|
),
|
|
15182
|
-
records.error && /* @__PURE__ */ (0,
|
|
15263
|
+
records.error && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RefusalLine, { error: records.error })
|
|
15183
15264
|
] });
|
|
15184
15265
|
}
|
|
15185
15266
|
|
|
15186
15267
|
// src/DataBindingPicker.tsx
|
|
15187
|
-
var
|
|
15268
|
+
var import_react84 = require("react");
|
|
15188
15269
|
var import_records30 = require("@ai-matrx/records");
|
|
15189
|
-
var
|
|
15190
|
-
var
|
|
15270
|
+
var import_react85 = require("@ai-matrx/records/react");
|
|
15271
|
+
var import_design_system50 = require("@ai-matrx/design-system");
|
|
15191
15272
|
init_names();
|
|
15192
|
-
var
|
|
15273
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
15193
15274
|
var DATA_BINDING_SHAPES = [
|
|
15194
15275
|
{ value: "collection", label: "The whole table" },
|
|
15195
15276
|
{ value: "reference", label: "One record" },
|
|
@@ -15256,9 +15337,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
|
|
|
15256
15337
|
...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
|
|
15257
15338
|
});
|
|
15258
15339
|
};
|
|
15259
|
-
return /* @__PURE__ */ (0,
|
|
15260
|
-
/* @__PURE__ */ (0,
|
|
15261
|
-
/* @__PURE__ */ (0,
|
|
15340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
15341
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
|
|
15342
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
15262
15343
|
BindingDetails,
|
|
15263
15344
|
{
|
|
15264
15345
|
tableId,
|
|
@@ -15277,11 +15358,11 @@ function BindingDetails({
|
|
|
15277
15358
|
disabled,
|
|
15278
15359
|
defaultRowLimit
|
|
15279
15360
|
}) {
|
|
15280
|
-
const table = (0,
|
|
15281
|
-
const fields = (0,
|
|
15282
|
-
const fieldList = (0,
|
|
15361
|
+
const table = (0, import_react85.useTable)(tableId);
|
|
15362
|
+
const fields = (0, import_react85.useFields)(tableId);
|
|
15363
|
+
const fieldList = (0, import_react84.useMemo)(() => fields.data ?? [], [fields.data]);
|
|
15283
15364
|
const shape = binding.semantic_type;
|
|
15284
|
-
(0,
|
|
15365
|
+
(0, import_react84.useEffect)(() => {
|
|
15285
15366
|
if (disabled || shape === "value" || binding.transform || fields.loading || fieldList.length === 0) return;
|
|
15286
15367
|
onChange({
|
|
15287
15368
|
...binding,
|
|
@@ -15322,9 +15403,9 @@ function BindingDetails({
|
|
|
15322
15403
|
const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
|
|
15323
15404
|
const template = binding.transform?.template ?? "";
|
|
15324
15405
|
const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
|
|
15325
|
-
return /* @__PURE__ */ (0,
|
|
15326
|
-
/* @__PURE__ */ (0,
|
|
15327
|
-
|
|
15406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
15407
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
15408
|
+
import_design_system50.Button,
|
|
15328
15409
|
{
|
|
15329
15410
|
type: "button",
|
|
15330
15411
|
size: "sm",
|
|
@@ -15337,7 +15418,7 @@ function BindingDetails({
|
|
|
15337
15418
|
},
|
|
15338
15419
|
s.value
|
|
15339
15420
|
)) }),
|
|
15340
|
-
shape !== "collection" && /* @__PURE__ */ (0,
|
|
15421
|
+
shape !== "collection" && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
15341
15422
|
RecordPicker,
|
|
15342
15423
|
{
|
|
15343
15424
|
tableId,
|
|
@@ -15346,8 +15427,8 @@ function BindingDetails({
|
|
|
15346
15427
|
disabled: Boolean(disabled)
|
|
15347
15428
|
}
|
|
15348
15429
|
),
|
|
15349
|
-
shape === "value" && /* @__PURE__ */ (0,
|
|
15350
|
-
|
|
15430
|
+
shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
15431
|
+
import_design_system50.CreatablePicker,
|
|
15351
15432
|
{
|
|
15352
15433
|
value: binding.field_key ?? null,
|
|
15353
15434
|
options: fieldOptions,
|
|
@@ -15360,11 +15441,11 @@ function BindingDetails({
|
|
|
15360
15441
|
ariaLabel: "Column"
|
|
15361
15442
|
}
|
|
15362
15443
|
),
|
|
15363
|
-
shape !== "value" && /* @__PURE__ */ (0,
|
|
15364
|
-
/* @__PURE__ */ (0,
|
|
15444
|
+
shape !== "value" && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
15445
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
15365
15446
|
"textarea",
|
|
15366
15447
|
{
|
|
15367
|
-
className: (0,
|
|
15448
|
+
className: (0, import_design_system50.cn)(
|
|
15368
15449
|
"min-h-[3.5rem] w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs"
|
|
15369
15450
|
),
|
|
15370
15451
|
"aria-label": "Each row reads as",
|
|
@@ -15373,8 +15454,8 @@ function BindingDetails({
|
|
|
15373
15454
|
onChange: (e) => setTemplate(e.target.value)
|
|
15374
15455
|
}
|
|
15375
15456
|
),
|
|
15376
|
-
!disabled && /* @__PURE__ */ (0,
|
|
15377
|
-
|
|
15457
|
+
!disabled && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
15458
|
+
import_design_system50.Button,
|
|
15378
15459
|
{
|
|
15379
15460
|
type: "button",
|
|
15380
15461
|
size: "sm",
|
|
@@ -15386,10 +15467,10 @@ function BindingDetails({
|
|
|
15386
15467
|
p.token
|
|
15387
15468
|
)) })
|
|
15388
15469
|
] }),
|
|
15389
|
-
shape === "collection" && /* @__PURE__ */ (0,
|
|
15470
|
+
shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
15390
15471
|
"Up to",
|
|
15391
|
-
/* @__PURE__ */ (0,
|
|
15392
|
-
|
|
15472
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
15473
|
+
import_design_system50.BasicInput,
|
|
15393
15474
|
{
|
|
15394
15475
|
type: "number",
|
|
15395
15476
|
min: 1,
|
|
@@ -15405,10 +15486,10 @@ function BindingDetails({
|
|
|
15405
15486
|
),
|
|
15406
15487
|
"rows"
|
|
15407
15488
|
] }),
|
|
15408
|
-
/* @__PURE__ */ (0,
|
|
15409
|
-
/* @__PURE__ */ (0,
|
|
15410
|
-
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0,
|
|
15411
|
-
|
|
15489
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
|
|
15490
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
|
|
15491
|
+
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
15492
|
+
import_design_system50.Button,
|
|
15412
15493
|
{
|
|
15413
15494
|
type: "button",
|
|
15414
15495
|
size: "sm",
|
|
@@ -15426,15 +15507,15 @@ function BindingDetails({
|
|
|
15426
15507
|
}
|
|
15427
15508
|
|
|
15428
15509
|
// src/PickedSummaries.tsx
|
|
15429
|
-
var
|
|
15510
|
+
var import_react86 = require("@ai-matrx/records/react");
|
|
15430
15511
|
init_names();
|
|
15431
|
-
var
|
|
15512
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
15432
15513
|
function TableNameText({ dataSource, tableId }) {
|
|
15433
15514
|
const tables = useTablesAnywhere(dataSource);
|
|
15434
|
-
if (!tableId) return /* @__PURE__ */ (0,
|
|
15435
|
-
if (tables.loading) return /* @__PURE__ */ (0,
|
|
15436
|
-
if (tables.error) return /* @__PURE__ */ (0,
|
|
15437
|
-
return /* @__PURE__ */ (0,
|
|
15515
|
+
if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "\u2014" });
|
|
15516
|
+
if (tables.loading) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "\u2026" });
|
|
15517
|
+
if (tables.error) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "Couldn't load the table's name" });
|
|
15518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
|
|
15438
15519
|
}
|
|
15439
15520
|
function ColumnValuesText({
|
|
15440
15521
|
dataSource,
|
|
@@ -15442,38 +15523,38 @@ function ColumnValuesText({
|
|
|
15442
15523
|
tableId,
|
|
15443
15524
|
value
|
|
15444
15525
|
}) {
|
|
15445
|
-
if (!tableId) return /* @__PURE__ */ (0,
|
|
15446
|
-
return /* @__PURE__ */ (0,
|
|
15526
|
+
if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "\u2014" });
|
|
15527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
15447
15528
|
TableScope,
|
|
15448
15529
|
{
|
|
15449
15530
|
dataSource,
|
|
15450
15531
|
userId,
|
|
15451
15532
|
tableId,
|
|
15452
|
-
fallback: /* @__PURE__ */ (0,
|
|
15453
|
-
unavailable: /* @__PURE__ */ (0,
|
|
15454
|
-
children: /* @__PURE__ */ (0,
|
|
15533
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "\u2026" }),
|
|
15534
|
+
unavailable: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "Couldn't load this table's columns" }),
|
|
15535
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(RecordLabelProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ColumnValuesWords, { tableId, value }) })
|
|
15455
15536
|
}
|
|
15456
15537
|
);
|
|
15457
15538
|
}
|
|
15458
15539
|
function ColumnValuesWords({ tableId, value }) {
|
|
15459
|
-
const fields = (0,
|
|
15540
|
+
const fields = (0, import_react86.useFields)(tableId);
|
|
15460
15541
|
const labels = useRecordLabels(fields.data ?? void 0);
|
|
15461
|
-
if (fields.loading) return /* @__PURE__ */ (0,
|
|
15462
|
-
if (fields.error) return /* @__PURE__ */ (0,
|
|
15542
|
+
if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "\u2026" });
|
|
15543
|
+
if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "Couldn't load this table's columns" });
|
|
15463
15544
|
const parts = [];
|
|
15464
15545
|
for (const [key, stored] of Object.entries(value)) {
|
|
15465
15546
|
if (key.startsWith("_")) continue;
|
|
15466
15547
|
const field = (fields.data ?? []).find((f) => f.key === key);
|
|
15467
|
-
if (parts.length) parts.push(/* @__PURE__ */ (0,
|
|
15548
|
+
if (parts.length) parts.push(/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { children: ", " }, `${key}-sep`));
|
|
15468
15549
|
parts.push(
|
|
15469
|
-
/* @__PURE__ */ (0,
|
|
15550
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { children: [
|
|
15470
15551
|
field ? fieldName(field) : "A removed column",
|
|
15471
15552
|
" is ",
|
|
15472
15553
|
field ? renderValue(field, stored, void 0, labels) : "\u2014"
|
|
15473
15554
|
] }, key)
|
|
15474
15555
|
);
|
|
15475
15556
|
}
|
|
15476
|
-
return parts.length ? /* @__PURE__ */ (0,
|
|
15557
|
+
return parts.length ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "\u2014" });
|
|
15477
15558
|
}
|
|
15478
15559
|
function RecordNameText({
|
|
15479
15560
|
dataSource,
|
|
@@ -15481,47 +15562,47 @@ function RecordNameText({
|
|
|
15481
15562
|
tableId,
|
|
15482
15563
|
recordId
|
|
15483
15564
|
}) {
|
|
15484
|
-
if (!tableId || !recordId) return /* @__PURE__ */ (0,
|
|
15485
|
-
return /* @__PURE__ */ (0,
|
|
15565
|
+
if (!tableId || !recordId) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "\u2014" });
|
|
15566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
15486
15567
|
TableScope,
|
|
15487
15568
|
{
|
|
15488
15569
|
dataSource,
|
|
15489
15570
|
userId,
|
|
15490
15571
|
tableId,
|
|
15491
|
-
fallback: /* @__PURE__ */ (0,
|
|
15492
|
-
unavailable: /* @__PURE__ */ (0,
|
|
15493
|
-
children: /* @__PURE__ */ (0,
|
|
15572
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "\u2026" }),
|
|
15573
|
+
unavailable: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "Couldn't load this record" }),
|
|
15574
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(RecordNameWords, { tableId, recordId })
|
|
15494
15575
|
}
|
|
15495
15576
|
);
|
|
15496
15577
|
}
|
|
15497
15578
|
function RecordNameWords({ tableId, recordId }) {
|
|
15498
|
-
const table = (0,
|
|
15499
|
-
const record = (0,
|
|
15500
|
-
if (record.loading || table.loading) return /* @__PURE__ */ (0,
|
|
15501
|
-
if (record.error) return /* @__PURE__ */ (0,
|
|
15502
|
-
if (!record.data) return /* @__PURE__ */ (0,
|
|
15503
|
-
return /* @__PURE__ */ (0,
|
|
15579
|
+
const table = (0, import_react86.useTable)(tableId);
|
|
15580
|
+
const record = (0, import_react86.useRecord)(recordId);
|
|
15581
|
+
if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "\u2026" });
|
|
15582
|
+
if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "Couldn't load this record" });
|
|
15583
|
+
if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: "A record you cannot open" });
|
|
15584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: recordName(record.data.document, table.data?.title_field ?? null) });
|
|
15504
15585
|
}
|
|
15505
15586
|
|
|
15506
15587
|
// src/HeldChangeDecision.tsx
|
|
15507
|
-
var
|
|
15508
|
-
var
|
|
15509
|
-
var
|
|
15588
|
+
var import_react87 = require("react");
|
|
15589
|
+
var import_react88 = require("@ai-matrx/records/react");
|
|
15590
|
+
var import_design_system51 = require("@ai-matrx/design-system");
|
|
15510
15591
|
init_Refusal();
|
|
15511
|
-
var
|
|
15592
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
15512
15593
|
function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided, approveLabel }) {
|
|
15513
|
-
return /* @__PURE__ */ (0,
|
|
15594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react88.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
|
|
15514
15595
|
}
|
|
15515
15596
|
function Decision({
|
|
15516
15597
|
approvalId,
|
|
15517
15598
|
onDecided,
|
|
15518
15599
|
approveLabel
|
|
15519
15600
|
}) {
|
|
15520
|
-
const client = (0,
|
|
15521
|
-
const [may, setMay] = (0,
|
|
15522
|
-
const [busy, setBusy] = (0,
|
|
15523
|
-
const [error, setError] = (0,
|
|
15524
|
-
(0,
|
|
15601
|
+
const client = (0, import_react88.useRecordsClient)();
|
|
15602
|
+
const [may, setMay] = (0, import_react87.useState)(null);
|
|
15603
|
+
const [busy, setBusy] = (0, import_react87.useState)(null);
|
|
15604
|
+
const [error, setError] = (0, import_react87.useState)(null);
|
|
15605
|
+
(0, import_react87.useEffect)(() => {
|
|
15525
15606
|
let live = true;
|
|
15526
15607
|
void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
|
|
15527
15608
|
if (!live) return;
|
|
@@ -15543,13 +15624,13 @@ function Decision({
|
|
|
15543
15624
|
if (res.ok) onDecided(approve);
|
|
15544
15625
|
else setError(res.error);
|
|
15545
15626
|
};
|
|
15546
|
-
if (may === null) return /* @__PURE__ */ (0,
|
|
15547
|
-
return /* @__PURE__ */ (0,
|
|
15548
|
-
may ? /* @__PURE__ */ (0,
|
|
15549
|
-
/* @__PURE__ */ (0,
|
|
15550
|
-
/* @__PURE__ */ (0,
|
|
15551
|
-
] }) : !error && /* @__PURE__ */ (0,
|
|
15552
|
-
error ? /* @__PURE__ */ (0,
|
|
15627
|
+
if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
|
|
15628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
15629
|
+
may ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex gap-2", children: [
|
|
15630
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_design_system51.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
|
|
15631
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_design_system51.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
|
|
15632
|
+
] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
|
|
15633
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RefusalLine, { error }) : null
|
|
15553
15634
|
] });
|
|
15554
15635
|
}
|
|
15555
15636
|
//# sourceMappingURL=pickers.cjs.map
|