@voplus/morpho-document 4.0.7 → 4.0.9
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/components/SendForm/index.d.ts +26 -0
- package/es/components/SendForm/index.js +48 -0
- package/es/components/SendForm/index.js.map +1 -0
- package/es/components/SendForm/index.less +48 -0
- package/es/components/SendForm/state.d.ts +22 -0
- package/es/components/SendForm/state.js +49 -0
- package/es/components/SendForm/state.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const SendForm: {
|
|
3
|
+
(props: {
|
|
4
|
+
/** 用于显示 模块的 title */
|
|
5
|
+
name?: string | undefined;
|
|
6
|
+
/** 是否需要显示 Contact 和 AttachmentButton, 默认只显示 Email Content */
|
|
7
|
+
label?: ("Contact" | "AttachmentButton")[] | undefined;
|
|
8
|
+
/** 是否需要显示默认的contact 「label 需要配置 Contact」 */
|
|
9
|
+
defaultContact?: {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
/** ProseMirror默认值 */
|
|
14
|
+
defaultDescription?: string | undefined;
|
|
15
|
+
/** 打开send form 的方式 Modal: 以dialog的方式打开 | SideForm: 从侧面打开 */
|
|
16
|
+
openType?: "Modal" | "SideForm" | undefined;
|
|
17
|
+
/** cancel */
|
|
18
|
+
onCancel?: (() => void) | undefined;
|
|
19
|
+
/** send */
|
|
20
|
+
onSend?: ((params: any) => void) | undefined;
|
|
21
|
+
}): JSX.Element;
|
|
22
|
+
defaultProps: {
|
|
23
|
+
openType: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export default SendForm;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { observe } from "@voplus/morpho-ui";
|
|
3
|
+
import { State } from "./state";
|
|
4
|
+
import { runInAction } from "mobx";
|
|
5
|
+
import { Button, Checkbox, Form, Modal, Row, Space } from "antd";
|
|
6
|
+
import MentionList from "@voplus/morpho-org/es/controls/MentionList";
|
|
7
|
+
import ProseMirror from "@voplus/morpho-text/es/controls/ProseMirror";
|
|
8
|
+
import SideForm from "@voplus/morpho-ui/es/controls/SideForm";
|
|
9
|
+
import classnames from "classnames";
|
|
10
|
+
import styles from "./index.less";
|
|
11
|
+
const SendForm = (props) => {
|
|
12
|
+
const { name, label, defaultContact, defaultDescription, openType } = props;
|
|
13
|
+
const [state] = useState(new State(defaultContact, defaultDescription));
|
|
14
|
+
const content = observe(() => (React.createElement(Form, { layout: "vertical", className: classnames(styles["general-send-form"]) },
|
|
15
|
+
(label === null || label === void 0 ? void 0 : label.includes("Contact")) && (React.createElement(Form.Item, { label: "Contact" },
|
|
16
|
+
React.createElement(MentionList, { multiple: false, contacts: state.contact ? [state.contact] : [], onChange: (list) => {
|
|
17
|
+
state.contact = list[0];
|
|
18
|
+
state.params.To.push(list[0].id);
|
|
19
|
+
} }))),
|
|
20
|
+
React.createElement(Form.Item, { label: "Email Content", className: "email-content", style: { height: (label === null || label === void 0 ? void 0 : label.includes("Contact")) ? "calc(100% - 100px)" : "100%" } },
|
|
21
|
+
React.createElement(ProseMirror, { toolbarProps: { sticky: false }, scroll: true, defaultHtml: defaultDescription, className: "proseMirror", onChange: (opt) => (state.params.Message = opt.getInnerHtml()) })),
|
|
22
|
+
(label === null || label === void 0 ? void 0 : label.includes("AttachmentButton")) && (React.createElement(Row, { justify: "end", style: { marginBottom: "20px" } },
|
|
23
|
+
React.createElement(Checkbox, { onChange: (e) => (state.params.ShowAttachmentButton = e.target.checked) }, "Show Attachment Download Button"))),
|
|
24
|
+
openType === "Modal" && (React.createElement(Row, { justify: "end" },
|
|
25
|
+
React.createElement(Space, null,
|
|
26
|
+
React.createElement(Button, { onClick: onCancel }, "Cancel"),
|
|
27
|
+
React.createElement(Button, { type: "primary", onClick: onSend }, "Send")))))));
|
|
28
|
+
return observe(() => openType === "Modal" ? (React.createElement(Modal, { title: `${name} Send Form Dialog`, open: true, destroyOnClose: true, closable: false, footer: null, onCancel: onCancel },
|
|
29
|
+
React.createElement("div", { className: styles["general-send-dialog"] }, content))) : (React.createElement(SideForm, { title: `${name} Send Form`, okText: "Send", onCancel: onCancel, onSubmit: onSend }, content)));
|
|
30
|
+
function onCancel() {
|
|
31
|
+
var _a;
|
|
32
|
+
runInAction(() => {
|
|
33
|
+
state.params = state.Params;
|
|
34
|
+
defaultContact ? (state.contact = defaultContact) : (state.contact = undefined);
|
|
35
|
+
});
|
|
36
|
+
(_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
37
|
+
}
|
|
38
|
+
/** email send */
|
|
39
|
+
function onSend() {
|
|
40
|
+
var _a;
|
|
41
|
+
(_a = props.onSend) === null || _a === void 0 ? void 0 : _a.call(props, state.params);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
SendForm.defaultProps = {
|
|
45
|
+
openType: "SideForm",
|
|
46
|
+
};
|
|
47
|
+
export default SendForm;
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SendForm/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AACjE,OAAO,WAAW,MAAM,4CAA4C,CAAC;AACrE,OAAO,WAAW,MAAM,6CAA6C,CAAC;AACtE,OAAO,QAAQ,MAAM,wCAAwC,CAAC;AAC9D,OAAO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H,oBAAC,QAAQ,IAAC,KAAK,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,EAAC,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IACtF,OAAO,CACE,CACX,CACD,CAAC;IAEF,SAAS,QAAQ;;QAChB,WAAW,CAAC,GAAG,EAAE;YAChB,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YAC5B,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;QACjF,CAAC,CAAC,CAAC;QACH,MAAA,KAAK,CAAC,QAAQ,qDAAI,CAAC;IACpB,CAAC;IAED,iBAAiB;IACjB,SAAS,MAAM;;QACd,MAAA,KAAK,CAAC,MAAM,sDAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;AACF,CAAC,CAAC;AAEF,QAAQ,CAAC,YAAY,GAAG;IACvB,QAAQ,EAAE,UAAU;CACpB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.general-send-form {
|
|
2
|
+
height: calc(100% - 50px);
|
|
3
|
+
|
|
4
|
+
:global {
|
|
5
|
+
.email-content {
|
|
6
|
+
// height: calc(100% - 100px);
|
|
7
|
+
|
|
8
|
+
.ant-form-item-row {
|
|
9
|
+
height: 100%;
|
|
10
|
+
flex-direction: inherit;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ant-form-item-control {
|
|
15
|
+
height: 100%;
|
|
16
|
+
|
|
17
|
+
.ant-form-item-control-input {
|
|
18
|
+
height: 100%;
|
|
19
|
+
align-items: flex-start;
|
|
20
|
+
|
|
21
|
+
.ant-form-item-control-input-content {
|
|
22
|
+
height: 95%;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.proseMirror {
|
|
28
|
+
background: #fff;
|
|
29
|
+
|
|
30
|
+
.editor-toolbar .toolbar-button {
|
|
31
|
+
display: inline-block;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.general-send-dialog {
|
|
38
|
+
:global {
|
|
39
|
+
.proseMirror {
|
|
40
|
+
height: 15rem !important;
|
|
41
|
+
background: #fff;
|
|
42
|
+
|
|
43
|
+
.editor-toolbar .toolbar-button {
|
|
44
|
+
display: inline-block;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare class State {
|
|
2
|
+
private defaultContact?;
|
|
3
|
+
private defaultDescription?;
|
|
4
|
+
constructor(defaultContact?: {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
} | undefined, defaultDescription?: string | undefined);
|
|
8
|
+
Params: {
|
|
9
|
+
To: string[];
|
|
10
|
+
Message: string;
|
|
11
|
+
ShowAttachmentButton: boolean;
|
|
12
|
+
};
|
|
13
|
+
params: {
|
|
14
|
+
To: string[];
|
|
15
|
+
Message: string;
|
|
16
|
+
ShowAttachmentButton: boolean;
|
|
17
|
+
};
|
|
18
|
+
contact: {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
} | undefined;
|
|
22
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { makeObservable, observable } from "mobx";
|
|
3
|
+
export class State {
|
|
4
|
+
constructor(defaultContact, defaultDescription) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
Object.defineProperty(this, "defaultContact", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: defaultContact
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(this, "defaultDescription", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: defaultDescription
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "Params", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: {
|
|
23
|
+
To: ((_a = this.defaultContact) === null || _a === void 0 ? void 0 : _a.id) ? [(_b = this.defaultContact) === null || _b === void 0 ? void 0 : _b.id] : [],
|
|
24
|
+
Message: this.defaultDescription || "",
|
|
25
|
+
ShowAttachmentButton: false,
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(this, "params", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: this.Params
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(this, "contact", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: this.defaultContact
|
|
39
|
+
});
|
|
40
|
+
makeObservable(this);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
__decorate([
|
|
44
|
+
observable
|
|
45
|
+
], State.prototype, "params", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
observable
|
|
48
|
+
], State.prototype, "contact", void 0);
|
|
49
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/components/SendForm/state.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElD,MAAM,OAAO,KAAK;IACjB,YACS,cAA6C,EAC7C,kBAA2B;;;;;;mBAD3B;;;;;;mBACA;;QAIT;;;;mBAAgB;gBACf,EAAE,EAAE,CAAA,MAAA,IAAI,CAAC,cAAc,0CAAE,EAAE,EAAC,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,cAAc,0CAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC5D,OAAO,EAAE,IAAI,CAAC,kBAAkB,IAAI,EAAE;gBACtC,oBAAoB,EAAE,KAAK;aAC3B;WAAC;QAEU;;;;mBAAgB,IAAI,CAAC,MAAM;WAAC;QAC5B;;;;mBAA2D,IAAI,CAAC,cAAc;WAAC;QAT1F,cAAc,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;CASD;AAFY;IAAX,UAAU;qCAA6B;AAC5B;IAAX,UAAU;sCAAgF"}
|