@protobase/ui 0.33.0 → 0.33.1
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/app/embedded-list/embedded-list.js +3 -3
- package/dist/app/pages/blocks/record-cards.js +40 -0
- package/dist/app/pages/render-node.js +2 -0
- package/dist/app/record-row/record-row-body.js +1 -1
- package/dist/app/related-cards/related-cards.js +1 -1
- package/dist/app/related-section.js +1 -1
- package/dist/package.js +1 -1
- package/dist/record-view/section.d.ts +6 -3
- package/dist/record-view/section.js +30 -23
- package/dist/shell/assets/app-vrO4ONeQ.js +69 -0
- package/dist/shell/assets/{index-CmfQ3unE.js → index-BOOpQoIj.js} +1 -1
- package/dist/shell/assets/{records-map-NbikCL0c.js → records-map-Xx5fQ8ha.js} +1 -1
- package/dist/shell/assets/{shared-protobase-ui-DF9YzkJs.js → shared-protobase-ui-CN-6W1IB.js} +1 -1
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +1 -1
- package/dist/shell/protobase.sw.js +2 -2
- package/package.json +4 -4
- package/dist/shell/assets/app-s0iA9x1p.js +0 -69
|
@@ -9,8 +9,10 @@ import { AppLink, useAppAddress } from "../use-app-address.js";
|
|
|
9
9
|
import { ErrorBanner } from "../error-banner.js";
|
|
10
10
|
import { useProjectUi } from "../pages/project-ui.js";
|
|
11
11
|
import { can } from "../permissions.js";
|
|
12
|
-
import {
|
|
12
|
+
import { text } from "./messages.js";
|
|
13
|
+
import { cutOffNote } from "./cut-off-note.js";
|
|
13
14
|
import { viewAllAddress } from "./embedded-display.js";
|
|
15
|
+
import { DataGrid } from "../../data-grid/data-grid.js";
|
|
14
16
|
import { BoardDisplay } from "../displays/board-display.js";
|
|
15
17
|
import { CalendarDisplay } from "../displays/calendar-display.js";
|
|
16
18
|
import { TimelineDisplay } from "../displays/timeline-display.js";
|
|
@@ -19,8 +21,6 @@ import { CustomDisplay } from "../displays/custom-display.js";
|
|
|
19
21
|
import { MapDisplay } from "../displays/map-display.js";
|
|
20
22
|
import { DisplaySwitch } from "../displays/display-controls.js";
|
|
21
23
|
import { embeddedColumns } from "./embedded-columns.js";
|
|
22
|
-
import { text } from "./messages.js";
|
|
23
|
-
import { cutOffNote } from "./cut-off-note.js";
|
|
24
24
|
import { embeddedRowTargets } from "./embedded-row-targets.js";
|
|
25
25
|
import { useEmbeddedRows } from "./use-embedded-rows.js";
|
|
26
26
|
import { useMemo, useState } from "react";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SectionContent } from "../../../record-view/section.js";
|
|
2
|
+
import { listColumnNames } from "../../../live/columns-from-model.js";
|
|
3
|
+
import { useAdminMeta } from "../../meta-gate.js";
|
|
4
|
+
import { propsOf } from "./block-props.js";
|
|
5
|
+
import { RelatedCards } from "../../related-cards/related-cards.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/app/pages/blocks/record-cards.tsx
|
|
8
|
+
/**
|
|
9
|
+
* What a filter finds as the record page's related cards, stacked full width under a heading like a record page
|
|
10
|
+
* section's, with no card frame around them, so no card sits in another.
|
|
11
|
+
*/
|
|
12
|
+
const RecordCardsBlock = ({ node, slots }) => {
|
|
13
|
+
const { resource, filter = "", sort = "", fields, cardActions = [], limit = 10, display, title, description, empty } = propsOf(node);
|
|
14
|
+
const { resources, views } = useAdminMeta();
|
|
15
|
+
const model = resources[resource];
|
|
16
|
+
if (!model) return null;
|
|
17
|
+
const view = views[model.name];
|
|
18
|
+
return /* @__PURE__ */ jsx("section", {
|
|
19
|
+
className: "min-w-0",
|
|
20
|
+
"aria-label": title,
|
|
21
|
+
children: /* @__PURE__ */ jsx(SectionContent, {
|
|
22
|
+
title,
|
|
23
|
+
help: description,
|
|
24
|
+
actions: slots.actions,
|
|
25
|
+
children: /* @__PURE__ */ jsx(RelatedCards, {
|
|
26
|
+
model,
|
|
27
|
+
view,
|
|
28
|
+
filter,
|
|
29
|
+
sort,
|
|
30
|
+
fields: fields ?? listColumnNames(model, view),
|
|
31
|
+
actions: cardActions,
|
|
32
|
+
limit,
|
|
33
|
+
display,
|
|
34
|
+
empty
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { RecordCardsBlock };
|
|
@@ -14,6 +14,7 @@ import { ModalFormBlock } from "./blocks/modal-form.js";
|
|
|
14
14
|
import { PageBlock } from "./blocks/page-block.js";
|
|
15
15
|
import { ProgressBlock } from "./blocks/progress.js";
|
|
16
16
|
import { RecordCardBlock } from "./blocks/record-card.js";
|
|
17
|
+
import { RecordCardsBlock } from "./blocks/record-cards.js";
|
|
17
18
|
import { RecordRowBlock } from "./blocks/record-row.js";
|
|
18
19
|
import { ShowBlock } from "./blocks/show.js";
|
|
19
20
|
import { StatBlock } from "./blocks/stat.js";
|
|
@@ -34,6 +35,7 @@ const blocks = {
|
|
|
34
35
|
Table: TableBlock,
|
|
35
36
|
CardRow: CardRowBlock,
|
|
36
37
|
RecordRow: RecordRowBlock,
|
|
38
|
+
RecordCards: RecordCardsBlock,
|
|
37
39
|
Chart: ChartBlock,
|
|
38
40
|
Progress: ProgressBlock,
|
|
39
41
|
ModalForm: ModalFormBlock,
|
|
@@ -7,8 +7,8 @@ import { defaultOrderBy } from "../list-order.js";
|
|
|
7
7
|
import { useAdminMeta } from "../meta-gate.js";
|
|
8
8
|
import { AppLink } from "../use-app-address.js";
|
|
9
9
|
import { ErrorBanner } from "../error-banner.js";
|
|
10
|
-
import { useLiveRows } from "../../live/use-live-rows.js";
|
|
11
10
|
import { viewAllAddress } from "../embedded-list/embedded-display.js";
|
|
11
|
+
import { useLiveRows } from "../../live/use-live-rows.js";
|
|
12
12
|
import { FilterChipList } from "../searches/filter-chip-list.js";
|
|
13
13
|
import { useFilterChips } from "../searches/use-filter-chips.js";
|
|
14
14
|
import { text } from "./messages.js";
|
|
@@ -5,9 +5,9 @@ import { defaultOrderBy } from "../list-order.js";
|
|
|
5
5
|
import { AppLink } from "../use-app-address.js";
|
|
6
6
|
import { ErrorBanner } from "../error-banner.js";
|
|
7
7
|
import { scopeOf, useCount, useListPage } from "../pages/use-layout-data.js";
|
|
8
|
-
import { embeddedDisplay, viewAllAddress } from "../embedded-list/embedded-display.js";
|
|
9
8
|
import { text } from "../embedded-list/messages.js";
|
|
10
9
|
import { cutOffNote } from "../embedded-list/cut-off-note.js";
|
|
10
|
+
import { embeddedDisplay, viewAllAddress } from "../embedded-list/embedded-display.js";
|
|
11
11
|
import { text as text$1 } from "./messages.js";
|
|
12
12
|
import { RelatedCard } from "./related-card.js";
|
|
13
13
|
import { ArrowRight } from "lucide-react";
|
|
@@ -6,6 +6,7 @@ import { listColumnNames } from "../live/columns-from-model.js";
|
|
|
6
6
|
import { useAdminMeta, usePermissions } from "./meta-gate.js";
|
|
7
7
|
import { ErrorBanner } from "./error-banner.js";
|
|
8
8
|
import { countQuery } from "./pages/use-layout-data.js";
|
|
9
|
+
import { RelatedCards } from "./related-cards/related-cards.js";
|
|
9
10
|
import { searchAll } from "../live/search-all.js";
|
|
10
11
|
import { relatedHandOrder } from "./hand-order/hand-order.js";
|
|
11
12
|
import { relatedOpens } from "./related-opens.js";
|
|
@@ -14,7 +15,6 @@ import { useEmbeddedDisplay } from "./embedded-list/use-embedded-display.js";
|
|
|
14
15
|
import { text } from "./record-messages.js";
|
|
15
16
|
import { HandSortedList } from "./hand-order/hand-sorted-list.js";
|
|
16
17
|
import { ReorderButton } from "./hand-order/reorder-button.js";
|
|
17
|
-
import { RelatedCards } from "./related-cards/related-cards.js";
|
|
18
18
|
import { useState } from "react";
|
|
19
19
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
20
|
import { useQuery } from "@tanstack/react-query";
|
package/dist/package.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
//#region src/record-view/section.d.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
title: string;
|
|
3
|
+
type SectionProps = {
|
|
4
|
+
title?: string;
|
|
6
5
|
help?: string;
|
|
7
6
|
actions?: ReactNode;
|
|
8
7
|
children: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
/** A titled part of the record page; `actions` sit at the end of the title's line. */
|
|
10
|
+
export declare const Section: ({ title, help, actions, children }: SectionProps & {
|
|
11
|
+
title: string;
|
|
9
12
|
}) => import("react").JSX.Element;
|
|
10
13
|
//#endregion
|
|
@@ -1,28 +1,35 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
//#region src/record-view/section.tsx
|
|
3
|
-
/** A
|
|
4
|
-
const
|
|
5
|
-
const heading = /* @__PURE__ */ jsx("h2", {
|
|
3
|
+
/** A section's title, its `actions` at the end of the title's line and its help, over its content, with no frame or spacing around them. */
|
|
4
|
+
const SectionContent = ({ title, help, actions, children }) => {
|
|
5
|
+
const heading = title ? /* @__PURE__ */ jsx("h2", {
|
|
6
6
|
className: "text-[16px] font-semibold text-foreground",
|
|
7
7
|
children: title
|
|
8
|
-
});
|
|
9
|
-
return /* @__PURE__ */ jsxs(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
help
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
]
|
|
25
|
-
});
|
|
8
|
+
}) : null;
|
|
9
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10
|
+
actions ? /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2",
|
|
12
|
+
children: [heading ?? /* @__PURE__ */ jsx("span", {}), actions]
|
|
13
|
+
}) : heading,
|
|
14
|
+
help && /* @__PURE__ */ jsx("p", {
|
|
15
|
+
className: "mt-1 max-w-xl leading-6 text-muted-foreground",
|
|
16
|
+
children: help
|
|
17
|
+
}),
|
|
18
|
+
Boolean(heading || actions || help) ? /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: "mt-5",
|
|
20
|
+
children
|
|
21
|
+
}) : children
|
|
22
|
+
] });
|
|
26
23
|
};
|
|
24
|
+
/** A titled part of the record page; `actions` sit at the end of the title's line. */
|
|
25
|
+
const Section = ({ title, help, actions, children }) => /* @__PURE__ */ jsx("section", {
|
|
26
|
+
className: "py-8 first:pt-8",
|
|
27
|
+
children: /* @__PURE__ */ jsx(SectionContent, {
|
|
28
|
+
title,
|
|
29
|
+
help,
|
|
30
|
+
actions,
|
|
31
|
+
children
|
|
32
|
+
})
|
|
33
|
+
});
|
|
27
34
|
//#endregion
|
|
28
|
-
export { Section };
|
|
35
|
+
export { Section, SectionContent };
|