@soppiya/app-bridge 1.0.9 → 1.1.2
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/components/articles-picker/index.d.ts +1 -0
- package/dist/components/articles-picker/index.js +2 -0
- package/dist/components/articles-picker/ui/ArticlesPicker.js +1 -1
- package/dist/components/blogs-picker/index.d.ts +1 -0
- package/dist/components/blogs-picker/index.js +2 -0
- package/dist/components/blogs-picker/ui/BlogsPicker.js +0 -1
- package/dist/components/collections-pciker/index.d.ts +1 -0
- package/dist/components/collections-pciker/index.js +2 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +6 -0
- package/dist/components/link-list-picker/api/query.d.ts +8 -0
- package/dist/components/link-list-picker/api/query.js +22 -0
- package/dist/components/link-list-picker/index.d.ts +1 -0
- package/dist/components/link-list-picker/index.js +2 -0
- package/dist/components/link-list-picker/model/useLinkList.d.ts +30 -0
- package/dist/components/link-list-picker/model/useLinkList.js +46 -0
- package/dist/components/link-list-picker/ui/LinkListPicker.d.ts +9 -0
- package/dist/components/link-list-picker/ui/LinkListPicker.js +98 -0
- package/dist/components/link-list-picker/ui/LinkListPicker.stories.d.ts +14 -0
- package/dist/components/link-list-picker/ui/LinkListPicker.stories.js +10 -0
- package/dist/components/meta-data/index.d.ts +1 -0
- package/dist/components/meta-data/index.js +2 -0
- package/dist/components/meta-data/ui/ArticleRefMetaField.js +1 -1
- package/dist/components/meta-data/ui/BlogRefMetaField.js +1 -1
- package/dist/components/meta-data/ui/CollectionRefMetaField.js +1 -1
- package/dist/components/meta-data/ui/ColorMetaField.js +8 -8
- package/dist/components/meta-data/ui/MetaData.js +23 -2
- package/dist/components/meta-data/ui/MetaDataItem.js +14 -5
- package/dist/components/meta-data/ui/MetaDataTypePopup.js +17 -9
- package/dist/components/meta-data/ui/PageRefMetaField.d.ts +1 -1
- package/dist/components/meta-data/ui/PageRefMetaField.js +36 -5
- package/dist/components/pages-picker/api/query.d.ts +8 -0
- package/dist/components/pages-picker/api/query.js +22 -0
- package/dist/components/pages-picker/index.d.ts +1 -0
- package/dist/components/pages-picker/index.js +2 -0
- package/dist/components/pages-picker/model/usePages.d.ts +30 -0
- package/dist/components/pages-picker/model/usePages.js +46 -0
- package/dist/components/pages-picker/ui/PagesPicker.d.ts +9 -0
- package/dist/components/pages-picker/ui/PagesPicker.js +104 -0
- package/dist/components/pages-picker/ui/PagesPicker.stories.d.ts +17 -0
- package/dist/components/pages-picker/ui/PagesPicker.stories.js +13 -0
- package/dist/shared/graphql/gql.d.ts +10 -0
- package/dist/shared/graphql/gql.js +3 -1
- package/dist/shared/graphql/graphql.d.ts +69 -0
- package/dist/shared/graphql/graphql.js +872 -224
- package/dist/styles.css +35 -2
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ArticlesPicker } from "./ui/ArticlesPicker";
|
|
@@ -33,7 +33,7 @@ const ArticlesPicker = ({ title, initialIds = [], limit = 1 / 0, onClose, onOk }
|
|
|
33
33
|
});
|
|
34
34
|
return /*#__PURE__*/ jsx(Modal, {
|
|
35
35
|
open: true,
|
|
36
|
-
title: title || "
|
|
36
|
+
title: title || "Articles",
|
|
37
37
|
bodyPadding: 0,
|
|
38
38
|
buttons: ButtonJSX,
|
|
39
39
|
onClose: onClose,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BlogsPicker } from "./ui/BlogsPicker";
|
|
@@ -22,7 +22,6 @@ const BlogsPicker = ({ title, initialIds = [], limit = 1 / 0, onClose, onOk })=>
|
|
|
22
22
|
const handleOk = ()=>{
|
|
23
23
|
if (lodash.isFunction(onOk)) onOk(selectedBlog);
|
|
24
24
|
};
|
|
25
|
-
console.log(selectedBlog);
|
|
26
25
|
const ButtonJSX = /*#__PURE__*/ jsx(InlineStack, {
|
|
27
26
|
justifyContent: "end",
|
|
28
27
|
children: /*#__PURE__*/ jsx(Button, {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CollectionPicker } from "./ui/CollectionPicker";
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
export * from "./articles-picker";
|
|
2
|
+
export * from "./blogs-picker";
|
|
3
|
+
export * from "./collections-pciker";
|
|
4
|
+
export * from "./link-list-picker";
|
|
1
5
|
export * from "./media";
|
|
6
|
+
export * from "./meta-data";
|
|
7
|
+
export * from "./pages-picker";
|
|
2
8
|
export * from "./products-picker";
|
|
3
9
|
export * from "./savebar";
|
|
4
10
|
export * from "./variants-picker";
|
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
export * from "./articles-picker/index.js";
|
|
2
|
+
export * from "./blogs-picker/index.js";
|
|
3
|
+
export * from "./collections-pciker/index.js";
|
|
4
|
+
export * from "./link-list-picker/index.js";
|
|
1
5
|
export * from "./media/index.js";
|
|
6
|
+
export * from "./meta-data/index.js";
|
|
7
|
+
export * from "./pages-picker/index.js";
|
|
2
8
|
export * from "./products-picker/index.js";
|
|
3
9
|
export * from "./savebar/index.js";
|
|
4
10
|
export * from "./variants-picker/index.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const linkListQuery: import("@graphql-typed-document-node/core").TypedDocumentNode<import("../../../shared/graphql/graphql").LinklistsQuery, import("../../../shared/graphql/graphql").Exact<{
|
|
2
|
+
after?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").Scalars["ID"]["input"]>;
|
|
3
|
+
before?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").Scalars["ID"]["input"]>;
|
|
4
|
+
first?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").Scalars["Int"]["input"]>;
|
|
5
|
+
last?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").Scalars["Int"]["input"]>;
|
|
6
|
+
query?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").Scalars["String"]["input"]>;
|
|
7
|
+
filterKeys?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").LinklistFilterKeys>;
|
|
8
|
+
}>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { graphql } from "../../../shared/graphql/index.js";
|
|
2
|
+
const linkListQuery = graphql(`query Linklists($after: ID, $before: ID, $first: Int, $last: Int, $query: String, $filterKeys: LinklistFilterKeys) {
|
|
3
|
+
linklists(after: $after, before: $before, first: $first, last: $last, query: $query, filterKeys: $filterKeys) {
|
|
4
|
+
pageInfo {
|
|
5
|
+
endCursor
|
|
6
|
+
hasNextPage
|
|
7
|
+
hasPreviousPage
|
|
8
|
+
startCursor
|
|
9
|
+
}
|
|
10
|
+
edges {
|
|
11
|
+
node {
|
|
12
|
+
_id
|
|
13
|
+
title
|
|
14
|
+
links {
|
|
15
|
+
url
|
|
16
|
+
_id
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}`);
|
|
22
|
+
export { linkListQuery };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LinkListPicker } from "./ui/LinkListPicker";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LinklistFilterKeys } from "../../../shared/graphql/graphql";
|
|
2
|
+
type Props = {
|
|
3
|
+
skip?: boolean;
|
|
4
|
+
first?: number;
|
|
5
|
+
query?: string | null;
|
|
6
|
+
filterKeys?: LinklistFilterKeys;
|
|
7
|
+
};
|
|
8
|
+
export declare const useLinklist: (props?: Props) => {
|
|
9
|
+
linklists: {
|
|
10
|
+
__typename: "Linklist";
|
|
11
|
+
_id?: string | null;
|
|
12
|
+
title?: string | null;
|
|
13
|
+
links?: Array<{
|
|
14
|
+
__typename: "LinklistLayer1";
|
|
15
|
+
url?: string | null;
|
|
16
|
+
_id?: string | null;
|
|
17
|
+
} | null> | null;
|
|
18
|
+
}[] | undefined;
|
|
19
|
+
pageInfo: {
|
|
20
|
+
__typename: "PageInfo";
|
|
21
|
+
endCursor?: string | null;
|
|
22
|
+
hasNextPage?: boolean | null;
|
|
23
|
+
hasPreviousPage?: boolean | null;
|
|
24
|
+
startCursor?: string | null;
|
|
25
|
+
} | null | undefined;
|
|
26
|
+
isLoadingLinklist: boolean;
|
|
27
|
+
error: import("@apollo/client").ErrorLike | undefined;
|
|
28
|
+
fetchMoreLinklists: () => void;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useQuery } from "@apollo/client/react";
|
|
2
|
+
import { linkListQuery } from "../api/query.js";
|
|
3
|
+
const useLinklist = (props = {})=>{
|
|
4
|
+
const { skip, first, query, filterKeys } = props;
|
|
5
|
+
const { data, loading: isLoadingLinklist, error, fetchMore } = useQuery(linkListQuery, {
|
|
6
|
+
skip,
|
|
7
|
+
variables: {
|
|
8
|
+
first,
|
|
9
|
+
query,
|
|
10
|
+
filterKeys
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const linklists = data?.linklists?.edges?.map((edge)=>edge?.node).filter((node)=>null != node);
|
|
14
|
+
const pageInfo = data?.linklists?.pageInfo;
|
|
15
|
+
const fetchMoreLinklists = ()=>{
|
|
16
|
+
if (!pageInfo?.hasNextPage) return;
|
|
17
|
+
fetchMore({
|
|
18
|
+
variables: {
|
|
19
|
+
first,
|
|
20
|
+
query,
|
|
21
|
+
filterKeys,
|
|
22
|
+
after: pageInfo.endCursor
|
|
23
|
+
},
|
|
24
|
+
updateQuery (prev, { fetchMoreResult }) {
|
|
25
|
+
if (!fetchMoreResult.linklists?.edges || !prev.linklists?.edges) return prev;
|
|
26
|
+
return {
|
|
27
|
+
linklists: {
|
|
28
|
+
...fetchMoreResult.linklists,
|
|
29
|
+
edges: [
|
|
30
|
+
...prev.linklists.edges,
|
|
31
|
+
...fetchMoreResult.linklists.edges
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
linklists,
|
|
40
|
+
pageInfo,
|
|
41
|
+
isLoadingLinklist,
|
|
42
|
+
error,
|
|
43
|
+
fetchMoreLinklists
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export { useLinklist };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
title?: string;
|
|
3
|
+
initialIds?: string[];
|
|
4
|
+
limit?: number;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
onOk?: (linklist: string[]) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const LinkListPicker: ({ title, initialIds, limit, onClose, onOk }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default LinkListPicker;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { InfinityScroll } from "../../infinity-scroll/index.js";
|
|
3
|
+
import { useFilterQuery } from "../../../shared/lib/index.js";
|
|
4
|
+
import { BlockStack, Box, Button, Checkbox, InlineStack, Input, Modal, Spinner, Text } from "@soppiya/elementus";
|
|
5
|
+
import lodash from "lodash";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { useLinklist } from "../model/useLinkList.js";
|
|
8
|
+
const LinkListPicker_LinkListPicker = ({ title, initialIds = [], limit = 1 / 0, onClose, onOk })=>{
|
|
9
|
+
const [selectedLinklist, setSelectedLinklist] = useState(initialIds);
|
|
10
|
+
const { query, debounceQuery, onChangeQuery } = useFilterQuery();
|
|
11
|
+
const { linklists, isLoadingLinklist, fetchMoreLinklists, pageInfo } = useLinklist({
|
|
12
|
+
first: 20,
|
|
13
|
+
query: debounceQuery
|
|
14
|
+
});
|
|
15
|
+
const isSelected = limit === 1 / 0 ? true : 1 === limit ? 1 === selectedLinklist.length : selectedLinklist.length >= limit;
|
|
16
|
+
const handleSelectedLinklist = (linkListId)=>{
|
|
17
|
+
selectedLinklist.includes(linkListId) ? setSelectedLinklist((prev)=>prev.filter((id)=>id !== linkListId)) : setSelectedLinklist((prev)=>[
|
|
18
|
+
...prev,
|
|
19
|
+
linkListId
|
|
20
|
+
]);
|
|
21
|
+
};
|
|
22
|
+
const handleOk = ()=>{
|
|
23
|
+
if (lodash.isFunction(onOk)) onOk(selectedLinklist);
|
|
24
|
+
};
|
|
25
|
+
const ButtonJSX = /*#__PURE__*/ jsx(InlineStack, {
|
|
26
|
+
justifyContent: "end",
|
|
27
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
28
|
+
disabled: lodash.isEmpty(selectedLinklist) || !isSelected,
|
|
29
|
+
onClick: handleOk,
|
|
30
|
+
children: "Add"
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
return /*#__PURE__*/ jsx(Modal, {
|
|
34
|
+
open: true,
|
|
35
|
+
title: title || "Linklist",
|
|
36
|
+
bodyPadding: 0,
|
|
37
|
+
buttons: ButtonJSX,
|
|
38
|
+
onClose: onClose,
|
|
39
|
+
children: /*#__PURE__*/ jsxs(BlockStack, {
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ jsx(Box, {
|
|
42
|
+
className: "border-b border-b-[#ebebeb]! h",
|
|
43
|
+
padding: 60,
|
|
44
|
+
children: /*#__PURE__*/ jsx(Input, {
|
|
45
|
+
size: "sm",
|
|
46
|
+
type: "search",
|
|
47
|
+
value: query ?? "",
|
|
48
|
+
onChange: (event)=>onChangeQuery(event.target.value)
|
|
49
|
+
})
|
|
50
|
+
}),
|
|
51
|
+
isLoadingLinklist ? /*#__PURE__*/ jsx(InlineStack, {
|
|
52
|
+
justifyContent: "center",
|
|
53
|
+
padding: 80,
|
|
54
|
+
children: /*#__PURE__*/ jsx(Spinner, {
|
|
55
|
+
size: "md"
|
|
56
|
+
})
|
|
57
|
+
}) : /*#__PURE__*/ jsxs(BlockStack, {
|
|
58
|
+
children: [
|
|
59
|
+
linklists?.map((linklist)=>/*#__PURE__*/ jsxs(InlineStack, {
|
|
60
|
+
stack: "full",
|
|
61
|
+
className: "lg:cursor-pointer border-b border-b-[#ebebeb]!",
|
|
62
|
+
gapX: 60,
|
|
63
|
+
padding: 60,
|
|
64
|
+
onClick: ()=>handleSelectedLinklist(String(linklist._id)),
|
|
65
|
+
children: [
|
|
66
|
+
/*#__PURE__*/ jsx(InlineStack, {
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
gapX: 60,
|
|
69
|
+
children: /*#__PURE__*/ jsx(Box, {
|
|
70
|
+
children: /*#__PURE__*/ jsx(Checkbox, {
|
|
71
|
+
checked: selectedLinklist.includes(String(linklist._id)),
|
|
72
|
+
onChange: ()=>{}
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
}),
|
|
76
|
+
/*#__PURE__*/ jsx(BlockStack, {
|
|
77
|
+
gapY: 30,
|
|
78
|
+
justifyContent: "center",
|
|
79
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
80
|
+
size: "sm",
|
|
81
|
+
color: "secondary",
|
|
82
|
+
truncate: "truncate-1",
|
|
83
|
+
children: linklist.title
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
}, linklist._id)),
|
|
88
|
+
pageInfo?.hasNextPage && /*#__PURE__*/ jsx(InfinityScroll, {
|
|
89
|
+
onFetch: fetchMoreLinklists
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
const LinkListPicker = LinkListPicker_LinkListPicker;
|
|
98
|
+
export { LinkListPicker as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const meta: {
|
|
2
|
+
title: string;
|
|
3
|
+
component: ({ title, initialIds, limit, onClose, onOk }: {
|
|
4
|
+
title?: string;
|
|
5
|
+
initialIds?: string[];
|
|
6
|
+
limit?: number;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
onOk?: (linklist: string[]) => void;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export declare const Default: {
|
|
13
|
+
args: {};
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import LinkListPicker from "./LinkListPicker.js";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: "Example/LinkListPicker",
|
|
4
|
+
component: LinkListPicker
|
|
5
|
+
};
|
|
6
|
+
const LinkListPicker_stories = meta;
|
|
7
|
+
const Default = {
|
|
8
|
+
args: {}
|
|
9
|
+
};
|
|
10
|
+
export { Default, LinkListPicker_stories as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MetaData } from "./ui/MetaData";
|
|
@@ -6,7 +6,7 @@ const ArticleRefMetaField = ({ value, children })=>{
|
|
|
6
6
|
const { articles, isLoadingArticles } = userArticles({
|
|
7
7
|
skip: !value,
|
|
8
8
|
filterKeys: {
|
|
9
|
-
cursors: value?.split(",
|
|
9
|
+
cursors: value?.split(",")
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
if (isLoadingArticles) return /*#__PURE__*/ jsx(Loading, {});
|
|
@@ -6,7 +6,7 @@ const BlogRefMetaField_BlogRefMetaField = ({ value, children })=>{
|
|
|
6
6
|
const { blogs, isLoadingBlogs } = useBlogs({
|
|
7
7
|
skip: !value,
|
|
8
8
|
filterKeys: {
|
|
9
|
-
cursors: value?.split(",
|
|
9
|
+
cursors: value?.split(",")
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
if (isLoadingBlogs) return /*#__PURE__*/ jsx(Loading, {});
|
|
@@ -5,7 +5,7 @@ import { Image, InlineStack, Text } from "@soppiya/elementus";
|
|
|
5
5
|
const CollectionRefMetaField_CollectionRefMetaField = ({ value, children })=>{
|
|
6
6
|
const { collections, isLoadingCollections } = useCollections({
|
|
7
7
|
filterKeys: {
|
|
8
|
-
cursors: value?.split(",
|
|
8
|
+
cursors: value?.split(",")
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
if (isLoadingCollections) return /*#__PURE__*/ jsx(Loading, {});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
import { InlineStack } from "@soppiya/elementus";
|
|
3
|
+
const ColorMetaField = ({ entry, value, children, onChange })=>/*#__PURE__*/ jsxs(InlineStack, {
|
|
4
|
+
justifyContent: "space-between",
|
|
3
5
|
children: [
|
|
4
|
-
/*#__PURE__*/ jsx(
|
|
5
|
-
children: /*#__PURE__*/ jsx("
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
onChange: (e)=>onChange(e.target.value)
|
|
10
|
-
})
|
|
6
|
+
/*#__PURE__*/ jsx(InlineStack, {
|
|
7
|
+
children: /*#__PURE__*/ jsx("input", {
|
|
8
|
+
type: "color",
|
|
9
|
+
value: value,
|
|
10
|
+
onChange: (e)=>onChange(e.target.value)
|
|
11
11
|
})
|
|
12
12
|
}),
|
|
13
13
|
"multiple" === entry && children
|
|
@@ -18,8 +18,29 @@ const MetaData_MetaData = ({ scope = "product", value = [], onChange })=>{
|
|
|
18
18
|
const metaField = value.find((item)=>item.metafield === _id);
|
|
19
19
|
return metaField?.value;
|
|
20
20
|
};
|
|
21
|
-
if (0 === metafields.length) return /*#__PURE__*/
|
|
22
|
-
children:
|
|
21
|
+
if (0 === metafields.length) return /*#__PURE__*/ jsxs(Card, {
|
|
22
|
+
children: [
|
|
23
|
+
/*#__PURE__*/ jsx(BlockStack, {
|
|
24
|
+
padding: 70,
|
|
25
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
26
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
27
|
+
size: "md",
|
|
28
|
+
weight: "semibold",
|
|
29
|
+
children: "Meta fields"
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
}),
|
|
33
|
+
/*#__PURE__*/ jsx(BlockStack, {
|
|
34
|
+
className: "border-t border-t-[#ebebeb]",
|
|
35
|
+
padding: 70,
|
|
36
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
37
|
+
size: "md",
|
|
38
|
+
weight: "medium",
|
|
39
|
+
alignment: "center",
|
|
40
|
+
children: "Empty"
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
]
|
|
23
44
|
});
|
|
24
45
|
return /*#__PURE__*/ jsxs(Card, {
|
|
25
46
|
children: [
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Button, Card, InlineStack, SoppiyaIcon, Text } from "@soppiya/elementus";
|
|
3
3
|
import ArticlesPicker from "../../articles-picker/ui/ArticlesPicker.js";
|
|
4
4
|
import BlogsPicker from "../../blogs-picker/ui/BlogsPicker.js";
|
|
5
5
|
import CollectionPicker from "../../collections-pciker/ui/CollectionPicker.js";
|
|
6
|
+
import PagesPicker from "../../pages-picker/ui/PagesPicker.js";
|
|
6
7
|
import { ProductsPicker } from "../../products-picker/index.js";
|
|
7
8
|
import { VariantsPicker } from "../../variants-picker/index.js";
|
|
8
9
|
import { useClickAway } from "@uidotdev/usehooks";
|
|
@@ -180,13 +181,14 @@ const MetaDataItem_MetaDataItem = ({ metaField, value = [], onChange })=>{
|
|
|
180
181
|
children: MetaFieldJSX && ("multiple" !== metaField.entry || isRefType ? /*#__PURE__*/ jsx(MetaFieldJSX, {
|
|
181
182
|
value: isRefType ? value.join(",") : value[0],
|
|
182
183
|
onChange: (v)=>handleChange(v),
|
|
183
|
-
children: /*#__PURE__*/ jsx(
|
|
184
|
+
children: /*#__PURE__*/ jsx(InlineStack, {
|
|
185
|
+
alignItems: "center",
|
|
184
186
|
children: /*#__PURE__*/ jsx(Button, {
|
|
185
187
|
color: "white",
|
|
186
188
|
onClick: ()=>handleDeleteMetaField(0),
|
|
187
189
|
children: /*#__PURE__*/ jsx(SoppiyaIcon, {
|
|
188
190
|
icon: "minus.svg",
|
|
189
|
-
size: "
|
|
191
|
+
size: "xs"
|
|
190
192
|
})
|
|
191
193
|
})
|
|
192
194
|
})
|
|
@@ -195,13 +197,14 @@ const MetaDataItem_MetaDataItem = ({ metaField, value = [], onChange })=>{
|
|
|
195
197
|
] : value).map((v, key)=>/*#__PURE__*/ jsx(MetaFieldJSX, {
|
|
196
198
|
entry: metaField.entry,
|
|
197
199
|
onChange: (v)=>handleChange(v, key),
|
|
198
|
-
children: /*#__PURE__*/ jsx(
|
|
200
|
+
children: /*#__PURE__*/ jsx(InlineStack, {
|
|
201
|
+
alignItems: "center",
|
|
199
202
|
children: /*#__PURE__*/ jsx(Button, {
|
|
200
203
|
color: "white",
|
|
201
204
|
onClick: ()=>handleDeleteMetaField(key),
|
|
202
205
|
children: /*#__PURE__*/ jsx(SoppiyaIcon, {
|
|
203
206
|
icon: "minus.svg",
|
|
204
|
-
size: "
|
|
207
|
+
size: "sm"
|
|
205
208
|
})
|
|
206
209
|
})
|
|
207
210
|
})
|
|
@@ -239,6 +242,12 @@ const MetaDataItem_MetaDataItem = ({ metaField, value = [], onChange })=>{
|
|
|
239
242
|
limit: "multiple" === metaField.entry ? 1 / 0 : 1,
|
|
240
243
|
onClose: ()=>setVisibleExplorer(""),
|
|
241
244
|
onOk: handleSelectExplorerItems
|
|
245
|
+
}),
|
|
246
|
+
"page" === visibleExplorer && /*#__PURE__*/ jsx(PagesPicker, {
|
|
247
|
+
initialIds: value,
|
|
248
|
+
limit: "multiple" === metaField.entry ? 1 / 0 : 1,
|
|
249
|
+
onClose: ()=>setVisibleExplorer(""),
|
|
250
|
+
onOk: handleSelectExplorerItems
|
|
242
251
|
})
|
|
243
252
|
]
|
|
244
253
|
});
|
|
@@ -7,6 +7,11 @@ const MetaFieldTypePopup = ({ isMultiple, name, type, children, onAdd, onClear }
|
|
|
7
7
|
const textCapitalize = (value)=>value.split("_").map((w)=>w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
8
8
|
return /*#__PURE__*/ jsx(react.Fragment, {
|
|
9
9
|
children: /*#__PURE__*/ jsxs(InlineStack, {
|
|
10
|
+
flexDirection: {
|
|
11
|
+
xs: "col",
|
|
12
|
+
md: "row"
|
|
13
|
+
},
|
|
14
|
+
gap: 70,
|
|
10
15
|
children: [
|
|
11
16
|
/*#__PURE__*/ jsxs(BlockStack, {
|
|
12
17
|
className: "w-[170px]!",
|
|
@@ -24,12 +29,22 @@ const MetaFieldTypePopup = ({ isMultiple, name, type, children, onAdd, onClear }
|
|
|
24
29
|
]
|
|
25
30
|
}),
|
|
26
31
|
/*#__PURE__*/ jsxs(BlockStack, {
|
|
27
|
-
className: "grow",
|
|
32
|
+
className: "grow md:flex-col-reverse!",
|
|
28
33
|
children: [
|
|
34
|
+
/*#__PURE__*/ jsx(BlockStack, {
|
|
35
|
+
gap: 50,
|
|
36
|
+
padding: {
|
|
37
|
+
top: {
|
|
38
|
+
md: children ? 70 : 0
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
className: "border-b border-b-[#ebebeb] md:border-b-transparent pb-4 md:pb-0 ",
|
|
42
|
+
children: children
|
|
43
|
+
}),
|
|
29
44
|
isMultiple && /*#__PURE__*/ jsx(BlockStack, {
|
|
30
45
|
children: /*#__PURE__*/ jsxs(InlineStack, {
|
|
31
46
|
justifyContent: "space-between",
|
|
32
|
-
className: "border-b border-b-[#ebebeb] pb-
|
|
47
|
+
className: "md:border-b md:border-b-[#ebebeb] mt-4 md:mt-0 md:pb-3",
|
|
33
48
|
children: [
|
|
34
49
|
/*#__PURE__*/ jsx(Button, {
|
|
35
50
|
color: "white",
|
|
@@ -44,13 +59,6 @@ const MetaFieldTypePopup = ({ isMultiple, name, type, children, onAdd, onClear }
|
|
|
44
59
|
})
|
|
45
60
|
]
|
|
46
61
|
})
|
|
47
|
-
}),
|
|
48
|
-
/*#__PURE__*/ jsx(BlockStack, {
|
|
49
|
-
gap: 50,
|
|
50
|
-
padding: {
|
|
51
|
-
top: 70
|
|
52
|
-
},
|
|
53
|
-
children: children
|
|
54
62
|
})
|
|
55
63
|
]
|
|
56
64
|
})
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MetaDataProps } from "./MetaDataItem";
|
|
2
|
-
declare const PageRefMetaField: ({ value, children }: MetaDataProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const PageRefMetaField: ({ value, children }: MetaDataProps) => import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[] | undefined;
|
|
3
3
|
export default PageRefMetaField;
|
|
@@ -1,6 +1,37 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { usePages } from "../../pages-picker/model/usePages.js";
|
|
3
|
+
import { Loading } from "../../../shared/loading/index.js";
|
|
4
|
+
import { Image, InlineStack, Text } from "@soppiya/elementus";
|
|
5
|
+
const PageRefMetaField_PageRefMetaField = ({ value, children })=>{
|
|
6
|
+
const { pages, isLoadingPages } = usePages({
|
|
7
|
+
skip: !value,
|
|
8
|
+
filterKeys: {
|
|
9
|
+
cursors: value?.split(",")
|
|
10
|
+
}
|
|
4
11
|
});
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
if (isLoadingPages) return /*#__PURE__*/ jsx(Loading, {});
|
|
13
|
+
return pages?.map((page)=>/*#__PURE__*/ jsxs(InlineStack, {
|
|
14
|
+
justifyContent: "space-between",
|
|
15
|
+
children: [
|
|
16
|
+
/*#__PURE__*/ jsxs(InlineStack, {
|
|
17
|
+
gapX: 70,
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ jsx(Image, {
|
|
21
|
+
size: "xs",
|
|
22
|
+
url: page.image?.url ?? ""
|
|
23
|
+
}),
|
|
24
|
+
/*#__PURE__*/ jsx(Text, {
|
|
25
|
+
size: "md",
|
|
26
|
+
weight: "regular",
|
|
27
|
+
color: "blue",
|
|
28
|
+
children: page.title
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
}),
|
|
32
|
+
children
|
|
33
|
+
]
|
|
34
|
+
}, page._id));
|
|
35
|
+
};
|
|
36
|
+
const PageRefMetaField = PageRefMetaField_PageRefMetaField;
|
|
37
|
+
export { PageRefMetaField as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const pagesQuery: import("@graphql-typed-document-node/core").TypedDocumentNode<import("../../../shared/graphql/graphql").PagesQuery, import("../../../shared/graphql/graphql").Exact<{
|
|
2
|
+
filterKeys?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").PageFilterKeys>;
|
|
3
|
+
after?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").Scalars["ID"]["input"]>;
|
|
4
|
+
before?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").Scalars["ID"]["input"]>;
|
|
5
|
+
first?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").Scalars["Int"]["input"]>;
|
|
6
|
+
last?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").Scalars["Int"]["input"]>;
|
|
7
|
+
query?: import("../../../shared/graphql/graphql").InputMaybe<import("../../../shared/graphql/graphql").Scalars["String"]["input"]>;
|
|
8
|
+
}>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { graphql } from "../../../shared/graphql/index.js";
|
|
2
|
+
const pagesQuery = graphql(`query Pages($filterKeys: PageFilterKeys, $after: ID, $before: ID, $first: Int, $last: Int, $query: String) {
|
|
3
|
+
pages(filterKeys: $filterKeys, after: $after, before: $before, first: $first, last: $last, query: $query) {
|
|
4
|
+
pageInfo {
|
|
5
|
+
endCursor
|
|
6
|
+
hasNextPage
|
|
7
|
+
hasPreviousPage
|
|
8
|
+
startCursor
|
|
9
|
+
}
|
|
10
|
+
edges {
|
|
11
|
+
node {
|
|
12
|
+
_id
|
|
13
|
+
title
|
|
14
|
+
image {
|
|
15
|
+
_id
|
|
16
|
+
url
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}`);
|
|
22
|
+
export { pagesQuery };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PagesPicker } from "./ui/PagesPicker";
|