@ai-matrx/records-ui 0.113.38 → 0.114.0

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/dist/pickers.js CHANGED
@@ -998,7 +998,9 @@ var NEEDS = {
998
998
  // custom.share_grant — passing your access on is an administrator's right
999
999
  share: "admin",
1000
1000
  // custom.field_declare / field_update / field_retire / table settings
1001
- structure: "admin"
1001
+ structure: "admin",
1002
+ // custom.field_declare / field_update / field_retire — the same rung; a lock takes it away, nothing else does
1003
+ schema: "admin"
1002
1004
  };
1003
1005
  var NOT_YET = "Still asking the store what you may do here. Nothing is offered until it has answered.";
1004
1006
  var NOTHING_AT_ALL = "You have not been given this. Ask somebody who administers it to share it with you.";
@@ -1013,7 +1015,8 @@ function sentenceFor(what, level) {
1013
1015
  organise: "organise this",
1014
1016
  remove: "delete this",
1015
1017
  share: "pass this on to somebody else",
1016
- structure: "change the columns of this table"
1018
+ structure: "change the columns of this table",
1019
+ schema: "change the columns of this table"
1017
1020
  };
1018
1021
  return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
1019
1022
  }
@@ -1029,6 +1032,7 @@ function whatYouMayDo(level, known = true) {
1029
1032
  remove: may("remove"),
1030
1033
  share: may("share"),
1031
1034
  structure: may("structure"),
1035
+ schema: may("schema"),
1032
1036
  why: (what) => known ? sentenceFor(what, level) : NOT_YET
1033
1037
  };
1034
1038
  }
@@ -1040,15 +1044,16 @@ function whatYouMayDoWithTable(table, level, known) {
1040
1044
  return {
1041
1045
  ...base,
1042
1046
  structure: false,
1043
- why: (what) => what === "structure" ? KERNEL_REASON : base.why(what)
1047
+ schema: false,
1048
+ why: (what) => what === "structure" || what === "schema" ? KERNEL_REASON : base.why(what)
1044
1049
  };
1045
1050
  }
1046
1051
  function tableIsLocked(table) {
1047
1052
  return table?.metadata?.["locked"] === true;
1048
1053
  }
1049
- var DATABASE_LOCKED_REASON = "This database is locked, so its columns and settings are read-only. Unlock it to change them.";
1054
+ var DATABASE_LOCKED_REASON = "This database is locked, so its columns cannot be added, renamed, changed or deleted. Unlock it to change them.";
1050
1055
  function lockedStructure(base) {
1051
- return { ...base, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base.why(what) };
1056
+ return { ...base, schema: false, why: (what) => what === "schema" ? DATABASE_LOCKED_REASON : base.why(what) };
1052
1057
  }
1053
1058
 
1054
1059
  // src/host.tsx
