@next-core/brick-kit 2.165.7 → 2.166.1
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 +253 -233
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +254 -234
- package/dist/index.esm.js.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, isNil, isEmpty, merge, sortBy, orderBy, isObject as isObject$1,
|
|
6
|
+
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, merge, sortBy, orderBy, isObject as isObject$1, 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,6 +2431,229 @@ function evaluate(raw) {
|
|
|
2416
2431
|
}
|
|
2417
2432
|
}
|
|
2418
2433
|
|
|
2434
|
+
function isBasicProperty(propRef) {
|
|
2435
|
+
return !!propRef.refProperty;
|
|
2436
|
+
}
|
|
2437
|
+
function isTransformableProperty(propRef) {
|
|
2438
|
+
return !!propRef.refTransform;
|
|
2439
|
+
}
|
|
2440
|
+
function isMergeableProperty(propRef) {
|
|
2441
|
+
return !!propRef.mergeProperty;
|
|
2442
|
+
}
|
|
2443
|
+
function isRefProperty(propRef) {
|
|
2444
|
+
return !!propRef.ref;
|
|
2445
|
+
}
|
|
2446
|
+
function isVariableProperty(propRef) {
|
|
2447
|
+
return !!propRef.asVariable;
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
var customTemplateRegistry = new Map();
|
|
2451
|
+
var appRegistered = new Set();
|
|
2452
|
+
var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
|
|
2453
|
+
var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
|
|
2454
|
+
var symbolForTplContextId = Symbol.for("tpl.contextId");
|
|
2455
|
+
|
|
2456
|
+
function propertyMerge(conf, value, object) {
|
|
2457
|
+
return propertyMergeAll(conf.$$mergeBase, Object.fromEntries(conf.$$mergeBase.proxies.map(proxy => [proxy.$$reversedRef, proxy === conf ? value : object[proxy.$$reversedRef]])));
|
|
2458
|
+
}
|
|
2459
|
+
function propertyMergeAll(mergeBase, object) {
|
|
2460
|
+
if (mergeBase.mergeType === "array") {
|
|
2461
|
+
return propertyMergeAllOfArray(mergeBase, object);
|
|
2462
|
+
}
|
|
2463
|
+
if (mergeBase.mergeType === "object") {
|
|
2464
|
+
return propertyMergeAllOfObject(mergeBase, object);
|
|
2465
|
+
}
|
|
2466
|
+
// istanbul ignore next: should never reach
|
|
2467
|
+
throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
|
|
2468
|
+
}
|
|
2469
|
+
function propertyMergeAllOfArray(_ref, object) {
|
|
2470
|
+
var _, _proxy$mergeArgs;
|
|
2471
|
+
var {
|
|
2472
|
+
baseValue,
|
|
2473
|
+
context,
|
|
2474
|
+
proxies
|
|
2475
|
+
} = _ref;
|
|
2476
|
+
// Use an approach like template-literal's quasis:
|
|
2477
|
+
// `quasi0${0}quais1${1}quasi2...`
|
|
2478
|
+
// Every quasi can be merged with multiple items.
|
|
2479
|
+
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
|
|
2480
|
+
$$lazyForUseBrick: true
|
|
2481
|
+
}) : [];
|
|
2482
|
+
var quasis = [];
|
|
2483
|
+
var size = computedBaseValue.length + 1;
|
|
2484
|
+
for (var i = 0; i < size; i += 1) {
|
|
2485
|
+
quasis.push([]);
|
|
2486
|
+
}
|
|
2487
|
+
for (var proxy of proxies) {
|
|
2488
|
+
var position = void 0;
|
|
2489
|
+
switch (proxy.mergeMethod) {
|
|
2490
|
+
case "append":
|
|
2491
|
+
position = computedBaseValue.length;
|
|
2492
|
+
break;
|
|
2493
|
+
case "prepend":
|
|
2494
|
+
position = 0;
|
|
2495
|
+
break;
|
|
2496
|
+
case "insertAt":
|
|
2497
|
+
// Defaults to `-1`.
|
|
2498
|
+
position = (_ = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _ !== void 0 ? _ : -1;
|
|
2499
|
+
if (position < 0) {
|
|
2500
|
+
// It's counted from the end if position is negative.
|
|
2501
|
+
position += quasis.length;
|
|
2502
|
+
}
|
|
2503
|
+
position = clamp(position, 0, computedBaseValue.length);
|
|
2504
|
+
break;
|
|
2505
|
+
// istanbul ignore next: should never reach
|
|
2506
|
+
default:
|
|
2507
|
+
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
2508
|
+
}
|
|
2509
|
+
var patchValue = object[proxy.$$reversedRef];
|
|
2510
|
+
if (!Array.isArray(patchValue)) {
|
|
2511
|
+
patchValue = [];
|
|
2512
|
+
}
|
|
2513
|
+
quasis[position].push(...patchValue);
|
|
2514
|
+
}
|
|
2515
|
+
return quasis.flatMap((item, index) => index < computedBaseValue.length ? item.concat(computedBaseValue[index]) : item);
|
|
2516
|
+
}
|
|
2517
|
+
function propertyMergeAllOfObject(_ref2, object) {
|
|
2518
|
+
var {
|
|
2519
|
+
baseValue,
|
|
2520
|
+
proxies,
|
|
2521
|
+
context
|
|
2522
|
+
} = _ref2;
|
|
2523
|
+
var computedBaseValue = isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
|
|
2524
|
+
return proxies.reduce((acc, proxy) => {
|
|
2525
|
+
switch (proxy.mergeMethod) {
|
|
2526
|
+
case "extend":
|
|
2527
|
+
return _objectSpread(_objectSpread({}, acc), object[proxy.$$reversedRef]);
|
|
2528
|
+
// istanbul ignore next: should never reach
|
|
2529
|
+
default:
|
|
2530
|
+
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
2531
|
+
}
|
|
2532
|
+
}, computedBaseValue);
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
function setupTemplateProxy(proxyContext, ref, slots) {
|
|
2536
|
+
var computedPropsFromProxy = {};
|
|
2537
|
+
var refForProxy;
|
|
2538
|
+
var {
|
|
2539
|
+
reversedProxies,
|
|
2540
|
+
templateProperties,
|
|
2541
|
+
externalSlots,
|
|
2542
|
+
templateContextId,
|
|
2543
|
+
proxyBrick
|
|
2544
|
+
} = proxyContext;
|
|
2545
|
+
if (ref && reversedProxies) {
|
|
2546
|
+
refForProxy = {};
|
|
2547
|
+
proxyBrick.proxyRefs.set(ref, refForProxy);
|
|
2548
|
+
|
|
2549
|
+
// Reversed proxies are used for expand storyboard before rendering page.
|
|
2550
|
+
if (reversedProxies.properties.has(ref)) {
|
|
2551
|
+
Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(propRef => {
|
|
2552
|
+
// `propValue` is computed.
|
|
2553
|
+
var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[propRef.$$reversedRef];
|
|
2554
|
+
if (isTransformableProperty(propRef)) {
|
|
2555
|
+
return Object.entries(preprocessTransformProperties({
|
|
2556
|
+
[propRef.$$reversedRef]: propValue
|
|
2557
|
+
}, propRef.refTransform));
|
|
2558
|
+
}
|
|
2559
|
+
if (isBasicProperty(propRef)) {
|
|
2560
|
+
return [[propRef.refProperty, propValue]];
|
|
2561
|
+
}
|
|
2562
|
+
// Ignore Variable properties.
|
|
2563
|
+
// And mergeable properties are processed later.
|
|
2564
|
+
return [];
|
|
2565
|
+
}).filter(propRef => propRef[1] !== undefined)));
|
|
2566
|
+
|
|
2567
|
+
// Brick properties can be merged multiple times.
|
|
2568
|
+
if (reversedProxies.mergeBases.has(ref)) {
|
|
2569
|
+
Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref => {
|
|
2570
|
+
var [mergeProperty, mergeBase] = _ref;
|
|
2571
|
+
return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
|
|
2572
|
+
}).filter(item => item[1] !== undefined)));
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
// Use an approach like template-literal's quasis:
|
|
2577
|
+
// `quasi0${0}quais1${1}quasi2...`
|
|
2578
|
+
// Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
|
|
2579
|
+
var quasisMap = new Map();
|
|
2580
|
+
if (reversedProxies.slots.has(ref)) {
|
|
2581
|
+
for (var item of reversedProxies.slots.get(ref)) {
|
|
2582
|
+
var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
|
|
2583
|
+
if (!quasisMap.has(item.refSlot)) {
|
|
2584
|
+
var quasis = [];
|
|
2585
|
+
// The size of quasis should be the existed slotted bricks' size plus one.
|
|
2586
|
+
var size = hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
|
|
2587
|
+
for (var i = 0; i < size; i += 1) {
|
|
2588
|
+
quasis.push([]);
|
|
2589
|
+
}
|
|
2590
|
+
quasisMap.set(item.refSlot, quasis);
|
|
2591
|
+
}
|
|
2592
|
+
var expandableSlot = quasisMap.get(item.refSlot);
|
|
2593
|
+
var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
|
|
2594
|
+
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$$ : []));
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
var _loop = function (slotName, _quasis) {
|
|
2598
|
+
if (!hasOwnProperty(slots, slotName)) {
|
|
2599
|
+
slots[slotName] = {
|
|
2600
|
+
type: "bricks",
|
|
2601
|
+
bricks: []
|
|
2602
|
+
};
|
|
2603
|
+
}
|
|
2604
|
+
var slotConf = slots[slotName];
|
|
2605
|
+
slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
|
|
2606
|
+
if (slotConf.bricks.length === 0) {
|
|
2607
|
+
delete slots[slotName];
|
|
2608
|
+
}
|
|
2609
|
+
};
|
|
2610
|
+
for (var [slotName, _quasis] of quasisMap.entries()) {
|
|
2611
|
+
_loop(slotName, _quasis);
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
return {
|
|
2615
|
+
[symbolForComputedPropsFromProxy]: computedPropsFromProxy,
|
|
2616
|
+
[symbolForRefForProxy]: refForProxy,
|
|
2617
|
+
[symbolForTplContextId]: templateContextId
|
|
2618
|
+
};
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
var _excluded$7 = ["properties", "slots"];
|
|
2622
|
+
function setupUseBrickInTemplate(props, proxyContext) {
|
|
2623
|
+
function walk(props) {
|
|
2624
|
+
if (!isObject(props)) {
|
|
2625
|
+
return props;
|
|
2626
|
+
}
|
|
2627
|
+
if (Array.isArray(props)) {
|
|
2628
|
+
return props.map(walk);
|
|
2629
|
+
}
|
|
2630
|
+
return Object.fromEntries(Object.entries(props).map(_ref => {
|
|
2631
|
+
var [key, value] = _ref;
|
|
2632
|
+
return isObject(value) && key === "useBrick" ? Array.isArray(value) ? [key, value.map(setup)] : [key, setup(value)] : [key, walk(value)];
|
|
2633
|
+
}).concat(Object.getOwnPropertySymbols(props).map(k => [k, props[k]])));
|
|
2634
|
+
}
|
|
2635
|
+
function setup(item) {
|
|
2636
|
+
var {
|
|
2637
|
+
properties,
|
|
2638
|
+
slots: originalSlots
|
|
2639
|
+
} = item,
|
|
2640
|
+
restConf = _objectWithoutProperties(item, _excluded$7);
|
|
2641
|
+
var slots = Object.fromEntries(Object.entries(originalSlots !== null && originalSlots !== void 0 ? originalSlots : {}).map(_ref2 => {
|
|
2642
|
+
var _slotConf$bricks;
|
|
2643
|
+
var [slotName, slotConf] = _ref2;
|
|
2644
|
+
return [slotName, {
|
|
2645
|
+
type: "bricks",
|
|
2646
|
+
bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(setup)
|
|
2647
|
+
}];
|
|
2648
|
+
}));
|
|
2649
|
+
return _objectSpread(_objectSpread({}, restConf), {}, {
|
|
2650
|
+
properties: walk(properties),
|
|
2651
|
+
slots
|
|
2652
|
+
}, setupTemplateProxy(proxyContext, restConf.ref, slots));
|
|
2653
|
+
}
|
|
2654
|
+
return walk(props);
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2419
2657
|
var computeRealValue = (value, context, injectDeep, internalOptions) => {
|
|
2420
2658
|
var preEvaluated = isPreEvaluated(value);
|
|
2421
2659
|
if (preEvaluated || typeof value === "string") {
|
|
@@ -2467,6 +2705,11 @@ var computeRealValue = (value, context, injectDeep, internalOptions) => {
|
|
|
2467
2705
|
};
|
|
2468
2706
|
function setProperties(bricks, properties, context, injectDeep) {
|
|
2469
2707
|
var realProps = computeRealProperties(properties, context, injectDeep);
|
|
2708
|
+
if (context.tplContextId) {
|
|
2709
|
+
realProps = setupUseBrickInTemplate(realProps, {
|
|
2710
|
+
templateContextId: context.tplContextId
|
|
2711
|
+
});
|
|
2712
|
+
}
|
|
2470
2713
|
if (!Array.isArray(bricks)) {
|
|
2471
2714
|
bricks = [bricks];
|
|
2472
2715
|
}
|
|
@@ -2534,7 +2777,7 @@ function getNextInternalOptions(internalOptions, isArray, key) {
|
|
|
2534
2777
|
}) : internalOptions;
|
|
2535
2778
|
}
|
|
2536
2779
|
|
|
2537
|
-
var _excluded$
|
|
2780
|
+
var _excluded$6 = ["children"],
|
|
2538
2781
|
_excluded2$2 = ["children"],
|
|
2539
2782
|
_excluded3 = ["items", "app"];
|
|
2540
2783
|
var symbolAppId = Symbol("appId");
|
|
@@ -2797,7 +3040,7 @@ function collectAppsRequireI18nFulfilled(items, contextAppId, appIds) {
|
|
|
2797
3040
|
var {
|
|
2798
3041
|
children
|
|
2799
3042
|
} = _ref,
|
|
2800
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
3043
|
+
rest = _objectWithoutProperties(_ref, _excluded$6);
|
|
2801
3044
|
var overrideAppId = rest[symbolAppId];
|
|
2802
3045
|
if (!rest[symbolMenuI18nNamespace] && overrideAppId !== contextAppId && !appIds.has(overrideAppId) && attemptToVisit(rest, ["I18N"])) {
|
|
2803
3046
|
appIds.add(overrideAppId);
|
|
@@ -2908,7 +3151,7 @@ function computeRealValueWithOverrideApp(_x22, _x23, _x24, _x25) {
|
|
|
2908
3151
|
function _computeRealValueWithOverrideApp() {
|
|
2909
3152
|
_computeRealValueWithOverrideApp = _asyncToGenerator$3(function* (data, overrideAppId, context, kernel) {
|
|
2910
3153
|
var newContext = context;
|
|
2911
|
-
if (overrideAppId !== context.app.id && attemptToVisit(data, ["APP", "I18N"])) {
|
|
3154
|
+
if (overrideAppId !== context.app.id && attemptToVisit(data, ["APP", "I18N", "IMG"])) {
|
|
2912
3155
|
if (window.STANDALONE_MICRO_APPS) {
|
|
2913
3156
|
if (data[symbolOverrideApp]) {
|
|
2914
3157
|
data[symbolOverrideApp].config = deepFreeze(merge({}, data[symbolOverrideApp].defaultConfig, data[symbolOverrideApp].userConfig));
|
|
@@ -3419,7 +3662,7 @@ function _internalApiLoadDynamicBricksInBrickConf(brickConf) {
|
|
|
3419
3662
|
return kernel.loadDynamicBricksInBrickConf(brickConf);
|
|
3420
3663
|
}
|
|
3421
3664
|
|
|
3422
|
-
var _excluded$
|
|
3665
|
+
var _excluded$5 = ["extraQuery", "clear", "keepHash"];
|
|
3423
3666
|
var blocked = false;
|
|
3424
3667
|
function getUserConfirmation(message, callback) {
|
|
3425
3668
|
blocked = !confirm(message);
|
|
@@ -3449,7 +3692,7 @@ function historyExtended(browserHistory) {
|
|
|
3449
3692
|
clear,
|
|
3450
3693
|
keepHash
|
|
3451
3694
|
} = options,
|
|
3452
|
-
state = _objectWithoutProperties(options, _excluded$
|
|
3695
|
+
state = _objectWithoutProperties(options, _excluded$5);
|
|
3453
3696
|
var urlSearchParams = new URLSearchParams(clear ? "" : browserHistory.location.search);
|
|
3454
3697
|
var params = {};
|
|
3455
3698
|
Object.assign(params, query, extraQuery);
|
|
@@ -6520,7 +6763,7 @@ var RuntimeApi_searchMicroAppStandalone = /*#__PURE__*/function () {
|
|
|
6520
6763
|
};
|
|
6521
6764
|
}();
|
|
6522
6765
|
|
|
6523
|
-
var _excluded$
|
|
6766
|
+
var _excluded$4 = ["feature_flags"],
|
|
6524
6767
|
_excluded2$1 = ["featureFlags", "misc"];
|
|
6525
6768
|
function standaloneBootstrap() {
|
|
6526
6769
|
return _standaloneBootstrap.apply(this, arguments);
|
|
@@ -6566,7 +6809,7 @@ function _standaloneBootstrap() {
|
|
|
6566
6809
|
var {
|
|
6567
6810
|
feature_flags: featureFlags
|
|
6568
6811
|
} = sys_settings,
|
|
6569
|
-
rest = _objectWithoutProperties(sys_settings, _excluded$
|
|
6812
|
+
rest = _objectWithoutProperties(sys_settings, _excluded$4);
|
|
6570
6813
|
settings = _objectSpread({
|
|
6571
6814
|
featureFlags
|
|
6572
6815
|
}, rest);
|
|
@@ -7524,28 +7767,6 @@ var formRenderer = "form-renderer.form-renderer";
|
|
|
7524
7767
|
var filterProperties = ["instanceId", "brick", "slots", "properties", "events", "if", "context", "bricks", "mountPoint"];
|
|
7525
7768
|
var symbolForFormContextId = Symbol.for("form.contextId");
|
|
7526
7769
|
|
|
7527
|
-
var customTemplateRegistry = new Map();
|
|
7528
|
-
var appRegistered = new Set();
|
|
7529
|
-
var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
|
|
7530
|
-
var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
|
|
7531
|
-
var symbolForTplContextId = Symbol.for("tpl.contextId");
|
|
7532
|
-
|
|
7533
|
-
function isBasicProperty(propRef) {
|
|
7534
|
-
return !!propRef.refProperty;
|
|
7535
|
-
}
|
|
7536
|
-
function isTransformableProperty(propRef) {
|
|
7537
|
-
return !!propRef.refTransform;
|
|
7538
|
-
}
|
|
7539
|
-
function isMergeableProperty(propRef) {
|
|
7540
|
-
return !!propRef.mergeProperty;
|
|
7541
|
-
}
|
|
7542
|
-
function isRefProperty(propRef) {
|
|
7543
|
-
return !!propRef.ref;
|
|
7544
|
-
}
|
|
7545
|
-
function isVariableProperty(propRef) {
|
|
7546
|
-
return !!propRef.asVariable;
|
|
7547
|
-
}
|
|
7548
|
-
|
|
7549
7770
|
function collectRefsInTemplate(template) {
|
|
7550
7771
|
var refMap = new Map();
|
|
7551
7772
|
collectRefsInBrickConfs(template.bricks, refMap);
|
|
@@ -7601,207 +7822,6 @@ function collectMergeBases(conf, mergeBases, contextInTemplate, refToBrickConf)
|
|
|
7601
7822
|
}
|
|
7602
7823
|
}
|
|
7603
7824
|
|
|
7604
|
-
function propertyMerge(conf, value, object) {
|
|
7605
|
-
return propertyMergeAll(conf.$$mergeBase, Object.fromEntries(conf.$$mergeBase.proxies.map(proxy => [proxy.$$reversedRef, proxy === conf ? value : object[proxy.$$reversedRef]])));
|
|
7606
|
-
}
|
|
7607
|
-
function propertyMergeAll(mergeBase, object) {
|
|
7608
|
-
if (mergeBase.mergeType === "array") {
|
|
7609
|
-
return propertyMergeAllOfArray(mergeBase, object);
|
|
7610
|
-
}
|
|
7611
|
-
if (mergeBase.mergeType === "object") {
|
|
7612
|
-
return propertyMergeAllOfObject(mergeBase, object);
|
|
7613
|
-
}
|
|
7614
|
-
// istanbul ignore next: should never reach
|
|
7615
|
-
throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
|
|
7616
|
-
}
|
|
7617
|
-
function propertyMergeAllOfArray(_ref, object) {
|
|
7618
|
-
var _, _proxy$mergeArgs;
|
|
7619
|
-
var {
|
|
7620
|
-
baseValue,
|
|
7621
|
-
context,
|
|
7622
|
-
proxies
|
|
7623
|
-
} = _ref;
|
|
7624
|
-
// Use an approach like template-literal's quasis:
|
|
7625
|
-
// `quasi0${0}quais1${1}quasi2...`
|
|
7626
|
-
// Every quasi can be merged with multiple items.
|
|
7627
|
-
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
|
|
7628
|
-
$$lazyForUseBrick: true
|
|
7629
|
-
}) : [];
|
|
7630
|
-
var quasis = [];
|
|
7631
|
-
var size = computedBaseValue.length + 1;
|
|
7632
|
-
for (var i = 0; i < size; i += 1) {
|
|
7633
|
-
quasis.push([]);
|
|
7634
|
-
}
|
|
7635
|
-
for (var proxy of proxies) {
|
|
7636
|
-
var position = void 0;
|
|
7637
|
-
switch (proxy.mergeMethod) {
|
|
7638
|
-
case "append":
|
|
7639
|
-
position = computedBaseValue.length;
|
|
7640
|
-
break;
|
|
7641
|
-
case "prepend":
|
|
7642
|
-
position = 0;
|
|
7643
|
-
break;
|
|
7644
|
-
case "insertAt":
|
|
7645
|
-
// Defaults to `-1`.
|
|
7646
|
-
position = (_ = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _ !== void 0 ? _ : -1;
|
|
7647
|
-
if (position < 0) {
|
|
7648
|
-
// It's counted from the end if position is negative.
|
|
7649
|
-
position += quasis.length;
|
|
7650
|
-
}
|
|
7651
|
-
position = clamp(position, 0, computedBaseValue.length);
|
|
7652
|
-
break;
|
|
7653
|
-
// istanbul ignore next: should never reach
|
|
7654
|
-
default:
|
|
7655
|
-
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
7656
|
-
}
|
|
7657
|
-
var patchValue = object[proxy.$$reversedRef];
|
|
7658
|
-
if (!Array.isArray(patchValue)) {
|
|
7659
|
-
patchValue = [];
|
|
7660
|
-
}
|
|
7661
|
-
quasis[position].push(...patchValue);
|
|
7662
|
-
}
|
|
7663
|
-
return quasis.flatMap((item, index) => index < computedBaseValue.length ? item.concat(computedBaseValue[index]) : item);
|
|
7664
|
-
}
|
|
7665
|
-
function propertyMergeAllOfObject(_ref2, object) {
|
|
7666
|
-
var {
|
|
7667
|
-
baseValue,
|
|
7668
|
-
proxies,
|
|
7669
|
-
context
|
|
7670
|
-
} = _ref2;
|
|
7671
|
-
var computedBaseValue = isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
|
|
7672
|
-
return proxies.reduce((acc, proxy) => {
|
|
7673
|
-
switch (proxy.mergeMethod) {
|
|
7674
|
-
case "extend":
|
|
7675
|
-
return _objectSpread(_objectSpread({}, acc), object[proxy.$$reversedRef]);
|
|
7676
|
-
// istanbul ignore next: should never reach
|
|
7677
|
-
default:
|
|
7678
|
-
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
7679
|
-
}
|
|
7680
|
-
}, computedBaseValue);
|
|
7681
|
-
}
|
|
7682
|
-
|
|
7683
|
-
function setupTemplateProxy(proxyContext, ref, slots) {
|
|
7684
|
-
var computedPropsFromProxy = {};
|
|
7685
|
-
var refForProxy;
|
|
7686
|
-
var {
|
|
7687
|
-
reversedProxies,
|
|
7688
|
-
templateProperties,
|
|
7689
|
-
externalSlots,
|
|
7690
|
-
templateContextId,
|
|
7691
|
-
proxyBrick
|
|
7692
|
-
} = proxyContext;
|
|
7693
|
-
if (ref && reversedProxies) {
|
|
7694
|
-
refForProxy = {};
|
|
7695
|
-
proxyBrick.proxyRefs.set(ref, refForProxy);
|
|
7696
|
-
|
|
7697
|
-
// Reversed proxies are used for expand storyboard before rendering page.
|
|
7698
|
-
if (reversedProxies.properties.has(ref)) {
|
|
7699
|
-
Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(propRef => {
|
|
7700
|
-
// `propValue` is computed.
|
|
7701
|
-
var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[propRef.$$reversedRef];
|
|
7702
|
-
if (isTransformableProperty(propRef)) {
|
|
7703
|
-
return Object.entries(preprocessTransformProperties({
|
|
7704
|
-
[propRef.$$reversedRef]: propValue
|
|
7705
|
-
}, propRef.refTransform));
|
|
7706
|
-
}
|
|
7707
|
-
if (isBasicProperty(propRef)) {
|
|
7708
|
-
return [[propRef.refProperty, propValue]];
|
|
7709
|
-
}
|
|
7710
|
-
// Ignore Variable properties.
|
|
7711
|
-
// And mergeable properties are processed later.
|
|
7712
|
-
return [];
|
|
7713
|
-
}).filter(propRef => propRef[1] !== undefined)));
|
|
7714
|
-
|
|
7715
|
-
// Brick properties can be merged multiple times.
|
|
7716
|
-
if (reversedProxies.mergeBases.has(ref)) {
|
|
7717
|
-
Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref => {
|
|
7718
|
-
var [mergeProperty, mergeBase] = _ref;
|
|
7719
|
-
return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
|
|
7720
|
-
}).filter(item => item[1] !== undefined)));
|
|
7721
|
-
}
|
|
7722
|
-
}
|
|
7723
|
-
|
|
7724
|
-
// Use an approach like template-literal's quasis:
|
|
7725
|
-
// `quasi0${0}quais1${1}quasi2...`
|
|
7726
|
-
// Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
|
|
7727
|
-
var quasisMap = new Map();
|
|
7728
|
-
if (reversedProxies.slots.has(ref)) {
|
|
7729
|
-
for (var item of reversedProxies.slots.get(ref)) {
|
|
7730
|
-
var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
|
|
7731
|
-
if (!quasisMap.has(item.refSlot)) {
|
|
7732
|
-
var quasis = [];
|
|
7733
|
-
// The size of quasis should be the existed slotted bricks' size plus one.
|
|
7734
|
-
var size = hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
|
|
7735
|
-
for (var i = 0; i < size; i += 1) {
|
|
7736
|
-
quasis.push([]);
|
|
7737
|
-
}
|
|
7738
|
-
quasisMap.set(item.refSlot, quasis);
|
|
7739
|
-
}
|
|
7740
|
-
var expandableSlot = quasisMap.get(item.refSlot);
|
|
7741
|
-
var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
|
|
7742
|
-
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$$ : []));
|
|
7743
|
-
}
|
|
7744
|
-
}
|
|
7745
|
-
var _loop = function (slotName, _quasis) {
|
|
7746
|
-
if (!hasOwnProperty(slots, slotName)) {
|
|
7747
|
-
slots[slotName] = {
|
|
7748
|
-
type: "bricks",
|
|
7749
|
-
bricks: []
|
|
7750
|
-
};
|
|
7751
|
-
}
|
|
7752
|
-
var slotConf = slots[slotName];
|
|
7753
|
-
slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
|
|
7754
|
-
if (slotConf.bricks.length === 0) {
|
|
7755
|
-
delete slots[slotName];
|
|
7756
|
-
}
|
|
7757
|
-
};
|
|
7758
|
-
for (var [slotName, _quasis] of quasisMap.entries()) {
|
|
7759
|
-
_loop(slotName, _quasis);
|
|
7760
|
-
}
|
|
7761
|
-
}
|
|
7762
|
-
return {
|
|
7763
|
-
[symbolForComputedPropsFromProxy]: computedPropsFromProxy,
|
|
7764
|
-
[symbolForRefForProxy]: refForProxy,
|
|
7765
|
-
[symbolForTplContextId]: templateContextId
|
|
7766
|
-
};
|
|
7767
|
-
}
|
|
7768
|
-
|
|
7769
|
-
var _excluded$4 = ["properties", "slots"];
|
|
7770
|
-
function setupUseBrickInTemplate(props, proxyContext) {
|
|
7771
|
-
function walk(props) {
|
|
7772
|
-
if (!isObject(props)) {
|
|
7773
|
-
return props;
|
|
7774
|
-
}
|
|
7775
|
-
if (Array.isArray(props)) {
|
|
7776
|
-
return props.map(walk);
|
|
7777
|
-
}
|
|
7778
|
-
return Object.fromEntries(Object.entries(props).map(_ref => {
|
|
7779
|
-
var [key, value] = _ref;
|
|
7780
|
-
return isObject(value) && key === "useBrick" ? Array.isArray(value) ? [key, value.map(setup)] : [key, setup(value)] : [key, walk(value)];
|
|
7781
|
-
}).concat(Object.getOwnPropertySymbols(props).map(k => [k, props[k]])));
|
|
7782
|
-
}
|
|
7783
|
-
function setup(item) {
|
|
7784
|
-
var {
|
|
7785
|
-
properties,
|
|
7786
|
-
slots: originalSlots
|
|
7787
|
-
} = item,
|
|
7788
|
-
restConf = _objectWithoutProperties(item, _excluded$4);
|
|
7789
|
-
var slots = Object.fromEntries(Object.entries(originalSlots !== null && originalSlots !== void 0 ? originalSlots : {}).map(_ref2 => {
|
|
7790
|
-
var _slotConf$bricks;
|
|
7791
|
-
var [slotName, slotConf] = _ref2;
|
|
7792
|
-
return [slotName, {
|
|
7793
|
-
type: "bricks",
|
|
7794
|
-
bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(setup)
|
|
7795
|
-
}];
|
|
7796
|
-
}));
|
|
7797
|
-
return _objectSpread(_objectSpread({}, restConf), {}, {
|
|
7798
|
-
properties: walk(properties),
|
|
7799
|
-
slots
|
|
7800
|
-
}, setupTemplateProxy(proxyContext, restConf.ref, slots));
|
|
7801
|
-
}
|
|
7802
|
-
return walk(props);
|
|
7803
|
-
}
|
|
7804
|
-
|
|
7805
7825
|
var _excluded$3 = ["properties", "slots"],
|
|
7806
7826
|
_excluded2 = ["ref", "slots"];
|
|
7807
7827
|
function expandCustomTemplate(brickConf, proxyBrick, context) {
|