ronds-metadata 1.2.84 → 1.2.86

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
13
13
  /*
14
14
  * @Author: wangxian
15
15
  * @Date: 2022-05-24 14:31:01
16
- * @LastEditTime: 2023-07-03 16:49:09
16
+ * @LastEditTime: 2023-07-27 13:59:50
17
17
  */
18
18
  import _regeneratorRuntime from "@babel/runtime/regenerator";
19
19
  import produce from 'immer';
@@ -59,6 +59,7 @@ export declare class GraphCore<N extends Node<Node.Properties> = Node<Node.Prope
59
59
  getNodeById: (nodeId: string) => N | undefined;
60
60
  updateNodeById: (nodeId: string, handler: (node?: N) => void) => void;
61
61
  updateNodes: (handler: (nodes: N[]) => void) => void;
62
+ updateNodeNameById(id: string, name: string): void;
62
63
  updateEdgeById: (edgeId: string, handler: (node?: E) => void) => void;
63
64
  updateEdges: (handler: (edges: E[]) => void) => void;
64
65
  throwRenderError: () => void;
@@ -6,7 +6,7 @@ var _excluded = ["wrapper", "container", "nodes", "edges"];
6
6
  /*
7
7
  * @Author: wangxian
8
8
  * @Date: 2022-05-24 13:55:44
9
- * @LastEditTime: 2022-05-31 10:43:04
9
+ * @LastEditTime: 2023-07-27 14:04:35
10
10
  */
11
11
  import { Graph } from '@antv/x6';
12
12
  import { debounceTime, fromEventPattern, map, merge, scan, tap } from 'rxjs';
@@ -421,6 +421,17 @@ export var GraphCore = /*#__PURE__*/function () {
421
421
  value: function onMoveNodes(args) {
422
422
  if (process.env.NODE_ENV === 'development') {}
423
423
  }
424
+ }, {
425
+ key: "updateNodeNameById",
426
+ value:
427
+ // 通过id更新名称
428
+ function updateNodeNameById(id, name) {
429
+ this.updateNodeById(id, function (node) {
430
+ node.setData({
431
+ name: name
432
+ });
433
+ });
434
+ }
424
435
  }, {
425
436
  key: "dispose",
426
437
  value:
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-07-07 15:47:59
9
+ * @LastEditTime: 2023-07-19 10:10:33
10
10
  */
11
11
  import saveAs from 'file-saver';
12
12
  import { asBlob } from 'html-docx-js-typescript';
@@ -168,6 +168,8 @@ function _handleMd2Doc() {
168
168
  _handleMd2Doc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mdText, fileName) {
169
169
  var isFirstLineCenter,
170
170
  md,
171
+ h2_idx_open,
172
+ h2_idx,
171
173
  html,
172
174
  commonHtml,
173
175
  opt,
@@ -202,15 +204,30 @@ function _handleMd2Doc() {
202
204
  // 在 table 元素上添加 class 属性
203
205
  return "<table class='doc-table' >\n";
204
206
  };
207
+ h2_idx_open = 0;
208
+ h2_idx = 0;
205
209
  md.renderer.rules.heading_open = function (tokens, idx, options, env, self) {
206
210
  var token = tokens[idx];
207
211
  if (isFirstLineCenter && idx === 0 && token.tag === 'h1') {
208
212
  return "<h1 style=\"text-align:center\" >\n";
209
213
  }
214
+ if (isFirstLineCenter && token.tag === 'h2') {
215
+ h2_idx_open++;
216
+ if (h2_idx_open === 2) {
217
+ h2_idx = idx;
218
+ }
219
+ }
220
+ return "<".concat(token.tag, ">\n");
221
+ };
222
+ md.renderer.rules.paragraph_open = function (tokens, idx, options, env, self) {
223
+ var token = tokens[idx];
224
+ if (isFirstLineCenter && h2_idx === 0) {
225
+ return "<p class=\"my-p\">\n";
226
+ }
210
227
  return "<".concat(token.tag, ">\n");
211
228
  };
212
229
  html = md.render(mdText);
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 p {\n margin: 0;\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 ");
230
+ 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 \n p {\n margin: 0\n }\n\n .my-p {\n margin-bottom: 10px !important;\n margin-top: 10px !important;\n font-size: 16px;\n }\n\n h4{\n margin:0;\n }\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 ");
214
231
  opt = {
215
232
  margin: {
216
233
  top: 0,
@@ -219,12 +236,12 @@ function _handleMd2Doc() {
219
236
  },
220
237
  orientation: 'portrait'
221
238
  };
222
- _context.next = 10;
239
+ _context.next = 13;
223
240
  return asBlob(commonHtml, opt);
224
- case 10:
241
+ case 13:
225
242
  blob = _context.sent;
226
243
  saveAs(blob, "".concat(fileName, ".doc"));
227
- case 12:
244
+ case 15:
228
245
  case "end":
229
246
  return _context.stop();
230
247
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.2.84",
4
+ "version": "1.2.86",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",