@next-core/brick-kit 2.135.1 → 2.136.2
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/CHANGELOG.md +30 -0
- package/dist/index.bundle.js +195 -116
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +195 -116
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/BrickNode.d.ts +1 -0
- package/dist/types/core/BrickNode.d.ts.map +1 -1
- package/dist/types/core/CustomForms/CustomFormContext.d.ts +8 -0
- package/dist/types/core/CustomForms/CustomFormContext.d.ts.map +1 -0
- package/dist/types/core/CustomForms/ExpandCustomForm.d.ts +2 -2
- package/dist/types/core/CustomForms/ExpandCustomForm.d.ts.map +1 -1
- package/dist/types/core/CustomForms/constants.d.ts +4 -0
- package/dist/types/core/CustomForms/constants.d.ts.map +1 -1
- package/dist/types/core/LocationContext.d.ts.map +1 -1
- package/dist/types/core/StoryboardContext.d.ts +2 -2
- package/dist/types/core/StoryboardContext.d.ts.map +1 -1
- package/dist/types/internal/bindListeners.d.ts +2 -1
- package/dist/types/internal/bindListeners.d.ts.map +1 -1
- package/dist/types/internal/evaluate.d.ts +1 -0
- package/dist/types/internal/evaluate.d.ts.map +1 -1
- package/dist/types/internal/setProperties.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.136.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.136.1...@next-core/brick-kit@2.136.2) (2022-09-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @next-core/brick-kit
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [2.136.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.136.0...@next-core/brick-kit@2.136.1) (2022-09-05)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* fix missing runtime brick in event callback ([a5b70be](https://github.com/easyops-cn/next-core/commit/a5b70be68bc6a856b78992320518d0a0e6a41128))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [2.136.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.135.1...@next-core/brick-kit@2.136.0) (2022-09-05)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* support context/state load/refresh callback ([4dfdd8b](https://github.com/easyops-cn/next-core/commit/4dfdd8bc8e91430a99857154237bae290c685329))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
## [2.135.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.135.0...@next-core/brick-kit@2.135.1) (2022-09-02)
|
|
7
37
|
|
|
8
38
|
**Note:** Version bump only for package @next-core/brick-kit
|
package/dist/index.bundle.js
CHANGED
|
@@ -1971,7 +1971,7 @@
|
|
|
1971
1971
|
return (_this$data$get = this.data.get(name)) === null || _this$data$get === void 0 ? void 0 : _this$data$get.value;
|
|
1972
1972
|
}
|
|
1973
1973
|
|
|
1974
|
-
updateValue(name, value, method) {
|
|
1974
|
+
updateValue(name, value, method, callback) {
|
|
1975
1975
|
var _item$eventTarget2;
|
|
1976
1976
|
|
|
1977
1977
|
if (!this.data.has(name)) {
|
|
@@ -1994,36 +1994,58 @@
|
|
|
1994
1994
|
// eslint-disable-next-line no-console
|
|
1995
1995
|
console.error("Unexpected storyboard context \"".concat(name, "\", expected \"free-variable\", received \"").concat(item.type, "\"."));
|
|
1996
1996
|
return;
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1997
|
+
}
|
|
1999
1998
|
|
|
2000
1999
|
if (method === "refresh" || method === "load") {
|
|
2001
2000
|
if (!item.load) {
|
|
2002
2001
|
throw new Error("You can not ".concat(method, " the storyboard context \"").concat(name, "\" which has no resolve."));
|
|
2003
2002
|
}
|
|
2004
2003
|
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2004
|
+
var promise;
|
|
2005
|
+
|
|
2006
|
+
if (method === "load") {
|
|
2007
|
+
// Try to reuse previous request when calling `load`.
|
|
2008
|
+
if (item.loaded) {
|
|
2009
|
+
promise = Promise.resolve(item.value);
|
|
2010
|
+
} else if (item.loading) {
|
|
2011
|
+
promise = item.loading;
|
|
2012
|
+
}
|
|
2008
2013
|
}
|
|
2009
2014
|
|
|
2010
|
-
|
|
2015
|
+
if (!promise) {
|
|
2016
|
+
promise = item.loading = item.load(_objectSpread__default["default"]({
|
|
2017
|
+
cache: method === "load" ? "default" : "reload"
|
|
2018
|
+
}, value)); // Do not use the chained promise, since the callbacks need the original promise.
|
|
2011
2019
|
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2020
|
+
promise.then(val => {
|
|
2021
|
+
var _item$eventTarget;
|
|
2022
|
+
|
|
2023
|
+
item.loaded = true;
|
|
2024
|
+
item.value = val;
|
|
2025
|
+
(_item$eventTarget = item.eventTarget) === null || _item$eventTarget === void 0 ? void 0 : _item$eventTarget.dispatchEvent(new CustomEvent(this.tplContextId ? "state.change" : "context.change", {
|
|
2026
|
+
detail: item.value
|
|
2027
|
+
}));
|
|
2028
|
+
}, err => {
|
|
2029
|
+
// Let users to override error handling.
|
|
2030
|
+
if (!(callback !== null && callback !== void 0 && callback.error)) {
|
|
2031
|
+
handleHttpError(err);
|
|
2032
|
+
}
|
|
2033
|
+
});
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
if (callback) {
|
|
2037
|
+
var callbackFactory = eventCallbackFactory(callback, () => this.getResolveOptions(_internalApiGetCurrentContext()).mergedContext, null);
|
|
2038
|
+
promise.then(val => {
|
|
2039
|
+
callbackFactory("success")({
|
|
2040
|
+
value: val
|
|
2041
|
+
});
|
|
2042
|
+
callbackFactory("finally")();
|
|
2043
|
+
}, err => {
|
|
2044
|
+
callbackFactory("error")(err);
|
|
2045
|
+
callbackFactory("finally")();
|
|
2046
|
+
});
|
|
2047
|
+
}
|
|
2016
2048
|
|
|
2017
|
-
item.loading = false;
|
|
2018
|
-
item.loaded = true;
|
|
2019
|
-
item.value = val;
|
|
2020
|
-
(_item$eventTarget = item.eventTarget) === null || _item$eventTarget === void 0 ? void 0 : _item$eventTarget.dispatchEvent(new CustomEvent(this.tplContextId ? "state.change" : "context.change", {
|
|
2021
|
-
detail: item.value
|
|
2022
|
-
}));
|
|
2023
|
-
}, err => {
|
|
2024
|
-
item.loading = false;
|
|
2025
|
-
handleHttpError(err);
|
|
2026
|
-
});
|
|
2027
2049
|
return;
|
|
2028
2050
|
}
|
|
2029
2051
|
|
|
@@ -2321,6 +2343,22 @@
|
|
|
2321
2343
|
});
|
|
2322
2344
|
var getMedia = () => MEDIA;
|
|
2323
2345
|
|
|
2346
|
+
var FormContextMap = new Map();
|
|
2347
|
+
class CustomFormContext {
|
|
2348
|
+
constructor() {
|
|
2349
|
+
_defineProperty__default["default"](this, "formState", void 0);
|
|
2350
|
+
|
|
2351
|
+
_defineProperty__default["default"](this, "id", _.uniqueId("form-ctx-"));
|
|
2352
|
+
|
|
2353
|
+
FormContextMap.set(this.id, this);
|
|
2354
|
+
this.formState = new StoryboardContextWrapper();
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
}
|
|
2358
|
+
function getCustomFormContext(formContextId) {
|
|
2359
|
+
return FormContextMap.get(formContextId);
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2324
2362
|
var symbolForRaw = Symbol.for("pre.evaluated.raw");
|
|
2325
2363
|
var symbolForContext = Symbol.for("pre.evaluated.context");
|
|
2326
2364
|
function isPreEvaluated(raw) {
|
|
@@ -2393,6 +2431,7 @@
|
|
|
2393
2431
|
var attemptToVisitData = attemptToVisitGlobals.has("DATA");
|
|
2394
2432
|
var attemptToVisitTpl = attemptToVisitGlobals.has("TPL");
|
|
2395
2433
|
var attemptToVisitState = attemptToVisitGlobals.has("STATE");
|
|
2434
|
+
var attemptToVisitFormState = attemptToVisitGlobals.has("FORM_STATE");
|
|
2396
2435
|
var attemptToVisitTplOrState = attemptToVisitTpl || attemptToVisitState; // Ignore evaluating if `event` is missing in context.
|
|
2397
2436
|
// Since it should be evaluated during events handling.
|
|
2398
2437
|
|
|
@@ -2444,6 +2483,20 @@
|
|
|
2444
2483
|
}
|
|
2445
2484
|
}
|
|
2446
2485
|
|
|
2486
|
+
if (attemptToVisitFormState && runtimeContext.formContextId) {
|
|
2487
|
+
var formContext = getCustomFormContext(runtimeContext.formContextId);
|
|
2488
|
+
globalVariables.FORM_STATE = getDynamicReadOnlyProxy({
|
|
2489
|
+
get(target, key) {
|
|
2490
|
+
return formContext.formState.getValue(key);
|
|
2491
|
+
},
|
|
2492
|
+
|
|
2493
|
+
ownKeys() {
|
|
2494
|
+
return Array.from(formContext.formState.get().keys());
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2447
2500
|
var {
|
|
2448
2501
|
app: currentApp,
|
|
2449
2502
|
query,
|
|
@@ -2897,7 +2950,7 @@
|
|
|
2897
2950
|
|
|
2898
2951
|
if (preEvaluated || brickUtils.isEvaluable(value)) {
|
|
2899
2952
|
var runtimeContext = {};
|
|
2900
|
-
var keys = ["event", "tplContextId", "overrideApp", "appendI18nNamespace"];
|
|
2953
|
+
var keys = ["event", "tplContextId", "overrideApp", "appendI18nNamespace", "formContextId"];
|
|
2901
2954
|
|
|
2902
2955
|
for (var key of keys) {
|
|
2903
2956
|
if (context !== null && context !== void 0 && context[key]) {
|
|
@@ -6310,12 +6363,12 @@
|
|
|
6310
6363
|
case "context.replace":
|
|
6311
6364
|
case "context.refresh":
|
|
6312
6365
|
case "context.load":
|
|
6313
|
-
return builtinContextListenerFactory(method, handler.args, handler, context);
|
|
6366
|
+
return builtinContextListenerFactory(method, handler.args, handler, handler.callback, context);
|
|
6314
6367
|
|
|
6315
6368
|
case "state.update":
|
|
6316
6369
|
case "state.refresh":
|
|
6317
6370
|
case "state.load":
|
|
6318
|
-
return builtinStateListenerFactory(method, handler.args, handler, context);
|
|
6371
|
+
return builtinStateListenerFactory(method, handler.args, handler, handler.callback, context);
|
|
6319
6372
|
|
|
6320
6373
|
case "tpl.dispatchEvent":
|
|
6321
6374
|
return builtinTplDispatchEventFactory(handler.args, handler, context);
|
|
@@ -6444,7 +6497,7 @@
|
|
|
6444
6497
|
};
|
|
6445
6498
|
}
|
|
6446
6499
|
|
|
6447
|
-
function builtinContextListenerFactory(method, args, ifContainer, context) {
|
|
6500
|
+
function builtinContextListenerFactory(method, args, ifContainer, callback, context) {
|
|
6448
6501
|
return function (event) {
|
|
6449
6502
|
if (!looseCheckIf(ifContainer, _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
6450
6503
|
event
|
|
@@ -6455,11 +6508,11 @@
|
|
|
6455
6508
|
var storyboardContext = _internalApiGetStoryboardContextWrapper();
|
|
6456
6509
|
|
|
6457
6510
|
var [name, value] = argsFactory(args, context, event);
|
|
6458
|
-
storyboardContext.updateValue(name, value, method);
|
|
6511
|
+
storyboardContext.updateValue(name, value, method, callback);
|
|
6459
6512
|
};
|
|
6460
6513
|
}
|
|
6461
6514
|
|
|
6462
|
-
function builtinStateListenerFactory(method, args, ifContainer, context) {
|
|
6515
|
+
function builtinStateListenerFactory(method, args, ifContainer, callback, context) {
|
|
6463
6516
|
return function (event) {
|
|
6464
6517
|
if (!looseCheckIf(ifContainer, _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
6465
6518
|
event
|
|
@@ -6469,7 +6522,7 @@
|
|
|
6469
6522
|
|
|
6470
6523
|
var tplContext = getTplContext(context.tplContextId);
|
|
6471
6524
|
var [name, value] = argsFactory(args, context, event);
|
|
6472
|
-
tplContext.state.updateValue(name, value, method === "update" ? "replace" : method);
|
|
6525
|
+
tplContext.state.updateValue(name, value, method === "update" ? "replace" : method, callback);
|
|
6473
6526
|
};
|
|
6474
6527
|
}
|
|
6475
6528
|
|
|
@@ -6670,13 +6723,39 @@
|
|
|
6670
6723
|
};
|
|
6671
6724
|
}
|
|
6672
6725
|
|
|
6726
|
+
function eventCallbackFactory(callback, getContext, runtimeBrick) {
|
|
6727
|
+
return function callbackFactory(type) {
|
|
6728
|
+
return function (result) {
|
|
6729
|
+
if (callback !== null && callback !== void 0 && callback[type]) {
|
|
6730
|
+
try {
|
|
6731
|
+
var event = new CustomEvent("callback.".concat(type), {
|
|
6732
|
+
detail: result
|
|
6733
|
+
});
|
|
6734
|
+
var context = getContext();
|
|
6735
|
+
[].concat(callback[type]).forEach(eachHandler => {
|
|
6736
|
+
listenerFactory(eachHandler, context, runtimeBrick)(event);
|
|
6737
|
+
});
|
|
6738
|
+
} catch (err) {
|
|
6739
|
+
// Do not throw errors in `callback.success` or `callback.progress`,
|
|
6740
|
+
// to avoid the following triggering of `callback.error`.
|
|
6741
|
+
// eslint-disable-next-line
|
|
6742
|
+
console.error(err);
|
|
6743
|
+
}
|
|
6744
|
+
} else if (type === "error") {
|
|
6745
|
+
// eslint-disable-next-line
|
|
6746
|
+
console.error("Unhandled callback error:", result);
|
|
6747
|
+
}
|
|
6748
|
+
};
|
|
6749
|
+
};
|
|
6750
|
+
}
|
|
6751
|
+
|
|
6673
6752
|
function brickCallback(_x2, _x3, _x4, _x5, _x6, _x7, _x8) {
|
|
6674
6753
|
return _brickCallback.apply(this, arguments);
|
|
6675
6754
|
}
|
|
6676
6755
|
|
|
6677
6756
|
function _brickCallback() {
|
|
6678
6757
|
_brickCallback = _asyncToGenerator__default["default"](function* (target, handler, method, context, runtimeBrick, event, options) {
|
|
6679
|
-
var
|
|
6758
|
+
var _poll;
|
|
6680
6759
|
|
|
6681
6760
|
if (typeof target[method] !== "function") {
|
|
6682
6761
|
// eslint-disable-next-line no-console
|
|
@@ -6703,45 +6782,17 @@
|
|
|
6703
6782
|
};
|
|
6704
6783
|
}();
|
|
6705
6784
|
|
|
6706
|
-
|
|
6707
|
-
success,
|
|
6708
|
-
error,
|
|
6709
|
-
finally: finallyHook,
|
|
6710
|
-
progress
|
|
6711
|
-
} = (_handler$callback = handler.callback) !== null && _handler$callback !== void 0 ? _handler$callback : {};
|
|
6712
|
-
|
|
6713
|
-
if (!(success || error || finallyHook || progress)) {
|
|
6785
|
+
if (!handler.callback) {
|
|
6714
6786
|
task();
|
|
6715
6787
|
return;
|
|
6716
6788
|
}
|
|
6717
6789
|
|
|
6718
|
-
var callbackFactory = (
|
|
6719
|
-
if (specificHandler) {
|
|
6720
|
-
try {
|
|
6721
|
-
var _event = new CustomEvent(eventType, {
|
|
6722
|
-
detail: result
|
|
6723
|
-
});
|
|
6724
|
-
|
|
6725
|
-
[].concat(specificHandler).forEach(eachHandler => {
|
|
6726
|
-
listenerFactory(eachHandler, context, runtimeBrick)(_event);
|
|
6727
|
-
});
|
|
6728
|
-
} catch (err) {
|
|
6729
|
-
// Do not throw errors in `callback.success` or `callback.progress`,
|
|
6730
|
-
// to avoid the following triggering of `callback.error`.
|
|
6731
|
-
// eslint-disable-next-line
|
|
6732
|
-
console.error(err);
|
|
6733
|
-
}
|
|
6734
|
-
} else if (eventType === "callback.error") {
|
|
6735
|
-
// eslint-disable-next-line
|
|
6736
|
-
console.error("Unhandled callback error:", result);
|
|
6737
|
-
}
|
|
6738
|
-
};
|
|
6739
|
-
|
|
6790
|
+
var callbackFactory = eventCallbackFactory(handler.callback, () => context, runtimeBrick);
|
|
6740
6791
|
var pollableCallback = {
|
|
6741
|
-
progress: callbackFactory("
|
|
6742
|
-
success: callbackFactory("
|
|
6743
|
-
error: callbackFactory("
|
|
6744
|
-
finally: callbackFactory("
|
|
6792
|
+
progress: callbackFactory("progress"),
|
|
6793
|
+
success: callbackFactory("success"),
|
|
6794
|
+
error: callbackFactory("error"),
|
|
6795
|
+
finally: callbackFactory("finally")
|
|
6745
6796
|
};
|
|
6746
6797
|
var poll;
|
|
6747
6798
|
|
|
@@ -8255,6 +8306,7 @@
|
|
|
8255
8306
|
|
|
8256
8307
|
var formRenderer = "form-renderer.form-renderer";
|
|
8257
8308
|
var filterProperties = ["instanceId", "brick", "slots", "properties", "events", "if", "context", "bricks", "mountPoint"];
|
|
8309
|
+
var symbolForFormContextId = Symbol.for("form.contextId");
|
|
8258
8310
|
|
|
8259
8311
|
function collectRefsInTemplate(template) {
|
|
8260
8312
|
var refMap = new Map();
|
|
@@ -9936,58 +9988,73 @@
|
|
|
9936
9988
|
}
|
|
9937
9989
|
}
|
|
9938
9990
|
|
|
9939
|
-
function ExpandCustomForm(
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9991
|
+
function ExpandCustomForm(_x, _x2, _x3, _x4) {
|
|
9992
|
+
return _ExpandCustomForm.apply(this, arguments);
|
|
9993
|
+
}
|
|
9994
|
+
|
|
9995
|
+
function _ExpandCustomForm() {
|
|
9996
|
+
_ExpandCustomForm = _asyncToGenerator__default["default"](function* (formData, brickConf, isPreview, context) {
|
|
9997
|
+
var errorBrick = {
|
|
9998
|
+
brick: "presentational-bricks.brick-illustration",
|
|
9999
|
+
properties: {
|
|
10000
|
+
category: "default",
|
|
10001
|
+
header: {
|
|
10002
|
+
title: "参数错误"
|
|
10003
|
+
},
|
|
10004
|
+
mode: "guide",
|
|
10005
|
+
name: "search-empty"
|
|
10006
|
+
}
|
|
10007
|
+
};
|
|
10008
|
+
var formContext = new CustomFormContext();
|
|
10009
|
+
|
|
10010
|
+
if (Array.isArray(formData.context)) {
|
|
10011
|
+
yield formContext.formState.define(formData.context, _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
10012
|
+
formContextId: formContext.id
|
|
10013
|
+
}), {});
|
|
9949
10014
|
}
|
|
9950
|
-
};
|
|
9951
10015
|
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
10016
|
+
try {
|
|
10017
|
+
var formStoryboard = getStoryboard([formData.formSchema], [], formData.fields, isPreview, formContext.id);
|
|
10018
|
+
formStoryboard[0] = ___default["default"].isEmpty(formStoryboard[0]) ? errorBrick : formStoryboard[0];
|
|
10019
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, brickConf), {}, {
|
|
10020
|
+
brick: "div",
|
|
10021
|
+
slots: {
|
|
10022
|
+
"": {
|
|
10023
|
+
bricks: [{
|
|
10024
|
+
brick: "basic-bricks.micro-view",
|
|
10025
|
+
properties: {
|
|
10026
|
+
style: {
|
|
10027
|
+
padding: "12px"
|
|
10028
|
+
}
|
|
10029
|
+
},
|
|
10030
|
+
slots: {
|
|
10031
|
+
content: {
|
|
10032
|
+
bricks: formStoryboard,
|
|
10033
|
+
type: "bricks"
|
|
10034
|
+
}
|
|
9970
10035
|
}
|
|
9971
|
-
}
|
|
9972
|
-
|
|
9973
|
-
|
|
10036
|
+
}],
|
|
10037
|
+
type: "bricks"
|
|
10038
|
+
}
|
|
9974
10039
|
}
|
|
9975
|
-
}
|
|
9976
|
-
})
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
10040
|
+
});
|
|
10041
|
+
} catch (error) {
|
|
10042
|
+
// eslint-disable-next-line no-console
|
|
10043
|
+
console.warn(error.message);
|
|
10044
|
+
return {
|
|
10045
|
+
brick: "div",
|
|
10046
|
+
slots: {
|
|
10047
|
+
"": {
|
|
10048
|
+
bricks: [errorBrick],
|
|
10049
|
+
type: "bricks"
|
|
10050
|
+
}
|
|
9986
10051
|
}
|
|
9987
|
-
}
|
|
9988
|
-
}
|
|
9989
|
-
}
|
|
10052
|
+
};
|
|
10053
|
+
}
|
|
10054
|
+
});
|
|
10055
|
+
return _ExpandCustomForm.apply(this, arguments);
|
|
9990
10056
|
}
|
|
10057
|
+
|
|
9991
10058
|
function getDefaultProperties(_name, fields) {
|
|
9992
10059
|
var field = fields.filter(item => item.fieldId === _name)[0];
|
|
9993
10060
|
|
|
@@ -10220,7 +10287,7 @@
|
|
|
10220
10287
|
return defaultValue;
|
|
10221
10288
|
} else return {};
|
|
10222
10289
|
}
|
|
10223
|
-
function getStoryboard(datasource, result, fields, isPreview) {
|
|
10290
|
+
function getStoryboard(datasource, result, fields, isPreview, formContextId) {
|
|
10224
10291
|
var _loop = function (i) {
|
|
10225
10292
|
var dataItem = datasource[i];
|
|
10226
10293
|
var resultItem = {}; //数据初始化:根据id,字段类型获取默认属性
|
|
@@ -10262,7 +10329,7 @@
|
|
|
10262
10329
|
if (Array.isArray(dataItem.bricks)) {
|
|
10263
10330
|
var _Object$keys;
|
|
10264
10331
|
|
|
10265
|
-
resultItem["slots"] = ___default["default"].groupBy(getStoryboard(dataItem.bricks, [], fields, isPreview), "mountPoint");
|
|
10332
|
+
resultItem["slots"] = ___default["default"].groupBy(getStoryboard(dataItem.bricks, [], fields, isPreview, formContextId), "mountPoint");
|
|
10266
10333
|
(_Object$keys = Object.keys(resultItem["slots"])) === null || _Object$keys === void 0 ? void 0 : _Object$keys.forEach(item => {
|
|
10267
10334
|
resultItem.slots[item] = {
|
|
10268
10335
|
bricks: resultItem.slots[item],
|
|
@@ -10271,6 +10338,9 @@
|
|
|
10271
10338
|
});
|
|
10272
10339
|
}
|
|
10273
10340
|
|
|
10341
|
+
resultItem = _objectSpread__default["default"](_objectSpread__default["default"]({}, resultItem), {}, {
|
|
10342
|
+
[symbolForFormContextId]: formContextId
|
|
10343
|
+
});
|
|
10274
10344
|
result[i] = resultItem;
|
|
10275
10345
|
};
|
|
10276
10346
|
|
|
@@ -10327,7 +10397,8 @@
|
|
|
10327
10397
|
getContext(_ref) {
|
|
10328
10398
|
var {
|
|
10329
10399
|
match,
|
|
10330
|
-
tplContextId
|
|
10400
|
+
tplContextId,
|
|
10401
|
+
formContextId
|
|
10331
10402
|
} = _ref;
|
|
10332
10403
|
var auth = getAuth();
|
|
10333
10404
|
var context = {
|
|
@@ -10347,7 +10418,8 @@
|
|
|
10347
10418
|
flags: this.kernel.getFeatureFlags(),
|
|
10348
10419
|
segues: this.segues,
|
|
10349
10420
|
storyboardContext: this.storyboardContextWrapper.get(),
|
|
10350
|
-
tplContextId
|
|
10421
|
+
tplContextId,
|
|
10422
|
+
formContextId
|
|
10351
10423
|
};
|
|
10352
10424
|
return context;
|
|
10353
10425
|
}
|
|
@@ -10687,10 +10759,12 @@
|
|
|
10687
10759
|
|
|
10688
10760
|
var tplStack = _arguments.length > 4 && _arguments[4] !== undefined ? _arguments[4] : [];
|
|
10689
10761
|
var tplContextId = brickConf[symbolForTplContextId];
|
|
10762
|
+
var formContextId = brickConf[symbolForFormContextId];
|
|
10690
10763
|
|
|
10691
10764
|
var context = _this6.getContext({
|
|
10692
10765
|
match,
|
|
10693
|
-
tplContextId
|
|
10766
|
+
tplContextId,
|
|
10767
|
+
formContextId
|
|
10694
10768
|
}); // First, check whether the brick should be rendered.
|
|
10695
10769
|
|
|
10696
10770
|
|
|
@@ -10720,6 +10794,10 @@
|
|
|
10720
10794
|
tplStack.push(tplTagName);
|
|
10721
10795
|
}
|
|
10722
10796
|
|
|
10797
|
+
if (brickConf.brick === formRenderer) {
|
|
10798
|
+
brickConf.properties.formData = JSON.stringify(brickConf.properties.formData);
|
|
10799
|
+
}
|
|
10800
|
+
|
|
10723
10801
|
var brick = {};
|
|
10724
10802
|
yield _this6.storyboardContextWrapper.define(brickConf.context, context, brick);
|
|
10725
10803
|
yield _this6.preCheckPermissions(brickConf, context);
|
|
@@ -10733,6 +10811,7 @@
|
|
|
10733
10811
|
slotId,
|
|
10734
10812
|
refForProxy: brickConf[symbolForRefForProxy],
|
|
10735
10813
|
tplContextId,
|
|
10814
|
+
formContextId,
|
|
10736
10815
|
iid: brickConf.iid
|
|
10737
10816
|
}, (_brickConf$lifeCycle = brickConf.lifeCycle) !== null && _brickConf$lifeCycle !== void 0 && _brickConf$lifeCycle.onScrollIntoView ? {
|
|
10738
10817
|
lifeCycle: {
|
|
@@ -10778,8 +10857,8 @@
|
|
|
10778
10857
|
}
|
|
10779
10858
|
|
|
10780
10859
|
if (brick.type === formRenderer) {
|
|
10781
|
-
var formData = brick.properties.formData;
|
|
10782
|
-
expandedBrickConf = ExpandCustomForm(formData, brickConf, brick.properties.isPreview);
|
|
10860
|
+
var formData = JSON.parse(brick.properties.formData);
|
|
10861
|
+
expandedBrickConf = yield ExpandCustomForm(formData, brickConf, brick.properties.isPreview, context);
|
|
10783
10862
|
yield _this6.kernel.loadDynamicBricksInBrickConf(expandedBrickConf);
|
|
10784
10863
|
}
|
|
10785
10864
|
|