ronds-metadata 1.2.60 → 1.2.62

Sign up to get free protection for your applications and to get access to all the features.
@@ -170,7 +170,7 @@ function Index(props) {
170
170
  if (isRefForm && !field && schema.length > 0) {
171
171
  var _fieldRule$, _fieldRule$$value, _fieldRule$2, _fieldRule$2$value, _fieldRule$2$value$co;
172
172
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
173
- className: "ant-form-item"
173
+ className: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.borderHidden) && 'ant-form-item'
174
174
  }, !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && /*#__PURE__*/React.createElement(_Col, {
175
175
  span: !labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'vertical' && 24,
176
176
  flex: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? "0 0 ".concat(labelSpan * 100 / 24, "%") : ''
@@ -10,7 +10,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
10
10
  /*
11
11
  * @Author: wangxian
12
12
  * @Date: 2023-05-30 13:36:05
13
- * @LastEditTime: 2023-06-05 16:34:56
13
+ * @LastEditTime: 2023-06-07 11:25:29
14
14
  */
15
15
  import React from 'react';
16
16
  var NumberRange = function NumberRange(props) {
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-02 09:16:28
9
+ * @LastEditTime: 2023-06-08 11:32:22
10
10
  */
11
11
  import saveAs from 'file-saver';
12
12
  import { asBlob } from 'html-docx-js-typescript';
@@ -166,7 +166,7 @@ export function handleMd2Doc(_x, _x2) {
166
166
  }
167
167
  function _handleMd2Doc() {
168
168
  _handleMd2Doc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mdText, fileName) {
169
- var md, html, opt, blob;
169
+ var md, html, commonHtml, opt, blob;
170
170
  return _regeneratorRuntime.wrap(function _callee$(_context) {
171
171
  while (1) switch (_context.prev = _context.next) {
172
172
  case 0:
@@ -177,8 +177,13 @@ function _handleMd2Doc() {
177
177
  // 如果 token 不存在,或者缺少必要的属性,则直接返回空字符串
178
178
  return '';
179
179
  }
180
- var src = token.attrGet('src');
181
- var width = '900'; // 自定义宽度
180
+ // 获取原始图片路径
181
+ var src = token.attrs[token.attrIndex('src')][1];
182
+ if (src.indexOf('http') === -1) {
183
+ // 修改图片路径;
184
+ token.attrs[token.attrIndex('src')][1] = "".concat(window.location.origin, "/").concat(src);
185
+ }
186
+ var width = '600'; // 自定义宽度
182
187
  var height = 'auto'; // 自适应高度
183
188
  // 添加自定义宽高属性
184
189
  token.attrSet('width', width);
@@ -186,19 +191,24 @@ function _handleMd2Doc() {
186
191
  // 渲染图片标签
187
192
  return self.renderToken(tokens, index, options);
188
193
  };
194
+ md.renderer.rules.table_open = function (tokens, idx, options, env, self) {
195
+ // 在 table 元素上添加 class 属性
196
+ return "<table class='doc-table' >\n";
197
+ };
189
198
  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>\n <div>\n ").concat(html, "\n </div>\n </body>\n </html>\n ");
190
200
  opt = {
191
201
  margin: {
192
202
  top: 100
193
203
  },
194
204
  orientation: 'portrait'
195
205
  };
196
- _context.next = 6;
206
+ _context.next = 8;
197
207
  return asBlob(html, opt);
198
- case 6:
208
+ case 8:
199
209
  blob = _context.sent;
200
210
  saveAs(blob, "".concat(fileName, ".doc"));
201
- case 8:
211
+ case 10:
202
212
  case "end":
203
213
  return _context.stop();
204
214
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.2.60",
4
+ "version": "1.2.62",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",