@plitzi/sdk-elements 0.32.24 → 0.33.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 +31 -0
- package/dist/Element/ElementContext.d.ts +7 -0
- package/dist/Element/helpers/isVisible.d.ts +1 -0
- package/dist/Element/helpers/isVisible.mjs +4 -0
- package/dist/Element/hocs/withElement.mjs +86 -78
- package/dist/Element/hooks/useInternalClassName.mjs +21 -20
- package/dist/Element/hooks/useInternalItems.mjs +1 -1
- package/dist/Element/hooks/useRscData.d.ts +4 -3
- package/dist/Element/hooks/useRscData.mjs +15 -10
- package/dist/dataSource/GlobalSources.d.ts +1 -2
- package/dist/dataSource/GlobalSources.mjs +46 -62
- package/dist/elements/advanced/BlockJsx/BlockJsx.mjs +1 -1
- package/dist/elements/basic/Link/Link.mjs +47 -41
- package/dist/elements/basic/RichText/RichText.d.ts +20 -0
- package/dist/elements/basic/RichText/RichText.mjs +30 -0
- package/dist/elements/basic/RichText/Settings.d.ts +7 -0
- package/dist/elements/basic/RichText/Settings.mjs +51 -0
- package/dist/elements/{provider/CollectionContainer → basic/RichText}/index.d.ts +6 -7
- package/dist/elements/{provider/CollectionContainer → basic/RichText}/index.mjs +12 -13
- package/dist/elements/basic/RichText/sanitizeHtml.d.ts +21 -0
- package/dist/elements/basic/RichText/sanitizeHtml.mjs +8 -0
- package/dist/elements/form/FormControl/index.mjs +1 -1
- package/dist/elements/index.d.ts +5 -3
- package/dist/elements/index.mjs +30 -28
- package/dist/elements/internal/Page/Page.mjs +28 -26
- package/dist/elements/provider/ApiContainer/ApiContainer.d.ts +28 -1
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +201 -86
- package/dist/elements/provider/ApiContainer/Settings.d.ts +15 -3
- package/dist/elements/provider/ApiContainer/Settings.mjs +209 -92
- package/dist/elements/provider/ApiContainer/components/FiltersInput/FiltersInput.d.ts +22 -0
- package/dist/elements/provider/ApiContainer/components/FiltersInput/FiltersInput.mjs +75 -0
- package/dist/elements/provider/ApiContainer/components/FiltersInput/index.d.ts +3 -0
- package/dist/elements/provider/ApiContainer/components/FiltersInput/index.mjs +5 -0
- package/dist/elements/provider/ApiContainer/hooks/useProviderPagination.d.ts +31 -0
- package/dist/elements/provider/ApiContainer/hooks/useProviderPagination.mjs +51 -0
- package/dist/elements/provider/ApiContainer/hooks/useProviderWrite.d.ts +26 -0
- package/dist/elements/provider/ApiContainer/hooks/useProviderWrite.mjs +27 -0
- package/dist/elements/provider/ApiContainer/index.d.ts +8 -0
- package/dist/elements/provider/ApiContainer/index.mjs +9 -1
- package/dist/elements/settings.mjs +32 -30
- package/dist/elements/structure/Pagination/Pagination.d.ts +41 -0
- package/dist/elements/structure/Pagination/Pagination.mjs +83 -0
- package/dist/elements/structure/Pagination/Settings.d.ts +12 -0
- package/dist/elements/structure/Pagination/Settings.mjs +85 -0
- package/dist/elements/structure/Pagination/buildPageWindow.d.ts +9 -0
- package/dist/elements/structure/Pagination/buildPageWindow.mjs +8 -0
- package/dist/elements/structure/Pagination/index.d.ts +67 -0
- package/dist/elements/structure/Pagination/index.mjs +59 -0
- package/dist/index.d.ts +130 -57
- package/dist/index.mjs +32 -30
- package/package.json +76 -32
- package/dist/elements/internal/Page/helpers/UserHelper.d.ts +0 -4
- package/dist/elements/provider/CollectionContainer/CollectionContainer.d.ts +0 -18
- package/dist/elements/provider/CollectionContainer/CollectionContainer.mjs +0 -69
- package/dist/elements/provider/CollectionContainer/CollectionContainer.stories-pending.d.ts +0 -1
- package/dist/elements/provider/CollectionContainer/Settings.d.ts +0 -10
- package/dist/elements/provider/CollectionContainer/Settings.mjs +0 -74
- package/dist/elements/provider/CollectionContainer/hooks/useCollectionContext.d.ts +0 -19
- package/dist/elements/provider/CollectionContainer/hooks/useCollectionContext.mjs +0 -71
|
@@ -1,66 +1,72 @@
|
|
|
1
1
|
import e from "../../../Element/hooks/useElement.mjs";
|
|
2
2
|
import { RootElement as t } from "../../../Element/RootElement.mjs";
|
|
3
3
|
import n from "../../../Element/hocs/withElement.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import { processTwig as
|
|
8
|
-
import { jsx as
|
|
9
|
-
import
|
|
10
|
-
import { getPageFullPath as
|
|
4
|
+
import { useMemo as r } from "react";
|
|
5
|
+
import i from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
6
|
+
import { useSdkStore as a } from "@plitzi/sdk-shared/store";
|
|
7
|
+
import { processTwig as o } from "@plitzi/sdk-shared/helpers/twigWrapper";
|
|
8
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
9
|
+
import c from "clsx";
|
|
10
|
+
import { getPageFullPath as l } from "@plitzi/sdk-navigation/NavigationHelper";
|
|
11
11
|
//#region src/elements/basic/Link/Link.tsx
|
|
12
|
-
var
|
|
13
|
-
let { style:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
var u = ({ ref: n, children: u, className: d = "", href: f = "#", target: p = "self", mode: m = "page" }) => {
|
|
13
|
+
let { style: h } = e(), { settings: { previewMode: g } } = i(), [[_, v, y, b, x]] = a([
|
|
14
|
+
"pageDefinitions",
|
|
15
|
+
"schema.pageFolders",
|
|
16
|
+
"navigation.routeParams",
|
|
17
|
+
"navigation.queryParams",
|
|
18
|
+
"navigation.navigate"
|
|
19
|
+
]), S = r(() => {
|
|
20
|
+
if (m === "external") return f;
|
|
21
|
+
let e = `/${f}`.replaceAll(/[/]+/gim, "/");
|
|
22
|
+
if (m === "internal") {
|
|
17
23
|
try {
|
|
18
|
-
let t =
|
|
19
|
-
...
|
|
20
|
-
...
|
|
24
|
+
let t = o(e, {
|
|
25
|
+
...b,
|
|
26
|
+
...y
|
|
21
27
|
}, !0);
|
|
22
28
|
return typeof t == "string" ? t : e;
|
|
23
29
|
} catch {}
|
|
24
30
|
return e;
|
|
25
31
|
}
|
|
26
|
-
return
|
|
32
|
+
return l(_, v, f, !0);
|
|
27
33
|
}, [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
]),
|
|
35
|
-
|
|
36
|
-
},
|
|
34
|
+
m,
|
|
35
|
+
f,
|
|
36
|
+
_,
|
|
37
|
+
v,
|
|
38
|
+
b,
|
|
39
|
+
y
|
|
40
|
+
]), C = (e) => {
|
|
41
|
+
g && (e.stopPropagation(), (m === "page" || m === "internal") && (e.preventDefault(), x(S)));
|
|
42
|
+
}, w = r(() => {
|
|
37
43
|
let e = {
|
|
38
44
|
ref: n,
|
|
39
|
-
style:
|
|
40
|
-
target: `_${
|
|
41
|
-
className:
|
|
45
|
+
style: h,
|
|
46
|
+
target: `_${p}`,
|
|
47
|
+
className: c("plitzi-component__link", d)
|
|
42
48
|
};
|
|
43
|
-
return
|
|
49
|
+
return g ? {
|
|
44
50
|
...e,
|
|
45
|
-
href:
|
|
51
|
+
href: S
|
|
46
52
|
} : {
|
|
47
53
|
...e,
|
|
48
|
-
"href-disabled":
|
|
54
|
+
"href-disabled": S
|
|
49
55
|
};
|
|
50
56
|
}, [
|
|
51
57
|
n,
|
|
58
|
+
h,
|
|
59
|
+
p,
|
|
60
|
+
d,
|
|
52
61
|
g,
|
|
53
|
-
|
|
54
|
-
f,
|
|
55
|
-
_,
|
|
56
|
-
w
|
|
62
|
+
S
|
|
57
63
|
]);
|
|
58
|
-
return /* @__PURE__ */
|
|
64
|
+
return /* @__PURE__ */ s(t, {
|
|
59
65
|
tag: "a",
|
|
60
|
-
...
|
|
61
|
-
onClick:
|
|
62
|
-
children:
|
|
66
|
+
...w,
|
|
67
|
+
onClick: C,
|
|
68
|
+
children: u
|
|
63
69
|
});
|
|
64
|
-
},
|
|
70
|
+
}, d = n(u);
|
|
65
71
|
//#endregion
|
|
66
|
-
export {
|
|
72
|
+
export { u as Link, d as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type RichTextProps = {
|
|
3
|
+
ref?: RefObject<HTMLElement>;
|
|
4
|
+
className?: string;
|
|
5
|
+
/** The body, bound from the provider. Whatever shape the CMS returns — see `format`. */
|
|
6
|
+
content?: string;
|
|
7
|
+
/** CMSs disagree on this and each one is right for itself: Strapi returns HTML or markdown depending on the
|
|
8
|
+
* editor, Contentful and Ghost return HTML, and plenty of fields are just text. One element, three readings. */
|
|
9
|
+
format?: 'html' | 'markdown' | 'text';
|
|
10
|
+
/** Prefix for relative `src`/`href` inside the body. A connector rebases record fields, but the markup inside a
|
|
11
|
+
* body field is opaque to it. */
|
|
12
|
+
mediaBaseUrl?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const RichText: ({ ref, className, content, format, mediaBaseUrl }: RichTextProps) => import("react").JSX.Element;
|
|
15
|
+
declare const _default: {
|
|
16
|
+
(props: import('../../../Element/hocs/withElement').WithElementProps<RichTextProps>): import("react").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
20
|
+
export { RichText };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RootElement as e } from "../../../Element/RootElement.mjs";
|
|
2
|
+
import { rebaseHtmlMedia as t, sanitizeHtml as n } from "./sanitizeHtml.mjs";
|
|
3
|
+
import r from "../../../Element/hocs/withElement.mjs";
|
|
4
|
+
import { useMemo as i } from "react";
|
|
5
|
+
import a from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import c from "clsx";
|
|
8
|
+
import l from "@plitzi/plitzi-ui/Markdown";
|
|
9
|
+
//#region src/elements/basic/RichText/RichText.tsx
|
|
10
|
+
var u = ({ ref: r, className: u = "", content: d = "", format: f = "html", mediaBaseUrl: p = "" }) => {
|
|
11
|
+
let { settings: { previewMode: m } } = a(), h = i(() => f === "html" ? t(n(d), p) : "", [
|
|
12
|
+
f,
|
|
13
|
+
d,
|
|
14
|
+
p
|
|
15
|
+
]);
|
|
16
|
+
return /* @__PURE__ */ s(e, {
|
|
17
|
+
ref: r,
|
|
18
|
+
className: c("plitzi-component__rich-text", { "plitzi-component__rich-text--edit-mode": !m }, u),
|
|
19
|
+
children: [
|
|
20
|
+
f === "html" && /* @__PURE__ */ o("div", { dangerouslySetInnerHTML: { __html: h } }),
|
|
21
|
+
f === "markdown" && /* @__PURE__ */ o(l, { children: d }),
|
|
22
|
+
f === "text" && /* @__PURE__ */ o("div", {
|
|
23
|
+
className: "plitzi-component__rich-text-plain",
|
|
24
|
+
children: d
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
}, d = r(u);
|
|
29
|
+
//#endregion
|
|
30
|
+
export { u as RichText, d as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type SettingsProps = {
|
|
2
|
+
format?: 'html' | 'markdown' | 'text';
|
|
3
|
+
mediaBaseUrl?: string;
|
|
4
|
+
onUpdate?: (key: string, value: string | boolean | number | object) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const Settings: ({ format, mediaBaseUrl, onUpdate }: SettingsProps) => import("react").JSX.Element;
|
|
7
|
+
export default Settings;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useCallback as e } from "react";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import r from "@plitzi/plitzi-ui/Input";
|
|
4
|
+
import i from "@plitzi/plitzi-ui/Select";
|
|
5
|
+
//#region src/elements/basic/RichText/Settings.tsx
|
|
6
|
+
var a = ({ format: a = "html", mediaBaseUrl: o = "", onUpdate: s }) => {
|
|
7
|
+
let c = e((e) => (t) => s?.(e, t), [s]);
|
|
8
|
+
return /* @__PURE__ */ n("div", {
|
|
9
|
+
className: "flex grow flex-col gap-4 py-2",
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ n(i, {
|
|
12
|
+
value: a,
|
|
13
|
+
label: "Content Format",
|
|
14
|
+
onChange: c("format"),
|
|
15
|
+
size: "xs",
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ t("option", {
|
|
18
|
+
value: "html",
|
|
19
|
+
children: "HTML"
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ t("option", {
|
|
22
|
+
value: "markdown",
|
|
23
|
+
children: "Markdown"
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ t("option", {
|
|
26
|
+
value: "text",
|
|
27
|
+
children: "Plain text"
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ t(r, {
|
|
32
|
+
value: o,
|
|
33
|
+
label: "Media Base URL",
|
|
34
|
+
placeholder: "https://cms.example.com",
|
|
35
|
+
title: "Prefix for relative image and link paths inside the body.",
|
|
36
|
+
onChange: c("mediaBaseUrl"),
|
|
37
|
+
size: "xs"
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ n("span", {
|
|
40
|
+
className: "text-xs text-gray-500",
|
|
41
|
+
children: [
|
|
42
|
+
"Bind ",
|
|
43
|
+
/* @__PURE__ */ t("strong", { children: "content" }),
|
|
44
|
+
" to the body field of your record. Scripts, event handlers and javascript: URLs are removed before rendering."
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { a as default };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
(props: import('../../../Element/hocs/withElement').WithElementProps<import('./
|
|
1
|
+
declare const RichText: {
|
|
2
|
+
(props: import('../../../Element/hocs/withElement').WithElementProps<import('./RichText').RichTextProps>): import("react").JSX.Element;
|
|
3
3
|
displayName: string;
|
|
4
4
|
} & {
|
|
5
5
|
type: string;
|
|
6
6
|
content: {
|
|
7
7
|
attributes: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
singleRecord: boolean;
|
|
8
|
+
content: string;
|
|
9
|
+
format: string;
|
|
10
|
+
mediaBaseUrl: string;
|
|
12
11
|
};
|
|
13
12
|
definition: {
|
|
14
13
|
label: string;
|
|
@@ -57,4 +56,4 @@ declare const CollectionContainer: {
|
|
|
57
56
|
settings: {};
|
|
58
57
|
};
|
|
59
58
|
};
|
|
60
|
-
export default
|
|
59
|
+
export default RichText;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import e from "./
|
|
2
|
-
//#region src/elements/
|
|
1
|
+
import e from "./RichText.mjs";
|
|
2
|
+
//#region src/elements/basic/RichText/index.ts
|
|
3
3
|
var t = Object.assign(e, {
|
|
4
|
-
type: "
|
|
4
|
+
type: "richText",
|
|
5
5
|
content: {
|
|
6
6
|
attributes: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
singleRecord: !1
|
|
7
|
+
content: "",
|
|
8
|
+
format: "html",
|
|
9
|
+
mediaBaseUrl: ""
|
|
11
10
|
},
|
|
12
11
|
definition: {
|
|
13
|
-
label: "
|
|
14
|
-
type: "
|
|
15
|
-
description: "",
|
|
12
|
+
label: "Rich Text",
|
|
13
|
+
type: "richText",
|
|
14
|
+
description: "Renders a body field coming from a CMS — HTML, markdown or plain text. Scripts and event handlers are stripped before rendering, so third-party content cannot execute.",
|
|
16
15
|
items: [],
|
|
17
16
|
bindings: {},
|
|
18
17
|
styleSelectors: { base: "" },
|
|
@@ -28,16 +27,16 @@ var t = Object.assign(e, {
|
|
|
28
27
|
itemsNotAllowed: []
|
|
29
28
|
},
|
|
30
29
|
market: {
|
|
31
|
-
category: "
|
|
30
|
+
category: "basic",
|
|
32
31
|
owner: "Plitzi",
|
|
33
32
|
verified: !0,
|
|
34
33
|
license: "MIT",
|
|
35
34
|
website: "https://plitzi.com",
|
|
36
35
|
backgroundColor: "#4422ee",
|
|
37
|
-
icon: "fa-solid fa-
|
|
36
|
+
icon: "fa-solid fa-align-left"
|
|
38
37
|
},
|
|
39
38
|
defaultStyle: {
|
|
40
|
-
name: "
|
|
39
|
+
name: "Rich Text",
|
|
41
40
|
displayMode: "desktop",
|
|
42
41
|
style: { base: { default: {
|
|
43
42
|
"min-width": "50px",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strips everything executable out of third-party HTML.
|
|
3
|
+
*
|
|
4
|
+
* This exists because `BlockHtml` deliberately does the opposite: it extracts `<script>` tags and runs them, which
|
|
5
|
+
* is correct for an embed the site's own author pasted in and unacceptable for a body field that arrives from a
|
|
6
|
+
* CMS — where the author of the content and the author of the site are, by design, different people.
|
|
7
|
+
*
|
|
8
|
+
* Deny-list sanitizing in a regex is not equivalent to parsing, and it is not claimed to be: it is the last line,
|
|
9
|
+
* not the only one. The provider is trusted (the site owner connected it), the content is not, and the markup a
|
|
10
|
+
* CMS body field produces is ordinary prose markup. `data:` is refused in URLs for the same reason as
|
|
11
|
+
* `javascript:` — an `data:text/html` navigation is script by another name.
|
|
12
|
+
*/
|
|
13
|
+
export declare const sanitizeHtml: (html: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Rewrites relative media paths in already-sanitized markup.
|
|
16
|
+
*
|
|
17
|
+
* A connector rebases the URLs it finds in a record's *fields*, but a body field is one opaque string — the
|
|
18
|
+
* `<img src="/uploads/x.png">` inside it is invisible to that pass and has to be handled where the markup is
|
|
19
|
+
* finally read.
|
|
20
|
+
*/
|
|
21
|
+
export declare const rebaseHtmlMedia: (html: string, baseUrl: string) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/elements/basic/RichText/sanitizeHtml.ts
|
|
2
|
+
var e = /<\s*(script|style|iframe|object|embed|link|meta|base|form)\b[^>]*>[\s\S]*?<\s*\/\s*\1\s*>/gi, t = /<\s*\/?\s*(script|style|iframe|object|embed|link|meta|base|form)\b[^>]*>/gi, n = /\son[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, r = /\s(href|src|xlink:href)\s*=\s*(?:"\s*(?:javascript|data|vbscript)\s*:[^"]*"|'\s*(?:javascript|data|vbscript)\s*:[^']*'|(?:javascript|data|vbscript)\s*:[^\s>]*)/gi, i = (i) => i.replace(e, "").replace(t, "").replace(n, "").replace(r, ""), a = (e, t) => {
|
|
3
|
+
if (!t) return e;
|
|
4
|
+
let n = t.replace(/\/+$/, "");
|
|
5
|
+
return e.replace(/\s(src|href)\s*=\s*"(\/(?!\/)[^"]*)"/gi, (e, t, r) => ` ${t}="${n}${r}"`);
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { a as rebaseHtmlMedia, i as sanitizeHtml };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from "./FormControl.mjs";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { omit as n } from "@plitzi/plitzi-ui";
|
|
3
|
+
import { omit as n } from "@plitzi/plitzi-ui/helpers/lodash";
|
|
4
4
|
import r from "@plitzi/plitzi-ui/icons/Form";
|
|
5
5
|
//#region src/elements/form/FormControl/index.tsx
|
|
6
6
|
var i = {
|
package/dist/elements/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { default as Heading } from './basic/Heading';
|
|
|
9
9
|
import { default as Link } from './basic/Link';
|
|
10
10
|
import { default as Markdown } from './basic/Markdown';
|
|
11
11
|
import { default as Paragraph } from './basic/Paragraph';
|
|
12
|
+
import { default as RichText } from './basic/RichText';
|
|
12
13
|
import { default as Text } from './basic/Text';
|
|
13
14
|
import { default as Form } from './form/Form';
|
|
14
15
|
import { default as FormControl } from './form/FormControl';
|
|
@@ -20,11 +21,11 @@ import { default as FontAwesome } from './media/FontAwesome';
|
|
|
20
21
|
import { default as Image } from './media/Image';
|
|
21
22
|
import { default as Video } from './media/Video';
|
|
22
23
|
import { default as ApiContainer } from './provider/ApiContainer';
|
|
23
|
-
import { default as CollectionContainer } from './provider/CollectionContainer';
|
|
24
24
|
import { default as Container } from './structure/Container';
|
|
25
25
|
import { default as DialogContainer } from './structure/DialogContainer';
|
|
26
26
|
import { default as List } from './structure/List';
|
|
27
27
|
import { default as ModalContainer } from './structure/ModalContainer';
|
|
28
|
+
import { default as Pagination } from './structure/Pagination';
|
|
28
29
|
import { default as TabContainer } from './structure/TabContainer';
|
|
29
30
|
export * from './advanced/BlockHtml';
|
|
30
31
|
export * from './advanced/BlockJsx';
|
|
@@ -37,6 +38,7 @@ export * from './basic/Heading';
|
|
|
37
38
|
export * from './basic/Link';
|
|
38
39
|
export * from './basic/Markdown';
|
|
39
40
|
export * from './basic/Paragraph';
|
|
41
|
+
export * from './basic/RichText';
|
|
40
42
|
export * from './basic/Text';
|
|
41
43
|
export * from './form/Form';
|
|
42
44
|
export * from './form/FormControl';
|
|
@@ -47,10 +49,10 @@ export * from './media/FontAwesome';
|
|
|
47
49
|
export * from './media/Image';
|
|
48
50
|
export * from './media/Video';
|
|
49
51
|
export * from './provider/ApiContainer';
|
|
50
|
-
export * from './provider/CollectionContainer';
|
|
51
52
|
export * from './structure/Container';
|
|
52
53
|
export * from './structure/DialogContainer';
|
|
53
54
|
export * from './structure/List';
|
|
54
55
|
export * from './structure/ModalContainer';
|
|
56
|
+
export * from './structure/Pagination';
|
|
55
57
|
export * from './structure/TabContainer';
|
|
56
|
-
export { NodeHtml, Dropdown, NotFound, Loading, Custom, Reference, BlockHtml, BlockJsx, Page, Container, LayoutContainer, DialogContainer, ModalContainer, TabContainer, Heading, Image, Video, FontAwesome, Button, Paragraph, Text, List, Link, Markdown, Form, FormControl, ApiContainer
|
|
58
|
+
export { NodeHtml, Dropdown, NotFound, Loading, Custom, Reference, BlockHtml, BlockJsx, Page, Container, LayoutContainer, DialogContainer, ModalContainer, TabContainer, Heading, Image, Video, FontAwesome, Button, Paragraph, RichText, Text, List, Link, Markdown, Pagination, Form, FormControl, ApiContainer };
|
package/dist/elements/index.mjs
CHANGED
|
@@ -10,53 +10,55 @@ import c from "./basic/Heading/index.mjs";
|
|
|
10
10
|
import l from "./basic/Link/index.mjs";
|
|
11
11
|
import u from "./basic/Markdown/index.mjs";
|
|
12
12
|
import d from "./basic/Paragraph/index.mjs";
|
|
13
|
-
import f from "./basic/
|
|
14
|
-
import p from "./
|
|
15
|
-
import m from "./form/
|
|
16
|
-
import h from "./
|
|
17
|
-
import g from "./internal/
|
|
18
|
-
import
|
|
19
|
-
import v from "./internal/
|
|
20
|
-
import y from "./
|
|
21
|
-
import b from "./media/
|
|
22
|
-
import x from "./media/
|
|
23
|
-
import S from "./
|
|
24
|
-
import C from "./provider/
|
|
13
|
+
import f from "./basic/RichText/index.mjs";
|
|
14
|
+
import p from "./basic/Text/index.mjs";
|
|
15
|
+
import m from "./form/Form/index.mjs";
|
|
16
|
+
import h from "./form/FormControl/index.mjs";
|
|
17
|
+
import g from "./internal/LayoutContainer/index.mjs";
|
|
18
|
+
import _ from "./internal/Loading/index.mjs";
|
|
19
|
+
import { NotFound as v } from "./internal/NotFound/index.mjs";
|
|
20
|
+
import y from "./internal/Page/index.mjs";
|
|
21
|
+
import b from "./media/FontAwesome/index.mjs";
|
|
22
|
+
import x from "./media/Image/index.mjs";
|
|
23
|
+
import S from "./media/Video/index.mjs";
|
|
24
|
+
import C from "./provider/ApiContainer/index.mjs";
|
|
25
25
|
import w from "./structure/Container/index.mjs";
|
|
26
26
|
import T from "./structure/DialogContainer/index.mjs";
|
|
27
27
|
import E from "./structure/List/index.mjs";
|
|
28
28
|
import D from "./structure/ModalContainer/index.mjs";
|
|
29
|
-
import O from "./structure/
|
|
29
|
+
import O from "./structure/Pagination/index.mjs";
|
|
30
|
+
import k from "./structure/TabContainer/index.mjs";
|
|
30
31
|
//#region src/elements/index.ts
|
|
31
|
-
var
|
|
32
|
-
ApiContainer: () =>
|
|
32
|
+
var A = /* @__PURE__ */ e({
|
|
33
|
+
ApiContainer: () => C,
|
|
33
34
|
BlockHtml: () => t,
|
|
34
35
|
BlockJsx: () => n,
|
|
35
36
|
Button: () => o,
|
|
36
|
-
CollectionContainer: () => C,
|
|
37
37
|
Container: () => w,
|
|
38
38
|
Custom: () => r,
|
|
39
39
|
DialogContainer: () => T,
|
|
40
40
|
Dropdown: () => s,
|
|
41
|
-
FontAwesome: () =>
|
|
42
|
-
Form: () =>
|
|
43
|
-
FormControl: () =>
|
|
41
|
+
FontAwesome: () => b,
|
|
42
|
+
Form: () => m,
|
|
43
|
+
FormControl: () => h,
|
|
44
44
|
Heading: () => c,
|
|
45
|
-
Image: () =>
|
|
46
|
-
LayoutContainer: () =>
|
|
45
|
+
Image: () => x,
|
|
46
|
+
LayoutContainer: () => g,
|
|
47
47
|
Link: () => l,
|
|
48
48
|
List: () => E,
|
|
49
|
-
Loading: () =>
|
|
49
|
+
Loading: () => _,
|
|
50
50
|
Markdown: () => u,
|
|
51
51
|
ModalContainer: () => D,
|
|
52
52
|
NodeHtml: () => i,
|
|
53
|
-
NotFound: () =>
|
|
54
|
-
Page: () =>
|
|
53
|
+
NotFound: () => v,
|
|
54
|
+
Page: () => y,
|
|
55
|
+
Pagination: () => O,
|
|
55
56
|
Paragraph: () => d,
|
|
56
57
|
Reference: () => a,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
RichText: () => f,
|
|
59
|
+
TabContainer: () => k,
|
|
60
|
+
Text: () => p,
|
|
61
|
+
Video: () => S
|
|
60
62
|
});
|
|
61
63
|
//#endregion
|
|
62
|
-
export {
|
|
64
|
+
export { C as ApiContainer, t as BlockHtml, n as BlockJsx, o as Button, w as Container, r as Custom, T as DialogContainer, s as Dropdown, b as FontAwesome, m as Form, h as FormControl, c as Heading, x as Image, g as LayoutContainer, l as Link, E as List, _ as Loading, u as Markdown, D as ModalContainer, i as NodeHtml, v as NotFound, y as Page, O as Pagination, d as Paragraph, a as Reference, f as RichText, k as TabContainer, p as Text, S as Video, A as elements_exports };
|
|
@@ -4,25 +4,27 @@ import n from "../LayoutContainer/index.mjs";
|
|
|
4
4
|
import r from "../../../Element/hocs/withElement.mjs";
|
|
5
5
|
import { use as i, useEffect as a, useMemo as o } from "react";
|
|
6
6
|
import s from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
7
|
-
import {
|
|
8
|
-
import u from "
|
|
7
|
+
import { useSdkStore as c } from "@plitzi/sdk-shared/store";
|
|
8
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
|
+
import d from "clsx";
|
|
10
|
+
import { Helmet as f } from "@dr.pogodin/react-helmet";
|
|
9
11
|
//#region src/elements/internal/Page/Page.tsx
|
|
10
|
-
var
|
|
11
|
-
let { id:
|
|
12
|
-
id:
|
|
13
|
-
rootId:
|
|
12
|
+
var p = ({ ref: r, seoEnabled: p = !1, seoPageTitle: m = "Title", seoPageDescription: h = "Description", className: g = "", layout: _ = "", layoutContainer: v = "", children: y }) => {
|
|
13
|
+
let { id: b, idRef: x } = e(), { settings: { previewMode: S }, contexts: { InteractionsContext: C } } = s(), { interactionsManager: w } = i(C), [[T, E]] = c(["navigation.routeParams", "navigation.queryParams"]), D = o(() => ({
|
|
14
|
+
id: _,
|
|
15
|
+
rootId: b,
|
|
14
16
|
plitziElementLayout: {
|
|
15
|
-
bodyChildren:
|
|
16
|
-
containerId:
|
|
17
|
-
referenceId:
|
|
18
|
-
rootId:
|
|
17
|
+
bodyChildren: y,
|
|
18
|
+
containerId: v || _,
|
|
19
|
+
referenceId: b,
|
|
20
|
+
rootId: v || _,
|
|
19
21
|
type: "layout"
|
|
20
22
|
}
|
|
21
23
|
}), [
|
|
22
|
-
g,
|
|
23
|
-
h,
|
|
24
24
|
v,
|
|
25
|
-
_
|
|
25
|
+
_,
|
|
26
|
+
b,
|
|
27
|
+
y
|
|
26
28
|
]), O = o(() => ({ onPageLoad: {
|
|
27
29
|
action: "onPageLoad",
|
|
28
30
|
title: "On Page Load",
|
|
@@ -35,30 +37,30 @@ var d = ({ ref: r, seoEnabled: d = !1, seoPageTitle: f = "Title", seoPageDescrip
|
|
|
35
37
|
}
|
|
36
38
|
} }), []);
|
|
37
39
|
return a(() => {
|
|
38
|
-
|
|
39
|
-
pageId:
|
|
40
|
+
w.interactionTrigger(x, "onPageLoad", {
|
|
41
|
+
pageId: b,
|
|
40
42
|
routeParams: T,
|
|
41
43
|
queryParams: E
|
|
42
44
|
});
|
|
43
45
|
}, [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
b,
|
|
47
|
+
x,
|
|
48
|
+
w,
|
|
47
49
|
E,
|
|
48
50
|
T
|
|
49
|
-
]), /* @__PURE__ */
|
|
51
|
+
]), /* @__PURE__ */ u(t, {
|
|
50
52
|
ref: r,
|
|
51
|
-
className:
|
|
53
|
+
className: d("plitzi-component__page", g),
|
|
52
54
|
interactionTriggers: O,
|
|
53
55
|
children: [
|
|
54
|
-
|
|
56
|
+
p && S && /* @__PURE__ */ u(f, { children: [!!m && /* @__PURE__ */ l("title", { children: m }), !!h && /* @__PURE__ */ l("meta", {
|
|
55
57
|
name: "description",
|
|
56
|
-
content:
|
|
58
|
+
content: h
|
|
57
59
|
})] }),
|
|
58
|
-
|
|
59
|
-
!
|
|
60
|
+
_ && /* @__PURE__ */ l(n, { internalProps: D }),
|
|
61
|
+
!_ && y
|
|
60
62
|
]
|
|
61
63
|
});
|
|
62
|
-
},
|
|
64
|
+
}, m = r(p);
|
|
63
65
|
//#endregion
|
|
64
|
-
export {
|
|
66
|
+
export { p as Page, m as default };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ProviderPagination } from './hooks/useProviderPagination';
|
|
1
2
|
import { RuleGroup } from '@plitzi/plitzi-ui/QueryBuilder';
|
|
2
3
|
import { ReactNode, RefObject } from 'react';
|
|
3
4
|
export type ApiContainerProps = {
|
|
@@ -6,14 +7,40 @@ export type ApiContainerProps = {
|
|
|
6
7
|
children?: ReactNode;
|
|
7
8
|
query?: string;
|
|
8
9
|
method?: 'get' | 'post' | 'put' | 'delete' | 'patch';
|
|
10
|
+
/** Client-side bearer token. Meant to arrive through a binding (e.g. the signed-in user's token), which resolves
|
|
11
|
+
* at runtime and never enters the schema. A static value typed here is persisted and therefore public — use a
|
|
12
|
+
* server connector (`runtime: 'server'`) for anything secret. */
|
|
9
13
|
accessToken?: string;
|
|
10
14
|
when?: RuleGroup;
|
|
11
15
|
headers?: Record<string, string>;
|
|
12
16
|
mockData?: Record<string, unknown> | string;
|
|
13
17
|
subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure';
|
|
14
18
|
credentials?: RequestCredentials;
|
|
19
|
+
/** Identifier of the server-side connector that feeds this provider. Only meaningful with `runtime: 'server'`. */
|
|
20
|
+
connector?: string;
|
|
21
|
+
/** Which of the connector's read endpoints to execute. Defaults to `list`. */
|
|
22
|
+
endpoint?: string;
|
|
23
|
+
/** Content type / collection read through the connector. */
|
|
24
|
+
resource?: string;
|
|
25
|
+
/** Records per window. Read server-side; a single-record provider is capped at one regardless. */
|
|
26
|
+
limit?: string;
|
|
27
|
+
/** Feeds a detail page: publishes `record` instead of `records`, filtered down to one entry. */
|
|
28
|
+
singleRecord?: boolean;
|
|
29
|
+
/** Field / operator / value rows applied to the connector query. Values are templates resolved server-side, so
|
|
30
|
+
* `{{routeParams.slug}}` is what turns a page into a detail page. */
|
|
31
|
+
filters?: {
|
|
32
|
+
field: string;
|
|
33
|
+
operator: string;
|
|
34
|
+
value: string;
|
|
35
|
+
}[];
|
|
36
|
+
/** `url` pages through the address bar and stays indexable; `append` accumulates in the browser for a "load
|
|
37
|
+
* more" list. Append needs a server-driven provider — a client-side query has no window to ask the server for. */
|
|
38
|
+
pagination?: ProviderPagination;
|
|
39
|
+
pageParam?: string;
|
|
40
|
+
/** Renders children while the first client-side request is still in flight, so a loading state can be bound. */
|
|
41
|
+
renderWhileLoading?: boolean;
|
|
15
42
|
};
|
|
16
|
-
declare const ApiContainer: ({ ref, className, children, query, method, accessToken, when, headers, mockData, subType, credentials }: ApiContainerProps) => import("react").JSX.Element;
|
|
43
|
+
declare const ApiContainer: ({ ref, className, children, query, method, accessToken, when, headers, mockData, subType, credentials, singleRecord, pagination, pageParam, renderWhileLoading }: ApiContainerProps) => import("react").JSX.Element;
|
|
17
44
|
declare const _default: {
|
|
18
45
|
(props: import('../../../Element/hocs/withElement').WithElementProps<ApiContainerProps>): import("react").JSX.Element;
|
|
19
46
|
displayName: string;
|