@ai-matrx/records-ui 0.114.0 → 0.114.1
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 +6 -0
- package/dist/index.cjs +47 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +47 -49
- package/dist/index.js.map +1 -1
- package/dist/object-actions.cjs +4 -8
- package/dist/object-actions.cjs.map +1 -1
- package/dist/object-actions.d.cts +1 -1
- package/dist/object-actions.d.ts +1 -1
- package/dist/object-actions.js +4 -8
- package/dist/object-actions.js.map +1 -1
- package/dist/{objectActions-BjZ_Vq5d.d.cts → objectActions-CV8VEz58.d.cts} +1 -6
- package/dist/{objectActions-BjZ_Vq5d.d.ts → objectActions-CV8VEz58.d.ts} +1 -6
- package/dist/pickers.cjs +87 -85
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +45 -43
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/dist/pickers.cjs
CHANGED
|
@@ -987,9 +987,7 @@ var NEEDS = {
|
|
|
987
987
|
// custom.share_grant — passing your access on is an administrator's right
|
|
988
988
|
share: "admin",
|
|
989
989
|
// custom.field_declare / field_update / field_retire / table settings
|
|
990
|
-
structure: "admin"
|
|
991
|
-
// custom.field_declare / field_update / field_retire — the same rung; a lock takes it away, nothing else does
|
|
992
|
-
schema: "admin"
|
|
990
|
+
structure: "admin"
|
|
993
991
|
};
|
|
994
992
|
var NOT_YET = "Still asking the store what you may do here. Nothing is offered until it has answered.";
|
|
995
993
|
var NOTHING_AT_ALL = "You have not been given this. Ask somebody who administers it to share it with you.";
|
|
@@ -1004,8 +1002,7 @@ function sentenceFor(what, level) {
|
|
|
1004
1002
|
organise: "organise this",
|
|
1005
1003
|
remove: "delete this",
|
|
1006
1004
|
share: "pass this on to somebody else",
|
|
1007
|
-
structure: "change the columns of this table"
|
|
1008
|
-
schema: "change the columns of this table"
|
|
1005
|
+
structure: "change the columns of this table"
|
|
1009
1006
|
};
|
|
1010
1007
|
return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
|
|
1011
1008
|
}
|
|
@@ -1021,7 +1018,6 @@ function whatYouMayDo(level, known = true) {
|
|
|
1021
1018
|
remove: may("remove"),
|
|
1022
1019
|
share: may("share"),
|
|
1023
1020
|
structure: may("structure"),
|
|
1024
|
-
schema: may("schema"),
|
|
1025
1021
|
why: (what) => known ? sentenceFor(what, level) : NOT_YET
|
|
1026
1022
|
};
|
|
1027
1023
|
}
|
|
@@ -1033,16 +1029,15 @@ function whatYouMayDoWithTable(table, level, known) {
|
|
|
1033
1029
|
return {
|
|
1034
1030
|
...base,
|
|
1035
1031
|
structure: false,
|
|
1036
|
-
|
|
1037
|
-
why: (what) => what === "structure" || what === "schema" ? KERNEL_REASON : base.why(what)
|
|
1032
|
+
why: (what) => what === "structure" ? KERNEL_REASON : base.why(what)
|
|
1038
1033
|
};
|
|
1039
1034
|
}
|
|
1040
1035
|
function tableIsLocked(table) {
|
|
1041
1036
|
return table?.metadata?.["locked"] === true;
|
|
1042
1037
|
}
|
|
1043
|
-
var DATABASE_LOCKED_REASON = "This database is locked, so its columns
|
|
1038
|
+
var DATABASE_LOCKED_REASON = "This database is locked, so its columns and settings are read-only. Unlock it to change them.";
|
|
1044
1039
|
function lockedStructure(base) {
|
|
1045
|
-
return { ...base,
|
|
1040
|
+
return { ...base, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base.why(what) };
|
|
1046
1041
|
}
|
|
1047
1042
|
|
|
1048
1043
|
// src/host.tsx
|
|
@@ -4237,10 +4232,46 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
4237
4232
|
}
|
|
4238
4233
|
|
|
4239
4234
|
// src/Condition.tsx
|
|
4240
|
-
var
|
|
4235
|
+
var import_react32 = require("react");
|
|
4241
4236
|
var import_design_system21 = require("@ai-matrx/design-system");
|
|
4242
4237
|
var import_records16 = require("@ai-matrx/records");
|
|
4243
|
-
var
|
|
4238
|
+
var import_react33 = require("@ai-matrx/records/react");
|
|
4239
|
+
|
|
4240
|
+
// src/personTime.ts
|
|
4241
|
+
var import_react31 = require("react");
|
|
4242
|
+
var import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
|
|
4243
|
+
var zone = null;
|
|
4244
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
4245
|
+
function getPersonTimeZone() {
|
|
4246
|
+
return zone;
|
|
4247
|
+
}
|
|
4248
|
+
function usePersonTimeZone() {
|
|
4249
|
+
return (0, import_react31.useSyncExternalStore)(
|
|
4250
|
+
(cb) => {
|
|
4251
|
+
listeners.add(cb);
|
|
4252
|
+
return () => listeners.delete(cb);
|
|
4253
|
+
},
|
|
4254
|
+
() => zone,
|
|
4255
|
+
() => null
|
|
4256
|
+
);
|
|
4257
|
+
}
|
|
4258
|
+
function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
4259
|
+
if (!zone) return at;
|
|
4260
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
4261
|
+
timeZone: zone,
|
|
4262
|
+
year: "numeric",
|
|
4263
|
+
month: "2-digit",
|
|
4264
|
+
day: "2-digit",
|
|
4265
|
+
hour: "2-digit",
|
|
4266
|
+
minute: "2-digit",
|
|
4267
|
+
second: "2-digit",
|
|
4268
|
+
hourCycle: "h23"
|
|
4269
|
+
}).formatToParts(at);
|
|
4270
|
+
const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
|
|
4271
|
+
return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
|
|
4272
|
+
}
|
|
4273
|
+
|
|
4274
|
+
// src/Condition.tsx
|
|
4244
4275
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4245
4276
|
var CONDITION_OPS = [
|
|
4246
4277
|
{ op: "eq", label: "is" },
|
|
@@ -4251,7 +4282,7 @@ var CONDITION_OPS = [
|
|
|
4251
4282
|
{ op: "gte", label: "is at least" },
|
|
4252
4283
|
{ op: "lte", label: "is at most" }
|
|
4253
4284
|
];
|
|
4254
|
-
var FilterTermsContext = (0,
|
|
4285
|
+
var FilterTermsContext = (0, import_react32.createContext)(false);
|
|
4255
4286
|
var RELATIVE_DAY_TERMS = [
|
|
4256
4287
|
{ kind: "today", label: "is today" },
|
|
4257
4288
|
{ kind: "tomorrow", label: "is tomorrow" },
|
|
@@ -4267,8 +4298,10 @@ var RELATIVE_DAY_TERMS = [
|
|
|
4267
4298
|
{ kind: "past_days", label: "is in the past \u2026 days", takesDays: true }
|
|
4268
4299
|
];
|
|
4269
4300
|
function relativeDayNode(fieldId, kind, days) {
|
|
4301
|
+
const zone2 = getPersonTimeZone();
|
|
4270
4302
|
const window2 = { relative: kind };
|
|
4271
4303
|
if (RELATIVE_DAY_TERMS.find((t) => t.kind === kind)?.takesDays) window2["n"] = days ?? 7;
|
|
4304
|
+
if (zone2) window2["tz"] = zone2;
|
|
4272
4305
|
return { op: "within", args: [{ field: fieldId }, { const: window2 }] };
|
|
4273
4306
|
}
|
|
4274
4307
|
function relativeDayOf(expr) {
|
|
@@ -4300,11 +4333,11 @@ function isChoiceColumn(f) {
|
|
|
4300
4333
|
return kind === "select" || kind === "multi_select";
|
|
4301
4334
|
}
|
|
4302
4335
|
function ChoiceValue({ field, value, onChange }) {
|
|
4303
|
-
const client = (0,
|
|
4304
|
-
const [choices, setChoices] = (0,
|
|
4305
|
-
const [open, setOpen] = (0,
|
|
4306
|
-
const [search, setSearch] = (0,
|
|
4307
|
-
(0,
|
|
4336
|
+
const client = (0, import_react33.useOptionalRecordsClient)();
|
|
4337
|
+
const [choices, setChoices] = (0, import_react32.useState)(null);
|
|
4338
|
+
const [open, setOpen] = (0, import_react32.useState)(false);
|
|
4339
|
+
const [search, setSearch] = (0, import_react32.useState)("");
|
|
4340
|
+
(0, import_react32.useEffect)(() => {
|
|
4308
4341
|
if (!client) return;
|
|
4309
4342
|
let cancelled = false;
|
|
4310
4343
|
void (0, askOnce_exports.fieldOptionsOnce)(client, field.id).then((got) => {
|
|
@@ -4435,7 +4468,7 @@ function conditionValue(typed) {
|
|
|
4435
4468
|
}
|
|
4436
4469
|
function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", className }) {
|
|
4437
4470
|
const node = expr ?? null;
|
|
4438
|
-
const filterTerms = (0,
|
|
4471
|
+
const filterTerms = (0, import_react32.useContext)(FilterTermsContext);
|
|
4439
4472
|
const relative = relativeDayOf(expr);
|
|
4440
4473
|
const reader = meOf(expr);
|
|
4441
4474
|
const op = relative ? `rel:${relative.kind}` : reader ? reader.which : node?.op ?? "";
|
|
@@ -4610,7 +4643,7 @@ function ConditionGroup({
|
|
|
4610
4643
|
className
|
|
4611
4644
|
}) {
|
|
4612
4645
|
const { joiner, args } = clausesOf(expr);
|
|
4613
|
-
const [drafting, setDrafting] = (0,
|
|
4646
|
+
const [drafting, setDrafting] = (0, import_react32.useState)(null);
|
|
4614
4647
|
const nested = depth > 0;
|
|
4615
4648
|
const replaceAt = (index, next) => {
|
|
4616
4649
|
const nextArgs = args.slice();
|
|
@@ -4737,9 +4770,9 @@ function ConditionGroup({
|
|
|
4737
4770
|
}
|
|
4738
4771
|
|
|
4739
4772
|
// src/FieldRetype.tsx
|
|
4740
|
-
var
|
|
4773
|
+
var import_react34 = require("react");
|
|
4741
4774
|
var import_records17 = require("@ai-matrx/records");
|
|
4742
|
-
var
|
|
4775
|
+
var import_react35 = require("@ai-matrx/records/react");
|
|
4743
4776
|
var import_design_system22 = require("@ai-matrx/design-system");
|
|
4744
4777
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4745
4778
|
var RETYPE_TARGETS = [
|
|
@@ -4776,17 +4809,17 @@ function currentTarget(field) {
|
|
|
4776
4809
|
return "text";
|
|
4777
4810
|
}
|
|
4778
4811
|
function FieldRetype({ field, tableId, onRetyped }) {
|
|
4779
|
-
const client = (0,
|
|
4812
|
+
const client = (0, import_react35.useRecordsClient)();
|
|
4780
4813
|
const notify = useRecordsUi().notify;
|
|
4781
|
-
const [to, setTo] = (0,
|
|
4782
|
-
const [preview, setPreview] = (0,
|
|
4783
|
-
const [asking, setAsking] = (0,
|
|
4784
|
-
const [refusal, setRefusal] = (0,
|
|
4785
|
-
const [busy, setBusy] = (0,
|
|
4786
|
-
const [said2, setSaid] = (0,
|
|
4814
|
+
const [to, setTo] = (0, import_react34.useState)(null);
|
|
4815
|
+
const [preview, setPreview] = (0, import_react34.useState)(null);
|
|
4816
|
+
const [asking, setAsking] = (0, import_react34.useState)(false);
|
|
4817
|
+
const [refusal, setRefusal] = (0, import_react34.useState)(null);
|
|
4818
|
+
const [busy, setBusy] = (0, import_react34.useState)(false);
|
|
4819
|
+
const [said2, setSaid] = (0, import_react34.useState)(null);
|
|
4787
4820
|
const name = fieldName(field);
|
|
4788
4821
|
const targets = RETYPE_TARGETS.filter((t) => t.id !== currentTarget(field));
|
|
4789
|
-
(0,
|
|
4822
|
+
(0, import_react34.useEffect)(() => {
|
|
4790
4823
|
if (!to) return;
|
|
4791
4824
|
let cancelled = false;
|
|
4792
4825
|
setPreview(null);
|
|
@@ -4842,7 +4875,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
4842
4875
|
undo: async () => {
|
|
4843
4876
|
const back = await client.migrateUndo({ migration_id: migration });
|
|
4844
4877
|
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
4845
|
-
(0,
|
|
4878
|
+
(0, import_react35.tableShapeChanged)(tableId);
|
|
4846
4879
|
onRetyped?.();
|
|
4847
4880
|
}
|
|
4848
4881
|
});
|
|
@@ -4853,7 +4886,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
4853
4886
|
);
|
|
4854
4887
|
setTo(null);
|
|
4855
4888
|
setPreview(null);
|
|
4856
|
-
(0,
|
|
4889
|
+
(0, import_react35.tableShapeChanged)(tableId);
|
|
4857
4890
|
onRetyped?.();
|
|
4858
4891
|
};
|
|
4859
4892
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-1.5", "data-records-retype": "", children: [
|
|
@@ -4885,9 +4918,9 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
4885
4918
|
}
|
|
4886
4919
|
|
|
4887
4920
|
// src/FieldRulePreview.tsx
|
|
4888
|
-
var
|
|
4921
|
+
var import_react36 = require("react");
|
|
4889
4922
|
var import_records18 = require("@ai-matrx/records");
|
|
4890
|
-
var
|
|
4923
|
+
var import_react37 = require("@ai-matrx/records/react");
|
|
4891
4924
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4892
4925
|
var PREVIEW_GROUPS2 = 1e3;
|
|
4893
4926
|
function ruleWords(rules) {
|
|
@@ -4905,14 +4938,14 @@ function groupValue(value, numbers) {
|
|
|
4905
4938
|
return /^-?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?$/.test(text) ? Number(text) : value;
|
|
4906
4939
|
}
|
|
4907
4940
|
function FieldRulePreview({ field, tableId, rules }) {
|
|
4908
|
-
const client = (0,
|
|
4909
|
-
const [preview, setPreview] = (0,
|
|
4910
|
-
const [refusal, setRefusal] = (0,
|
|
4911
|
-
const key = (0,
|
|
4912
|
-
const latest = (0,
|
|
4941
|
+
const client = (0, import_react37.useRecordsClient)();
|
|
4942
|
+
const [preview, setPreview] = (0, import_react36.useState)(null);
|
|
4943
|
+
const [refusal, setRefusal] = (0, import_react36.useState)(null);
|
|
4944
|
+
const key = (0, import_react36.useMemo)(() => ruleWords(rules), [rules]);
|
|
4945
|
+
const latest = (0, import_react36.useRef)(rules);
|
|
4913
4946
|
latest.current = rules;
|
|
4914
4947
|
const name = fieldName(field);
|
|
4915
|
-
(0,
|
|
4948
|
+
(0, import_react36.useEffect)(() => {
|
|
4916
4949
|
let cancelled = false;
|
|
4917
4950
|
setPreview(null);
|
|
4918
4951
|
setRefusal(null);
|
|
@@ -5033,9 +5066,9 @@ function choiceLookForNewList(multi, rows) {
|
|
|
5033
5066
|
}
|
|
5034
5067
|
|
|
5035
5068
|
// src/ChoiceListEditor.tsx
|
|
5036
|
-
var
|
|
5069
|
+
var import_react38 = require("react");
|
|
5037
5070
|
var import_records19 = require("@ai-matrx/records");
|
|
5038
|
-
var
|
|
5071
|
+
var import_react39 = require("@ai-matrx/records/react");
|
|
5039
5072
|
var import_design_system23 = require("@ai-matrx/design-system");
|
|
5040
5073
|
var import_data_table5 = require("@ai-matrx/design-system/data-table");
|
|
5041
5074
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -5080,15 +5113,15 @@ function ChoiceListEditor({
|
|
|
5080
5113
|
rehome = {},
|
|
5081
5114
|
onRehome
|
|
5082
5115
|
}) {
|
|
5083
|
-
const client = (0,
|
|
5084
|
-
const [refused, setRefused] = (0,
|
|
5085
|
-
const [usage, setUsage] = (0,
|
|
5086
|
-
const [asking, setAsking] = (0,
|
|
5087
|
-
const [moveTo, setMoveTo] = (0,
|
|
5088
|
-
const focusRow = (0,
|
|
5089
|
-
const [removed, setRemoved] = (0,
|
|
5116
|
+
const client = (0, import_react39.useRecordsClient)();
|
|
5117
|
+
const [refused, setRefused] = (0, import_react38.useState)(null);
|
|
5118
|
+
const [usage, setUsage] = (0, import_react38.useState)(null);
|
|
5119
|
+
const [asking, setAsking] = (0, import_react38.useState)(null);
|
|
5120
|
+
const [moveTo, setMoveTo] = (0, import_react38.useState)("");
|
|
5121
|
+
const focusRow = (0, import_react38.useRef)(null);
|
|
5122
|
+
const [removed, setRemoved] = (0, import_react38.useState)({});
|
|
5090
5123
|
const fieldId = field?.id ?? null;
|
|
5091
|
-
(0,
|
|
5124
|
+
(0, import_react38.useEffect)(() => {
|
|
5092
5125
|
if (rows !== null || !fieldId || !field) return;
|
|
5093
5126
|
let live = true;
|
|
5094
5127
|
void client.fieldOptions({ field_id: fieldId }).then((got) => {
|
|
@@ -5105,7 +5138,7 @@ function ChoiceListEditor({
|
|
|
5105
5138
|
live = false;
|
|
5106
5139
|
};
|
|
5107
5140
|
}, [client, fieldId, rows, onRows, onStart]);
|
|
5108
|
-
(0,
|
|
5141
|
+
(0, import_react38.useEffect)(() => {
|
|
5109
5142
|
if (!onRehome || !fieldId) return;
|
|
5110
5143
|
let live = true;
|
|
5111
5144
|
void client.fieldChoiceUsage({ field_id: fieldId }).then(
|
|
@@ -5245,7 +5278,7 @@ function ChoiceListEditor({
|
|
|
5245
5278
|
] });
|
|
5246
5279
|
}
|
|
5247
5280
|
function ChoiceSwatch({ words, color, onColor }) {
|
|
5248
|
-
const [open, setOpen] = (0,
|
|
5281
|
+
const [open, setOpen] = (0, import_react38.useState)(false);
|
|
5249
5282
|
const pick = (next) => {
|
|
5250
5283
|
onColor(next);
|
|
5251
5284
|
setOpen(false);
|
|
@@ -5686,37 +5719,6 @@ function readersSentence(count, tableName2) {
|
|
|
5686
5719
|
return `${rollups} on ${tableName2 ?? "this table"} read through this.`;
|
|
5687
5720
|
}
|
|
5688
5721
|
|
|
5689
|
-
// src/personTime.ts
|
|
5690
|
-
var import_react39 = require("react");
|
|
5691
|
-
var import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
|
|
5692
|
-
var zone = null;
|
|
5693
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
5694
|
-
function usePersonTimeZone() {
|
|
5695
|
-
return (0, import_react39.useSyncExternalStore)(
|
|
5696
|
-
(cb) => {
|
|
5697
|
-
listeners.add(cb);
|
|
5698
|
-
return () => listeners.delete(cb);
|
|
5699
|
-
},
|
|
5700
|
-
() => zone,
|
|
5701
|
-
() => null
|
|
5702
|
-
);
|
|
5703
|
-
}
|
|
5704
|
-
function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
5705
|
-
if (!zone) return at;
|
|
5706
|
-
const parts = new Intl.DateTimeFormat("en-US", {
|
|
5707
|
-
timeZone: zone,
|
|
5708
|
-
year: "numeric",
|
|
5709
|
-
month: "2-digit",
|
|
5710
|
-
day: "2-digit",
|
|
5711
|
-
hour: "2-digit",
|
|
5712
|
-
minute: "2-digit",
|
|
5713
|
-
second: "2-digit",
|
|
5714
|
-
hourCycle: "h23"
|
|
5715
|
-
}).formatToParts(at);
|
|
5716
|
-
const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
|
|
5717
|
-
return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
|
|
5718
|
-
}
|
|
5719
|
-
|
|
5720
5722
|
// src/gridMenus.ts
|
|
5721
5723
|
function nextFieldSort(fields) {
|
|
5722
5724
|
let last = 0;
|
|
@@ -6081,8 +6083,8 @@ function FieldEditor(props) {
|
|
|
6081
6083
|
const entityMutation = (0, import_react43.useEntityFieldMutation)();
|
|
6082
6084
|
const mutation = onEntity ? { saving: entityMutation.saving, error: entityMutation.error } : { saving: tableMutation.saving, error: tableMutation.error };
|
|
6083
6085
|
const client = (0, import_react43.useRecordsClient)();
|
|
6084
|
-
const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights2.
|
|
6085
|
-
const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights2.why("
|
|
6086
|
+
const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights2.structure;
|
|
6087
|
+
const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights2.why("structure");
|
|
6086
6088
|
const storeLabel = onEntity ? entityRights.data?.label ?? null : table.data?.name ?? null;
|
|
6087
6089
|
const tableLabel = props.tableLabel ?? storeLabel;
|
|
6088
6090
|
const offered = onEntity ? STANDARD_TABLE_FIELD_CHOICES : FIELD_TYPE_CHOICES;
|