@ai-matrx/records-ui 0.116.67 → 0.116.68
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 +63 -42
- package/dist/{SaveToTable-OYJH3OKN.js → SaveToTable-GU4RF65M.js} +3 -3
- package/dist/{chunk-O5K6Y3N3.js → chunk-4CI2HLX3.js} +1 -1
- package/dist/chunk-4CI2HLX3.js.map +1 -0
- package/dist/{chunk-NBL26U5K.js → chunk-6BTGCYPK.js} +2 -2
- package/dist/{chunk-EACZUXJO.js → chunk-6Q2RJEN5.js} +2 -2
- package/dist/{chunk-57CGHFPO.js → chunk-BWVNQYNC.js} +9 -9
- package/dist/chunk-BWVNQYNC.js.map +1 -0
- package/dist/{chunk-TEYXG4XD.js → chunk-K7OX6RG6.js} +1 -1
- package/dist/chunk-K7OX6RG6.js.map +1 -0
- package/dist/{chunk-W6FX3XVF.js → chunk-QNI75ZHU.js} +2 -2
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.js.map +1 -1
- package/dist/html-frame.cjs.map +1 -1
- package/dist/html-frame.js +1 -1
- package/dist/index.cjs +58 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +67 -58
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +4 -4
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +4 -4
- package/dist/skeleton.js +3 -3
- package/package.json +6 -6
- package/dist/chunk-57CGHFPO.js.map +0 -1
- package/dist/chunk-O5K6Y3N3.js.map +0 -1
- package/dist/chunk-TEYXG4XD.js.map +0 -1
- /package/dist/{SaveToTable-OYJH3OKN.js.map → SaveToTable-GU4RF65M.js.map} +0 -0
- /package/dist/{chunk-NBL26U5K.js.map → chunk-6BTGCYPK.js.map} +0 -0
- /package/dist/{chunk-EACZUXJO.js.map → chunk-6Q2RJEN5.js.map} +0 -0
- /package/dist/{chunk-W6FX3XVF.js.map → chunk-QNI75ZHU.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -5493,8 +5493,8 @@ interface ChartBlockProps {
|
|
|
5493
5493
|
/** `false` draws no legend beside a donut and no value list under bars or a line. Default `true`. */
|
|
5494
5494
|
legend?: boolean | undefined;
|
|
5495
5495
|
/**
|
|
5496
|
-
* The
|
|
5497
|
-
* choice column's own option
|
|
5496
|
+
* The color each group is drawn in, keyed by its stored value as text ("" for no value) — a
|
|
5497
|
+
* choice column's own option colors. A group not named here takes the palette's next color.
|
|
5498
5498
|
* Single-group blocks only; a compared block keeps its two series tones.
|
|
5499
5499
|
*/
|
|
5500
5500
|
groupColors?: Readonly<Record<string, string>> | undefined;
|
|
@@ -7929,7 +7929,7 @@ interface SectionCardProps {
|
|
|
7929
7929
|
valueFields?: readonly string[] | undefined;
|
|
7930
7930
|
/** The row's usage note. Default: a column named usage_note / note / notes; `null` = none. */
|
|
7931
7931
|
noteField?: string | null | undefined;
|
|
7932
|
-
/** What one row is called on the Add dialog ("
|
|
7932
|
+
/** What one row is called on the Add dialog ("color", "spacing value"). Default "entry". */
|
|
7933
7933
|
noun?: string | undefined;
|
|
7934
7934
|
/** A look's check offered a fix and the person asked for it. Absent: the fix button is absent. */
|
|
7935
7935
|
onFix?: ((args: {
|
package/dist/index.d.ts
CHANGED
|
@@ -5493,8 +5493,8 @@ interface ChartBlockProps {
|
|
|
5493
5493
|
/** `false` draws no legend beside a donut and no value list under bars or a line. Default `true`. */
|
|
5494
5494
|
legend?: boolean | undefined;
|
|
5495
5495
|
/**
|
|
5496
|
-
* The
|
|
5497
|
-
* choice column's own option
|
|
5496
|
+
* The color each group is drawn in, keyed by its stored value as text ("" for no value) — a
|
|
5497
|
+
* choice column's own option colors. A group not named here takes the palette's next color.
|
|
5498
5498
|
* Single-group blocks only; a compared block keeps its two series tones.
|
|
5499
5499
|
*/
|
|
5500
5500
|
groupColors?: Readonly<Record<string, string>> | undefined;
|
|
@@ -7929,7 +7929,7 @@ interface SectionCardProps {
|
|
|
7929
7929
|
valueFields?: readonly string[] | undefined;
|
|
7930
7930
|
/** The row's usage note. Default: a column named usage_note / note / notes; `null` = none. */
|
|
7931
7931
|
noteField?: string | null | undefined;
|
|
7932
|
-
/** What one row is called on the Add dialog ("
|
|
7932
|
+
/** What one row is called on the Add dialog ("color", "spacing value"). Default "entry". */
|
|
7933
7933
|
noun?: string | undefined;
|
|
7934
7934
|
/** A look's check offered a fix and the person asked for it. Absent: the fix button is absent. */
|
|
7935
7935
|
onFix?: ((args: {
|
package/dist/index.js
CHANGED
|
@@ -187,7 +187,7 @@ import {
|
|
|
187
187
|
withoutAddition,
|
|
188
188
|
withoutLeadingBlank,
|
|
189
189
|
workedOutErrorFor
|
|
190
|
-
} from "./chunk-
|
|
190
|
+
} from "./chunk-BWVNQYNC.js";
|
|
191
191
|
import {
|
|
192
192
|
CHART_PLOT_PX,
|
|
193
193
|
EMBEDDED_ROW_PX,
|
|
@@ -203,7 +203,7 @@ import {
|
|
|
203
203
|
skeletonLayoutFor,
|
|
204
204
|
useExpectedRows,
|
|
205
205
|
useRememberedLayout
|
|
206
|
-
} from "./chunk-
|
|
206
|
+
} from "./chunk-6BTGCYPK.js";
|
|
207
207
|
import {
|
|
208
208
|
DEFAULT_FOOTER,
|
|
209
209
|
EMBEDDED_LOOK,
|
|
@@ -231,7 +231,7 @@ import {
|
|
|
231
231
|
viewSettings,
|
|
232
232
|
viewSettingsFor,
|
|
233
233
|
viewSettingsPatch
|
|
234
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-QNI75ZHU.js";
|
|
235
235
|
import {
|
|
236
236
|
HTML_SAMPLE_CSP,
|
|
237
237
|
HTML_SAMPLE_SANDBOX,
|
|
@@ -239,7 +239,7 @@ import {
|
|
|
239
239
|
HtmlSampleTokensProvider,
|
|
240
240
|
SAMPLE_TOKEN_NAMES,
|
|
241
241
|
sampleDocument
|
|
242
|
-
} from "./chunk-
|
|
242
|
+
} from "./chunk-4CI2HLX3.js";
|
|
243
243
|
import {
|
|
244
244
|
ArchiveItemMenu,
|
|
245
245
|
ArchivedBuiltOn,
|
|
@@ -298,7 +298,7 @@ import {
|
|
|
298
298
|
visibilityLaneFor,
|
|
299
299
|
whyNotAskable,
|
|
300
300
|
writeOnTheWinningVersion_exports
|
|
301
|
-
} from "./chunk-
|
|
301
|
+
} from "./chunk-6Q2RJEN5.js";
|
|
302
302
|
import {
|
|
303
303
|
ACTION_CHECKING_ACCESS_REASON,
|
|
304
304
|
ACTION_NOT_HERE_REASON,
|
|
@@ -466,7 +466,7 @@ import {
|
|
|
466
466
|
storedChoiceColorLookup,
|
|
467
467
|
subscribePersonTimeZone,
|
|
468
468
|
timeOfDayWords
|
|
469
|
-
} from "./chunk-
|
|
469
|
+
} from "./chunk-K7OX6RG6.js";
|
|
470
470
|
import {
|
|
471
471
|
ADD_FIELD_OPEN_LABEL,
|
|
472
472
|
FIELD_TYPE_CATALOGUE,
|
|
@@ -4547,7 +4547,7 @@ function paintByOption(style, _fields, index, lookup) {
|
|
|
4547
4547
|
}
|
|
4548
4548
|
};
|
|
4549
4549
|
}
|
|
4550
|
-
function
|
|
4550
|
+
function colorableBy(field) {
|
|
4551
4551
|
const kind2 = String(editorKindFor(field));
|
|
4552
4552
|
return kind2 === "select" || kind2 === "multi_select" || kind2 === "checkbox" || kind2 === "boolean";
|
|
4553
4553
|
}
|
|
@@ -4609,8 +4609,8 @@ function swatches(prefix, current, write) {
|
|
|
4609
4609
|
...current ? [{ id: `${prefix}-none`, label: "No highlight", onSelect: () => write(null) }] : []
|
|
4610
4610
|
];
|
|
4611
4611
|
}
|
|
4612
|
-
function
|
|
4613
|
-
const { enabled, tableId, fields, decorations,
|
|
4612
|
+
function useGridColors(args) {
|
|
4613
|
+
const { enabled, tableId, fields, decorations, mayColor, whyNot, notify, view } = args;
|
|
4614
4614
|
const client = useRecordsClient13();
|
|
4615
4615
|
const [rulesOpen, setRulesOpen] = useState14(null);
|
|
4616
4616
|
const dialogOptions = useChoiceOptions(fields, rulesOpen !== null ? fields.filter(isChoiceField).map((f) => f.key) : []);
|
|
@@ -4628,7 +4628,7 @@ function useGridColours(args) {
|
|
|
4628
4628
|
[client, tableId, decorations, notify]
|
|
4629
4629
|
);
|
|
4630
4630
|
const idOf = useCallback7((key) => fields.find((f) => f.key === key), [fields]);
|
|
4631
|
-
const refusal3 =
|
|
4631
|
+
const refusal3 = mayColor ? void 0 : whyNot;
|
|
4632
4632
|
const headerItem = useCallback7(
|
|
4633
4633
|
(columnKey) => {
|
|
4634
4634
|
if (!enabled) return null;
|
|
@@ -4637,33 +4637,33 @@ function useGridColours(args) {
|
|
|
4637
4637
|
const name = fieldName(field);
|
|
4638
4638
|
const by = decorations.data?.color_by;
|
|
4639
4639
|
const byThis = by?.field === field.id;
|
|
4640
|
-
const byWhy =
|
|
4640
|
+
const byWhy = colorableBy(field) ? void 0 : `${name} holds free values; rows are colored by a column of choices or ticks. Use a color rule instead.`;
|
|
4641
4641
|
const column = decorations.data?.columns?.[field.id];
|
|
4642
4642
|
return {
|
|
4643
|
-
id: "col-
|
|
4643
|
+
id: "col-color",
|
|
4644
4644
|
label: "Color by\u2026",
|
|
4645
4645
|
icon: "palette",
|
|
4646
4646
|
disabledReason: refusal3,
|
|
4647
4647
|
submenu: [
|
|
4648
4648
|
byThis ? {
|
|
4649
|
-
id: "col-
|
|
4649
|
+
id: "col-color-off",
|
|
4650
4650
|
label: `Stop coloring by ${name}`,
|
|
4651
4651
|
onSelect: () => void write(["color_by"], null, `Rows are no longer colored by ${name}.`)
|
|
4652
4652
|
} : {
|
|
4653
|
-
id: "col-
|
|
4653
|
+
id: "col-color-rows",
|
|
4654
4654
|
label: "Color rows by this column",
|
|
4655
4655
|
disabledReason: byWhy,
|
|
4656
4656
|
onSelect: () => void write(["color_by"], { field: field.id, target: "row" }, `Each row wears the color of its ${name}.`)
|
|
4657
4657
|
},
|
|
4658
4658
|
...byThis && by?.target === "row" ? [
|
|
4659
4659
|
{
|
|
4660
|
-
id: "col-
|
|
4660
|
+
id: "col-color-cells",
|
|
4661
4661
|
label: "Color only this column's cells",
|
|
4662
4662
|
onSelect: () => void write(["color_by"], { field: field.id, target: "cell" }, `Only ${name}'s cells wear their color now.`)
|
|
4663
4663
|
}
|
|
4664
4664
|
] : [],
|
|
4665
4665
|
{
|
|
4666
|
-
id: "col-
|
|
4666
|
+
id: "col-color-rules",
|
|
4667
4667
|
label: "Color rules\u2026",
|
|
4668
4668
|
onSelect: () => setRulesOpen(columnKey)
|
|
4669
4669
|
},
|
|
@@ -4750,7 +4750,7 @@ function useGridColours(args) {
|
|
|
4750
4750
|
[enabled, decorations.data, refusal3, write]
|
|
4751
4751
|
);
|
|
4752
4752
|
const dialogs = enabled ? /* @__PURE__ */ jsx13(
|
|
4753
|
-
|
|
4753
|
+
ColorRulesDialog,
|
|
4754
4754
|
{
|
|
4755
4755
|
open: rulesOpen !== null,
|
|
4756
4756
|
startField: rulesOpen,
|
|
@@ -4774,11 +4774,11 @@ function useGridColours(args) {
|
|
|
4774
4774
|
}
|
|
4775
4775
|
}
|
|
4776
4776
|
) : null;
|
|
4777
|
-
const
|
|
4777
|
+
const colorable = fields.filter(colorableBy);
|
|
4778
4778
|
const byId = decorations.data?.color_by?.field ?? null;
|
|
4779
|
-
const sheet = enabled ? /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1.5", "data-records-grid-sheet-
|
|
4779
|
+
const sheet = enabled ? /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1.5", "data-records-grid-sheet-colors": "", children: [
|
|
4780
4780
|
/* @__PURE__ */ jsx13("span", { className: "text-xs font-medium text-muted-foreground", children: "Colors" }),
|
|
4781
|
-
|
|
4781
|
+
mayColor ? /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
4782
4782
|
/* @__PURE__ */ jsxs12("label", { className: "flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground", children: [
|
|
4783
4783
|
/* @__PURE__ */ jsx13("span", { className: "shrink-0", children: "Color rows by" }),
|
|
4784
4784
|
/* @__PURE__ */ jsx13(
|
|
@@ -4791,11 +4791,11 @@ function useGridColours(args) {
|
|
|
4791
4791
|
const field = fields.find((f) => f.id === id);
|
|
4792
4792
|
void (field ? write(["color_by"], { field: field.id, target: "row" }, `Each row wears the color of its ${fieldName(field)}.`) : write(["color_by"], null, "Rows are no longer colored by a column."));
|
|
4793
4793
|
},
|
|
4794
|
-
options: [{ value: "", label: "No color" }, ...
|
|
4794
|
+
options: [{ value: "", label: "No color" }, ...colorable.map((field) => ({ value: field.id, label: fieldName(field) }))]
|
|
4795
4795
|
}
|
|
4796
4796
|
)
|
|
4797
4797
|
] }),
|
|
4798
|
-
/* @__PURE__ */ jsx13(Button11, { type: "button", size: "sm", variant: "outline", className: "h-10 shrink-0", onClick: () => setRulesOpen(
|
|
4798
|
+
/* @__PURE__ */ jsx13(Button11, { type: "button", size: "sm", variant: "outline", className: "h-10 shrink-0", onClick: () => setRulesOpen(colorable[0]?.key ?? fields[0]?.key ?? ""), children: "Color rules\u2026" })
|
|
4799
4799
|
] }) : /* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground", children: whyNot })
|
|
4800
4800
|
] }) : null;
|
|
4801
4801
|
return { headerItem, cellItem, cellsItem, rowItem, dialogs, sheet };
|
|
@@ -4804,7 +4804,7 @@ var SELECT = "h-8";
|
|
|
4804
4804
|
var CHOICE_OPS = ["is", "is_not", "is_empty", "not_empty"].filter(
|
|
4805
4805
|
(op) => COLOR_RULE_OPS.includes(op)
|
|
4806
4806
|
);
|
|
4807
|
-
function
|
|
4807
|
+
function ColorRulesDialog({
|
|
4808
4808
|
open,
|
|
4809
4809
|
startField,
|
|
4810
4810
|
fields,
|
|
@@ -4844,13 +4844,13 @@ function ColourRulesDialog({
|
|
|
4844
4844
|
onClose();
|
|
4845
4845
|
};
|
|
4846
4846
|
const first = startField ?? fields[0]?.key ?? "";
|
|
4847
|
-
return /* @__PURE__ */ jsx13(Dialog6, { open, onOpenChange: (next) => !next ? close() : void 0, children: /* @__PURE__ */ jsxs12(DialogContent6, { className: "sm:max-w-2xl", "data-records-
|
|
4847
|
+
return /* @__PURE__ */ jsx13(Dialog6, { open, onOpenChange: (next) => !next ? close() : void 0, children: /* @__PURE__ */ jsxs12(DialogContent6, { className: "sm:max-w-2xl", "data-records-color-rules": "", children: [
|
|
4848
4848
|
/* @__PURE__ */ jsxs12(DialogHeader6, { children: [
|
|
4849
4849
|
/* @__PURE__ */ jsx13(DialogTitle6, { children: "Color rules" }),
|
|
4850
4850
|
/* @__PURE__ */ jsx13(DialogDescription6, { children: scope === "view" ? "The first rule a row matches wins. These rules belong to this view alone, and a date can be tested against today." : "The first rule a row matches wins. A rule tints the whole row, or only the cell it reads. Everyone who opens this table sees them." })
|
|
4851
4851
|
] }),
|
|
4852
4852
|
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-2", children: [
|
|
4853
|
-
viewRules ? /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 text-xs", "data-records-
|
|
4853
|
+
viewRules ? /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 text-xs", "data-records-color-rules-scope": "", children: [
|
|
4854
4854
|
/* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: "Keep them on" }),
|
|
4855
4855
|
/* @__PURE__ */ jsx13(
|
|
4856
4856
|
PickOne,
|
|
@@ -4870,7 +4870,7 @@ function ColourRulesDialog({
|
|
|
4870
4870
|
)
|
|
4871
4871
|
] }) : null,
|
|
4872
4872
|
rows.length === 0 ? /* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground", children: "No rules yet." }) : null,
|
|
4873
|
-
rows.map((rule, i) => /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1.5 text-xs", "data-records-
|
|
4873
|
+
rows.map((rule, i) => /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-1.5 text-xs", "data-records-color-rule": "", children: [
|
|
4874
4874
|
/* @__PURE__ */ jsx13("span", { className: "text-muted-foreground", children: i === 0 ? "When" : "Else when" }),
|
|
4875
4875
|
/* @__PURE__ */ jsx13(
|
|
4876
4876
|
PickOne,
|
|
@@ -4886,7 +4886,7 @@ function ColourRulesDialog({
|
|
|
4886
4886
|
PickOne,
|
|
4887
4887
|
{
|
|
4888
4888
|
label: "Test",
|
|
4889
|
-
attrs: { "data-records-
|
|
4889
|
+
attrs: { "data-records-color-rule-op": "" },
|
|
4890
4890
|
className: SELECT,
|
|
4891
4891
|
value: rule.op,
|
|
4892
4892
|
onChange: (picked) => set(i, { op: picked }),
|
|
@@ -4900,7 +4900,7 @@ function ColourRulesDialog({
|
|
|
4900
4900
|
PickOne,
|
|
4901
4901
|
{
|
|
4902
4902
|
label: "Choice",
|
|
4903
|
-
attrs: { "data-records-
|
|
4903
|
+
attrs: { "data-records-color-rule-choice": "" },
|
|
4904
4904
|
className: SELECT,
|
|
4905
4905
|
placeholder: "Pick a choice",
|
|
4906
4906
|
value: optionFor(choicesOf(rule.field), rule.value)?.id ?? "",
|
|
@@ -4911,7 +4911,7 @@ function ColourRulesDialog({
|
|
|
4911
4911
|
"input",
|
|
4912
4912
|
{
|
|
4913
4913
|
"aria-label": "Value",
|
|
4914
|
-
"data-records-
|
|
4914
|
+
"data-records-color-rule-value": "",
|
|
4915
4915
|
className: "h-8 w-28 rounded border bg-background px-2 text-xs",
|
|
4916
4916
|
value: rule.value,
|
|
4917
4917
|
onChange: (e) => set(i, { value: e.target.value })
|
|
@@ -4935,7 +4935,7 @@ function ColourRulesDialog({
|
|
|
4935
4935
|
PickOne,
|
|
4936
4936
|
{
|
|
4937
4937
|
label: "Color",
|
|
4938
|
-
attrs: { "data-records-
|
|
4938
|
+
attrs: { "data-records-color-rule-color": "" },
|
|
4939
4939
|
className: SELECT,
|
|
4940
4940
|
value: rule.color,
|
|
4941
4941
|
onChange: (picked) => set(i, { color: picked }),
|
|
@@ -4950,7 +4950,7 @@ function ColourRulesDialog({
|
|
|
4950
4950
|
type: "button",
|
|
4951
4951
|
size: "sm",
|
|
4952
4952
|
variant: "outline",
|
|
4953
|
-
"data-records-
|
|
4953
|
+
"data-records-color-rule-add": "",
|
|
4954
4954
|
onClick: () => setDrafts([...rows, { field: first, op: "is", value: "", color: "amber", target: "row" }]),
|
|
4955
4955
|
children: "Add a rule"
|
|
4956
4956
|
}
|
|
@@ -4963,7 +4963,7 @@ function ColourRulesDialog({
|
|
|
4963
4963
|
{
|
|
4964
4964
|
type: "button",
|
|
4965
4965
|
size: "sm",
|
|
4966
|
-
"data-records-
|
|
4966
|
+
"data-records-color-rules-save": "",
|
|
4967
4967
|
disabled: busy || drafts === null,
|
|
4968
4968
|
onClick: async () => {
|
|
4969
4969
|
setBusy(true);
|
|
@@ -6798,12 +6798,12 @@ function useMergedGridControls(args) {
|
|
|
6798
6798
|
const [labelling, setLabelling] = useState22(false);
|
|
6799
6799
|
const [rowActionsOpen, setRowActionsOpen] = useState22(false);
|
|
6800
6800
|
const noDecorations = useMemo13(() => ({ data: null, apply: () => void 0 }), []);
|
|
6801
|
-
const
|
|
6801
|
+
const colors = useGridColors({
|
|
6802
6802
|
enabled,
|
|
6803
6803
|
tableId,
|
|
6804
6804
|
fields,
|
|
6805
6805
|
decorations: args.decorations ?? noDecorations,
|
|
6806
|
-
|
|
6806
|
+
mayColor: editable && rights.write,
|
|
6807
6807
|
whyNot: editable ? rights.why("write") : "Editing is off here.",
|
|
6808
6808
|
notify,
|
|
6809
6809
|
// THIS VIEW'S OWN RULES: kept on the look like every other view setting (and saved to the view the same way).
|
|
@@ -6949,8 +6949,8 @@ function useMergedGridControls(args) {
|
|
|
6949
6949
|
const field = fields.find((f) => f.key === columnId2);
|
|
6950
6950
|
if (!field) return [];
|
|
6951
6951
|
const out = [];
|
|
6952
|
-
const
|
|
6953
|
-
if (
|
|
6952
|
+
const color = colors.headerItem(columnId2);
|
|
6953
|
+
if (color) out.push(color);
|
|
6954
6954
|
const wrapped = new Set(presentation.wrapColumns ?? []);
|
|
6955
6955
|
const wraps = wrapped.has(columnId2);
|
|
6956
6956
|
out.push({
|
|
@@ -6997,15 +6997,15 @@ function useMergedGridControls(args) {
|
|
|
6997
6997
|
return out;
|
|
6998
6998
|
},
|
|
6999
6999
|
cell: (rowId, columnId2) => {
|
|
7000
|
-
const item =
|
|
7000
|
+
const item = colors.cellItem(rowId, columnId2);
|
|
7001
7001
|
return [...args.moreItems?.cell?.(rowId, columnId2) ?? [], ...item ? [item] : []];
|
|
7002
7002
|
},
|
|
7003
7003
|
selection: (cells) => {
|
|
7004
|
-
const item =
|
|
7004
|
+
const item = colors.cellsItem(cells.map((c) => ({ rowId: c.rowId, columnKey: c.columnId })));
|
|
7005
7005
|
return item ? [item] : [];
|
|
7006
7006
|
},
|
|
7007
7007
|
row: (rowId) => {
|
|
7008
|
-
const item =
|
|
7008
|
+
const item = colors.rowItem(rowId);
|
|
7009
7009
|
return [...args.moreItems?.row?.(rowId) ?? [], ...item ? [item] : []];
|
|
7010
7010
|
},
|
|
7011
7011
|
table: () => [
|
|
@@ -7279,7 +7279,7 @@ function useMergedGridControls(args) {
|
|
|
7279
7279
|
}, [
|
|
7280
7280
|
columnAccess,
|
|
7281
7281
|
args,
|
|
7282
|
-
|
|
7282
|
+
colors,
|
|
7283
7283
|
fieldKeys,
|
|
7284
7284
|
canWrite,
|
|
7285
7285
|
client,
|
|
@@ -7328,7 +7328,7 @@ function useMergedGridControls(args) {
|
|
|
7328
7328
|
);
|
|
7329
7329
|
const close = () => setDialog(null);
|
|
7330
7330
|
const dialogs = !enabled ? null : /* @__PURE__ */ jsxs21(Fragment4, { children: [
|
|
7331
|
-
|
|
7331
|
+
colors.dialogs,
|
|
7332
7332
|
dialog?.kind === "access" && columnAccess ? columnAccess({
|
|
7333
7333
|
tableId,
|
|
7334
7334
|
fieldId: dialog.field.id,
|
|
@@ -7597,7 +7597,7 @@ function useMergedGridControls(args) {
|
|
|
7597
7597
|
dialogs,
|
|
7598
7598
|
addColumn: () => setDialog({ kind: "insert", anchor: null, side: "right" }),
|
|
7599
7599
|
sheetTools: enabled ? /* @__PURE__ */ jsxs21(Fragment4, { children: [
|
|
7600
|
-
|
|
7600
|
+
colors.sheet,
|
|
7601
7601
|
args.summaries ? /* @__PURE__ */ jsx22(
|
|
7602
7602
|
SummarySheetControls,
|
|
7603
7603
|
{
|
|
@@ -7688,7 +7688,7 @@ import {
|
|
|
7688
7688
|
useEntityRecord,
|
|
7689
7689
|
useRecordsClient as useRecordsClient21
|
|
7690
7690
|
} from "@ai-matrx/records/react";
|
|
7691
|
-
import { Button as Button20, Separator, cn as cn8 } from "@ai-matrx/design-system";
|
|
7691
|
+
import { Button as Button20, Separator, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, cn as cn8 } from "@ai-matrx/design-system";
|
|
7692
7692
|
import { mapPgError } from "@ai-matrx/records/core";
|
|
7693
7693
|
import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7694
7694
|
function isEmptyValue(value) {
|
|
@@ -7920,10 +7920,19 @@ function CustomFieldsSection({
|
|
|
7920
7920
|
if (!read.loading && !read.error && fields.length === 0 && !mayAdd && !rights.data) return null;
|
|
7921
7921
|
const storeReason = rights.data?.reason ?? null;
|
|
7922
7922
|
const reason = storeReason && entityLabel && rights.data?.label ? storeReason.split(rights.data.label).join(entityLabel) : storeReason;
|
|
7923
|
-
const
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7923
|
+
const refused = Boolean(rights.data && !rights.data.may_declare);
|
|
7924
|
+
const refusedSentence = reason ?? "Only an owner or an admin can add a field here.";
|
|
7925
|
+
const addRefused = (className2) => refused ? (
|
|
7926
|
+
// Its own provider: the section mounts in hosts with and without an app-root one.
|
|
7927
|
+
/* @__PURE__ */ jsx23(TooltipProvider, { titleTooltips: false, children: /* @__PURE__ */ jsxs22(Tooltip, { children: [
|
|
7928
|
+
/* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs22("span", { tabIndex: 0, className: cn8("inline-flex", className2), "data-records-custom-fields-cannot-add": "", children: [
|
|
7929
|
+
/* @__PURE__ */ jsx23(Button20, { size: "sm", variant: "ghost", disabled: true, children: "Add field" }),
|
|
7930
|
+
/* @__PURE__ */ jsx23("span", { className: "sr-only", children: refusedSentence })
|
|
7931
|
+
] }) }),
|
|
7932
|
+
/* @__PURE__ */ jsx23(TooltipContent, { className: "max-w-xs", children: refusedSentence })
|
|
7933
|
+
] }) })
|
|
7934
|
+
) : null;
|
|
7935
|
+
const cannotAdd = refused && onMakeOwnTable ? /* @__PURE__ */ jsx23("div", { className: "flex min-w-0 items-center justify-end", children: /* @__PURE__ */ jsx23(Button20, { size: "sm", variant: "ghost", onClick: onMakeOwnTable, children: "Make your own table" }) }) : null;
|
|
7927
7936
|
const editor = adding ? /* @__PURE__ */ jsx23(
|
|
7928
7937
|
FieldEditor,
|
|
7929
7938
|
{
|
|
@@ -7944,7 +7953,7 @@ function CustomFieldsSection({
|
|
|
7944
7953
|
/* @__PURE__ */ jsxs22("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
7945
7954
|
/* @__PURE__ */ jsx23("h3", { className: "text-sm font-medium", children: title }),
|
|
7946
7955
|
!read.loading ? /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "None yet" }) : null,
|
|
7947
|
-
mayAdd ? /* @__PURE__ */ jsx23(Button20, { size: "sm", variant: "ghost", className: "ml-auto", onClick: () => setAdding(true), children: "Add field" }) :
|
|
7956
|
+
mayAdd ? /* @__PURE__ */ jsx23(Button20, { size: "sm", variant: "ghost", className: "ml-auto", onClick: () => setAdding(true), children: "Add field" }) : addRefused("ml-auto")
|
|
7948
7957
|
] }),
|
|
7949
7958
|
cannotAdd
|
|
7950
7959
|
] });
|
|
@@ -7976,7 +7985,7 @@ function CustomFieldsSection({
|
|
|
7976
7985
|
onClick: () => setAdding(true),
|
|
7977
7986
|
children: "Add field"
|
|
7978
7987
|
}
|
|
7979
|
-
) : null,
|
|
7988
|
+
) : !mayAdd && !editing ? addRefused(fields.length > 0 ? void 0 : "ml-auto") : null,
|
|
7980
7989
|
editing ? /* @__PURE__ */ jsx23(
|
|
7981
7990
|
Button20,
|
|
7982
7991
|
{
|
|
@@ -23929,7 +23938,7 @@ import {
|
|
|
23929
23938
|
ReferenceLine,
|
|
23930
23939
|
Scatter,
|
|
23931
23940
|
ScatterChart,
|
|
23932
|
-
Tooltip,
|
|
23941
|
+
Tooltip as Tooltip2,
|
|
23933
23942
|
XAxis,
|
|
23934
23943
|
YAxis
|
|
23935
23944
|
} from "recharts";
|
|
@@ -24950,13 +24959,13 @@ function Drawing({
|
|
|
24950
24959
|
// 0, 0.3, 0.5, 0.8, 1. When every value drawn is a whole number, so is every tick.
|
|
24951
24960
|
allowDecimals: !onlyWholeNumbers(data)
|
|
24952
24961
|
};
|
|
24953
|
-
const tooltip = /* @__PURE__ */ jsx84(
|
|
24962
|
+
const tooltip = /* @__PURE__ */ jsx84(Tooltip2, { content: /* @__PURE__ */ jsx84(ChartTooltipContent, { config }), cursor: false });
|
|
24954
24963
|
const legend = series.length > 1 ? /* @__PURE__ */ jsx84(Legend, { content: /* @__PURE__ */ jsx84(ChartLegendContent, { config }) }) : null;
|
|
24955
24964
|
if (kind2 === "donut" || kind2 === "pie") {
|
|
24956
24965
|
const hole = kind2 === "donut";
|
|
24957
24966
|
const total = points.reduce((sum, p) => sum + (p.values[series[0]] ?? 0), 0);
|
|
24958
24967
|
const ring = /* @__PURE__ */ jsx84(ChartFrame, { config, height: HEIGHT, className: "w-[140px] shrink-0", children: (width) => /* @__PURE__ */ jsxs77(PieChart, { width, height: HEIGHT, children: [
|
|
24959
|
-
/* @__PURE__ */ jsx84(
|
|
24968
|
+
/* @__PURE__ */ jsx84(Tooltip2, { content: /* @__PURE__ */ jsx84(DonutTooltip, { total }) }),
|
|
24960
24969
|
/* @__PURE__ */ jsx84(
|
|
24961
24970
|
Pie,
|
|
24962
24971
|
{
|
|
@@ -25070,7 +25079,7 @@ function Drawing({
|
|
|
25070
25079
|
/* @__PURE__ */ jsx84(XAxis, { type: "number", dataKey: "x", name: String(config[xKey]?.label ?? ""), ...axis, tickCount: Math.max(2, Math.floor((width - 56) / 52)), interval: "preserveStartEnd", allowDecimals: !onlyWholeNumbers(dots) }),
|
|
25071
25080
|
/* @__PURE__ */ jsx84(YAxis, { type: "number", dataKey: "y", name: String(config[yKey]?.label ?? ""), width: 44, ...axis, allowDecimals: !onlyWholeNumbers(dots) }),
|
|
25072
25081
|
/* @__PURE__ */ jsx84(
|
|
25073
|
-
|
|
25082
|
+
Tooltip2,
|
|
25074
25083
|
{
|
|
25075
25084
|
cursor: false,
|
|
25076
25085
|
content: ({ active, payload }) => {
|
|
@@ -32775,7 +32784,7 @@ function freshFormName(base, taken) {
|
|
|
32775
32784
|
function sameForm(a, b) {
|
|
32776
32785
|
return JSON.stringify(formDeclareArgs(a)) === JSON.stringify(formDeclareArgs(b));
|
|
32777
32786
|
}
|
|
32778
|
-
var LOOK_REFUSAL = /^(That picture|A form's (
|
|
32787
|
+
var LOOK_REFUSAL = /^(That picture|A form's (color|logo|cover|look))/;
|
|
32779
32788
|
function isLookRefusal(error) {
|
|
32780
32789
|
return Boolean(error && LOOK_REFUSAL.test(refusalSentence(error)));
|
|
32781
32790
|
}
|
|
@@ -42134,7 +42143,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
42134
42143
|
|
|
42135
42144
|
// src/entityViews.tsx
|
|
42136
42145
|
import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
|
|
42137
|
-
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
|
|
42146
|
+
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider as TooltipProvider2 } from "@ai-matrx/design-system";
|
|
42138
42147
|
import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
|
|
42139
42148
|
import { useEffect as useEffect107, useMemo as useMemo73, useRef as useRef54, useState as useState122 } from "react";
|
|
42140
42149
|
import { Button as Button101, ErrorBox as ErrorBox5, Input as Input12, cn as cn74 } from "@ai-matrx/design-system";
|
|
@@ -42369,7 +42378,7 @@ function EntityTablePageBody({
|
|
|
42369
42378
|
] }) : null,
|
|
42370
42379
|
addRefused ? /* @__PURE__ */ jsx133(ErrorBox5, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
|
|
42371
42380
|
entity.error ? /* @__PURE__ */ jsx133("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx133(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsxs126(Fragment58, { children: [
|
|
42372
|
-
presentation === "embedded" && searchBox ? /* @__PURE__ */ jsx133("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ jsx133(
|
|
42381
|
+
presentation === "embedded" && searchBox ? /* @__PURE__ */ jsx133("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ jsx133(TooltipProvider2, { children: /* @__PURE__ */ jsx133(
|
|
42373
42382
|
TapTargetSearchGroup2,
|
|
42374
42383
|
{
|
|
42375
42384
|
surface: "solid",
|
|
@@ -43159,7 +43168,7 @@ var READS_ON_PROBLEM_WORDS = {
|
|
|
43159
43168
|
missing: "no row by that name",
|
|
43160
43169
|
self: "reads on itself",
|
|
43161
43170
|
duplicate: "two rows share that name",
|
|
43162
|
-
"no-
|
|
43171
|
+
"no-color": "that row has no color"
|
|
43163
43172
|
};
|
|
43164
43173
|
function resolveReadsOn(row, rows, keys) {
|
|
43165
43174
|
if (!keys.readsOn || !keys.name) return { on: null, problem: null, target: null };
|
|
@@ -43172,7 +43181,7 @@ function resolveReadsOn(row, rows, keys) {
|
|
|
43172
43181
|
if (matches.length === 0) return { on, problem: "missing", target: null };
|
|
43173
43182
|
if (matches.length > 1) return { on, problem: "duplicate", target: null };
|
|
43174
43183
|
const target = matches[0];
|
|
43175
|
-
if (keys.color && !readColorPair((target.document ?? {})[keys.color])) return { on, problem: "no-
|
|
43184
|
+
if (keys.color && !readColorPair((target.document ?? {})[keys.color])) return { on, problem: "no-color", target };
|
|
43176
43185
|
return { on, problem: null, target };
|
|
43177
43186
|
}
|
|
43178
43187
|
function groundOf(row, rows, keys) {
|