@openli1115/lowcode-edit-pro-table 1.0.58 → 1.0.60

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.
@@ -7,11 +7,23 @@ import { useProBoundValue } from "../../context/useProBoundValue";
7
7
  import { FORM_EMPTY_ARRAY } from "../../context/useComponentContext";
8
8
  var createElement = window.React.createElement;
9
9
  function normalizeCascaderPath(v) {
10
- if (Array.isArray(v)) return v.slice();
10
+ if (Array.isArray(v)) {
11
+ return v.filter(function (x) {
12
+ return x != null && x !== '';
13
+ }).map(function (x) {
14
+ return String(x);
15
+ });
16
+ }
17
+ if (typeof v === 'number' && !Number.isNaN(v)) {
18
+ /** 表单里有时是数字 id(2977),Fusion dataSource 已 string 化,需对齐 */
19
+ return [String(v)];
20
+ }
11
21
  if (typeof v === 'string' && v.trim()) {
12
22
  try {
13
23
  var parsed = JSON.parse(v);
14
- return Array.isArray(parsed) ? parsed.slice() : [];
24
+ return Array.isArray(parsed) ? parsed.map(function (x) {
25
+ return String(x);
26
+ }) : [];
15
27
  } catch (_unused) {
16
28
  /** 历史或单值存成非 JSON 字符串时,当作单选叶子 value */
17
29
  return [v];
@@ -30,12 +42,15 @@ function cascaderChangeToPath(newValue, extra) {
30
42
  var nodes = extra === null || extra === void 0 ? void 0 : extra.selectedPath;
31
43
  if (Array.isArray(nodes) && nodes.length > 0) {
32
44
  return nodes.map(function (n) {
33
- return n != null && 'value' in n ? n.value : n;
45
+ if (n != null && typeof n === 'object' && 'value' in n) {
46
+ return String(n.value);
47
+ }
48
+ return n == null ? '' : String(n);
34
49
  }).filter(function (x) {
35
- return x != null && x !== '';
50
+ return x !== '';
36
51
  });
37
52
  }
38
- return [newValue];
53
+ return [String(newValue)];
39
54
  }
40
55
  var ProCascaderSelect = function ProCascaderSelect(props) {
41
56
  var screen_structure = props.screen_structure,
@@ -70,7 +85,7 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
70
85
  var displayValue = normalizeCascaderPath(value);
71
86
  return /*#__PURE__*/React.createElement("span", {
72
87
  className: "field-wrapper " + (disableEdit ? 'disable-edit' : 'enable-edit')
73
- }, /*#__PURE__*/React.createElement(_CascaderSelect, _extends({}, restProps, {
88
+ }, /*#__PURE__*/React.createElement(_CascaderSelect, _extends({}, props, {
74
89
  readOnly: disableEdit ? true : readOnlyProp,
75
90
  disabled: disabledProp,
76
91
  dataSource: dataSource,
@@ -6,7 +6,7 @@ var createContext = React.createContext,
6
6
  useMemo = React.useMemo,
7
7
  useRef = React.useRef,
8
8
  useState = React.useState;
9
- import { get, set, isEqual } from 'lodash';
9
+ import { get, set, isEqual, cloneDeep } from 'lodash';
10
10
 
11
11
  // formContext.ts
12
12
  var FormContext;
@@ -58,7 +58,9 @@ export var FormProvider = function FormProvider(_ref) {
58
58
  setValues(function (prev) {
59
59
  // 使用浅比较检查值是否实际变化
60
60
  if (isEqual(get(prev, path), value)) return prev;
61
- var newValues = _extends({}, prev);
61
+
62
+ /** 必须深拷贝:浅拷贝 + set 会与 prev / previewStore 共用嵌套引用,deepEqual 会因 a===b 误判「无变化」而跳过同步 */
63
+ var newValues = cloneDeep(prev);
62
64
  set(newValues, path, value);
63
65
  console.log("[FormProvider] \uD83D\uDCDD Set field '" + path + "' to:", value);
64
66
 
@@ -12,11 +12,23 @@ var _useComponentContext = require("../../context/useComponentContext");
12
12
  var _excluded = ["screen_structure", "screen_structure_field", "screen_inner_id", "range_inner_table", "dataSource", "disableEdit", "readOnly", "disabled", "value", "onChange", "defaultValue"];
13
13
  var createElement = window.React.createElement;
14
14
  function normalizeCascaderPath(v) {
15
- if (Array.isArray(v)) return v.slice();
15
+ if (Array.isArray(v)) {
16
+ return v.filter(function (x) {
17
+ return x != null && x !== '';
18
+ }).map(function (x) {
19
+ return String(x);
20
+ });
21
+ }
22
+ if (typeof v === 'number' && !Number.isNaN(v)) {
23
+ /** 表单里有时是数字 id(2977),Fusion dataSource 已 string 化,需对齐 */
24
+ return [String(v)];
25
+ }
16
26
  if (typeof v === 'string' && v.trim()) {
17
27
  try {
18
28
  var parsed = JSON.parse(v);
19
- return Array.isArray(parsed) ? parsed.slice() : [];
29
+ return Array.isArray(parsed) ? parsed.map(function (x) {
30
+ return String(x);
31
+ }) : [];
20
32
  } catch (_unused) {
21
33
  /** 历史或单值存成非 JSON 字符串时,当作单选叶子 value */
22
34
  return [v];
@@ -35,12 +47,15 @@ function cascaderChangeToPath(newValue, extra) {
35
47
  var nodes = extra === null || extra === void 0 ? void 0 : extra.selectedPath;
36
48
  if (Array.isArray(nodes) && nodes.length > 0) {
37
49
  return nodes.map(function (n) {
38
- return n != null && 'value' in n ? n.value : n;
50
+ if (n != null && typeof n === 'object' && 'value' in n) {
51
+ return String(n.value);
52
+ }
53
+ return n == null ? '' : String(n);
39
54
  }).filter(function (x) {
40
- return x != null && x !== '';
55
+ return x !== '';
41
56
  });
42
57
  }
43
- return [newValue];
58
+ return [String(newValue)];
44
59
  }
45
60
  var ProCascaderSelect = function ProCascaderSelect(props) {
46
61
  var screen_structure = props.screen_structure,
@@ -75,7 +90,7 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
75
90
  var displayValue = normalizeCascaderPath(value);
76
91
  return /*#__PURE__*/React.createElement("span", {
77
92
  className: "field-wrapper " + (disableEdit ? 'disable-edit' : 'enable-edit')
78
- }, /*#__PURE__*/React.createElement(_cascaderSelect["default"], (0, _extends2["default"])({}, restProps, {
93
+ }, /*#__PURE__*/React.createElement(_cascaderSelect["default"], (0, _extends2["default"])({}, props, {
79
94
  readOnly: disableEdit ? true : readOnlyProp,
80
95
  disabled: disabledProp,
81
96
  dataSource: dataSource,
@@ -64,7 +64,9 @@ var FormProvider = exports.FormProvider = function FormProvider(_ref) {
64
64
  setValues(function (prev) {
65
65
  // 使用浅比较检查值是否实际变化
66
66
  if ((0, _lodash.isEqual)((0, _lodash.get)(prev, path), value)) return prev;
67
- var newValues = (0, _extends2["default"])({}, prev);
67
+
68
+ /** 必须深拷贝:浅拷贝 + set 会与 prev / previewStore 共用嵌套引用,deepEqual 会因 a===b 误判「无变化」而跳过同步 */
69
+ var newValues = (0, _lodash.cloneDeep)(prev);
68
70
  (0, _lodash.set)(newValues, path, value);
69
71
  console.log("[FormProvider] \uD83D\uDCDD Set field '" + path + "' to:", value);
70
72
 
@@ -101,7 +101,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
101
101
  packageName = '@openli1115/lowcode-edit-pro-table';
102
102
  }
103
103
  if (version === void 0) {
104
- version = '1.0.58';
104
+ version = '1.0.60';
105
105
  }
106
106
  if (basicLibraryVersion === void 0) {
107
107
  basicLibraryVersion = {
@@ -106,7 +106,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
106
106
  packageName = '@openli1115/lowcode-edit-pro-table';
107
107
  }
108
108
  if (version === void 0) {
109
- version = '1.0.58';
109
+ version = '1.0.60';
110
110
  }
111
111
  if (basicLibraryVersion === void 0) {
112
112
  basicLibraryVersion = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openli1115/lowcode-edit-pro-table",
3
- "version": "1.0.58",
3
+ "version": "1.0.60",
4
4
  "description": "@openli1115/lowcode-edit-pro-table",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -101,10 +101,10 @@
101
101
  },
102
102
  "componentConfig": {
103
103
  "isComponentLibrary": true,
104
- "materialSchema": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.58/build/lowcode/assets-prod.json"
104
+ "materialSchema": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.60/build/lowcode/assets-prod.json"
105
105
  },
106
106
  "lcMeta": {
107
107
  "type": "component"
108
108
  },
109
- "homepage": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.58/build/index.html"
109
+ "homepage": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.60/build/index.html"
110
110
  }