@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/dist/pickers.js CHANGED
@@ -998,9 +998,7 @@ 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",
1002
- // custom.field_declare / field_update / field_retire — the same rung; a lock takes it away, nothing else does
1003
- schema: "admin"
1001
+ structure: "admin"
1004
1002
  };
1005
1003
  var NOT_YET = "Still asking the store what you may do here. Nothing is offered until it has answered.";
1006
1004
  var NOTHING_AT_ALL = "You have not been given this. Ask somebody who administers it to share it with you.";
@@ -1015,8 +1013,7 @@ function sentenceFor(what, level) {
1015
1013
  organise: "organise this",
1016
1014
  remove: "delete this",
1017
1015
  share: "pass this on to somebody else",
1018
- structure: "change the columns of this table",
1019
- schema: "change the columns of this table"
1016
+ structure: "change the columns of this table"
1020
1017
  };
1021
1018
  return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
1022
1019
  }
@@ -1032,7 +1029,6 @@ function whatYouMayDo(level, known = true) {
1032
1029
  remove: may("remove"),
1033
1030
  share: may("share"),
1034
1031
  structure: may("structure"),
1035
- schema: may("schema"),
1036
1032
  why: (what) => known ? sentenceFor(what, level) : NOT_YET
1037
1033
  };
1038
1034
  }
@@ -1044,16 +1040,15 @@ function whatYouMayDoWithTable(table, level, known) {
1044
1040
  return {
1045
1041
  ...base,
1046
1042
  structure: false,
1047
- schema: false,
1048
- why: (what) => what === "structure" || what === "schema" ? KERNEL_REASON : base.why(what)
1043
+ why: (what) => what === "structure" ? KERNEL_REASON : base.why(what)
1049
1044
  };
1050
1045
  }
1051
1046
  function tableIsLocked(table) {
1052
1047
  return table?.metadata?.["locked"] === true;
1053
1048
  }
1054
- var DATABASE_LOCKED_REASON = "This database is locked, so its columns cannot be added, renamed, changed or deleted. Unlock it to change them.";
1049
+ var DATABASE_LOCKED_REASON = "This database is locked, so its columns and settings are read-only. Unlock it to change them.";
1055
1050
  function lockedStructure(base) {
1056
- return { ...base, schema: false, why: (what) => what === "schema" ? DATABASE_LOCKED_REASON : base.why(what) };
1051
+ return { ...base, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base.why(what) };
1057
1052
  }
1058
1053
 
1059
1054
  // src/host.tsx
@@ -4298,6 +4293,42 @@ import { createContext as createContext4, useContext as useContext4, useEffect a
4298
4293
  import { BasicInput as BasicInput6, Button as Button10 } from "@ai-matrx/design-system";
4299
4294
  import { optionKey as optionKey2, optionLabel, rankTypedMatches as rankTypedMatches2 } from "@ai-matrx/records";
4300
4295
  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
4301
4332
  import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
4302
4333
  var CONDITION_OPS = [
4303
4334
  { op: "eq", label: "is" },
@@ -4324,8 +4355,10 @@ var RELATIVE_DAY_TERMS = [
4324
4355
  { kind: "past_days", label: "is in the past \u2026 days", takesDays: true }
4325
4356
  ];
4326
4357
  function relativeDayNode(fieldId, kind, days) {
4358
+ const zone2 = getPersonTimeZone();
4327
4359
  const window2 = { relative: kind };
4328
4360
  if (RELATIVE_DAY_TERMS.find((t) => t.kind === kind)?.takesDays) window2["n"] = days ?? 7;
4361
+ if (zone2) window2["tz"] = zone2;
4329
4362
  return { op: "within", args: [{ field: fieldId }, { const: window2 }] };
4330
4363
  }
4331
4364
  function relativeDayOf(expr) {
@@ -5765,37 +5798,6 @@ function readersSentence(count, tableName2) {
5765
5798
  return `${rollups} on ${tableName2 ?? "this table"} read through this.`;
5766
5799
  }
5767
5800
 
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
-
5799
5801
  // src/gridMenus.ts
5800
5802
  function nextFieldSort(fields) {
5801
5803
  let last = 0;
@@ -6160,8 +6162,8 @@ function FieldEditor(props) {
6160
6162
  const entityMutation = useEntityFieldMutation();
6161
6163
  const mutation = onEntity ? { saving: entityMutation.saving, error: entityMutation.error } : { saving: tableMutation.saving, error: tableMutation.error };
6162
6164
  const client = useRecordsClient9();
6163
- const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights2.schema;
6164
- const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights2.why("schema");
6165
+ const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights2.structure;
6166
+ const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights2.why("structure");
6165
6167
  const storeLabel = onEntity ? entityRights.data?.label ?? null : table.data?.name ?? null;
6166
6168
  const tableLabel = props.tableLabel ?? storeLabel;
6167
6169
  const offered = onEntity ? STANDARD_TABLE_FIELD_CHOICES : FIELD_TYPE_CHOICES;