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

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.
@@ -15,16 +15,6 @@ var _window$React = window.React,
15
15
  useContext = _window$React.useContext,
16
16
  useState = _window$React.useState,
17
17
  useRef = _window$React.useRef;
18
-
19
- /** 与预览 previewFlowDebug 一致:window.__PREVIEW_FLOW_LOG__ === false 时静音 */
20
- function previewFlowCascader(tag, detail) {
21
- if (typeof window !== 'undefined' && window.__PREVIEW_FLOW_LOG__ === false) {
22
- return;
23
- }
24
- console.log('[PreviewFlow][Cascader]', tag, detail);
25
- /** 避免控制台开「正则」筛选时,[] 被当成字符类导致搜不到;用纯文本筛「PreviewFlow Cascader」即可 */
26
- console.log('PreviewFlow Cascader ·', tag, detail);
27
- }
28
18
  function toStr(v) {
29
19
  if (v == null) return '';
30
20
  return String(v);
@@ -170,19 +160,43 @@ function normalizeCascaderPath(v, dataSource) {
170
160
  return tryExpandByLeaf(toStr(v), [toStr(v)]);
171
161
  }
172
162
  if (typeof v === 'string' && v.trim()) {
163
+ var trimmed = v.trim();
164
+ /** JSON.parse("2976") 会得到数字 2976,若误判为非数组并 return [],级联路径永远为空 */
165
+ if (trimmed.startsWith('[')) {
166
+ try {
167
+ var parsed = JSON.parse(trimmed);
168
+ if (!Array.isArray(parsed)) return [];
169
+ var _path = parsed.map(function (x) {
170
+ return toStr(x);
171
+ });
172
+ if (_path.length === 0) return [];
173
+ if (isValidPathInTree(dataSource, _path)) return _path;
174
+ return tryExpandByLeaf(_path[_path.length - 1], _path);
175
+ } catch (_unused) {
176
+ return tryExpandByLeaf(v, [v]);
177
+ }
178
+ }
173
179
  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]);
180
+ var _parsed = JSON.parse(trimmed);
181
+ if (Array.isArray(_parsed)) {
182
+ var _path2 = _parsed.map(function (x) {
183
+ return toStr(x);
184
+ });
185
+ if (_path2.length === 0) return [];
186
+ if (isValidPathInTree(dataSource, _path2)) return _path2;
187
+ return tryExpandByLeaf(_path2[_path2.length - 1], _path2);
188
+ }
189
+ if (typeof _parsed === 'number' && !Number.isNaN(_parsed)) {
190
+ var leaf = toStr(_parsed);
191
+ return tryExpandByLeaf(leaf, [leaf]);
192
+ }
193
+ if (typeof _parsed === 'string' && _parsed.trim()) {
194
+ return tryExpandByLeaf(_parsed, [_parsed]);
195
+ }
196
+ } catch (_unused2) {
197
+ /** 非 JSON 或单值 id 字符串 */
185
198
  }
199
+ return tryExpandByLeaf(trimmed, [trimmed]);
186
200
  }
187
201
  return [];
188
202
  }
@@ -366,22 +380,9 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
366
380
  if (pathPersistAttemptsRef.current.has(attemptKey)) return;
367
381
  pathPersistAttemptsRef.current.add(attemptKey);
368
382
  commit(expanded);
369
- previewFlowCascader('persistScalarOrPartialToPath', {
370
- fieldPath: fieldPath,
371
- structureName: structureName,
372
- structureField: structureField,
373
- from: typeof value === 'object' ? JSON.stringify(value).slice(0, 160) : String(value).slice(0, 80),
374
- expanded: expanded
375
- });
376
383
  }, [fieldPath, value, cascaderOptions, commit, structureName, structureField]);
377
384
  var handleChange = function handleChange(newValue, _data, extra) {
378
385
  var next = cascaderChangeToPath(newValue, extra);
379
- previewFlowCascader('onChange', {
380
- fieldPath: fieldPath,
381
- rawValue: newValue,
382
- normalizedPath: next,
383
- selectedPathLen: Array.isArray(extra === null || extra === void 0 ? void 0 : extra.selectedPath) ? extra.selectedPath.length : 0
384
- });
385
386
  commit(next);
386
387
  schemaOnChange === null || schemaOnChange === void 0 ? void 0 : schemaOnChange(next, structureName, structureField);
387
388
  };
@@ -390,31 +391,6 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
390
391
  var displayValue = useMemo(function () {
391
392
  return normalizeCascaderPath(value, cascaderOptions);
392
393
  }, [value, cascaderOptions]);
