@ai-matrx/records-ui 0.115.98 → 0.115.99
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 +5 -0
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.js.map +1 -1
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +267 -173
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -9
- package/dist/index.d.ts +7 -9
- package/dist/index.js +467 -373
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +24 -7
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +24 -7
- package/dist/pickers.js.map +1 -1
- package/package.json +3 -3
package/dist/pickers.js
CHANGED
|
@@ -6322,12 +6322,25 @@ function shownAsOf(field) {
|
|
|
6322
6322
|
const options = raw.options;
|
|
6323
6323
|
return options && typeof options === "object" && Object.keys(options).length > 0 ? { id, options } : { id };
|
|
6324
6324
|
}
|
|
6325
|
+
var YEAR_NAMES = /(^|[\s_-])(year|founded|established|incorporated|vintage)([\s_-]|$)/i;
|
|
6326
|
+
function isYearField(field) {
|
|
6327
|
+
return YEAR_NAMES.test(String(field.label ?? "")) || YEAR_NAMES.test(field.key);
|
|
6328
|
+
}
|
|
6329
|
+
function isYearValue(value) {
|
|
6330
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 1e3 && value <= 2999;
|
|
6331
|
+
}
|
|
6332
|
+
function ungroupedForYears(field, format) {
|
|
6333
|
+
if (format.id !== "number" || !isYearField(field)) return format;
|
|
6334
|
+
const options = format.options ?? {};
|
|
6335
|
+
if (options["useGrouping"] !== void 0) return format;
|
|
6336
|
+
return { ...format, options: { ...options, useGrouping: false } };
|
|
6337
|
+
}
|
|
6325
6338
|
function formatForField(field) {
|
|
6326
6339
|
const shownAs = shownAsOf(field);
|
|
6327
6340
|
if (newerKindOf4(field) === "rating" && (!shownAs || shownAs.id === "rating")) {
|
|
6328
6341
|
return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: ratingMaxOf(field) } };
|
|
6329
6342
|
}
|
|
6330
|
-
if (shownAs) return shownAs;
|
|
6343
|
+
if (shownAs) return ungroupedForYears(field, shownAs);
|
|
6331
6344
|
const stamp = dateFormatFor(field);
|
|
6332
6345
|
if (stamp && editorKindFor(field) !== "datetime") return stamp;
|
|
6333
6346
|
switch (editorKindFor(field)) {
|
|
@@ -6347,7 +6360,7 @@ function formatForField(field) {
|
|
|
6347
6360
|
case "phone":
|
|
6348
6361
|
return { id: "phone" };
|
|
6349
6362
|
case "number":
|
|
6350
|
-
return { id: "number" };
|
|
6363
|
+
return ungroupedForYears(field, { id: "number" });
|
|
6351
6364
|
default:
|
|
6352
6365
|
return void 0;
|
|
6353
6366
|
}
|
|
@@ -8231,7 +8244,7 @@ function Scalar({ value, keyName, dense }) {
|
|
|
8231
8244
|
const date = dateWords(text);
|
|
8232
8245
|
if (date) return /* @__PURE__ */ jsx28("span", { title: text, children: date });
|
|
8233
8246
|
if (!dense && ui.renderText && text.length > 40 && MARKDOWN.test(text)) return /* @__PURE__ */ jsx28("div", { className: "min-w-0", children: ui.renderText(text, "cell") });
|
|
8234
|
-
return /* @__PURE__ */ jsx28("span", { className: cn23(dense ? "line-clamp-2" : "whitespace-pre-wrap
|
|
8247
|
+
return /* @__PURE__ */ jsx28("span", { className: cn23(dense ? "line-clamp-2 break-words" : "whitespace-pre-wrap [overflow-wrap:anywhere]"), children: text });
|
|
8235
8248
|
}
|
|
8236
8249
|
var TABLE_ROWS = 8;
|
|
8237
8250
|
var TABLE_COLUMNS = 12;
|
|
@@ -8243,7 +8256,7 @@ function RecordsTable({ items }) {
|
|
|
8243
8256
|
return /* @__PURE__ */ jsxs26("div", { className: "min-w-0", "data-records-structured": "table", children: [
|
|
8244
8257
|
/* @__PURE__ */ jsx28("div", { className: "max-w-full overflow-x-auto rounded-md border border-border", children: /* @__PURE__ */ jsxs26("table", { className: "w-full border-collapse text-xs", children: [
|
|
8245
8258
|
/* @__PURE__ */ jsx28("thead", { className: "bg-muted/60 text-left", children: /* @__PURE__ */ jsx28("tr", { children: pictureFirst.map((k) => /* @__PURE__ */ jsx28("th", { scope: "col", className: "whitespace-nowrap px-2 py-1 font-medium text-muted-foreground", children: keyWords(k) }, k)) }) }),
|
|
8246
|
-
/* @__PURE__ */ jsx28("tbody", { children: shown2.map((item, i) => /* @__PURE__ */ jsx28("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ jsx28("td", { className: "max-w-[18rem] px-2 py-1", children: k in item ? /* @__PURE__ */ jsx28(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
|
|
8259
|
+
/* @__PURE__ */ jsx28("tbody", { children: shown2.map((item, i) => /* @__PURE__ */ jsx28("tr", { className: "border-t border-border/60 align-top", children: pictureFirst.map((k) => /* @__PURE__ */ jsx28("td", { className: "min-w-[7rem] max-w-[18rem] px-2 py-1", children: k in item ? /* @__PURE__ */ jsx28(Nested, { value: item[k], keyName: k, dense: true }) : /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: "\u2014" }) }, k)) }, i)) })
|
|
8247
8260
|
] }) }),
|
|
8248
8261
|
items.length > TABLE_ROWS ? /* @__PURE__ */ jsx28(Button14, { type: "button", variant: "ghost", size: "sm", className: "mt-1 h-6 px-2 text-xs", onClick: (e) => {
|
|
8249
8262
|
stop(e);
|
|
@@ -8301,6 +8314,9 @@ function Row({ label, keyName, value, depth, gutter }) {
|
|
|
8301
8314
|
}
|
|
8302
8315
|
);
|
|
8303
8316
|
}
|
|
8317
|
+
function recordsCount(data) {
|
|
8318
|
+
return Array.isArray(data) && data.length > 0 && data.every(isPlainObject2) ? plural2(data.length, "item", "items") : "";
|
|
8319
|
+
}
|
|
8304
8320
|
function rawTextOf(s) {
|
|
8305
8321
|
return s.raw ?? JSON.stringify(s.data, null, 2);
|
|
8306
8322
|
}
|
|
@@ -8312,7 +8328,7 @@ function StructuredValueView({ structured, label, className }) {
|
|
|
8312
8328
|
const text = rawTextOf(structured);
|
|
8313
8329
|
return /* @__PURE__ */ jsxs26("div", { className: cn23("flex min-w-0 flex-col gap-1.5 whitespace-normal", className), "data-records-structured-view": "", children: [
|
|
8314
8330
|
/* @__PURE__ */ jsxs26("div", { className: "flex min-w-0 items-center gap-1", onClick: stop, children: [
|
|
8315
|
-
/* @__PURE__ */ jsx28("span", { className: "min-w-0 flex-1 truncate text-xs text-muted-foreground", children:
|
|
8331
|
+
/* @__PURE__ */ jsx28("span", { className: "min-w-0 flex-1 truncate text-xs text-muted-foreground", children: recordsCount(structured.data) }),
|
|
8316
8332
|
savable ? /* @__PURE__ */ jsx28(Button14, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs", onClick: () => setSaving(true), "data-records-structured-save": "", children: "Save as table" }) : null,
|
|
8317
8333
|
/* @__PURE__ */ jsx28(
|
|
8318
8334
|
Button14,
|
|
@@ -8599,13 +8615,14 @@ function scalarText(field, value, labels, stillWaitingFor) {
|
|
|
8599
8615
|
}
|
|
8600
8616
|
const shownAs = shownAsOf(field);
|
|
8601
8617
|
if (shownAs) {
|
|
8602
|
-
const said2 = formatFieldValue3(value, shownAs);
|
|
8618
|
+
const said2 = formatFieldValue3(value, shownAs.id === "number" && isYearField(field) && isYearValue(value) ? formatForField(field) ?? shownAs : shownAs);
|
|
8603
8619
|
if (said2.ok && !said2.empty) return said2.text;
|
|
8604
8620
|
}
|
|
8605
8621
|
if (typeof value === "number") {
|
|
8606
8622
|
if (kind === "percent") return `${value}%`;
|
|
8607
8623
|
if (kind === "currency") return field.unit ? `${field.unit}${value.toLocaleString()}` : value.toLocaleString();
|
|
8608
|
-
|
|
8624
|
+
const plain = isYearField(field) && isYearValue(value) ? String(value) : value.toLocaleString();
|
|
8625
|
+
return field.unit ? `${plain} ${field.unit}` : plain;
|
|
8609
8626
|
}
|
|
8610
8627
|
if (kind === "datetime" || systemStampOf(field) === "created_time" || systemStampOf(field) === "modified_time") {
|
|
8611
8628
|
const said2 = dateText(field, value);
|