@next-core/brick-kit 2.104.5 → 2.104.6
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 +8 -0
- package/dist/index.bundle.js +39 -24
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +39 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/StoryboardContext.d.ts +1 -0
- package/dist/types/core/StoryboardContext.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.104.6](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.104.5...@next-core/brick-kit@2.104.6) (2022-02-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @next-core/brick-kit
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.104.5](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.104.4...@next-core/brick-kit@2.104.5) (2022-02-15)
|
|
7
15
|
|
|
8
16
|
|
package/dist/index.bundle.js
CHANGED
|
@@ -1979,17 +1979,38 @@
|
|
|
1979
1979
|
|
|
1980
1980
|
return _asyncToGenerator__default["default"](function* () {
|
|
1981
1981
|
if (Array.isArray(contextConfs)) {
|
|
1982
|
-
|
|
1982
|
+
var {
|
|
1983
|
+
mergedContext,
|
|
1984
|
+
keyword
|
|
1985
|
+
} = _this.getResolveOptions(coreContext);
|
|
1986
|
+
|
|
1987
|
+
yield brickUtils.resolveContextConcurrently(contextConfs, contextConf => resolveStoryboardContext(contextConf, mergedContext, _this, brick), keyword);
|
|
1983
1988
|
}
|
|
1984
1989
|
})();
|
|
1985
1990
|
}
|
|
1986
1991
|
|
|
1987
1992
|
syncDefine(contextConfs, coreContext, brick) {
|
|
1988
1993
|
if (Array.isArray(contextConfs)) {
|
|
1989
|
-
|
|
1994
|
+
var {
|
|
1995
|
+
mergedContext,
|
|
1996
|
+
keyword
|
|
1997
|
+
} = this.getResolveOptions(coreContext);
|
|
1998
|
+
brickUtils.syncResolveContextConcurrently(contextConfs, contextConf => syncResolveStoryboardContext(contextConf, mergedContext, this, brick), keyword);
|
|
1990
1999
|
}
|
|
1991
2000
|
}
|
|
1992
2001
|
|
|
2002
|
+
getResolveOptions(coreContext) {
|
|
2003
|
+
return this.tplContextId ? {
|
|
2004
|
+
mergedContext: _objectSpread__default["default"](_objectSpread__default["default"]({}, coreContext), {}, {
|
|
2005
|
+
tplContextId: this.tplContextId
|
|
2006
|
+
}),
|
|
2007
|
+
keyword: "STATE"
|
|
2008
|
+
} : {
|
|
2009
|
+
mergedContext: coreContext,
|
|
2010
|
+
keyword: "CTX"
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
|
|
1993
2014
|
}
|
|
1994
2015
|
|
|
1995
2016
|
function resolveStoryboardContext(_x, _x2, _x3, _x4) {
|
|
@@ -2024,23 +2045,23 @@
|
|
|
2024
2045
|
}
|
|
2025
2046
|
|
|
2026
2047
|
function _resolveNormalStoryboardContext() {
|
|
2027
|
-
_resolveNormalStoryboardContext = _asyncToGenerator__default["default"](function* (contextConf,
|
|
2028
|
-
if (!looseCheckIf(contextConf,
|
|
2048
|
+
_resolveNormalStoryboardContext = _asyncToGenerator__default["default"](function* (contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
2049
|
+
if (!looseCheckIf(contextConf, mergedContext)) {
|
|
2029
2050
|
return false;
|
|
2030
2051
|
}
|
|
2031
2052
|
|
|
2032
2053
|
var isResolve = false;
|
|
2033
|
-
var value = getDefinedTemplateState(
|
|
2054
|
+
var value = getDefinedTemplateState(!!storyboardContextWrapper.tplContextId, contextConf, brick);
|
|
2034
2055
|
|
|
2035
2056
|
if (value === undefined) {
|
|
2036
2057
|
if (contextConf.resolve) {
|
|
2037
|
-
if (looseCheckIf(contextConf.resolve,
|
|
2058
|
+
if (looseCheckIf(contextConf.resolve, mergedContext)) {
|
|
2038
2059
|
isResolve = true;
|
|
2039
2060
|
var valueConf = {};
|
|
2040
2061
|
yield _internalApiGetResolver().resolveOne("reference", _objectSpread__default["default"]({
|
|
2041
2062
|
transform: "value",
|
|
2042
2063
|
transformMapArray: false
|
|
2043
|
-
}, contextConf.resolve), valueConf, null,
|
|
2064
|
+
}, contextConf.resolve), valueConf, null, mergedContext);
|
|
2044
2065
|
value = valueConf.value;
|
|
2045
2066
|
} else if (!brickUtils.hasOwnProperty(contextConf, "value")) {
|
|
2046
2067
|
return false;
|
|
@@ -2048,18 +2069,18 @@
|
|
|
2048
2069
|
}
|
|
2049
2070
|
|
|
2050
2071
|
if (!isResolve && contextConf.value !== undefined) {
|
|
2051
|
-
value = computeRealValue(contextConf.value,
|
|
2072
|
+
value = computeRealValue(contextConf.value, mergedContext, true);
|
|
2052
2073
|
}
|
|
2053
2074
|
}
|
|
2054
2075
|
|
|
2055
|
-
resolveFreeVariableValue(value, contextConf,
|
|
2076
|
+
resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick);
|
|
2056
2077
|
return true;
|
|
2057
2078
|
});
|
|
2058
2079
|
return _resolveNormalStoryboardContext.apply(this, arguments);
|
|
2059
2080
|
}
|
|
2060
2081
|
|
|
2061
|
-
function syncResolveStoryboardContext(contextConf,
|
|
2062
|
-
if (!looseCheckIf(contextConf,
|
|
2082
|
+
function syncResolveStoryboardContext(contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
2083
|
+
if (!looseCheckIf(contextConf, mergedContext)) {
|
|
2063
2084
|
return false;
|
|
2064
2085
|
}
|
|
2065
2086
|
|
|
@@ -2067,23 +2088,23 @@
|
|
|
2067
2088
|
throw new Error("resolve is not allowed here");
|
|
2068
2089
|
}
|
|
2069
2090
|
|
|
2070
|
-
var value = getDefinedTemplateState(
|
|
2091
|
+
var value = getDefinedTemplateState(!!storyboardContextWrapper.tplContextId, contextConf, brick);
|
|
2071
2092
|
|
|
2072
2093
|
if (value === undefined) {
|
|
2073
|
-
value = computeRealValue(contextConf.value,
|
|
2094
|
+
value = computeRealValue(contextConf.value, mergedContext, true);
|
|
2074
2095
|
}
|
|
2075
2096
|
|
|
2076
|
-
resolveFreeVariableValue(value, contextConf,
|
|
2097
|
+
resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick);
|
|
2077
2098
|
return true;
|
|
2078
2099
|
}
|
|
2079
2100
|
|
|
2080
|
-
function getDefinedTemplateState(
|
|
2081
|
-
if (
|
|
2101
|
+
function getDefinedTemplateState(isTemplateState, contextConf, brick) {
|
|
2102
|
+
if (isTemplateState && brick.properties && brickUtils.hasOwnProperty(brick.properties, contextConf.name)) {
|
|
2082
2103
|
return brick.properties[contextConf.name];
|
|
2083
2104
|
}
|
|
2084
2105
|
}
|
|
2085
2106
|
|
|
2086
|
-
function resolveFreeVariableValue(value, contextConf,
|
|
2107
|
+
function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
2087
2108
|
var newContext = {
|
|
2088
2109
|
type: "free-variable",
|
|
2089
2110
|
value,
|
|
@@ -2093,13 +2114,7 @@
|
|
|
2093
2114
|
|
|
2094
2115
|
if (contextConf.onChange) {
|
|
2095
2116
|
for (var handler of [].concat(contextConf.onChange)) {
|
|
2096
|
-
|
|
2097
|
-
newContext.eventTarget.addEventListener("state.change", listenerFactory(handler, _objectSpread__default["default"](_objectSpread__default["default"]({}, coreContext), {}, {
|
|
2098
|
-
tplContextId: storyboardContextWrapper.tplContextId
|
|
2099
|
-
}), brick));
|
|
2100
|
-
} else {
|
|
2101
|
-
newContext.eventTarget.addEventListener("context.change", listenerFactory(handler, coreContext, brick));
|
|
2102
|
-
}
|
|
2117
|
+
newContext.eventTarget.addEventListener(storyboardContextWrapper.tplContextId ? "state.change" : "context.change", listenerFactory(handler, mergedContext, brick));
|
|
2103
2118
|
}
|
|
2104
2119
|
}
|
|
2105
2120
|
|