@ai-matrx/records-ui 0.42.0 → 0.43.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/CHANGELOG.md +35 -0
- package/dist/index.cjs +33 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4898,6 +4898,27 @@ import {
|
|
|
4898
4898
|
} from "@ai-matrx/records/react";
|
|
4899
4899
|
import { Button as Button15, Skeleton as Skeleton5, cn as cn17 } from "@ai-matrx/design-system";
|
|
4900
4900
|
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4901
|
+
var UNPLACED = "\0unplaced";
|
|
4902
|
+
function stageOfCard(row, stageKey, stages) {
|
|
4903
|
+
const document2 = row.document ?? {};
|
|
4904
|
+
const choices = document2["_choices"];
|
|
4905
|
+
if (choices && typeof choices === "object") {
|
|
4906
|
+
const chosen = choices[stageKey];
|
|
4907
|
+
if (chosen && typeof chosen === "object") {
|
|
4908
|
+
const key = chosen["key"];
|
|
4909
|
+
if (typeof key === "string" && key !== "") {
|
|
4910
|
+
return stages.some((s) => s.key === key) ? key : null;
|
|
4911
|
+
}
|
|
4912
|
+
}
|
|
4913
|
+
}
|
|
4914
|
+
const raw = document2[stageKey];
|
|
4915
|
+
if (raw === null || raw === void 0 || raw === "") return null;
|
|
4916
|
+
const said = String(raw).trim();
|
|
4917
|
+
const byKey = stages.find((s) => s.key === said);
|
|
4918
|
+
if (byKey) return byKey.key;
|
|
4919
|
+
const byLabel = stages.find((s) => s.label.toLowerCase() === said.toLowerCase());
|
|
4920
|
+
return byLabel ? byLabel.key : null;
|
|
4921
|
+
}
|
|
4901
4922
|
function PipelineBoard({
|
|
4902
4923
|
tableId,
|
|
4903
4924
|
rows,
|
|
@@ -4947,12 +4968,12 @@ function PipelineBoard({
|
|
|
4947
4968
|
const map = /* @__PURE__ */ new Map();
|
|
4948
4969
|
if (!stageKey) return map;
|
|
4949
4970
|
for (const row of rows) {
|
|
4950
|
-
const
|
|
4951
|
-
|
|
4952
|
-
map.set(key, [...map.get(key) ?? [], row]);
|
|
4971
|
+
const key = stageOfCard(row, stageKey, definition?.stages ?? []);
|
|
4972
|
+
map.set(key ?? UNPLACED, [...map.get(key ?? UNPLACED) ?? [], row]);
|
|
4953
4973
|
}
|
|
4954
4974
|
return map;
|
|
4955
|
-
}, [rows, stageKey]);
|
|
4975
|
+
}, [rows, stageKey, definition?.stages]);
|
|
4976
|
+
const unplaced = cardsByStage.get(UNPLACED) ?? [];
|
|
4956
4977
|
const all = fields.data ?? [];
|
|
4957
4978
|
const titleField = useMemo14(
|
|
4958
4979
|
() => all.find((f) => f.key !== stageKey) ?? all[0],
|
|
@@ -5099,7 +5120,14 @@ function PipelineBoard({
|
|
|
5099
5120
|
},
|
|
5100
5121
|
stage.key
|
|
5101
5122
|
);
|
|
5102
|
-
}) })
|
|
5123
|
+
}) }),
|
|
5124
|
+
unplaced.length > 0 ? /* @__PURE__ */ jsxs17("p", { className: "text-xs text-muted-foreground", "data-testid": "pipeline-unplaced", children: [
|
|
5125
|
+
unplaced.length === 1 ? "One record is" : `${unplaced.length} records are`,
|
|
5126
|
+
" not in any of these columns \u2014 ",
|
|
5127
|
+
unplaced.slice(0, 3).map((r) => rowName(r, titleField?.key ?? null, "Untitled")).join(", "),
|
|
5128
|
+
unplaced.length > 3 ? ` and ${unplaced.length - 3} more` : "",
|
|
5129
|
+
". Their stage is not one this pipeline offers, so nothing here can draw them; open one from the grid to move it."
|
|
5130
|
+
] }) : null
|
|
5103
5131
|
] });
|
|
5104
5132
|
}
|
|
5105
5133
|
function formatTotal(total) {
|