ronds-metadata 1.2.66 → 1.2.68
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/comps/MetadataForm/HOC/index.js +3 -2
- package/es/utils.d.ts +1 -1
- package/es/utils.js +20 -6
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
5
5
|
/*
|
|
6
6
|
* @Author: wangxian
|
|
7
7
|
* @Date: 2021-09-18 14:15:04
|
|
8
|
-
* @LastEditTime: 2023-06-
|
|
8
|
+
* @LastEditTime: 2023-06-14 09:27:20
|
|
9
9
|
*/
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { deepClone } from '../../../utils';
|
|
@@ -20,6 +20,7 @@ export function withAddOnAfter(WrappedComponent) {
|
|
|
20
20
|
isShowTypeInfo = props.isShowTypeInfo,
|
|
21
21
|
fields = props.fields,
|
|
22
22
|
colSpan = props.colSpan,
|
|
23
|
+
disabled = props.disabled,
|
|
23
24
|
field = props.field,
|
|
24
25
|
id = props.id,
|
|
25
26
|
_props$name = props.name,
|
|
@@ -100,7 +101,7 @@ export function withAddOnAfter(WrappedComponent) {
|
|
|
100
101
|
labelSpan: labelSpan,
|
|
101
102
|
isObj: isObj,
|
|
102
103
|
notRequire: depend === null || depend === void 0 ? void 0 : depend.notRequire,
|
|
103
|
-
disabled: (depend === null || depend === void 0 ? void 0 : depend.disabled) ||
|
|
104
|
+
disabled: (depend === null || depend === void 0 ? void 0 : depend.disabled) || disabled
|
|
104
105
|
})), isShowTypeInfo && !field && type !== 'number' && type !== 'bool' && /*#__PURE__*/React.createElement("div", {
|
|
105
106
|
className: "with-add-on-after-extra"
|
|
106
107
|
}, help !== null && help !== void 0 ? help : type))), fields && ((_fields$5 = fields[0]) === null || _fields$5 === void 0 ? void 0 : (_fields$5$value = _fields$5.value) === null || _fields$5$value === void 0 ? void 0 : (_fields$5$value$commo = _fields$5$value.common) === null || _fields$5$value$commo === void 0 ? void 0 : _fields$5$value$commo.br) && /*#__PURE__*/React.createElement(_Col, {
|
package/es/utils.d.ts
CHANGED
|
@@ -29,4 +29,4 @@ export declare function getConstantValue(array: any[], key: string | number, str
|
|
|
29
29
|
* @param mdText string
|
|
30
30
|
* @param fileName string
|
|
31
31
|
*/
|
|
32
|
-
export declare function handleMd2Doc(mdText: string, fileName: string): Promise<void>;
|
|
32
|
+
export declare function handleMd2Doc(mdText: string, fileName: string, isFirstLineCenter?: boolean): Promise<void>;
|
package/es/utils.js
CHANGED
|
@@ -6,7 +6,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
6
6
|
/*
|
|
7
7
|
* @Author: wangxian
|
|
8
8
|
* @Date: 2021-09-18 14:15:04
|
|
9
|
-
* @LastEditTime: 2023-06-
|
|
9
|
+
* @LastEditTime: 2023-06-12 16:44:46
|
|
10
10
|
*/
|
|
11
11
|
import saveAs from 'file-saver';
|
|
12
12
|
import { asBlob } from 'html-docx-js-typescript';
|
|
@@ -166,10 +166,17 @@ export function handleMd2Doc(_x, _x2) {
|
|
|
166
166
|
}
|
|
167
167
|
function _handleMd2Doc() {
|
|
168
168
|
_handleMd2Doc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mdText, fileName) {
|
|
169
|
-
var
|
|
169
|
+
var isFirstLineCenter,
|
|
170
|
+
md,
|
|
171
|
+
html,
|
|
172
|
+
commonHtml,
|
|
173
|
+
opt,
|
|
174
|
+
blob,
|
|
175
|
+
_args = arguments;
|
|
170
176
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
171
177
|
while (1) switch (_context.prev = _context.next) {
|
|
172
178
|
case 0:
|
|
179
|
+
isFirstLineCenter = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
|
|
173
180
|
md = new MarkdownIt();
|
|
174
181
|
md.renderer.rules.image = function (tokens, index, options, env, self) {
|
|
175
182
|
var token = tokens[index];
|
|
@@ -195,20 +202,27 @@ function _handleMd2Doc() {
|
|
|
195
202
|
// 在 table 元素上添加 class 属性
|
|
196
203
|
return "<table class='doc-table' >\n";
|
|
197
204
|
};
|
|
205
|
+
md.renderer.rules.heading_open = function (tokens, idx, options, env, self) {
|
|
206
|
+
var token = tokens[idx];
|
|
207
|
+
if (isFirstLineCenter && idx === 0 && token.tag === 'h1') {
|
|
208
|
+
return "<h1 style=\"text-align:center\" >\n";
|
|
209
|
+
}
|
|
210
|
+
return '';
|
|
211
|
+
};
|
|
198
212
|
html = md.render(mdText);
|
|
199
|
-
commonHtml = "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <style>\n .doc-table {\n border-collapse:collapse;\n width: 100%;\n border: 1px solid #ccc;\n border-style: hidden;\n overflow: hidden;\n }\n th {\n background: #f9fafb;\n border: 1px solid #f3f4f5;\n font-weight: 600;\n color: rgba(0, 0, 0, 0.85);\n padding:8px;\n text-align:left;\n }\n tr {\n border: 1px solid #f3f4f5;\n }\n td {\n border: 1px solid #f3f4f5;\n padding:4px\n }\n blockquote {\n border-left: 4px solid #f3f4f5; \n overflow: hidden;\n }\n </style>\n </head>\n <body>\n <div style='text-align:center;font-weight:blod'><h1>".concat(fileName, "</h1></div
|
|
213
|
+
commonHtml = "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <style>\n .doc-table {\n border-collapse:collapse;\n width: 100%;\n border: 1px solid #ccc;\n border-style: hidden;\n overflow: hidden;\n }\n th {\n background: #f9fafb;\n border: 1px solid #f3f4f5;\n font-weight: 600;\n color: rgba(0, 0, 0, 0.85);\n padding:8px;\n text-align:left;\n }\n tr {\n border: 1px solid #f3f4f5;\n }\n td {\n border: 1px solid #f3f4f5;\n padding:4px\n }\n blockquote {\n border-left: 4px solid #f3f4f5; \n overflow: hidden;\n }\n </style>\n </head>\n <body>\n ".concat(!isFirstLineCenter ? "<div style='text-align:center;font-weight:blod'><h1>".concat(fileName, "</h1></div>") : '', "\n <div>\n ").concat(html, "\n </div>\n </body>\n </html>\n ");
|
|
200
214
|
opt = {
|
|
201
215
|
margin: {
|
|
202
216
|
top: 100
|
|
203
217
|
},
|
|
204
218
|
orientation: 'portrait'
|
|
205
219
|
};
|
|
206
|
-
_context.next =
|
|
220
|
+
_context.next = 10;
|
|
207
221
|
return asBlob(commonHtml, opt);
|
|
208
|
-
case
|
|
222
|
+
case 10:
|
|
209
223
|
blob = _context.sent;
|
|
210
224
|
saveAs(blob, "".concat(fileName, ".doc"));
|
|
211
|
-
case
|
|
225
|
+
case 12:
|
|
212
226
|
case "end":
|
|
213
227
|
return _context.stop();
|
|
214
228
|
}
|