@voplus/morpho-document 1.4.78 → 1.4.80
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.
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Button, Dropdown, Form, Menu } from "@voplus/antd";
|
|
2
2
|
import { InlineEdit, observe } from "@voplus/morpho-ui";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import React, { useEffect, useState } from "react";
|
|
4
|
+
import { useDocument, useFileStore } from "@voplus/morpho-document-core";
|
|
5
|
+
import { DownOutlined } from "@ant-design/icons";
|
|
5
6
|
import { Scrollbars } from "react-custom-scrollbars";
|
|
6
|
-
import { useDocument, useDocumentStore, useFileStore } from "@voplus/morpho-document-core";
|
|
7
|
-
import { useWordFill } from "../WordFillView/WordFillContext";
|
|
8
|
-
import { runInAction } from "mobx";
|
|
9
7
|
import { State } from "./state";
|
|
8
|
+
import { runInAction } from "mobx";
|
|
9
|
+
import { useWordFill } from "../WordFillView/WordFillContext";
|
|
10
10
|
const WordFields = (props) => {
|
|
11
11
|
const store = useFileStore();
|
|
12
|
-
const documentStore = useDocumentStore();
|
|
13
12
|
const document = useDocument(props.id);
|
|
14
13
|
const [state] = useState(new State());
|
|
15
14
|
const [form] = Form.useForm();
|
|
@@ -20,14 +19,13 @@ const WordFields = (props) => {
|
|
|
20
19
|
return observe(() => (React.createElement("div", { className: "properties-list" },
|
|
21
20
|
React.createElement(Scrollbars, { autoHide: true },
|
|
22
21
|
React.createElement(Form, { form: form, labelAlign: "left", labelCol: { span: 11 }, scrollToFirstError: true }, state.wordFieldList.map((item) => (React.createElement(Form.Item, { label: item.Name, wrapperCol: { span: 12 }, key: item.Name },
|
|
23
|
-
React.createElement(InlineEdit, { defaultValue: item.Value
|
|
22
|
+
React.createElement(InlineEdit, { defaultValue: item.Value, content: (v) => (React.createElement("div", null, item.Value ? (React.createElement("span", null, item.Value)) : (React.createElement("span", { style: { color: "#00000040" } }, "Add Value")))), onSave: (value) => runInAction(() => (item.Value = value)) })))))),
|
|
24
23
|
React.createElement("div", null,
|
|
25
24
|
React.createElement(Button, { type: "primary", onClick: Reload }, "Refresh Preview"),
|
|
26
25
|
React.createElement(Dropdown.Button, { style: { width: 150, marginLeft: 10 }, onClick: handleButtonClick, icon: React.createElement(DownOutlined, null), overlay: React.createElement(Menu, { onClick: handleMenuClick },
|
|
27
26
|
React.createElement(Menu.Item, { key: "pdf" }, "Download[PDF]")) }, "Download")))));
|
|
28
27
|
function handleButtonClick() {
|
|
29
|
-
store.fillDownload(props.id, { data: state.wordFieldList })
|
|
30
|
-
documentStore.downloadFiles(props.id).then((blob) => {
|
|
28
|
+
store.fillDownload(props.id, { data: state.wordFieldList }).then((blob) => {
|
|
31
29
|
if (blob) {
|
|
32
30
|
const url = URL.createObjectURL(blob);
|
|
33
31
|
if (url) {
|
|
@@ -35,23 +33,21 @@ const WordFields = (props) => {
|
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
});
|
|
38
|
-
wordFills.WordFieldList = state.wordFieldList;
|
|
39
36
|
}
|
|
40
37
|
function handleMenuClick() {
|
|
41
|
-
|
|
42
|
-
store.fillDownload(props.id, { data: state.wordFieldList }, state.isPdf);
|
|
43
|
-
documentStore.downloadFiles(props.id).then((blob) => {
|
|
38
|
+
store.fillDownload(props.id, { data: state.wordFieldList }, true).then((blob) => {
|
|
44
39
|
if (blob) {
|
|
45
40
|
const url = URL.createObjectURL(blob);
|
|
41
|
+
const pdfname = document.name.replace(".docx", ".pdf");
|
|
46
42
|
if (url) {
|
|
47
|
-
saveAs(url,
|
|
43
|
+
saveAs(url, pdfname);
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
46
|
});
|
|
51
|
-
wordFills.IsPdf = state.isPdf;
|
|
52
|
-
wordFills.WordFieldList = state.wordFieldList;
|
|
53
47
|
}
|
|
54
48
|
function Reload() {
|
|
49
|
+
wordFills.IsPdf = true;
|
|
50
|
+
wordFills.WordFieldList = state.wordFieldList;
|
|
55
51
|
wordFills.Loaded = false;
|
|
56
52
|
setTimeout(() => {
|
|
57
53
|
wordFills.Loaded = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/WordFields/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/WordFields/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IAC7C,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,EAAG,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IACtC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,WAAW,EAAE,CAAC;IAEhC,SAAS,CAAC,GAAG,EAAE;QACd,KAAK,CAAC,e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,CAAC;QACvB,SAAS,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;QAC9C,SAAS,CAAC,MAAM,GAAG,KAAK,CAAC;QACzB,UAAU,CAAC,GAAG,EAAE;YACf,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC;QACzB,CAAC,EAAE,GAAG,CAAC,CAAC;IACT,CAAC;AACF,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voplus/morpho-document",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.80",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://voplus.visualstudio.com/morpho-document/_git/morpho-document"
|
|
@@ -55,5 +55,6 @@
|
|
|
55
55
|
"@types/codemirror": "^0.0.109",
|
|
56
56
|
"react": "17.x",
|
|
57
57
|
"react-dom": "17.x"
|
|
58
|
-
}
|
|
58
|
+
},
|
|
59
|
+
"sideEffects": false
|
|
59
60
|
}
|