@@ -4293,42 +4298,6 @@ import { createContext as createContext4, useContext as useContext4, useEffect a
4293
4298
  import { BasicInput as BasicInput6, Button as Button10 } from "@ai-matrx/design-system";
4294
4299
  import { optionKey as optionKey2, optionLabel, rankTypedMatches as rankTypedMatches2 } from "@ai-matrx/records";
4295
4300
  import { useOptionalRecordsClient as useOptionalRecordsClient5 } from "@ai-matrx/records/react";
4296
-
4297
- // src/personTime.ts
4298
- import { useSyncExternalStore } from "react";
4299
- import { setColorRuleTimeZone } from "@ai-matrx/design-system/data-table/table-style";
4300
- var zone = null;
4301
- var listeners = /* @__PURE__ */ new Set();
4302
- function getPersonTimeZone() {
4303
- return zone;
4304
- }
4305
- function usePersonTimeZone() {
4306
- return useSyncExternalStore(
4307
- (cb) => {
4308
- listeners.add(cb);
4309
- return () => listeners.delete(cb);
4310
- },
4311
- () => zone,
4312
- () => null
4313
- );
4314
- }
4315
- function personWallNow(at = /* @__PURE__ */ new Date()) {
4316
- if (!zone) return at;
4317
- const parts = new Intl.DateTimeFormat("en-US", {
4318
- timeZone: zone,
4319
- year: "numeric",
4320
- month: "2-digit",
4321
- day: "2-digit",
4322
- hour: "2-digit",
4323
- minute: "2-digit",
4324
- second: "2-digit",
4325
- hourCycle: "h23"
4326
- }).formatToParts(at);
4327
- const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
4328
- return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
4329
- }
4330
-
4331
- // src/Condition.tsx
4332
4301
  import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4333
4302
  var CONDITION_OPS = [
4334
4303
  { op: "eq", label: "is" },
@@ -4355,10 +4324,8 @@ var RELATIVE_DAY_TERMS = [
4355
4324
  { kind: "past_days", label: "is in the past \u2026 days", takesDays: true }
4356
4325
  ];
4357
4326
  function relativeDayNode(fieldId, kind, days) {
4358
- const zone2 = getPersonTimeZone();
4359
4327
  const window2 = { relative: kind };
4360
4328
  if (RELATIVE_DAY_TERMS.find((t) => t.kind === kind)?.takesDays) window2["n"] = days ?? 7;
4361
- if (zone2) window2["tz"] = zone2;
4362
4329
  return { op: "within", args: [{ field: fieldId }, { const: window2 }] };
4363
4330
  }
4364
4331
  function relativeDayOf(expr) {
@@ -5798,6 +5765,37 @@ function readersSentence(count, tableName2) {
5798
5765
  return `${rollups} on ${tableName2 ?? "this table"} read through this.`;
5799
5766
  }
5800
5767
 
5768
+ // src/personTime.ts
5769
+ import { useSyncExternalStore } from "react";
5770
+ import { setColorRuleTimeZone } from "@ai-matrx/design-system/data-table/table-style";
5771
+ var zone = null;
5772
+ var listeners = /* @__PURE__ */ new Set();
5773
+ function usePersonTimeZone() {
5774
+ return useSyncExternalStore(
5775
+ (cb) => {
5776
+ listeners.add(cb);
5777
+ return () => listeners.delete(cb);
5778
+ },
5779
+ () => zone,
5780
+ () => null
5781
+ );
5782
+ }
5783
+ function personWallNow(at = /* @__PURE__ */ new Date()) {
5784
+ if (!zone) return at;
5785
+ const parts = new Intl.DateTimeFormat("en-US", {
5786
+ timeZone: zone,
5787
+ year: "numeric",
5788
+ month: "2-digit",
5789
+ day: "2-digit",
5790
+ hour: "2-digit",
5791
+ minute: "2-digit",
5792
+ second: "2-digit",
5793
+ hourCycle: "h23"
5794
+ }).formatToParts(at);
5795
+ const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
5796
+ return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
5797
+ }
5798
+
5801
5799
  // src/gridMenus.ts
5802
5800
  function nextFieldSort(fields) {
5803
5801
  let last = 0;
@@ -6162,8 +6160,8 @@ function FieldEditor(props) {
6162
6160
  const entityMutation = useEntityFieldMutation();
6163
6161
  const mutation = onEntity ? { saving: entityMutation.saving, error: entityMutation.error } : { saving: tableMutation.saving, error: tableMutation.error };
6164
6162
  const client = useRecordsClient9();
6165
- const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights2.structure;
6166
- const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights2.why("structure");
6163
+ const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights2.schema;
6164
+ const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights2.why("schema");
6167
6165
  const storeLabel = onEntity ? entityRights.data?.label ?? null : table.data?.name ?? null;
6168
6166
  const tableLabel = props.tableLabel ?? storeLabel;
6169
6167
  const offered = onEntity ? STANDARD_TABLE_FIELD_CHOICES : FIELD_TYPE_CHOICES;