@voplus/morpho-workspace 11.0.2 → 11.0.4
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/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardActions.d.ts +26 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardActions.js +34 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardActions.js.map +1 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardContent.d.ts +10 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardContent.js +27 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardContent.js.map +1 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardFooter.d.ts +12 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardFooter.js +16 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardFooter.js.map +1 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardHeader.d.ts +7 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardHeader.js +20 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardHeader.js.map +1 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationMobileCard.d.ts +1 -1
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationMobileCard.js +11 -49
- package/es/modules/notification-workspace/components/DocumentNotificationCard/NotificationMobileCard.js.map +1 -1
- package/es/modules/notification-workspace/components/DocumentNotificationCard/index.d.ts +2 -9
- package/es/modules/notification-workspace/components/DocumentNotificationCard/index.js +10 -60
- package/es/modules/notification-workspace/components/DocumentNotificationCard/index.js.map +1 -1
- package/es/modules/notification-workspace/components/DocumentNotificationCard/{obsolete.d.ts → types.d.ts} +0 -4
- package/es/modules/notification-workspace/components/DocumentNotificationCard/types.js +2 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/types.js.map +1 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/useNotificationCard.d.ts +22 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/useNotificationCard.js +55 -0
- package/es/modules/notification-workspace/components/DocumentNotificationCard/useNotificationCard.js.map +1 -0
- package/es/modules/notification-workspace/components/NotificationTag/index.d.ts +1 -0
- package/es/modules/notification-workspace/components/NotificationTag/index.js +8 -8
- package/es/modules/notification-workspace/components/NotificationTag/index.js.map +1 -1
- package/es/modules/tasks/components/SubTaskList/index.js +2 -5
- package/es/modules/tasks/components/SubTaskList/index.js.map +1 -1
- package/es/modules/tasks/components/SubTaskList/state.d.ts +6 -0
- package/es/modules/tasks/components/SubTaskList/state.js +16 -0
- package/es/modules/tasks/components/SubTaskList/state.js.map +1 -1
- package/es/modules/tasks/pages/TaskListPage/index.js +2 -2
- package/es/modules/tasks/pages/TaskListPage/index.js.map +1 -1
- package/es/modules/tasks/pages/TaskListPage/state.d.ts +10 -1
- package/es/modules/tasks/pages/TaskListPage/state.js +24 -6
- package/es/modules/tasks/pages/TaskListPage/state.js.map +1 -1
- package/es/modules/work/work-type/pages/WorkTypePage/index.js +5 -3
- package/es/modules/work/work-type/pages/WorkTypePage/index.js.map +1 -1
- package/package.json +1 -1
- package/es/modules/notification-workspace/components/DocumentNotificationCard/index.css +0 -151
- package/es/modules/notification-workspace/components/DocumentNotificationCard/obsolete.js +0 -66
- package/es/modules/notification-workspace/components/DocumentNotificationCard/obsolete.js.map +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NotificationStatus } from "../../../../data/notification-workspace";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/** 次要操作按钮样式(复用主题的 secondary-button) */
|
|
4
|
+
export declare const SECONDARY_ACTION_CLASS = "secondary-button h-8 px-5 text-sm font-bold uppercase";
|
|
5
|
+
/** 主操作按钮样式(复用主题的 primary-button) */
|
|
6
|
+
export declare const PRIMARY_ACTION_CLASS = "primary-button h-8 px-5 text-sm font-bold uppercase";
|
|
7
|
+
export type NotificationAction = "createTask" | "undoDismiss" | "later" | "dismiss";
|
|
8
|
+
/**
|
|
9
|
+
* 底部操作按钮:样式、顺序、显示条件统一以 index(桌面端)原有写法为准,
|
|
10
|
+
* 不区分桌面端与移动端。
|
|
11
|
+
*/
|
|
12
|
+
declare const NotificationCardActions: (props: {
|
|
13
|
+
status: NotificationStatus;
|
|
14
|
+
className?: string;
|
|
15
|
+
onCreateTask: (ev: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
16
|
+
onChangeStatus: (ev: any, status: NotificationStatus) => void;
|
|
17
|
+
/**
|
|
18
|
+
* 追加到每个按钮的类名之后,用于自定义按钮样式;不传时沿用默认样式。
|
|
19
|
+
*
|
|
20
|
+
* 覆盖默认已设置的属性(高度、内边距、字号等)时**必须**使用 tailwind v4 的尾置 `!`,
|
|
21
|
+
* 例如 `"h-7! px-3! text-xs!"`。不加 `!` 时 `.h-8` / `.px-5` 会因为排位更靠后而胜出,
|
|
22
|
+
* 而 `.secondary-button` 属于未分层样式,会压过分层内的普通工具类。
|
|
23
|
+
*/
|
|
24
|
+
buttonClassName?: string;
|
|
25
|
+
}) => React.JSX.Element;
|
|
26
|
+
export default NotificationCardActions;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
/** 次要操作按钮样式(复用主题的 secondary-button) */
|
|
4
|
+
export const SECONDARY_ACTION_CLASS = "secondary-button h-8 px-5 text-sm font-bold uppercase";
|
|
5
|
+
/** 主操作按钮样式(复用主题的 primary-button) */
|
|
6
|
+
export const PRIMARY_ACTION_CLASS = "primary-button h-8 px-5 text-sm font-bold uppercase";
|
|
7
|
+
/** 文案与样式只有这一处定义,各端共用 */
|
|
8
|
+
const ACTIONS = {
|
|
9
|
+
createTask: { label: "Create Task", className: SECONDARY_ACTION_CLASS },
|
|
10
|
+
undoDismiss: { label: "Undo Dismiss", className: PRIMARY_ACTION_CLASS, next: "Read" },
|
|
11
|
+
later: { label: "Later", className: SECONDARY_ACTION_CLASS, next: "Later" },
|
|
12
|
+
dismiss: { label: "Dismiss", className: PRIMARY_ACTION_CLASS, next: "Dismissed" },
|
|
13
|
+
};
|
|
14
|
+
/** 按钮顺序统一沿用 index(桌面端)原有的写法 */
|
|
15
|
+
const ACTION_ORDER = ["createTask", "undoDismiss", "later", "dismiss"];
|
|
16
|
+
/**
|
|
17
|
+
* 底部操作按钮:样式、顺序、显示条件统一以 index(桌面端)原有写法为准,
|
|
18
|
+
* 不区分桌面端与移动端。
|
|
19
|
+
*/
|
|
20
|
+
const NotificationCardActions = (props) => {
|
|
21
|
+
const { status } = props;
|
|
22
|
+
const visible = {
|
|
23
|
+
createTask: true,
|
|
24
|
+
undoDismiss: status === "Dismissed",
|
|
25
|
+
later: status !== "Later" && status !== "Dismissed",
|
|
26
|
+
dismiss: status !== "Dismissed",
|
|
27
|
+
};
|
|
28
|
+
return (React.createElement("div", { className: classnames("flex items-center gap-2", props.className) }, ACTION_ORDER.filter((action) => visible[action]).map((action) => {
|
|
29
|
+
const { label, className, next } = ACTIONS[action];
|
|
30
|
+
return (React.createElement("button", { key: action, className: classnames(className, props.buttonClassName), onClick: (ev) => (next ? props.onChangeStatus(ev, next) : props.onCreateTask(ev)) }, label));
|
|
31
|
+
})));
|
|
32
|
+
};
|
|
33
|
+
export default NotificationCardActions;
|
|
34
|
+
//# sourceMappingURL=NotificationCardActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationCardActions.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardActions.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,uCAAuC;AACvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,uDAAuD,CAAC;AAE9F,oCAAoC;AACpC,MAAM,CAAC,MAAM,oBAA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AC,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,EACvD,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,IAEhF,KAAK,CACE,CACT,CAAC;IACH,CAAC,CAAC,CACG,CACN,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IDocumentNotification } from "../../../../data/notification-workspace";
|
|
2
|
+
import React from "react";
|
|
3
|
+
declare const NotificationCardContent: (props: {
|
|
4
|
+
notification: IDocumentNotification;
|
|
5
|
+
contentRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
6
|
+
showMirror: boolean;
|
|
7
|
+
onReadMore: (ev: React.MouseEvent) => void;
|
|
8
|
+
mobile?: boolean;
|
|
9
|
+
}) => React.JSX.Element;
|
|
10
|
+
export default NotificationCardContent;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import ProseMirrorViewer from "@voplus/morpho-text/es/controls/ProseMirror/Viewer";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import classnames from "classnames";
|
|
4
|
+
import { observe } from "@voplus/morpho-ui";
|
|
5
|
+
const NotificationCardContent = (props) => {
|
|
6
|
+
const { notification, contentRef, showMirror, onReadMore, mobile } = props;
|
|
7
|
+
return observe(() => {
|
|
8
|
+
/** Read More 统一复用主题的 underline-button(移动端原本是个无样式的 div) */
|
|
9
|
+
const readMore = !showMirror && (React.createElement("button", { className: classnames("underline-button", mobile ? "mt-1" : "mt-3"), onClick: onReadMore }, "Read More ..."));
|
|
10
|
+
const content = (React.createElement("div", { ref: contentRef, className: classnames(
|
|
11
|
+
// 展开时不限高,折叠时限定高度
|
|
12
|
+
mobile
|
|
13
|
+
? classnames("bg-bg-table p-3 mt-3 rounded-base [&_.ProseMirror]:text-xs! [&_.ProseMirror]:font-medium!", showMirror
|
|
14
|
+
? "[&_.ProseMirror-container]:max-h-none!"
|
|
15
|
+
: "[&_.ProseMirror-container]:max-h-[85px]")
|
|
16
|
+
: showMirror
|
|
17
|
+
? "text-font-primary [&_.ProseMirror-container]:max-h-none!"
|
|
18
|
+
: "bg-bg-blue rounded-lg p-4 border-l-4 border-font-secondary [&_.ProseMirror-container]:max-h-[85px]") },
|
|
19
|
+
React.createElement(ProseMirrorViewer, { html: notification.content?.content }),
|
|
20
|
+
mobile && readMore));
|
|
21
|
+
return mobile ? (content) : (React.createElement("div", { className: "px-5 mt-5" },
|
|
22
|
+
content,
|
|
23
|
+
readMore));
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export default NotificationCardContent;
|
|
27
|
+
//# sourceMappingURL=NotificationCardContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationCardContent.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardContent.tsx"],"names":[],"mappings":"AACA,OAAO,iBAAiB,MAAM,oDAAoD,CAAC;AACnF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,uBAAuB,GAAG,CAAC,KAMhC,EAAE,EAAE;IACJ,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAE3E,OAAO,OAAO,CAAC,GAAG,EAAE;QACnB,0DAA0D;QAC1D,MAAM,QAAQ,GAAG,CAAC,UAAU,IAAI,CAC/B,gCACC,SAAS,EAAE,UAAU,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EACnE,OAAO,EAAE,UAAU,oBAGX,CACT,CAAC;QAEF,MAAM,OAAO,GAAG,CACf,6BACC,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,UAAU;YACpB,iBAAiB;YACjB,MAAM;gBACL,CAAC,CAAC,UAAU,CACV,2FAA2F,EAC3F,UAAU;oBACT,CAAC,CAAC,wCAAwC;oBAC1C,CAAC,CAAC,yCAAyC,CAC3C;gBACH,CAAC,CAAC,UAAU;oBACZ,CAAC,CAAC,0DAA0D;oBAC5D,CAAC,CAAC,oGAAoG,CACvG;YAED,oBAAC,iBAAiB,IAAC,IAAI,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,GAAI;YACzD,MAAM,IAAI,QAAQ,CACd,CACN,CAAC;QAEF,OAAO,MAAM,CAAC,CAAC,CAAC,CACf,OAAO,CACP,CAAC,CAAC,CAAC,CACH,6BAAK,SAAS,EAAC,WAAW;YACxB,OAAO;YACP,QAAQ,CACJ,CACN,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IDocumentNotification, NotificationStatus } from "../../../../data/notification-workspace";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export declare const CREATE_DATE_FORMAT = "DD MMM YYYY | hh:mm A";
|
|
4
|
+
declare const NotificationCardFooter: (props: {
|
|
5
|
+
notification: IDocumentNotification;
|
|
6
|
+
onCreateTask: (ev: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
7
|
+
onChangeStatus: (ev: any, status: NotificationStatus) => void;
|
|
8
|
+
mobile?: boolean;
|
|
9
|
+
/** 透传给 NotificationCardActions,用于自定义按钮样式 */
|
|
10
|
+
buttonClassName?: string;
|
|
11
|
+
}) => React.JSX.Element;
|
|
12
|
+
export default NotificationCardFooter;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import NotificationCardActions from "./NotificationCardActions";
|
|
3
|
+
import { Divider } from "antd";
|
|
4
|
+
import dayjs from "dayjs";
|
|
5
|
+
import { observe } from "@voplus/morpho-ui";
|
|
6
|
+
export const CREATE_DATE_FORMAT = "DD MMM YYYY | hh:mm A";
|
|
7
|
+
const NotificationCardFooter = (props) => {
|
|
8
|
+
const { notification, onCreateTask, onChangeStatus, mobile } = props;
|
|
9
|
+
return observe(() => (React.createElement(React.Fragment, null,
|
|
10
|
+
!mobile && React.createElement(Divider, { className: "mt-7! mb-5! border-border!" }),
|
|
11
|
+
React.createElement("div", { className: mobile ? "mt-3" : "px-5 flex justify-between" },
|
|
12
|
+
React.createElement("div", { className: mobile ? "text-font-grey mb-3" : "text-sm text-font-grey font-medium leading-8" }, dayjs.utc(notification.createDate).local().format(CREATE_DATE_FORMAT)),
|
|
13
|
+
React.createElement(NotificationCardActions, { status: notification.status, onCreateTask: onCreateTask, onChangeStatus: onChangeStatus, className: mobile ? "justify-end" : undefined, buttonClassName: props.buttonClassName })))));
|
|
14
|
+
};
|
|
15
|
+
export default NotificationCardFooter;
|
|
16
|
+
//# sourceMappingURL=NotificationCardFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationCardFooter.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardFooter.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AAE1D,MAAM,sBAAsB,GAAG,CAAC,KAO/B,EAAE,EAAE;IACJ,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAErE,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CACpB;QACE,CAAC,MAAM,IAAI,oBAAC,OAAO,IAAC,SAAS,EAAC,4BAA4B,GAAG;QAC9D,6BAAK,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,2BAA2B;YAC5D,6BACC,SAAS,EACR,MAAM,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,8CAA8C,IAG/E,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CACjE;YACN,oBAAC,uBAAuB,IACvB,MAAM,EAAE,YAAY,CAAC,MAAM,EAC3B,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EAC7C,eAAe,EAAE,KAAK,CAAC,eAAe,GACrC,CACG,CACJ,CACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IDocumentNotification } from "../../../../data/notification-workspace";
|
|
2
|
+
import React from "react";
|
|
3
|
+
declare const NotificationCardHeader: (props: {
|
|
4
|
+
notification: IDocumentNotification;
|
|
5
|
+
mobile?: boolean;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
export default NotificationCardHeader;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import NotificationTag from "../NotificationTag";
|
|
3
|
+
import classnames from "classnames";
|
|
4
|
+
import { getContentTitle, getInitials } from "./useNotificationCard";
|
|
5
|
+
import { observe } from "@voplus/morpho-ui";
|
|
6
|
+
const NotificationCardHeader = (props) => {
|
|
7
|
+
const { notification, mobile } = props;
|
|
8
|
+
return observe(() => {
|
|
9
|
+
const tag = notification.notificationType ? (React.createElement(NotificationTag, { tag: notification.notificationType })) : null;
|
|
10
|
+
return (React.createElement("div", { className: mobile ? "flex gap-1.5" : "px-5 flex items-start gap-2.5" },
|
|
11
|
+
React.createElement("div", { className: classnames("bg-blue-profile rounded-base flex items-center justify-center", mobile ? "w-9 h-9" : "w-10 h-10") }, notification.createdBy && (React.createElement("span", { className: classnames("text-font-secondary font-bold", mobile ? "text-sm" : "text-[15px]") }, getInitials(notification.createdBy.name)))),
|
|
12
|
+
React.createElement("div", { className: mobile ? "text-font-primary font-medium" : "flex-1 min-w-0" },
|
|
13
|
+
React.createElement("div", { className: mobile ? "text-font-secondary font-bold" : "text-sm font-bold text-font-secondary" }, notification.createdBy?.name),
|
|
14
|
+
React.createElement("div", { className: mobile ? "mb-2" : "text-sm text-font-primary font-medium" }, getContentTitle(notification.content?.title)),
|
|
15
|
+
mobile && tag),
|
|
16
|
+
!mobile && React.createElement("div", null, tag)));
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export default NotificationCardHeader;
|
|
20
|
+
//# sourceMappingURL=NotificationCardHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationCardHeader.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/DocumentNotificationCard/NotificationCardHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,oBAAoB,CAAC;AACjD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,sBAAsB,GAAG,CAAC,KAG/B,EAAE,EAAE;IACJ,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEvC,OAAO,OAAO,CAAC,GAAG,EAAE;QACnB,MAAM,GAAG,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAC3C,oBAAC,eAAe,IAAC,GAAG,EAAE,YAAY,CAAC,gBAAgB,GAAI,CACvD,CAAC,CAAC,CAAC,IAAI,CAAC;QAET,OAAO,CACN,6BAAK,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,+BAA+B;YACxE,6BACC,SAAS,EAAE,UAAU,CACpB,+DAA+D,EAC/D,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAChC,IAEA,YAAY,CAAC,SAAS,IAAI,CAC1B,8BACC,SAAS,EAAE,UAAU,CACpB,+BAA+B,EAC/B,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAClC,IAEA,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CACnC,CACP,CACI;YACN,6BAAK,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,gBAAgB;gBAC1E,6BACC,SAAS,EACR,MAAM,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,uCAAuC,IAGlF,YAAY,CAAC,SAAS,EAAE,IAAI,CACxB;gBACN,6BAAK,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,uCAAuC,IACvE,eAAe,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CACxC;gBAEL,MAAM,IAAI,GAAG,CACT;YACL,CAAC,MAAM,IAAI,iCAAM,GAAG,CAAO,CACvB,CACN,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1,55 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import React, { useState, useEffect, useRef } from "react";
|
|
6
|
-
import AvatarItem from "@voplus/morpho-org/es/components/AvatarList/AvatarItem";
|
|
7
|
-
import NotificationNewTaskForm from "../../../tasks/components/NotificationNewTaskForm";
|
|
8
|
-
import classnames from "classnames";
|
|
9
|
-
import dayjs from "dayjs";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import NotificationCardContent from "./NotificationCardContent";
|
|
3
|
+
import NotificationCardFooter from "./NotificationCardFooter";
|
|
4
|
+
import NotificationCardHeader from "./NotificationCardHeader";
|
|
10
5
|
import { observe } from "@voplus/morpho-ui";
|
|
6
|
+
import { useNotificationCard } from "./useNotificationCard";
|
|
7
|
+
/** 移动端卡片宽度有限,用一套更小的按钮;`!` 用于覆盖默认已设置的 h-8 / px-5 / text-sm */
|
|
8
|
+
const MOBILE_BUTTON_CLASS = "h-7! px-3! text-xs!";
|
|
11
9
|
const NotificationMobileCard = (props) => {
|
|
12
|
-
const
|
|
13
|
-
const asideContext = useAsideContentContext();
|
|
14
|
-
const notification = useNotificationInWorkSpace(props.id);
|
|
15
|
-
const [showMirror, setShowMirror] = useState(true);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const measureHeight = () => {
|
|
18
|
-
if (elementRef.current) {
|
|
19
|
-
const element = elementRef.current.getElementsByClassName("ProseMirror")[0];
|
|
20
|
-
if (element?.offsetHeight > 85)
|
|
21
|
-
setShowMirror(false);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
measureHeight();
|
|
25
|
-
}, []);
|
|
10
|
+
const { notification, contentRef, showMirror, onReadMore, onCreateTask, onChangeStatus } = useNotificationCard(props);
|
|
26
11
|
return observe(() => (React.createElement("div", { className: "notification-card-content mobile", onClick: props.onClick },
|
|
27
|
-
React.createElement(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
React.createElement("div", { className: "notification-name" }, notification.createdBy?.name),
|
|
31
|
-
React.createElement("div", null, notification.content?.title === "Mention Notification"
|
|
32
|
-
? "mentioned you in ____"
|
|
33
|
-
: notification.content?.title),
|
|
34
|
-
notification.notificationType && (React.createElement("span", { className: "notification-tags" }, notification.notificationType)))),
|
|
35
|
-
React.createElement("div", { ref: elementRef, className: classnames("notification-content-viewer", { show: showMirror }) },
|
|
36
|
-
React.createElement(ProseMirrorViewer, { html: notification.content?.content }),
|
|
37
|
-
!showMirror && (React.createElement("div", { className: "read-more", onClick: () => setShowMirror(true) }, "Read More ..."))),
|
|
38
|
-
React.createElement("div", { className: "notification-footer" },
|
|
39
|
-
React.createElement("div", { className: "notification-date" }, dayjs.utc(notification.createDate).local().format("DD MMM YYYY | hh:mm A")),
|
|
40
|
-
React.createElement("div", { className: "notification-btn" },
|
|
41
|
-
React.createElement(Space, null,
|
|
42
|
-
notification.status !== "Dismissed" && (React.createElement(Button, { className: "btn-task-form", onClick: (ev) => {
|
|
43
|
-
ev.stopPropagation();
|
|
44
|
-
asideContext.openAside(React.createElement(NotificationNewTaskForm, { showView: true, self: true, title: `Followup ${notification.content.title}`, description: `<div><p>This is a follow-up task of:</p><h3>Notification Content</h3><p>${notification.content.content}</p></div>`, parentId: notification.node?.id, onCancel: () => asideContext?.closeAside() }), { span: 12 });
|
|
45
|
-
} }, "Create Task")),
|
|
46
|
-
notification.status !== "Dismissed" && (React.createElement(Button, { className: "btn-dismiss", onClick: (ev) => onChangeStatus(ev, "Dismissed") }, "Dismiss")),
|
|
47
|
-
notification.status === "Dismissed" && (React.createElement(Button, { className: "btn-unDismiss", onClick: (ev) => onChangeStatus(ev, "Read") }, "Undo Dismiss")),
|
|
48
|
-
notification.status !== "Later" && notification.status !== "Dismissed" && (React.createElement(Button, { className: "btn-later", onClick: (ev) => onChangeStatus(ev, "Later") }, "Later"))))))));
|
|
49
|
-
function onChangeStatus(ev, status) {
|
|
50
|
-
props.onChangeStatus?.(status);
|
|
51
|
-
ev.stopPropagation();
|
|
52
|
-
}
|
|
12
|
+
React.createElement(NotificationCardHeader, { notification: notification, mobile: true }),
|
|
13
|
+
React.createElement(NotificationCardContent, { notification: notification, contentRef: contentRef, showMirror: showMirror, onReadMore: onReadMore, mobile: true }),
|
|
14
|
+
React.createElement(NotificationCardFooter, { notification: notification, onCreateTask: onCreateTask, onChangeStatus: onChangeStatus, buttonClassName: MOBILE_BUTTON_CLASS, mobile: true }))));
|
|
53
15
|
};
|
|
54
16
|
export default NotificationMobileCard;
|
|
55
17
|
//# sourceMappingURL=NotificationMobileCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationMobileCard.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/DocumentNotificationCard/NotificationMobileCard.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"NotificationMobileCard.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/DocumentNotificationCard/NotificationMobileCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,6DAA6D;AAC7D,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAElD,MAAM,sBAAsB,GAAG,CAAC,KAA4B,EAAE,EAAE;IAC/D,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,GACvF,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAE5B,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CACpB,6BAAK,SAAS,EAAC,kCAAkC,EAAC,OAAO,EAAE,KAAK,CAAC,OAAO;QACvE,oBAAC,sBAAsB,IAAC,YAAY,EAAE,YAAY,EAAE,MAAM,SAAG;QAC7D,oBAAC,uBAAuB,IACvB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,MAAM,SACL;QACF,oBAAC,sBAAsB,IACtB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,mBAAmB,EACpC,MAAM,SACL,CACG,CACN,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import { NotificationStatus } from "../../../../data/notification-workspace";
|
|
2
1
|
import React from "react";
|
|
3
|
-
import "./
|
|
4
|
-
export type NotificationCardProps
|
|
5
|
-
id: string;
|
|
6
|
-
active?: boolean;
|
|
7
|
-
className?: string;
|
|
8
|
-
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
9
|
-
onChangeStatus?: (state: NotificationStatus) => void;
|
|
10
|
-
};
|
|
2
|
+
import { NotificationCardProps } from "./types";
|
|
3
|
+
export type { NotificationCardProps } from "./types";
|
|
11
4
|
declare const DocumentNotificationCard: (props: NotificationCardProps) => React.JSX.Element;
|
|
12
5
|
export default DocumentNotificationCard;
|
|
@@ -1,69 +1,19 @@
|
|
|
1
|
-
import { useNotificationInWorkSpace, } from "../../../../data/notification-workspace";
|
|
2
1
|
import { useLayout } from "@voplus/morpho-data";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import NotificationTag from "../NotificationTag";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import NotificationCardContent from "./NotificationCardContent";
|
|
4
|
+
import NotificationCardFooter from "./NotificationCardFooter";
|
|
5
|
+
import NotificationCardHeader from "./NotificationCardHeader";
|
|
8
6
|
import NotificationMobileCard from "./NotificationMobileCard";
|
|
9
7
|
import classnames from "classnames";
|
|
10
|
-
import dayjs from "dayjs";
|
|
11
8
|
import { observe } from "@voplus/morpho-ui";
|
|
12
|
-
import "./
|
|
9
|
+
import { useNotificationCard } from "./useNotificationCard";
|
|
13
10
|
const DocumentNotificationCard = (props) => {
|
|
14
|
-
const elementRef = useRef(null);
|
|
15
11
|
const layout = useLayout();
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (elementRef.current) {
|
|
22
|
-
const element = elementRef.current.getElementsByClassName("ProseMirror")[0];
|
|
23
|
-
if (element?.offsetHeight > 85)
|
|
24
|
-
setShowMirror(false);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
measureHeight();
|
|
28
|
-
}, []);
|
|
29
|
-
return observe(() => (React.createElement("div", { className: classnames("mb-4 mr-5 ml-5 bg-white rounded-xl border border-gray-200 hover:shadow-md transition-shadow duration-200 cursor-pointer new-notification-card", props.active ? "shadow-md" : "shadow-xs", { "notification-card mobile": layout.ui.mobile }, { "notification-card-aside": asideContext?.asideContent }) }, layout.ui.mobile ? (React.createElement(NotificationMobileCard, { ...props })) : (React.createElement("div", { className: "p-6 notification-card-content", onClick: props.onClick },
|
|
30
|
-
React.createElement("div", { className: "flex items-start gap-4" },
|
|
31
|
-
React.createElement("div", { className: "shrink-0" },
|
|
32
|
-
React.createElement("div", { className: "w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center" }, notification.createdBy && (React.createElement("span", { className: "text-blue-600 font-bold text-lg" }, setName(notification.createdBy.name))))),
|
|
33
|
-
React.createElement("div", { className: "flex-1 min-w-0" },
|
|
34
|
-
React.createElement("div", { className: "flex items-center justify-between mb-2" },
|
|
35
|
-
React.createElement("div", { className: "notification-info flex items-center gap-2" },
|
|
36
|
-
React.createElement("h3", { className: "createdBy-name font-semibold text-gray-900" }, notification.createdBy?.name),
|
|
37
|
-
notification.notificationType && (React.createElement(NotificationTag, { tag: notification.notificationType }))),
|
|
38
|
-
React.createElement("div", { className: "flex items-center gap-2" },
|
|
39
|
-
React.createElement("button", { className: "px-3 py-1 bg-gray-100 text-gray-700 text-sm font-medium rounded-lg hover:bg-gray-200 transition-colors", onClick: onCreateTask }, "Create Task"),
|
|
40
|
-
notification.status === "Dismissed" && (React.createElement("button", { className: "px-3 py-1 bg-blue-100 text-blue-700 text-sm font-medium rounded-lg hover:bg-blue-200 transition-colors", onClick: (ev) => onChangeStatus(ev, "Read") }, "Undo Dismiss")),
|
|
41
|
-
notification.status !== "Later" && notification.status !== "Dismissed" && (React.createElement("button", { className: "px-3 py-1 bg-gray-100 text-gray-700 text-sm font-medium rounded-lg hover:bg-gray-200 transition-colors", onClick: (ev) => onChangeStatus(ev, "Later") }, "Later")),
|
|
42
|
-
notification.status !== "Dismissed" && (React.createElement("button", { className: "px-3 py-1 bg-blue-100 text-sm font-medium rounded-lg hover:bg-blue-200 transition-colors dismiss-btn", onClick: (ev) => onChangeStatus(ev, "Dismissed") }, "Dismiss")))),
|
|
43
|
-
React.createElement("div", { className: "text-sm text-gray-600 mb-2" }, notification.content?.title === "Mention Notification"
|
|
44
|
-
? "mentioned you in ____"
|
|
45
|
-
: notification.content?.title),
|
|
46
|
-
React.createElement("div", { ref: elementRef, className: classnames("notification-content-viewer", showMirror
|
|
47
|
-
? "text-gray-700 mb-3"
|
|
48
|
-
: "bg-gray-50 rounded-lg p-4 mb-3 border-l-4 border-blue-500", { show: showMirror }) },
|
|
49
|
-
React.createElement(ProseMirrorViewer, { html: notification.content?.content })),
|
|
50
|
-
!showMirror && (React.createElement("button", { className: "read-more text-blue-600 text-sm hover:text-blue-700 font-medium", onClick: () => setShowMirror(true) }, "Read More ...")),
|
|
51
|
-
React.createElement("div", { className: "text-xs text-gray-500 mt-2" }, dayjs.utc(notification.createDate).local().format("DD MMM YYYY | hh:mm A")))))))));
|
|
52
|
-
function setName(name) {
|
|
53
|
-
let str = "";
|
|
54
|
-
name?.split(" ").forEach((r) => {
|
|
55
|
-
str += r.substring(0, 1);
|
|
56
|
-
});
|
|
57
|
-
return str;
|
|
58
|
-
}
|
|
59
|
-
function onCreateTask(ev) {
|
|
60
|
-
ev.stopPropagation();
|
|
61
|
-
asideContext.openAside(React.createElement(NotificationNewTaskForm, { showView: true, self: true, title: `Followup ${notification.content.title}`, description: `<div><p>This is a follow-up task of:</p><h3>Notification Content</h3><p>${notification.content.content}</p></div>`, parentId: notification.node?.id, onCancel: () => asideContext?.closeAside() }), { span: 12 });
|
|
62
|
-
}
|
|
63
|
-
function onChangeStatus(ev, status) {
|
|
64
|
-
props.onChangeStatus?.(status);
|
|
65
|
-
ev.stopPropagation();
|
|
66
|
-
}
|
|
12
|
+
const { notification, contentRef, showMirror, onReadMore, onCreateTask, onChangeStatus } = useNotificationCard(props);
|
|
13
|
+
return observe(() => (React.createElement("div", { className: classnames("mb-4 mr-5 ml-5 bg-white rounded-base border border-border hover:shadow-md transition-shadow duration-200 cursor-pointer new-notification-card", props.active ? "shadow-md" : "shadow-xs", layout.ui.mobile && "text-xs m-3 p-4", { "notification-card mobile": layout.ui.mobile }) }, layout.ui.mobile ? (React.createElement(NotificationMobileCard, { ...props })) : (React.createElement("div", { className: "py-5 notification-card-content", onClick: props.onClick },
|
|
14
|
+
React.createElement(NotificationCardHeader, { notification: notification }),
|
|
15
|
+
React.createElement(NotificationCardContent, { notification: notification, contentRef: contentRef, showMirror: showMirror, onReadMore: onReadMore }),
|
|
16
|
+
React.createElement(NotificationCardFooter, { notification: notification, onCreateTask: onCreateTask, onChangeStatus: onChangeStatus }))))));
|
|
67
17
|
};
|
|
68
18
|
export default DocumentNotificationCard;
|
|
69
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/DocumentNotificationCard/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/DocumentNotificationCard/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,uBAAuB,MAA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Ac,EAAE,cAAc,GAC7B,CACG,CACN,CACI,CACN,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { NotificationStatus } from "../../../../data/notification-workspace";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import "./index.css";
|
|
4
|
-
/** 旧的,测试后没问题 可删 */
|
|
5
3
|
export type NotificationCardProps = {
|
|
6
4
|
id: string;
|
|
7
5
|
active?: boolean;
|
|
@@ -9,5 +7,3 @@ export type NotificationCardProps = {
|
|
|
9
7
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
10
8
|
onChangeStatus?: (state: NotificationStatus) => void;
|
|
11
9
|
};
|
|
12
|
-
declare const DocumentNotificationCard: (props: NotificationCardProps) => React.JSX.Element;
|
|
13
|
-
export default DocumentNotificationCard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/DocumentNotificationCard/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IDocumentNotification, NotificationStatus } from "../../../../data/notification-workspace";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { NotificationCardProps } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* DocumentNotificationCard 与 NotificationMobileCard 共用的卡片逻辑:
|
|
6
|
+
* 通知数据读取、正文折叠状态、Create Task 侧边栏、状态变更回调。
|
|
7
|
+
*
|
|
8
|
+
* 注意:这里读到的 notification 是 observable,组件必须在 observe() 回调内
|
|
9
|
+
* 读取它上面真正要渲染的字段,响应式更新才不会丢。
|
|
10
|
+
*/
|
|
11
|
+
export declare const useNotificationCard: (props: NotificationCardProps) => {
|
|
12
|
+
notification: IDocumentNotification;
|
|
13
|
+
showMirror: boolean;
|
|
14
|
+
contentRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
15
|
+
onReadMore: (ev: React.MouseEvent) => void;
|
|
16
|
+
onCreateTask: (ev: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
17
|
+
onChangeStatus: (ev: any, status: NotificationStatus) => void;
|
|
18
|
+
};
|
|
19
|
+
/** 头像占位用的姓名首字母,例如 "Yi Dan" -> "YD" */
|
|
20
|
+
export declare const getInitials: (name?: string) => string;
|
|
21
|
+
/** Mention 通知在列表里不直接展示原标题 */
|
|
22
|
+
export declare const getContentTitle: (title?: string) => string | undefined;
|
package/es/modules/notification-workspace/components/DocumentNotificationCard/useNotificationCard.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useNotificationInWorkSpace, } from "../../../../data/notification-workspace";
|
|
2
|
+
import { useAsideContentContext } from "@voplus/morpho-ui/es/components/layout/AsideContent";
|
|
3
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
4
|
+
import NotificationNewTaskForm from "../../../tasks/components/NotificationNewTaskForm";
|
|
5
|
+
/** 正文高度超过该值时折叠,并显示 Read More */
|
|
6
|
+
const CONTENT_MAX_HEIGHT = 85;
|
|
7
|
+
/**
|
|
8
|
+
* DocumentNotificationCard 与 NotificationMobileCard 共用的卡片逻辑:
|
|
9
|
+
* 通知数据读取、正文折叠状态、Create Task 侧边栏、状态变更回调。
|
|
10
|
+
*
|
|
11
|
+
* 注意:这里读到的 notification 是 observable,组件必须在 observe() 回调内
|
|
12
|
+
* 读取它上面真正要渲染的字段,响应式更新才不会丢。
|
|
13
|
+
*/
|
|
14
|
+
export const useNotificationCard = (props) => {
|
|
15
|
+
const contentRef = useRef(null);
|
|
16
|
+
const asideContext = useAsideContentContext();
|
|
17
|
+
const notification = useNotificationInWorkSpace(props.id);
|
|
18
|
+
const [showMirror, setShowMirror] = useState(true);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const element = contentRef.current?.getElementsByClassName("ProseMirror")[0];
|
|
21
|
+
if (element && element.offsetHeight > CONTENT_MAX_HEIGHT)
|
|
22
|
+
setShowMirror(false);
|
|
23
|
+
}, []);
|
|
24
|
+
const onReadMore = (ev) => {
|
|
25
|
+
ev.stopPropagation();
|
|
26
|
+
setShowMirror(true);
|
|
27
|
+
};
|
|
28
|
+
const onCreateTask = (ev) => {
|
|
29
|
+
ev.stopPropagation();
|
|
30
|
+
asideContext.openAside(React.createElement(NotificationNewTaskForm, { showView: true, self: true, title: `Followup ${notification.content.title}`, description: `<div><p>This is a follow-up task of:</p><h3>Notification Content</h3><p>${notification.content.content}</p></div>`, parentId: notification.node?.id, onCancel: () => asideContext?.closeAside() }), { span: 12 });
|
|
31
|
+
};
|
|
32
|
+
const onChangeStatus = (ev, status) => {
|
|
33
|
+
props.onChangeStatus?.(status);
|
|
34
|
+
ev.stopPropagation();
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
notification,
|
|
38
|
+
showMirror,
|
|
39
|
+
contentRef,
|
|
40
|
+
onReadMore,
|
|
41
|
+
onCreateTask,
|
|
42
|
+
onChangeStatus,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/** 头像占位用的姓名首字母,例如 "Yi Dan" -> "YD" */
|
|
46
|
+
export const getInitials = (name) => {
|
|
47
|
+
let str = "";
|
|
48
|
+
name?.split(" ").forEach((r) => {
|
|
49
|
+
str += r.substring(0, 1);
|
|
50
|
+
});
|
|
51
|
+
return str;
|
|
52
|
+
};
|
|
53
|
+
/** Mention 通知在列表里不直接展示原标题 */
|
|
54
|
+
export const getContentTitle = (title) => title === "Mention Notification" ? "mentioned you in ____" : title;
|
|
55
|
+
//# sourceMappingURL=useNotificationCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotificationCard.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/DocumentNotificationCard/useNotificationCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGN,0BAA0B,GAC1B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAC7F,OAAO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AC/B,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,GACzC,EACF,EAAE,IAAI,EAAE,EAAE,EAAE,CACZ,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,CAAC,EAAO,EAAE,MAA0B,EAAE,EAAE;QAC9D,KAAK,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAC;QAC/B,EAAE,CAAC,eAAe,EAAE,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO;QACN,YAAY;QACZ,UAAU;QACV,UAAU;QACV,UAAU;QACV,YAAY;QACZ,cAAc;KACd,CAAC;AACH,CAAC,CAAC;AAEF,sCAAsC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAa,EAAE,EAAE;IAC5C,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QAC9B,GAAG,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC;AAEF,6BAA6B;AAC7B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAc,EAAE,EAAE,CACjD,KAAK,KAAK,sBAAsB,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,KAAK,CAAC"}
|
|
@@ -2,23 +2,23 @@ import React from "react";
|
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
const NotificationTag = (props) => {
|
|
4
4
|
const { tag } = props;
|
|
5
|
-
return (React.createElement("span", { className: classnames("px-2 py-1
|
|
5
|
+
return (React.createElement("span", { className: classnames("border text-2xs font-bold tracking-wide rounded-base px-2.5 py-1 whitespace-nowrap uppercase", getStatusClasses(), props.className) }, tag));
|
|
6
6
|
function getStatusClasses() {
|
|
7
7
|
switch (tag) {
|
|
8
8
|
case "Work Notification":
|
|
9
|
-
return "bg-emerald-100 text-emerald-800";
|
|
9
|
+
return "border-emerald-200 bg-emerald-100 text-emerald-800";
|
|
10
10
|
case "Form Notification":
|
|
11
|
-
return "bg-orange-100 text-orange-800";
|
|
11
|
+
return "border-orange-200 bg-orange-100 text-orange-800";
|
|
12
12
|
case "Quotation Notification":
|
|
13
|
-
return "bg-purple-100 text-purple-800";
|
|
13
|
+
return "border-purple-200 bg-purple-100 text-purple-800";
|
|
14
14
|
case "SignEnvelope Notification":
|
|
15
|
-
return "bg-indigo-100 text-indigo-800";
|
|
15
|
+
return "border-indigo-200 bg-indigo-100 text-indigo-800";
|
|
16
16
|
case "FormSchema Notification":
|
|
17
|
-
return "bg-amber-100 text-amber-800";
|
|
17
|
+
return "border-amber-200 bg-amber-100 text-amber-800";
|
|
18
18
|
case "Task Notification":
|
|
19
|
-
return "bg-rose-100 text-rose-800";
|
|
19
|
+
return "border-rose-200 bg-rose-100 text-rose-800";
|
|
20
20
|
default:
|
|
21
|
-
return "bg-blue-100 text-blue-800";
|
|
21
|
+
return "border-blue-200 bg-blue-100 text-blue-800";
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/NotificationTag/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,MAAM,eAAe,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/notification-workspace/components/NotificationTag/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,MAAM,eAAe,GAAG,CAAC,KAA0C,EAAE,EAAE;IACtE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IAEtB,OAAO,CACN,8BACC,SAAS,EAAE,UAAU,CACpB,8FAA8F,EAC9F,gBAAgB,EAAE,EAClB,KAAK,CAAC,SAAS,CACf,IAEA,GAAG,CACE,CACP,CAAC;IAEF,SAAS,gBAAgB;QACxB,QAAQ,GAAG,EAAE,CAAC;YACb,KAAK,mBAAmB;gBACvB,OAAO,oDAAoD,CAAC;YAC7D,KAAK,mBAAmB;gBACvB,OAAO,iDAAiD,CAAC;YAC1D,KAAK,wBAAwB;gBAC5B,OAAO,iDAAiD,CAAC;YAC1D,KAAK,2BAA2B;gBAC/B,OAAO,iDAAiD,CAAC;YAC1D,KAAK,yBAAyB;gBAC7B,OAAO,8CAA8C,CAAC;YACvD,KAAK,mBAAmB;gBACvB,OAAO,2CAA2C,CAAC;YACpD;gBACC,OAAO,2CAA2C,CAAC;QACrD,CAAC;IACF,CAAC;AACF,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { NodeMenuContext, NodeMenuState, } from "@voplus/morpho-document-core/es
|
|
|
7
7
|
import { TaskFilter, TaskStatusFilter } from "../../../../controls/filters";
|
|
8
8
|
import { useTaskListEffect, useTaskStore } from "@voplus/morpho-document-core";
|
|
9
9
|
import { ListDataContext, useCreateListDataState, BatchContext, BatchContextState, } from "@voplus/morpho-ui/es/data";
|
|
10
|
-
import { State } from "./state";
|
|
10
|
+
import { State, composeListFilters } from "./state";
|
|
11
11
|
import { faListCheckSolid } from "@voplus/morpho-ui/es/faIcons";
|
|
12
12
|
import { useApplicationContext, useDeepMemo } from "@voplus/morpho-data";
|
|
13
13
|
import { FlagFilter, CreateDateFilter } from "@voplus/morpho-document/es/controls/filters";
|
|
@@ -40,13 +40,10 @@ const SubTaskList = ({ header = true, total = true, filterVisible = true, header
|
|
|
40
40
|
const state = useDeepMemo(() => new State(), [parentId]);
|
|
41
41
|
const menuContext = useMemo(() => new NodeMenuState(props.parentId), [props.parentId]);
|
|
42
42
|
/** 建立 ListView 和useTaskListEffect所需的ListDataState. 会根据parentId重建所以不需reset. */
|
|
43
|
-
const defaultFilter = parentId
|
|
44
|
-
? [{ c: "ParentNodeId", o: "=", l: "And", v1: parentId }]
|
|
45
|
-
: [];
|
|
46
43
|
const list = useCreateListDataState({
|
|
47
44
|
filterDefaults: {
|
|
48
45
|
includes: "tags,task-number-reports",
|
|
49
|
-
filters:
|
|
46
|
+
filters: composeListFilters(parentId, props.filters),
|
|
50
47
|
},
|
|
51
48
|
}, [parentId, props.filters]);
|
|
52
49
|
const batch = useDeepMemo(() => new BatchContextState(list), [parentId]);
|