@ai-matrx/records-ui 0.93.63 → 0.93.64

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/index.js CHANGED
@@ -18617,15 +18617,19 @@ function Kanban({
18617
18617
  }) {
18618
18618
  const groupFields = useMemo31(() => [groupField], [groupField]);
18619
18619
  const labels = useRecordLabels(groupFields);
18620
+ const options = useChoiceOptions(groupFields, isChoiceField(groupField) ? [groupField.key] : []).get(groupField.key);
18620
18621
  const columns = useMemo31(() => {
18621
18622
  const map = /* @__PURE__ */ new Map();
18623
+ const order = (options ?? []).map((o) => o.label);
18624
+ for (const label of order) map.set(label, []);
18622
18625
  for (const row of rows) {
18623
18626
  const raw = (row.document ?? {})[groupField.key];
18624
18627
  const key = raw === null || raw === void 0 || raw === "" ? "No value" : scalarText(groupField, raw, labels);
18625
18628
  map.set(key, [...map.get(key) ?? [], row]);
18626
18629
  }
18627
- return [...map.entries()].sort((a, b) => a[0] === "No value" ? 1 : b[0] === "No value" ? -1 : a[0].localeCompare(b[0]));
18628
- }, [rows, groupField, labels]);
18630
+ const rank = (name) => name === "No value" ? Number.MAX_SAFE_INTEGER : order.includes(name) ? order.indexOf(name) : order.length;
18631
+ return [...map.entries()].sort((a, b) => rank(a[0]) - rank(b[0]) || a[0].localeCompare(b[0]));
18632
+ }, [rows, groupField, labels, options]);
18629
18633
  return /* @__PURE__ */ jsxs56("div", { className: "flex min-h-0 flex-col gap-2", children: [
18630
18634
  /* @__PURE__ */ jsx64(Note, { children: note }),
18631
18635
  /* @__PURE__ */ jsx64("div", { className: "flex min-h-0 gap-2 overflow-x-auto pb-2", children: columns.map(([name, cards]) => /* @__PURE__ */ jsxs56("section", { className: "flex w-64 shrink-0 flex-col rounded border bg-muted/30", children: [