393
- var incomingLeafId = useMemo(function () {
394
- if (Array.isArray(value)) {
395
- var cleaned = value.filter(function (x) {
396
- return x != null && x !== '';
397
- });
398
- return cleaned.length > 0 ? toStr(cleaned[cleaned.length - 1]) : '';
399
- }
400
- if (typeof value === 'number' && !Number.isNaN(value)) return toStr(value);
401
- if (typeof value === 'string' && value.trim()) {
402
- try {
403
- var parsed = JSON.parse(value);
404
- if (Array.isArray(parsed) && parsed.length > 0) {
405
- return toStr(parsed[parsed.length - 1]);
406
- }
407
- } catch (_unused2) {
408
- return value;
409
- }
410
- return value;
411
- }
412
- return '';
413
- }, [value]);
414
- var packedPathFromLeaf = useMemo(function () {
415
- if (!incomingLeafId) return [];
416
- return findPathByNodeValue(cascaderOptions, incomingLeafId);
417
- }, [cascaderOptions, incomingLeafId]);
418
394
 
419
395
  /**
420
396
  * 回显兼容:
@@ -429,24 +405,6 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
429
405
  if (path.length === 0) return '';
430
406
  return path[path.length - 1];
431
407
  }, [displayValue, isMultiple]);
432
- useEffect(function () {
433
- var leaf = displayValue.length > 0 ? displayValue[displayValue.length - 1] : '';
434
- var resolvedPathFromLeaf = leaf ? findPathByNodeValue(cascaderOptions, toStr(leaf)) : [];
435
- previewFlowCascader('echo', {
436
- fieldPath: fieldPath,
437
- structureName: structureName,
438
- structureField: structureField,
439
- rangeInnerTable: rangeInnerTable,
440
- incomingLeafId: incomingLeafId,
441
- packedPathFromLeafLen: packedPathFromLeaf.length,
442
- rawBoundValuePreview: typeof value === 'object' ? JSON.stringify(value).slice(0, 120) : String(value).slice(0, 80),
443
- normalizedDisplayPath: displayValue,
444
- fusionValuePreview: typeof valueForFusion === 'object' ? JSON.stringify(valueForFusion).slice(0, 80) : String(valueForFusion).slice(0, 80),
445
- isMultiple: isMultiple,
446
- optionsCount: cascaderOptions.length,
447
- resolvedPathFromLeafLen: resolvedPathFromLeaf.length
448
- });
449
- }, [fieldPath, structureName, structureField, rangeInnerTable, incomingLeafId, packedPathFromLeaf, value, displayValue, valueForFusion, isMultiple, cascaderOptions]);
450
408
 
451
409
  /** dataSource 未就绪或异步时,仍用自定义文案兜底 */
452
410
  var schemaDisplayRender = props.displayRender;
@@ -20,16 +20,6 @@ var _window$React = window.React,
20
20
  useContext = _window$React.useContext,
21
21
  useState = _window$React.useState,
22
22
  useRef = _window$React.useRef;
23
-
24
- /** 与预览 previewFlowDebug 一致:window.__PREVIEW_FLOW_LOG__ === false 时静音 */
25
- function previewFlowCascader(tag, detail) {
26
- if (typeof window !== 'undefined' && window.__PREVIEW_FLOW_LOG__ === false) {
27
- return;
28
- }
29
- console.log('[PreviewFlow][Cascader]', tag, detail);
30
- /** 避免控制台开「正则」筛选时,[] 被当成字符类导致搜不到;用纯文本筛「PreviewFlow Cascader」即可 */
31
- console.log('PreviewFlow Cascader ·', tag, detail);
32
- }
33
23
  function toStr(v) {
34
24
  if (v == null) return '';
35
25
  return String(v);
@@ -175,19 +165,43 @@ function normalizeCascaderPath(v, dataSource) {
175
165
  return tryExpandByLeaf(toStr(v), [toStr(v)]);
176
166
  }
177
167
  if (typeof v === 'string' && v.trim()) {
168
+ var trimmed = v.trim();
169
+ /** JSON.parse("2976") 会得到数字 2976,若误判为非数组并 return [],级联路径永远为空 */
170
+ if (trimmed.startsWith('[')) {
171
+ try {
172
+ var parsed = JSON.parse(trimmed);
173
+ if (!Array.isArray(parsed)) return [];
174
+ var _path = parsed.map(function (x) {
175
+ return toStr(x);
176
+ });
177
+ if (_path.length === 0) return [];
178
+ if (isValidPathInTree(dataSource, _path)) return _path;
179
+ return tryExpandByLeaf(_path[_path.length - 1], _path);
180
+ } catch (_unused) {
181
+ return tryExpandByLeaf(v, [v]);
182
+ }
183
+ }
178
184
  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]);
185
+ var _parsed = JSON.parse(trimmed);
186
+ if (Array.isArray(_parsed)) {
187
+ var _path2 = _parsed.map(function (x) {
188
+ return toStr(x);
189
+ });
190
+ if (_path2.length === 0) return [];
191
+ if (isValidPathInTree(dataSource, _path2)) return _path2;
192
+ return tryExpandByLeaf(_path2[_path2.length - 1], _path2);
193
+ }
194
+ if (typeof _parsed === 'number' && !Number.isNaN(_parsed)) {
195
+ var leaf = toStr(_parsed);
196
+ return tryExpandByLeaf(leaf, [leaf]);
197
+ }
198
+ if (typeof _parsed === 'string' && _parsed.trim()) {
199
+ return tryExpandByLeaf(_parsed, [_parsed]);
200
+ }
201
+ } catch (_unused2) {
202
+ /** 非 JSON 或单值 id 字符串 */
190
203
  }
