@openli1115/lowcode-edit-pro-table 1.0.97 → 1.0.98

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.
@@ -170,19 +170,43 @@ function normalizeCascaderPath(v, dataSource) {
170
170
  return tryExpandByLeaf(toStr(v), [toStr(v)]);
171
171
  }
172
172
  if (typeof v === 'string' && v.trim()) {
173
+ var trimmed = v.trim();
174
+ /** JSON.parse("2976") 会得到数字 2976,若误判为非数组并 return [],级联路径永远为空 */
175
+ if (trimmed.startsWith('[')) {
176
+ try {
177
+ var parsed = JSON.parse(trimmed);
178
+ if (!Array.isArray(parsed)) return [];
179
+ var _path = parsed.map(function (x) {
180
+ return toStr(x);
181
+ });
182
+ if (_path.length === 0) return [];
183
+ if (isValidPathInTree(dataSource, _path)) return _path;
184
+ return tryExpandByLeaf(_path[_path.length - 1], _path);
185
+ } catch (_unused) {
186
+ return tryExpandByLeaf(v, [v]);
187
+ }
188
+ }
173
189
  try {
174
- var parsed = JSON.parse(v);
175
- if (!Array.isArray(parsed)) return [];
176
- var _path = parsed.map(function (x) {
177
- return toStr(x);
178
- });
179
- if (_path.length === 0) return [];
180
- if (isValidPathInTree(dataSource, _path)) return _path;
181
- return tryExpandByLeaf(_path[_path.length - 1], _path);
182
- } catch (_unused) {
183
- /** 历史或接口单值回填时,当作叶子值反查完整路径 */
184
- return tryExpandByLeaf(v, [v]);
190
+ var _parsed = JSON.parse(trimmed);
191
+ if (Array.isArray(_parsed)) {
192
+ var _path2 = _parsed.map(function (x) {
193
+ return toStr(x);
194
+ });
195
+ if (_path2.length === 0) return [];
196
+ if (isValidPathInTree(dataSource, _path2)) return _path2;
197
+ return tryExpandByLeaf(_path2[_path2.length - 1], _path2);
198
+ }
199
+ if (typeof _parsed === 'number' && !Number.isNaN(_parsed)) {
200
+ var leaf = toStr(_parsed);
201
+ return tryExpandByLeaf(leaf, [leaf]);
202
+ }
203
+ if (typeof _parsed === 'string' && _parsed.trim()) {
204
+ return tryExpandByLeaf(_parsed, [_parsed]);
205
+ }
206
+ } catch (_unused2) {
207
+ /** 非 JSON 或单值 id 字符串 */
185
208
  }
209
+ return tryExpandByLeaf(trimmed, [trimmed]);
186
210
  }
187
211
  return [];
188
212
  }
@@ -404,7 +428,7 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
404
428
  if (Array.isArray(parsed) && parsed.length > 0) {
405
429
  return toStr(parsed[parsed.length - 1]);
406
430
  }
407
- } catch (_unused2) {
431
+ } catch (_unused3) {
408
432
  return value;
409
433
  }
410
434
  return value;
@@ -175,19 +175,43 @@ function normalizeCascaderPath(v, dataSource) {
175
175
  return tryExpandByLeaf(toStr(v), [toStr(v)]);
176
176
  }
177
177
  if (typeof v === 'string' && v.trim()) {
178
+ var trimmed = v.trim();
179
+ /** JSON.parse("2976") 会得到数字 2976,若误判为非数组并 return [],级联路径永远为空 */
180
+ if (trimmed.startsWith('[')) {
181
+ try {
182
+ var parsed = JSON.parse(trimmed);
183
+ if (!Array.isArray(parsed)) return [];
184
+ var _path = parsed.map(function (x) {
185
+ return toStr(x);
186
+ });
187
+ if (_path.length === 0) return [];
188
+ if (isValidPathInTree(dataSource, _path)) return _path;
189
+ return tryExpandByLeaf(_path[_path.length - 1], _path);
190
+ } catch (_unused) {
191
+ return tryExpandByLeaf(v, [v]);
192
+ }
193
+ }
178
194
  try {
179
- var parsed = JSON.parse(v);
180
- if (!Array.isArray(parsed)) return [];
181
- var _path = parsed.map(function (x) {
182
- return toStr(x);
183
- });
184
- if (_path.length === 0) return [];
185
- if (isValidPathInTree(dataSource, _path)) return _path;
186
- return tryExpandByLeaf(_path[_path.length - 1], _path);
187
- } catch (_unused) {
188
- /** 历史或接口单值回填时,当作叶子值反查完整路径 */
189
- return tryExpandByLeaf(v, [v]);
195
+ var _parsed = JSON.parse(trimmed);
196
+ if (Array.isArray(_parsed)) {
197
+ var _path2 = _parsed.map(function (x) {
198
+ return toStr(x);
199
+ });
200
+ if (_path2.length === 0) return [];
201
+ if (isValidPathInTree(dataSource, _path2)) return _path2;
202
+ return tryExpandByLeaf(_path2[_path2.length - 1], _path2);
203
+ }
204
+ if (typeof _parsed === 'number' && !Number.isNaN(_parsed)) {
205
+ var leaf = toStr(_parsed);
206
+ return tryExpandByLeaf(leaf, [leaf]);
207
+ }
208
+ if (typeof _parsed === 'string' && _parsed.trim()) {
209
+ return tryExpandByLeaf(_parsed, [_parsed]);
210
+ }
211
+ } catch (_unused2) {
212
+ /** 非 JSON 或单值 id 字符串 */
190
213
  }
214
+ return tryExpandByLeaf(trimmed, [trimmed]);
191
215
  }
192
216
  return [];
193
217
  }
@@ -409,7 +433,7 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
409
433
  if (Array.isArray(parsed) && parsed.length > 0) {
410
434
  return toStr(parsed[parsed.length - 1]);
411
435
  }
412
- } catch (_unused2) {
436
+ } catch (_unused3) {
413
437
  return value;
414
438
  }
415
439
  return value;
@@ -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.97';
104
+ version = '1.0.98';
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.97';
109
+ version = '1.0.98';
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.97",
3
+ "version": "1.0.98",
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.97/build/lowcode/assets-prod.json"
104
+ "materialSchema": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.98/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.97/build/index.html"
109
+ "homepage": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.98/build/index.html"
110
110
  }