@ai-matrx/records-ui 0.113.31 → 0.113.32
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 +26 -12
- package/dist/first-page.cjs +59 -602
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.d.cts +17 -251
- package/dist/first-page.d.ts +17 -251
- package/dist/first-page.js +25 -594
- package/dist/first-page.js.map +1 -1
- package/dist/index.cjs +445 -1295
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -537
- package/dist/index.d.ts +34 -537
- package/dist/index.js +360 -1159
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +237 -237
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +116 -116
- package/dist/pickers.js.map +1 -1
- package/package.json +5 -5
package/dist/pickers.js
CHANGED
|
@@ -2473,10 +2473,92 @@ import { formatFieldValue as formatFieldValue3 } from "@ai-matrx/design-system/f
|
|
|
2473
2473
|
import { Badge as Badge5, cn as cn17 } from "@ai-matrx/design-system";
|
|
2474
2474
|
|
|
2475
2475
|
// src/embeddedLook.tsx
|
|
2476
|
-
import { createContext as
|
|
2476
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
2477
|
+
|
|
2478
|
+
// src/presentation.ts
|
|
2479
|
+
import { parseTableStyle, tableStyleIsEmpty } from "@ai-matrx/design-system/data-table/table-style";
|
|
2480
|
+
import {
|
|
2481
|
+
COLOR_ROTATION
|
|
2482
|
+
} from "@ai-matrx/design-system/data-table";
|
|
2483
|
+
import { getFieldFormat } from "@ai-matrx/design-system/field-formats";
|
|
2484
|
+
import { newerKindOf as newerKindOf4, ratingMaxOf } from "@ai-matrx/records";
|
|
2485
|
+
var DRAWN_KINDS = /* @__PURE__ */ new Set(["select", "multi_select", "relation", "member", "person", "attachment", "file", "entity_reference", "checkbox", "boolean", "signature", "json"]);
|
|
2486
|
+
function shownAsOf(field) {
|
|
2487
|
+
if (DRAWN_KINDS.has(String(editorKindFor(field)))) return void 0;
|
|
2488
|
+
const raw = field.display_format;
|
|
2489
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
2490
|
+
const id = raw.id;
|
|
2491
|
+
if (typeof id !== "string" || id === "formula" || !getFieldFormat(id)) return void 0;
|
|
2492
|
+
const options = raw.options;
|
|
2493
|
+
return options && typeof options === "object" && Object.keys(options).length > 0 ? { id, options } : { id };
|
|
2494
|
+
}
|
|
2495
|
+
function formatForField(field) {
|
|
2496
|
+
const shownAs = shownAsOf(field);
|
|
2497
|
+
if (newerKindOf4(field) === "rating" && (!shownAs || shownAs.id === "rating")) {
|
|
2498
|
+
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: ratingMaxOf(field) } };
|
|
2499
|
+
}
|
|
2500
|
+
if (shownAs) return shownAs;
|
|
2501
|
+
const stamp = dateFormatFor(field);
|
|
2502
|
+
if (stamp && editorKindFor(field) !== "datetime") return stamp;
|
|
2503
|
+
switch (editorKindFor(field)) {
|
|
2504
|
+
case "currency":
|
|
2505
|
+
return {
|
|
2506
|
+
id: "currency",
|
|
2507
|
+
options: { currency: currencyCodeFor(field.unit) }
|
|
2508
|
+
};
|
|
2509
|
+
case "percent":
|
|
2510
|
+
return { id: "percent" };
|
|
2511
|
+
case "datetime":
|
|
2512
|
+
return String(field.config?.["kind"] ?? "") === "date" ? { id: "date" } : { id: "datetime" };
|
|
2513
|
+
case "email":
|
|
2514
|
+
return { id: "email" };
|
|
2515
|
+
case "url":
|
|
2516
|
+
return { id: "url" };
|
|
2517
|
+
case "phone":
|
|
2518
|
+
return { id: "phone" };
|
|
2519
|
+
case "number":
|
|
2520
|
+
return { id: "number" };
|
|
2521
|
+
default:
|
|
2522
|
+
return void 0;
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
var SYMBOL_TO_CODE = {
|
|
2526
|
+
$: "USD",
|
|
2527
|
+
"\xA3": "GBP",
|
|
2528
|
+
"\u20AC": "EUR",
|
|
2529
|
+
"\xA5": "JPY",
|
|
2530
|
+
"\u20B9": "INR",
|
|
2531
|
+
"\u20BD": "RUB",
|
|
2532
|
+
"\u20A9": "KRW",
|
|
2533
|
+
"R$": "BRL",
|
|
2534
|
+
"C$": "CAD",
|
|
2535
|
+
"A$": "AUD"
|
|
2536
|
+
};
|
|
2537
|
+
function currencyCodeFor(unit) {
|
|
2538
|
+
const raw = (unit ?? "").trim();
|
|
2539
|
+
if (raw === "") return "USD";
|
|
2540
|
+
return SYMBOL_TO_CODE[raw] ?? raw.toUpperCase();
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
// src/embeddedLook.tsx
|
|
2544
|
+
var EmbeddedLookContext = createContext2(null);
|
|
2545
|
+
var EmbeddedLookProvider = EmbeddedLookContext.Provider;
|
|
2546
|
+
function useEmbeddedLook() {
|
|
2547
|
+
return useContext2(EmbeddedLookContext);
|
|
2548
|
+
}
|
|
2549
|
+
var EMBEDDED_TABLE_CLASS = [
|
|
2550
|
+
"[&_tbody_td]:h-10",
|
|
2551
|
+
"[&_tbody_td]:align-middle!",
|
|
2552
|
+
"[&_tbody_td]:border-r",
|
|
2553
|
+
"[&_tbody_td]:border-border",
|
|
2554
|
+
"[&_tbody_td:last-child]:border-r-0",
|
|
2555
|
+
"[&_thead_th]:border-r",
|
|
2556
|
+
"[&_thead_th]:border-border",
|
|
2557
|
+
"[&_thead_th:last-child]:border-r-0"
|
|
2558
|
+
].join(" ");
|
|
2477
2559
|
|
|
2478
2560
|
// src/labels.tsx
|
|
2479
|
-
import { createContext as
|
|
2561
|
+
import { createContext as createContext3, useCallback as useCallback3, useContext as useContext3, useEffect as useEffect8, useMemo as useMemo7, useRef as useRef6, useState as useState10 } from "react";
|
|
2480
2562
|
import { useRecordsClient as useRecordsClient4 } from "@ai-matrx/records/react";
|
|
2481
2563
|
import { autonumberPrefixOf, autonumberWords } from "@ai-matrx/records";
|
|
2482
2564
|
import { newerKindExportWords, optionKey } from "@ai-matrx/records";
|
|
@@ -2754,7 +2836,7 @@ function encodeAt(canvas, type, maxWidth, quality) {
|
|
|
2754
2836
|
|
|
2755
2837
|
// src/labels.tsx
|
|
2756
2838
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2757
|
-
var LabelContext =
|
|
2839
|
+
var LabelContext = createContext3({
|
|
2758
2840
|
// With no provider the resolver is ABSENT, not silently empty: a caller gets
|
|
2759
2841
|
// null and says "Loading…" forever, which is visible. The mount always
|
|
2760
2842
|
// provides one, so this is only ever a bare unit test.
|
|
@@ -2944,125 +3026,13 @@ function RecordLabelProvider({ children }) {
|
|
|
2944
3026
|
return /* @__PURE__ */ jsx13(LabelContext.Provider, { value, children });
|
|
2945
3027
|
}
|
|
2946
3028
|
function useRecordLabels(fields) {
|
|
2947
|
-
const { lookup, want } =
|
|
3029
|
+
const { lookup, want } = useContext3(LabelContext);
|
|
2948
3030
|
useEffect8(() => {
|
|
2949
3031
|
for (const field of fields ?? []) want(field);
|
|
2950
3032
|
}, [fields, want]);
|
|
2951
3033
|
return lookup;
|
|
2952
3034
|
}
|
|
2953
3035
|
|
|
2954
|
-
// src/personTime.ts
|
|
2955
|
-
import { useSyncExternalStore } from "react";
|
|
2956
|
-
var zone = null;
|
|
2957
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
2958
|
-
function usePersonTimeZone() {
|
|
2959
|
-
return useSyncExternalStore(
|
|
2960
|
-
(cb) => {
|
|
2961
|
-
listeners.add(cb);
|
|
2962
|
-
return () => listeners.delete(cb);
|
|
2963
|
-
},
|
|
2964
|
-
() => zone,
|
|
2965
|
-
() => null
|
|
2966
|
-
);
|
|
2967
|
-
}
|
|
2968
|
-
function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
2969
|
-
if (!zone) return at;
|
|
2970
|
-
const parts = new Intl.DateTimeFormat("en-US", {
|
|
2971
|
-
timeZone: zone,
|
|
2972
|
-
year: "numeric",
|
|
2973
|
-
month: "2-digit",
|
|
2974
|
-
day: "2-digit",
|
|
2975
|
-
hour: "2-digit",
|
|
2976
|
-
minute: "2-digit",
|
|
2977
|
-
second: "2-digit",
|
|
2978
|
-
hourCycle: "h23"
|
|
2979
|
-
}).formatToParts(at);
|
|
2980
|
-
const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
|
|
2981
|
-
return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
|
-
// src/presentation.ts
|
|
2985
|
-
import { parseTableStyle, tableStyleIsEmpty } from "@ai-matrx/design-system/data-table/table-style";
|
|
2986
|
-
import {
|
|
2987
|
-
COLOR_ROTATION
|
|
2988
|
-
} from "@ai-matrx/design-system/data-table";
|
|
2989
|
-
import { getFieldFormat } from "@ai-matrx/design-system/field-formats";
|
|
2990
|
-
import { newerKindOf as newerKindOf4, ratingMaxOf } from "@ai-matrx/records";
|
|
2991
|
-
var DRAWN_KINDS = /* @__PURE__ */ new Set(["select", "multi_select", "relation", "member", "person", "attachment", "file", "entity_reference", "checkbox", "boolean", "signature", "json"]);
|
|
2992
|
-
function shownAsOf(field) {
|
|
2993
|
-
if (DRAWN_KINDS.has(String(editorKindFor(field)))) return void 0;
|
|
2994
|
-
const raw = field.display_format;
|
|
2995
|
-
if (!raw || typeof raw !== "object") return void 0;
|
|
2996
|
-
const id = raw.id;
|
|
2997
|
-
if (typeof id !== "string" || id === "formula" || !getFieldFormat(id)) return void 0;
|
|
2998
|
-
const options = raw.options;
|
|
2999
|
-
return options && typeof options === "object" && Object.keys(options).length > 0 ? { id, options } : { id };
|
|
3000
|
-
}
|
|
3001
|
-
function formatForField(field) {
|
|
3002
|
-
const shownAs = shownAsOf(field);
|
|
3003
|
-
if (newerKindOf4(field) === "rating" && (!shownAs || shownAs.id === "rating")) {
|
|
3004
|
-
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: ratingMaxOf(field) } };
|
|
3005
|
-
}
|
|
3006
|
-
if (shownAs) return shownAs;
|
|
3007
|
-
const stamp = dateFormatFor(field);
|
|
3008
|
-
if (stamp && editorKindFor(field) !== "datetime") return stamp;
|
|
3009
|
-
switch (editorKindFor(field)) {
|
|
3010
|
-
case "currency":
|
|
3011
|
-
return {
|
|
3012
|
-
id: "currency",
|
|
3013
|
-
options: { currency: currencyCodeFor(field.unit) }
|
|
3014
|
-
};
|
|
3015
|
-
case "percent":
|
|
3016
|
-
return { id: "percent" };
|
|
3017
|
-
case "datetime":
|
|
3018
|
-
return String(field.config?.["kind"] ?? "") === "date" ? { id: "date" } : { id: "datetime" };
|
|
3019
|
-
case "email":
|
|
3020
|
-
return { id: "email" };
|
|
3021
|
-
case "url":
|
|
3022
|
-
return { id: "url" };
|
|
3023
|
-
case "phone":
|
|
3024
|
-
return { id: "phone" };
|
|
3025
|
-
case "number":
|
|
3026
|
-
return { id: "number" };
|
|
3027
|
-
default:
|
|
3028
|
-
return void 0;
|
|
3029
|
-
}
|
|
3030
|
-
}
|
|
3031
|
-
var SYMBOL_TO_CODE = {
|
|
3032
|
-
$: "USD",
|
|
3033
|
-
"\xA3": "GBP",
|
|
3034
|
-
"\u20AC": "EUR",
|
|
3035
|
-
"\xA5": "JPY",
|
|
3036
|
-
"\u20B9": "INR",
|
|
3037
|
-
"\u20BD": "RUB",
|
|
3038
|
-
"\u20A9": "KRW",
|
|
3039
|
-
"R$": "BRL",
|
|
3040
|
-
"C$": "CAD",
|
|
3041
|
-
"A$": "AUD"
|
|
3042
|
-
};
|
|
3043
|
-
function currencyCodeFor(unit) {
|
|
3044
|
-
const raw = (unit ?? "").trim();
|
|
3045
|
-
if (raw === "") return "USD";
|
|
3046
|
-
return SYMBOL_TO_CODE[raw] ?? raw.toUpperCase();
|
|
3047
|
-
}
|
|
3048
|
-
|
|
3049
|
-
// src/embeddedLook.tsx
|
|
3050
|
-
var EmbeddedLookContext = createContext3(null);
|
|
3051
|
-
var EmbeddedLookProvider = EmbeddedLookContext.Provider;
|
|
3052
|
-
function useEmbeddedLook() {
|
|
3053
|
-
return useContext3(EmbeddedLookContext);
|
|
3054
|
-
}
|
|
3055
|
-
var EMBEDDED_TABLE_CLASS = [
|
|
3056
|
-
"[&_tbody_td]:h-10",
|
|
3057
|
-
"[&_tbody_td]:align-middle!",
|
|
3058
|
-
"[&_tbody_td]:border-r",
|
|
3059
|
-
"[&_tbody_td]:border-border",
|
|
3060
|
-
"[&_tbody_td:last-child]:border-r-0",
|
|
3061
|
-
"[&_thead_th]:border-r",
|
|
3062
|
-
"[&_thead_th]:border-border",
|
|
3063
|
-
"[&_thead_th:last-child]:border-r-0"
|
|
3064
|
-
].join(" ");
|
|
3065
|
-
|
|
3066
3036
|
// src/enumLabels.ts
|
|
3067
3037
|
function exhaustiveValuesOf() {
|
|
3068
3038
|
return function(values) {
|
|
@@ -5704,6 +5674,36 @@ function readersSentence(count, tableName2) {
|
|
|
5704
5674
|
return `${rollups} on ${tableName2 ?? "this table"} read through this.`;
|
|
5705
5675
|
}
|
|
5706
5676
|
|
|
5677
|
+
// src/personTime.ts
|
|
5678
|
+
import { useSyncExternalStore } from "react";
|
|
5679
|
+
var zone = null;
|
|
5680
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
5681
|
+
function usePersonTimeZone() {
|
|
5682
|
+
return useSyncExternalStore(
|
|
5683
|
+
(cb) => {
|
|
5684
|
+
listeners.add(cb);
|
|
5685
|
+
return () => listeners.delete(cb);
|
|
5686
|
+
},
|
|
5687
|
+
() => zone,
|
|
5688
|
+
() => null
|
|
5689
|
+
);
|
|
5690
|
+
}
|
|
5691
|
+
function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
5692
|
+
if (!zone) return at;
|
|
5693
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
5694
|
+
timeZone: zone,
|
|
5695
|
+
year: "numeric",
|
|
5696
|
+
month: "2-digit",
|
|
5697
|
+
day: "2-digit",
|
|
5698
|
+
hour: "2-digit",
|
|
5699
|
+
minute: "2-digit",
|
|
5700
|
+
second: "2-digit",
|
|
5701
|
+
hourCycle: "h23"
|
|
5702
|
+
}).formatToParts(at);
|
|
5703
|
+
const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
|
|
5704
|
+
return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
|
|
5705
|
+
}
|
|
5706
|
+
|
|
5707
5707
|
// src/gridMenus.ts
|
|
5708
5708
|
function nextFieldSort(fields) {
|
|
5709
5709
|
let last = 0;
|