@openli1115/lowcode-edit-pro-table 1.0.96 → 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.
- package/build/docs/404.html +3 -3
- package/build/docs/_demos/:uuid +3 -3
- package/build/docs/colorful-button.html +3 -3
- package/build/docs/colorful-input.html +3 -3
- package/build/docs/index.html +3 -3
- package/build/docs/{umi.3e1d98ba.js → umi.64c6da37.js} +1 -1
- package/build/docs/~demos/:uuid.html +3 -3
- package/build/docs/~demos/colorful-button-demo.html +3 -3
- package/build/docs/~demos/colorful-input-demo.html +3 -3
- package/build/lowcode/assets-daily.json +13 -13
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +13 -13
- package/build/lowcode/meta.design.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +2 -2
- package/build/lowcode/view.js +2 -2
- package/dist/BizComps.js +3 -3
- package/dist/BizComps.js.map +1 -1
- package/es/components/ProCascaderSelect/index.js +67 -14
- package/lib/components/ProCascaderSelect/index.js +66 -13
- package/lowcode_es/meta.js +1 -1
- package/lowcode_lib/meta.js +1 -1
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
5
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
|
-
import { get } from 'lodash';
|
|
6
|
+
import { get, isEqual } from 'lodash';
|
|
7
7
|
import { resolveProScreenBinding } from "../utils";
|
|
8
8
|
import { getFormContext } from "../../context/FormProvider";
|
|
9
9
|
import { FORM_EMPTY_ARRAY } from "../../context/useComponentContext";
|
|
@@ -13,7 +13,8 @@ var _window$React = window.React,
|
|
|
13
13
|
useEffect = _window$React.useEffect,
|
|
14
14
|
useMemo = _window$React.useMemo,
|
|
15
15
|
useContext = _window$React.useContext,
|
|
16
|
-
useState = _window$React.useState
|
|
16
|
+
useState = _window$React.useState,
|
|
17
|
+
useRef = _window$React.useRef;
|
|
17
18
|
|
|
18
19
|
/** 与预览 previewFlowDebug 一致:window.__PREVIEW_FLOW_LOG__ === false 时静音 */
|
|
19
20
|
function previewFlowCascader(tag, detail) {
|
|
@@ -169,19 +170,43 @@ function normalizeCascaderPath(v, dataSource) {
|
|
|
169
170
|
return tryExpandByLeaf(toStr(v), [toStr(v)]);
|
|
170
171
|
}
|
|
171
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
|
+
}
|
|
172
189
|
try {
|
|
173
|
-
var
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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 字符串 */
|
|
184
208
|
}
|
|
209
|
+
return tryExpandByLeaf(trimmed, [trimmed]);
|
|
185
210
|
}
|
|
186
211
|
return [];
|
|
187
212
|
}
|
|
@@ -345,6 +370,34 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
|
|
|
345
370
|
var raw = Array.isArray(dataSource) ? dataSource : Array.isArray(options) ? options : [];
|
|
346
371
|
return mapToFusionCascaderTree(raw);
|
|
347
372
|
}, [dataSource, options]);
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* 屏幕结构(customType 3)等:接口常回标量如 current_status: "2976";级联需要完整路径 ['父','子']。
|
|
376
|
+
* 在 dataSource(children 树)就绪后,用 normalizeCascaderPath 反查并写回表单,避免初始化只存叶子、展示依赖异步树。
|
|
377
|
+
* structureName / structureField 来自 schema,不硬编码。
|
|
378
|
+
*/
|
|
379
|
+
var pathPersistAttemptsRef = useRef(new Set());
|
|
380
|
+
useEffect(function () {
|
|
381
|
+
pathPersistAttemptsRef.current.clear();
|
|
382
|
+
}, [fieldPath, cascaderOptions]);
|
|
383
|
+
useEffect(function () {
|
|
384
|
+
if (!fieldPath) return;
|
|
385
|
+
if (cascaderOptions.length === 0) return;
|
|
386
|
+
var expanded = normalizeCascaderPath(value, cascaderOptions);
|
|
387
|
+
if (!Array.isArray(expanded) || expanded.length === 0) return;
|
|
388
|
+
if (isEqual(value, expanded)) return;
|
|
389
|
+
var attemptKey = JSON.stringify(value) + "\u2192" + JSON.stringify(expanded);
|
|
390
|
+
if (pathPersistAttemptsRef.current.has(attemptKey)) return;
|
|
391
|
+
pathPersistAttemptsRef.current.add(attemptKey);
|
|
392
|
+
commit(expanded);
|
|
393
|
+
previewFlowCascader('persistScalarOrPartialToPath', {
|
|
394
|
+
fieldPath: fieldPath,
|
|
395
|
+
structureName: structureName,
|
|
396
|
+
structureField: structureField,
|
|
397
|
+
from: typeof value === 'object' ? JSON.stringify(value).slice(0, 160) : String(value).slice(0, 80),
|
|
398
|
+
expanded: expanded
|
|
399
|
+
});
|
|
400
|
+
}, [fieldPath, value, cascaderOptions, commit, structureName, structureField]);
|
|
348
401
|
var handleChange = function handleChange(newValue, _data, extra) {
|
|
349
402
|
var next = cascaderChangeToPath(newValue, extra);
|
|
350
403
|
previewFlowCascader('onChange', {
|
|
@@ -375,7 +428,7 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
|
|
|
375
428
|
if (Array.isArray(parsed) && parsed.length > 0) {
|
|
376
429
|
return toStr(parsed[parsed.length - 1]);
|
|
377
430
|
}
|
|
378
|
-
} catch (
|
|
431
|
+
} catch (_unused3) {
|
|
379
432
|
return value;
|
|
380
433
|
}
|
|
381
434
|
return value;
|
|
@@ -18,7 +18,8 @@ var _window$React = window.React,
|
|
|
18
18
|
useEffect = _window$React.useEffect,
|
|
19
19
|
useMemo = _window$React.useMemo,
|
|
20
20
|
useContext = _window$React.useContext,
|
|
21
|
-
useState = _window$React.useState
|
|
21
|
+
useState = _window$React.useState,
|
|
22
|
+
useRef = _window$React.useRef;
|
|
22
23
|
|
|
23
24
|
/** 与预览 previewFlowDebug 一致:window.__PREVIEW_FLOW_LOG__ === false 时静音 */
|
|
24
25
|
function previewFlowCascader(tag, detail) {
|
|
@@ -174,19 +175,43 @@ function normalizeCascaderPath(v, dataSource) {
|
|
|
174
175
|
return tryExpandByLeaf(toStr(v), [toStr(v)]);
|
|
175
176
|
}
|
|
176
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
|
+
}
|
|
177
194
|
try {
|
|
178
|
-
var
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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 字符串 */
|
|
189
213
|
}
|
|
214
|
+
return tryExpandByLeaf(trimmed, [trimmed]);
|
|
190
215
|
}
|
|
191
216
|
return [];
|
|
192
217
|
}
|
|
@@ -350,6 +375,34 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
|
|
|
350
375
|
var raw = Array.isArray(dataSource) ? dataSource : Array.isArray(options) ? options : [];
|
|
351
376
|
return mapToFusionCascaderTree(raw);
|
|
352
377
|
}, [dataSource, options]);
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* 屏幕结构(customType 3)等:接口常回标量如 current_status: "2976";级联需要完整路径 ['父','子']。
|
|
381
|
+
* 在 dataSource(children 树)就绪后,用 normalizeCascaderPath 反查并写回表单,避免初始化只存叶子、展示依赖异步树。
|
|
382
|
+
* structureName / structureField 来自 schema,不硬编码。
|
|
383
|
+
*/
|
|
384
|
+
var pathPersistAttemptsRef = useRef(new Set());
|
|
385
|
+
useEffect(function () {
|
|
386
|
+
pathPersistAttemptsRef.current.clear();
|
|
387
|
+
}, [fieldPath, cascaderOptions]);
|
|
388
|
+
useEffect(function () {
|
|
389
|
+
if (!fieldPath) return;
|
|
390
|
+
if (cascaderOptions.length === 0) return;
|
|
391
|
+
var expanded = normalizeCascaderPath(value, cascaderOptions);
|
|
392
|
+
if (!Array.isArray(expanded) || expanded.length === 0) return;
|
|
393
|
+
if ((0, _lodash.isEqual)(value, expanded)) return;
|
|
394
|
+
var attemptKey = JSON.stringify(value) + "\u2192" + JSON.stringify(expanded);
|
|
395
|
+
if (pathPersistAttemptsRef.current.has(attemptKey)) return;
|
|
396
|
+
pathPersistAttemptsRef.current.add(attemptKey);
|
|
397
|
+
commit(expanded);
|
|
398
|
+
previewFlowCascader('persistScalarOrPartialToPath', {
|
|
399
|
+
fieldPath: fieldPath,
|
|
400
|
+
structureName: structureName,
|
|
401
|
+
structureField: structureField,
|
|
402
|
+
from: typeof value === 'object' ? JSON.stringify(value).slice(0, 160) : String(value).slice(0, 80),
|
|
403
|
+
expanded: expanded
|
|
404
|
+
});
|
|
405
|
+
}, [fieldPath, value, cascaderOptions, commit, structureName, structureField]);
|
|
353
406
|
var handleChange = function handleChange(newValue, _data, extra) {
|
|
354
407
|
var next = cascaderChangeToPath(newValue, extra);
|
|
355
408
|
previewFlowCascader('onChange', {
|
|
@@ -380,7 +433,7 @@ var ProCascaderSelect = function ProCascaderSelect(props) {
|
|
|
380
433
|
if (Array.isArray(parsed) && parsed.length > 0) {
|
|
381
434
|
return toStr(parsed[parsed.length - 1]);
|
|
382
435
|
}
|
|
383
|
-
} catch (
|
|
436
|
+
} catch (_unused3) {
|
|
384
437
|
return value;
|
|
385
438
|
}
|
|
386
439
|
return value;
|
package/lowcode_es/meta.js
CHANGED
|
@@ -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.
|
|
104
|
+
version = '1.0.98';
|
|
105
105
|
}
|
|
106
106
|
if (basicLibraryVersion === void 0) {
|
|
107
107
|
basicLibraryVersion = {
|
package/lowcode_lib/meta.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
109
|
+
"homepage": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.98/build/index.html"
|
|
110
110
|
}
|