@next-core/brick-kit 2.200.4 → 2.202.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 +86 -11
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +97 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/types/ModalStack.d.ts +6 -0
- package/dist/types/ModalStack.d.ts.map +1 -0
- package/dist/types/core/CustomTemplates/expandCustomTemplate.d.ts +1 -0
- package/dist/types/core/CustomTemplates/expandCustomTemplate.d.ts.map +1 -1
- package/dist/types/core/CustomTemplates/replaceSlotWithSlottedBricks.d.ts +4 -0
- package/dist/types/core/CustomTemplates/replaceSlotWithSlottedBricks.d.ts.map +1 -0
- package/dist/types/core/CustomTemplates/setupTemplateProxy.d.ts +1 -1
- package/dist/types/core/CustomTemplates/setupTemplateProxy.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
4
4
|
import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
|
|
5
5
|
import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
|
|
6
6
|
import _, { escapeRegExp, set, get, difference, identity, uniqueId, isNil, isEmpty, merge, sortBy, cloneDeep, clamp, orderBy, pick, isObject as isObject$1, uniq, omit, findLastIndex, noop, isString as isString$1 } from 'lodash';
|
|
7
|
-
import { toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, isTrackAll, trackAll, trackContext, trackState, trackFormState, transformAndInject, transform, JsonStorage, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, scanPermissionActionsInAny, deepFreeze, scanProcessorsInAny, preevaluate, shouldAllowRecursiveEvaluations, inject, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, snippetEvaluate, scanCustomApisInStoryboard, prefetchScript, scanBricksInBrickConf, loadScript, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, clearExpressionASTCache, clearFunctionASTCache, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
7
|
+
import { toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable as isEvaluable$1, isTrackAll, trackAll, trackContext, trackState, trackFormState, transformAndInject, transform, JsonStorage, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, scanPermissionActionsInAny, deepFreeze, scanProcessorsInAny, preevaluate, shouldAllowRecursiveEvaluations, inject, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, snippetEvaluate, scanCustomApisInStoryboard, prefetchScript, scanBricksInBrickConf, loadScript, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, clearExpressionASTCache, clearFunctionASTCache, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
8
8
|
import moment from 'moment';
|
|
9
9
|
import { pipes } from '@next-core/pipes';
|
|
10
10
|
import i18next, { getFixedT } from 'i18next';
|
|
@@ -612,7 +612,7 @@ function getTracks(value) {
|
|
|
612
612
|
var contextNames = false;
|
|
613
613
|
var stateNames = false;
|
|
614
614
|
var formStateNames = false;
|
|
615
|
-
if (typeof value === "string" ? isEvaluable(value) : isPreEvaluated(value)) {
|
|
615
|
+
if (typeof value === "string" ? isEvaluable$1(value) : isPreEvaluated(value)) {
|
|
616
616
|
var raw = typeof value === "string" ? value : getPreEvaluatedRaw(value);
|
|
617
617
|
if (isTrackAll(raw)) {
|
|
618
618
|
var result = trackAll(raw);
|
|
@@ -663,7 +663,7 @@ function doTransform(data, to, options) {
|
|
|
663
663
|
}
|
|
664
664
|
var result;
|
|
665
665
|
var dismissRecursiveMarkingInjected = false;
|
|
666
|
-
if (preEvaluated || isEvaluable(to)) {
|
|
666
|
+
if (preEvaluated || isEvaluable$1(to)) {
|
|
667
667
|
var runtimeContext = {
|
|
668
668
|
data
|
|
669
669
|
};
|
|
@@ -690,7 +690,7 @@ function doTransform(data, to, options) {
|
|
|
690
690
|
// Get both string and symbol keys.
|
|
691
691
|
Object.entries(to).map(_ref => {
|
|
692
692
|
var [k, v] = _ref;
|
|
693
|
-
if (Array.isArray(options === null || options === void 0 ? void 0 : options.trackingContextList) && (typeof v === "string" ? isEvaluable(v) : isPreEvaluated(v))) {
|
|
693
|
+
if (Array.isArray(options === null || options === void 0 ? void 0 : options.trackingContextList) && (typeof v === "string" ? isEvaluable$1(v) : isPreEvaluated(v))) {
|
|
694
694
|
var raw;
|
|
695
695
|
if (typeof v === "string") {
|
|
696
696
|
raw = v;
|
|
@@ -2725,7 +2725,7 @@ function sortMenuItems(list) {
|
|
|
2725
2725
|
function attemptToVisit(data, globals) {
|
|
2726
2726
|
var memo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new WeakSet();
|
|
2727
2727
|
if (typeof data === "string") {
|
|
2728
|
-
if (isEvaluable(data)) {
|
|
2728
|
+
if (isEvaluable$1(data)) {
|
|
2729
2729
|
if (globals.some(key => data.includes(key))) {
|
|
2730
2730
|
var {
|
|
2731
2731
|
attemptToVisitGlobals
|
|
@@ -2762,7 +2762,7 @@ function _computeRealValueWithOverrideApp() {
|
|
|
2762
2762
|
if ("if" in data && data.if === null) {
|
|
2763
2763
|
delete data.if;
|
|
2764
2764
|
}
|
|
2765
|
-
if ("to" in data && data.to && !isEvaluable(data.to)) {
|
|
2765
|
+
if ("to" in data && data.to && !isEvaluable$1(data.to)) {
|
|
2766
2766
|
var yaml = pipes.yaml(data.to);
|
|
2767
2767
|
if (isObject(yaml) && ["pathname", "search", "hash"].some(key => hasOwnProperty(yaml, key))) {
|
|
2768
2768
|
data.to = yaml;
|
|
@@ -2879,7 +2879,7 @@ function evaluate(raw) {
|
|
|
2879
2879
|
var _runtimeContext$overr;
|
|
2880
2880
|
var runtimeContext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2881
2881
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
2882
|
-
if (options.isReEvaluation && !(typeof raw === "string" && isEvaluable(raw))) {
|
|
2882
|
+
if (options.isReEvaluation && !(typeof raw === "string" && isEvaluable$1(raw))) {
|
|
2883
2883
|
devtoolsHookEmit("re-evaluation", {
|
|
2884
2884
|
id: options.evaluationId,
|
|
2885
2885
|
detail: {
|
|
@@ -3240,7 +3240,7 @@ function propertyMergeAllOfObject(_ref2, object) {
|
|
|
3240
3240
|
}, computedBaseValue);
|
|
3241
3241
|
}
|
|
3242
3242
|
|
|
3243
|
-
function setupTemplateProxy(proxyContext, ref, slots) {
|
|
3243
|
+
function setupTemplateProxy(proxyContext, ref, slots, slotted) {
|
|
3244
3244
|
var computedPropsFromProxy = {};
|
|
3245
3245
|
var refForProxy;
|
|
3246
3246
|
var {
|
|
@@ -3286,6 +3286,9 @@ function setupTemplateProxy(proxyContext, ref, slots) {
|
|
|
3286
3286
|
// Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
|
|
3287
3287
|
var quasisMap = new Map();
|
|
3288
3288
|
if (reversedProxies.slots.has(ref)) {
|
|
3289
|
+
if (slotted) {
|
|
3290
|
+
throw new Error("Can not have proxied slot ref when the ref target has a slot element child, check your template \"".concat(proxyBrick.type, "\" and ref \"").concat(ref, "\""));
|
|
3291
|
+
}
|
|
3289
3292
|
for (var item of reversedProxies.slots.get(ref)) {
|
|
3290
3293
|
var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
|
|
3291
3294
|
if (!quasisMap.has(item.refSlot)) {
|
|
@@ -3373,7 +3376,7 @@ var computeRealValue = (value, context, injectDeep, internalOptions) => {
|
|
|
3373
3376
|
var lazy = (internalOptions === null || internalOptions === void 0 ? void 0 : internalOptions.$$lazyForUseBrick) && isLazyContentInUseBrick(internalOptions.$$stateOfUseBrick);
|
|
3374
3377
|
var result;
|
|
3375
3378
|
var dismissRecursiveMarkingInjected = lazy;
|
|
3376
|
-
if (preEvaluated || isEvaluable(value)) {
|
|
3379
|
+
if (preEvaluated || isEvaluable$1(value)) {
|
|
3377
3380
|
var runtimeContext = {};
|
|
3378
3381
|
if (context) {
|
|
3379
3382
|
var keys = ["event", "tplContextId", "overrideApp", "appendI18nNamespace", "formContextId", "query", "match", "app", "segues"];
|
|
@@ -6733,7 +6736,7 @@ function customListenerFactory(handler, ifContainer, context, runtimeBrick) {
|
|
|
6733
6736
|
var rawTargetRef = handler.targetRef;
|
|
6734
6737
|
var computedTarget = rawTarget;
|
|
6735
6738
|
// Allow `target` to be set as evaluable string.
|
|
6736
|
-
if (typeof rawTarget === "string" ? isEvaluable(rawTarget) : isPreEvaluated(rawTarget)) {
|
|
6739
|
+
if (typeof rawTarget === "string" ? isEvaluable$1(rawTarget) : isPreEvaluated(rawTarget)) {
|
|
6737
6740
|
computedTarget = computeRealValue(rawTarget, _objectSpread(_objectSpread({}, context), {}, {
|
|
6738
6741
|
event
|
|
6739
6742
|
}));
|
|
@@ -6759,7 +6762,7 @@ function customListenerFactory(handler, ifContainer, context, runtimeBrick) {
|
|
|
6759
6762
|
} else if (rawTargetRef) {
|
|
6760
6763
|
var computedTargetRef = rawTargetRef;
|
|
6761
6764
|
// Allow `targetRef` to be set as evaluable string.
|
|
6762
|
-
if (typeof rawTargetRef === "string" ? isEvaluable(rawTargetRef) : isPreEvaluated(rawTargetRef)) {
|
|
6765
|
+
if (typeof rawTargetRef === "string" ? isEvaluable$1(rawTargetRef) : isPreEvaluated(rawTargetRef)) {
|
|
6763
6766
|
computedTargetRef = computeRealValue(rawTargetRef, _objectSpread(_objectSpread({}, context), {}, {
|
|
6764
6767
|
event
|
|
6765
6768
|
}), true);
|
|
@@ -8437,6 +8440,38 @@ function collectMergeBases(conf, mergeBases, contextInTemplate, refToBrickConf)
|
|
|
8437
8440
|
}
|
|
8438
8441
|
}
|
|
8439
8442
|
|
|
8443
|
+
function isEvaluable(raw) {
|
|
8444
|
+
return /^\s*<%[~=]?\s/.test(raw) && /\s%>\s*$/.test(raw);
|
|
8445
|
+
}
|
|
8446
|
+
|
|
8447
|
+
function replaceSlotWithSlottedBricks(brickConf, proxyContext, expand) {
|
|
8448
|
+
var _brickConf$properties, _brickConf$properties2, _slots$$bricks, _slots, _slots$;
|
|
8449
|
+
// Currently, no support for `if` in a slot.
|
|
8450
|
+
if (brickConf.if != null && !brickConf.if || typeof brickConf.if === "string") {
|
|
8451
|
+
throw new Error("Can not use \"if\" in a slot currently, check your template \"".concat(proxyContext.proxyBrick.type, "\""));
|
|
8452
|
+
}
|
|
8453
|
+
var slot = String((_brickConf$properties = (_brickConf$properties2 = brickConf.properties) === null || _brickConf$properties2 === void 0 ? void 0 : _brickConf$properties2.name) !== null && _brickConf$properties !== void 0 ? _brickConf$properties : "");
|
|
8454
|
+
|
|
8455
|
+
// Currently, no support for expression as slot name.
|
|
8456
|
+
if (isEvaluable(slot)) {
|
|
8457
|
+
throw new Error("Can not use an expression as slot name \"".concat(slot, "\" currently, check your template \"").concat(proxyContext.proxyBrick.type, "\""));
|
|
8458
|
+
}
|
|
8459
|
+
|
|
8460
|
+
// Do not repeat the same slot name in a template.
|
|
8461
|
+
if (proxyContext.usedSlots.has(slot)) {
|
|
8462
|
+
throw new Error("Can not have multiple slots with the same name \"".concat(slot, "\", check your template \"").concat(proxyContext.proxyBrick.type, "\""));
|
|
8463
|
+
}
|
|
8464
|
+
proxyContext.usedSlots.add(slot);
|
|
8465
|
+
if (proxyContext.externalSlots && hasOwnProperty(proxyContext.externalSlots, slot)) {
|
|
8466
|
+
var _proxyContext$externa;
|
|
8467
|
+
var insertBricks = (_proxyContext$externa = proxyContext.externalSlots[slot].bricks) !== null && _proxyContext$externa !== void 0 ? _proxyContext$externa : [];
|
|
8468
|
+
if (insertBricks.length > 0) {
|
|
8469
|
+
return insertBricks;
|
|
8470
|
+
}
|
|
8471
|
+
}
|
|
8472
|
+
return ((_slots$$bricks = (_slots = brickConf.slots) === null || _slots === void 0 ? void 0 : (_slots$ = _slots[""]) === null || _slots$ === void 0 ? void 0 : _slots$.bricks) !== null && _slots$$bricks !== void 0 ? _slots$$bricks : []).flatMap(item => expand(item, proxyContext));
|
|
8473
|
+
}
|
|
8474
|
+
|
|
8440
8475
|
var _excluded$4 = ["properties", "slots"],
|
|
8441
8476
|
_excluded2 = ["ref", "slots"];
|
|
8442
8477
|
function expandCustomTemplate(brickConf, proxyBrick, context) {
|
|
@@ -8565,38 +8600,48 @@ function lowLevelExpandCustomTemplate(template, brickConf, proxyBrick, context,
|
|
|
8565
8600
|
templateProperties,
|
|
8566
8601
|
externalSlots: externalSlots,
|
|
8567
8602
|
templateContextId: tplContext.id,
|
|
8568
|
-
proxyBrick
|
|
8603
|
+
proxyBrick,
|
|
8604
|
+
usedSlots: new Set()
|
|
8569
8605
|
};
|
|
8570
8606
|
newBrickConf.slots = {
|
|
8571
8607
|
"": {
|
|
8572
8608
|
type: "bricks",
|
|
8573
|
-
bricks: bricks.
|
|
8609
|
+
bricks: bricks.flatMap(item => expandBrickInTemplate(item, proxyContext))
|
|
8574
8610
|
}
|
|
8575
8611
|
};
|
|
8576
8612
|
return newBrickConf;
|
|
8577
8613
|
}
|
|
8578
|
-
function expandBrickInTemplate(brickConfInTemplate, proxyContext) {
|
|
8614
|
+
function expandBrickInTemplate(brickConfInTemplate, proxyContext, markSlotted) {
|
|
8579
8615
|
// Ignore `if: null` to make `looseCheckIf` working.
|
|
8580
8616
|
if (brickConfInTemplate.if === null) {
|
|
8581
8617
|
delete brickConfInTemplate.if;
|
|
8582
8618
|
}
|
|
8583
|
-
|
|
8619
|
+
if (brickConfInTemplate.brick === "slot") {
|
|
8620
|
+
markSlotted === null || markSlotted === void 0 ? void 0 : markSlotted();
|
|
8621
|
+
return replaceSlotWithSlottedBricks(brickConfInTemplate, proxyContext, expandBrickInTemplate);
|
|
8622
|
+
}
|
|
8623
|
+
var _ref = brickConfInTemplate,
|
|
8624
|
+
{
|
|
8584
8625
|
ref,
|
|
8585
8626
|
slots: slotsInTemplate
|
|
8586
|
-
} =
|
|
8587
|
-
restBrickConfInTemplate = _objectWithoutProperties(
|
|
8588
|
-
var
|
|
8627
|
+
} = _ref,
|
|
8628
|
+
restBrickConfInTemplate = _objectWithoutProperties(_ref, _excluded2);
|
|
8629
|
+
var slotted = false;
|
|
8630
|
+
var markChild = () => {
|
|
8631
|
+
slotted = true;
|
|
8632
|
+
};
|
|
8633
|
+
var slots = Object.fromEntries(Object.entries(slotsInTemplate !== null && slotsInTemplate !== void 0 ? slotsInTemplate : {}).map(_ref2 => {
|
|
8589
8634
|
var _slotConf$bricks;
|
|
8590
|
-
var [slotName, slotConf] =
|
|
8635
|
+
var [slotName, slotConf] = _ref2;
|
|
8591
8636
|
return [slotName, {
|
|
8592
8637
|
type: "bricks",
|
|
8593
|
-
bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).
|
|
8638
|
+
bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).flatMap(item => expandBrickInTemplate(item, proxyContext, markChild))
|
|
8594
8639
|
}];
|
|
8595
8640
|
}));
|
|
8596
8641
|
return _objectSpread(_objectSpread({}, restBrickConfInTemplate), {}, {
|
|
8597
8642
|
properties: setupUseBrickInTemplate(brickConfInTemplate.properties, proxyContext),
|
|
8598
8643
|
slots
|
|
8599
|
-
}, setupTemplateProxy(proxyContext, ref, slots));
|
|
8644
|
+
}, setupTemplateProxy(proxyContext, ref, slots, slotted));
|
|
8600
8645
|
}
|
|
8601
8646
|
|
|
8602
8647
|
// If it's a custom template, return the tag name of the template.
|
|
@@ -15209,7 +15254,7 @@ function getRealValue(value) {
|
|
|
15209
15254
|
}
|
|
15210
15255
|
var compute = data => {
|
|
15211
15256
|
if (typeof data === "string") {
|
|
15212
|
-
if (isEvaluable(data)) {
|
|
15257
|
+
if (isEvaluable$1(data)) {
|
|
15213
15258
|
var result = evaluate(data, ctx);
|
|
15214
15259
|
recursiveMarkAsInjected(result);
|
|
15215
15260
|
return result;
|
|
@@ -15236,5 +15281,34 @@ function constructEventListener(handler) {
|
|
|
15236
15281
|
});
|
|
15237
15282
|
}
|
|
15238
15283
|
|
|
15239
|
-
|
|
15284
|
+
var stack = [];
|
|
15285
|
+
function instantiateModalStack() {
|
|
15286
|
+
var initialIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000;
|
|
15287
|
+
var index = -1;
|
|
15288
|
+
var pull = () => {
|
|
15289
|
+
if (index > -1) {
|
|
15290
|
+
var found = stack.indexOf(index);
|
|
15291
|
+
// Assert: found should always be greater than -1
|
|
15292
|
+
// istanbul ignore else
|
|
15293
|
+
if (found > -1) {
|
|
15294
|
+
stack.splice(found, 1);
|
|
15295
|
+
}
|
|
15296
|
+
}
|
|
15297
|
+
};
|
|
15298
|
+
var push = () => {
|
|
15299
|
+
var _stack;
|
|
15300
|
+
// Handle pushes without pull
|
|
15301
|
+
pull();
|
|
15302
|
+
// Find the next available index
|
|
15303
|
+
index = ((_stack = stack[stack.length - 1]) !== null && _stack !== void 0 ? _stack : -1) + 1;
|
|
15304
|
+
stack.push(index);
|
|
15305
|
+
return index + initialIndex;
|
|
15306
|
+
};
|
|
15307
|
+
return {
|
|
15308
|
+
push,
|
|
15309
|
+
pull
|
|
15310
|
+
};
|
|
15311
|
+
}
|
|
15312
|
+
|
|
15313
|
+
export { BrickAsComponent, BrickAsComponentFactory, BrickWrapper, DisplayByFeatureFlags, EasyopsEmpty, ErrorBoundary, FeatureFlagsProvider, ForwardRefSingleBrickAsComponent, ForwardRefSingleBrickAsComponentFactory, ModalElement, SingleBrickAsComponent, SingleBrickAsComponentFactory, StoryboardFunctionRegistryFactory, UpdatingElement, WebsocketMessageRequest, WebsocketMessageResponse, abortController, applyTheme, authenticate, batchSetAppsLocalTheme, checkIf, checkIfByTransform, clearDebugContract, collectDebugContract, constructEventListener, createHistory, createRuntime, createWebSocket, developHelper, doTransform, event, getAuth, getCssPropertyValue, getCurrentTheme, getHistory, getMockInfo, getRealValue, getRuntime, getRuntimeMisc, getWebSocket, handleHttpError, httpErrorToString, i18nText, initI18n, instantiateModalStack, isLoggedIn, logout, looseCheckIf$1 as looseCheckIf, looseCheckIfByTransform, looseCheckIfOfComputed, method, preprocessTransformProperties, property, reTransformForDevtools, renderEasyopsEmpty, setAppLocales, transformElementProperties, transformIntermediateData, transformProperties, useApplyPageTitle, useCurrentApp, useCurrentMode, useCurrentTheme, useFeatureFlags, useLocation, useProvider, useRecentApps };
|
|
15240
15314
|
//# sourceMappingURL=index.esm.js.map
|