204
+ return tryExpandByLeaf(trimmed, [trimmed]);
191
205
  }
192
206
  return [];
193
207
  }
@@ -371,22 +385,9 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
371
385
  if (pathPersistAttemptsRef.current.has(attemptKey)) return;
372
386
  pathPersistAttemptsRef.current.add(attemptKey);
373
387
  commit(expanded);
374
- previewFlowCascader('persistScalarOrPartialToPath', {
375
- fieldPath: fieldPath,
376
- structureName: structureName,
377
- structureField: structureField,
378
- from: typeof value === 'object' ? JSON.stringify(value).slice(0, 160) : String(value).slice(0, 80),
379
- expanded: expanded
380
- });
381
388
  }, [fieldPath, value, cascaderOptions, commit, structureName, structureField]);
382
389
  var handleChange = function handleChange(newValue, _data, extra) {
383
390
  var next = cascaderChangeToPath(newValue, extra);
384
- previewFlowCascader('onChange', {
385
- fieldPath: fieldPath,
386
- rawValue: newValue,
387
- normalizedPath: next,
388
- selectedPathLen: Array.isArray(extra === null || extra === void 0 ? void 0 : extra.selectedPath) ? extra.selectedPath.length : 0
389
- });
390
391
  commit(next);
391
392
  schemaOnChange === null || schemaOnChange === void 0 ? void 0 : schemaOnChange(next, structureName, structureField);
392
393
  };
@@ -395,31 +396,6 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
395
396
  var displayValue = useMemo(function () {
396
397
  return normalizeCascaderPath(value, cascaderOptions);
397
398
  }, [value, cascaderOptions]);
398
- var incomingLeafId = useMemo(function () {
399
- if (Array.isArray(value)) {
400
- var cleaned = value.filter(function (x) {
401
- return x != null && x !== '';
402
- });
403
- return cleaned.length > 0 ? toStr(cleaned[cleaned.length - 1]) : '';
404
- }
405
- if (typeof value === 'number' && !Number.isNaN(value)) return toStr(value);
406
- if (typeof value === 'string' && value.trim()) {
407
- try {
408
- var parsed = JSON.parse(value);
409
- if (Array.isArray(parsed) && parsed.length > 0) {
410
- return toStr(parsed[parsed.length - 1]);
411
- }
412
- } catch (_unused2) {
413
- return value;
414
- }
415
- return value;
416
- }
417
- return '';
418
- }, [value]);
419
- var packedPathFromLeaf = useMemo(function () {
420
- if (!incomingLeafId) return [];
421
- return findPathByNodeValue(cascaderOptions, incomingLeafId);
422
- }, [cascaderOptions, incomingLeafId]);
423
399
 
424
400
  /**
425
401
  * 回显兼容:
@@ -434,24 +410,6 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
434
410
  if (path.length === 0) return '';
435
411
  return path[path.length - 1];
436
412
  }, [displayValue, isMultiple]);
437
- useEffect(function () {
438
- var leaf = displayValue.length > 0 ? displayValue[displayValue.length - 1] : '';
439
- var resolvedPathFromLeaf = leaf ? findPathByNodeValue(cascaderOptions, toStr(leaf)) : [];
440
- previewFlowCascader('echo', {
441
- fieldPath: fieldPath,
442
- structureName: structureName,
443
- structureField: structureField,
444
- rangeInnerTable: rangeInnerTable,
445
- incomingLeafId: incomingLeafId,
446
- packedPathFromLeafLen: packedPathFromLeaf.length,
447
- rawBoundValuePreview: typeof value === 'object' ? JSON.stringify(value).slice(0, 120) : String(value).slice(0, 80),
448
- normalizedDisplayPath: displayValue,
449
- fusionValuePreview: typeof valueForFusion === 'object' ? JSON.stringify(valueForFusion).slice(0, 80) : String(valueForFusion).slice(0, 80),
450
- isMultiple: isMultiple,
451
- optionsCount: cascaderOptions.length,
452
- resolvedPathFromLeafLen: resolvedPathFromLeaf.length
453
- });
454
- }, [fieldPath, structureName, structureField, rangeInnerTable, incomingLeafId, packedPathFromLeaf, value, displayValue, valueForFusion, isMultiple, cascaderOptions]);
455
413
 
456
414
  /** dataSource 未就绪或异步时,仍用自定义文案兜底 */
457
415
  var schemaDisplayRender = props.displayRender;
@@ -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.99';
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.99';
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.99",
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.99/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.99/build/index.html"
110
110
  }