@blocklet/discuss-kit-ux 1.6.154 → 1.6.157
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/button-group/button-group.d.ts +16 -0
- package/dist/components/button-group/index.d.ts +1 -0
- package/dist/{editor-RcBS7Z7c.mjs → editor-DQIO9RKL.mjs} +2 -1
- package/dist/{index-jj8c8x1n.mjs → index-bzFgbBTK.mjs} +162 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +6 -4
- package/dist/index.umd.js +158 -2
- package/package.json +4 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface ButtonItem {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
icon: string;
|
|
5
|
+
}
|
|
6
|
+
interface Props {
|
|
7
|
+
data: ButtonItem[];
|
|
8
|
+
theme: string;
|
|
9
|
+
selected: string[];
|
|
10
|
+
urlName: string;
|
|
11
|
+
defaultButton: ButtonItem;
|
|
12
|
+
onSelectTab: (selectTab: string[]) => void;
|
|
13
|
+
type: string;
|
|
14
|
+
}
|
|
15
|
+
export default function ButtonGroup({ data, theme, selected, urlName, defaultButton, onSelectTab, type, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ButtonGroup } from './button-group';
|
|
@@ -4,7 +4,7 @@ import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangeP
|
|
|
4
4
|
import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
|
|
5
5
|
import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
|
|
6
6
|
import { lazy } from "react";
|
|
7
|
-
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-
|
|
7
|
+
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-bzFgbBTK.mjs";
|
|
8
8
|
import "@blocklet/labels";
|
|
9
9
|
import "@mui/material/styles";
|
|
10
10
|
import "@mui/material/Box";
|
|
@@ -68,6 +68,7 @@ import "@mui/material/Pagination";
|
|
|
68
68
|
import "unstated-next";
|
|
69
69
|
import "js-cookie";
|
|
70
70
|
import "@arcblock/ws";
|
|
71
|
+
import "@emotion/css";
|
|
71
72
|
const BlockletEditor = lazy(() => import("@blocklet/editor"));
|
|
72
73
|
const Root = styled(Box)`
|
|
73
74
|
.be-editable,
|
|
@@ -21,7 +21,7 @@ import { ImageNode } from "@blocklet/editor/lib/main/nodes/ImageNode";
|
|
|
21
21
|
import { VideoNode } from "@blocklet/editor/lib/ext/VideoPlugin/VideoNode";
|
|
22
22
|
import { useSize, useInViewport, useSetState, useGetState, useReactive } from "ahooks";
|
|
23
23
|
import LoadingButton from "@mui/lab/LoadingButton";
|
|
24
|
-
import { Send, Save, ChatBubbleOutlineOutlined, MoreVert, AddReactionOutlined, NavigateNext, DeleteOutlineOutlined, ContentCopy, ArrowUpward, ArrowDownward, ArrowBackIos, Add } from "@mui/icons-material";
|
|
24
|
+
import { Send, Save, ChatBubbleOutlineOutlined, MoreVert, AddReactionOutlined, NavigateNext, DeleteOutlineOutlined, ContentCopy, ArrowUpward, ArrowDownward, ArrowBackIos, Add, BorderColorOutlined } from "@mui/icons-material";
|
|
25
25
|
import { LocaleContext, useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
26
26
|
import Alert from "@mui/material/Alert";
|
|
27
27
|
import isBoolean from "lodash/isBoolean";
|
|
@@ -71,6 +71,7 @@ import MuiPagination from "@mui/material/Pagination";
|
|
|
71
71
|
import { createContainer } from "unstated-next";
|
|
72
72
|
import Cookie from "js-cookie";
|
|
73
73
|
import { WsClient } from "@arcblock/ws";
|
|
74
|
+
import { css } from "@emotion/css";
|
|
74
75
|
const themeOverrides = {
|
|
75
76
|
components: {
|
|
76
77
|
MuiButton: {
|
|
@@ -4562,7 +4563,7 @@ function Pagination({ page, size = 20, total, onChange, routerMode = true, ...re
|
|
|
4562
4563
|
}
|
|
4563
4564
|
);
|
|
4564
4565
|
}
|
|
4565
|
-
const Editor = lazy(() => import("./editor-
|
|
4566
|
+
const Editor = lazy(() => import("./editor-DQIO9RKL.mjs"));
|
|
4566
4567
|
function LazyEditor(props) {
|
|
4567
4568
|
const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4568
4569
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -10421,6 +10422,161 @@ function PointUpProvider({ children }) {
|
|
|
10421
10422
|
children
|
|
10422
10423
|
] });
|
|
10423
10424
|
}
|
|
10425
|
+
function ButtonGroup({
|
|
10426
|
+
data,
|
|
10427
|
+
theme = "dark",
|
|
10428
|
+
selected,
|
|
10429
|
+
urlName,
|
|
10430
|
+
defaultButton,
|
|
10431
|
+
onSelectTab,
|
|
10432
|
+
type,
|
|
10433
|
+
...rest
|
|
10434
|
+
}) {
|
|
10435
|
+
const downSm = useMediaQuery$1((mainTheme) => mainTheme.breakpoints.down("sm"));
|
|
10436
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
10437
|
+
const selectedString = searchParams.get(urlName);
|
|
10438
|
+
const dataWithDefault = defaultButton ? [defaultButton, ...data] : data;
|
|
10439
|
+
const selectedArray = selectedString !== null && selectedString !== "" ? selectedString.split(",") : dataWithDefault.map((item) => item.id);
|
|
10440
|
+
const [selectTab, setSelectTab] = useState(selectedArray);
|
|
10441
|
+
const [selectAll, setSelectAll] = useState(false);
|
|
10442
|
+
const updateUrl = (url, newSelectTab) => {
|
|
10443
|
+
setSearchParams({
|
|
10444
|
+
...searchParams,
|
|
10445
|
+
[url]: newSelectTab.join(",")
|
|
10446
|
+
});
|
|
10447
|
+
};
|
|
10448
|
+
const handleClick = (item) => {
|
|
10449
|
+
setSelectTab([item.id]);
|
|
10450
|
+
updateUrl(urlName, [item.id]);
|
|
10451
|
+
};
|
|
10452
|
+
const handleSelectAll = () => {
|
|
10453
|
+
setSelectAll((prevSelectAll) => {
|
|
10454
|
+
const newSelectAll = !prevSelectAll;
|
|
10455
|
+
const newSelectTab = newSelectAll ? dataWithDefault == null ? void 0 : dataWithDefault.map((item) => item.id) : [];
|
|
10456
|
+
setSelectTab(newSelectTab);
|
|
10457
|
+
updateUrl(urlName, newSelectTab);
|
|
10458
|
+
return newSelectAll;
|
|
10459
|
+
});
|
|
10460
|
+
};
|
|
10461
|
+
useEffect(() => {
|
|
10462
|
+
if (JSON.stringify(selectedArray) !== JSON.stringify(selectTab)) {
|
|
10463
|
+
setSelectTab((selectedArray == null ? void 0 : selectedArray.length) > 0 ? selectedArray : []);
|
|
10464
|
+
}
|
|
10465
|
+
}, [data]);
|
|
10466
|
+
useEffect(() => {
|
|
10467
|
+
if (selectedString === null || selectedString === "") {
|
|
10468
|
+
setSelectAll(true);
|
|
10469
|
+
} else if ((selectTab == null ? void 0 : selectTab.length) === (dataWithDefault == null ? void 0 : dataWithDefault.length)) {
|
|
10470
|
+
setSelectAll(true);
|
|
10471
|
+
} else {
|
|
10472
|
+
setSelectAll(false);
|
|
10473
|
+
}
|
|
10474
|
+
if (onSelectTab)
|
|
10475
|
+
onSelectTab(selectTab);
|
|
10476
|
+
}, [selectTab, selectedArray]);
|
|
10477
|
+
return /* @__PURE__ */ jsxs(Box$1, { className: Group, children: [
|
|
10478
|
+
/* @__PURE__ */ jsxs(
|
|
10479
|
+
Box$1,
|
|
10480
|
+
{
|
|
10481
|
+
sx: {
|
|
10482
|
+
bgcolor: theme === "dark" ? "#F9FAFB" : "",
|
|
10483
|
+
width: "fit-content",
|
|
10484
|
+
maxWidth: "calc(100% - 16px)",
|
|
10485
|
+
borderRadius: "99999px",
|
|
10486
|
+
borderTopRightRadius: downSm ? 0 : "99999px",
|
|
10487
|
+
borderBottomRightRadius: downSm ? 0 : "99999px",
|
|
10488
|
+
overflow: "scroll",
|
|
10489
|
+
whiteSpace: "nowrap"
|
|
10490
|
+
},
|
|
10491
|
+
children: [
|
|
10492
|
+
/* @__PURE__ */ jsx(
|
|
10493
|
+
Button$1,
|
|
10494
|
+
{
|
|
10495
|
+
onClick: handleSelectAll,
|
|
10496
|
+
sx: {
|
|
10497
|
+
backgroundColor: selectAll ? "#ffffff" : "",
|
|
10498
|
+
color: selectAll ? "#030712" : "#4b5563",
|
|
10499
|
+
border: selectAll ? "1px solid #e5e7eb!important" : "1px solid transparent"
|
|
10500
|
+
},
|
|
10501
|
+
...rest,
|
|
10502
|
+
children: "All"
|
|
10503
|
+
}
|
|
10504
|
+
),
|
|
10505
|
+
dataWithDefault == null ? void 0 : dataWithDefault.map((item, index) => {
|
|
10506
|
+
const isActive = !selectAll && (selectTab == null ? void 0 : selectTab.includes(item.id));
|
|
10507
|
+
return /* @__PURE__ */ jsx(
|
|
10508
|
+
Button$1,
|
|
10509
|
+
{
|
|
10510
|
+
onClick: () => handleClick(item),
|
|
10511
|
+
sx: {
|
|
10512
|
+
...isActive && {
|
|
10513
|
+
backgroundColor: "#ffffff",
|
|
10514
|
+
color: "#030712",
|
|
10515
|
+
border: "1px solid #e5e7eb!important"
|
|
10516
|
+
}
|
|
10517
|
+
},
|
|
10518
|
+
...rest,
|
|
10519
|
+
children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
10520
|
+
item == null ? void 0 : item.icon,
|
|
10521
|
+
" ",
|
|
10522
|
+
item == null ? void 0 : item.title
|
|
10523
|
+
] })
|
|
10524
|
+
},
|
|
10525
|
+
index
|
|
10526
|
+
);
|
|
10527
|
+
})
|
|
10528
|
+
]
|
|
10529
|
+
}
|
|
10530
|
+
),
|
|
10531
|
+
urlName !== "type" && /* @__PURE__ */ jsx(AccessControl, { roles: ["admin", "owner"], children: /* @__PURE__ */ jsx(
|
|
10532
|
+
IconButton$1,
|
|
10533
|
+
{
|
|
10534
|
+
component: Link,
|
|
10535
|
+
color: "inherit",
|
|
10536
|
+
size: "small",
|
|
10537
|
+
to: `/discussions/boards?type=${type}`,
|
|
10538
|
+
sx: { color: "grey.500" },
|
|
10539
|
+
children: /* @__PURE__ */ jsx(BorderColorOutlined, { sx: { fontSize: 16 } })
|
|
10540
|
+
}
|
|
10541
|
+
) })
|
|
10542
|
+
] });
|
|
10543
|
+
}
|
|
10544
|
+
const Group = css`
|
|
10545
|
+
display: flex;
|
|
10546
|
+
flex-direction: row;
|
|
10547
|
+
.MuiButtonBase-root {
|
|
10548
|
+
border-radius: 9999px;
|
|
10549
|
+
color: #4b5563;
|
|
10550
|
+
margin: 5px 8px 5px 5px;
|
|
10551
|
+
padding: 5px 12px;
|
|
10552
|
+
line-height: 22px;
|
|
10553
|
+
font-size: 13px;
|
|
10554
|
+
border: 1px solid transparent;
|
|
10555
|
+
}
|
|
10556
|
+
|
|
10557
|
+
.MuiButtonBase-root:last-of-type {
|
|
10558
|
+
margin-right: 0;
|
|
10559
|
+
}
|
|
10560
|
+
|
|
10561
|
+
.MuiButtonBase-root:first-of-type {
|
|
10562
|
+
margin-left: 0;
|
|
10563
|
+
}
|
|
10564
|
+
|
|
10565
|
+
.MuiButtonBase-root:hover {
|
|
10566
|
+
background-color: #ffffff;
|
|
10567
|
+
color: #030712;
|
|
10568
|
+
border: 1px solid #e5e7eb;
|
|
10569
|
+
}
|
|
10570
|
+
|
|
10571
|
+
* {
|
|
10572
|
+
scrollbar-width: none; /* Firefox */
|
|
10573
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
10574
|
+
}
|
|
10575
|
+
|
|
10576
|
+
*::-webkit-scrollbar {
|
|
10577
|
+
display: none; /* Chrome, Safari and Opera */
|
|
10578
|
+
}
|
|
10579
|
+
`;
|
|
10424
10580
|
export {
|
|
10425
10581
|
UnreadNotificationProvider as $,
|
|
10426
10582
|
Avatar as A,
|
|
@@ -10471,9 +10627,10 @@ export {
|
|
|
10471
10627
|
composeImageUrl as ah,
|
|
10472
10628
|
usePointUpContext as ai,
|
|
10473
10629
|
PointUpProvider as aj,
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10630
|
+
ButtonGroup as ak,
|
|
10631
|
+
create as al,
|
|
10632
|
+
getWsClient as am,
|
|
10633
|
+
useSubscription as an,
|
|
10477
10634
|
InternalThemeProvider as b,
|
|
10478
10635
|
Input as c,
|
|
10479
10636
|
translations as d,
|
package/dist/index.d.ts
CHANGED
|
@@ -24,5 +24,6 @@ export * as routes from './components/routes';
|
|
|
24
24
|
export { default as preferences } from './preferences';
|
|
25
25
|
export * from './components/uploader';
|
|
26
26
|
export * from './components/point-up';
|
|
27
|
+
export * from './components/button-group';
|
|
27
28
|
export * from './ws';
|
|
28
29
|
export { default as RelativeTime } from './components/shared/relative-time';
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import { N, j, Q, A, h, a8, B, y, F, z, H, U, T, W, Y, o, C, q, v, x, a0, a1, ac, a3, K, L, D, ab, aa, E, G, c, b, a9, M, P, aj, n, m, a7, R, S, a4, k, Z, $, ad, ag, af, ah,
|
|
2
|
+
import { N, j, Q, A, h, a8, B, y, F, z, H, ak, U, T, W, Y, o, C, q, v, x, a0, a1, ac, a3, K, L, D, ab, aa, E, G, c, b, a9, M, P, aj, n, m, a7, R, S, a4, k, Z, $, ad, ag, af, ah, al, J, am, l, p, r, t, d, a5, O, e, X, w, a2, a6, u, ai, an, _, ae, f } from "./index-bzFgbBTK.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
|
@@ -65,6 +65,7 @@ import "@mui/material/Pagination";
|
|
|
65
65
|
import "unstated-next";
|
|
66
66
|
import "js-cookie";
|
|
67
67
|
import "@arcblock/ws";
|
|
68
|
+
import "@emotion/css";
|
|
68
69
|
export {
|
|
69
70
|
N as AccessControl,
|
|
70
71
|
j as AuthorInfo,
|
|
@@ -77,6 +78,7 @@ export {
|
|
|
77
78
|
F as BlogCard,
|
|
78
79
|
z as BlogList,
|
|
79
80
|
H as BlogPermaLink,
|
|
81
|
+
ak as ButtonGroup,
|
|
80
82
|
U as Chat,
|
|
81
83
|
T as ChatClient,
|
|
82
84
|
W as ChatHeaderAddon,
|
|
@@ -116,9 +118,9 @@ export {
|
|
|
116
118
|
ag as UploaderProvider,
|
|
117
119
|
af as UploaderTrigger,
|
|
118
120
|
ah as composeImageUrl,
|
|
119
|
-
|
|
121
|
+
al as create,
|
|
120
122
|
J as getBlogLink,
|
|
121
|
-
|
|
123
|
+
am as getWsClient,
|
|
122
124
|
l as lexicalUtils,
|
|
123
125
|
p as preferences,
|
|
124
126
|
r as routes,
|
|
@@ -133,7 +135,7 @@ export {
|
|
|
133
135
|
a6 as useDefaultApiErrorHandler,
|
|
134
136
|
u as useNow,
|
|
135
137
|
ai as usePointUpContext,
|
|
136
|
-
|
|
138
|
+
an as useSubscription,
|
|
137
139
|
_ as useUnreadNotification,
|
|
138
140
|
ae as useUploader,
|
|
139
141
|
f as utils
|
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("react"), require("@mui/material/Box"), require("@arcblock/ux/lib/Theme"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@mui/material/colors"), require("@arcblock/did-connect/lib/Session"), require("@mui/material"), require("@arcblock/did-connect/lib/Address"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("url-join"), require("react-dom"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "react", "@mui/material/Box", "@arcblock/ux/lib/Theme", "lodash/isNil", "@blocklet/editor/lib/config", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@mui/material/colors", "@arcblock/did-connect/lib/Session", "@mui/material", "@arcblock/did-connect/lib/Address", "@blocklet/editor/lib/ext/CheckboxPlugin", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "react-dom", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.react, global.Box, global.Theme, global.isNil, global.config, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$1, global.colors, global.Session, global.material, global.DIDAddress, global.CheckboxPlugin, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.reactDom, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.Fab, global.debounce, global.TextField, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.Cookie, global.ws, global.OnContentChangePlugin, global.ShortcutPlugin, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
|
|
3
|
-
})(this, function(exports2, labels, jsxRuntime, styles, react, Box, Theme, isNil, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, useMediaQuery, DID, Tooltip, reactRouterDom, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$1, colors, Session, material, DIDAddress, CheckboxPlugin, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, reactDom, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, Fab, debounce, TextField, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode, VideoNode) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("react"), require("@mui/material/Box"), require("@arcblock/ux/lib/Theme"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@mui/material/colors"), require("@arcblock/did-connect/lib/Session"), require("@mui/material"), require("@arcblock/did-connect/lib/Address"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("url-join"), require("react-dom"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "react", "@mui/material/Box", "@arcblock/ux/lib/Theme", "lodash/isNil", "@blocklet/editor/lib/config", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@mui/material/colors", "@arcblock/did-connect/lib/Session", "@mui/material", "@arcblock/did-connect/lib/Address", "@blocklet/editor/lib/ext/CheckboxPlugin", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "react-dom", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.react, global.Box, global.Theme, global.isNil, global.config, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$1, global.colors, global.Session, global.material, global.DIDAddress, global.CheckboxPlugin, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.reactDom, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.Fab, global.debounce, global.TextField, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.Cookie, global.ws, global.css, global.OnContentChangePlugin, global.ShortcutPlugin, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
|
|
3
|
+
})(this, function(exports2, labels, jsxRuntime, styles, react, Box, Theme, isNil, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, useMediaQuery, DID, Tooltip, reactRouterDom, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$1, colors, Session, material, DIDAddress, CheckboxPlugin, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, reactDom, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, Fab, debounce, TextField, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode, VideoNode) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => {
|
|
@@ -10359,6 +10359,161 @@ var __publicField = (obj, key, value) => {
|
|
|
10359
10359
|
children
|
|
10360
10360
|
] });
|
|
10361
10361
|
}
|
|
10362
|
+
function ButtonGroup({
|
|
10363
|
+
data,
|
|
10364
|
+
theme = "dark",
|
|
10365
|
+
selected,
|
|
10366
|
+
urlName,
|
|
10367
|
+
defaultButton,
|
|
10368
|
+
onSelectTab,
|
|
10369
|
+
type,
|
|
10370
|
+
...rest
|
|
10371
|
+
}) {
|
|
10372
|
+
const downSm = useMediaQuery((mainTheme) => mainTheme.breakpoints.down("sm"));
|
|
10373
|
+
const [searchParams, setSearchParams] = reactRouterDom.useSearchParams();
|
|
10374
|
+
const selectedString = searchParams.get(urlName);
|
|
10375
|
+
const dataWithDefault = defaultButton ? [defaultButton, ...data] : data;
|
|
10376
|
+
const selectedArray = selectedString !== null && selectedString !== "" ? selectedString.split(",") : dataWithDefault.map((item) => item.id);
|
|
10377
|
+
const [selectTab, setSelectTab] = react.useState(selectedArray);
|
|
10378
|
+
const [selectAll, setSelectAll] = react.useState(false);
|
|
10379
|
+
const updateUrl = (url, newSelectTab) => {
|
|
10380
|
+
setSearchParams({
|
|
10381
|
+
...searchParams,
|
|
10382
|
+
[url]: newSelectTab.join(",")
|
|
10383
|
+
});
|
|
10384
|
+
};
|
|
10385
|
+
const handleClick = (item) => {
|
|
10386
|
+
setSelectTab([item.id]);
|
|
10387
|
+
updateUrl(urlName, [item.id]);
|
|
10388
|
+
};
|
|
10389
|
+
const handleSelectAll = () => {
|
|
10390
|
+
setSelectAll((prevSelectAll) => {
|
|
10391
|
+
const newSelectAll = !prevSelectAll;
|
|
10392
|
+
const newSelectTab = newSelectAll ? dataWithDefault == null ? void 0 : dataWithDefault.map((item) => item.id) : [];
|
|
10393
|
+
setSelectTab(newSelectTab);
|
|
10394
|
+
updateUrl(urlName, newSelectTab);
|
|
10395
|
+
return newSelectAll;
|
|
10396
|
+
});
|
|
10397
|
+
};
|
|
10398
|
+
react.useEffect(() => {
|
|
10399
|
+
if (JSON.stringify(selectedArray) !== JSON.stringify(selectTab)) {
|
|
10400
|
+
setSelectTab((selectedArray == null ? void 0 : selectedArray.length) > 0 ? selectedArray : []);
|
|
10401
|
+
}
|
|
10402
|
+
}, [data]);
|
|
10403
|
+
react.useEffect(() => {
|
|
10404
|
+
if (selectedString === null || selectedString === "") {
|
|
10405
|
+
setSelectAll(true);
|
|
10406
|
+
} else if ((selectTab == null ? void 0 : selectTab.length) === (dataWithDefault == null ? void 0 : dataWithDefault.length)) {
|
|
10407
|
+
setSelectAll(true);
|
|
10408
|
+
} else {
|
|
10409
|
+
setSelectAll(false);
|
|
10410
|
+
}
|
|
10411
|
+
if (onSelectTab)
|
|
10412
|
+
onSelectTab(selectTab);
|
|
10413
|
+
}, [selectTab, selectedArray]);
|
|
10414
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { className: Group, children: [
|
|
10415
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10416
|
+
material.Box,
|
|
10417
|
+
{
|
|
10418
|
+
sx: {
|
|
10419
|
+
bgcolor: theme === "dark" ? "#F9FAFB" : "",
|
|
10420
|
+
width: "fit-content",
|
|
10421
|
+
maxWidth: "calc(100% - 16px)",
|
|
10422
|
+
borderRadius: "99999px",
|
|
10423
|
+
borderTopRightRadius: downSm ? 0 : "99999px",
|
|
10424
|
+
borderBottomRightRadius: downSm ? 0 : "99999px",
|
|
10425
|
+
overflow: "scroll",
|
|
10426
|
+
whiteSpace: "nowrap"
|
|
10427
|
+
},
|
|
10428
|
+
children: [
|
|
10429
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10430
|
+
material.Button,
|
|
10431
|
+
{
|
|
10432
|
+
onClick: handleSelectAll,
|
|
10433
|
+
sx: {
|
|
10434
|
+
backgroundColor: selectAll ? "#ffffff" : "",
|
|
10435
|
+
color: selectAll ? "#030712" : "#4b5563",
|
|
10436
|
+
border: selectAll ? "1px solid #e5e7eb!important" : "1px solid transparent"
|
|
10437
|
+
},
|
|
10438
|
+
...rest,
|
|
10439
|
+
children: "All"
|
|
10440
|
+
}
|
|
10441
|
+
),
|
|
10442
|
+
dataWithDefault == null ? void 0 : dataWithDefault.map((item, index) => {
|
|
10443
|
+
const isActive = !selectAll && (selectTab == null ? void 0 : selectTab.includes(item.id));
|
|
10444
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10445
|
+
material.Button,
|
|
10446
|
+
{
|
|
10447
|
+
onClick: () => handleClick(item),
|
|
10448
|
+
sx: {
|
|
10449
|
+
...isActive && {
|
|
10450
|
+
backgroundColor: "#ffffff",
|
|
10451
|
+
color: "#030712",
|
|
10452
|
+
border: "1px solid #e5e7eb!important"
|
|
10453
|
+
}
|
|
10454
|
+
},
|
|
10455
|
+
...rest,
|
|
10456
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
10457
|
+
item == null ? void 0 : item.icon,
|
|
10458
|
+
" ",
|
|
10459
|
+
item == null ? void 0 : item.title
|
|
10460
|
+
] })
|
|
10461
|
+
},
|
|
10462
|
+
index
|
|
10463
|
+
);
|
|
10464
|
+
})
|
|
10465
|
+
]
|
|
10466
|
+
}
|
|
10467
|
+
),
|
|
10468
|
+
urlName !== "type" && /* @__PURE__ */ jsxRuntime.jsx(AccessControl, { roles: ["admin", "owner"], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10469
|
+
IconButton$1,
|
|
10470
|
+
{
|
|
10471
|
+
component: reactRouterDom.Link,
|
|
10472
|
+
color: "inherit",
|
|
10473
|
+
size: "small",
|
|
10474
|
+
to: `/discussions/boards?type=${type}`,
|
|
10475
|
+
sx: { color: "grey.500" },
|
|
10476
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.BorderColorOutlined, { sx: { fontSize: 16 } })
|
|
10477
|
+
}
|
|
10478
|
+
) })
|
|
10479
|
+
] });
|
|
10480
|
+
}
|
|
10481
|
+
const Group = css.css`
|
|
10482
|
+
display: flex;
|
|
10483
|
+
flex-direction: row;
|
|
10484
|
+
.MuiButtonBase-root {
|
|
10485
|
+
border-radius: 9999px;
|
|
10486
|
+
color: #4b5563;
|
|
10487
|
+
margin: 5px 8px 5px 5px;
|
|
10488
|
+
padding: 5px 12px;
|
|
10489
|
+
line-height: 22px;
|
|
10490
|
+
font-size: 13px;
|
|
10491
|
+
border: 1px solid transparent;
|
|
10492
|
+
}
|
|
10493
|
+
|
|
10494
|
+
.MuiButtonBase-root:last-of-type {
|
|
10495
|
+
margin-right: 0;
|
|
10496
|
+
}
|
|
10497
|
+
|
|
10498
|
+
.MuiButtonBase-root:first-of-type {
|
|
10499
|
+
margin-left: 0;
|
|
10500
|
+
}
|
|
10501
|
+
|
|
10502
|
+
.MuiButtonBase-root:hover {
|
|
10503
|
+
background-color: #ffffff;
|
|
10504
|
+
color: #030712;
|
|
10505
|
+
border: 1px solid #e5e7eb;
|
|
10506
|
+
}
|
|
10507
|
+
|
|
10508
|
+
* {
|
|
10509
|
+
scrollbar-width: none; /* Firefox */
|
|
10510
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
10511
|
+
}
|
|
10512
|
+
|
|
10513
|
+
*::-webkit-scrollbar {
|
|
10514
|
+
display: none; /* Chrome, Safari and Opera */
|
|
10515
|
+
}
|
|
10516
|
+
`;
|
|
10362
10517
|
const BlockletEditor = react.lazy(() => import("@blocklet/editor"));
|
|
10363
10518
|
const Root = material.styled(material.Box)`
|
|
10364
10519
|
.be-editable,
|
|
@@ -10401,6 +10556,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10401
10556
|
exports2.BlogCard = BlogCard;
|
|
10402
10557
|
exports2.BlogList = BlogListWrapper;
|
|
10403
10558
|
exports2.BlogPermaLink = BlogPermaLink;
|
|
10559
|
+
exports2.ButtonGroup = ButtonGroup;
|
|
10404
10560
|
exports2.Chat = Chat;
|
|
10405
10561
|
exports2.ChatClient = ChatClient;
|
|
10406
10562
|
exports2.ChatHeaderAddon = ChatHeaderAddon;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.157",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@arcblock/ws": "^1.18.110",
|
|
32
|
-
"@blocklet/editor": "1.6.
|
|
33
|
-
"@blocklet/labels": "1.6.
|
|
32
|
+
"@blocklet/editor": "1.6.157",
|
|
33
|
+
"@blocklet/labels": "1.6.157",
|
|
34
34
|
"@blocklet/uploader": "^0.0.73",
|
|
35
35
|
"@emotion/css": "^11.10.5",
|
|
36
36
|
"@emotion/react": "^11.10.5",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"resolutions": {
|
|
95
95
|
"react": "^18.2.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "dea46382238f0e92a003e2b6d943353bf2de9258"
|
|
98
98
|
}
|