@ai-matrx/records-ui 0.41.0 → 0.42.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 +32 -0
- package/dist/index.cjs +17 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5308,7 +5308,7 @@ function offerableFields(all, want) {
|
|
|
5308
5308
|
return kind === "datetime" || kind === "date";
|
|
5309
5309
|
});
|
|
5310
5310
|
}
|
|
5311
|
-
function
|
|
5311
|
+
function useStageField(tableId) {
|
|
5312
5312
|
const client = useRecordsClient13();
|
|
5313
5313
|
const [stage, setStage] = useState19({
|
|
5314
5314
|
asked: false,
|
|
@@ -5325,8 +5325,17 @@ function useIsPipeline(tableId, groupField) {
|
|
|
5325
5325
|
cancelled = true;
|
|
5326
5326
|
};
|
|
5327
5327
|
}, [client, tableId]);
|
|
5328
|
-
|
|
5329
|
-
|
|
5328
|
+
return stage;
|
|
5329
|
+
}
|
|
5330
|
+
function boardColumnChoice(fields, chosenKey, stage) {
|
|
5331
|
+
const has = (key) => key != null && fields.some((f) => f.key === key) ? key : null;
|
|
5332
|
+
const chosen = has(chosenKey);
|
|
5333
|
+
if (chosen) {
|
|
5334
|
+
return { groupKey: chosen, isPipeline: stage.asked ? stage.key === chosen : null, stillAsking: false };
|
|
5335
|
+
}
|
|
5336
|
+
if (!stage.asked) return { groupKey: null, isPipeline: null, stillAsking: true };
|
|
5337
|
+
const fromTable = has(stage.key);
|
|
5338
|
+
return { groupKey: fromTable, isPipeline: fromTable != null, stillAsking: false };
|
|
5330
5339
|
}
|
|
5331
5340
|
function Board({
|
|
5332
5341
|
view,
|
|
@@ -5338,7 +5347,7 @@ function Board({
|
|
|
5338
5347
|
}) {
|
|
5339
5348
|
const fields = useFields10(view.subject);
|
|
5340
5349
|
const records = useViewRecords(view, pageSize);
|
|
5341
|
-
const
|
|
5350
|
+
const stage = useStageField(view.subject);
|
|
5342
5351
|
if (fields.error) return /* @__PURE__ */ jsx21(RefusalNotice, { error: fields.error });
|
|
5343
5352
|
if (records.error) return /* @__PURE__ */ jsx21(RefusalNotice, { error: records.error });
|
|
5344
5353
|
if (fields.loading || records.loading) return /* @__PURE__ */ jsx21(Skeleton6, { className: "h-40 w-full" });
|
|
@@ -5346,7 +5355,9 @@ function Board({
|
|
|
5346
5355
|
const byKey = (key) => all.find((f) => f.key === key);
|
|
5347
5356
|
const titleField = byKey(view.groupField) ? all.find((f) => f.key !== view.groupField) ?? all[0] : all[0];
|
|
5348
5357
|
if (view.layout === "kanban") {
|
|
5349
|
-
const
|
|
5358
|
+
const choice = boardColumnChoice(all, view.groupField, stage);
|
|
5359
|
+
const groupField = byKey(choice.groupKey);
|
|
5360
|
+
const isPipeline = choice.isPipeline;
|
|
5350
5361
|
const picker = /* @__PURE__ */ jsx21(
|
|
5351
5362
|
FieldPicker,
|
|
5352
5363
|
{
|
|
@@ -5358,6 +5369,7 @@ function Board({
|
|
|
5358
5369
|
onPick: (key) => onChange({ groupField: key })
|
|
5359
5370
|
}
|
|
5360
5371
|
);
|
|
5372
|
+
if (choice.stillAsking) return /* @__PURE__ */ jsx21(Skeleton6, { className: "h-40 w-full" });
|
|
5361
5373
|
if (!groupField) return /* @__PURE__ */ jsx21(Needs, { layout: "kanban", picker });
|
|
5362
5374
|
return /* @__PURE__ */ jsxs18("div", { className: "flex min-h-0 flex-col gap-2", children: [
|
|
5363
5375
|
picker,
|