@next-core/brick-kit 2.166.0 → 2.167.0
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/dist/index.bundle.js +553 -274
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +558 -279
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/internal/setProperties.d.ts.map +1 -1
- package/package.json +4 -3
package/dist/index.bundle.js
CHANGED
|
@@ -2430,6 +2430,229 @@
|
|
|
2430
2430
|
}
|
|
2431
2431
|
}
|
|
2432
2432
|
|
|
2433
|
+
function isBasicProperty(propRef) {
|
|
2434
|
+
return !!propRef.refProperty;
|
|
2435
|
+
}
|
|
2436
|
+
function isTransformableProperty(propRef) {
|
|
2437
|
+
return !!propRef.refTransform;
|
|
2438
|
+
}
|
|
2439
|
+
function isMergeableProperty(propRef) {
|
|
2440
|
+
return !!propRef.mergeProperty;
|
|
2441
|
+
}
|
|
2442
|
+
function isRefProperty(propRef) {
|
|
2443
|
+
return !!propRef.ref;
|
|
2444
|
+
}
|
|
2445
|
+
function isVariableProperty(propRef) {
|
|
2446
|
+
return !!propRef.asVariable;
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
var customTemplateRegistry = new Map();
|
|
2450
|
+
var appRegistered = new Set();
|
|
2451
|
+
var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
|
|
2452
|
+
var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
|
|
2453
|
+
var symbolForTplContextId = Symbol.for("tpl.contextId");
|
|
2454
|
+
|
|
2455
|
+
function propertyMerge(conf, value, object) {
|
|
2456
|
+
return propertyMergeAll(conf.$$mergeBase, Object.fromEntries(conf.$$mergeBase.proxies.map(proxy => [proxy.$$reversedRef, proxy === conf ? value : object[proxy.$$reversedRef]])));
|
|
2457
|
+
}
|
|
2458
|
+
function propertyMergeAll(mergeBase, object) {
|
|
2459
|
+
if (mergeBase.mergeType === "array") {
|
|
2460
|
+
return propertyMergeAllOfArray(mergeBase, object);
|
|
2461
|
+
}
|
|
2462
|
+
if (mergeBase.mergeType === "object") {
|
|
2463
|
+
return propertyMergeAllOfObject(mergeBase, object);
|
|
2464
|
+
}
|
|
2465
|
+
// istanbul ignore next: should never reach
|
|
2466
|
+
throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
|
|
2467
|
+
}
|
|
2468
|
+
function propertyMergeAllOfArray(_ref, object) {
|
|
2469
|
+
var _$1, _proxy$mergeArgs;
|
|
2470
|
+
var {
|
|
2471
|
+
baseValue,
|
|
2472
|
+
context,
|
|
2473
|
+
proxies
|
|
2474
|
+
} = _ref;
|
|
2475
|
+
// Use an approach like template-literal's quasis:
|
|
2476
|
+
// `quasi0${0}quais1${1}quasi2...`
|
|
2477
|
+
// Every quasi can be merged with multiple items.
|
|
2478
|
+
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
|
|
2479
|
+
$$lazyForUseBrick: true
|
|
2480
|
+
}) : [];
|
|
2481
|
+
var quasis = [];
|
|
2482
|
+
var size = computedBaseValue.length + 1;
|
|
2483
|
+
for (var i = 0; i < size; i += 1) {
|
|
2484
|
+
quasis.push([]);
|
|
2485
|
+
}
|
|
2486
|
+
for (var proxy of proxies) {
|
|
2487
|
+
var position = void 0;
|
|
2488
|
+
switch (proxy.mergeMethod) {
|
|
2489
|
+
case "append":
|
|
2490
|
+
position = computedBaseValue.length;
|
|
2491
|
+
break;
|
|
2492
|
+
case "prepend":
|
|
2493
|
+
position = 0;
|
|
2494
|
+
break;
|
|
2495
|
+
case "insertAt":
|
|
2496
|
+
// Defaults to `-1`.
|
|
2497
|
+
position = (_$1 = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _$1 !== void 0 ? _$1 : -1;
|
|
2498
|
+
if (position < 0) {
|
|
2499
|
+
// It's counted from the end if position is negative.
|
|
2500
|
+
position += quasis.length;
|
|
2501
|
+
}
|
|
2502
|
+
position = _.clamp(position, 0, computedBaseValue.length);
|
|
2503
|
+
break;
|
|
2504
|
+
// istanbul ignore next: should never reach
|
|
2505
|
+
default:
|
|
2506
|
+
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
2507
|
+
}
|
|
2508
|
+
var patchValue = object[proxy.$$reversedRef];
|
|
2509
|
+
if (!Array.isArray(patchValue)) {
|
|
2510
|
+
patchValue = [];
|
|
2511
|
+
}
|
|
2512
|
+
quasis[position].push(...patchValue);
|
|
2513
|
+
}
|
|
2514
|
+
return quasis.flatMap((item, index) => index < computedBaseValue.length ? item.concat(computedBaseValue[index]) : item);
|
|
2515
|
+
}
|
|
2516
|
+
function propertyMergeAllOfObject(_ref2, object) {
|
|
2517
|
+
var {
|
|
2518
|
+
baseValue,
|
|
2519
|
+
proxies,
|
|
2520
|
+
context
|
|
2521
|
+
} = _ref2;
|
|
2522
|
+
var computedBaseValue = brickUtils.isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
|
|
2523
|
+
return proxies.reduce((acc, proxy) => {
|
|
2524
|
+
switch (proxy.mergeMethod) {
|
|
2525
|
+
case "extend":
|
|
2526
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, acc), object[proxy.$$reversedRef]);
|
|
2527
|
+
// istanbul ignore next: should never reach
|
|
2528
|
+
default:
|
|
2529
|
+
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
2530
|
+
}
|
|
2531
|
+
}, computedBaseValue);
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
function setupTemplateProxy(proxyContext, ref, slots) {
|
|
2535
|
+
var computedPropsFromProxy = {};
|
|
2536
|
+
var refForProxy;
|
|
2537
|
+
var {
|
|
2538
|
+
reversedProxies,
|
|
2539
|
+
templateProperties,
|
|
2540
|
+
externalSlots,
|
|
2541
|
+
templateContextId,
|
|
2542
|
+
proxyBrick
|
|
2543
|
+
} = proxyContext;
|
|
2544
|
+
if (ref && reversedProxies) {
|
|
2545
|
+
refForProxy = {};
|
|
2546
|
+
proxyBrick.proxyRefs.set(ref, refForProxy);
|
|
2547
|
+
|
|
2548
|
+
// Reversed proxies are used for expand storyboard before rendering page.
|
|
2549
|
+
if (reversedProxies.properties.has(ref)) {
|
|
2550
|
+
Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(propRef => {
|
|
2551
|
+
// `propValue` is computed.
|
|
2552
|
+
var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[propRef.$$reversedRef];
|
|
2553
|
+
if (isTransformableProperty(propRef)) {
|
|
2554
|
+
return Object.entries(preprocessTransformProperties({
|
|
2555
|
+
[propRef.$$reversedRef]: propValue
|
|
2556
|
+
}, propRef.refTransform));
|
|
2557
|
+
}
|
|
2558
|
+
if (isBasicProperty(propRef)) {
|
|
2559
|
+
return [[propRef.refProperty, propValue]];
|
|
2560
|
+
}
|
|
2561
|
+
// Ignore Variable properties.
|
|
2562
|
+
// And mergeable properties are processed later.
|
|
2563
|
+
return [];
|
|
2564
|
+
}).filter(propRef => propRef[1] !== undefined)));
|
|
2565
|
+
|
|
2566
|
+
// Brick properties can be merged multiple times.
|
|
2567
|
+
if (reversedProxies.mergeBases.has(ref)) {
|
|
2568
|
+
Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref => {
|
|
2569
|
+
var [mergeProperty, mergeBase] = _ref;
|
|
2570
|
+
return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
|
|
2571
|
+
}).filter(item => item[1] !== undefined)));
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
// Use an approach like template-literal's quasis:
|
|
2576
|
+
// `quasi0${0}quais1${1}quasi2...`
|
|
2577
|
+
// Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
|
|
2578
|
+
var quasisMap = new Map();
|
|
2579
|
+
if (reversedProxies.slots.has(ref)) {
|
|
2580
|
+
for (var item of reversedProxies.slots.get(ref)) {
|
|
2581
|
+
var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
|
|
2582
|
+
if (!quasisMap.has(item.refSlot)) {
|
|
2583
|
+
var quasis = [];
|
|
2584
|
+
// The size of quasis should be the existed slotted bricks' size plus one.
|
|
2585
|
+
var size = brickUtils.hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
|
|
2586
|
+
for (var i = 0; i < size; i += 1) {
|
|
2587
|
+
quasis.push([]);
|
|
2588
|
+
}
|
|
2589
|
+
quasisMap.set(item.refSlot, quasis);
|
|
2590
|
+
}
|
|
2591
|
+
var expandableSlot = quasisMap.get(item.refSlot);
|
|
2592
|
+
var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
|
|
2593
|
+
expandableSlot[_.clamp(refPosition < 0 ? expandableSlot.length + refPosition : refPosition, 0, expandableSlot.length - 1)].push(...((_externalSlots$item$$ = externalSlots === null || externalSlots === void 0 ? void 0 : (_externalSlots$item$$2 = externalSlots[item.$$reversedRef]) === null || _externalSlots$item$$2 === void 0 ? void 0 : _externalSlots$item$$2.bricks) !== null && _externalSlots$item$$ !== void 0 ? _externalSlots$item$$ : []));
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
var _loop = function (slotName, _quasis) {
|
|
2597
|
+
if (!brickUtils.hasOwnProperty(slots, slotName)) {
|
|
2598
|
+
slots[slotName] = {
|
|
2599
|
+
type: "bricks",
|
|
2600
|
+
bricks: []
|
|
2601
|
+
};
|
|
2602
|
+
}
|
|
2603
|
+
var slotConf = slots[slotName];
|
|
2604
|
+
slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
|
|
2605
|
+
if (slotConf.bricks.length === 0) {
|
|
2606
|
+
delete slots[slotName];
|
|
2607
|
+
}
|
|
2608
|
+
};
|
|
2609
|
+
for (var [slotName, _quasis] of quasisMap.entries()) {
|
|
2610
|
+
_loop(slotName, _quasis);
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
return {
|
|
2614
|
+
[symbolForComputedPropsFromProxy]: computedPropsFromProxy,
|
|
2615
|
+
[symbolForRefForProxy]: refForProxy,
|
|
2616
|
+
[symbolForTplContextId]: templateContextId
|
|
2617
|
+
};
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
var _excluded$7 = ["properties", "slots"];
|
|
2621
|
+
function setupUseBrickInTemplate(props, proxyContext) {
|
|
2622
|
+
function walk(props) {
|
|
2623
|
+
if (!brickUtils.isObject(props)) {
|
|
2624
|
+
return props;
|
|
2625
|
+
}
|
|
2626
|
+
if (Array.isArray(props)) {
|
|
2627
|
+
return props.map(walk);
|
|
2628
|
+
}
|
|
2629
|
+
return Object.fromEntries(Object.entries(props).map(_ref => {
|
|
2630
|
+
var [key, value] = _ref;
|
|
2631
|
+
return brickUtils.isObject(value) && key === "useBrick" ? Array.isArray(value) ? [key, value.map(setup)] : [key, setup(value)] : [key, walk(value)];
|
|
2632
|
+
}).concat(Object.getOwnPropertySymbols(props).map(k => [k, props[k]])));
|
|
2633
|
+
}
|
|
2634
|
+
function setup(item) {
|
|
2635
|
+
var {
|
|
2636
|
+
properties,
|
|
2637
|
+
slots: originalSlots
|
|
2638
|
+
} = item,
|
|
2639
|
+
restConf = _objectWithoutProperties__default["default"](item, _excluded$7);
|
|
2640
|
+
var slots = Object.fromEntries(Object.entries(originalSlots !== null && originalSlots !== void 0 ? originalSlots : {}).map(_ref2 => {
|
|
2641
|
+
var _slotConf$bricks;
|
|
2642
|
+
var [slotName, slotConf] = _ref2;
|
|
2643
|
+
return [slotName, {
|
|
2644
|
+
type: "bricks",
|
|
2645
|
+
bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(setup)
|
|
2646
|
+
}];
|
|
2647
|
+
}));
|
|
2648
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, restConf), {}, {
|
|
2649
|
+
properties: walk(properties),
|
|
2650
|
+
slots
|
|
2651
|
+
}, setupTemplateProxy(proxyContext, restConf.ref, slots));
|
|
2652
|
+
}
|
|
2653
|
+
return walk(props);
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2433
2656
|
var computeRealValue = (value, context, injectDeep, internalOptions) => {
|
|
2434
2657
|
var preEvaluated = isPreEvaluated(value);
|
|
2435
2658
|
if (preEvaluated || typeof value === "string") {
|
|
@@ -2481,6 +2704,11 @@
|
|
|
2481
2704
|
};
|
|
2482
2705
|
function setProperties(bricks, properties, context, injectDeep) {
|
|
2483
2706
|
var realProps = computeRealProperties(properties, context, injectDeep);
|
|
2707
|
+
if (context.tplContextId) {
|
|
2708
|
+
realProps = setupUseBrickInTemplate(realProps, {
|
|
2709
|
+
templateContextId: context.tplContextId
|
|
2710
|
+
});
|
|
2711
|
+
}
|
|
2484
2712
|
if (!Array.isArray(bricks)) {
|
|
2485
2713
|
bricks = [bricks];
|
|
2486
2714
|
}
|
|
@@ -2548,7 +2776,7 @@
|
|
|
2548
2776
|
}) : internalOptions;
|
|
2549
2777
|
}
|
|
2550
2778
|
|
|
2551
|
-
var _excluded$
|
|
2779
|
+
var _excluded$6 = ["children"],
|
|
2552
2780
|
_excluded2$2 = ["children"],
|
|
2553
2781
|
_excluded3 = ["items", "app"];
|
|
2554
2782
|
var symbolAppId = Symbol("appId");
|
|
@@ -2811,7 +3039,7 @@
|
|
|
2811
3039
|
var {
|
|
2812
3040
|
children
|
|
2813
3041
|
} = _ref,
|
|
2814
|
-
rest = _objectWithoutProperties__default["default"](_ref, _excluded$
|
|
3042
|
+
rest = _objectWithoutProperties__default["default"](_ref, _excluded$6);
|
|
2815
3043
|
var overrideAppId = rest[symbolAppId];
|
|
2816
3044
|
if (!rest[symbolMenuI18nNamespace] && overrideAppId !== contextAppId && !appIds.has(overrideAppId) && attemptToVisit(rest, ["I18N"])) {
|
|
2817
3045
|
appIds.add(overrideAppId);
|
|
@@ -3433,7 +3661,7 @@
|
|
|
3433
3661
|
return kernel.loadDynamicBricksInBrickConf(brickConf);
|
|
3434
3662
|
}
|
|
3435
3663
|
|
|
3436
|
-
var _excluded$
|
|
3664
|
+
var _excluded$5 = ["extraQuery", "clear", "keepHash"];
|
|
3437
3665
|
var blocked = false;
|
|
3438
3666
|
function getUserConfirmation(message, callback) {
|
|
3439
3667
|
blocked = !confirm(message);
|
|
@@ -3463,7 +3691,7 @@
|
|
|
3463
3691
|
clear,
|
|
3464
3692
|
keepHash
|
|
3465
3693
|
} = options,
|
|
3466
|
-
state = _objectWithoutProperties__default["default"](options, _excluded$
|
|
3694
|
+
state = _objectWithoutProperties__default["default"](options, _excluded$5);
|
|
3467
3695
|
var urlSearchParams = new URLSearchParams(clear ? "" : browserHistory.location.search);
|
|
3468
3696
|
var params = {};
|
|
3469
3697
|
Object.assign(params, query, extraQuery);
|
|
@@ -6323,41 +6551,302 @@
|
|
|
6323
6551
|
};
|
|
6324
6552
|
}();
|
|
6325
6553
|
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
*/
|
|
6331
|
-
function processBootstrapResponse(bootstrapResponse) {
|
|
6332
|
-
for (var storyboard of bootstrapResponse.storyboards) {
|
|
6333
|
-
var app = storyboard.app;
|
|
6334
|
-
if (app) {
|
|
6335
|
-
app.config = brickUtils.deepFreeze(_.merge({}, app.defaultConfig, app.userConfig));
|
|
6336
|
-
if (app.locales) {
|
|
6337
|
-
(function () {
|
|
6338
|
-
// Prefix to avoid conflict between brick package's i18n namespace.
|
|
6339
|
-
var ns = "$tmp-".concat(app.id);
|
|
6340
|
-
// Support any languages in `app.locales`.
|
|
6341
|
-
Object.entries(app.locales).forEach(_ref => {
|
|
6342
|
-
var [lang, resources] = _ref;
|
|
6343
|
-
i18next__default["default"].addResourceBundle(lang, ns, resources);
|
|
6344
|
-
});
|
|
6345
|
-
// Use `app.name` as the fallback `app.localeName`.
|
|
6346
|
-
app.localeName = i18next__default["default"].getFixedT(null, ns)("name", app.name);
|
|
6347
|
-
// Remove the temporary i18n resource bundles.
|
|
6348
|
-
Object.keys(app.locales).forEach(lang => {
|
|
6349
|
-
i18next__default["default"].removeResourceBundle(lang, ns);
|
|
6350
|
-
});
|
|
6351
|
-
})();
|
|
6352
|
-
} else {
|
|
6353
|
-
app.localeName = app.name;
|
|
6354
|
-
}
|
|
6355
|
-
}
|
|
6554
|
+
var cache$1 = new Map();
|
|
6555
|
+
function loadScript(src, prefix) {
|
|
6556
|
+
if (Array.isArray(src)) {
|
|
6557
|
+
return Promise.all(src.map(item => loadScript(item, prefix)));
|
|
6356
6558
|
}
|
|
6357
|
-
|
|
6358
|
-
|
|
6559
|
+
var fixedSrc = prefix ? "".concat(prefix).concat(src) : src;
|
|
6560
|
+
var cachedPromise = cache$1.get(fixedSrc);
|
|
6561
|
+
if (cachedPromise) {
|
|
6562
|
+
return cachedPromise;
|
|
6359
6563
|
}
|
|
6360
|
-
|
|
6564
|
+
var promise = new Promise((resolve, reject) => {
|
|
6565
|
+
var end = () => {
|
|
6566
|
+
window.dispatchEvent(new Event("request.end"));
|
|
6567
|
+
};
|
|
6568
|
+
var script = document.createElement("script");
|
|
6569
|
+
script.src = fixedSrc;
|
|
6570
|
+
script.type = "text/javascript";
|
|
6571
|
+
script.async = true;
|
|
6572
|
+
script.onload = () => {
|
|
6573
|
+
resolve(fixedSrc);
|
|
6574
|
+
end();
|
|
6575
|
+
};
|
|
6576
|
+
script.onerror = e => {
|
|
6577
|
+
reject(e);
|
|
6578
|
+
end();
|
|
6579
|
+
};
|
|
6580
|
+
var firstScript = document.currentScript || document.getElementsByTagName("script")[0];
|
|
6581
|
+
firstScript.parentNode.insertBefore(script, firstScript);
|
|
6582
|
+
window.dispatchEvent(new Event("request.start"));
|
|
6583
|
+
});
|
|
6584
|
+
cache$1.set(fixedSrc, promise);
|
|
6585
|
+
return promise;
|
|
6586
|
+
}
|
|
6587
|
+
|
|
6588
|
+
// https://github.com/module-federation/module-federation-examples/blob/eda9493f3991a423479fd834cfb1d7b241d9d1f0/advanced-api/dynamic-remotes/app1/src/App.js
|
|
6589
|
+
function loadSharedModule(_x, _x2) {
|
|
6590
|
+
return _loadSharedModule.apply(this, arguments);
|
|
6591
|
+
}
|
|
6592
|
+
function _loadSharedModule() {
|
|
6593
|
+
_loadSharedModule = _asyncToGenerator__default["default"](function* (scope, module) {
|
|
6594
|
+
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
6595
|
+
yield __webpack_init_sharing__("default");
|
|
6596
|
+
var container = window[scope]; // or get the container somewhere else
|
|
6597
|
+
// Initialize the container, it may provide shared modules
|
|
6598
|
+
yield container.init(__webpack_share_scopes__.default);
|
|
6599
|
+
var factory = yield container.get(module);
|
|
6600
|
+
return factory();
|
|
6601
|
+
});
|
|
6602
|
+
return _loadSharedModule.apply(this, arguments);
|
|
6603
|
+
}
|
|
6604
|
+
|
|
6605
|
+
var resolveBasicPkg;
|
|
6606
|
+
var basicPkgWillBeResolved = false;
|
|
6607
|
+
var waitBasicPkg = new Promise(resolve => {
|
|
6608
|
+
resolveBasicPkg = resolve;
|
|
6609
|
+
});
|
|
6610
|
+
function flushStableLoadBricks() {
|
|
6611
|
+
if (!basicPkgWillBeResolved) {
|
|
6612
|
+
resolveBasicPkg();
|
|
6613
|
+
}
|
|
6614
|
+
}
|
|
6615
|
+
function loadBricksImperatively(_x, _x2) {
|
|
6616
|
+
return _loadBricksImperatively.apply(this, arguments);
|
|
6617
|
+
}
|
|
6618
|
+
function _loadBricksImperatively() {
|
|
6619
|
+
_loadBricksImperatively = _asyncToGenerator__default["default"](function* (bricks, brickPackages) {
|
|
6620
|
+
var promise = enqueueStableLoad("bricks", bricks, brickPackages);
|
|
6621
|
+
flushStableLoadBricks();
|
|
6622
|
+
return dispatchRequestStatus(promise);
|
|
6623
|
+
});
|
|
6624
|
+
return _loadBricksImperatively.apply(this, arguments);
|
|
6625
|
+
}
|
|
6626
|
+
function loadProcessorsImperatively(processors, brickPackages) {
|
|
6627
|
+
var promise = enqueueStableLoad("processors", processors, brickPackages);
|
|
6628
|
+
flushStableLoadBricks();
|
|
6629
|
+
return dispatchRequestStatus(promise);
|
|
6630
|
+
}
|
|
6631
|
+
var v2AdapterPromise;
|
|
6632
|
+
var V2_ADAPTER_LOAD_BRICKS = "v2-adapter.load-bricks";
|
|
6633
|
+
|
|
6634
|
+
// Get brick/processor items including their dependencies
|
|
6635
|
+
function getItemsByPkg(type, list, brickPackagesMap) {
|
|
6636
|
+
var itemsByPkg = new Map();
|
|
6637
|
+
var listToLoad = new Set();
|
|
6638
|
+
var add = item => {
|
|
6639
|
+
var _pkg$dependencies;
|
|
6640
|
+
if (listToLoad.has(item)) {
|
|
6641
|
+
return;
|
|
6642
|
+
}
|
|
6643
|
+
listToLoad.add(item);
|
|
6644
|
+
var pkg;
|
|
6645
|
+
var namespace;
|
|
6646
|
+
var itemName;
|
|
6647
|
+
if (type === "processors" || item.includes(".")) {
|
|
6648
|
+
[namespace, itemName] = item.split(".");
|
|
6649
|
+
var pkgId = "bricks/".concat(type === "processors" ? getProcessorPackageName(namespace) : namespace);
|
|
6650
|
+
pkg = brickPackagesMap.get(pkgId);
|
|
6651
|
+
} else {
|
|
6652
|
+
itemName = item;
|
|
6653
|
+
for (var p of brickPackagesMap.values()) {
|
|
6654
|
+
var _p$elements;
|
|
6655
|
+
if ((_p$elements = p.elements) !== null && _p$elements !== void 0 && _p$elements.some(e => e === itemName)) {
|
|
6656
|
+
pkg = p;
|
|
6657
|
+
break;
|
|
6658
|
+
}
|
|
6659
|
+
}
|
|
6660
|
+
}
|
|
6661
|
+
if (!pkg) {
|
|
6662
|
+
throw new Error("Package for ".concat(item, " not found."));
|
|
6663
|
+
}
|
|
6664
|
+
var groupItems = itemsByPkg.get(pkg);
|
|
6665
|
+
if (!groupItems) {
|
|
6666
|
+
groupItems = [];
|
|
6667
|
+
itemsByPkg.set(pkg, groupItems);
|
|
6668
|
+
}
|
|
6669
|
+
groupItems.push(itemName);
|
|
6670
|
+
|
|
6671
|
+
// Load their dependencies too
|
|
6672
|
+
var deps = (_pkg$dependencies = pkg.dependencies) === null || _pkg$dependencies === void 0 ? void 0 : _pkg$dependencies[item];
|
|
6673
|
+
if (deps) {
|
|
6674
|
+
for (var dep of deps) {
|
|
6675
|
+
add(dep);
|
|
6676
|
+
}
|
|
6677
|
+
}
|
|
6678
|
+
};
|
|
6679
|
+
for (var item of list) {
|
|
6680
|
+
add(item);
|
|
6681
|
+
}
|
|
6682
|
+
return itemsByPkg;
|
|
6683
|
+
}
|
|
6684
|
+
function loadBrickModule(_x3, _x4, _x5) {
|
|
6685
|
+
return _loadBrickModule.apply(this, arguments);
|
|
6686
|
+
}
|
|
6687
|
+
function _loadBrickModule() {
|
|
6688
|
+
_loadBrickModule = _asyncToGenerator__default["default"](function* (type, pkgId, itemName) {
|
|
6689
|
+
var moduleName = "".concat(type === "processors" ? "./processors/" : "./").concat(itemName);
|
|
6690
|
+
try {
|
|
6691
|
+
yield loadSharedModule(pkgId, moduleName);
|
|
6692
|
+
} catch (error) {
|
|
6693
|
+
// eslint-disable-next-line no-console
|
|
6694
|
+
console.error(error);
|
|
6695
|
+
throw new Error("Load ".concat(type, " of \"").concat(pkgId.split("/").pop(), ".").concat(moduleName.split("/").pop(), "\" failed"));
|
|
6696
|
+
}
|
|
6697
|
+
});
|
|
6698
|
+
return _loadBrickModule.apply(this, arguments);
|
|
6699
|
+
}
|
|
6700
|
+
function loadRestBricks(type, pkgs, itemsMap) {
|
|
6701
|
+
return pkgs.map( /*#__PURE__*/function () {
|
|
6702
|
+
var _ref = _asyncToGenerator__default["default"](function* (pkg) {
|
|
6703
|
+
var _window$PUBLIC_ROOT;
|
|
6704
|
+
yield loadScript(pkg.filePath, (_window$PUBLIC_ROOT = window.PUBLIC_ROOT) !== null && _window$PUBLIC_ROOT !== void 0 ? _window$PUBLIC_ROOT : "");
|
|
6705
|
+
yield waitBasicPkg;
|
|
6706
|
+
return Promise.all(
|
|
6707
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
6708
|
+
itemsMap.get(pkg).map(itemName => loadBrickModule(type, pkg.id, itemName)));
|
|
6709
|
+
});
|
|
6710
|
+
return function (_x6) {
|
|
6711
|
+
return _ref.apply(this, arguments);
|
|
6712
|
+
};
|
|
6713
|
+
}());
|
|
6714
|
+
}
|
|
6715
|
+
function enqueueStableLoad(_x7, _x8, _x9) {
|
|
6716
|
+
return _enqueueStableLoad.apply(this, arguments);
|
|
6717
|
+
}
|
|
6718
|
+
function _enqueueStableLoad() {
|
|
6719
|
+
_enqueueStableLoad = _asyncToGenerator__default["default"](function* (type, list, brickPackages) {
|
|
6720
|
+
var brickPackagesMap = new Map();
|
|
6721
|
+
for (var pkg of brickPackages) {
|
|
6722
|
+
var _pkg$id;
|
|
6723
|
+
var pkgId = (_pkg$id = pkg.id) !== null && _pkg$id !== void 0 ? _pkg$id : getPkgIdByFilePath(pkg.filePath);
|
|
6724
|
+
brickPackagesMap.set(pkgId, pkg);
|
|
6725
|
+
}
|
|
6726
|
+
var itemsByPkg = getItemsByPkg(type, list, brickPackagesMap);
|
|
6727
|
+
var foundBasicPkg;
|
|
6728
|
+
var v2Packages = [];
|
|
6729
|
+
var v3PackagesOtherThanBasic = [];
|
|
6730
|
+
var maybeV2Adapter;
|
|
6731
|
+
for (var _pkg of itemsByPkg.keys()) {
|
|
6732
|
+
if (_pkg.id) {
|
|
6733
|
+
if (_pkg.id === "bricks/basic") {
|
|
6734
|
+
foundBasicPkg = _pkg;
|
|
6735
|
+
} else {
|
|
6736
|
+
v3PackagesOtherThanBasic.push(_pkg);
|
|
6737
|
+
}
|
|
6738
|
+
} else {
|
|
6739
|
+
// Brick packages of v2 has no `id`
|
|
6740
|
+
v2Packages.push(_pkg);
|
|
6741
|
+
maybeV2Adapter = brickPackagesMap.get("bricks/v2-adapter");
|
|
6742
|
+
if (!maybeV2Adapter) {
|
|
6743
|
+
// eslint-disable-next-line no-console
|
|
6744
|
+
console.error("Using v2 bricks, but v2-adapter not found");
|
|
6745
|
+
}
|
|
6746
|
+
}
|
|
6747
|
+
}
|
|
6748
|
+
var v2Adapter = maybeV2Adapter;
|
|
6749
|
+
var basicPkgPromise;
|
|
6750
|
+
var basicPkg = foundBasicPkg;
|
|
6751
|
+
if (basicPkg) {
|
|
6752
|
+
var _window$PUBLIC_ROOT2;
|
|
6753
|
+
var tempPromise = loadScript(basicPkg.filePath, (_window$PUBLIC_ROOT2 = window.PUBLIC_ROOT) !== null && _window$PUBLIC_ROOT2 !== void 0 ? _window$PUBLIC_ROOT2 : "");
|
|
6754
|
+
// Packages other than BASIC will wait for an extra micro-task tick.
|
|
6755
|
+
if (!basicPkgWillBeResolved) {
|
|
6756
|
+
basicPkgWillBeResolved = true;
|
|
6757
|
+
tempPromise.then(() => Promise.resolve()).then(resolveBasicPkg);
|
|
6758
|
+
}
|
|
6759
|
+
basicPkgPromise = tempPromise.then(() => Promise.all(
|
|
6760
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
6761
|
+
itemsByPkg.get(basicPkg).map(itemName => loadBrickModule(type, basicPkg.id, itemName))));
|
|
6762
|
+
}
|
|
6763
|
+
var pkgPromises = [basicPkgPromise].concat(loadRestBricks(type, v3PackagesOtherThanBasic, itemsByPkg));
|
|
6764
|
+
if (v2Adapter && v2Packages.length > 0) {
|
|
6765
|
+
if (!v2AdapterPromise) {
|
|
6766
|
+
// Load `v2-adapter.load-bricks` and its dependencies
|
|
6767
|
+
var v2AdapterItemsByPkg = getItemsByPkg("bricks", [V2_ADAPTER_LOAD_BRICKS], brickPackagesMap);
|
|
6768
|
+
var v2AdapterPackages = [...v2AdapterItemsByPkg.keys()];
|
|
6769
|
+
var loadV2Adapter = /*#__PURE__*/function () {
|
|
6770
|
+
var _ref2 = _asyncToGenerator__default["default"](function* () {
|
|
6771
|
+
yield Promise.all(loadRestBricks("bricks", v2AdapterPackages, v2AdapterItemsByPkg));
|
|
6772
|
+
return document.createElement(V2_ADAPTER_LOAD_BRICKS);
|
|
6773
|
+
});
|
|
6774
|
+
return function loadV2Adapter() {
|
|
6775
|
+
return _ref2.apply(this, arguments);
|
|
6776
|
+
};
|
|
6777
|
+
}();
|
|
6778
|
+
v2AdapterPromise = loadV2Adapter();
|
|
6779
|
+
}
|
|
6780
|
+
pkgPromises.push(v2AdapterPromise.then(adapter => Promise.all(v2Packages.map(pkg => {
|
|
6781
|
+
var pkgId = getPkgIdByFilePath(pkg.filePath);
|
|
6782
|
+
var pkgNamespace = pkgId.split("/")[1];
|
|
6783
|
+
return adapter.resolve(v2Adapter.filePath, pkg.filePath, type === "bricks" ?
|
|
6784
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
6785
|
+
itemsByPkg.get(pkg).map(itemName => "".concat(pkgNamespace, ".").concat(itemName)) : [], pkg.dll,
|
|
6786
|
+
// Todo: remove `brickPackages` as an argument
|
|
6787
|
+
brickPackages);
|
|
6788
|
+
}))));
|
|
6789
|
+
}
|
|
6790
|
+
yield Promise.all(pkgPromises);
|
|
6791
|
+
});
|
|
6792
|
+
return _enqueueStableLoad.apply(this, arguments);
|
|
6793
|
+
}
|
|
6794
|
+
function dispatchRequestStatus(_x10) {
|
|
6795
|
+
return _dispatchRequestStatus.apply(this, arguments);
|
|
6796
|
+
}
|
|
6797
|
+
function _dispatchRequestStatus() {
|
|
6798
|
+
_dispatchRequestStatus = _asyncToGenerator__default["default"](function* (promise) {
|
|
6799
|
+
window.dispatchEvent(new Event("request.start"));
|
|
6800
|
+
try {
|
|
6801
|
+
yield promise;
|
|
6802
|
+
} finally {
|
|
6803
|
+
window.dispatchEvent(new Event("request.end"));
|
|
6804
|
+
}
|
|
6805
|
+
});
|
|
6806
|
+
return _dispatchRequestStatus.apply(this, arguments);
|
|
6807
|
+
}
|
|
6808
|
+
function getProcessorPackageName(camelPackageName) {
|
|
6809
|
+
return camelPackageName.replace(/[A-Z]/g, match => "-".concat(match[0].toLocaleLowerCase())).replace(/_[0-9]/g, match => "-".concat(match[1]));
|
|
6810
|
+
}
|
|
6811
|
+
function getPkgIdByFilePath(filePath) {
|
|
6812
|
+
return filePath.split("/").slice(0, 2).join("/");
|
|
6813
|
+
}
|
|
6814
|
+
|
|
6815
|
+
/**
|
|
6816
|
+
* Merge `app.defaultConfig` and `app.userConfig` to `app.config`.
|
|
6817
|
+
*
|
|
6818
|
+
* @param bootstrapResponse - Response of bootstrap API.
|
|
6819
|
+
*/
|
|
6820
|
+
function processBootstrapResponse(bootstrapResponse) {
|
|
6821
|
+
for (var storyboard of bootstrapResponse.storyboards) {
|
|
6822
|
+
var app = storyboard.app;
|
|
6823
|
+
if (app) {
|
|
6824
|
+
app.config = brickUtils.deepFreeze(_.merge({}, app.defaultConfig, app.userConfig));
|
|
6825
|
+
if (app.locales) {
|
|
6826
|
+
(function () {
|
|
6827
|
+
// Prefix to avoid conflict between brick package's i18n namespace.
|
|
6828
|
+
var ns = "$tmp-".concat(app.id);
|
|
6829
|
+
// Support any languages in `app.locales`.
|
|
6830
|
+
Object.entries(app.locales).forEach(_ref => {
|
|
6831
|
+
var [lang, resources] = _ref;
|
|
6832
|
+
i18next__default["default"].addResourceBundle(lang, ns, resources);
|
|
6833
|
+
});
|
|
6834
|
+
// Use `app.name` as the fallback `app.localeName`.
|
|
6835
|
+
app.localeName = i18next__default["default"].getFixedT(null, ns)("name", app.name);
|
|
6836
|
+
// Remove the temporary i18n resource bundles.
|
|
6837
|
+
Object.keys(app.locales).forEach(lang => {
|
|
6838
|
+
i18next__default["default"].removeResourceBundle(lang, ns);
|
|
6839
|
+
});
|
|
6840
|
+
})();
|
|
6841
|
+
} else {
|
|
6842
|
+
app.localeName = app.name;
|
|
6843
|
+
}
|
|
6844
|
+
}
|
|
6845
|
+
}
|
|
6846
|
+
if (bootstrapResponse.settings) {
|
|
6847
|
+
bootstrapResponse.settings = brickUtils.deepFreeze(bootstrapResponse.settings);
|
|
6848
|
+
}
|
|
6849
|
+
bootstrapResponse.brickPackages = brickUtils.deepFreeze(bootstrapResponse.brickPackages);
|
|
6361
6850
|
bootstrapResponse.templatePackages = brickUtils.deepFreeze(bootstrapResponse.templatePackages);
|
|
6362
6851
|
}
|
|
6363
6852
|
|
|
@@ -6534,7 +7023,7 @@
|
|
|
6534
7023
|
};
|
|
6535
7024
|
}();
|
|
6536
7025
|
|
|
6537
|
-
var _excluded$
|
|
7026
|
+
var _excluded$4 = ["feature_flags"],
|
|
6538
7027
|
_excluded2$1 = ["featureFlags", "misc"];
|
|
6539
7028
|
function standaloneBootstrap() {
|
|
6540
7029
|
return _standaloneBootstrap.apply(this, arguments);
|
|
@@ -6580,7 +7069,7 @@
|
|
|
6580
7069
|
var {
|
|
6581
7070
|
feature_flags: featureFlags
|
|
6582
7071
|
} = sys_settings,
|
|
6583
|
-
rest = _objectWithoutProperties__default["default"](sys_settings, _excluded$
|
|
7072
|
+
rest = _objectWithoutProperties__default["default"](sys_settings, _excluded$4);
|
|
6584
7073
|
settings = _objectSpread__default["default"]({
|
|
6585
7074
|
featureFlags
|
|
6586
7075
|
}, rest);
|
|
@@ -7538,28 +8027,6 @@
|
|
|
7538
8027
|
var filterProperties = ["instanceId", "brick", "slots", "properties", "events", "if", "context", "bricks", "mountPoint"];
|
|
7539
8028
|
var symbolForFormContextId = Symbol.for("form.contextId");
|
|
7540
8029
|
|
|
7541
|
-
var customTemplateRegistry = new Map();
|
|
7542
|
-
var appRegistered = new Set();
|
|
7543
|
-
var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
|
|
7544
|
-
var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
|
|
7545
|
-
var symbolForTplContextId = Symbol.for("tpl.contextId");
|
|
7546
|
-
|
|
7547
|
-
function isBasicProperty(propRef) {
|
|
7548
|
-
return !!propRef.refProperty;
|
|
7549
|
-
}
|
|
7550
|
-
function isTransformableProperty(propRef) {
|
|
7551
|
-
return !!propRef.refTransform;
|
|
7552
|
-
}
|
|
7553
|
-
function isMergeableProperty(propRef) {
|
|
7554
|
-
return !!propRef.mergeProperty;
|
|
7555
|
-
}
|
|
7556
|
-
function isRefProperty(propRef) {
|
|
7557
|
-
return !!propRef.ref;
|
|
7558
|
-
}
|
|
7559
|
-
function isVariableProperty(propRef) {
|
|
7560
|
-
return !!propRef.asVariable;
|
|
7561
|
-
}
|
|
7562
|
-
|
|
7563
8030
|
function collectRefsInTemplate(template) {
|
|
7564
8031
|
var refMap = new Map();
|
|
7565
8032
|
collectRefsInBrickConfs(template.bricks, refMap);
|
|
@@ -7615,207 +8082,6 @@
|
|
|
7615
8082
|
}
|
|
7616
8083
|
}
|
|
7617
8084
|
|
|
7618
|
-
function propertyMerge(conf, value, object) {
|
|
7619
|
-
return propertyMergeAll(conf.$$mergeBase, Object.fromEntries(conf.$$mergeBase.proxies.map(proxy => [proxy.$$reversedRef, proxy === conf ? value : object[proxy.$$reversedRef]])));
|
|
7620
|
-
}
|
|
7621
|
-
function propertyMergeAll(mergeBase, object) {
|
|
7622
|
-
if (mergeBase.mergeType === "array") {
|
|
7623
|
-
return propertyMergeAllOfArray(mergeBase, object);
|
|
7624
|
-
}
|
|
7625
|
-
if (mergeBase.mergeType === "object") {
|
|
7626
|
-
return propertyMergeAllOfObject(mergeBase, object);
|
|
7627
|
-
}
|
|
7628
|
-
// istanbul ignore next: should never reach
|
|
7629
|
-
throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
|
|
7630
|
-
}
|
|
7631
|
-
function propertyMergeAllOfArray(_ref, object) {
|
|
7632
|
-
var _$1, _proxy$mergeArgs;
|
|
7633
|
-
var {
|
|
7634
|
-
baseValue,
|
|
7635
|
-
context,
|
|
7636
|
-
proxies
|
|
7637
|
-
} = _ref;
|
|
7638
|
-
// Use an approach like template-literal's quasis:
|
|
7639
|
-
// `quasi0${0}quais1${1}quasi2...`
|
|
7640
|
-
// Every quasi can be merged with multiple items.
|
|
7641
|
-
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
|
|
7642
|
-
$$lazyForUseBrick: true
|
|
7643
|
-
}) : [];
|
|
7644
|
-
var quasis = [];
|
|
7645
|
-
var size = computedBaseValue.length + 1;
|
|
7646
|
-
for (var i = 0; i < size; i += 1) {
|
|
7647
|
-
quasis.push([]);
|
|
7648
|
-
}
|
|
7649
|
-
for (var proxy of proxies) {
|
|
7650
|
-
var position = void 0;
|
|
7651
|
-
switch (proxy.mergeMethod) {
|
|
7652
|
-
case "append":
|
|
7653
|
-
position = computedBaseValue.length;
|
|
7654
|
-
break;
|
|
7655
|
-
case "prepend":
|
|
7656
|
-
position = 0;
|
|
7657
|
-
break;
|
|
7658
|
-
case "insertAt":
|
|
7659
|
-
// Defaults to `-1`.
|
|
7660
|
-
position = (_$1 = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _$1 !== void 0 ? _$1 : -1;
|
|
7661
|
-
if (position < 0) {
|
|
7662
|
-
// It's counted from the end if position is negative.
|
|
7663
|
-
position += quasis.length;
|
|
7664
|
-
}
|
|
7665
|
-
position = _.clamp(position, 0, computedBaseValue.length);
|
|
7666
|
-
break;
|
|
7667
|
-
// istanbul ignore next: should never reach
|
|
7668
|
-
default:
|
|
7669
|
-
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
7670
|
-
}
|
|
7671
|
-
var patchValue = object[proxy.$$reversedRef];
|
|
7672
|
-
if (!Array.isArray(patchValue)) {
|
|
7673
|
-
patchValue = [];
|
|
7674
|
-
}
|
|
7675
|
-
quasis[position].push(...patchValue);
|
|
7676
|
-
}
|
|
7677
|
-
return quasis.flatMap((item, index) => index < computedBaseValue.length ? item.concat(computedBaseValue[index]) : item);
|
|
7678
|
-
}
|
|
7679
|
-
function propertyMergeAllOfObject(_ref2, object) {
|
|
7680
|
-
var {
|
|
7681
|
-
baseValue,
|
|
7682
|
-
proxies,
|
|
7683
|
-
context
|
|
7684
|
-
} = _ref2;
|
|
7685
|
-
var computedBaseValue = brickUtils.isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
|
|
7686
|
-
return proxies.reduce((acc, proxy) => {
|
|
7687
|
-
switch (proxy.mergeMethod) {
|
|
7688
|
-
case "extend":
|
|
7689
|
-
return _objectSpread__default["default"](_objectSpread__default["default"]({}, acc), object[proxy.$$reversedRef]);
|
|
7690
|
-
// istanbul ignore next: should never reach
|
|
7691
|
-
default:
|
|
7692
|
-
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
7693
|
-
}
|
|
7694
|
-
}, computedBaseValue);
|
|
7695
|
-
}
|
|
7696
|
-
|
|
7697
|
-
function setupTemplateProxy(proxyContext, ref, slots) {
|
|
7698
|
-
var computedPropsFromProxy = {};
|
|
7699
|
-
var refForProxy;
|
|
7700
|
-
var {
|
|
7701
|
-
reversedProxies,
|
|
7702
|
-
templateProperties,
|
|
7703
|
-
externalSlots,
|
|
7704
|
-
templateContextId,
|
|
7705
|
-
proxyBrick
|
|
7706
|
-
} = proxyContext;
|
|
7707
|
-
if (ref && reversedProxies) {
|
|
7708
|
-
refForProxy = {};
|
|
7709
|
-
proxyBrick.proxyRefs.set(ref, refForProxy);
|
|
7710
|
-
|
|
7711
|
-
// Reversed proxies are used for expand storyboard before rendering page.
|
|
7712
|
-
if (reversedProxies.properties.has(ref)) {
|
|
7713
|
-
Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(propRef => {
|
|
7714
|
-
// `propValue` is computed.
|
|
7715
|
-
var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[propRef.$$reversedRef];
|
|
7716
|
-
if (isTransformableProperty(propRef)) {
|
|
7717
|
-
return Object.entries(preprocessTransformProperties({
|
|
7718
|
-
[propRef.$$reversedRef]: propValue
|
|
7719
|
-
}, propRef.refTransform));
|
|
7720
|
-
}
|
|
7721
|
-
if (isBasicProperty(propRef)) {
|
|
7722
|
-
return [[propRef.refProperty, propValue]];
|
|
7723
|
-
}
|
|
7724
|
-
// Ignore Variable properties.
|
|
7725
|
-
// And mergeable properties are processed later.
|
|
7726
|
-
return [];
|
|
7727
|
-
}).filter(propRef => propRef[1] !== undefined)));
|
|
7728
|
-
|
|
7729
|
-
// Brick properties can be merged multiple times.
|
|
7730
|
-
if (reversedProxies.mergeBases.has(ref)) {
|
|
7731
|
-
Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref => {
|
|
7732
|
-
var [mergeProperty, mergeBase] = _ref;
|
|
7733
|
-
return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
|
|
7734
|
-
}).filter(item => item[1] !== undefined)));
|
|
7735
|
-
}
|
|
7736
|
-
}
|
|
7737
|
-
|
|
7738
|
-
// Use an approach like template-literal's quasis:
|
|
7739
|
-
// `quasi0${0}quais1${1}quasi2...`
|
|
7740
|
-
// Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
|
|
7741
|
-
var quasisMap = new Map();
|
|
7742
|
-
if (reversedProxies.slots.has(ref)) {
|
|
7743
|
-
for (var item of reversedProxies.slots.get(ref)) {
|
|
7744
|
-
var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
|
|
7745
|
-
if (!quasisMap.has(item.refSlot)) {
|
|
7746
|
-
var quasis = [];
|
|
7747
|
-
// The size of quasis should be the existed slotted bricks' size plus one.
|
|
7748
|
-
var size = brickUtils.hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
|
|
7749
|
-
for (var i = 0; i < size; i += 1) {
|
|
7750
|
-
quasis.push([]);
|
|
7751
|
-
}
|
|
7752
|
-
quasisMap.set(item.refSlot, quasis);
|
|
7753
|
-
}
|
|
7754
|
-
var expandableSlot = quasisMap.get(item.refSlot);
|
|
7755
|
-
var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
|
|
7756
|
-
expandableSlot[_.clamp(refPosition < 0 ? expandableSlot.length + refPosition : refPosition, 0, expandableSlot.length - 1)].push(...((_externalSlots$item$$ = externalSlots === null || externalSlots === void 0 ? void 0 : (_externalSlots$item$$2 = externalSlots[item.$$reversedRef]) === null || _externalSlots$item$$2 === void 0 ? void 0 : _externalSlots$item$$2.bricks) !== null && _externalSlots$item$$ !== void 0 ? _externalSlots$item$$ : []));
|
|
7757
|
-
}
|
|
7758
|
-
}
|
|
7759
|
-
var _loop = function (slotName, _quasis) {
|
|
7760
|
-
if (!brickUtils.hasOwnProperty(slots, slotName)) {
|
|
7761
|
-
slots[slotName] = {
|
|
7762
|
-
type: "bricks",
|
|
7763
|
-
bricks: []
|
|
7764
|
-
};
|
|
7765
|
-
}
|
|
7766
|
-
var slotConf = slots[slotName];
|
|
7767
|
-
slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
|
|
7768
|
-
if (slotConf.bricks.length === 0) {
|
|
7769
|
-
delete slots[slotName];
|
|
7770
|
-
}
|
|
7771
|
-
};
|
|
7772
|
-
for (var [slotName, _quasis] of quasisMap.entries()) {
|
|
7773
|
-
_loop(slotName, _quasis);
|
|
7774
|
-
}
|
|
7775
|
-
}
|
|
7776
|
-
return {
|
|
7777
|
-
[symbolForComputedPropsFromProxy]: computedPropsFromProxy,
|
|
7778
|
-
[symbolForRefForProxy]: refForProxy,
|
|
7779
|
-
[symbolForTplContextId]: templateContextId
|
|
7780
|
-
};
|
|
7781
|
-
}
|
|
7782
|
-
|
|
7783
|
-
var _excluded$4 = ["properties", "slots"];
|
|
7784
|
-
function setupUseBrickInTemplate(props, proxyContext) {
|
|
7785
|
-
function walk(props) {
|
|
7786
|
-
if (!brickUtils.isObject(props)) {
|
|
7787
|
-
return props;
|
|
7788
|
-
}
|
|
7789
|
-
if (Array.isArray(props)) {
|
|
7790
|
-
return props.map(walk);
|
|
7791
|
-
}
|
|
7792
|
-
return Object.fromEntries(Object.entries(props).map(_ref => {
|
|
7793
|
-
var [key, value] = _ref;
|
|
7794
|
-
return brickUtils.isObject(value) && key === "useBrick" ? Array.isArray(value) ? [key, value.map(setup)] : [key, setup(value)] : [key, walk(value)];
|
|
7795
|
-
}).concat(Object.getOwnPropertySymbols(props).map(k => [k, props[k]])));
|
|
7796
|
-
}
|
|
7797
|
-
function setup(item) {
|
|
7798
|
-
var {
|
|
7799
|
-
properties,
|
|
7800
|
-
slots: originalSlots
|
|
7801
|
-
} = item,
|
|
7802
|
-
restConf = _objectWithoutProperties__default["default"](item, _excluded$4);
|
|
7803
|
-
var slots = Object.fromEntries(Object.entries(originalSlots !== null && originalSlots !== void 0 ? originalSlots : {}).map(_ref2 => {
|
|
7804
|
-
var _slotConf$bricks;
|
|
7805
|
-
var [slotName, slotConf] = _ref2;
|
|
7806
|
-
return [slotName, {
|
|
7807
|
-
type: "bricks",
|
|
7808
|
-
bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(setup)
|
|
7809
|
-
}];
|
|
7810
|
-
}));
|
|
7811
|
-
return _objectSpread__default["default"](_objectSpread__default["default"]({}, restConf), {}, {
|
|
7812
|
-
properties: walk(properties),
|
|
7813
|
-
slots
|
|
7814
|
-
}, setupTemplateProxy(proxyContext, restConf.ref, slots));
|
|
7815
|
-
}
|
|
7816
|
-
return walk(props);
|
|
7817
|
-
}
|
|
7818
|
-
|
|
7819
8085
|
var _excluded$3 = ["properties", "slots"],
|
|
7820
8086
|
_excluded2 = ["ref", "slots"];
|
|
7821
8087
|
function expandCustomTemplate(brickConf, proxyBrick, context) {
|
|
@@ -8313,6 +8579,7 @@
|
|
|
8313
8579
|
pendingTask: Promise.resolve()
|
|
8314
8580
|
};
|
|
8315
8581
|
} else {
|
|
8582
|
+
var _eager$v3Bricks;
|
|
8316
8583
|
// 先加载模板
|
|
8317
8584
|
var templateDeps = brickUtils.getTemplateDepsOfStoryboard(storyboard, templatePackages);
|
|
8318
8585
|
yield loadScriptOfBricksOrTemplates(templateDeps);
|
|
@@ -8321,6 +8588,8 @@
|
|
|
8321
8588
|
dll,
|
|
8322
8589
|
deps,
|
|
8323
8590
|
bricks,
|
|
8591
|
+
v3Bricks,
|
|
8592
|
+
v3Processors,
|
|
8324
8593
|
eager
|
|
8325
8594
|
} = brickUtils.getDllAndDepsOfStoryboard(yield brickUtils.asyncProcessStoryboard(storyboard, brickTemplateRegistry, templatePackages), brickPackages, {
|
|
8326
8595
|
ignoreBricksInUnusedCustomTemplates: true
|
|
@@ -8328,10 +8597,15 @@
|
|
|
8328
8597
|
// 需要先阻塞加载 Custom Processors 和 widgets。
|
|
8329
8598
|
yield loadScriptOfDll(eager.dll);
|
|
8330
8599
|
yield loadScriptOfBricksOrTemplates(eager.deps);
|
|
8600
|
+
if ((_eager$v3Bricks = eager.v3Bricks) !== null && _eager$v3Bricks !== void 0 && _eager$v3Bricks.length) {
|
|
8601
|
+
yield loadBricksImperatively(eager.v3Bricks, brickPackages);
|
|
8602
|
+
}
|
|
8331
8603
|
// 加载构件资源时,不再阻塞后续业务数据的加载,在挂载构件时再等待该任务完成。
|
|
8332
8604
|
// 挂载构件可能包括:Provider 构件实时挂载、路由准备完成后的统一挂载等。
|
|
8333
8605
|
return {
|
|
8334
|
-
pendingTask: loadScriptOfDll(dll).then(() => loadScriptOfBricksOrTemplates(deps)).then((
|
|
8606
|
+
pendingTask: loadScriptOfDll(dll).then(() => loadScriptOfBricksOrTemplates(deps)).then( /*#__PURE__*/_asyncToGenerator__default["default"](function* () {
|
|
8607
|
+
yield Promise.all([loadLazyBricks(bricks), (v3Bricks === null || v3Bricks === void 0 ? void 0 : v3Bricks.length) && loadBricksImperatively(v3Bricks, brickPackages), (v3Processors === null || v3Processors === void 0 ? void 0 : v3Processors.length) && loadProcessorsImperatively(v3Processors, brickPackages)]);
|
|
8608
|
+
}))
|
|
8335
8609
|
};
|
|
8336
8610
|
}
|
|
8337
8611
|
});
|
|
@@ -8340,28 +8614,33 @@
|
|
|
8340
8614
|
};
|
|
8341
8615
|
}());
|
|
8342
8616
|
_defineProperty__default["default"](this, "_loadDynamicBricks", /*#__PURE__*/function () {
|
|
8343
|
-
var
|
|
8617
|
+
var _ref3 = _asyncToGenerator__default["default"](function* (bricks, processors) {
|
|
8344
8618
|
var filteredBricks = bricks.filter(
|
|
8345
8619
|
// Only try to load undefined custom elements.
|
|
8346
8620
|
item => !customElements.get(item));
|
|
8621
|
+
var {
|
|
8622
|
+
brickPackages
|
|
8623
|
+
} = _this.bootstrapData;
|
|
8347
8624
|
// Try to load deps for dynamic added bricks.
|
|
8348
8625
|
var {
|
|
8349
8626
|
dll,
|
|
8350
|
-
deps
|
|
8627
|
+
deps,
|
|
8628
|
+
v3Bricks,
|
|
8629
|
+
v3Processors
|
|
8351
8630
|
} = brickUtils.getDllAndDepsByResource({
|
|
8352
8631
|
bricks: filteredBricks,
|
|
8353
8632
|
processors
|
|
8354
8633
|
}, _this.bootstrapData.brickPackages);
|
|
8355
8634
|
yield loadScriptOfDll(dll);
|
|
8356
8635
|
yield loadScriptOfBricksOrTemplates(deps);
|
|
8357
|
-
yield loadLazyBricks(filteredBricks);
|
|
8636
|
+
yield Promise.all([loadLazyBricks(filteredBricks), (v3Bricks === null || v3Bricks === void 0 ? void 0 : v3Bricks.length) && loadBricksImperatively(v3Bricks, brickPackages), (v3Processors === null || v3Processors === void 0 ? void 0 : v3Processors.length) && loadProcessorsImperatively(v3Processors, brickPackages)]);
|
|
8358
8637
|
});
|
|
8359
8638
|
return function (_x2, _x3) {
|
|
8360
|
-
return
|
|
8639
|
+
return _ref3.apply(this, arguments);
|
|
8361
8640
|
};
|
|
8362
8641
|
}());
|
|
8363
8642
|
_defineProperty__default["default"](this, "_loadEditorBricks", /*#__PURE__*/function () {
|
|
8364
|
-
var
|
|
8643
|
+
var _ref4 = _asyncToGenerator__default["default"](function* (editorBricks) {
|
|
8365
8644
|
var {
|
|
8366
8645
|
dll,
|
|
8367
8646
|
deps
|
|
@@ -8374,7 +8653,7 @@
|
|
|
8374
8653
|
yield loadScriptOfBricksOrTemplates(deps);
|
|
8375
8654
|
});
|
|
8376
8655
|
return function (_x4) {
|
|
8377
|
-
return
|
|
8656
|
+
return _ref4.apply(this, arguments);
|
|
8378
8657
|
};
|
|
8379
8658
|
}());
|
|
8380
8659
|
}
|
|
@@ -8558,8 +8837,8 @@
|
|
|
8558
8837
|
// Prefix to avoid conflict between brick package's i18n namespace.
|
|
8559
8838
|
var i18nNamespace = getI18nNamespace("app", storyboard.app.id);
|
|
8560
8839
|
// Support any language in `meta.i18n`.
|
|
8561
|
-
Object.entries(storyboard.meta.i18n).forEach(
|
|
8562
|
-
var [lang, resources] =
|
|
8840
|
+
Object.entries(storyboard.meta.i18n).forEach(_ref5 => {
|
|
8841
|
+
var [lang, resources] = _ref5;
|
|
8563
8842
|
i18next__default["default"].addResourceBundle(lang, i18nNamespace, resources);
|
|
8564
8843
|
});
|
|
8565
8844
|
}
|
|
@@ -8981,8 +9260,8 @@
|
|
|
8981
9260
|
});
|
|
8982
9261
|
});
|
|
8983
9262
|
if (!filterMenus.length) {
|
|
8984
|
-
var
|
|
8985
|
-
filterMenus = (
|
|
9263
|
+
var _ref6, _yield$InstanceApi_po;
|
|
9264
|
+
filterMenus = (_ref6 = (_yield$InstanceApi_po = yield InstanceApi_postSearch("STANDALONE_MENU@EASYOPS", {
|
|
8986
9265
|
page: 1,
|
|
8987
9266
|
page_size: 200,
|
|
8988
9267
|
fields: {
|
|
@@ -9011,7 +9290,7 @@
|
|
|
9011
9290
|
$eq: true
|
|
9012
9291
|
}
|
|
9013
9292
|
}
|
|
9014
|
-
})) === null || _yield$InstanceApi_po === void 0 ? void 0 : _yield$InstanceApi_po.list) !== null &&
|
|
9293
|
+
})) === null || _yield$InstanceApi_po === void 0 ? void 0 : _yield$InstanceApi_po.list) !== null && _ref6 !== void 0 ? _ref6 : [];
|
|
9015
9294
|
}
|
|
9016
9295
|
return filterMenus;
|
|
9017
9296
|
})();
|