@next-core/brick-kit 2.165.6 → 2.166.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 +249 -242
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +250 -243
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/CustomTemplates/setupUseBrickInTemplate.d.ts +1 -1
- package/dist/types/core/CustomTemplates/setupUseBrickInTemplate.d.ts.map +1 -1
- package/dist/types/internal/getGeneralGlobals.d.ts +1 -1
- package/dist/types/internal/getGeneralGlobals.d.ts.map +1 -1
- package/dist/types/internal/images.d.ts +1 -1
- package/dist/types/internal/images.d.ts.map +1 -1
- package/dist/types/internal/setProperties.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
4
|
import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
|
|
5
5
|
import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
|
|
6
|
-
import _, { set, get, difference, identity, uniqueId, cloneDeep,
|
|
6
|
+
import _, { set, get, difference, identity, uniqueId, cloneDeep, isNil, isEmpty, merge, sortBy, orderBy, isObject as isObject$1, clamp, uniq, pick, omit, findLastIndex, noop, isString as isString$1 } from 'lodash';
|
|
7
7
|
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, trackFormState, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, shouldAllowRecursiveEvaluations, preevaluate, inject, scanPermissionActionsInAny, deepFreeze, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
8
8
|
import React, { useState, useEffect, useRef, useMemo, useCallback, forwardRef, useImperativeHandle, useContext, createContext, useReducer } from 'react';
|
|
9
9
|
import { http, HttpResponseError, HttpAbortError, HttpFetchError } from '@next-core/brick-http';
|
|
@@ -645,10 +645,25 @@ function getUrlBySegueFactory(app, segues) {
|
|
|
645
645
|
};
|
|
646
646
|
}
|
|
647
647
|
|
|
648
|
-
function imagesFactory(appId, isBuildPush) {
|
|
648
|
+
function imagesFactory(appId, isBuildPush, version) {
|
|
649
649
|
return {
|
|
650
650
|
get(name) {
|
|
651
|
-
|
|
651
|
+
var getSuffix = () => {
|
|
652
|
+
var suffix = window.APP_ROOT ? "".concat(window.APP_ROOT, "-/") : "";
|
|
653
|
+
if (!suffix.startsWith("/")) {
|
|
654
|
+
suffix = getBasePath() + suffix;
|
|
655
|
+
}
|
|
656
|
+
if (window.APP_ID && window.APP_ID !== appId) {
|
|
657
|
+
return suffix.replace(new RegExp("/(".concat(window.APP_ID, "|\\d+.\\d+.\\d+)/"), "g"), (_, p1) => {
|
|
658
|
+
if (p1 === window.APP_ID) {
|
|
659
|
+
return "/".concat(appId, "/");
|
|
660
|
+
}
|
|
661
|
+
return "/".concat(version, "/");
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
return suffix;
|
|
665
|
+
};
|
|
666
|
+
return isBuildPush ? "".concat(getBasePath(), "api/gateway/object_store.object_store.GetObject/api/v1/objectStore/bucket/next-builder/object/").concat(name) : "".concat(getSuffix(), "micro-apps/").concat(appId, "/images/").concat(name);
|
|
652
667
|
}
|
|
653
668
|
};
|
|
654
669
|
}
|
|
@@ -1403,7 +1418,7 @@ function getIndividualGlobal(variableName, _ref) {
|
|
|
1403
1418
|
case "FN":
|
|
1404
1419
|
return storyboardFunctions;
|
|
1405
1420
|
case "IMG":
|
|
1406
|
-
return collectCoverage ? fakeImageFactory() : widgetId ? widgetImagesFactory(widgetId, widgetVersion) : imagesFactory(app.id, app.isBuildPush);
|
|
1421
|
+
return collectCoverage ? fakeImageFactory() : widgetId ? widgetImagesFactory(widgetId, widgetVersion) : imagesFactory(app.id, app.isBuildPush, app.currentVersion);
|
|
1407
1422
|
case "I18N":
|
|
1408
1423
|
return collectCoverage ? identity : widgetId ? widgetI18nFactory(widgetId) : getFixedT(null, [appendI18nNamespace, getI18nNamespace("app", app.id)].filter(Boolean));
|
|
1409
1424
|
case "I18N_TEXT":
|
|
@@ -2416,232 +2431,6 @@ function evaluate(raw) {
|
|
|
2416
2431
|
}
|
|
2417
2432
|
}
|
|
2418
2433
|
|
|
2419
|
-
function isBasicProperty(propRef) {
|
|
2420
|
-
return !!propRef.refProperty;
|
|
2421
|
-
}
|
|
2422
|
-
function isTransformableProperty(propRef) {
|
|
2423
|
-
return !!propRef.refTransform;
|
|
2424
|
-
}
|
|
2425
|
-
function isMergeableProperty(propRef) {
|
|
2426
|
-
return !!propRef.mergeProperty;
|
|
2427
|
-
}
|
|
2428
|
-
function isRefProperty(propRef) {
|
|
2429
|
-
return !!propRef.ref;
|
|
2430
|
-
}
|
|
2431
|
-
function isVariableProperty(propRef) {
|
|
2432
|
-
return !!propRef.asVariable;
|
|
2433
|
-
}
|
|
2434
|
-
|
|
2435
|
-
var customTemplateRegistry = new Map();
|
|
2436
|
-
var appRegistered = new Set();
|
|
2437
|
-
var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
|
|
2438
|
-
var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
|
|
2439
|
-
var symbolForTplContextId = Symbol.for("tpl.contextId");
|
|
2440
|
-
|
|
2441
|
-
function propertyMerge(conf, value, object) {
|
|
2442
|
-
return propertyMergeAll(conf.$$mergeBase, Object.fromEntries(conf.$$mergeBase.proxies.map(proxy => [proxy.$$reversedRef, proxy === conf ? value : object[proxy.$$reversedRef]])));
|
|
2443
|
-
}
|
|
2444
|
-
function propertyMergeAll(mergeBase, object) {
|
|
2445
|
-
if (mergeBase.mergeType === "array") {
|
|
2446
|
-
return propertyMergeAllOfArray(mergeBase, object);
|
|
2447
|
-
}
|
|
2448
|
-
if (mergeBase.mergeType === "object") {
|
|
2449
|
-
return propertyMergeAllOfObject(mergeBase, object);
|
|
2450
|
-
}
|
|
2451
|
-
// istanbul ignore next: should never reach
|
|
2452
|
-
throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
|
|
2453
|
-
}
|
|
2454
|
-
function propertyMergeAllOfArray(_ref, object) {
|
|
2455
|
-
var _, _proxy$mergeArgs;
|
|
2456
|
-
var {
|
|
2457
|
-
baseValue,
|
|
2458
|
-
context,
|
|
2459
|
-
proxies
|
|
2460
|
-
} = _ref;
|
|
2461
|
-
// Use an approach like template-literal's quasis:
|
|
2462
|
-
// `quasi0${0}quais1${1}quasi2...`
|
|
2463
|
-
// Every quasi can be merged with multiple items.
|
|
2464
|
-
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
|
|
2465
|
-
$$lazyForUseBrick: true
|
|
2466
|
-
}) : [];
|
|
2467
|
-
var quasis = [];
|
|
2468
|
-
var size = computedBaseValue.length + 1;
|
|
2469
|
-
for (var i = 0; i < size; i += 1) {
|
|
2470
|
-
quasis.push([]);
|
|
2471
|
-
}
|
|
2472
|
-
for (var proxy of proxies) {
|
|
2473
|
-
var position = void 0;
|
|
2474
|
-
switch (proxy.mergeMethod) {
|
|
2475
|
-
case "append":
|
|
2476
|
-
position = computedBaseValue.length;
|
|
2477
|
-
break;
|
|
2478
|
-
case "prepend":
|
|
2479
|
-
position = 0;
|
|
2480
|
-
break;
|
|
2481
|
-
case "insertAt":
|
|
2482
|
-
// Defaults to `-1`.
|
|
2483
|
-
position = (_ = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _ !== void 0 ? _ : -1;
|
|
2484
|
-
if (position < 0) {
|
|
2485
|
-
// It's counted from the end if position is negative.
|
|
2486
|
-
position += quasis.length;
|
|
2487
|
-
}
|
|
2488
|
-
position = clamp(position, 0, computedBaseValue.length);
|
|
2489
|
-
break;
|
|
2490
|
-
// istanbul ignore next: should never reach
|
|
2491
|
-
default:
|
|
2492
|
-
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
2493
|
-
}
|
|
2494
|
-
var patchValue = object[proxy.$$reversedRef];
|
|
2495
|
-
if (!Array.isArray(patchValue)) {
|
|
2496
|
-
patchValue = [];
|
|
2497
|
-
}
|
|
2498
|
-
quasis[position].push(...patchValue);
|
|
2499
|
-
}
|
|
2500
|
-
return quasis.flatMap((item, index) => index < computedBaseValue.length ? item.concat(computedBaseValue[index]) : item);
|
|
2501
|
-
}
|
|
2502
|
-
function propertyMergeAllOfObject(_ref2, object) {
|
|
2503
|
-
var {
|
|
2504
|
-
baseValue,
|
|
2505
|
-
proxies,
|
|
2506
|
-
context
|
|
2507
|
-
} = _ref2;
|
|
2508
|
-
var computedBaseValue = isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
|
|
2509
|
-
return proxies.reduce((acc, proxy) => {
|
|
2510
|
-
switch (proxy.mergeMethod) {
|
|
2511
|
-
case "extend":
|
|
2512
|
-
return _objectSpread(_objectSpread({}, acc), object[proxy.$$reversedRef]);
|
|
2513
|
-
// istanbul ignore next: should never reach
|
|
2514
|
-
default:
|
|
2515
|
-
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
2516
|
-
}
|
|
2517
|
-
}, computedBaseValue);
|
|
2518
|
-
}
|
|
2519
|
-
|
|
2520
|
-
function setupTemplateProxy(proxyContext, ref, slots) {
|
|
2521
|
-
var computedPropsFromProxy = {};
|
|
2522
|
-
var refForProxy;
|
|
2523
|
-
var {
|
|
2524
|
-
reversedProxies,
|
|
2525
|
-
templateProperties,
|
|
2526
|
-
externalSlots,
|
|
2527
|
-
templateContextId,
|
|
2528
|
-
proxyBrick
|
|
2529
|
-
} = proxyContext;
|
|
2530
|
-
if (ref && reversedProxies) {
|
|
2531
|
-
refForProxy = {};
|
|
2532
|
-
proxyBrick.proxyRefs.set(ref, refForProxy);
|
|
2533
|
-
|
|
2534
|
-
// Reversed proxies are used for expand storyboard before rendering page.
|
|
2535
|
-
if (reversedProxies.properties.has(ref)) {
|
|
2536
|
-
Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(propRef => {
|
|
2537
|
-
// `propValue` is computed.
|
|
2538
|
-
var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[propRef.$$reversedRef];
|
|
2539
|
-
if (isTransformableProperty(propRef)) {
|
|
2540
|
-
return Object.entries(preprocessTransformProperties({
|
|
2541
|
-
[propRef.$$reversedRef]: propValue
|
|
2542
|
-
}, propRef.refTransform));
|
|
2543
|
-
}
|
|
2544
|
-
if (isBasicProperty(propRef)) {
|
|
2545
|
-
return [[propRef.refProperty, propValue]];
|
|
2546
|
-
}
|
|
2547
|
-
// Ignore Variable properties.
|
|
2548
|
-
// And mergeable properties are processed later.
|
|
2549
|
-
return [];
|
|
2550
|
-
}).filter(propRef => propRef[1] !== undefined)));
|
|
2551
|
-
|
|
2552
|
-
// Brick properties can be merged multiple times.
|
|
2553
|
-
if (reversedProxies.mergeBases.has(ref)) {
|
|
2554
|
-
Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref => {
|
|
2555
|
-
var [mergeProperty, mergeBase] = _ref;
|
|
2556
|
-
return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
|
|
2557
|
-
}).filter(item => item[1] !== undefined)));
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
|
|
2561
|
-
// Use an approach like template-literal's quasis:
|
|
2562
|
-
// `quasi0${0}quais1${1}quasi2...`
|
|
2563
|
-
// Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
|
|
2564
|
-
var quasisMap = new Map();
|
|
2565
|
-
if (reversedProxies.slots.has(ref)) {
|
|
2566
|
-
for (var item of reversedProxies.slots.get(ref)) {
|
|
2567
|
-
var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
|
|
2568
|
-
if (!quasisMap.has(item.refSlot)) {
|
|
2569
|
-
var quasis = [];
|
|
2570
|
-
// The size of quasis should be the existed slotted bricks' size plus one.
|
|
2571
|
-
var size = hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
|
|
2572
|
-
for (var i = 0; i < size; i += 1) {
|
|
2573
|
-
quasis.push([]);
|
|
2574
|
-
}
|
|
2575
|
-
quasisMap.set(item.refSlot, quasis);
|
|
2576
|
-
}
|
|
2577
|
-
var expandableSlot = quasisMap.get(item.refSlot);
|
|
2578
|
-
var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
|
|
2579
|
-
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$$ : []));
|
|
2580
|
-
}
|
|
2581
|
-
}
|
|
2582
|
-
var _loop = function (slotName, _quasis) {
|
|
2583
|
-
if (!hasOwnProperty(slots, slotName)) {
|
|
2584
|
-
slots[slotName] = {
|
|
2585
|
-
type: "bricks",
|
|
2586
|
-
bricks: []
|
|
2587
|
-
};
|
|
2588
|
-
}
|
|
2589
|
-
var slotConf = slots[slotName];
|
|
2590
|
-
slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
|
|
2591
|
-
if (slotConf.bricks.length === 0) {
|
|
2592
|
-
delete slots[slotName];
|
|
2593
|
-
}
|
|
2594
|
-
};
|
|
2595
|
-
for (var [slotName, _quasis] of quasisMap.entries()) {
|
|
2596
|
-
_loop(slotName, _quasis);
|
|
2597
|
-
}
|
|
2598
|
-
}
|
|
2599
|
-
return {
|
|
2600
|
-
[symbolForComputedPropsFromProxy]: computedPropsFromProxy,
|
|
2601
|
-
[symbolForRefForProxy]: refForProxy,
|
|
2602
|
-
[symbolForTplContextId]: templateContextId
|
|
2603
|
-
};
|
|
2604
|
-
}
|
|
2605
|
-
|
|
2606
|
-
function setupUseBrickInTemplate(props, proxyContext) {
|
|
2607
|
-
function walk(props) {
|
|
2608
|
-
if (!props) {
|
|
2609
|
-
return;
|
|
2610
|
-
}
|
|
2611
|
-
for (var [key, value] of Object.entries(props)) {
|
|
2612
|
-
if (isObject(value)) {
|
|
2613
|
-
if (key === "useBrick") {
|
|
2614
|
-
if (Array.isArray(value)) {
|
|
2615
|
-
value.forEach(setup);
|
|
2616
|
-
} else {
|
|
2617
|
-
setup(value);
|
|
2618
|
-
}
|
|
2619
|
-
} else {
|
|
2620
|
-
walk(value);
|
|
2621
|
-
}
|
|
2622
|
-
}
|
|
2623
|
-
}
|
|
2624
|
-
}
|
|
2625
|
-
function setup(item) {
|
|
2626
|
-
var {
|
|
2627
|
-
ref,
|
|
2628
|
-
slots: slotsInTemplate
|
|
2629
|
-
} = item;
|
|
2630
|
-
item.slots = Object.fromEntries(Object.entries(slotsInTemplate !== null && slotsInTemplate !== void 0 ? slotsInTemplate : {}).map(_ref => {
|
|
2631
|
-
var _slotConf$bricks;
|
|
2632
|
-
var [slotName, slotConf] = _ref;
|
|
2633
|
-
return [slotName, {
|
|
2634
|
-
type: "bricks",
|
|
2635
|
-
bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(setup)
|
|
2636
|
-
}];
|
|
2637
|
-
}));
|
|
2638
|
-
Object.assign(item, setupTemplateProxy(proxyContext, ref, item.slots));
|
|
2639
|
-
walk(item.properties);
|
|
2640
|
-
return item;
|
|
2641
|
-
}
|
|
2642
|
-
walk(props);
|
|
2643
|
-
}
|
|
2644
|
-
|
|
2645
2434
|
var computeRealValue = (value, context, injectDeep, internalOptions) => {
|
|
2646
2435
|
var preEvaluated = isPreEvaluated(value);
|
|
2647
2436
|
if (preEvaluated || typeof value === "string") {
|
|
@@ -2693,11 +2482,6 @@ var computeRealValue = (value, context, injectDeep, internalOptions) => {
|
|
|
2693
2482
|
};
|
|
2694
2483
|
function setProperties(bricks, properties, context, injectDeep) {
|
|
2695
2484
|
var realProps = computeRealProperties(properties, context, injectDeep);
|
|
2696
|
-
if (context.tplContextId) {
|
|
2697
|
-
setupUseBrickInTemplate(realProps, {
|
|
2698
|
-
templateContextId: context.tplContextId
|
|
2699
|
-
});
|
|
2700
|
-
}
|
|
2701
2485
|
if (!Array.isArray(bricks)) {
|
|
2702
2486
|
bricks = [bricks];
|
|
2703
2487
|
}
|
|
@@ -2765,7 +2549,7 @@ function getNextInternalOptions(internalOptions, isArray, key) {
|
|
|
2765
2549
|
}) : internalOptions;
|
|
2766
2550
|
}
|
|
2767
2551
|
|
|
2768
|
-
var _excluded$
|
|
2552
|
+
var _excluded$7 = ["children"],
|
|
2769
2553
|
_excluded2$2 = ["children"],
|
|
2770
2554
|
_excluded3 = ["items", "app"];
|
|
2771
2555
|
var symbolAppId = Symbol("appId");
|
|
@@ -3028,7 +2812,7 @@ function collectAppsRequireI18nFulfilled(items, contextAppId, appIds) {
|
|
|
3028
2812
|
var {
|
|
3029
2813
|
children
|
|
3030
2814
|
} = _ref,
|
|
3031
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
2815
|
+
rest = _objectWithoutProperties(_ref, _excluded$7);
|
|
3032
2816
|
var overrideAppId = rest[symbolAppId];
|
|
3033
2817
|
if (!rest[symbolMenuI18nNamespace] && overrideAppId !== contextAppId && !appIds.has(overrideAppId) && attemptToVisit(rest, ["I18N"])) {
|
|
3034
2818
|
appIds.add(overrideAppId);
|
|
@@ -3139,7 +2923,7 @@ function computeRealValueWithOverrideApp(_x22, _x23, _x24, _x25) {
|
|
|
3139
2923
|
function _computeRealValueWithOverrideApp() {
|
|
3140
2924
|
_computeRealValueWithOverrideApp = _asyncToGenerator$3(function* (data, overrideAppId, context, kernel) {
|
|
3141
2925
|
var newContext = context;
|
|
3142
|
-
if (overrideAppId !== context.app.id && attemptToVisit(data, ["APP", "I18N"])) {
|
|
2926
|
+
if (overrideAppId !== context.app.id && attemptToVisit(data, ["APP", "I18N", "IMG"])) {
|
|
3143
2927
|
if (window.STANDALONE_MICRO_APPS) {
|
|
3144
2928
|
if (data[symbolOverrideApp]) {
|
|
3145
2929
|
data[symbolOverrideApp].config = deepFreeze(merge({}, data[symbolOverrideApp].defaultConfig, data[symbolOverrideApp].userConfig));
|
|
@@ -3650,7 +3434,7 @@ function _internalApiLoadDynamicBricksInBrickConf(brickConf) {
|
|
|
3650
3434
|
return kernel.loadDynamicBricksInBrickConf(brickConf);
|
|
3651
3435
|
}
|
|
3652
3436
|
|
|
3653
|
-
var _excluded$
|
|
3437
|
+
var _excluded$6 = ["extraQuery", "clear", "keepHash"];
|
|
3654
3438
|
var blocked = false;
|
|
3655
3439
|
function getUserConfirmation(message, callback) {
|
|
3656
3440
|
blocked = !confirm(message);
|
|
@@ -3680,7 +3464,7 @@ function historyExtended(browserHistory) {
|
|
|
3680
3464
|
clear,
|
|
3681
3465
|
keepHash
|
|
3682
3466
|
} = options,
|
|
3683
|
-
state = _objectWithoutProperties(options, _excluded$
|
|
3467
|
+
state = _objectWithoutProperties(options, _excluded$6);
|
|
3684
3468
|
var urlSearchParams = new URLSearchParams(clear ? "" : browserHistory.location.search);
|
|
3685
3469
|
var params = {};
|
|
3686
3470
|
Object.assign(params, query, extraQuery);
|
|
@@ -6751,7 +6535,7 @@ var RuntimeApi_searchMicroAppStandalone = /*#__PURE__*/function () {
|
|
|
6751
6535
|
};
|
|
6752
6536
|
}();
|
|
6753
6537
|
|
|
6754
|
-
var _excluded$
|
|
6538
|
+
var _excluded$5 = ["feature_flags"],
|
|
6755
6539
|
_excluded2$1 = ["featureFlags", "misc"];
|
|
6756
6540
|
function standaloneBootstrap() {
|
|
6757
6541
|
return _standaloneBootstrap.apply(this, arguments);
|
|
@@ -6797,7 +6581,7 @@ function _standaloneBootstrap() {
|
|
|
6797
6581
|
var {
|
|
6798
6582
|
feature_flags: featureFlags
|
|
6799
6583
|
} = sys_settings,
|
|
6800
|
-
rest = _objectWithoutProperties(sys_settings, _excluded$
|
|
6584
|
+
rest = _objectWithoutProperties(sys_settings, _excluded$5);
|
|
6801
6585
|
settings = _objectSpread({
|
|
6802
6586
|
featureFlags
|
|
6803
6587
|
}, rest);
|
|
@@ -7755,6 +7539,28 @@ var formRenderer = "form-renderer.form-renderer";
|
|
|
7755
7539
|
var filterProperties = ["instanceId", "brick", "slots", "properties", "events", "if", "context", "bricks", "mountPoint"];
|
|
7756
7540
|
var symbolForFormContextId = Symbol.for("form.contextId");
|
|
7757
7541
|
|
|
7542
|
+
var customTemplateRegistry = new Map();
|
|
7543
|
+
var appRegistered = new Set();
|
|
7544
|
+
var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
|
|
7545
|
+
var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
|
|
7546
|
+
var symbolForTplContextId = Symbol.for("tpl.contextId");
|
|
7547
|
+
|
|
7548
|
+
function isBasicProperty(propRef) {
|
|
7549
|
+
return !!propRef.refProperty;
|
|
7550
|
+
}
|
|
7551
|
+
function isTransformableProperty(propRef) {
|
|
7552
|
+
return !!propRef.refTransform;
|
|
7553
|
+
}
|
|
7554
|
+
function isMergeableProperty(propRef) {
|
|
7555
|
+
return !!propRef.mergeProperty;
|
|
7556
|
+
}
|
|
7557
|
+
function isRefProperty(propRef) {
|
|
7558
|
+
return !!propRef.ref;
|
|
7559
|
+
}
|
|
7560
|
+
function isVariableProperty(propRef) {
|
|
7561
|
+
return !!propRef.asVariable;
|
|
7562
|
+
}
|
|
7563
|
+
|
|
7758
7564
|
function collectRefsInTemplate(template) {
|
|
7759
7565
|
var refMap = new Map();
|
|
7760
7566
|
collectRefsInBrickConfs(template.bricks, refMap);
|
|
@@ -7810,6 +7616,207 @@ function collectMergeBases(conf, mergeBases, contextInTemplate, refToBrickConf)
|
|
|
7810
7616
|
}
|
|
7811
7617
|
}
|
|
7812
7618
|
|
|
7619
|
+
function propertyMerge(conf, value, object) {
|
|
7620
|
+
return propertyMergeAll(conf.$$mergeBase, Object.fromEntries(conf.$$mergeBase.proxies.map(proxy => [proxy.$$reversedRef, proxy === conf ? value : object[proxy.$$reversedRef]])));
|
|
7621
|
+
}
|
|
7622
|
+
function propertyMergeAll(mergeBase, object) {
|
|
7623
|
+
if (mergeBase.mergeType === "array") {
|
|
7624
|
+
return propertyMergeAllOfArray(mergeBase, object);
|
|
7625
|
+
}
|
|
7626
|
+
if (mergeBase.mergeType === "object") {
|
|
7627
|
+
return propertyMergeAllOfObject(mergeBase, object);
|
|
7628
|
+
}
|
|
7629
|
+
// istanbul ignore next: should never reach
|
|
7630
|
+
throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
|
|
7631
|
+
}
|
|
7632
|
+
function propertyMergeAllOfArray(_ref, object) {
|
|
7633
|
+
var _, _proxy$mergeArgs;
|
|
7634
|
+
var {
|
|
7635
|
+
baseValue,
|
|
7636
|
+
context,
|
|
7637
|
+
proxies
|
|
7638
|
+
} = _ref;
|
|
7639
|
+
// Use an approach like template-literal's quasis:
|
|
7640
|
+
// `quasi0${0}quais1${1}quasi2...`
|
|
7641
|
+
// Every quasi can be merged with multiple items.
|
|
7642
|
+
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
|
|
7643
|
+
$$lazyForUseBrick: true
|
|
7644
|
+
}) : [];
|
|
7645
|
+
var quasis = [];
|
|
7646
|
+
var size = computedBaseValue.length + 1;
|
|
7647
|
+
for (var i = 0; i < size; i += 1) {
|
|
7648
|
+
quasis.push([]);
|
|
7649
|
+
}
|
|
7650
|
+
for (var proxy of proxies) {
|
|
7651
|
+
var position = void 0;
|
|
7652
|
+
switch (proxy.mergeMethod) {
|
|
7653
|
+
case "append":
|
|
7654
|
+
position = computedBaseValue.length;
|
|
7655
|
+
break;
|
|
7656
|
+
case "prepend":
|
|
7657
|
+
position = 0;
|
|
7658
|
+
break;
|
|
7659
|
+
case "insertAt":
|
|
7660
|
+
// Defaults to `-1`.
|
|
7661
|
+
position = (_ = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _ !== void 0 ? _ : -1;
|
|
7662
|
+
if (position < 0) {
|
|
7663
|
+
// It's counted from the end if position is negative.
|
|
7664
|
+
position += quasis.length;
|
|
7665
|
+
}
|
|
7666
|
+
position = clamp(position, 0, computedBaseValue.length);
|
|
7667
|
+
break;
|
|
7668
|
+
// istanbul ignore next: should never reach
|
|
7669
|
+
default:
|
|
7670
|
+
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
7671
|
+
}
|
|
7672
|
+
var patchValue = object[proxy.$$reversedRef];
|
|
7673
|
+
if (!Array.isArray(patchValue)) {
|
|
7674
|
+
patchValue = [];
|
|
7675
|
+
}
|
|
7676
|
+
quasis[position].push(...patchValue);
|
|
7677
|
+
}
|
|
7678
|
+
return quasis.flatMap((item, index) => index < computedBaseValue.length ? item.concat(computedBaseValue[index]) : item);
|
|
7679
|
+
}
|
|
7680
|
+
function propertyMergeAllOfObject(_ref2, object) {
|
|
7681
|
+
var {
|
|
7682
|
+
baseValue,
|
|
7683
|
+
proxies,
|
|
7684
|
+
context
|
|
7685
|
+
} = _ref2;
|
|
7686
|
+
var computedBaseValue = isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
|
|
7687
|
+
return proxies.reduce((acc, proxy) => {
|
|
7688
|
+
switch (proxy.mergeMethod) {
|
|
7689
|
+
case "extend":
|
|
7690
|
+
return _objectSpread(_objectSpread({}, acc), object[proxy.$$reversedRef]);
|
|
7691
|
+
// istanbul ignore next: should never reach
|
|
7692
|
+
default:
|
|
7693
|
+
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
7694
|
+
}
|
|
7695
|
+
}, computedBaseValue);
|
|
7696
|
+
}
|
|
7697
|
+
|
|
7698
|
+
function setupTemplateProxy(proxyContext, ref, slots) {
|
|
7699
|
+
var computedPropsFromProxy = {};
|
|
7700
|
+
var refForProxy;
|
|
7701
|
+
var {
|
|
7702
|
+
reversedProxies,
|
|
7703
|
+
templateProperties,
|
|
7704
|
+
externalSlots,
|
|
7705
|
+
templateContextId,
|
|
7706
|
+
proxyBrick
|
|
7707
|
+
} = proxyContext;
|
|
7708
|
+
if (ref && reversedProxies) {
|
|
7709
|
+
refForProxy = {};
|
|
7710
|
+
proxyBrick.proxyRefs.set(ref, refForProxy);
|
|
7711
|
+
|
|
7712
|
+
// Reversed proxies are used for expand storyboard before rendering page.
|
|
7713
|
+
if (reversedProxies.properties.has(ref)) {
|
|
7714
|
+
Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(propRef => {
|
|
7715
|
+
// `propValue` is computed.
|
|
7716
|
+
var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[propRef.$$reversedRef];
|
|
7717
|
+
if (isTransformableProperty(propRef)) {
|
|
7718
|
+
return Object.entries(preprocessTransformProperties({
|
|
7719
|
+
[propRef.$$reversedRef]: propValue
|
|
7720
|
+
}, propRef.refTransform));
|
|
7721
|
+
}
|
|
7722
|
+
if (isBasicProperty(propRef)) {
|
|
7723
|
+
return [[propRef.refProperty, propValue]];
|
|
7724
|
+
}
|
|
7725
|
+
// Ignore Variable properties.
|
|
7726
|
+
// And mergeable properties are processed later.
|
|
7727
|
+
return [];
|
|
7728
|
+
}).filter(propRef => propRef[1] !== undefined)));
|
|
7729
|
+
|
|
7730
|
+
// Brick properties can be merged multiple times.
|
|
7731
|
+
if (reversedProxies.mergeBases.has(ref)) {
|
|
7732
|
+
Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref => {
|
|
7733
|
+
var [mergeProperty, mergeBase] = _ref;
|
|
7734
|
+
return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
|
|
7735
|
+
}).filter(item => item[1] !== undefined)));
|
|
7736
|
+
}
|
|
7737
|
+
}
|
|
7738
|
+
|
|
7739
|
+
// Use an approach like template-literal's quasis:
|
|
7740
|
+
// `quasi0${0}quais1${1}quasi2...`
|
|
7741
|
+
// Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
|
|
7742
|
+
var quasisMap = new Map();
|
|
7743
|
+
if (reversedProxies.slots.has(ref)) {
|
|
7744
|
+
for (var item of reversedProxies.slots.get(ref)) {
|
|
7745
|
+
var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
|
|
7746
|
+
if (!quasisMap.has(item.refSlot)) {
|
|
7747
|
+
var quasis = [];
|
|
7748
|
+
// The size of quasis should be the existed slotted bricks' size plus one.
|
|
7749
|
+
var size = hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
|
|
7750
|
+
for (var i = 0; i < size; i += 1) {
|
|
7751
|
+
quasis.push([]);
|
|
7752
|
+
}
|
|
7753
|
+
quasisMap.set(item.refSlot, quasis);
|
|
7754
|
+
}
|
|
7755
|
+
var expandableSlot = quasisMap.get(item.refSlot);
|
|
7756
|
+
var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
|
|
7757
|
+
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$$ : []));
|
|
7758
|
+
}
|
|
7759
|
+
}
|
|
7760
|
+
var _loop = function (slotName, _quasis) {
|
|
7761
|
+
if (!hasOwnProperty(slots, slotName)) {
|
|
7762
|
+
slots[slotName] = {
|
|
7763
|
+
type: "bricks",
|
|
7764
|
+
bricks: []
|
|
7765
|
+
};
|
|
7766
|
+
}
|
|
7767
|
+
var slotConf = slots[slotName];
|
|
7768
|
+
slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
|
|
7769
|
+
if (slotConf.bricks.length === 0) {
|
|
7770
|
+
delete slots[slotName];
|
|
7771
|
+
}
|
|
7772
|
+
};
|
|
7773
|
+
for (var [slotName, _quasis] of quasisMap.entries()) {
|
|
7774
|
+
_loop(slotName, _quasis);
|
|
7775
|
+
}
|
|
7776
|
+
}
|
|
7777
|
+
return {
|
|
7778
|
+
[symbolForComputedPropsFromProxy]: computedPropsFromProxy,
|
|
7779
|
+
[symbolForRefForProxy]: refForProxy,
|
|
7780
|
+
[symbolForTplContextId]: templateContextId
|
|
7781
|
+
};
|
|
7782
|
+
}
|
|
7783
|
+
|
|
7784
|
+
var _excluded$4 = ["properties", "slots"];
|
|
7785
|
+
function setupUseBrickInTemplate(props, proxyContext) {
|
|
7786
|
+
function walk(props) {
|
|
7787
|
+
if (!isObject(props)) {
|
|
7788
|
+
return props;
|
|
7789
|
+
}
|
|
7790
|
+
if (Array.isArray(props)) {
|
|
7791
|
+
return props.map(walk);
|
|
7792
|
+
}
|
|
7793
|
+
return Object.fromEntries(Object.entries(props).map(_ref => {
|
|
7794
|
+
var [key, value] = _ref;
|
|
7795
|
+
return isObject(value) && key === "useBrick" ? Array.isArray(value) ? [key, value.map(setup)] : [key, setup(value)] : [key, walk(value)];
|
|
7796
|
+
}).concat(Object.getOwnPropertySymbols(props).map(k => [k, props[k]])));
|
|
7797
|
+
}
|
|
7798
|
+
function setup(item) {
|
|
7799
|
+
var {
|
|
7800
|
+
properties,
|
|
7801
|
+
slots: originalSlots
|
|
7802
|
+
} = item,
|
|
7803
|
+
restConf = _objectWithoutProperties(item, _excluded$4);
|
|
7804
|
+
var slots = Object.fromEntries(Object.entries(originalSlots !== null && originalSlots !== void 0 ? originalSlots : {}).map(_ref2 => {
|
|
7805
|
+
var _slotConf$bricks;
|
|
7806
|
+
var [slotName, slotConf] = _ref2;
|
|
7807
|
+
return [slotName, {
|
|
7808
|
+
type: "bricks",
|
|
7809
|
+
bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(setup)
|
|
7810
|
+
}];
|
|
7811
|
+
}));
|
|
7812
|
+
return _objectSpread(_objectSpread({}, restConf), {}, {
|
|
7813
|
+
properties: walk(properties),
|
|
7814
|
+
slots
|
|
7815
|
+
}, setupTemplateProxy(proxyContext, restConf.ref, slots));
|
|
7816
|
+
}
|
|
7817
|
+
return walk(props);
|
|
7818
|
+
}
|
|
7819
|
+
|
|
7813
7820
|
var _excluded$3 = ["properties", "slots"],
|
|
7814
7821
|
_excluded2 = ["ref", "slots"];
|
|
7815
7822
|
function expandCustomTemplate(brickConf, proxyBrick, context) {
|
|
@@ -7966,8 +7973,8 @@ function expandBrickInTemplate(brickConfInTemplate, proxyContext) {
|
|
|
7966
7973
|
bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(item => expandBrickInTemplate(item, proxyContext))
|
|
7967
7974
|
}];
|
|
7968
7975
|
}));
|
|
7969
|
-
setupUseBrickInTemplate(brickConfInTemplate.properties, proxyContext);
|
|
7970
7976
|
return _objectSpread(_objectSpread({}, restBrickConfInTemplate), {}, {
|
|
7977
|
+
properties: setupUseBrickInTemplate(brickConfInTemplate.properties, proxyContext),
|
|
7971
7978
|
slots
|
|
7972
7979
|
}, setupTemplateProxy(proxyContext, ref, slots));
|
|
7973
7980
|
}
|