@lingxiteam/ebe-utils 0.3.25 → 0.3.27

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.
@@ -195,11 +195,15 @@ const Description = React.forwardRef<any, MyDescriptionProps>((props, ref) => {
195
195
  }
196
196
  }
197
197
  }
198
-
199
198
  // 如果配置了换行符则根据换行符进行切割
200
199
  if (lineBreak && typeof text === 'string') {
201
- return content.split(lineBreak).map((_c: any, _i: any) => <div key={_i}>{_c}</div>);
200
+ let temlineBreak = lineBreak;
201
+ if (temlineBreak === '\\n') {
202
+ temlineBreak = lineBreak.replace(/\\n/g, '\n');
203
+ }
204
+ return content.split(temlineBreak).map((_c: any, _i: any) => <div key={_i}>{_c}</div>);
202
205
  }
206
+
203
207
  // 自定义渲染函数
204
208
  if (c.jsx) {
205
209
  content = (
@@ -8,17 +8,20 @@ import React, { useMemo, useRef } from 'react';
8
8
  import { DEFAULT_TOOLBARS, DEFAULT_TOOLBARS_GROUP } from './const';
9
9
  import IdleContainer from '../utils/IdleContainer';
10
10
 
11
- const LcdpUeditorMain: LingXiFC <{[key: string]: any}> = (props => {
11
+ const LcdpUeditorMain: LingXiFC<{ [key: string]: any }> = (props) => {
12
12
  const { value, onChange, style, className, rootRef: ref, funcTypes, pasteplain = false, name } = props;
13
13
  const editorRef = useRef<ILcdpUeditorInst | null>(null);
14
14
 
15
15
  const engineApis = props.getEngineApis();
16
16
  const { getLocale, lang } = useLocale(engineApis);
17
+ const { onlySyncValue } = engineApis;
17
18
 
18
19
  const { disabled, required, readOnly, formFieldsRef } = useCommonImperativeHandle(ref, props, {
19
- setValue: (val:string) => {
20
+ setValue: (val: string) => {
20
21
  if (editorRef.current) {
21
22
  editorRef.current.setContent(val);
23
+ // 同步 hoc vlaue使用,解决值不同步问题
24
+ onlySyncValue(val);
22
25
  } else {
23
26
  // 编辑器未挂载先设置到value
24
27
  onChange(val);
@@ -75,7 +78,7 @@ const LcdpUeditorMain: LingXiFC <{[key: string]: any}> = (props => {
75
78
  return 'zh-cn';
76
79
  }
77
80
  }, [lang]);
78
-
81
+
79
82
  return (
80
83
  <IdleContainer>
81
84
  <FormFields
@@ -131,6 +134,6 @@ const LcdpUeditorMain: LingXiFC <{[key: string]: any}> = (props => {
131
134
  </FormFields>
132
135
  </IdleContainer>
133
136
  );
134
- });
137
+ };
135
138
 
136
139
  export default LcdpUeditorMain;
@@ -590,6 +590,11 @@ const ImportBusiObjModal = forwardRef<ImportBusiObjModalHooks, ImportBusiObjModa
590
590
  xhr.onload = async () => {
591
591
  response = JSON.parse(xhr.responseText || xhr.response);
592
592
  if (xhr.status === 200) {
593
+ if (Object.prototype.toString.call(response?.resultObject) === '[object Object]' && response?.resultObject.hasOwnProperty('resultCode') && response?.resultObject?.resultCode !== '0') {
594
+ response.resultCode = response?.resultObject?.resultCode;
595
+ response.resultMsg = response?.resultObject?.resultMsg;
596
+ response.resultObject = undefined;
597
+ }
593
598
  let result = response?.resultObject;
594
599
  let isAsyncImport = false;
595
600
  if (hasUploadProcess) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/ebe-utils",
3
- "version": "0.3.25",
3
+ "version": "0.3.27",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -19,7 +19,7 @@
19
19
  "@babel/types": "^7.12.12",
20
20
  "cac": "^6.7.14",
21
21
  "fs-extra": "9.x",
22
- "@lingxiteam/ebe": "0.3.25"
22
+ "@lingxiteam/ebe": "0.3.27"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"
@@ -1 +0,0 @@
1
- export declare function renameComponents(data: any): string;
@@ -1,70 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- export function renameComponents(data) {
8
- // 读取 JSON 文件
9
- // const data: JsonData = JSON.parse(jsonContent);
10
-
11
- // 用于存储已使用的名称计数
12
- var nameCounters = {};
13
- var renameObject = {};
14
-
15
- // 递归处理组件
16
- function processComponents(components) {
17
- if (!Array.isArray(components)) return;
18
- components.forEach(function (component) {
19
- // 处理当前组件
20
- if (component.id && /^[A-Za-z]+_\d+$/.test(component.id)) {
21
- var baseName = component.id.split('_')[0];
22
- // 生成新的有意义的名字
23
- var newName = generateMeaningfulName(baseName, component.id, nameCounters);
24
- component.id = newName;
25
- }
26
-
27
- // 递归处理子组件
28
- if (component.components) {
29
- processComponents(component.components);
30
- }
31
- });
32
- }
33
-
34
- // 生成有意义的名称
35
- function generateMeaningfulName(baseName, label, counters) {
36
- if (!counters[baseName]) {
37
- counters[baseName] = 1;
38
- } else {
39
- counters[baseName] += 1;
40
- }
41
- // 从 Form1 开始,防止变量名和组件名相同
42
- var rename = "".concat(baseName).concat(counters[baseName]);
43
- renameObject[label] = rename;
44
- return rename;
45
- }
46
-
47
- // 处理所有组件
48
- if (data.components) {
49
- processComponents(data.components);
50
- }
51
-
52
- // 将对象转换为字符串
53
- var jsonString = JSON.stringify(data, null, 4);
54
-
55
- // 全局替换所有引用
56
- Object.entries(renameObject).forEach(function (_ref) {
57
- var _ref2 = _slicedToArray(_ref, 2),
58
- oldName = _ref2[0],
59
- newName = _ref2[1];
60
- // 使用正则表达式确保只替换完整的匹配
61
- var regex = oldName.trim();
62
- // @ts-ignore
63
- jsonString = jsonString.replaceAll(regex, newName);
64
- });
65
- return JSON.parse(jsonString);
66
- // 写回文件
67
- // fs.writeFileSync('./Page_ceshi1.json', jsonString, 'utf8');
68
- // console.log('组件重命名完成!');
69
- // console.log('/重命名映射关系:', renameObject);
70
- }