@next-core/brick-kit 2.192.0 → 2.193.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 +2004 -1974
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +1966 -1936
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Runtime.d.ts +2 -1
- package/dist/types/core/Runtime.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +5 -1
- package/dist/types/core/interfaces.d.ts.map +1 -1
- package/dist/types/developHelper.d.ts +2 -1
- package/dist/types/developHelper.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.bundle.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('history'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@babel/runtime/helpers/defineProperty'), require('@babel/runtime/helpers/asyncToGenerator'), require('lodash'), require('@next-core/brick-utils'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'history', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/objectWithoutProperties', '@babel/runtime/helpers/defineProperty', '@babel/runtime/helpers/asyncToGenerator', 'lodash', '@next-core/brick-utils', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickKit = {}, global.history$1, global._objectSpread, global._objectWithoutProperties, global._defineProperty$1, global._asyncToGenerator$3, global._, global.brickUtils, global.
|
|
5
|
-
})(this, (function (exports, history$1, _objectSpread, _objectWithoutProperties, _defineProperty$1, _asyncToGenerator$3, _, brickUtils,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('history'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@babel/runtime/helpers/defineProperty'), require('@babel/runtime/helpers/asyncToGenerator'), require('lodash'), require('@next-core/brick-utils'), require('moment'), require('@next-core/pipes'), require('i18next'), require('react'), require('@next-core/brick-http'), require('@next-core/easyops-analytics'), require('antd'), require('@ant-design/icons'), require('js-yaml'), require('@next-core/loader'), require('react-i18next'), require('@babel/runtime/helpers/esm/extends'), require('@next-core/illustrations'), require('@babel/runtime/helpers/decorate')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'history', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/objectWithoutProperties', '@babel/runtime/helpers/defineProperty', '@babel/runtime/helpers/asyncToGenerator', 'lodash', '@next-core/brick-utils', 'moment', '@next-core/pipes', 'i18next', 'react', '@next-core/brick-http', '@next-core/easyops-analytics', 'antd', '@ant-design/icons', 'js-yaml', '@next-core/loader', 'react-i18next', '@babel/runtime/helpers/esm/extends', '@next-core/illustrations', '@babel/runtime/helpers/decorate'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickKit = {}, global.history$1, global._objectSpread, global._objectWithoutProperties, global._defineProperty$1, global._asyncToGenerator$3, global._, global.brickUtils, global.moment, global.pipes, global.i18next, global.React, global.brickHttp, global.easyopsAnalytics, global.antd, global.icons, global.yaml, global.loader, global.reactI18next, global._extends, global.illustrations, global._decorate));
|
|
5
|
+
})(this, (function (exports, history$1, _objectSpread, _objectWithoutProperties, _defineProperty$1, _asyncToGenerator$3, _, brickUtils, moment, pipes, i18next, React, brickHttp, easyopsAnalytics, antd, icons, yaml, loader, reactI18next, _extends, illustrations, _decorate) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty$1);
|
|
12
12
|
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator$3);
|
|
13
13
|
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
14
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
|
-
var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
|
|
16
14
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
15
|
+
var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
|
|
16
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
17
|
var yaml__default = /*#__PURE__*/_interopDefaultLegacy(yaml);
|
|
18
18
|
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
19
19
|
var _decorate__default = /*#__PURE__*/_interopDefaultLegacy(_decorate);
|
|
@@ -289,658 +289,391 @@
|
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
291
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
292
|
+
function supply(attemptToVisitGlobals, providedGlobalVariables, mock) {
|
|
293
|
+
var globalVariables = _objectSpread__default["default"]({}, providedGlobalVariables);
|
|
294
|
+
// Allow limited browser builtin values.
|
|
295
|
+
globalVariables["undefined"] = undefined;
|
|
296
|
+
for (var variableName of attemptToVisitGlobals) {
|
|
297
|
+
if (!Object.prototype.hasOwnProperty.call(globalVariables, variableName)) {
|
|
298
|
+
var variable = supplyIndividual(variableName, mock);
|
|
299
|
+
if (variable !== undefined) {
|
|
300
|
+
globalVariables[variableName] = variable;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
298
303
|
}
|
|
299
|
-
|
|
304
|
+
return globalVariables;
|
|
300
305
|
}
|
|
306
|
+
var shouldOmitInLodash = new Set([
|
|
307
|
+
// Omit all mutable methods from lodash.
|
|
308
|
+
// But allow sequence methods like `_.chain`.
|
|
309
|
+
"fill", "pull", "pullAll", "pullAllBy", "pullAllWith", "pullAt", "remove", "reverse", "assign", "assignIn", "assignInWith", "assignWith", "defaults", "defaultsDeep", "merge", "mergeWith", "set", "setWith", "unset", "update", "updateWith",
|
|
310
|
+
/**
|
|
311
|
+
* Ignore `Function` methods from lodash, too.
|
|
312
|
+
* There are chances to invoke `Object.assign`, etc.
|
|
313
|
+
*
|
|
314
|
+
* E.g.:
|
|
315
|
+
*
|
|
316
|
+
* ```
|
|
317
|
+
* _.wrap(_.method('constructor.assign',{b:2},{b:3}),(func,...a) => func(...a))({})
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
"after", "ary", "before", "bind", "bindKey", "curry", "curryRight", "debounce", "defer", "delay", "flip", "memoize", "negate", "once", "overArgs", "partial", "partialRight", "rearg", "rest", "spread", "throttle", "unary", "wrap"]);
|
|
301
321
|
|
|
302
|
-
//
|
|
303
|
-
var
|
|
304
|
-
var
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
322
|
+
// Omit all mutable methods from moment.
|
|
323
|
+
var shouldOmitInMoment = new Set(["lang", "langData", "locale", "localeData", "defineLocale", "updateLocale", "updateOffset"]);
|
|
324
|
+
var allowedGlobalObjects = new Set(["Array", "Boolean", "Date", "Infinity", "JSON", "Math", "NaN", "Number", "String", "RegExp", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "isFinite", "isNaN", "parseFloat", "parseInt", "Map", "Set", "URLSearchParams", "WeakMap", "WeakSet", "atob", "btoa"]);
|
|
325
|
+
function supplyIndividual(variableName, mock) {
|
|
326
|
+
switch (variableName) {
|
|
327
|
+
case "Object":
|
|
328
|
+
// Do not allow mutable methods like `Object.assign`.
|
|
329
|
+
return delegateMethods(Object, ["entries", "fromEntries", "keys", "values"]);
|
|
330
|
+
case "_":
|
|
331
|
+
return Object.fromEntries(Object.entries(___default["default"]).filter(entry => !shouldOmitInLodash.has(entry[0])).concat(mock ? [["uniqueId", prefix => "".concat(prefix !== null && prefix !== void 0 ? prefix : "", "42")]] : []));
|
|
332
|
+
case "moment":
|
|
333
|
+
return Object.assign(function () {
|
|
334
|
+
return moment__default["default"](...arguments);
|
|
335
|
+
}, Object.fromEntries(Object.entries(moment__default["default"]).filter(entry => !shouldOmitInMoment.has(entry[0]))));
|
|
336
|
+
case "PIPES":
|
|
337
|
+
return pipes.pipes;
|
|
338
|
+
case "TAG_URL":
|
|
339
|
+
return tagUrlFactory(true);
|
|
340
|
+
case "SAFE_TAG_URL":
|
|
341
|
+
return tagUrlFactory();
|
|
342
|
+
default:
|
|
343
|
+
if (allowedGlobalObjects.has(variableName)) {
|
|
344
|
+
return window[variableName];
|
|
345
|
+
}
|
|
310
346
|
}
|
|
311
|
-
theme = value;
|
|
312
347
|
}
|
|
313
|
-
function
|
|
314
|
-
return
|
|
348
|
+
function delegateMethods(target, methods) {
|
|
349
|
+
return Object.fromEntries(methods.map(method => [method, function () {
|
|
350
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
351
|
+
args[_key] = arguments[_key];
|
|
352
|
+
}
|
|
353
|
+
return target[method].apply(target, args);
|
|
354
|
+
}]));
|
|
315
355
|
}
|
|
316
|
-
|
|
317
|
-
|
|
356
|
+
/**
|
|
357
|
+
* Pass `ignoreSlashes` as `true` to encode all tagged expressions
|
|
358
|
+
* as URL components, except for `/` which maybe used in `APP.homepage`.
|
|
359
|
+
*
|
|
360
|
+
* Otherwise encode all tagged expressions as URL components.
|
|
361
|
+
* This will encode `/` as `%2F`. So do not use it directly
|
|
362
|
+
* with `APP.homepage` as in template expressions.
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
*
|
|
366
|
+
* ```js
|
|
367
|
+
* TAG_URL`${APP.homepage}/list?q=${q}&redirect=${redirect}`
|
|
368
|
+
* ```
|
|
369
|
+
*
|
|
370
|
+
* ```js
|
|
371
|
+
* SAFE_TAG_URL`file/${path}?q=${q}`
|
|
372
|
+
* // `path` will be fully transformed by `encodeURIComponent`.
|
|
373
|
+
* ```
|
|
374
|
+
*
|
|
375
|
+
* ```js
|
|
376
|
+
* // Wrap `APP.homepage` outside of `SAFE_TAG_URL`.
|
|
377
|
+
* `${APP.homepage}/${SAFE_TAG_URL`file/${path}?q=${q}`}`
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
function tagUrlFactory(ignoreSlashes) {
|
|
381
|
+
return function (strings) {
|
|
382
|
+
for (var _len2 = arguments.length, partials = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
383
|
+
partials[_key2 - 1] = arguments[_key2];
|
|
384
|
+
}
|
|
385
|
+
var result = [];
|
|
386
|
+
strings.forEach((str, index) => {
|
|
387
|
+
result.push(str);
|
|
388
|
+
if (index < partials.length) {
|
|
389
|
+
result.push(ignoreSlashes ? String(partials[index]).replace(/[^/]+/g, p => encodeURIComponent(p)) : encodeURIComponent(String(partials[index])));
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
return result.join("");
|
|
393
|
+
};
|
|
318
394
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
395
|
+
|
|
396
|
+
function getUrlByAliasFactory(app) {
|
|
397
|
+
return function getUrlByAlias(alias, pathParams, query) {
|
|
398
|
+
if (!(app !== null && app !== void 0 && app.$$routeAliasMap.has(alias))) {
|
|
399
|
+
// eslint-disable-next-line no-console
|
|
400
|
+
throw new Error("Route alias not found: ".concat(alias));
|
|
401
|
+
}
|
|
402
|
+
var routeConf = app.$$routeAliasMap.get(alias);
|
|
403
|
+
var url = brickUtils.toPath(brickUtils.computeRealRoutePath(routeConf.path, app), pathParams);
|
|
404
|
+
if (query) {
|
|
405
|
+
var urlSearchParams = new URLSearchParams();
|
|
406
|
+
for (var [key, value] of Object.entries(query)) {
|
|
407
|
+
if (Array.isArray(value)) {
|
|
408
|
+
for (var item of value) {
|
|
409
|
+
urlSearchParams.append(key, item);
|
|
410
|
+
}
|
|
411
|
+
} else if (value !== undefined && value !== null && value !== "") {
|
|
412
|
+
urlSearchParams.set(key, value);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
var queryString = urlSearchParams.toString();
|
|
416
|
+
if (queryString.length > 0) {
|
|
417
|
+
url += "?".concat(queryString);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return url;
|
|
421
|
+
};
|
|
331
422
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}, []);
|
|
343
|
-
return currentTheme;
|
|
423
|
+
|
|
424
|
+
function getUrlBySegueFactory(app, segues) {
|
|
425
|
+
return function getUrlBySegue(segueId, pathParams, query) {
|
|
426
|
+
if (!brickUtils.hasOwnProperty(segues, segueId)) {
|
|
427
|
+
// eslint-disable-next-line no-console
|
|
428
|
+
throw new Error("Segue not found: ".concat(segueId));
|
|
429
|
+
}
|
|
430
|
+
var segue = segues[segueId];
|
|
431
|
+
return getUrlByAliasFactory(app)(segue.target, pathParams, query);
|
|
432
|
+
};
|
|
344
433
|
}
|
|
345
|
-
|
|
346
|
-
|
|
434
|
+
|
|
435
|
+
function imagesFactory(appId, isBuildPush, version) {
|
|
436
|
+
return {
|
|
437
|
+
get(name) {
|
|
438
|
+
var getSuffix = () => {
|
|
439
|
+
var suffix = window.APP_ROOT ? "".concat(window.APP_ROOT).concat(window.BOOTSTRAP_UNION_FILE && window.PUBLIC_DEPS ? "" : "-/") : "";
|
|
440
|
+
if (!suffix.startsWith("/")) {
|
|
441
|
+
suffix = getBasePath() + suffix;
|
|
442
|
+
}
|
|
443
|
+
if (window.APP_ID && window.APP_ID !== appId) {
|
|
444
|
+
return suffix.replace(new RegExp("(^|/)".concat(_.escapeRegExp(window.APP_ID), "/")), "$1".concat(appId, "/")).replace(/\/\d+\.\d+\.\d+\//, "/".concat(version, "/"));
|
|
445
|
+
}
|
|
446
|
+
return suffix;
|
|
447
|
+
};
|
|
448
|
+
return isBuildPush ? "".concat(getBasePath(), "api/gateway/object_store.object_store.GetObject/api/v1/objectStore/bucket/next-builder/object/").concat(name) : window.BOOTSTRAP_UNION_FILE && window.PUBLIC_DEPS ? "".concat(getSuffix(), "images/").concat(name) : "".concat(getSuffix(), "micro-apps/").concat(appId, "/images/").concat(name);
|
|
449
|
+
}
|
|
450
|
+
};
|
|
347
451
|
}
|
|
348
|
-
function
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
356
|
-
return result || {};
|
|
452
|
+
function widgetImagesFactory(widgetId, widgetVersion) {
|
|
453
|
+
return {
|
|
454
|
+
get(name) {
|
|
455
|
+
var _window$PUBLIC_ROOT;
|
|
456
|
+
return "".concat((_window$PUBLIC_ROOT = window.PUBLIC_ROOT) !== null && _window$PUBLIC_ROOT !== void 0 ? _window$PUBLIC_ROOT : "", "bricks/").concat(widgetId, "/").concat(window.PUBLIC_ROOT_WITH_VERSION && widgetVersion ? "".concat(widgetVersion, "/") : "", "dist/assets/").concat(name);
|
|
457
|
+
}
|
|
458
|
+
};
|
|
357
459
|
}
|
|
358
460
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
461
|
+
var injected = new WeakSet();
|
|
462
|
+
|
|
463
|
+
// The injected (or transformed) result should never be *injected* again.
|
|
464
|
+
// So does the fetched data from a remote api.
|
|
465
|
+
function recursiveMarkAsInjected(value) {
|
|
466
|
+
if (brickUtils.isObject(value)) {
|
|
467
|
+
if (!haveBeenInjected(value)) {
|
|
468
|
+
injected.add(value);
|
|
469
|
+
if (Array.isArray(value)) {
|
|
470
|
+
value.forEach(recursiveMarkAsInjected);
|
|
471
|
+
} else {
|
|
472
|
+
// Only mark pure objects.
|
|
473
|
+
var proto = Object.getPrototypeOf(value);
|
|
474
|
+
if (!proto || proto.constructor === Object) {
|
|
475
|
+
Object.values(value).forEach(recursiveMarkAsInjected);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
365
479
|
}
|
|
366
|
-
mode = value;
|
|
367
480
|
}
|
|
368
|
-
function
|
|
369
|
-
return
|
|
481
|
+
function haveBeenInjected(object) {
|
|
482
|
+
return injected.has(object);
|
|
370
483
|
}
|
|
371
|
-
function
|
|
372
|
-
|
|
484
|
+
function resetAllInjected() {
|
|
485
|
+
injected = new WeakSet();
|
|
373
486
|
}
|
|
374
|
-
function
|
|
375
|
-
if (value) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
value
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
487
|
+
function cloneDeepWithInjectedMark(value) {
|
|
488
|
+
if (brickUtils.isObject(value) && !isPreEvaluated(value)) {
|
|
489
|
+
var clone = Array.isArray(value) ? value.map(item => cloneDeepWithInjectedMark(item)) : Object.fromEntries(
|
|
490
|
+
// Get both string and symbol keys.
|
|
491
|
+
Object.entries(value).map(_ref => {
|
|
492
|
+
var [k, v] = _ref;
|
|
493
|
+
return [k, cloneDeepWithInjectedMark(v)];
|
|
494
|
+
}).concat(Object.getOwnPropertySymbols(value).map(k => [k, value[k]])));
|
|
495
|
+
if (haveBeenInjected(value)) {
|
|
496
|
+
injected.add(clone);
|
|
497
|
+
}
|
|
498
|
+
return clone;
|
|
385
499
|
}
|
|
386
|
-
|
|
387
|
-
function useCurrentMode() {
|
|
388
|
-
var [currentMode, setCurrentMode] = React.useState(getCurrentMode());
|
|
389
|
-
React.useEffect(() => {
|
|
390
|
-
var listenToModeChange = event => {
|
|
391
|
-
setCurrentMode(event.detail);
|
|
392
|
-
};
|
|
393
|
-
window.addEventListener("mode.change", listenToModeChange);
|
|
394
|
-
return () => {
|
|
395
|
-
window.removeEventListener("mode.change", listenToModeChange);
|
|
396
|
-
};
|
|
397
|
-
}, []);
|
|
398
|
-
return currentMode;
|
|
399
|
-
}
|
|
400
|
-
function getCssPropertyValue(name) {
|
|
401
|
-
var _window$getComputedSt;
|
|
402
|
-
var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.documentElement;
|
|
403
|
-
if (!el) return "";
|
|
404
|
-
return ((_window$getComputedSt = window.getComputedStyle(el)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.getPropertyValue(name)) || "";
|
|
500
|
+
return value;
|
|
405
501
|
}
|
|
406
502
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
503
|
+
var StateOfUseBrick;
|
|
504
|
+
(function (StateOfUseBrick) {
|
|
505
|
+
StateOfUseBrick[StateOfUseBrick["INITIAL"] = 0] = "INITIAL";
|
|
506
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK"] = 1] = "USE_BRICK";
|
|
507
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_ITEM"] = 2] = "USE_BRICK_ITEM";
|
|
508
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_PROPERTIES"] = 3] = "USE_BRICK_PROPERTIES";
|
|
509
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_TRANSFORM"] = 4] = "USE_BRICK_TRANSFORM";
|
|
510
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_EVENTS"] = 5] = "USE_BRICK_EVENTS";
|
|
511
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_IF"] = 6] = "USE_BRICK_IF";
|
|
512
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_SLOTS"] = 7] = "USE_BRICK_SLOTS";
|
|
513
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_SLOTS_ITEM"] = 8] = "USE_BRICK_SLOTS_ITEM";
|
|
514
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_SLOTS_ITEM_BRICKS"] = 9] = "USE_BRICK_SLOTS_ITEM_BRICKS";
|
|
515
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_SLOTS_ITEM_BRICKS_ITEM"] = 10] = "USE_BRICK_SLOTS_ITEM_BRICKS_ITEM";
|
|
516
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE"] = 11] = "USE_BRICK_LIFECYCLE";
|
|
517
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE_USERESOLVES"] = 12] = "USE_BRICK_LIFECYCLE_USERESOLVES";
|
|
518
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE_USERESOLVES_ITEM"] = 13] = "USE_BRICK_LIFECYCLE_USERESOLVES_ITEM";
|
|
519
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_TRANSFORM"] = 14] = "USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_TRANSFORM";
|
|
520
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT"] = 15] = "USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT";
|
|
521
|
+
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT_TRANSFORM"] = 16] = "USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT_TRANSFORM";
|
|
522
|
+
})(StateOfUseBrick || (StateOfUseBrick = {}));
|
|
523
|
+
function isLazyContentInUseBrick(state) {
|
|
524
|
+
switch (state) {
|
|
525
|
+
case StateOfUseBrick.USE_BRICK_PROPERTIES:
|
|
526
|
+
case StateOfUseBrick.USE_BRICK_TRANSFORM:
|
|
527
|
+
case StateOfUseBrick.USE_BRICK_EVENTS:
|
|
528
|
+
case StateOfUseBrick.USE_BRICK_IF:
|
|
529
|
+
case StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_TRANSFORM:
|
|
530
|
+
case StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT_TRANSFORM:
|
|
531
|
+
return true;
|
|
414
532
|
}
|
|
415
|
-
|
|
416
|
-
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
function getNextStateOfUseBrick(state, isArray, key) {
|
|
536
|
+
if (isLazyContentInUseBrick(state)) {
|
|
537
|
+
return state;
|
|
538
|
+
}
|
|
539
|
+
if (isArray) {
|
|
540
|
+
switch (state) {
|
|
541
|
+
case StateOfUseBrick.USE_BRICK:
|
|
542
|
+
return StateOfUseBrick.USE_BRICK_ITEM;
|
|
543
|
+
case StateOfUseBrick.USE_BRICK_SLOTS_ITEM_BRICKS:
|
|
544
|
+
return StateOfUseBrick.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM;
|
|
545
|
+
case StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES:
|
|
546
|
+
return StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM;
|
|
547
|
+
}
|
|
417
548
|
} else {
|
|
418
|
-
|
|
549
|
+
switch (state) {
|
|
550
|
+
case StateOfUseBrick.INITIAL:
|
|
551
|
+
if (key === "useBrick") {
|
|
552
|
+
return StateOfUseBrick.USE_BRICK;
|
|
553
|
+
}
|
|
554
|
+
break;
|
|
555
|
+
case StateOfUseBrick.USE_BRICK:
|
|
556
|
+
case StateOfUseBrick.USE_BRICK_ITEM:
|
|
557
|
+
case StateOfUseBrick.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM:
|
|
558
|
+
{
|
|
559
|
+
switch (key) {
|
|
560
|
+
case "properties":
|
|
561
|
+
return StateOfUseBrick.USE_BRICK_PROPERTIES;
|
|
562
|
+
case "transform":
|
|
563
|
+
return StateOfUseBrick.USE_BRICK_TRANSFORM;
|
|
564
|
+
case "events":
|
|
565
|
+
return StateOfUseBrick.USE_BRICK_EVENTS;
|
|
566
|
+
case "slots":
|
|
567
|
+
return StateOfUseBrick.USE_BRICK_SLOTS;
|
|
568
|
+
case "if":
|
|
569
|
+
return StateOfUseBrick.USE_BRICK_IF;
|
|
570
|
+
case "lifeCycle":
|
|
571
|
+
return StateOfUseBrick.USE_BRICK_LIFECYCLE;
|
|
572
|
+
}
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
case StateOfUseBrick.USE_BRICK_SLOTS:
|
|
576
|
+
return StateOfUseBrick.USE_BRICK_SLOTS_ITEM;
|
|
577
|
+
case StateOfUseBrick.USE_BRICK_SLOTS_ITEM:
|
|
578
|
+
if (key === "bricks") {
|
|
579
|
+
return StateOfUseBrick.USE_BRICK_SLOTS_ITEM_BRICKS;
|
|
580
|
+
}
|
|
581
|
+
break;
|
|
582
|
+
case StateOfUseBrick.USE_BRICK_LIFECYCLE:
|
|
583
|
+
if (key === "useResolves") {
|
|
584
|
+
return StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES;
|
|
585
|
+
}
|
|
586
|
+
break;
|
|
587
|
+
case StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM:
|
|
588
|
+
{
|
|
589
|
+
switch (key) {
|
|
590
|
+
case "transform":
|
|
591
|
+
return StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_TRANSFORM;
|
|
592
|
+
case "onReject":
|
|
593
|
+
return StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT;
|
|
594
|
+
}
|
|
595
|
+
break;
|
|
596
|
+
}
|
|
597
|
+
case StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT:
|
|
598
|
+
if (key === "transform") {
|
|
599
|
+
return StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT_TRANSFORM;
|
|
600
|
+
}
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
419
603
|
}
|
|
604
|
+
return StateOfUseBrick.INITIAL;
|
|
420
605
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
606
|
+
|
|
607
|
+
function getTracks(value) {
|
|
608
|
+
var contextNames = false;
|
|
609
|
+
var stateNames = false;
|
|
610
|
+
var formStateNames = false;
|
|
611
|
+
if (typeof value === "string" ? brickUtils.isEvaluable(value) : isPreEvaluated(value)) {
|
|
612
|
+
var raw = typeof value === "string" ? value : getPreEvaluatedRaw(value);
|
|
613
|
+
if (brickUtils.isTrackAll(raw)) {
|
|
614
|
+
var result = brickUtils.trackAll(raw);
|
|
615
|
+
if (result) {
|
|
616
|
+
contextNames = result.context;
|
|
617
|
+
stateNames = result.state;
|
|
618
|
+
formStateNames = result.formState;
|
|
432
619
|
}
|
|
433
|
-
|
|
434
|
-
|
|
620
|
+
} else {
|
|
621
|
+
contextNames = brickUtils.trackContext(raw);
|
|
622
|
+
stateNames = brickUtils.trackState(raw);
|
|
623
|
+
formStateNames = brickUtils.trackFormState(raw);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return {
|
|
627
|
+
contextNames,
|
|
628
|
+
stateNames,
|
|
629
|
+
formStateNames
|
|
435
630
|
};
|
|
436
631
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
configurable: true,
|
|
443
|
-
writable: true
|
|
444
|
-
});
|
|
445
|
-
} else {
|
|
446
|
-
obj[key] = value;
|
|
447
|
-
}
|
|
448
|
-
return obj;
|
|
632
|
+
|
|
633
|
+
/** @internal */
|
|
634
|
+
function transformElementProperties(element, data, to, from, mapArray) {
|
|
635
|
+
var result = preprocessTransformProperties(data, to, from, mapArray);
|
|
636
|
+
setRealProperties(element, result, true);
|
|
449
637
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
});
|
|
457
|
-
keys.push.apply(keys, symbols);
|
|
638
|
+
|
|
639
|
+
/** @internal */
|
|
640
|
+
function transformProperties(props, data, to, from, mapArray, options) {
|
|
641
|
+
var result = preprocessTransformProperties(data, to, from, mapArray, options);
|
|
642
|
+
for (var [propName, propValue] of Object.entries(result)) {
|
|
643
|
+
_.set(props, propName, propValue);
|
|
458
644
|
}
|
|
459
|
-
return
|
|
645
|
+
return props;
|
|
460
646
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
647
|
+
|
|
648
|
+
/** @internal */
|
|
649
|
+
function doTransform(data, to, options) {
|
|
650
|
+
var preEvaluated = isPreEvaluated(to);
|
|
651
|
+
if (preEvaluated || typeof to === "string") {
|
|
652
|
+
// For `useBrick`, some fields such as `properties`/`transform`/`events`,
|
|
653
|
+
// are kept and to be transformed later.
|
|
654
|
+
var lazy = (options === null || options === void 0 ? void 0 : options.$$lazyForUseBrick) && isLazyContentInUseBrick(options.$$stateOfUseBrick);
|
|
655
|
+
if (lazy) {
|
|
656
|
+
// The current data context is not memoized, since a new data context
|
|
657
|
+
// should always be provided before later transformations.
|
|
658
|
+
return to;
|
|
659
|
+
}
|
|
660
|
+
var result;
|
|
661
|
+
var dismissRecursiveMarkingInjected = false;
|
|
662
|
+
if (preEvaluated || brickUtils.isEvaluable(to)) {
|
|
663
|
+
var runtimeContext = {
|
|
664
|
+
data
|
|
665
|
+
};
|
|
666
|
+
if (options !== null && options !== void 0 && options.tplContextId) runtimeContext.tplContextId = options.tplContextId;
|
|
667
|
+
if (options !== null && options !== void 0 && options.formContextId) runtimeContext.formContextId = options.formContextId;
|
|
668
|
+
result = evaluate(to, runtimeContext, options === null || options === void 0 ? void 0 : options.evaluateOptions);
|
|
669
|
+
dismissRecursiveMarkingInjected = shouldDismissRecursiveMarkingInjected(to);
|
|
470
670
|
} else {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
671
|
+
result = options !== null && options !== void 0 && options.allowInject ? brickUtils.transformAndInject(to, data, _internalApiGetCurrentContext()) : brickUtils.transform(to, data);
|
|
672
|
+
}
|
|
673
|
+
if (!dismissRecursiveMarkingInjected) {
|
|
674
|
+
recursiveMarkAsInjected(result);
|
|
474
675
|
}
|
|
475
|
-
|
|
476
|
-
return target;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* @description 获取实例详情
|
|
481
|
-
* @endpoint GET /object/:objectId/instance/:instanceId
|
|
482
|
-
*/
|
|
483
|
-
var InstanceApi_getDetail = /*#__PURE__*/function () {
|
|
484
|
-
var _ref = _asyncToGenerator$2(function* (objectId, instanceId, params, options) {
|
|
485
|
-
return (/**! @contract easyops.api.cmdb.instance.GetDetail */
|
|
486
|
-
(yield brickHttp.http.get("api/gateway/cmdb.instance.GetDetail/object/".concat(objectId, "/instance/").concat(instanceId), _objectSpread2(_objectSpread2({}, options), {}, {
|
|
487
|
-
params
|
|
488
|
-
}))).data
|
|
489
|
-
);
|
|
490
|
-
});
|
|
491
|
-
return function InstanceApi_getDetail(_x, _x2, _x3, _x4) {
|
|
492
|
-
return _ref.apply(this, arguments);
|
|
493
|
-
};
|
|
494
|
-
}();
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* @description 搜索实例
|
|
498
|
-
* @endpoint POST /object/:objectId/instance/_search
|
|
499
|
-
*/
|
|
500
|
-
var InstanceApi_postSearch = /*#__PURE__*/function () {
|
|
501
|
-
var _ref = _asyncToGenerator$2(function* (objectId, data, options) {
|
|
502
|
-
return (/**! @contract easyops.api.cmdb.instance.PostSearch */
|
|
503
|
-
(yield brickHttp.http.post("api/gateway/cmdb.instance.PostSearch/object/".concat(objectId, "/instance/_search"), data, options)).data
|
|
504
|
-
);
|
|
505
|
-
});
|
|
506
|
-
return function InstanceApi_postSearch(_x, _x2, _x3) {
|
|
507
|
-
return _ref.apply(this, arguments);
|
|
508
|
-
};
|
|
509
|
-
}();
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* @description 获取菜单信息
|
|
513
|
-
* @endpoint GET /api/v1/micro-app/menus/:menuId
|
|
514
|
-
*/
|
|
515
|
-
var InstalledMicroAppApi_getMenusInfo = /*#__PURE__*/function () {
|
|
516
|
-
var _ref = _asyncToGenerator__default["default"](function* (menuId, params, options) {
|
|
517
|
-
return (/**! @contract easyops.api.micro_app.installed_micro_app.GetMenusInfo@1.0.0 */(yield brickHttp.http.get("api/gateway/micro_app.installed_micro_app.GetMenusInfo/api/v1/micro-app/menus/".concat(menuId), _objectSpread__default["default"](_objectSpread__default["default"]({}, options), {}, {
|
|
518
|
-
params
|
|
519
|
-
}))).data
|
|
520
|
-
);
|
|
521
|
-
});
|
|
522
|
-
return function InstalledMicroAppApi_getMenusInfo(_x, _x2, _x3) {
|
|
523
|
-
return _ref.apply(this, arguments);
|
|
524
|
-
};
|
|
525
|
-
}();
|
|
526
|
-
|
|
527
|
-
/** 微应用的i18n信息 */
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* @description 获取微应用的i18n数据
|
|
531
|
-
* @endpoint GET /api/v1/micro-app/i18n
|
|
532
|
-
*/
|
|
533
|
-
var InstalledMicroAppApi_getI18NData = /*#__PURE__*/function () {
|
|
534
|
-
var _ref = _asyncToGenerator__default["default"](function* (params, options) {
|
|
535
|
-
return (/**! @contract easyops.api.micro_app.installed_micro_app.GetI18NData@1.0.0 */(yield brickHttp.http.get("api/gateway/micro_app.installed_micro_app.GetI18NData/api/v1/micro-app/i18n", _objectSpread__default["default"](_objectSpread__default["default"]({}, options), {}, {
|
|
536
|
-
params
|
|
537
|
-
}))).data
|
|
538
|
-
);
|
|
539
|
-
});
|
|
540
|
-
return function InstalledMicroAppApi_getI18NData(_x, _x2) {
|
|
541
|
-
return _ref.apply(this, arguments);
|
|
542
|
-
};
|
|
543
|
-
}();
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* @description 校验系统权限
|
|
547
|
-
* @endpoint POST /api/micro_app/v1/permission/validate
|
|
548
|
-
*/
|
|
549
|
-
var PermissionApi_validatePermissions = /*#__PURE__*/function () {
|
|
550
|
-
var _ref = _asyncToGenerator__default["default"](function* (data, options) {
|
|
551
|
-
return (/**! @contract easyops.api.micro_app.permission.ValidatePermissions@1.0.0 */(yield brickHttp.http.post("api/gateway/micro_app.permission.ValidatePermissions/api/micro_app/v1/permission/validate", data, options)).data
|
|
552
|
-
);
|
|
553
|
-
});
|
|
554
|
-
return function PermissionApi_validatePermissions(_x, _x2) {
|
|
555
|
-
return _ref.apply(this, arguments);
|
|
556
|
-
};
|
|
557
|
-
}();
|
|
558
|
-
|
|
559
|
-
function supply(attemptToVisitGlobals, providedGlobalVariables, mock) {
|
|
560
|
-
var globalVariables = _objectSpread__default["default"]({}, providedGlobalVariables);
|
|
561
|
-
// Allow limited browser builtin values.
|
|
562
|
-
globalVariables["undefined"] = undefined;
|
|
563
|
-
for (var variableName of attemptToVisitGlobals) {
|
|
564
|
-
if (!Object.prototype.hasOwnProperty.call(globalVariables, variableName)) {
|
|
565
|
-
var variable = supplyIndividual(variableName, mock);
|
|
566
|
-
if (variable !== undefined) {
|
|
567
|
-
globalVariables[variableName] = variable;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
return globalVariables;
|
|
572
|
-
}
|
|
573
|
-
var shouldOmitInLodash = new Set([
|
|
574
|
-
// Omit all mutable methods from lodash.
|
|
575
|
-
// But allow sequence methods like `_.chain`.
|
|
576
|
-
"fill", "pull", "pullAll", "pullAllBy", "pullAllWith", "pullAt", "remove", "reverse", "assign", "assignIn", "assignInWith", "assignWith", "defaults", "defaultsDeep", "merge", "mergeWith", "set", "setWith", "unset", "update", "updateWith",
|
|
577
|
-
/**
|
|
578
|
-
* Ignore `Function` methods from lodash, too.
|
|
579
|
-
* There are chances to invoke `Object.assign`, etc.
|
|
580
|
-
*
|
|
581
|
-
* E.g.:
|
|
582
|
-
*
|
|
583
|
-
* ```
|
|
584
|
-
* _.wrap(_.method('constructor.assign',{b:2},{b:3}),(func,...a) => func(...a))({})
|
|
585
|
-
* ```
|
|
586
|
-
*/
|
|
587
|
-
"after", "ary", "before", "bind", "bindKey", "curry", "curryRight", "debounce", "defer", "delay", "flip", "memoize", "negate", "once", "overArgs", "partial", "partialRight", "rearg", "rest", "spread", "throttle", "unary", "wrap"]);
|
|
588
|
-
|
|
589
|
-
// Omit all mutable methods from moment.
|
|
590
|
-
var shouldOmitInMoment = new Set(["lang", "langData", "locale", "localeData", "defineLocale", "updateLocale", "updateOffset"]);
|
|
591
|
-
var allowedGlobalObjects = new Set(["Array", "Boolean", "Date", "Infinity", "JSON", "Math", "NaN", "Number", "String", "RegExp", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "isFinite", "isNaN", "parseFloat", "parseInt", "Map", "Set", "URLSearchParams", "WeakMap", "WeakSet", "atob", "btoa"]);
|
|
592
|
-
function supplyIndividual(variableName, mock) {
|
|
593
|
-
switch (variableName) {
|
|
594
|
-
case "Object":
|
|
595
|
-
// Do not allow mutable methods like `Object.assign`.
|
|
596
|
-
return delegateMethods(Object, ["entries", "fromEntries", "keys", "values"]);
|
|
597
|
-
case "_":
|
|
598
|
-
return Object.fromEntries(Object.entries(___default["default"]).filter(entry => !shouldOmitInLodash.has(entry[0])).concat(mock ? [["uniqueId", prefix => "".concat(prefix !== null && prefix !== void 0 ? prefix : "", "42")]] : []));
|
|
599
|
-
case "moment":
|
|
600
|
-
return Object.assign(function () {
|
|
601
|
-
return moment__default["default"](...arguments);
|
|
602
|
-
}, Object.fromEntries(Object.entries(moment__default["default"]).filter(entry => !shouldOmitInMoment.has(entry[0]))));
|
|
603
|
-
case "PIPES":
|
|
604
|
-
return pipes.pipes;
|
|
605
|
-
case "TAG_URL":
|
|
606
|
-
return tagUrlFactory(true);
|
|
607
|
-
case "SAFE_TAG_URL":
|
|
608
|
-
return tagUrlFactory();
|
|
609
|
-
default:
|
|
610
|
-
if (allowedGlobalObjects.has(variableName)) {
|
|
611
|
-
return window[variableName];
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
function delegateMethods(target, methods) {
|
|
616
|
-
return Object.fromEntries(methods.map(method => [method, function () {
|
|
617
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
618
|
-
args[_key] = arguments[_key];
|
|
619
|
-
}
|
|
620
|
-
return target[method].apply(target, args);
|
|
621
|
-
}]));
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Pass `ignoreSlashes` as `true` to encode all tagged expressions
|
|
625
|
-
* as URL components, except for `/` which maybe used in `APP.homepage`.
|
|
626
|
-
*
|
|
627
|
-
* Otherwise encode all tagged expressions as URL components.
|
|
628
|
-
* This will encode `/` as `%2F`. So do not use it directly
|
|
629
|
-
* with `APP.homepage` as in template expressions.
|
|
630
|
-
*
|
|
631
|
-
* @example
|
|
632
|
-
*
|
|
633
|
-
* ```js
|
|
634
|
-
* TAG_URL`${APP.homepage}/list?q=${q}&redirect=${redirect}`
|
|
635
|
-
* ```
|
|
636
|
-
*
|
|
637
|
-
* ```js
|
|
638
|
-
* SAFE_TAG_URL`file/${path}?q=${q}`
|
|
639
|
-
* // `path` will be fully transformed by `encodeURIComponent`.
|
|
640
|
-
* ```
|
|
641
|
-
*
|
|
642
|
-
* ```js
|
|
643
|
-
* // Wrap `APP.homepage` outside of `SAFE_TAG_URL`.
|
|
644
|
-
* `${APP.homepage}/${SAFE_TAG_URL`file/${path}?q=${q}`}`
|
|
645
|
-
* ```
|
|
646
|
-
*/
|
|
647
|
-
function tagUrlFactory(ignoreSlashes) {
|
|
648
|
-
return function (strings) {
|
|
649
|
-
for (var _len2 = arguments.length, partials = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
650
|
-
partials[_key2 - 1] = arguments[_key2];
|
|
651
|
-
}
|
|
652
|
-
var result = [];
|
|
653
|
-
strings.forEach((str, index) => {
|
|
654
|
-
result.push(str);
|
|
655
|
-
if (index < partials.length) {
|
|
656
|
-
result.push(ignoreSlashes ? String(partials[index]).replace(/[^/]+/g, p => encodeURIComponent(p)) : encodeURIComponent(String(partials[index])));
|
|
657
|
-
}
|
|
658
|
-
});
|
|
659
|
-
return result.join("");
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
function getUrlByAliasFactory(app) {
|
|
664
|
-
return function getUrlByAlias(alias, pathParams, query) {
|
|
665
|
-
if (!(app !== null && app !== void 0 && app.$$routeAliasMap.has(alias))) {
|
|
666
|
-
// eslint-disable-next-line no-console
|
|
667
|
-
throw new Error("Route alias not found: ".concat(alias));
|
|
668
|
-
}
|
|
669
|
-
var routeConf = app.$$routeAliasMap.get(alias);
|
|
670
|
-
var url = brickUtils.toPath(brickUtils.computeRealRoutePath(routeConf.path, app), pathParams);
|
|
671
|
-
if (query) {
|
|
672
|
-
var urlSearchParams = new URLSearchParams();
|
|
673
|
-
for (var [key, value] of Object.entries(query)) {
|
|
674
|
-
if (Array.isArray(value)) {
|
|
675
|
-
for (var item of value) {
|
|
676
|
-
urlSearchParams.append(key, item);
|
|
677
|
-
}
|
|
678
|
-
} else if (value !== undefined && value !== null && value !== "") {
|
|
679
|
-
urlSearchParams.set(key, value);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
var queryString = urlSearchParams.toString();
|
|
683
|
-
if (queryString.length > 0) {
|
|
684
|
-
url += "?".concat(queryString);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
return url;
|
|
688
|
-
};
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
function getUrlBySegueFactory(app, segues) {
|
|
692
|
-
return function getUrlBySegue(segueId, pathParams, query) {
|
|
693
|
-
if (!brickUtils.hasOwnProperty(segues, segueId)) {
|
|
694
|
-
// eslint-disable-next-line no-console
|
|
695
|
-
throw new Error("Segue not found: ".concat(segueId));
|
|
696
|
-
}
|
|
697
|
-
var segue = segues[segueId];
|
|
698
|
-
return getUrlByAliasFactory(app)(segue.target, pathParams, query);
|
|
699
|
-
};
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
function imagesFactory(appId, isBuildPush, version) {
|
|
703
|
-
return {
|
|
704
|
-
get(name) {
|
|
705
|
-
var getSuffix = () => {
|
|
706
|
-
var suffix = window.APP_ROOT ? "".concat(window.APP_ROOT).concat(window.BOOTSTRAP_UNION_FILE && window.PUBLIC_DEPS ? "" : "-/") : "";
|
|
707
|
-
if (!suffix.startsWith("/")) {
|
|
708
|
-
suffix = getBasePath() + suffix;
|
|
709
|
-
}
|
|
710
|
-
if (window.APP_ID && window.APP_ID !== appId) {
|
|
711
|
-
return suffix.replace(new RegExp("(^|/)".concat(_.escapeRegExp(window.APP_ID), "/")), "$1".concat(appId, "/")).replace(/\/\d+\.\d+\.\d+\//, "/".concat(version, "/"));
|
|
712
|
-
}
|
|
713
|
-
return suffix;
|
|
714
|
-
};
|
|
715
|
-
return isBuildPush ? "".concat(getBasePath(), "api/gateway/object_store.object_store.GetObject/api/v1/objectStore/bucket/next-builder/object/").concat(name) : window.BOOTSTRAP_UNION_FILE && window.PUBLIC_DEPS ? "".concat(getSuffix(), "images/").concat(name) : "".concat(getSuffix(), "micro-apps/").concat(appId, "/images/").concat(name);
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
function widgetImagesFactory(widgetId, widgetVersion) {
|
|
720
|
-
return {
|
|
721
|
-
get(name) {
|
|
722
|
-
var _window$PUBLIC_ROOT;
|
|
723
|
-
return "".concat((_window$PUBLIC_ROOT = window.PUBLIC_ROOT) !== null && _window$PUBLIC_ROOT !== void 0 ? _window$PUBLIC_ROOT : "", "bricks/").concat(widgetId, "/").concat(window.PUBLIC_ROOT_WITH_VERSION && widgetVersion ? "".concat(widgetVersion, "/") : "", "dist/assets/").concat(name);
|
|
724
|
-
}
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
var injected = new WeakSet();
|
|
729
|
-
|
|
730
|
-
// The injected (or transformed) result should never be *injected* again.
|
|
731
|
-
// So does the fetched data from a remote api.
|
|
732
|
-
function recursiveMarkAsInjected(value) {
|
|
733
|
-
if (brickUtils.isObject(value)) {
|
|
734
|
-
if (!haveBeenInjected(value)) {
|
|
735
|
-
injected.add(value);
|
|
736
|
-
if (Array.isArray(value)) {
|
|
737
|
-
value.forEach(recursiveMarkAsInjected);
|
|
738
|
-
} else {
|
|
739
|
-
// Only mark pure objects.
|
|
740
|
-
var proto = Object.getPrototypeOf(value);
|
|
741
|
-
if (!proto || proto.constructor === Object) {
|
|
742
|
-
Object.values(value).forEach(recursiveMarkAsInjected);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
function haveBeenInjected(object) {
|
|
749
|
-
return injected.has(object);
|
|
750
|
-
}
|
|
751
|
-
function resetAllInjected() {
|
|
752
|
-
injected = new WeakSet();
|
|
753
|
-
}
|
|
754
|
-
function cloneDeepWithInjectedMark(value) {
|
|
755
|
-
if (brickUtils.isObject(value) && !isPreEvaluated(value)) {
|
|
756
|
-
var clone = Array.isArray(value) ? value.map(item => cloneDeepWithInjectedMark(item)) : Object.fromEntries(
|
|
757
|
-
// Get both string and symbol keys.
|
|
758
|
-
Object.entries(value).map(_ref => {
|
|
759
|
-
var [k, v] = _ref;
|
|
760
|
-
return [k, cloneDeepWithInjectedMark(v)];
|
|
761
|
-
}).concat(Object.getOwnPropertySymbols(value).map(k => [k, value[k]])));
|
|
762
|
-
if (haveBeenInjected(value)) {
|
|
763
|
-
injected.add(clone);
|
|
764
|
-
}
|
|
765
|
-
return clone;
|
|
766
|
-
}
|
|
767
|
-
return value;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
var StateOfUseBrick;
|
|
771
|
-
(function (StateOfUseBrick) {
|
|
772
|
-
StateOfUseBrick[StateOfUseBrick["INITIAL"] = 0] = "INITIAL";
|
|
773
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK"] = 1] = "USE_BRICK";
|
|
774
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_ITEM"] = 2] = "USE_BRICK_ITEM";
|
|
775
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_PROPERTIES"] = 3] = "USE_BRICK_PROPERTIES";
|
|
776
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_TRANSFORM"] = 4] = "USE_BRICK_TRANSFORM";
|
|
777
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_EVENTS"] = 5] = "USE_BRICK_EVENTS";
|
|
778
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_IF"] = 6] = "USE_BRICK_IF";
|
|
779
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_SLOTS"] = 7] = "USE_BRICK_SLOTS";
|
|
780
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_SLOTS_ITEM"] = 8] = "USE_BRICK_SLOTS_ITEM";
|
|
781
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_SLOTS_ITEM_BRICKS"] = 9] = "USE_BRICK_SLOTS_ITEM_BRICKS";
|
|
782
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_SLOTS_ITEM_BRICKS_ITEM"] = 10] = "USE_BRICK_SLOTS_ITEM_BRICKS_ITEM";
|
|
783
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE"] = 11] = "USE_BRICK_LIFECYCLE";
|
|
784
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE_USERESOLVES"] = 12] = "USE_BRICK_LIFECYCLE_USERESOLVES";
|
|
785
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE_USERESOLVES_ITEM"] = 13] = "USE_BRICK_LIFECYCLE_USERESOLVES_ITEM";
|
|
786
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_TRANSFORM"] = 14] = "USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_TRANSFORM";
|
|
787
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT"] = 15] = "USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT";
|
|
788
|
-
StateOfUseBrick[StateOfUseBrick["USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT_TRANSFORM"] = 16] = "USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT_TRANSFORM";
|
|
789
|
-
})(StateOfUseBrick || (StateOfUseBrick = {}));
|
|
790
|
-
function isLazyContentInUseBrick(state) {
|
|
791
|
-
switch (state) {
|
|
792
|
-
case StateOfUseBrick.USE_BRICK_PROPERTIES:
|
|
793
|
-
case StateOfUseBrick.USE_BRICK_TRANSFORM:
|
|
794
|
-
case StateOfUseBrick.USE_BRICK_EVENTS:
|
|
795
|
-
case StateOfUseBrick.USE_BRICK_IF:
|
|
796
|
-
case StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_TRANSFORM:
|
|
797
|
-
case StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT_TRANSFORM:
|
|
798
|
-
return true;
|
|
799
|
-
}
|
|
800
|
-
return false;
|
|
801
|
-
}
|
|
802
|
-
function getNextStateOfUseBrick(state, isArray, key) {
|
|
803
|
-
if (isLazyContentInUseBrick(state)) {
|
|
804
|
-
return state;
|
|
805
|
-
}
|
|
806
|
-
if (isArray) {
|
|
807
|
-
switch (state) {
|
|
808
|
-
case StateOfUseBrick.USE_BRICK:
|
|
809
|
-
return StateOfUseBrick.USE_BRICK_ITEM;
|
|
810
|
-
case StateOfUseBrick.USE_BRICK_SLOTS_ITEM_BRICKS:
|
|
811
|
-
return StateOfUseBrick.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM;
|
|
812
|
-
case StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES:
|
|
813
|
-
return StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM;
|
|
814
|
-
}
|
|
815
|
-
} else {
|
|
816
|
-
switch (state) {
|
|
817
|
-
case StateOfUseBrick.INITIAL:
|
|
818
|
-
if (key === "useBrick") {
|
|
819
|
-
return StateOfUseBrick.USE_BRICK;
|
|
820
|
-
}
|
|
821
|
-
break;
|
|
822
|
-
case StateOfUseBrick.USE_BRICK:
|
|
823
|
-
case StateOfUseBrick.USE_BRICK_ITEM:
|
|
824
|
-
case StateOfUseBrick.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM:
|
|
825
|
-
{
|
|
826
|
-
switch (key) {
|
|
827
|
-
case "properties":
|
|
828
|
-
return StateOfUseBrick.USE_BRICK_PROPERTIES;
|
|
829
|
-
case "transform":
|
|
830
|
-
return StateOfUseBrick.USE_BRICK_TRANSFORM;
|
|
831
|
-
case "events":
|
|
832
|
-
return StateOfUseBrick.USE_BRICK_EVENTS;
|
|
833
|
-
case "slots":
|
|
834
|
-
return StateOfUseBrick.USE_BRICK_SLOTS;
|
|
835
|
-
case "if":
|
|
836
|
-
return StateOfUseBrick.USE_BRICK_IF;
|
|
837
|
-
case "lifeCycle":
|
|
838
|
-
return StateOfUseBrick.USE_BRICK_LIFECYCLE;
|
|
839
|
-
}
|
|
840
|
-
break;
|
|
841
|
-
}
|
|
842
|
-
case StateOfUseBrick.USE_BRICK_SLOTS:
|
|
843
|
-
return StateOfUseBrick.USE_BRICK_SLOTS_ITEM;
|
|
844
|
-
case StateOfUseBrick.USE_BRICK_SLOTS_ITEM:
|
|
845
|
-
if (key === "bricks") {
|
|
846
|
-
return StateOfUseBrick.USE_BRICK_SLOTS_ITEM_BRICKS;
|
|
847
|
-
}
|
|
848
|
-
break;
|
|
849
|
-
case StateOfUseBrick.USE_BRICK_LIFECYCLE:
|
|
850
|
-
if (key === "useResolves") {
|
|
851
|
-
return StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES;
|
|
852
|
-
}
|
|
853
|
-
break;
|
|
854
|
-
case StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM:
|
|
855
|
-
{
|
|
856
|
-
switch (key) {
|
|
857
|
-
case "transform":
|
|
858
|
-
return StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_TRANSFORM;
|
|
859
|
-
case "onReject":
|
|
860
|
-
return StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT;
|
|
861
|
-
}
|
|
862
|
-
break;
|
|
863
|
-
}
|
|
864
|
-
case StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT:
|
|
865
|
-
if (key === "transform") {
|
|
866
|
-
return StateOfUseBrick.USE_BRICK_LIFECYCLE_USERESOLVES_ITEM_ONREJECT_TRANSFORM;
|
|
867
|
-
}
|
|
868
|
-
break;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
return StateOfUseBrick.INITIAL;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
function getTracks(value) {
|
|
875
|
-
var contextNames = false;
|
|
876
|
-
var stateNames = false;
|
|
877
|
-
var formStateNames = false;
|
|
878
|
-
if (typeof value === "string" ? brickUtils.isEvaluable(value) : isPreEvaluated(value)) {
|
|
879
|
-
var raw = typeof value === "string" ? value : getPreEvaluatedRaw(value);
|
|
880
|
-
if (brickUtils.isTrackAll(raw)) {
|
|
881
|
-
var result = brickUtils.trackAll(raw);
|
|
882
|
-
if (result) {
|
|
883
|
-
contextNames = result.context;
|
|
884
|
-
stateNames = result.state;
|
|
885
|
-
formStateNames = result.formState;
|
|
886
|
-
}
|
|
887
|
-
} else {
|
|
888
|
-
contextNames = brickUtils.trackContext(raw);
|
|
889
|
-
stateNames = brickUtils.trackState(raw);
|
|
890
|
-
formStateNames = brickUtils.trackFormState(raw);
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
return {
|
|
894
|
-
contextNames,
|
|
895
|
-
stateNames,
|
|
896
|
-
formStateNames
|
|
897
|
-
};
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
/** @internal */
|
|
901
|
-
function transformElementProperties(element, data, to, from, mapArray) {
|
|
902
|
-
var result = preprocessTransformProperties(data, to, from, mapArray);
|
|
903
|
-
setRealProperties(element, result, true);
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
/** @internal */
|
|
907
|
-
function transformProperties(props, data, to, from, mapArray, options) {
|
|
908
|
-
var result = preprocessTransformProperties(data, to, from, mapArray, options);
|
|
909
|
-
for (var [propName, propValue] of Object.entries(result)) {
|
|
910
|
-
_.set(props, propName, propValue);
|
|
911
|
-
}
|
|
912
|
-
return props;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
/** @internal */
|
|
916
|
-
function doTransform(data, to, options) {
|
|
917
|
-
var preEvaluated = isPreEvaluated(to);
|
|
918
|
-
if (preEvaluated || typeof to === "string") {
|
|
919
|
-
// For `useBrick`, some fields such as `properties`/`transform`/`events`,
|
|
920
|
-
// are kept and to be transformed later.
|
|
921
|
-
var lazy = (options === null || options === void 0 ? void 0 : options.$$lazyForUseBrick) && isLazyContentInUseBrick(options.$$stateOfUseBrick);
|
|
922
|
-
if (lazy) {
|
|
923
|
-
// The current data context is not memoized, since a new data context
|
|
924
|
-
// should always be provided before later transformations.
|
|
925
|
-
return to;
|
|
926
|
-
}
|
|
927
|
-
var result;
|
|
928
|
-
var dismissRecursiveMarkingInjected = false;
|
|
929
|
-
if (preEvaluated || brickUtils.isEvaluable(to)) {
|
|
930
|
-
var runtimeContext = {
|
|
931
|
-
data
|
|
932
|
-
};
|
|
933
|
-
if (options !== null && options !== void 0 && options.tplContextId) runtimeContext.tplContextId = options.tplContextId;
|
|
934
|
-
if (options !== null && options !== void 0 && options.formContextId) runtimeContext.formContextId = options.formContextId;
|
|
935
|
-
result = evaluate(to, runtimeContext, options === null || options === void 0 ? void 0 : options.evaluateOptions);
|
|
936
|
-
dismissRecursiveMarkingInjected = shouldDismissRecursiveMarkingInjected(to);
|
|
937
|
-
} else {
|
|
938
|
-
result = options !== null && options !== void 0 && options.allowInject ? brickUtils.transformAndInject(to, data, _internalApiGetCurrentContext()) : brickUtils.transform(to, data);
|
|
939
|
-
}
|
|
940
|
-
if (!dismissRecursiveMarkingInjected) {
|
|
941
|
-
recursiveMarkAsInjected(result);
|
|
942
|
-
}
|
|
943
|
-
return result;
|
|
676
|
+
return result;
|
|
944
677
|
}
|
|
945
678
|
if (!brickUtils.isObject(to) || haveBeenInjected(to)) {
|
|
946
679
|
return to;
|
|
@@ -1244,44 +977,197 @@
|
|
|
1244
977
|
return "$".concat(type, "-").concat(id);
|
|
1245
978
|
}
|
|
1246
979
|
|
|
1247
|
-
function registerWidgetI18n(widgetId, i18n) {
|
|
1248
|
-
var ns = getI18nNamespace("widget", widgetId);
|
|
1249
|
-
Object.entries(i18n).forEach(_ref => {
|
|
1250
|
-
var [lang, resources] = _ref;
|
|
1251
|
-
i18next__default["default"].addResourceBundle(lang, ns, resources);
|
|
980
|
+
function registerWidgetI18n(widgetId, i18n) {
|
|
981
|
+
var ns = getI18nNamespace("widget", widgetId);
|
|
982
|
+
Object.entries(i18n).forEach(_ref => {
|
|
983
|
+
var [lang, resources] = _ref;
|
|
984
|
+
i18next__default["default"].addResourceBundle(lang, ns, resources);
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
function widgetI18nFactory(widgetId) {
|
|
988
|
+
return i18next.getFixedT(null, getI18nNamespace("widget", widgetId));
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
function i18nText(data) {
|
|
992
|
+
var _i18next$language;
|
|
993
|
+
if (!data) {
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
var language = (_i18next$language = i18next__default["default"].language) !== null && _i18next$language !== void 0 ? _i18next$language : "zh-CN";
|
|
997
|
+
// First, make a perfect match.
|
|
998
|
+
if (brickUtils.hasOwnProperty(data, language)) {
|
|
999
|
+
return data[language];
|
|
1000
|
+
}
|
|
1001
|
+
// https://en.wikipedia.org/wiki/IETF_language_tag
|
|
1002
|
+
var primaryLanguage = language.split("-")[0];
|
|
1003
|
+
if (primaryLanguage !== language) {
|
|
1004
|
+
// Then, match the primary language (which omits other subtags).
|
|
1005
|
+
// E.g., match `zh` if the current language is `zh-CN`.
|
|
1006
|
+
return brickUtils.hasOwnProperty(data, primaryLanguage) ? data[primaryLanguage] : undefined;
|
|
1007
|
+
}
|
|
1008
|
+
// At last, match the first key which starts with the primary language,
|
|
1009
|
+
// if the current language contains primary subtag only.
|
|
1010
|
+
// E.g., match `zh-CN` if the current language is `zh`.
|
|
1011
|
+
var prefix = "".concat(primaryLanguage, "-");
|
|
1012
|
+
for (var key of Object.keys(data)) {
|
|
1013
|
+
if (key.startsWith(prefix)) {
|
|
1014
|
+
return data[key];
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
// Themes.
|
|
1020
|
+
var DEFAULT_THEME = "light";
|
|
1021
|
+
var theme = DEFAULT_THEME;
|
|
1022
|
+
var storage = new brickUtils.JsonStorage(localStorage);
|
|
1023
|
+
var LOCAL_STORAGE_APPS_THEME_KEY = "apps-theme";
|
|
1024
|
+
function setTheme(value) {
|
|
1025
|
+
if (value !== "dark" && value !== "light" && value !== "dark-v2") {
|
|
1026
|
+
throw new Error("Unsupported theme: ".concat(value));
|
|
1027
|
+
}
|
|
1028
|
+
theme = value;
|
|
1029
|
+
}
|
|
1030
|
+
function getTheme() {
|
|
1031
|
+
return theme;
|
|
1032
|
+
}
|
|
1033
|
+
function getCurrentTheme() {
|
|
1034
|
+
return document.documentElement.dataset.theme;
|
|
1035
|
+
}
|
|
1036
|
+
function applyTheme(value) {
|
|
1037
|
+
if (value) {
|
|
1038
|
+
setTheme(value);
|
|
1039
|
+
} else {
|
|
1040
|
+
value = getTheme();
|
|
1041
|
+
}
|
|
1042
|
+
if (value !== getCurrentTheme()) {
|
|
1043
|
+
document.documentElement.dataset.theme = value;
|
|
1044
|
+
window.dispatchEvent(new CustomEvent("theme.change", {
|
|
1045
|
+
detail: value
|
|
1046
|
+
}));
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
function useCurrentTheme() {
|
|
1050
|
+
var [currentTheme, setCurrentTheme] = React.useState(getCurrentTheme());
|
|
1051
|
+
React.useEffect(() => {
|
|
1052
|
+
var listenToThemeChange = event => {
|
|
1053
|
+
setCurrentTheme(event.detail);
|
|
1054
|
+
};
|
|
1055
|
+
window.addEventListener("theme.change", listenToThemeChange);
|
|
1056
|
+
return () => {
|
|
1057
|
+
window.removeEventListener("theme.change", listenToThemeChange);
|
|
1058
|
+
};
|
|
1059
|
+
}, []);
|
|
1060
|
+
return currentTheme;
|
|
1061
|
+
}
|
|
1062
|
+
function batchSetAppsLocalTheme(appsTheme) {
|
|
1063
|
+
storage.setItem(LOCAL_STORAGE_APPS_THEME_KEY, _objectSpread__default["default"](_objectSpread__default["default"]({}, getLocalAppsTheme()), appsTheme));
|
|
1064
|
+
}
|
|
1065
|
+
function getLocalAppsTheme() {
|
|
1066
|
+
var result;
|
|
1067
|
+
try {
|
|
1068
|
+
result = storage.getItem(LOCAL_STORAGE_APPS_THEME_KEY);
|
|
1069
|
+
} catch (_unused) {
|
|
1070
|
+
// eslint-disable-next-line no-console
|
|
1071
|
+
console.error("JSON parse error inside `getLocalAppsTheme()`");
|
|
1072
|
+
}
|
|
1073
|
+
return result || {};
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
// Modes.
|
|
1077
|
+
var DEFAULT_MODE = "default";
|
|
1078
|
+
var mode = DEFAULT_MODE;
|
|
1079
|
+
function setMode(value) {
|
|
1080
|
+
if (value !== "dashboard" && value !== "default") {
|
|
1081
|
+
throw new Error("Unsupported mode: ".concat(value));
|
|
1082
|
+
}
|
|
1083
|
+
mode = value;
|
|
1084
|
+
}
|
|
1085
|
+
function getMode() {
|
|
1086
|
+
return mode;
|
|
1087
|
+
}
|
|
1088
|
+
function getCurrentMode() {
|
|
1089
|
+
return document.documentElement.dataset.mode;
|
|
1090
|
+
}
|
|
1091
|
+
function applyMode(value) {
|
|
1092
|
+
if (value) {
|
|
1093
|
+
setMode(value);
|
|
1094
|
+
} else {
|
|
1095
|
+
value = getMode();
|
|
1096
|
+
}
|
|
1097
|
+
if (value !== getCurrentMode()) {
|
|
1098
|
+
document.documentElement.dataset.mode = value;
|
|
1099
|
+
window.dispatchEvent(new CustomEvent("mode.change", {
|
|
1100
|
+
detail: value
|
|
1101
|
+
}));
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
function useCurrentMode() {
|
|
1105
|
+
var [currentMode, setCurrentMode] = React.useState(getCurrentMode());
|
|
1106
|
+
React.useEffect(() => {
|
|
1107
|
+
var listenToModeChange = event => {
|
|
1108
|
+
setCurrentMode(event.detail);
|
|
1109
|
+
};
|
|
1110
|
+
window.addEventListener("mode.change", listenToModeChange);
|
|
1111
|
+
return () => {
|
|
1112
|
+
window.removeEventListener("mode.change", listenToModeChange);
|
|
1113
|
+
};
|
|
1114
|
+
}, []);
|
|
1115
|
+
return currentMode;
|
|
1116
|
+
}
|
|
1117
|
+
function getCssPropertyValue(name) {
|
|
1118
|
+
var _window$getComputedSt;
|
|
1119
|
+
var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.documentElement;
|
|
1120
|
+
if (!el) return "";
|
|
1121
|
+
return ((_window$getComputedSt = window.getComputedStyle(el)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.getPropertyValue(name)) || "";
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* @description 获取菜单信息
|
|
1126
|
+
* @endpoint GET /api/v1/micro-app/menus/:menuId
|
|
1127
|
+
*/
|
|
1128
|
+
var InstalledMicroAppApi_getMenusInfo = /*#__PURE__*/function () {
|
|
1129
|
+
var _ref = _asyncToGenerator__default["default"](function* (menuId, params, options) {
|
|
1130
|
+
return (/**! @contract easyops.api.micro_app.installed_micro_app.GetMenusInfo@1.0.0 */(yield brickHttp.http.get("api/gateway/micro_app.installed_micro_app.GetMenusInfo/api/v1/micro-app/menus/".concat(menuId), _objectSpread__default["default"](_objectSpread__default["default"]({}, options), {}, {
|
|
1131
|
+
params
|
|
1132
|
+
}))).data
|
|
1133
|
+
);
|
|
1252
1134
|
});
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
}
|
|
1135
|
+
return function InstalledMicroAppApi_getMenusInfo(_x, _x2, _x3) {
|
|
1136
|
+
return _ref.apply(this, arguments);
|
|
1137
|
+
};
|
|
1138
|
+
}();
|
|
1257
1139
|
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
return
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1140
|
+
/** 微应用的i18n信息 */
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* @description 获取微应用的i18n数据
|
|
1144
|
+
* @endpoint GET /api/v1/micro-app/i18n
|
|
1145
|
+
*/
|
|
1146
|
+
var InstalledMicroAppApi_getI18NData = /*#__PURE__*/function () {
|
|
1147
|
+
var _ref = _asyncToGenerator__default["default"](function* (params, options) {
|
|
1148
|
+
return (/**! @contract easyops.api.micro_app.installed_micro_app.GetI18NData@1.0.0 */(yield brickHttp.http.get("api/gateway/micro_app.installed_micro_app.GetI18NData/api/v1/micro-app/i18n", _objectSpread__default["default"](_objectSpread__default["default"]({}, options), {}, {
|
|
1149
|
+
params
|
|
1150
|
+
}))).data
|
|
1151
|
+
);
|
|
1152
|
+
});
|
|
1153
|
+
return function InstalledMicroAppApi_getI18NData(_x, _x2) {
|
|
1154
|
+
return _ref.apply(this, arguments);
|
|
1155
|
+
};
|
|
1156
|
+
}();
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* @description 校验系统权限
|
|
1160
|
+
* @endpoint POST /api/micro_app/v1/permission/validate
|
|
1161
|
+
*/
|
|
1162
|
+
var PermissionApi_validatePermissions = /*#__PURE__*/function () {
|
|
1163
|
+
var _ref = _asyncToGenerator__default["default"](function* (data, options) {
|
|
1164
|
+
return (/**! @contract easyops.api.micro_app.permission.ValidatePermissions@1.0.0 */(yield brickHttp.http.post("api/gateway/micro_app.permission.ValidatePermissions/api/micro_app/v1/permission/validate", data, options)).data
|
|
1165
|
+
);
|
|
1166
|
+
});
|
|
1167
|
+
return function PermissionApi_validatePermissions(_x, _x2) {
|
|
1168
|
+
return _ref.apply(this, arguments);
|
|
1169
|
+
};
|
|
1170
|
+
}();
|
|
1285
1171
|
|
|
1286
1172
|
var auth = {};
|
|
1287
1173
|
|
|
@@ -1931,419 +1817,950 @@
|
|
|
1931
1817
|
}));
|
|
1932
1818
|
}
|
|
1933
1819
|
};
|
|
1934
|
-
triggerEvent(updateContexts);
|
|
1935
|
-
triggerEvent(affectContexts);
|
|
1936
|
-
this.batchUpdate = false;
|
|
1937
|
-
return;
|
|
1820
|
+
triggerEvent(updateContexts);
|
|
1821
|
+
triggerEvent(affectContexts);
|
|
1822
|
+
this.batchUpdate = false;
|
|
1823
|
+
return;
|
|
1824
|
+
}
|
|
1825
|
+
updateValue(name, value, method, callback) {
|
|
1826
|
+
var _item$eventTarget;
|
|
1827
|
+
if (!this.data.has(name)) {
|
|
1828
|
+
if (this.tplContextId) {
|
|
1829
|
+
throw new Error("State not found: ".concat(name));
|
|
1830
|
+
} else {
|
|
1831
|
+
// eslint-disable-next-line no-console
|
|
1832
|
+
console.warn("Context \"".concat(name, "\" is not declared, we recommend declaring it first."));
|
|
1833
|
+
this.set(name, {
|
|
1834
|
+
type: "free-variable",
|
|
1835
|
+
value
|
|
1836
|
+
});
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
var item = this.data.get(name);
|
|
1841
|
+
if (item.type !== "free-variable") {
|
|
1842
|
+
// eslint-disable-next-line no-console
|
|
1843
|
+
console.error("Unexpected storyboard context \"".concat(name, "\", expected \"free-variable\", received \"").concat(item.type, "\"."));
|
|
1844
|
+
return;
|
|
1845
|
+
}
|
|
1846
|
+
if (method === "refresh" || method === "load") {
|
|
1847
|
+
if (!item.useResolve) {
|
|
1848
|
+
throw new Error("You can not ".concat(method, " the storyboard context \"").concat(name, "\" which is not using resolve."));
|
|
1849
|
+
}
|
|
1850
|
+
var promise;
|
|
1851
|
+
if (method === "load") {
|
|
1852
|
+
// Try to reuse previous request when calling `load`.
|
|
1853
|
+
if (item.loaded) {
|
|
1854
|
+
promise = Promise.resolve(item.value);
|
|
1855
|
+
} else if (item.loading) {
|
|
1856
|
+
promise = item.loading;
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
var shouldDismiss = error => {
|
|
1860
|
+
// If render twice immediately, flow API contracts maybe cleared before
|
|
1861
|
+
// the second rendering, while the page load handlers of the first
|
|
1862
|
+
// rendering can't be cancelled, which throws `FlowApiNotFoundError`.
|
|
1863
|
+
// So we ignore error reporting for this case.
|
|
1864
|
+
return (error === null || error === void 0 ? void 0 : error.name) === "FlowApiNotFoundError" && this.renderId && this.renderId !== _internalApiGetRouterRenderId();
|
|
1865
|
+
};
|
|
1866
|
+
if (!promise) {
|
|
1867
|
+
promise = item.loading = item.load(_objectSpread__default["default"]({
|
|
1868
|
+
cache: method === "load" ? "default" : "reload"
|
|
1869
|
+
}, value));
|
|
1870
|
+
// Do not use the chained promise, since the callbacks need the original promise.
|
|
1871
|
+
promise.then(val => {
|
|
1872
|
+
this.finishLoad(item, val);
|
|
1873
|
+
}, err => {
|
|
1874
|
+
// Let users to override error handling.
|
|
1875
|
+
if (!shouldDismiss(err) && !(callback !== null && callback !== void 0 && callback.error)) {
|
|
1876
|
+
handleHttpError(err);
|
|
1877
|
+
}
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
if (callback) {
|
|
1881
|
+
var callbackFactory = eventCallbackFactory(callback, () => this.getResolveOptions(_internalApiGetCurrentContext()).mergedContext, null);
|
|
1882
|
+
promise.then(val => {
|
|
1883
|
+
callbackFactory("success")({
|
|
1884
|
+
value: val
|
|
1885
|
+
});
|
|
1886
|
+
callbackFactory("finally")();
|
|
1887
|
+
}, err => {
|
|
1888
|
+
if (!shouldDismiss(err) && callback.error) {
|
|
1889
|
+
callbackFactory("error")(err);
|
|
1890
|
+
}
|
|
1891
|
+
callbackFactory("finally")();
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
return;
|
|
1895
|
+
}
|
|
1896
|
+
if (method === "replace") {
|
|
1897
|
+
item.value = value;
|
|
1898
|
+
} else {
|
|
1899
|
+
if (brickUtils.isObject(item.value)) {
|
|
1900
|
+
Object.assign(item.value, value);
|
|
1901
|
+
} else {
|
|
1902
|
+
// eslint-disable-next-line no-console
|
|
1903
|
+
console.warn("Non-object current value of context \"".concat(name, "\" for \"context.assign\", try \"context.replace\" instead."));
|
|
1904
|
+
item.value = value;
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
if (this.batchUpdate) return;
|
|
1908
|
+
(_item$eventTarget = item.eventTarget) === null || _item$eventTarget === void 0 ? void 0 : _item$eventTarget.dispatchEvent(new CustomEvent(this.eventName, {
|
|
1909
|
+
detail: item.value
|
|
1910
|
+
}));
|
|
1911
|
+
}
|
|
1912
|
+
finishLoad(item, value) {
|
|
1913
|
+
var _item$eventTarget2;
|
|
1914
|
+
if (!item.useResolve) {
|
|
1915
|
+
// This happens when a tracked conditional resolve switches from
|
|
1916
|
+
// resolve to fallback after an dep update triggered refresh but
|
|
1917
|
+
// before it's been resolved.
|
|
1918
|
+
return;
|
|
1919
|
+
}
|
|
1920
|
+
item.loaded = true;
|
|
1921
|
+
item.value = value;
|
|
1922
|
+
(_item$eventTarget2 = item.eventTarget) === null || _item$eventTarget2 === void 0 ? void 0 : _item$eventTarget2.dispatchEvent(new CustomEvent(this.eventName, {
|
|
1923
|
+
detail: value
|
|
1924
|
+
}));
|
|
1925
|
+
}
|
|
1926
|
+
waitForUsedContext(data) {
|
|
1927
|
+
var _this = this;
|
|
1928
|
+
return _asyncToGenerator__default["default"](function* () {
|
|
1929
|
+
if (_this.tplContextId || _this.formContextId) {
|
|
1930
|
+
return;
|
|
1931
|
+
}
|
|
1932
|
+
var usage = brickUtils.collectContextUsage(data, "CTX");
|
|
1933
|
+
if (usage.includesComputed) {
|
|
1934
|
+
for (var pending of _this.pendingStack) {
|
|
1935
|
+
yield pending.pendingResult;
|
|
1936
|
+
}
|
|
1937
|
+
} else if (usage.usedContexts.length > 0) {
|
|
1938
|
+
var _loop = function* (pendingContexts) {
|
|
1939
|
+
yield Promise.all(usage.usedContexts.map(ctx => pendingContexts.get(ctx)));
|
|
1940
|
+
};
|
|
1941
|
+
for (var {
|
|
1942
|
+
pendingContexts
|
|
1943
|
+
} of _this.pendingStack) {
|
|
1944
|
+
yield* _loop(pendingContexts);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
})();
|
|
1948
|
+
}
|
|
1949
|
+
waitForAllContext() {
|
|
1950
|
+
var _this2 = this;
|
|
1951
|
+
return _asyncToGenerator__default["default"](function* () {
|
|
1952
|
+
if (_this2.tplContextId || _this2.formContextId) {
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
for (var pending of _this2.pendingStack) {
|
|
1956
|
+
yield pending.pendingResult;
|
|
1957
|
+
}
|
|
1958
|
+
})();
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
/** After mount, dispatch the change event when an async data is loaded */
|
|
1962
|
+
handleAsyncAfterMount() {
|
|
1963
|
+
this.data.forEach(item => {
|
|
1964
|
+
if (item.type === "free-variable" && item.async) {
|
|
1965
|
+
// An async data always has `loading`
|
|
1966
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1967
|
+
item.loading.then(value => {
|
|
1968
|
+
this.finishLoad(item, value);
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
deferDefine(contextConfs, coreContext, brick) {
|
|
1974
|
+
var {
|
|
1975
|
+
mergedContext,
|
|
1976
|
+
keyword
|
|
1977
|
+
} = this.getResolveOptions(coreContext);
|
|
1978
|
+
if (Array.isArray(contextConfs) && contextConfs.length > 0) {
|
|
1979
|
+
var pending = brickUtils.deferResolveContextConcurrently(contextConfs, contextConf => resolveStoryboardContext(contextConf, mergedContext, this, brick), keyword);
|
|
1980
|
+
this.pendingStack.push(pending);
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
define(contextConfs, coreContext, brick) {
|
|
1984
|
+
var _this3 = this;
|
|
1985
|
+
return _asyncToGenerator__default["default"](function* () {
|
|
1986
|
+
if (Array.isArray(contextConfs)) {
|
|
1987
|
+
var {
|
|
1988
|
+
mergedContext,
|
|
1989
|
+
keyword
|
|
1990
|
+
} = _this3.getResolveOptions(coreContext);
|
|
1991
|
+
yield brickUtils.resolveContextConcurrently(contextConfs, contextConf => resolveStoryboardContext(contextConf, mergedContext, _this3, brick), keyword);
|
|
1992
|
+
}
|
|
1993
|
+
})();
|
|
1994
|
+
}
|
|
1995
|
+
syncDefine(contextConfs, coreContext, brick) {
|
|
1996
|
+
if (Array.isArray(contextConfs)) {
|
|
1997
|
+
var {
|
|
1998
|
+
mergedContext,
|
|
1999
|
+
keyword
|
|
2000
|
+
} = this.getResolveOptions(coreContext);
|
|
2001
|
+
brickUtils.syncResolveContextConcurrently(contextConfs, contextConf => syncResolveStoryboardContext(contextConf, mergedContext, this, brick), keyword);
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
getResolveOptions(coreContext) {
|
|
2005
|
+
return this.formContextId ? {
|
|
2006
|
+
mergedContext: _objectSpread__default["default"](_objectSpread__default["default"]({}, coreContext), {}, {
|
|
2007
|
+
formContextId: this.formContextId
|
|
2008
|
+
}),
|
|
2009
|
+
keyword: "FORM_STATE"
|
|
2010
|
+
} : this.tplContextId ? {
|
|
2011
|
+
mergedContext: _objectSpread__default["default"](_objectSpread__default["default"]({}, coreContext), {}, {
|
|
2012
|
+
tplContextId: this.tplContextId
|
|
2013
|
+
}),
|
|
2014
|
+
keyword: "STATE"
|
|
2015
|
+
} : {
|
|
2016
|
+
mergedContext: coreContext,
|
|
2017
|
+
keyword: "CTX"
|
|
2018
|
+
};
|
|
1938
2019
|
}
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
2020
|
+
getContextTriggerSetByLifecycle(lifecycle) {
|
|
2021
|
+
return this.batchTriggerContextsNamesMap.get(lifecycle) || [];
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
function resolveStoryboardContext(_x, _x2, _x3, _x4) {
|
|
2025
|
+
return _resolveStoryboardContext.apply(this, arguments);
|
|
2026
|
+
}
|
|
2027
|
+
function _resolveStoryboardContext() {
|
|
2028
|
+
_resolveStoryboardContext = _asyncToGenerator__default["default"](function* (contextConf, coreContext, storyboardContextWrapper, brick) {
|
|
2029
|
+
if (contextConf.property) {
|
|
2030
|
+
if (storyboardContextWrapper.tplContextId) {
|
|
2031
|
+
throw new Error("Setting `property` is not allowed in template scoped context");
|
|
2032
|
+
}
|
|
2033
|
+
if (brick) {
|
|
2034
|
+
storyboardContextWrapper.set(contextConf.name, {
|
|
2035
|
+
type: "brick-property",
|
|
2036
|
+
brick,
|
|
2037
|
+
prop: contextConf.property
|
|
1950
2038
|
});
|
|
1951
|
-
return;
|
|
1952
2039
|
}
|
|
2040
|
+
return true;
|
|
1953
2041
|
}
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
2042
|
+
return resolveNormalStoryboardContext(contextConf, coreContext, storyboardContextWrapper, brick);
|
|
2043
|
+
});
|
|
2044
|
+
return _resolveStoryboardContext.apply(this, arguments);
|
|
2045
|
+
}
|
|
2046
|
+
var supportContextResolveTriggerBrickLifeCycle = ["onBeforePageLoad", "onPageLoad", "onBeforePageLeave", "onPageLeave", "onAnchorLoad", "onAnchorUnload"];
|
|
2047
|
+
function resolveNormalStoryboardContext(_x5, _x6, _x7, _x8) {
|
|
2048
|
+
return _resolveNormalStoryboardContext.apply(this, arguments);
|
|
2049
|
+
}
|
|
2050
|
+
function _resolveNormalStoryboardContext() {
|
|
2051
|
+
_resolveNormalStoryboardContext = _asyncToGenerator__default["default"](function* (contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
2052
|
+
yield storyboardContextWrapper.waitForUsedContext(contextConf.if);
|
|
2053
|
+
if (!looseCheckIf$1(contextConf, mergedContext)) {
|
|
2054
|
+
return false;
|
|
1959
2055
|
}
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
2056
|
+
var isTemplateState = !!storyboardContextWrapper.tplContextId;
|
|
2057
|
+
var isFormState = !!storyboardContextWrapper.formContextId;
|
|
2058
|
+
var value = getDefinedTemplateState(isTemplateState, contextConf, brick);
|
|
2059
|
+
var load = null;
|
|
2060
|
+
var loading;
|
|
2061
|
+
var useResolve;
|
|
2062
|
+
var trackConditionalResolve;
|
|
2063
|
+
var resolvePolicy;
|
|
2064
|
+
if (value === undefined) {
|
|
2065
|
+
if (contextConf.resolve) {
|
|
2066
|
+
var hasFallbackValue = brickUtils.hasOwnProperty(contextConf, "value");
|
|
2067
|
+
// Track conditional resolve only if all matches:
|
|
2068
|
+
// - Track enabled
|
|
2069
|
+
// - Has fallback value
|
|
2070
|
+
// - Referencing other data in `resolve.if`
|
|
2071
|
+
trackConditionalResolve = contextConf.track && hasFallbackValue && brickUtils.hasOwnProperty(contextConf.resolve, "if") && brickUtils.collectContextUsage(contextConf.resolve.if, isTemplateState ? "STATE" : isFormState ? "FORM_STATE" : "CTX").usedContexts.length > 0;
|
|
2072
|
+
yield storyboardContextWrapper.waitForUsedContext(contextConf.resolve.if);
|
|
2073
|
+
useResolve = looseCheckIf$1(contextConf.resolve, mergedContext);
|
|
2074
|
+
if (useResolve || trackConditionalResolve) {
|
|
2075
|
+
load = /*#__PURE__*/function () {
|
|
2076
|
+
var _ref = _asyncToGenerator__default["default"](function* (options) {
|
|
2077
|
+
var valueConf = {};
|
|
2078
|
+
yield _internalApiGetResolver().resolveOne("reference", _objectSpread__default["default"]({
|
|
2079
|
+
transform: "value",
|
|
2080
|
+
transformMapArray: false
|
|
2081
|
+
}, contextConf.resolve), valueConf, null, mergedContext, options);
|
|
2082
|
+
return valueConf.value;
|
|
2083
|
+
});
|
|
2084
|
+
return function load(_x9) {
|
|
2085
|
+
return _ref.apply(this, arguments);
|
|
2086
|
+
};
|
|
2087
|
+
}();
|
|
1971
2088
|
}
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
2089
|
+
if (useResolve) {
|
|
2090
|
+
// `async` take precedence over `lazy`
|
|
2091
|
+
resolvePolicy = contextConf.resolve.async && !isTemplateState ? "async" : contextConf.resolve.lazy ? "lazy" : "eager";
|
|
2092
|
+
if (resolvePolicy === "eager") {
|
|
2093
|
+
value = yield load();
|
|
2094
|
+
} else if (resolvePolicy === "async") {
|
|
2095
|
+
loading = load();
|
|
2096
|
+
} else if (contextConf.resolve.trigger) {
|
|
2097
|
+
var lifecycleName = contextConf.resolve.trigger;
|
|
2098
|
+
if (supportContextResolveTriggerBrickLifeCycle.includes(lifecycleName)) {
|
|
2099
|
+
var contextNameArray = storyboardContextWrapper.batchTriggerContextsNamesMap.get(lifecycleName) || [];
|
|
2100
|
+
contextNameArray.push({
|
|
2101
|
+
name: contextConf.name,
|
|
2102
|
+
type: storyboardContextWrapper.tplContextId ? "state" : "context",
|
|
2103
|
+
tplContextId: storyboardContextWrapper.tplContextId
|
|
2104
|
+
});
|
|
2105
|
+
storyboardContextWrapper.batchTriggerContextsNamesMap.set(lifecycleName, contextNameArray);
|
|
2106
|
+
} else {
|
|
2107
|
+
// eslint-disable-next-line no-console
|
|
2108
|
+
console.error("unsupported lifecycle: \"".concat(lifecycleName, "\""));
|
|
2109
|
+
}
|
|
1991
2110
|
}
|
|
1992
|
-
})
|
|
2111
|
+
} else if (!hasFallbackValue) {
|
|
2112
|
+
return false;
|
|
2113
|
+
}
|
|
1993
2114
|
}
|
|
1994
|
-
if (
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
});
|
|
2000
|
-
callbackFactory("finally")();
|
|
2001
|
-
}, err => {
|
|
2002
|
-
if (!shouldDismiss(err) && callback.error) {
|
|
2003
|
-
callbackFactory("error")(err);
|
|
2004
|
-
}
|
|
2005
|
-
callbackFactory("finally")();
|
|
2006
|
-
});
|
|
2115
|
+
if ((!useResolve || resolvePolicy !== "eager") && contextConf.value !== undefined) {
|
|
2116
|
+
yield storyboardContextWrapper.waitForUsedContext(contextConf.value);
|
|
2117
|
+
// If the context has no resolve, just use its `value`.
|
|
2118
|
+
// Or if the resolve is ignored or lazy, use its `value` as a fallback.
|
|
2119
|
+
value = computeRealValue(contextConf.value, mergedContext, true);
|
|
2007
2120
|
}
|
|
2008
|
-
return;
|
|
2009
2121
|
}
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2122
|
+
resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, load, resolvePolicy === "eager", loading, resolvePolicy === "async", useResolve, trackConditionalResolve);
|
|
2123
|
+
return true;
|
|
2124
|
+
});
|
|
2125
|
+
return _resolveNormalStoryboardContext.apply(this, arguments);
|
|
2126
|
+
}
|
|
2127
|
+
function syncResolveStoryboardContext(contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
2128
|
+
if (!looseCheckIf$1(contextConf, mergedContext)) {
|
|
2129
|
+
return false;
|
|
2130
|
+
}
|
|
2131
|
+
if (contextConf.resolve) {
|
|
2132
|
+
throw new Error("resolve is not allowed here");
|
|
2133
|
+
}
|
|
2134
|
+
var value = getDefinedTemplateState(!!storyboardContextWrapper.tplContextId, contextConf, brick);
|
|
2135
|
+
if (value === undefined) {
|
|
2136
|
+
value = computeRealValue(contextConf.value, mergedContext, true);
|
|
2137
|
+
}
|
|
2138
|
+
resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick);
|
|
2139
|
+
return true;
|
|
2140
|
+
}
|
|
2141
|
+
function getDefinedTemplateState(isTemplateState, contextConf, brick) {
|
|
2142
|
+
if (isTemplateState && brick.properties && brickUtils.hasOwnProperty(brick.properties, contextConf.name)) {
|
|
2143
|
+
return brick.properties[contextConf.name];
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, load, loaded, loading, async, useResolve, trackConditionalResolve) {
|
|
2147
|
+
var newContext = {
|
|
2148
|
+
type: "free-variable",
|
|
2149
|
+
value,
|
|
2150
|
+
// This is required for tracking context, even if no `onChange` is specified.
|
|
2151
|
+
eventTarget: new EventTarget$1(),
|
|
2152
|
+
useResolve,
|
|
2153
|
+
load,
|
|
2154
|
+
loaded,
|
|
2155
|
+
loading,
|
|
2156
|
+
async,
|
|
2157
|
+
deps: []
|
|
2158
|
+
};
|
|
2159
|
+
var eventName = storyboardContextWrapper.formContextId ? "formstate.change" : storyboardContextWrapper.tplContextId ? "state.change" : "context.change";
|
|
2160
|
+
if (contextConf.onChange) {
|
|
2161
|
+
for (var handler of [].concat(contextConf.onChange)) {
|
|
2162
|
+
newContext.eventTarget.addEventListener(eventName, listenerFactory(handler, mergedContext, brick));
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
newContext.eventTarget.addEventListener(eventName, e => {
|
|
2166
|
+
storyboardContextWrapper.notifyRealTimeDataChange(contextConf.name, e.detail);
|
|
2167
|
+
});
|
|
2168
|
+
if (contextConf.track) {
|
|
2169
|
+
var isTemplateState = !!storyboardContextWrapper.tplContextId;
|
|
2170
|
+
var isFormState = !!storyboardContextWrapper.formContextId;
|
|
2171
|
+
// Track its dependencies and auto update when each of them changed.
|
|
2172
|
+
var deps = (isFormState ? brickUtils.trackUsedFormState : isTemplateState ? brickUtils.trackUsedState : brickUtils.trackUsedContext)(trackConditionalResolve ? [contextConf.resolve, contextConf.value] : load ? contextConf.resolve : contextConf.value);
|
|
2173
|
+
!load && (newContext.deps = deps);
|
|
2174
|
+
for (var dep of deps) {
|
|
2175
|
+
var _eventTarget;
|
|
2176
|
+
var ctx = storyboardContextWrapper.get().get(dep);
|
|
2177
|
+
ctx === null || ctx === void 0 ? void 0 : (_eventTarget = ctx.eventTarget) === null || _eventTarget === void 0 ? void 0 : _eventTarget.addEventListener(eventName, batchAddListener(() => {
|
|
2178
|
+
newContext.useResolve = trackConditionalResolve ? looseCheckIf$1(contextConf.resolve, mergedContext) : !!load;
|
|
2179
|
+
if (newContext.useResolve) {
|
|
2180
|
+
storyboardContextWrapper.updateValue(contextConf.name, {
|
|
2181
|
+
cache: "default"
|
|
2182
|
+
}, "refresh");
|
|
2183
|
+
} else {
|
|
2184
|
+
storyboardContextWrapper.updateValue(contextConf.name, computeRealValue(contextConf.value, mergedContext, true), "replace");
|
|
2185
|
+
}
|
|
2186
|
+
}, contextConf, storyboardContextWrapper));
|
|
2020
2187
|
}
|
|
2021
|
-
if (this.batchUpdate) return;
|
|
2022
|
-
(_item$eventTarget = item.eventTarget) === null || _item$eventTarget === void 0 ? void 0 : _item$eventTarget.dispatchEvent(new CustomEvent(this.eventName, {
|
|
2023
|
-
detail: item.value
|
|
2024
|
-
}));
|
|
2025
2188
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
// before it's been resolved.
|
|
2189
|
+
storyboardContextWrapper.set(contextConf.name, newContext);
|
|
2190
|
+
}
|
|
2191
|
+
function batchAddListener(listener, contextConf, storyboardContextWrapper) {
|
|
2192
|
+
return event => {
|
|
2193
|
+
if (storyboardContextWrapper.batchUpdate && storyboardContextWrapper.batchUpdateContextsNames.includes(contextConf.name)) {
|
|
2032
2194
|
return;
|
|
2033
2195
|
}
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2196
|
+
listener(event);
|
|
2197
|
+
};
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
var tplContextMap = new Map();
|
|
2201
|
+
class CustomTemplateContext {
|
|
2202
|
+
constructor(brick, renderId) {
|
|
2203
|
+
_defineProperty__default["default"](this, "variables", void 0);
|
|
2204
|
+
_defineProperty__default["default"](this, "state", void 0);
|
|
2205
|
+
_defineProperty__default["default"](this, "id", _.uniqueId("tpl-ctx-"));
|
|
2206
|
+
this.brick = brick;
|
|
2207
|
+
tplContextMap.set(this.id, this);
|
|
2208
|
+
this.state = new StoryboardContextWrapper(this.id, undefined, renderId);
|
|
2209
|
+
brick.tplContextId = this.id;
|
|
2039
2210
|
}
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
if (_this.tplContextId || _this.formContextId) {
|
|
2044
|
-
return;
|
|
2045
|
-
}
|
|
2046
|
-
var usage = brickUtils.collectContextUsage(data, "CTX");
|
|
2047
|
-
if (usage.includesComputed) {
|
|
2048
|
-
for (var pending of _this.pendingStack) {
|
|
2049
|
-
yield pending.pendingResult;
|
|
2050
|
-
}
|
|
2051
|
-
} else if (usage.usedContexts.length > 0) {
|
|
2052
|
-
var _loop = function* (pendingContexts) {
|
|
2053
|
-
yield Promise.all(usage.usedContexts.map(ctx => pendingContexts.get(ctx)));
|
|
2054
|
-
};
|
|
2055
|
-
for (var {
|
|
2056
|
-
pendingContexts
|
|
2057
|
-
} of _this.pendingStack) {
|
|
2058
|
-
yield* _loop(pendingContexts);
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
})();
|
|
2211
|
+
setVariables(variables) {
|
|
2212
|
+
this.variables = variables;
|
|
2213
|
+
Object.freeze(variables);
|
|
2062
2214
|
}
|
|
2063
|
-
|
|
2064
|
-
var
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2215
|
+
getVariables() {
|
|
2216
|
+
var {
|
|
2217
|
+
element
|
|
2218
|
+
} = this.brick;
|
|
2219
|
+
if (element) {
|
|
2220
|
+
return Object.fromEntries(Object.keys(this.variables).map(prop => [prop, element[prop]]));
|
|
2221
|
+
}
|
|
2222
|
+
return this.variables;
|
|
2223
|
+
}
|
|
2224
|
+
getBrick() {
|
|
2225
|
+
return this.brick;
|
|
2073
2226
|
}
|
|
2227
|
+
}
|
|
2228
|
+
function getCustomTemplateContext(tplContextId) {
|
|
2229
|
+
return tplContextMap.get(tplContextId);
|
|
2230
|
+
}
|
|
2231
|
+
function getCustomContextTriggerListByLifecycle(lifecycle) {
|
|
2232
|
+
return [...tplContextMap.values()].map(tplContext => tplContext.state.getContextTriggerSetByLifecycle(lifecycle)).filter(trigger => trigger.length > 0).flat(1);
|
|
2233
|
+
}
|
|
2074
2234
|
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2235
|
+
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2236
|
+
try {
|
|
2237
|
+
var info = gen[key](arg);
|
|
2238
|
+
var value = info.value;
|
|
2239
|
+
} catch (error) {
|
|
2240
|
+
reject(error);
|
|
2241
|
+
return;
|
|
2242
|
+
}
|
|
2243
|
+
if (info.done) {
|
|
2244
|
+
resolve(value);
|
|
2245
|
+
} else {
|
|
2246
|
+
Promise.resolve(value).then(_next, _throw);
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
function _asyncToGenerator$2(fn) {
|
|
2250
|
+
return function () {
|
|
2251
|
+
var self = this,
|
|
2252
|
+
args = arguments;
|
|
2253
|
+
return new Promise(function (resolve, reject) {
|
|
2254
|
+
var gen = fn.apply(self, args);
|
|
2255
|
+
function _next(value) {
|
|
2256
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
2084
2257
|
}
|
|
2258
|
+
function _throw(err) {
|
|
2259
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2260
|
+
}
|
|
2261
|
+
_next(undefined);
|
|
2262
|
+
});
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2265
|
+
function _defineProperty(obj, key, value) {
|
|
2266
|
+
if (key in obj) {
|
|
2267
|
+
Object.defineProperty(obj, key, {
|
|
2268
|
+
value: value,
|
|
2269
|
+
enumerable: true,
|
|
2270
|
+
configurable: true,
|
|
2271
|
+
writable: true
|
|
2085
2272
|
});
|
|
2273
|
+
} else {
|
|
2274
|
+
obj[key] = value;
|
|
2086
2275
|
}
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2276
|
+
return obj;
|
|
2277
|
+
}
|
|
2278
|
+
function ownKeys(object, enumerableOnly) {
|
|
2279
|
+
var keys = Object.keys(object);
|
|
2280
|
+
if (Object.getOwnPropertySymbols) {
|
|
2281
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
2282
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
2283
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
2284
|
+
});
|
|
2285
|
+
keys.push.apply(keys, symbols);
|
|
2286
|
+
}
|
|
2287
|
+
return keys;
|
|
2288
|
+
}
|
|
2289
|
+
function _objectSpread2(target) {
|
|
2290
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
2291
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
2292
|
+
if (i % 2) {
|
|
2293
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
2294
|
+
_defineProperty(target, key, source[key]);
|
|
2295
|
+
});
|
|
2296
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
2297
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
2298
|
+
} else {
|
|
2299
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
2300
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2301
|
+
});
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
return target;
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
/**
|
|
2308
|
+
* @description 获取实例详情
|
|
2309
|
+
* @endpoint GET /object/:objectId/instance/:instanceId
|
|
2310
|
+
*/
|
|
2311
|
+
var InstanceApi_getDetail = /*#__PURE__*/function () {
|
|
2312
|
+
var _ref = _asyncToGenerator$2(function* (objectId, instanceId, params, options) {
|
|
2313
|
+
return (/**! @contract easyops.api.cmdb.instance.GetDetail */
|
|
2314
|
+
(yield brickHttp.http.get("api/gateway/cmdb.instance.GetDetail/object/".concat(objectId, "/instance/").concat(instanceId), _objectSpread2(_objectSpread2({}, options), {}, {
|
|
2315
|
+
params
|
|
2316
|
+
}))).data
|
|
2317
|
+
);
|
|
2318
|
+
});
|
|
2319
|
+
return function InstanceApi_getDetail(_x, _x2, _x3, _x4) {
|
|
2320
|
+
return _ref.apply(this, arguments);
|
|
2321
|
+
};
|
|
2322
|
+
}();
|
|
2323
|
+
|
|
2324
|
+
/**
|
|
2325
|
+
* @description 搜索实例
|
|
2326
|
+
* @endpoint POST /object/:objectId/instance/_search
|
|
2327
|
+
*/
|
|
2328
|
+
var InstanceApi_postSearch = /*#__PURE__*/function () {
|
|
2329
|
+
var _ref = _asyncToGenerator$2(function* (objectId, data, options) {
|
|
2330
|
+
return (/**! @contract easyops.api.cmdb.instance.PostSearch */
|
|
2331
|
+
(yield brickHttp.http.post("api/gateway/cmdb.instance.PostSearch/object/".concat(objectId, "/instance/_search"), data, options)).data
|
|
2332
|
+
);
|
|
2333
|
+
});
|
|
2334
|
+
return function InstanceApi_postSearch(_x, _x2, _x3) {
|
|
2335
|
+
return _ref.apply(this, arguments);
|
|
2336
|
+
};
|
|
2337
|
+
}();
|
|
2338
|
+
|
|
2339
|
+
var _excluded$8 = ["children"],
|
|
2340
|
+
_excluded2$2 = ["children"],
|
|
2341
|
+
_excluded3 = ["items", "app"];
|
|
2342
|
+
var symbolAppId = Symbol("appId");
|
|
2343
|
+
var symbolMenuI18nNamespace = Symbol("menuI18nNamespace");
|
|
2344
|
+
var symbolOverrideApp = Symbol("overrideApp");
|
|
2345
|
+
var symbolShouldCache = Symbol("shouldCache");
|
|
2346
|
+
// Caching menu requests to avoid flicker.
|
|
2347
|
+
var menuCache = new Map();
|
|
2348
|
+
var menuTitleCache = new Map();
|
|
2349
|
+
var processMenuCache = new Map();
|
|
2350
|
+
function constructMenu(_x, _x2, _x3) {
|
|
2351
|
+
return _constructMenu.apply(this, arguments);
|
|
2352
|
+
}
|
|
2353
|
+
function _constructMenu() {
|
|
2354
|
+
_constructMenu = _asyncToGenerator__default["default"](function* (menuBar, context, kernel) {
|
|
2355
|
+
var hasSubMenu = !!menuBar.subMenuId;
|
|
2356
|
+
yield Promise.all([_asyncToGenerator__default["default"](function* () {
|
|
2357
|
+
if (menuBar.menuId) {
|
|
2358
|
+
var _menuBar$menu;
|
|
2359
|
+
var defaultCollapsed = (_menuBar$menu = menuBar.menu) === null || _menuBar$menu === void 0 ? void 0 : _menuBar$menu.defaultCollapsed;
|
|
2360
|
+
var menu = yield processMenu(menuBar.menuId, context, kernel, hasSubMenu);
|
|
2361
|
+
if (!_.isNil(defaultCollapsed)) {
|
|
2362
|
+
menu.defaultCollapsed = defaultCollapsed;
|
|
2363
|
+
}
|
|
2364
|
+
menuBar.menu = menu;
|
|
2365
|
+
}
|
|
2366
|
+
})(), _asyncToGenerator__default["default"](function* () {
|
|
2367
|
+
if (hasSubMenu) {
|
|
2368
|
+
menuBar.subMenu = yield processMenu(menuBar.subMenuId, context, kernel);
|
|
2369
|
+
} else {
|
|
2370
|
+
menuBar.subMenu = null;
|
|
2371
|
+
}
|
|
2372
|
+
})()]);
|
|
2373
|
+
});
|
|
2374
|
+
return _constructMenu.apply(this, arguments);
|
|
2375
|
+
}
|
|
2376
|
+
function preConstructMenus(_x4, _x5, _x6) {
|
|
2377
|
+
return _preConstructMenus.apply(this, arguments);
|
|
2378
|
+
}
|
|
2379
|
+
function _preConstructMenus() {
|
|
2380
|
+
_preConstructMenus = _asyncToGenerator__default["default"](function* (menus, context, kernel) {
|
|
2381
|
+
var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel, undefined, true)));
|
|
2382
|
+
data.forEach((item, index) => processMenuCache.set(menus[index], item));
|
|
2383
|
+
});
|
|
2384
|
+
return _preConstructMenus.apply(this, arguments);
|
|
2385
|
+
}
|
|
2386
|
+
var getMenu = menuId => processMenuCache.get(menuId);
|
|
2387
|
+
function fetchMenuById(_x7, _x8, _x9) {
|
|
2388
|
+
return _fetchMenuById.apply(this, arguments);
|
|
2389
|
+
}
|
|
2390
|
+
function _fetchMenuById() {
|
|
2391
|
+
_fetchMenuById = _asyncToGenerator__default["default"](function* (menuId, kernel, isPreFetch) {
|
|
2392
|
+
if (menuCache.has(menuId)) {
|
|
2393
|
+
return menuCache.get(menuId);
|
|
2095
2394
|
}
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2395
|
+
var menuList = window.STANDALONE_MICRO_APPS ? yield kernel.getStandaloneMenus(menuId, isPreFetch) : kernel.getFeatureFlags()["three-level-menu-layout"] ? (yield InstalledMicroAppApi_getMenusInfo(menuId, {
|
|
2396
|
+
menuObjectId: "EASYOPS_STORYBOARD_MENU"
|
|
2397
|
+
})).menus : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
|
|
2398
|
+
page: 1,
|
|
2399
|
+
page_size: 200,
|
|
2400
|
+
fields: {
|
|
2401
|
+
menuId: true,
|
|
2402
|
+
title: true,
|
|
2403
|
+
icon: true,
|
|
2404
|
+
link: true,
|
|
2405
|
+
titleDataSource: true,
|
|
2406
|
+
defaultCollapsed: true,
|
|
2407
|
+
defaultCollapsedBreakpoint: true,
|
|
2408
|
+
type: true,
|
|
2409
|
+
injectMenuGroupId: true,
|
|
2410
|
+
dynamicItems: true,
|
|
2411
|
+
itemsResolve: true,
|
|
2412
|
+
items: true,
|
|
2413
|
+
i18n: true,
|
|
2414
|
+
"items.children": true,
|
|
2415
|
+
"app.appId": true
|
|
2416
|
+
},
|
|
2417
|
+
query: {
|
|
2418
|
+
menuId: {
|
|
2419
|
+
$eq: menuId
|
|
2420
|
+
},
|
|
2421
|
+
app: {
|
|
2422
|
+
$size: {
|
|
2423
|
+
$gt: 0
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2106
2426
|
}
|
|
2107
|
-
})
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
var {
|
|
2112
|
-
mergedContext,
|
|
2113
|
-
keyword
|
|
2114
|
-
} = this.getResolveOptions(coreContext);
|
|
2115
|
-
brickUtils.syncResolveContextConcurrently(contextConfs, contextConf => syncResolveStoryboardContext(contextConf, mergedContext, this, brick), keyword);
|
|
2427
|
+
})).list;
|
|
2428
|
+
var menuData = yield mergeMenu(menuList, kernel);
|
|
2429
|
+
if (!menuData) {
|
|
2430
|
+
throw new Error("Menu not found: ".concat(menuId));
|
|
2116
2431
|
}
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
return
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
}),
|
|
2123
|
-
keyword: "FORM_STATE"
|
|
2124
|
-
} : this.tplContextId ? {
|
|
2125
|
-
mergedContext: _objectSpread__default["default"](_objectSpread__default["default"]({}, coreContext), {}, {
|
|
2126
|
-
tplContextId: this.tplContextId
|
|
2127
|
-
}),
|
|
2128
|
-
keyword: "STATE"
|
|
2129
|
-
} : {
|
|
2130
|
-
mergedContext: coreContext,
|
|
2131
|
-
keyword: "CTX"
|
|
2132
|
-
};
|
|
2133
|
-
}
|
|
2134
|
-
getContextTriggerSetByLifecycle(lifecycle) {
|
|
2135
|
-
return this.batchTriggerContextsNamesMap.get(lifecycle) || [];
|
|
2136
|
-
}
|
|
2432
|
+
reorderMenu(menuData);
|
|
2433
|
+
menuData[symbolShouldCache] && menuCache.set(menuId, menuData);
|
|
2434
|
+
return menuData;
|
|
2435
|
+
});
|
|
2436
|
+
return _fetchMenuById.apply(this, arguments);
|
|
2137
2437
|
}
|
|
2138
|
-
function
|
|
2139
|
-
return
|
|
2438
|
+
function mergeMenu(_x10, _x11) {
|
|
2439
|
+
return _mergeMenu.apply(this, arguments);
|
|
2140
2440
|
}
|
|
2141
|
-
function
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2441
|
+
function _mergeMenu() {
|
|
2442
|
+
_mergeMenu = _asyncToGenerator__default["default"](function* (menuList, kernel) {
|
|
2443
|
+
var mainMenu = menuList.find(menu => menu.type !== "inject");
|
|
2444
|
+
if (!mainMenu) {
|
|
2445
|
+
return undefined;
|
|
2446
|
+
}
|
|
2447
|
+
var validMenuList = [];
|
|
2448
|
+
var injectWithMenus = new Map();
|
|
2449
|
+
var menuWithI18n = new WeakMap();
|
|
2450
|
+
for (var menu of menuList) {
|
|
2451
|
+
if (menu.i18n) {
|
|
2452
|
+
(function () {
|
|
2453
|
+
var menuI18nNamespace = getI18nNamespace("menu", "".concat(menu.menuId, "~").concat(menu.app[0].appId, "+").concat(menu.instanceId));
|
|
2454
|
+
// Support any language in `meta.i18n`.
|
|
2455
|
+
Object.entries(menu.i18n).forEach(_ref6 => {
|
|
2456
|
+
var [lang, resources] = _ref6;
|
|
2457
|
+
i18next__default["default"].addResourceBundle(lang, menuI18nNamespace, resources);
|
|
2458
|
+
});
|
|
2459
|
+
menuWithI18n.set(menu, menuI18nNamespace);
|
|
2460
|
+
})();
|
|
2146
2461
|
}
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2462
|
+
}
|
|
2463
|
+
var shouldCacheList = yield Promise.all(menuList.map(menu => loadDynamicMenuItems(menu, kernel, menuWithI18n)));
|
|
2464
|
+
for (var _menu of menuList) {
|
|
2465
|
+
var _menu$items;
|
|
2466
|
+
if (((_menu$items = _menu.items) === null || _menu$items === void 0 ? void 0 : _menu$items.length) > 0) {
|
|
2467
|
+
if (_menu.type === "inject" && _menu.injectMenuGroupId) {
|
|
2468
|
+
var injectingMenus = injectWithMenus.get(_menu.injectMenuGroupId);
|
|
2469
|
+
if (!injectingMenus) {
|
|
2470
|
+
injectingMenus = [];
|
|
2471
|
+
injectWithMenus.set(_menu.injectMenuGroupId, injectingMenus);
|
|
2472
|
+
}
|
|
2473
|
+
injectingMenus.push(_menu);
|
|
2474
|
+
} else {
|
|
2475
|
+
validMenuList.push(_menu);
|
|
2476
|
+
}
|
|
2153
2477
|
}
|
|
2154
|
-
return true;
|
|
2155
2478
|
}
|
|
2156
|
-
return
|
|
2479
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, mainMenu), {}, {
|
|
2480
|
+
items: validMenuList.flatMap(menu => processGroupInject(menu.items, menu, injectWithMenus, menuWithI18n)),
|
|
2481
|
+
[symbolShouldCache]: shouldCacheList.every(Boolean),
|
|
2482
|
+
[symbolMenuI18nNamespace]: menuWithI18n.get(mainMenu),
|
|
2483
|
+
[symbolOverrideApp]: mainMenu.overrideApp
|
|
2484
|
+
});
|
|
2157
2485
|
});
|
|
2158
|
-
return
|
|
2159
|
-
}
|
|
2160
|
-
var supportContextResolveTriggerBrickLifeCycle = ["onBeforePageLoad", "onPageLoad", "onBeforePageLeave", "onPageLeave", "onAnchorLoad", "onAnchorUnload"];
|
|
2161
|
-
function resolveNormalStoryboardContext(_x5, _x6, _x7, _x8) {
|
|
2162
|
-
return _resolveNormalStoryboardContext.apply(this, arguments);
|
|
2486
|
+
return _mergeMenu.apply(this, arguments);
|
|
2163
2487
|
}
|
|
2164
|
-
function
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2488
|
+
function processGroupInject(items, menu, injectWithMenus, menuWithI18n) {
|
|
2489
|
+
return items === null || items === void 0 ? void 0 : items.map(item => {
|
|
2490
|
+
var _processGroupInject;
|
|
2491
|
+
var foundInjectingMenus = item.groupId && injectWithMenus.get(item.groupId);
|
|
2492
|
+
if (foundInjectingMenus) {
|
|
2493
|
+
// Each menu to be injected with should be injected only once.
|
|
2494
|
+
injectWithMenus.delete(item.groupId);
|
|
2169
2495
|
}
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
transform: "value",
|
|
2194
|
-
transformMapArray: false
|
|
2195
|
-
}, contextConf.resolve), valueConf, null, mergedContext, options);
|
|
2196
|
-
return valueConf.value;
|
|
2197
|
-
});
|
|
2198
|
-
return function load(_x9) {
|
|
2199
|
-
return _ref.apply(this, arguments);
|
|
2200
|
-
};
|
|
2201
|
-
}();
|
|
2202
|
-
}
|
|
2203
|
-
if (useResolve) {
|
|
2204
|
-
// `async` take precedence over `lazy`
|
|
2205
|
-
resolvePolicy = contextConf.resolve.async && !isTemplateState ? "async" : contextConf.resolve.lazy ? "lazy" : "eager";
|
|
2206
|
-
if (resolvePolicy === "eager") {
|
|
2207
|
-
value = yield load();
|
|
2208
|
-
} else if (resolvePolicy === "async") {
|
|
2209
|
-
loading = load();
|
|
2210
|
-
} else if (contextConf.resolve.trigger) {
|
|
2211
|
-
var lifecycleName = contextConf.resolve.trigger;
|
|
2212
|
-
if (supportContextResolveTriggerBrickLifeCycle.includes(lifecycleName)) {
|
|
2213
|
-
var contextNameArray = storyboardContextWrapper.batchTriggerContextsNamesMap.get(lifecycleName) || [];
|
|
2214
|
-
contextNameArray.push({
|
|
2215
|
-
name: contextConf.name,
|
|
2216
|
-
type: storyboardContextWrapper.tplContextId ? "state" : "context",
|
|
2217
|
-
tplContextId: storyboardContextWrapper.tplContextId
|
|
2218
|
-
});
|
|
2219
|
-
storyboardContextWrapper.batchTriggerContextsNamesMap.set(lifecycleName, contextNameArray);
|
|
2220
|
-
} else {
|
|
2221
|
-
// eslint-disable-next-line no-console
|
|
2222
|
-
console.error("unsupported lifecycle: \"".concat(lifecycleName, "\""));
|
|
2223
|
-
}
|
|
2496
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, item), {}, {
|
|
2497
|
+
children: ((_processGroupInject = processGroupInject(item.children || item.items, menu, injectWithMenus, menuWithI18n)) !== null && _processGroupInject !== void 0 ? _processGroupInject : []).concat(foundInjectingMenus ? foundInjectingMenus.flatMap(injectingMenu => processGroupInject(injectingMenu.items, injectingMenu, injectWithMenus, menuWithI18n)) : []),
|
|
2498
|
+
[symbolAppId]: menu.app[0].appId,
|
|
2499
|
+
[symbolMenuI18nNamespace]: menuWithI18n.get(menu),
|
|
2500
|
+
[symbolOverrideApp]: menu.overrideApp
|
|
2501
|
+
});
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
function loadDynamicMenuItems(_x12, _x13, _x14) {
|
|
2505
|
+
return _loadDynamicMenuItems.apply(this, arguments);
|
|
2506
|
+
}
|
|
2507
|
+
function _loadDynamicMenuItems() {
|
|
2508
|
+
_loadDynamicMenuItems = _asyncToGenerator__default["default"](function* (menu, kernel, menuWithI18n) {
|
|
2509
|
+
if (menu.dynamicItems && menu.itemsResolve) {
|
|
2510
|
+
var _menu$itemsResolve;
|
|
2511
|
+
var itemsConf = {};
|
|
2512
|
+
var overrideAppId = menu.app[0].appId;
|
|
2513
|
+
var context = _internalApiGetCurrentContext();
|
|
2514
|
+
var newContext = context;
|
|
2515
|
+
if (overrideAppId !== context.app.id && attemptToVisit(menu.itemsResolve, ["APP", "I18N"])) {
|
|
2516
|
+
if (window.STANDALONE_MICRO_APPS) {
|
|
2517
|
+
if (menu.overrideApp) {
|
|
2518
|
+
menu.overrideApp.config = brickUtils.deepFreeze(_.merge({}, menu.overrideApp.defaultConfig, menu.overrideApp.userConfig));
|
|
2224
2519
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2520
|
+
newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
2521
|
+
overrideApp: menu.overrideApp,
|
|
2522
|
+
appendI18nNamespace: menuWithI18n.get(menu)
|
|
2523
|
+
});
|
|
2524
|
+
} else {
|
|
2525
|
+
var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
|
|
2526
|
+
newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
2527
|
+
overrideApp: storyboard === null || storyboard === void 0 ? void 0 : storyboard.app,
|
|
2528
|
+
appendI18nNamespace: menuWithI18n.get(menu)
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
var usedActions = brickUtils.scanPermissionActionsInAny(menu.itemsResolve);
|
|
2533
|
+
yield validatePermissions(usedActions);
|
|
2534
|
+
yield _internalApiGetResolver().resolveOne("reference", _objectSpread__default["default"]({
|
|
2535
|
+
transform: "items",
|
|
2536
|
+
transformMapArray: false
|
|
2537
|
+
}, menu.itemsResolve), itemsConf, null, newContext);
|
|
2538
|
+
menu.items = itemsConf.items;
|
|
2539
|
+
if ((_menu$itemsResolve = menu.itemsResolve) !== null && _menu$itemsResolve !== void 0 && _menu$itemsResolve.args) {
|
|
2540
|
+
var _menu$itemsResolve2;
|
|
2541
|
+
return !attemptToVisit((_menu$itemsResolve2 = menu.itemsResolve) === null || _menu$itemsResolve2 === void 0 ? void 0 : _menu$itemsResolve2.args, ["QUERY", "PATH"]);
|
|
2234
2542
|
}
|
|
2235
2543
|
}
|
|
2236
|
-
resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, load, resolvePolicy === "eager", loading, resolvePolicy === "async", useResolve, trackConditionalResolve);
|
|
2237
2544
|
return true;
|
|
2238
2545
|
});
|
|
2239
|
-
return
|
|
2546
|
+
return _loadDynamicMenuItems.apply(this, arguments);
|
|
2240
2547
|
}
|
|
2241
|
-
function
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2548
|
+
function walkMenuItems(menuItems) {
|
|
2549
|
+
return menuItems === null || menuItems === void 0 ? void 0 : menuItems.filter(
|
|
2550
|
+
// `if` is already evaluated.
|
|
2551
|
+
looseCheckIfOfComputed).map(item => {
|
|
2552
|
+
var children = walkMenuItems(item.children || item.items);
|
|
2553
|
+
return item.type === "group" ? {
|
|
2554
|
+
type: "group",
|
|
2555
|
+
childLayout: item.childLayout,
|
|
2556
|
+
title: item.text || item.title,
|
|
2557
|
+
items: children,
|
|
2558
|
+
groupId: item.groupId,
|
|
2559
|
+
groupFrom: item.groupFrom
|
|
2560
|
+
} : children !== null && children !== void 0 && children.length ? {
|
|
2561
|
+
type: "subMenu",
|
|
2562
|
+
childLayout: item.childLayout,
|
|
2563
|
+
title: item.text || item.title,
|
|
2564
|
+
icon: item.icon,
|
|
2565
|
+
items: children,
|
|
2566
|
+
defaultExpanded: item.defaultExpanded
|
|
2567
|
+
} : item;
|
|
2568
|
+
});
|
|
2254
2569
|
}
|
|
2255
|
-
function
|
|
2256
|
-
|
|
2257
|
-
return brick.properties[contextConf.name];
|
|
2258
|
-
}
|
|
2570
|
+
function processMenu(_x15, _x16, _x17, _x18, _x19) {
|
|
2571
|
+
return _processMenu.apply(this, arguments);
|
|
2259
2572
|
}
|
|
2260
|
-
function
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
if (contextConf.onChange) {
|
|
2275
|
-
for (var handler of [].concat(contextConf.onChange)) {
|
|
2276
|
-
newContext.eventTarget.addEventListener(eventName, listenerFactory(handler, mergedContext, brick));
|
|
2573
|
+
function _processMenu() {
|
|
2574
|
+
_processMenu = _asyncToGenerator__default["default"](function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
|
|
2575
|
+
var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel, isPreFetch),
|
|
2576
|
+
{
|
|
2577
|
+
items,
|
|
2578
|
+
app
|
|
2579
|
+
} = _yield$fetchMenuById,
|
|
2580
|
+
restMenuData = _objectWithoutProperties__default["default"](_yield$fetchMenuById, _excluded3);
|
|
2581
|
+
var usedActions = brickUtils.scanPermissionActionsInAny([items, restMenuData]);
|
|
2582
|
+
yield validatePermissions(usedActions);
|
|
2583
|
+
var appsRequireI18nFulfilled = new Set();
|
|
2584
|
+
var rootAppId = app[0].appId;
|
|
2585
|
+
if (rootAppId !== context.app.id && !restMenuData[symbolMenuI18nNamespace]) {
|
|
2586
|
+
appsRequireI18nFulfilled.add(rootAppId);
|
|
2277
2587
|
}
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2588
|
+
collectAppsRequireI18nFulfilled(items, context.app.id, appsRequireI18nFulfilled);
|
|
2589
|
+
yield kernel.fulfilStoryboardI18n([...appsRequireI18nFulfilled]);
|
|
2590
|
+
var menuData = _objectSpread__default["default"](_objectSpread__default["default"]({}, yield computeRealValueWithOverrideApp(restMenuData, rootAppId, context, kernel)), {}, {
|
|
2591
|
+
items: yield computeMenuItemsWithOverrideApp(items, context, kernel)
|
|
2592
|
+
});
|
|
2593
|
+
return {
|
|
2594
|
+
title: yield processMenuTitle(menuData),
|
|
2595
|
+
icon: menuData.icon,
|
|
2596
|
+
link: menuData.link,
|
|
2597
|
+
menuItems: walkMenuItems(menuData.items),
|
|
2598
|
+
defaultCollapsed: menuData.defaultCollapsed || hasSubMenu,
|
|
2599
|
+
defaultCollapsedBreakpoint: menuData.defaultCollapsedBreakpoint
|
|
2600
|
+
};
|
|
2281
2601
|
});
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
}, "refresh");
|
|
2297
|
-
} else {
|
|
2298
|
-
storyboardContextWrapper.updateValue(contextConf.name, computeRealValue(contextConf.value, mergedContext, true), "replace");
|
|
2299
|
-
}
|
|
2300
|
-
}, contextConf, storyboardContextWrapper));
|
|
2602
|
+
return _processMenu.apply(this, arguments);
|
|
2603
|
+
}
|
|
2604
|
+
function collectAppsRequireI18nFulfilled(items, contextAppId, appIds) {
|
|
2605
|
+
function collect(items) {
|
|
2606
|
+
for (var _ref of items) {
|
|
2607
|
+
var {
|
|
2608
|
+
children
|
|
2609
|
+
} = _ref,
|
|
2610
|
+
rest = _objectWithoutProperties__default["default"](_ref, _excluded$8);
|
|
2611
|
+
var overrideAppId = rest[symbolAppId];
|
|
2612
|
+
if (!rest[symbolMenuI18nNamespace] && overrideAppId !== contextAppId && !appIds.has(overrideAppId) && attemptToVisit(rest, ["I18N"])) {
|
|
2613
|
+
appIds.add(overrideAppId);
|
|
2614
|
+
}
|
|
2615
|
+
children && collect(children);
|
|
2301
2616
|
}
|
|
2302
2617
|
}
|
|
2303
|
-
|
|
2618
|
+
collect(items);
|
|
2304
2619
|
}
|
|
2305
|
-
function
|
|
2306
|
-
return
|
|
2307
|
-
|
|
2308
|
-
|
|
2620
|
+
function computeMenuItemsWithOverrideApp(items, context, kernel) {
|
|
2621
|
+
return Promise.all(items.map( /*#__PURE__*/function () {
|
|
2622
|
+
var _ref3 = _asyncToGenerator__default["default"](function* (_ref2) {
|
|
2623
|
+
var {
|
|
2624
|
+
children
|
|
2625
|
+
} = _ref2,
|
|
2626
|
+
rest = _objectWithoutProperties__default["default"](_ref2, _excluded2$2);
|
|
2627
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, yield computeRealValueWithOverrideApp(rest, rest[symbolAppId], context, kernel)), {}, {
|
|
2628
|
+
children: children && (yield computeMenuItemsWithOverrideApp(children, context, kernel))
|
|
2629
|
+
});
|
|
2630
|
+
});
|
|
2631
|
+
return function (_x20) {
|
|
2632
|
+
return _ref3.apply(this, arguments);
|
|
2633
|
+
};
|
|
2634
|
+
}()));
|
|
2635
|
+
}
|
|
2636
|
+
function processMenuTitle(_x21) {
|
|
2637
|
+
return _processMenuTitle.apply(this, arguments);
|
|
2638
|
+
}
|
|
2639
|
+
function _processMenuTitle() {
|
|
2640
|
+
_processMenuTitle = _asyncToGenerator__default["default"](function* (menuData) {
|
|
2641
|
+
if (menuData.title || _.isEmpty(menuData.titleDataSource)) {
|
|
2642
|
+
return menuData.title;
|
|
2309
2643
|
}
|
|
2310
|
-
|
|
2311
|
-
|
|
2644
|
+
var cacheKey = JSON.stringify(menuData.titleDataSource);
|
|
2645
|
+
if (menuTitleCache.has(cacheKey)) {
|
|
2646
|
+
return menuTitleCache.get(cacheKey);
|
|
2647
|
+
}
|
|
2648
|
+
var {
|
|
2649
|
+
objectId,
|
|
2650
|
+
instanceId,
|
|
2651
|
+
attributeId
|
|
2652
|
+
} = menuData.titleDataSource;
|
|
2653
|
+
var attr = attributeId !== null && attributeId !== void 0 ? attributeId : "name";
|
|
2654
|
+
var instanceData = yield InstanceApi_getDetail(objectId, instanceId, {
|
|
2655
|
+
fields: attr
|
|
2656
|
+
});
|
|
2657
|
+
var title;
|
|
2658
|
+
if (attributeId === "#showKey" && Array.isArray(instanceData[attr])) {
|
|
2659
|
+
var [primary, ...rest] = instanceData[attr];
|
|
2660
|
+
title = rest.length > 0 ? "".concat(primary, "(").concat(rest.join(","), ")") : String(primary);
|
|
2661
|
+
} else {
|
|
2662
|
+
title = String(instanceData[attr]);
|
|
2663
|
+
}
|
|
2664
|
+
menuTitleCache.set(cacheKey, title);
|
|
2665
|
+
return title;
|
|
2666
|
+
});
|
|
2667
|
+
return _processMenuTitle.apply(this, arguments);
|
|
2668
|
+
}
|
|
2669
|
+
function clearMenuTitleCache() {
|
|
2670
|
+
menuTitleCache.clear();
|
|
2671
|
+
}
|
|
2672
|
+
function clearMenuCache() {
|
|
2673
|
+
menuCache.clear();
|
|
2674
|
+
}
|
|
2675
|
+
function reorderMenu(menuData) {
|
|
2676
|
+
menuData.items = reorderMenuItems(menuData.items);
|
|
2677
|
+
}
|
|
2678
|
+
function reorderMenuItems(list) {
|
|
2679
|
+
return sortMenuItems(list).map(item => _objectSpread__default["default"](_objectSpread__default["default"]({}, item), {}, {
|
|
2680
|
+
children: reorderMenuItems(item.children)
|
|
2681
|
+
}));
|
|
2682
|
+
}
|
|
2683
|
+
function sortMenuItems(list) {
|
|
2684
|
+
return _.sortBy(list, item => {
|
|
2685
|
+
var _item$sort;
|
|
2686
|
+
return (_item$sort = item.sort) !== null && _item$sort !== void 0 ? _item$sort : -Infinity;
|
|
2687
|
+
});
|
|
2312
2688
|
}
|
|
2313
2689
|
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
var {
|
|
2331
|
-
element
|
|
2332
|
-
} = this.brick;
|
|
2333
|
-
if (element) {
|
|
2334
|
-
return Object.fromEntries(Object.keys(this.variables).map(prop => [prop, element[prop]]));
|
|
2690
|
+
/**
|
|
2691
|
+
* If the menu contains evaluations which use `APP` or `I18N`,
|
|
2692
|
+
* we have to override app in context when computing real values.
|
|
2693
|
+
*/
|
|
2694
|
+
function attemptToVisit(data, globals) {
|
|
2695
|
+
var memo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new WeakSet();
|
|
2696
|
+
if (typeof data === "string") {
|
|
2697
|
+
if (brickUtils.isEvaluable(data)) {
|
|
2698
|
+
if (globals.some(key => data.includes(key))) {
|
|
2699
|
+
var {
|
|
2700
|
+
attemptToVisitGlobals
|
|
2701
|
+
} = brickUtils.preevaluate(data);
|
|
2702
|
+
return globals.some(key => attemptToVisitGlobals.has(key));
|
|
2703
|
+
}
|
|
2704
|
+
} else if (globals.includes("APP")) {
|
|
2705
|
+
return /\${\s*APP\s*\./.test(data);
|
|
2335
2706
|
}
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2707
|
+
} else if (brickUtils.isObject(data)) {
|
|
2708
|
+
// Avoid call stack overflow.
|
|
2709
|
+
// istanbul ignore next
|
|
2710
|
+
if (memo.has(data)) {
|
|
2711
|
+
return false;
|
|
2712
|
+
}
|
|
2713
|
+
memo.add(data);
|
|
2714
|
+
return (Array.isArray(data) ? data : Object.values(data)).some(item => attemptToVisit(item, globals, memo));
|
|
2340
2715
|
}
|
|
2716
|
+
return false;
|
|
2341
2717
|
}
|
|
2342
|
-
function
|
|
2343
|
-
return
|
|
2718
|
+
function computeRealValueWithOverrideApp(_x22, _x23, _x24, _x25) {
|
|
2719
|
+
return _computeRealValueWithOverrideApp.apply(this, arguments);
|
|
2344
2720
|
}
|
|
2345
|
-
function
|
|
2346
|
-
|
|
2721
|
+
function _computeRealValueWithOverrideApp() {
|
|
2722
|
+
_computeRealValueWithOverrideApp = _asyncToGenerator__default["default"](function* (data, overrideAppId, context, kernel) {
|
|
2723
|
+
if ("titleDataSource" in data && brickUtils.isObject(data.titleDataSource) && Object.entries(data.titleDataSource).every(_ref7 => {
|
|
2724
|
+
var [key, value] = _ref7;
|
|
2725
|
+
return value === null || value === "";
|
|
2726
|
+
})) {
|
|
2727
|
+
delete data.titleDataSource;
|
|
2728
|
+
}
|
|
2729
|
+
if ("if" in data && data.if === null) {
|
|
2730
|
+
delete data.if;
|
|
2731
|
+
}
|
|
2732
|
+
if ("to" in data && data.to && !brickUtils.isEvaluable(data.to)) {
|
|
2733
|
+
var yaml = pipes.pipes.yaml(data.to);
|
|
2734
|
+
if (brickUtils.isObject(yaml) && ["pathname", "search", "hash"].some(key => brickUtils.hasOwnProperty(yaml, key))) {
|
|
2735
|
+
data.to = yaml;
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
var newContext = context;
|
|
2739
|
+
if (overrideAppId !== context.app.id && attemptToVisit(data, ["APP", "I18N", "IMG"])) {
|
|
2740
|
+
if (window.STANDALONE_MICRO_APPS) {
|
|
2741
|
+
if (data[symbolOverrideApp]) {
|
|
2742
|
+
data[symbolOverrideApp].config = brickUtils.deepFreeze(_.merge({}, data[symbolOverrideApp].defaultConfig, data[symbolOverrideApp].userConfig));
|
|
2743
|
+
}
|
|
2744
|
+
newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
2745
|
+
overrideApp: data[symbolOverrideApp],
|
|
2746
|
+
appendI18nNamespace: data[symbolMenuI18nNamespace]
|
|
2747
|
+
});
|
|
2748
|
+
} else {
|
|
2749
|
+
var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
|
|
2750
|
+
newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
2751
|
+
overrideApp: storyboard === null || storyboard === void 0 ? void 0 : storyboard.app,
|
|
2752
|
+
appendI18nNamespace: data[symbolMenuI18nNamespace]
|
|
2753
|
+
});
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
var processors = brickUtils.scanProcessorsInAny(data);
|
|
2757
|
+
yield kernel.loadDynamicBricks([], processors);
|
|
2758
|
+
yield kernel.router.waitForUsedContext(data);
|
|
2759
|
+
return computeRealValue(data, newContext, true, {
|
|
2760
|
+
ignoreSymbols: true
|
|
2761
|
+
});
|
|
2762
|
+
});
|
|
2763
|
+
return _computeRealValueWithOverrideApp.apply(this, arguments);
|
|
2347
2764
|
}
|
|
2348
2765
|
|
|
2349
2766
|
var MediaBreakpoint;
|
|
@@ -2441,1027 +2858,610 @@
|
|
|
2441
2858
|
return;
|
|
2442
2859
|
}
|
|
2443
2860
|
if (typeof raw !== "string") {
|
|
2444
|
-
// If the `raw` is not a string, it must be a pre-evaluated object.
|
|
2445
|
-
// Then fulfil the context, and restore the original `raw`.
|
|
2446
|
-
runtimeContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, raw[symbolForContext]), runtimeContext);
|
|
2447
|
-
raw = raw[symbolForRaw];
|
|
2448
|
-
}
|
|
2449
|
-
|
|
2450
|
-
// A `SyntaxError` maybe thrown.
|
|
2451
|
-
var precooked;
|
|
2452
|
-
try {
|
|
2453
|
-
precooked = brickUtils.preevaluate(raw);
|
|
2454
|
-
} catch (error) {
|
|
2455
|
-
var message = "".concat(error.message, ", in \"").concat(raw, "\"");
|
|
2456
|
-
if (options.isReEvaluation) {
|
|
2457
|
-
devtoolsHookEmit("re-evaluation", {
|
|
2458
|
-
id: options.evaluationId,
|
|
2459
|
-
detail: {
|
|
2460
|
-
raw,
|
|
2461
|
-
context: {}
|
|
2462
|
-
},
|
|
2463
|
-
error: message
|
|
2464
|
-
});
|
|
2465
|
-
return;
|
|
2466
|
-
} else {
|
|
2467
|
-
var errorConstructor = getCookErrorConstructor(error);
|
|
2468
|
-
throw new errorConstructor(message);
|
|
2469
|
-
}
|
|
2470
|
-
}
|
|
2471
|
-
var globalVariables = {};
|
|
2472
|
-
var attemptToVisitGlobals = precooked.attemptToVisitGlobals;
|
|
2473
|
-
var attemptToVisitEvent = attemptToVisitGlobals.has("EVENT");
|
|
2474
|
-
var attemptToVisitData = attemptToVisitGlobals.has("DATA");
|
|
2475
|
-
var attemptToVisitTpl = attemptToVisitGlobals.has("TPL");
|
|
2476
|
-
var attemptToVisitState = attemptToVisitGlobals.has("STATE");
|
|
2477
|
-
var attemptToVisitFormState = attemptToVisitGlobals.has("FORM_STATE");
|
|
2478
|
-
var attemptToVisitTplOrState = attemptToVisitTpl || attemptToVisitState;
|
|
2479
|
-
|
|
2480
|
-
// Ignore evaluating if `event` is missing in context.
|
|
2481
|
-
// Since it should be evaluated during events handling.
|
|
2482
|
-
var missingEvent = options.lazy === true;
|
|
2483
|
-
if (attemptToVisitEvent) {
|
|
2484
|
-
if (brickUtils.hasOwnProperty(runtimeContext, "event")) {
|
|
2485
|
-
globalVariables.EVENT = runtimeContext.event;
|
|
2486
|
-
} else {
|
|
2487
|
-
// Let's see if pre-evaluation is required (store the `data` in context).
|
|
2488
|
-
missingEvent = true;
|
|
2489
|
-
}
|
|
2490
|
-
}
|
|
2491
|
-
var missingTplOrState = attemptToVisitTplOrState && !brickUtils.hasOwnProperty(runtimeContext, "tplContextId");
|
|
2492
|
-
var missingData = attemptToVisitData && !brickUtils.hasOwnProperty(runtimeContext, "data");
|
|
2493
|
-
var rawWithContext = Object.keys(runtimeContext).length > 0 ? {
|
|
2494
|
-
[symbolForRaw]: raw,
|
|
2495
|
-
[symbolForContext]: runtimeContext
|
|
2496
|
-
} : raw;
|
|
2497
|
-
|
|
2498
|
-
// Since `EVENT`, `DATA`, `TPL` and `STATE` are provided in different context,
|
|
2499
|
-
// whenever missing one of them, memorize the current context for later consuming.
|
|
2500
|
-
if (missingEvent || missingData || missingTplOrState) {
|
|
2501
|
-
return rawWithContext;
|
|
2502
|
-
}
|
|
2503
|
-
if (attemptToVisitData) {
|
|
2504
|
-
globalVariables.DATA = runtimeContext.data;
|
|
2505
|
-
}
|
|
2506
|
-
if (attemptToVisitTplOrState && runtimeContext.tplContextId) {
|
|
2507
|
-
var tplContext = getCustomTemplateContext(runtimeContext.tplContextId);
|
|
2508
|
-
if (attemptToVisitTpl) {
|
|
2509
|
-
globalVariables.TPL = tplContext.getVariables();
|
|
2510
|
-
}
|
|
2511
|
-
if (attemptToVisitState) {
|
|
2512
|
-
globalVariables.STATE = getDynamicReadOnlyProxy({
|
|
2513
|
-
get(target, key) {
|
|
2514
|
-
return tplContext.state.getValue(key);
|
|
2515
|
-
},
|
|
2516
|
-
ownKeys() {
|
|
2517
|
-
return Array.from(tplContext.state.get().keys());
|
|
2518
|
-
}
|
|
2519
|
-
});
|
|
2520
|
-
}
|
|
2521
|
-
}
|
|
2522
|
-
if (attemptToVisitFormState && runtimeContext.formContextId) {
|
|
2523
|
-
var formContext = getCustomFormContext(runtimeContext.formContextId);
|
|
2524
|
-
globalVariables.FORM_STATE = getDynamicReadOnlyProxy({
|
|
2525
|
-
get(target, key) {
|
|
2526
|
-
return formContext.formState.getValue(key);
|
|
2527
|
-
},
|
|
2528
|
-
ownKeys() {
|
|
2529
|
-
return Array.from(formContext.formState.get().keys());
|
|
2530
|
-
}
|
|
2531
|
-
});
|
|
2532
|
-
}
|
|
2533
|
-
var internalContext = _internalApiGetCurrentContext();
|
|
2534
|
-
var mergedContext = {};
|
|
2535
|
-
|
|
2536
|
-
// Use runtime context over internal context.
|
|
2537
|
-
// Internal context such as `match`, maybe change after `history.push`.
|
|
2538
|
-
// So we prefer memoized runtime context.
|
|
2539
|
-
for (var key of ["query", "match", "hash", "pathname", "app", "segues"]) {
|
|
2540
|
-
mergedContext[key] = (brickUtils.hasOwnProperty(runtimeContext, key) ? runtimeContext : internalContext)[key];
|
|
2541
|
-
}
|
|
2542
|
-
var {
|
|
2543
|
-
app: currentApp,
|
|
2544
|
-
query,
|
|
2545
|
-
match,
|
|
2546
|
-
hash,
|
|
2547
|
-
pathname,
|
|
2548
|
-
segues
|
|
2549
|
-
} = mergedContext;
|
|
2550
|
-
var {
|
|
2551
|
-
sys,
|
|
2552
|
-
flags,
|
|
2553
|
-
storyboardContext
|
|
2554
|
-
} = internalContext;
|
|
2555
|
-
var app = (_runtimeContext$overr = runtimeContext.overrideApp) !== null && _runtimeContext$overr !== void 0 ? _runtimeContext$overr : currentApp;
|
|
2556
|
-
function getIndividualGlobal(variableName) {
|
|
2557
|
-
switch (variableName) {
|
|
2558
|
-
case "ALIAS":
|
|
2559
|
-
return {
|
|
2560
|
-
getUrl: getUrlByAliasFactory(app)
|
|
2561
|
-
};
|
|
2562
|
-
case "ANCHOR":
|
|
2563
|
-
return hash ? hash.substr(1) : null;
|
|
2564
|
-
case "APP":
|
|
2565
|
-
return _objectSpread__default["default"](_objectSpread__default["default"]({}, _.cloneDeep(app)), {}, {
|
|
2566
|
-
getMenu
|
|
2567
|
-
});
|
|
2568
|
-
case "CTX":
|
|
2569
|
-
return getDynamicReadOnlyProxy({
|
|
2570
|
-
get(target, key) {
|
|
2571
|
-
var _item$brick$element;
|
|
2572
|
-
var item = storyboardContext.get(key);
|
|
2573
|
-
return !item ? item : item.type === "brick-property" ? (_item$brick$element = item.brick.element) === null || _item$brick$element === void 0 ? void 0 : _item$brick$element[item.prop] : item.value;
|
|
2574
|
-
},
|
|
2575
|
-
ownKeys() {
|
|
2576
|
-
return Array.from(storyboardContext.keys());
|
|
2577
|
-
}
|
|
2578
|
-
});
|
|
2579
|
-
case "FLAGS":
|
|
2580
|
-
return getReadOnlyProxy(flags);
|
|
2581
|
-
case "HASH":
|
|
2582
|
-
return hash;
|
|
2583
|
-
case "PATH_NAME":
|
|
2584
|
-
return pathname;
|
|
2585
|
-
case "INSTALLED_APPS":
|
|
2586
|
-
return {
|
|
2587
|
-
has: (appId, matchVersion) => getRuntime().hasInstalledApp(appId, matchVersion)
|
|
2588
|
-
};
|
|
2589
|
-
case "LOCAL_STORAGE":
|
|
2590
|
-
return {
|
|
2591
|
-
getItem: getItemFactory("local")
|
|
2592
|
-
};
|
|
2593
|
-
case "MISC":
|
|
2594
|
-
return getRuntime().getMiscSettings();
|
|
2595
|
-
case "PARAMS":
|
|
2596
|
-
return new URLSearchParams(query);
|
|
2597
|
-
case "PATH":
|
|
2598
|
-
return getReadOnlyProxy(match.params);
|
|
2599
|
-
case "PROCESSORS":
|
|
2600
|
-
return getDynamicReadOnlyProxy({
|
|
2601
|
-
get(target, key) {
|
|
2602
|
-
var pkg = customProcessorRegistry.get(key);
|
|
2603
|
-
if (!pkg) {
|
|
2604
|
-
throw new Error("'PROCESSORS.".concat(key, "' is not registered! Have you installed the relevant brick package of '").concat(key.replace(/[A-Z]/g, m => "-".concat(m.toLowerCase())), "-NB'?"));
|
|
2605
|
-
}
|
|
2606
|
-
return getDynamicReadOnlyProxy({
|
|
2607
|
-
get(t, k) {
|
|
2608
|
-
return pkg.get(k);
|
|
2609
|
-
},
|
|
2610
|
-
ownKeys() {
|
|
2611
|
-
return Array.from(pkg.keys());
|
|
2612
|
-
}
|
|
2613
|
-
});
|
|
2614
|
-
},
|
|
2615
|
-
ownKeys() {
|
|
2616
|
-
return Array.from(customProcessorRegistry.keys());
|
|
2617
|
-
}
|
|
2618
|
-
});
|
|
2619
|
-
case "QUERY":
|
|
2620
|
-
return Object.fromEntries(Array.from(query.keys()).map(key => [key, query.get(key)]));
|
|
2621
|
-
case "QUERY_ARRAY":
|
|
2622
|
-
return Object.fromEntries(Array.from(query.keys()).map(key => [key, query.getAll(key)]));
|
|
2623
|
-
case "SEGUE":
|
|
2624
|
-
return {
|
|
2625
|
-
getUrl: getUrlBySegueFactory(app, segues)
|
|
2626
|
-
};
|
|
2627
|
-
case "SESSION_STORAGE":
|
|
2628
|
-
return {
|
|
2629
|
-
getItem: getItemFactory("session")
|
|
2630
|
-
};
|
|
2631
|
-
case "SYS":
|
|
2632
|
-
return getReadOnlyProxy(sys);
|
|
2633
|
-
case "MEDIA":
|
|
2634
|
-
return getReadOnlyProxy(getMedia());
|
|
2635
|
-
case "__WIDGET_FN__":
|
|
2636
|
-
return widgetFunctions;
|
|
2637
|
-
case "__WIDGET_IMG__":
|
|
2638
|
-
return widgetImagesFactory;
|
|
2639
|
-
case "__WIDGET_I18N__":
|
|
2640
|
-
return widgetI18nFactory;
|
|
2641
|
-
}
|
|
2642
|
-
}
|
|
2643
|
-
for (var variableName of attemptToVisitGlobals) {
|
|
2644
|
-
var variable = getIndividualGlobal(variableName);
|
|
2645
|
-
if (variable !== undefined) {
|
|
2646
|
-
globalVariables[variableName] = variable;
|
|
2647
|
-
}
|
|
2861
|
+
// If the `raw` is not a string, it must be a pre-evaluated object.
|
|
2862
|
+
// Then fulfil the context, and restore the original `raw`.
|
|
2863
|
+
runtimeContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, raw[symbolForContext]), runtimeContext);
|
|
2864
|
+
raw = raw[symbolForRaw];
|
|
2648
2865
|
}
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
appendI18nNamespace: runtimeContext.appendI18nNamespace
|
|
2653
|
-
}));
|
|
2866
|
+
|
|
2867
|
+
// A `SyntaxError` maybe thrown.
|
|
2868
|
+
var precooked;
|
|
2654
2869
|
try {
|
|
2655
|
-
|
|
2656
|
-
globalVariables: supply(precooked.attemptToVisitGlobals, globalVariables)
|
|
2657
|
-
});
|
|
2658
|
-
var detail = {
|
|
2659
|
-
raw,
|
|
2660
|
-
context: globalVariables,
|
|
2661
|
-
result
|
|
2662
|
-
};
|
|
2663
|
-
if (options.isReEvaluation) {
|
|
2664
|
-
devtoolsHookEmit("re-evaluation", {
|
|
2665
|
-
id: options.evaluationId,
|
|
2666
|
-
detail
|
|
2667
|
-
});
|
|
2668
|
-
} else {
|
|
2669
|
-
devtoolsHookEmit("evaluation", detail);
|
|
2670
|
-
}
|
|
2671
|
-
return result;
|
|
2870
|
+
precooked = brickUtils.preevaluate(raw);
|
|
2672
2871
|
} catch (error) {
|
|
2673
|
-
var
|
|
2872
|
+
var message = "".concat(error.message, ", in \"").concat(raw, "\"");
|
|
2674
2873
|
if (options.isReEvaluation) {
|
|
2675
2874
|
devtoolsHookEmit("re-evaluation", {
|
|
2676
2875
|
id: options.evaluationId,
|
|
2677
2876
|
detail: {
|
|
2678
2877
|
raw,
|
|
2679
|
-
context:
|
|
2878
|
+
context: {}
|
|
2680
2879
|
},
|
|
2681
|
-
error:
|
|
2880
|
+
error: message
|
|
2682
2881
|
});
|
|
2882
|
+
return;
|
|
2683
2883
|
} else {
|
|
2684
|
-
var
|
|
2685
|
-
throw new
|
|
2884
|
+
var errorConstructor = getCookErrorConstructor(error);
|
|
2885
|
+
throw new errorConstructor(message);
|
|
2686
2886
|
}
|
|
2687
2887
|
}
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
function isMergeableProperty(propRef) {
|
|
2697
|
-
return !!propRef.mergeProperty;
|
|
2698
|
-
}
|
|
2699
|
-
function isRefProperty(propRef) {
|
|
2700
|
-
return !!propRef.ref;
|
|
2701
|
-
}
|
|
2702
|
-
function isVariableProperty(propRef) {
|
|
2703
|
-
return !!propRef.asVariable;
|
|
2704
|
-
}
|
|
2705
|
-
|
|
2706
|
-
var customTemplateRegistry = new Map();
|
|
2707
|
-
var appRegistered = new Set();
|
|
2708
|
-
var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
|
|
2709
|
-
var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
|
|
2710
|
-
var symbolForTplContextId = Symbol.for("tpl.contextId");
|
|
2888
|
+
var globalVariables = {};
|
|
2889
|
+
var attemptToVisitGlobals = precooked.attemptToVisitGlobals;
|
|
2890
|
+
var attemptToVisitEvent = attemptToVisitGlobals.has("EVENT");
|
|
2891
|
+
var attemptToVisitData = attemptToVisitGlobals.has("DATA");
|
|
2892
|
+
var attemptToVisitTpl = attemptToVisitGlobals.has("TPL");
|
|
2893
|
+
var attemptToVisitState = attemptToVisitGlobals.has("STATE");
|
|
2894
|
+
var attemptToVisitFormState = attemptToVisitGlobals.has("FORM_STATE");
|
|
2895
|
+
var attemptToVisitTplOrState = attemptToVisitTpl || attemptToVisitState;
|
|
2711
2896
|
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
}
|
|
2722
|
-
// istanbul ignore next: should never reach
|
|
2723
|
-
throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
|
|
2724
|
-
}
|
|
2725
|
-
function propertyMergeAllOfArray(_ref, object) {
|
|
2726
|
-
var _$1, _proxy$mergeArgs;
|
|
2727
|
-
var {
|
|
2728
|
-
baseValue,
|
|
2729
|
-
context,
|
|
2730
|
-
proxies
|
|
2731
|
-
} = _ref;
|
|
2732
|
-
// Use an approach like template-literal's quasis:
|
|
2733
|
-
// `quasi0${0}quais1${1}quasi2...`
|
|
2734
|
-
// Every quasi can be merged with multiple items.
|
|
2735
|
-
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
|
|
2736
|
-
$$lazyForUseBrick: true
|
|
2737
|
-
}) : [];
|
|
2738
|
-
var quasis = [];
|
|
2739
|
-
var size = computedBaseValue.length + 1;
|
|
2740
|
-
for (var i = 0; i < size; i += 1) {
|
|
2741
|
-
quasis.push([]);
|
|
2742
|
-
}
|
|
2743
|
-
for (var proxy of proxies) {
|
|
2744
|
-
var position = void 0;
|
|
2745
|
-
switch (proxy.mergeMethod) {
|
|
2746
|
-
case "append":
|
|
2747
|
-
position = computedBaseValue.length;
|
|
2748
|
-
break;
|
|
2749
|
-
case "prepend":
|
|
2750
|
-
position = 0;
|
|
2751
|
-
break;
|
|
2752
|
-
case "insertAt":
|
|
2753
|
-
// Defaults to `-1`.
|
|
2754
|
-
position = (_$1 = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _$1 !== void 0 ? _$1 : -1;
|
|
2755
|
-
if (position < 0) {
|
|
2756
|
-
// It's counted from the end if position is negative.
|
|
2757
|
-
position += quasis.length;
|
|
2758
|
-
}
|
|
2759
|
-
position = _.clamp(position, 0, computedBaseValue.length);
|
|
2760
|
-
break;
|
|
2761
|
-
// istanbul ignore next: should never reach
|
|
2762
|
-
default:
|
|
2763
|
-
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
2764
|
-
}
|
|
2765
|
-
var patchValue = object[proxy.$$reversedRef];
|
|
2766
|
-
if (!Array.isArray(patchValue)) {
|
|
2767
|
-
patchValue = [];
|
|
2897
|
+
// Ignore evaluating if `event` is missing in context.
|
|
2898
|
+
// Since it should be evaluated during events handling.
|
|
2899
|
+
var missingEvent = options.lazy === true;
|
|
2900
|
+
if (attemptToVisitEvent) {
|
|
2901
|
+
if (brickUtils.hasOwnProperty(runtimeContext, "event")) {
|
|
2902
|
+
globalVariables.EVENT = runtimeContext.event;
|
|
2903
|
+
} else {
|
|
2904
|
+
// Let's see if pre-evaluation is required (store the `data` in context).
|
|
2905
|
+
missingEvent = true;
|
|
2768
2906
|
}
|
|
2769
|
-
quasis[position].push(...patchValue);
|
|
2770
2907
|
}
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
context
|
|
2778
|
-
} = _ref2;
|
|
2779
|
-
var computedBaseValue = brickUtils.isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
|
|
2780
|
-
return proxies.reduce((acc, proxy) => {
|
|
2781
|
-
switch (proxy.mergeMethod) {
|
|
2782
|
-
case "extend":
|
|
2783
|
-
return _objectSpread__default["default"](_objectSpread__default["default"]({}, acc), object[proxy.$$reversedRef]);
|
|
2784
|
-
// istanbul ignore next: should never reach
|
|
2785
|
-
default:
|
|
2786
|
-
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
2787
|
-
}
|
|
2788
|
-
}, computedBaseValue);
|
|
2789
|
-
}
|
|
2790
|
-
|
|
2791
|
-
function setupTemplateProxy(proxyContext, ref, slots) {
|
|
2792
|
-
var computedPropsFromProxy = {};
|
|
2793
|
-
var refForProxy;
|
|
2794
|
-
var {
|
|
2795
|
-
reversedProxies,
|
|
2796
|
-
templateProperties,
|
|
2797
|
-
externalSlots,
|
|
2798
|
-
templateContextId,
|
|
2799
|
-
proxyBrick
|
|
2800
|
-
} = proxyContext;
|
|
2801
|
-
if (ref && reversedProxies) {
|
|
2802
|
-
refForProxy = {};
|
|
2803
|
-
proxyBrick.proxyRefs.set(ref, refForProxy);
|
|
2804
|
-
|
|
2805
|
-
// Reversed proxies are used for expand storyboard before rendering page.
|
|
2806
|
-
if (reversedProxies.properties.has(ref)) {
|
|
2807
|
-
Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(propRef => {
|
|
2808
|
-
// `propValue` is computed.
|
|
2809
|
-
var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[propRef.$$reversedRef];
|
|
2810
|
-
if (isTransformableProperty(propRef)) {
|
|
2811
|
-
return Object.entries(preprocessTransformProperties({
|
|
2812
|
-
[propRef.$$reversedRef]: propValue
|
|
2813
|
-
}, propRef.refTransform));
|
|
2814
|
-
}
|
|
2815
|
-
if (isBasicProperty(propRef)) {
|
|
2816
|
-
return [[propRef.refProperty, propValue]];
|
|
2817
|
-
}
|
|
2818
|
-
// Ignore Variable properties.
|
|
2819
|
-
// And mergeable properties are processed later.
|
|
2820
|
-
return [];
|
|
2821
|
-
}).filter(propRef => propRef[1] !== undefined)));
|
|
2822
|
-
|
|
2823
|
-
// Brick properties can be merged multiple times.
|
|
2824
|
-
if (reversedProxies.mergeBases.has(ref)) {
|
|
2825
|
-
Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref => {
|
|
2826
|
-
var [mergeProperty, mergeBase] = _ref;
|
|
2827
|
-
return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
|
|
2828
|
-
}).filter(item => item[1] !== undefined)));
|
|
2829
|
-
}
|
|
2830
|
-
}
|
|
2908
|
+
var missingTplOrState = attemptToVisitTplOrState && !brickUtils.hasOwnProperty(runtimeContext, "tplContextId");
|
|
2909
|
+
var missingData = attemptToVisitData && !brickUtils.hasOwnProperty(runtimeContext, "data");
|
|
2910
|
+
var rawWithContext = Object.keys(runtimeContext).length > 0 ? {
|
|
2911
|
+
[symbolForRaw]: raw,
|
|
2912
|
+
[symbolForContext]: runtimeContext
|
|
2913
|
+
} : raw;
|
|
2831
2914
|
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
if (reversedProxies.slots.has(ref)) {
|
|
2837
|
-
for (var item of reversedProxies.slots.get(ref)) {
|
|
2838
|
-
var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
|
|
2839
|
-
if (!quasisMap.has(item.refSlot)) {
|
|
2840
|
-
var quasis = [];
|
|
2841
|
-
// The size of quasis should be the existed slotted bricks' size plus one.
|
|
2842
|
-
var size = brickUtils.hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
|
|
2843
|
-
for (var i = 0; i < size; i += 1) {
|
|
2844
|
-
quasis.push([]);
|
|
2845
|
-
}
|
|
2846
|
-
quasisMap.set(item.refSlot, quasis);
|
|
2847
|
-
}
|
|
2848
|
-
var expandableSlot = quasisMap.get(item.refSlot);
|
|
2849
|
-
var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
|
|
2850
|
-
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$$ : []));
|
|
2851
|
-
}
|
|
2852
|
-
}
|
|
2853
|
-
var _loop = function (slotName, _quasis) {
|
|
2854
|
-
if (!brickUtils.hasOwnProperty(slots, slotName)) {
|
|
2855
|
-
slots[slotName] = {
|
|
2856
|
-
type: "bricks",
|
|
2857
|
-
bricks: []
|
|
2858
|
-
};
|
|
2859
|
-
}
|
|
2860
|
-
var slotConf = slots[slotName];
|
|
2861
|
-
slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
|
|
2862
|
-
if (slotConf.bricks.length === 0) {
|
|
2863
|
-
delete slots[slotName];
|
|
2864
|
-
}
|
|
2865
|
-
};
|
|
2866
|
-
for (var [slotName, _quasis] of quasisMap.entries()) {
|
|
2867
|
-
_loop(slotName, _quasis);
|
|
2868
|
-
}
|
|
2915
|
+
// Since `EVENT`, `DATA`, `TPL` and `STATE` are provided in different context,
|
|
2916
|
+
// whenever missing one of them, memorize the current context for later consuming.
|
|
2917
|
+
if (missingEvent || missingData || missingTplOrState) {
|
|
2918
|
+
return rawWithContext;
|
|
2869
2919
|
}
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
var _excluded$8 = ["properties", "slots"];
|
|
2878
|
-
function setupUseBrickInTemplate(props, proxyContext) {
|
|
2879
|
-
function walk(props) {
|
|
2880
|
-
if (Array.isArray(props)) {
|
|
2881
|
-
return props.map(walk);
|
|
2920
|
+
if (attemptToVisitData) {
|
|
2921
|
+
globalVariables.DATA = runtimeContext.data;
|
|
2922
|
+
}
|
|
2923
|
+
if (attemptToVisitTplOrState && runtimeContext.tplContextId) {
|
|
2924
|
+
var tplContext = getCustomTemplateContext(runtimeContext.tplContextId);
|
|
2925
|
+
if (attemptToVisitTpl) {
|
|
2926
|
+
globalVariables.TPL = tplContext.getVariables();
|
|
2882
2927
|
}
|
|
2883
|
-
if (
|
|
2884
|
-
|
|
2928
|
+
if (attemptToVisitState) {
|
|
2929
|
+
globalVariables.STATE = getDynamicReadOnlyProxy({
|
|
2930
|
+
get(target, key) {
|
|
2931
|
+
return tplContext.state.getValue(key);
|
|
2932
|
+
},
|
|
2933
|
+
ownKeys() {
|
|
2934
|
+
return Array.from(tplContext.state.get().keys());
|
|
2935
|
+
}
|
|
2936
|
+
});
|
|
2885
2937
|
}
|
|
2886
|
-
return Object.fromEntries(Object.entries(props).map(_ref => {
|
|
2887
|
-
var [key, value] = _ref;
|
|
2888
|
-
return brickUtils.isObject(value) && key === "useBrick" ? Array.isArray(value) ? [key, value.map(setup)] : [key, setup(value)] : [key, walk(value)];
|
|
2889
|
-
}).concat(Object.getOwnPropertySymbols(props).map(k => [k, props[k]])));
|
|
2890
2938
|
}
|
|
2891
|
-
|
|
2892
|
-
var
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
type: "bricks",
|
|
2902
|
-
bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(setup)
|
|
2903
|
-
}];
|
|
2904
|
-
}));
|
|
2905
|
-
return _objectSpread__default["default"](_objectSpread__default["default"]({}, restConf), {}, {
|
|
2906
|
-
properties: walk(properties),
|
|
2907
|
-
slots
|
|
2908
|
-
}, setupTemplateProxy(proxyContext, restConf.ref, slots));
|
|
2939
|
+
if (attemptToVisitFormState && runtimeContext.formContextId) {
|
|
2940
|
+
var formContext = getCustomFormContext(runtimeContext.formContextId);
|
|
2941
|
+
globalVariables.FORM_STATE = getDynamicReadOnlyProxy({
|
|
2942
|
+
get(target, key) {
|
|
2943
|
+
return formContext.formState.getValue(key);
|
|
2944
|
+
},
|
|
2945
|
+
ownKeys() {
|
|
2946
|
+
return Array.from(formContext.formState.get().keys());
|
|
2947
|
+
}
|
|
2948
|
+
});
|
|
2909
2949
|
}
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
function isPlainObject(object) {
|
|
2913
|
-
return Object.prototype.toString.call(object) === "[object Object]";
|
|
2914
|
-
}
|
|
2950
|
+
var internalContext = _internalApiGetCurrentContext();
|
|
2951
|
+
var mergedContext = {};
|
|
2915
2952
|
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2953
|
+
// Use runtime context over internal context.
|
|
2954
|
+
// Internal context such as `match`, maybe change after `history.push`.
|
|
2955
|
+
// So we prefer memoized runtime context.
|
|
2956
|
+
for (var key of ["query", "match", "hash", "pathname", "app", "segues"]) {
|
|
2957
|
+
mergedContext[key] = (brickUtils.hasOwnProperty(runtimeContext, key) ? runtimeContext : internalContext)[key];
|
|
2958
|
+
}
|
|
2959
|
+
var {
|
|
2960
|
+
app: currentApp,
|
|
2961
|
+
query,
|
|
2962
|
+
match,
|
|
2963
|
+
hash,
|
|
2964
|
+
pathname,
|
|
2965
|
+
segues
|
|
2966
|
+
} = mergedContext;
|
|
2967
|
+
var {
|
|
2968
|
+
sys,
|
|
2969
|
+
flags,
|
|
2970
|
+
storyboardContext
|
|
2971
|
+
} = internalContext;
|
|
2972
|
+
var app = (_runtimeContext$overr = runtimeContext.overrideApp) !== null && _runtimeContext$overr !== void 0 ? _runtimeContext$overr : currentApp;
|
|
2973
|
+
function getIndividualGlobal(variableName) {
|
|
2974
|
+
switch (variableName) {
|
|
2975
|
+
case "ALIAS":
|
|
2976
|
+
return {
|
|
2977
|
+
getUrl: getUrlByAliasFactory(app)
|
|
2978
|
+
};
|
|
2979
|
+
case "ANCHOR":
|
|
2980
|
+
return hash ? hash.substr(1) : null;
|
|
2981
|
+
case "APP":
|
|
2982
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, _.cloneDeep(app)), {}, {
|
|
2983
|
+
getMenu
|
|
2984
|
+
});
|
|
2985
|
+
case "CTX":
|
|
2986
|
+
return getDynamicReadOnlyProxy({
|
|
2987
|
+
get(target, key) {
|
|
2988
|
+
var _item$brick$element;
|
|
2989
|
+
var item = storyboardContext.get(key);
|
|
2990
|
+
return !item ? item : item.type === "brick-property" ? (_item$brick$element = item.brick.element) === null || _item$brick$element === void 0 ? void 0 : _item$brick$element[item.prop] : item.value;
|
|
2991
|
+
},
|
|
2992
|
+
ownKeys() {
|
|
2993
|
+
return Array.from(storyboardContext.keys());
|
|
2931
2994
|
}
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2995
|
+
});
|
|
2996
|
+
case "FLAGS":
|
|
2997
|
+
return getReadOnlyProxy(flags);
|
|
2998
|
+
case "HASH":
|
|
2999
|
+
return hash;
|
|
3000
|
+
case "PATH_NAME":
|
|
3001
|
+
return pathname;
|
|
3002
|
+
case "INSTALLED_APPS":
|
|
3003
|
+
return {
|
|
3004
|
+
has: (appId, matchVersion) => getRuntime().hasInstalledApp(appId, matchVersion)
|
|
3005
|
+
};
|
|
3006
|
+
case "LOCAL_STORAGE":
|
|
3007
|
+
return {
|
|
3008
|
+
getItem: getItemFactory("local")
|
|
3009
|
+
};
|
|
3010
|
+
case "MISC":
|
|
3011
|
+
return getRuntime().getMiscSettings();
|
|
3012
|
+
case "PARAMS":
|
|
3013
|
+
return new URLSearchParams(query);
|
|
3014
|
+
case "PATH":
|
|
3015
|
+
return getReadOnlyProxy(match.params);
|
|
3016
|
+
case "PROCESSORS":
|
|
3017
|
+
return getDynamicReadOnlyProxy({
|
|
3018
|
+
get(target, key) {
|
|
3019
|
+
var pkg = customProcessorRegistry.get(key);
|
|
3020
|
+
if (!pkg) {
|
|
3021
|
+
throw new Error("'PROCESSORS.".concat(key, "' is not registered! Have you installed the relevant brick package of '").concat(key.replace(/[A-Z]/g, m => "-".concat(m.toLowerCase())), "-NB'?"));
|
|
3022
|
+
}
|
|
3023
|
+
return getDynamicReadOnlyProxy({
|
|
3024
|
+
get(t, k) {
|
|
3025
|
+
return pkg.get(k);
|
|
3026
|
+
},
|
|
3027
|
+
ownKeys() {
|
|
3028
|
+
return Array.from(pkg.keys());
|
|
3029
|
+
}
|
|
3030
|
+
});
|
|
3031
|
+
},
|
|
3032
|
+
ownKeys() {
|
|
3033
|
+
return Array.from(customProcessorRegistry.keys());
|
|
2937
3034
|
}
|
|
2938
|
-
}
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
3035
|
+
});
|
|
3036
|
+
case "QUERY":
|
|
3037
|
+
return Object.fromEntries(Array.from(query.keys()).map(key => [key, query.get(key)]));
|
|
3038
|
+
case "QUERY_ARRAY":
|
|
3039
|
+
return Object.fromEntries(Array.from(query.keys()).map(key => [key, query.getAll(key)]));
|
|
3040
|
+
case "SEGUE":
|
|
3041
|
+
return {
|
|
3042
|
+
getUrl: getUrlBySegueFactory(app, segues)
|
|
3043
|
+
};
|
|
3044
|
+
case "SESSION_STORAGE":
|
|
3045
|
+
return {
|
|
3046
|
+
getItem: getItemFactory("session")
|
|
3047
|
+
};
|
|
3048
|
+
case "SYS":
|
|
3049
|
+
return getReadOnlyProxy(sys);
|
|
3050
|
+
case "MEDIA":
|
|
3051
|
+
return getReadOnlyProxy(getMedia());
|
|
3052
|
+
case "__WIDGET_FN__":
|
|
3053
|
+
return widgetFunctions;
|
|
3054
|
+
case "__WIDGET_IMG__":
|
|
3055
|
+
return widgetImagesFactory;
|
|
3056
|
+
case "__WIDGET_I18N__":
|
|
3057
|
+
return widgetI18nFactory;
|
|
2950
3058
|
}
|
|
2951
|
-
return result;
|
|
2952
3059
|
}
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
return value.map(v => computeRealValue(v, context, injectDeep, nextOptions));
|
|
3060
|
+
for (var variableName of attemptToVisitGlobals) {
|
|
3061
|
+
var variable = getIndividualGlobal(variableName);
|
|
3062
|
+
if (variable !== undefined) {
|
|
3063
|
+
globalVariables[variableName] = variable;
|
|
3064
|
+
}
|
|
2959
3065
|
}
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
realProps = setupUseBrickInTemplate(realProps, {
|
|
2969
|
-
templateContextId: context.tplContextId
|
|
3066
|
+
Object.assign(globalVariables, getGeneralGlobals(precooked.attemptToVisitGlobals, {
|
|
3067
|
+
storyboardFunctions,
|
|
3068
|
+
app,
|
|
3069
|
+
appendI18nNamespace: runtimeContext.appendI18nNamespace
|
|
3070
|
+
}));
|
|
3071
|
+
try {
|
|
3072
|
+
var result = brickUtils.cook(precooked.expression, precooked.source, {
|
|
3073
|
+
globalVariables: supply(precooked.attemptToVisitGlobals, globalVariables)
|
|
2970
3074
|
});
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
brick[propName][k] = v;
|
|
2984
|
-
}
|
|
2985
|
-
} else if (propName === "innerHTML") {
|
|
2986
|
-
// `innerHTML` is dangerous, use `textContent` instead.
|
|
2987
|
-
// eslint-disable-next-line no-console
|
|
2988
|
-
console.error("Please use `textContent` instead of `innerHTML`.");
|
|
2989
|
-
brick.textContent = propValue;
|
|
2990
|
-
} else {
|
|
2991
|
-
if (extractProps) {
|
|
2992
|
-
_.set(brick, propName, propValue);
|
|
2993
|
-
} else {
|
|
2994
|
-
brick[propName] = propValue;
|
|
2995
|
-
}
|
|
3075
|
+
var detail = {
|
|
3076
|
+
raw,
|
|
3077
|
+
context: globalVariables,
|
|
3078
|
+
result
|
|
3079
|
+
};
|
|
3080
|
+
if (options.isReEvaluation) {
|
|
3081
|
+
devtoolsHookEmit("re-evaluation", {
|
|
3082
|
+
id: options.evaluationId,
|
|
3083
|
+
detail
|
|
3084
|
+
});
|
|
3085
|
+
} else {
|
|
3086
|
+
devtoolsHookEmit("evaluation", detail);
|
|
2996
3087
|
}
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3088
|
+
return result;
|
|
3089
|
+
} catch (error) {
|
|
3090
|
+
var _message = "".concat(error.message, ", in \"").concat(raw, "\"");
|
|
3091
|
+
if (options.isReEvaluation) {
|
|
3092
|
+
devtoolsHookEmit("re-evaluation", {
|
|
3093
|
+
id: options.evaluationId,
|
|
3094
|
+
detail: {
|
|
3095
|
+
raw,
|
|
3096
|
+
context: globalVariables
|
|
3097
|
+
},
|
|
3098
|
+
error: _message
|
|
3007
3099
|
});
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
result[propName] = realValue;
|
|
3012
|
-
}
|
|
3013
|
-
}
|
|
3014
|
-
if (Array.isArray(trackingContextList)) {
|
|
3015
|
-
var {
|
|
3016
|
-
contextNames,
|
|
3017
|
-
stateNames,
|
|
3018
|
-
formStateNames
|
|
3019
|
-
} = getTracks(propValue);
|
|
3020
|
-
if (contextNames || stateNames || formStateNames) {
|
|
3021
|
-
trackingContextList.push({
|
|
3022
|
-
contextNames,
|
|
3023
|
-
stateNames,
|
|
3024
|
-
formStateNames,
|
|
3025
|
-
propName,
|
|
3026
|
-
propValue
|
|
3027
|
-
});
|
|
3028
|
-
}
|
|
3029
|
-
}
|
|
3100
|
+
} else {
|
|
3101
|
+
var _errorConstructor = getCookErrorConstructor(error);
|
|
3102
|
+
throw new _errorConstructor(_message);
|
|
3030
3103
|
}
|
|
3031
3104
|
}
|
|
3032
|
-
return result;
|
|
3033
|
-
}
|
|
3034
|
-
function getNextInternalOptions(internalOptions, isArray, key) {
|
|
3035
|
-
return internalOptions !== null && internalOptions !== void 0 && internalOptions.$$lazyForUseBrick ? _objectSpread__default["default"](_objectSpread__default["default"]({}, internalOptions), {}, {
|
|
3036
|
-
$$stateOfUseBrick: getNextStateOfUseBrick(internalOptions.$$stateOfUseBrick, isArray, key)
|
|
3037
|
-
}) : internalOptions;
|
|
3038
3105
|
}
|
|
3039
3106
|
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
_excluded3 = ["items", "app"];
|
|
3043
|
-
var symbolAppId = Symbol("appId");
|
|
3044
|
-
var symbolMenuI18nNamespace = Symbol("menuI18nNamespace");
|
|
3045
|
-
var symbolOverrideApp = Symbol("overrideApp");
|
|
3046
|
-
var symbolShouldCache = Symbol("shouldCache");
|
|
3047
|
-
// Caching menu requests to avoid flicker.
|
|
3048
|
-
var menuCache = new Map();
|
|
3049
|
-
var menuTitleCache = new Map();
|
|
3050
|
-
var processMenuCache = new Map();
|
|
3051
|
-
function constructMenu(_x, _x2, _x3) {
|
|
3052
|
-
return _constructMenu.apply(this, arguments);
|
|
3107
|
+
function isBasicProperty(propRef) {
|
|
3108
|
+
return !!propRef.refProperty;
|
|
3053
3109
|
}
|
|
3054
|
-
function
|
|
3055
|
-
|
|
3056
|
-
var hasSubMenu = !!menuBar.subMenuId;
|
|
3057
|
-
yield Promise.all([_asyncToGenerator__default["default"](function* () {
|
|
3058
|
-
if (menuBar.menuId) {
|
|
3059
|
-
var _menuBar$menu;
|
|
3060
|
-
var defaultCollapsed = (_menuBar$menu = menuBar.menu) === null || _menuBar$menu === void 0 ? void 0 : _menuBar$menu.defaultCollapsed;
|
|
3061
|
-
var menu = yield processMenu(menuBar.menuId, context, kernel, hasSubMenu);
|
|
3062
|
-
if (!_.isNil(defaultCollapsed)) {
|
|
3063
|
-
menu.defaultCollapsed = defaultCollapsed;
|
|
3064
|
-
}
|
|
3065
|
-
menuBar.menu = menu;
|
|
3066
|
-
}
|
|
3067
|
-
})(), _asyncToGenerator__default["default"](function* () {
|
|
3068
|
-
if (hasSubMenu) {
|
|
3069
|
-
menuBar.subMenu = yield processMenu(menuBar.subMenuId, context, kernel);
|
|
3070
|
-
} else {
|
|
3071
|
-
menuBar.subMenu = null;
|
|
3072
|
-
}
|
|
3073
|
-
})()]);
|
|
3074
|
-
});
|
|
3075
|
-
return _constructMenu.apply(this, arguments);
|
|
3110
|
+
function isTransformableProperty(propRef) {
|
|
3111
|
+
return !!propRef.refTransform;
|
|
3076
3112
|
}
|
|
3077
|
-
function
|
|
3078
|
-
return
|
|
3113
|
+
function isMergeableProperty(propRef) {
|
|
3114
|
+
return !!propRef.mergeProperty;
|
|
3079
3115
|
}
|
|
3080
|
-
function
|
|
3081
|
-
|
|
3082
|
-
var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel, undefined, true)));
|
|
3083
|
-
data.forEach((item, index) => processMenuCache.set(menus[index], item));
|
|
3084
|
-
});
|
|
3085
|
-
return _preConstructMenus.apply(this, arguments);
|
|
3116
|
+
function isRefProperty(propRef) {
|
|
3117
|
+
return !!propRef.ref;
|
|
3086
3118
|
}
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
return _fetchMenuById.apply(this, arguments);
|
|
3119
|
+
function isVariableProperty(propRef) {
|
|
3120
|
+
return !!propRef.asVariable;
|
|
3090
3121
|
}
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3122
|
+
|
|
3123
|
+
var customTemplateRegistry = new Map();
|
|
3124
|
+
var appRegistered = new Set();
|
|
3125
|
+
var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
|
|
3126
|
+
var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
|
|
3127
|
+
var symbolForTplContextId = Symbol.for("tpl.contextId");
|
|
3128
|
+
|
|
3129
|
+
function propertyMerge(conf, value, object) {
|
|
3130
|
+
return propertyMergeAll(conf.$$mergeBase, Object.fromEntries(conf.$$mergeBase.proxies.map(proxy => [proxy.$$reversedRef, proxy === conf ? value : object[proxy.$$reversedRef]])));
|
|
3131
|
+
}
|
|
3132
|
+
function propertyMergeAll(mergeBase, object) {
|
|
3133
|
+
if (mergeBase.mergeType === "array") {
|
|
3134
|
+
return propertyMergeAllOfArray(mergeBase, object);
|
|
3135
|
+
}
|
|
3136
|
+
if (mergeBase.mergeType === "object") {
|
|
3137
|
+
return propertyMergeAllOfObject(mergeBase, object);
|
|
3138
|
+
}
|
|
3139
|
+
// istanbul ignore next: should never reach
|
|
3140
|
+
throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
|
|
3141
|
+
}
|
|
3142
|
+
function propertyMergeAllOfArray(_ref, object) {
|
|
3143
|
+
var _$1, _proxy$mergeArgs;
|
|
3144
|
+
var {
|
|
3145
|
+
baseValue,
|
|
3146
|
+
context,
|
|
3147
|
+
proxies
|
|
3148
|
+
} = _ref;
|
|
3149
|
+
// Use an approach like template-literal's quasis:
|
|
3150
|
+
// `quasi0${0}quais1${1}quasi2...`
|
|
3151
|
+
// Every quasi can be merged with multiple items.
|
|
3152
|
+
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
|
|
3153
|
+
$$lazyForUseBrick: true
|
|
3154
|
+
}) : [];
|
|
3155
|
+
var quasis = [];
|
|
3156
|
+
var size = computedBaseValue.length + 1;
|
|
3157
|
+
for (var i = 0; i < size; i += 1) {
|
|
3158
|
+
quasis.push([]);
|
|
3159
|
+
}
|
|
3160
|
+
for (var proxy of proxies) {
|
|
3161
|
+
var position = void 0;
|
|
3162
|
+
switch (proxy.mergeMethod) {
|
|
3163
|
+
case "append":
|
|
3164
|
+
position = computedBaseValue.length;
|
|
3165
|
+
break;
|
|
3166
|
+
case "prepend":
|
|
3167
|
+
position = 0;
|
|
3168
|
+
break;
|
|
3169
|
+
case "insertAt":
|
|
3170
|
+
// Defaults to `-1`.
|
|
3171
|
+
position = (_$1 = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _$1 !== void 0 ? _$1 : -1;
|
|
3172
|
+
if (position < 0) {
|
|
3173
|
+
// It's counted from the end if position is negative.
|
|
3174
|
+
position += quasis.length;
|
|
3126
3175
|
}
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3176
|
+
position = _.clamp(position, 0, computedBaseValue.length);
|
|
3177
|
+
break;
|
|
3178
|
+
// istanbul ignore next: should never reach
|
|
3179
|
+
default:
|
|
3180
|
+
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
3132
3181
|
}
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
return _mergeMenu.apply(this, arguments);
|
|
3182
|
+
var patchValue = object[proxy.$$reversedRef];
|
|
3183
|
+
if (!Array.isArray(patchValue)) {
|
|
3184
|
+
patchValue = [];
|
|
3185
|
+
}
|
|
3186
|
+
quasis[position].push(...patchValue);
|
|
3187
|
+
}
|
|
3188
|
+
return quasis.flatMap((item, index) => index < computedBaseValue.length ? item.concat(computedBaseValue[index]) : item);
|
|
3141
3189
|
}
|
|
3142
|
-
function
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3190
|
+
function propertyMergeAllOfObject(_ref2, object) {
|
|
3191
|
+
var {
|
|
3192
|
+
baseValue,
|
|
3193
|
+
proxies,
|
|
3194
|
+
context
|
|
3195
|
+
} = _ref2;
|
|
3196
|
+
var computedBaseValue = brickUtils.isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
|
|
3197
|
+
return proxies.reduce((acc, proxy) => {
|
|
3198
|
+
switch (proxy.mergeMethod) {
|
|
3199
|
+
case "extend":
|
|
3200
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, acc), object[proxy.$$reversedRef]);
|
|
3201
|
+
// istanbul ignore next: should never reach
|
|
3202
|
+
default:
|
|
3203
|
+
throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
|
|
3147
3204
|
}
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3205
|
+
}, computedBaseValue);
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
function setupTemplateProxy(proxyContext, ref, slots) {
|
|
3209
|
+
var computedPropsFromProxy = {};
|
|
3210
|
+
var refForProxy;
|
|
3211
|
+
var {
|
|
3212
|
+
reversedProxies,
|
|
3213
|
+
templateProperties,
|
|
3214
|
+
externalSlots,
|
|
3215
|
+
templateContextId,
|
|
3216
|
+
proxyBrick
|
|
3217
|
+
} = proxyContext;
|
|
3218
|
+
if (ref && reversedProxies) {
|
|
3219
|
+
refForProxy = {};
|
|
3220
|
+
proxyBrick.proxyRefs.set(ref, refForProxy);
|
|
3221
|
+
|
|
3222
|
+
// Reversed proxies are used for expand storyboard before rendering page.
|
|
3223
|
+
if (reversedProxies.properties.has(ref)) {
|
|
3224
|
+
Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(propRef => {
|
|
3225
|
+
// `propValue` is computed.
|
|
3226
|
+
var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[propRef.$$reversedRef];
|
|
3227
|
+
if (isTransformableProperty(propRef)) {
|
|
3228
|
+
return Object.entries(preprocessTransformProperties({
|
|
3229
|
+
[propRef.$$reversedRef]: propValue
|
|
3230
|
+
}, propRef.refTransform));
|
|
3231
|
+
}
|
|
3232
|
+
if (isBasicProperty(propRef)) {
|
|
3233
|
+
return [[propRef.refProperty, propValue]];
|
|
3234
|
+
}
|
|
3235
|
+
// Ignore Variable properties.
|
|
3236
|
+
// And mergeable properties are processed later.
|
|
3237
|
+
return [];
|
|
3238
|
+
}).filter(propRef => propRef[1] !== undefined)));
|
|
3239
|
+
|
|
3240
|
+
// Brick properties can be merged multiple times.
|
|
3241
|
+
if (reversedProxies.mergeBases.has(ref)) {
|
|
3242
|
+
Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref => {
|
|
3243
|
+
var [mergeProperty, mergeBase] = _ref;
|
|
3244
|
+
return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
|
|
3245
|
+
}).filter(item => item[1] !== undefined)));
|
|
3162
3246
|
}
|
|
3163
3247
|
}
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3248
|
+
|
|
3249
|
+
// Use an approach like template-literal's quasis:
|
|
3250
|
+
// `quasi0${0}quais1${1}quasi2...`
|
|
3251
|
+
// Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
|
|
3252
|
+
var quasisMap = new Map();
|
|
3253
|
+
if (reversedProxies.slots.has(ref)) {
|
|
3254
|
+
for (var item of reversedProxies.slots.get(ref)) {
|
|
3255
|
+
var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
|
|
3256
|
+
if (!quasisMap.has(item.refSlot)) {
|
|
3257
|
+
var quasis = [];
|
|
3258
|
+
// The size of quasis should be the existed slotted bricks' size plus one.
|
|
3259
|
+
var size = brickUtils.hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
|
|
3260
|
+
for (var i = 0; i < size; i += 1) {
|
|
3261
|
+
quasis.push([]);
|
|
3173
3262
|
}
|
|
3174
|
-
|
|
3175
|
-
} else {
|
|
3176
|
-
validMenuList.push(_menu);
|
|
3263
|
+
quasisMap.set(item.refSlot, quasis);
|
|
3177
3264
|
}
|
|
3265
|
+
var expandableSlot = quasisMap.get(item.refSlot);
|
|
3266
|
+
var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
|
|
3267
|
+
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$$ : []));
|
|
3178
3268
|
}
|
|
3179
3269
|
}
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
});
|
|
3187
|
-
return _mergeMenu.apply(this, arguments);
|
|
3188
|
-
}
|
|
3189
|
-
function processGroupInject(items, menu, injectWithMenus, menuWithI18n) {
|
|
3190
|
-
return items === null || items === void 0 ? void 0 : items.map(item => {
|
|
3191
|
-
var _processGroupInject;
|
|
3192
|
-
var foundInjectingMenus = item.groupId && injectWithMenus.get(item.groupId);
|
|
3193
|
-
if (foundInjectingMenus) {
|
|
3194
|
-
// Each menu to be injected with should be injected only once.
|
|
3195
|
-
injectWithMenus.delete(item.groupId);
|
|
3196
|
-
}
|
|
3197
|
-
return _objectSpread__default["default"](_objectSpread__default["default"]({}, item), {}, {
|
|
3198
|
-
children: ((_processGroupInject = processGroupInject(item.children || item.items, menu, injectWithMenus, menuWithI18n)) !== null && _processGroupInject !== void 0 ? _processGroupInject : []).concat(foundInjectingMenus ? foundInjectingMenus.flatMap(injectingMenu => processGroupInject(injectingMenu.items, injectingMenu, injectWithMenus, menuWithI18n)) : []),
|
|
3199
|
-
[symbolAppId]: menu.app[0].appId,
|
|
3200
|
-
[symbolMenuI18nNamespace]: menuWithI18n.get(menu),
|
|
3201
|
-
[symbolOverrideApp]: menu.overrideApp
|
|
3202
|
-
});
|
|
3203
|
-
});
|
|
3204
|
-
}
|
|
3205
|
-
function loadDynamicMenuItems(_x12, _x13, _x14) {
|
|
3206
|
-
return _loadDynamicMenuItems.apply(this, arguments);
|
|
3207
|
-
}
|
|
3208
|
-
function _loadDynamicMenuItems() {
|
|
3209
|
-
_loadDynamicMenuItems = _asyncToGenerator__default["default"](function* (menu, kernel, menuWithI18n) {
|
|
3210
|
-
if (menu.dynamicItems && menu.itemsResolve) {
|
|
3211
|
-
var _menu$itemsResolve;
|
|
3212
|
-
var itemsConf = {};
|
|
3213
|
-
var overrideAppId = menu.app[0].appId;
|
|
3214
|
-
var context = _internalApiGetCurrentContext();
|
|
3215
|
-
var newContext = context;
|
|
3216
|
-
if (overrideAppId !== context.app.id && attemptToVisit(menu.itemsResolve, ["APP", "I18N"])) {
|
|
3217
|
-
if (window.STANDALONE_MICRO_APPS) {
|
|
3218
|
-
if (menu.overrideApp) {
|
|
3219
|
-
menu.overrideApp.config = brickUtils.deepFreeze(_.merge({}, menu.overrideApp.defaultConfig, menu.overrideApp.userConfig));
|
|
3220
|
-
}
|
|
3221
|
-
newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
3222
|
-
overrideApp: menu.overrideApp,
|
|
3223
|
-
appendI18nNamespace: menuWithI18n.get(menu)
|
|
3224
|
-
});
|
|
3225
|
-
} else {
|
|
3226
|
-
var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
|
|
3227
|
-
newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
3228
|
-
overrideApp: storyboard === null || storyboard === void 0 ? void 0 : storyboard.app,
|
|
3229
|
-
appendI18nNamespace: menuWithI18n.get(menu)
|
|
3230
|
-
});
|
|
3231
|
-
}
|
|
3270
|
+
var _loop = function (slotName, _quasis) {
|
|
3271
|
+
if (!brickUtils.hasOwnProperty(slots, slotName)) {
|
|
3272
|
+
slots[slotName] = {
|
|
3273
|
+
type: "bricks",
|
|
3274
|
+
bricks: []
|
|
3275
|
+
};
|
|
3232
3276
|
}
|
|
3233
|
-
var
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
transformMapArray: false
|
|
3238
|
-
}, menu.itemsResolve), itemsConf, null, newContext);
|
|
3239
|
-
menu.items = itemsConf.items;
|
|
3240
|
-
if ((_menu$itemsResolve = menu.itemsResolve) !== null && _menu$itemsResolve !== void 0 && _menu$itemsResolve.args) {
|
|
3241
|
-
var _menu$itemsResolve2;
|
|
3242
|
-
return !attemptToVisit((_menu$itemsResolve2 = menu.itemsResolve) === null || _menu$itemsResolve2 === void 0 ? void 0 : _menu$itemsResolve2.args, ["QUERY", "PATH"]);
|
|
3277
|
+
var slotConf = slots[slotName];
|
|
3278
|
+
slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
|
|
3279
|
+
if (slotConf.bricks.length === 0) {
|
|
3280
|
+
delete slots[slotName];
|
|
3243
3281
|
}
|
|
3282
|
+
};
|
|
3283
|
+
for (var [slotName, _quasis] of quasisMap.entries()) {
|
|
3284
|
+
_loop(slotName, _quasis);
|
|
3244
3285
|
}
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
// `if` is already evaluated.
|
|
3252
|
-
looseCheckIfOfComputed).map(item => {
|
|
3253
|
-
var children = walkMenuItems(item.children || item.items);
|
|
3254
|
-
return item.type === "group" ? {
|
|
3255
|
-
type: "group",
|
|
3256
|
-
childLayout: item.childLayout,
|
|
3257
|
-
title: item.text || item.title,
|
|
3258
|
-
items: children,
|
|
3259
|
-
groupId: item.groupId,
|
|
3260
|
-
groupFrom: item.groupFrom
|
|
3261
|
-
} : children !== null && children !== void 0 && children.length ? {
|
|
3262
|
-
type: "subMenu",
|
|
3263
|
-
childLayout: item.childLayout,
|
|
3264
|
-
title: item.text || item.title,
|
|
3265
|
-
icon: item.icon,
|
|
3266
|
-
items: children,
|
|
3267
|
-
defaultExpanded: item.defaultExpanded
|
|
3268
|
-
} : item;
|
|
3269
|
-
});
|
|
3270
|
-
}
|
|
3271
|
-
function processMenu(_x15, _x16, _x17, _x18, _x19) {
|
|
3272
|
-
return _processMenu.apply(this, arguments);
|
|
3286
|
+
}
|
|
3287
|
+
return {
|
|
3288
|
+
[symbolForComputedPropsFromProxy]: computedPropsFromProxy,
|
|
3289
|
+
[symbolForRefForProxy]: refForProxy,
|
|
3290
|
+
[symbolForTplContextId]: templateContextId
|
|
3291
|
+
};
|
|
3273
3292
|
}
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
} = _yield$fetchMenuById,
|
|
3281
|
-
restMenuData = _objectWithoutProperties__default["default"](_yield$fetchMenuById, _excluded3);
|
|
3282
|
-
var usedActions = brickUtils.scanPermissionActionsInAny([items, restMenuData]);
|
|
3283
|
-
yield validatePermissions(usedActions);
|
|
3284
|
-
var appsRequireI18nFulfilled = new Set();
|
|
3285
|
-
var rootAppId = app[0].appId;
|
|
3286
|
-
if (rootAppId !== context.app.id && !restMenuData[symbolMenuI18nNamespace]) {
|
|
3287
|
-
appsRequireI18nFulfilled.add(rootAppId);
|
|
3293
|
+
|
|
3294
|
+
var _excluded$7 = ["properties", "slots"];
|
|
3295
|
+
function setupUseBrickInTemplate(props, proxyContext) {
|
|
3296
|
+
function walk(props) {
|
|
3297
|
+
if (Array.isArray(props)) {
|
|
3298
|
+
return props.map(walk);
|
|
3288
3299
|
}
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
var menuData = _objectSpread__default["default"](_objectSpread__default["default"]({}, yield computeRealValueWithOverrideApp(restMenuData, rootAppId, context, kernel)), {}, {
|
|
3292
|
-
items: yield computeMenuItemsWithOverrideApp(items, context, kernel)
|
|
3293
|
-
});
|
|
3294
|
-
return {
|
|
3295
|
-
title: yield processMenuTitle(menuData),
|
|
3296
|
-
icon: menuData.icon,
|
|
3297
|
-
link: menuData.link,
|
|
3298
|
-
menuItems: walkMenuItems(menuData.items),
|
|
3299
|
-
defaultCollapsed: menuData.defaultCollapsed || hasSubMenu,
|
|
3300
|
-
defaultCollapsedBreakpoint: menuData.defaultCollapsedBreakpoint
|
|
3301
|
-
};
|
|
3302
|
-
});
|
|
3303
|
-
return _processMenu.apply(this, arguments);
|
|
3304
|
-
}
|
|
3305
|
-
function collectAppsRequireI18nFulfilled(items, contextAppId, appIds) {
|
|
3306
|
-
function collect(items) {
|
|
3307
|
-
for (var _ref of items) {
|
|
3308
|
-
var {
|
|
3309
|
-
children
|
|
3310
|
-
} = _ref,
|
|
3311
|
-
rest = _objectWithoutProperties__default["default"](_ref, _excluded$7);
|
|
3312
|
-
var overrideAppId = rest[symbolAppId];
|
|
3313
|
-
if (!rest[symbolMenuI18nNamespace] && overrideAppId !== contextAppId && !appIds.has(overrideAppId) && attemptToVisit(rest, ["I18N"])) {
|
|
3314
|
-
appIds.add(overrideAppId);
|
|
3315
|
-
}
|
|
3316
|
-
children && collect(children);
|
|
3300
|
+
if (!brickUtils.isObject(props) || !isPlainObject(props)) {
|
|
3301
|
+
return props;
|
|
3317
3302
|
}
|
|
3303
|
+
return Object.fromEntries(Object.entries(props).map(_ref => {
|
|
3304
|
+
var [key, value] = _ref;
|
|
3305
|
+
return brickUtils.isObject(value) && key === "useBrick" ? Array.isArray(value) ? [key, value.map(setup)] : [key, setup(value)] : [key, walk(value)];
|
|
3306
|
+
}).concat(Object.getOwnPropertySymbols(props).map(k => [k, props[k]])));
|
|
3318
3307
|
}
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
return
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3308
|
+
function setup(item) {
|
|
3309
|
+
var {
|
|
3310
|
+
properties,
|
|
3311
|
+
slots: originalSlots
|
|
3312
|
+
} = item,
|
|
3313
|
+
restConf = _objectWithoutProperties__default["default"](item, _excluded$7);
|
|
3314
|
+
var slots = Object.fromEntries(Object.entries(originalSlots !== null && originalSlots !== void 0 ? originalSlots : {}).map(_ref2 => {
|
|
3315
|
+
var _slotConf$bricks;
|
|
3316
|
+
var [slotName, slotConf] = _ref2;
|
|
3317
|
+
return [slotName, {
|
|
3318
|
+
type: "bricks",
|
|
3319
|
+
bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(setup)
|
|
3320
|
+
}];
|
|
3321
|
+
}));
|
|
3322
|
+
return _objectSpread__default["default"](_objectSpread__default["default"]({}, restConf), {}, {
|
|
3323
|
+
properties: walk(properties),
|
|
3324
|
+
slots
|
|
3325
|
+
}, setupTemplateProxy(proxyContext, restConf.ref, slots));
|
|
3326
|
+
}
|
|
3327
|
+
return walk(props);
|
|
3336
3328
|
}
|
|
3337
|
-
function
|
|
3338
|
-
return
|
|
3329
|
+
function isPlainObject(object) {
|
|
3330
|
+
return Object.prototype.toString.call(object) === "[object Object]";
|
|
3339
3331
|
}
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3332
|
+
|
|
3333
|
+
var computeRealValue = (value, context, injectDeep, internalOptions) => {
|
|
3334
|
+
var preEvaluated = isPreEvaluated(value);
|
|
3335
|
+
if (preEvaluated || typeof value === "string") {
|
|
3336
|
+
// For `useBrick`, some fields such as `properties`/`transform`/`events`/`if`,
|
|
3337
|
+
// are kept and to be evaluated later.
|
|
3338
|
+
var lazy = (internalOptions === null || internalOptions === void 0 ? void 0 : internalOptions.$$lazyForUseBrick) && isLazyContentInUseBrick(internalOptions.$$stateOfUseBrick);
|
|
3339
|
+
var result;
|
|
3340
|
+
var dismissRecursiveMarkingInjected = lazy;
|
|
3341
|
+
if (preEvaluated || brickUtils.isEvaluable(value)) {
|
|
3342
|
+
var runtimeContext = {};
|
|
3343
|
+
if (context) {
|
|
3344
|
+
var keys = ["event", "tplContextId", "overrideApp", "appendI18nNamespace", "formContextId", "query", "match", "app", "segues"];
|
|
3345
|
+
for (var key of keys) {
|
|
3346
|
+
if (context[key]) {
|
|
3347
|
+
runtimeContext[key] = context[key];
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
var simpleKeys = ["hash", "pathname"];
|
|
3351
|
+
for (var _key of simpleKeys) {
|
|
3352
|
+
if (brickUtils.hasOwnProperty(context, _key)) {
|
|
3353
|
+
runtimeContext[_key] = context[_key];
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
// The current runtime context is memoized even if the evaluation maybe lazy.
|
|
3358
|
+
result = evaluate(value, runtimeContext, {
|
|
3359
|
+
lazy
|
|
3360
|
+
});
|
|
3361
|
+
dismissRecursiveMarkingInjected = shouldDismissRecursiveMarkingInjected(value);
|
|
3362
|
+
} else {
|
|
3363
|
+
result = lazy ? value : brickUtils.inject(value, context);
|
|
3344
3364
|
}
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
return menuTitleCache.get(cacheKey);
|
|
3365
|
+
if (!dismissRecursiveMarkingInjected) {
|
|
3366
|
+
recursiveMarkAsInjected(result);
|
|
3348
3367
|
}
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
var
|
|
3356
|
-
|
|
3368
|
+
return result;
|
|
3369
|
+
}
|
|
3370
|
+
if (!(injectDeep && brickUtils.isObject(value)) || haveBeenInjected(value)) {
|
|
3371
|
+
return value;
|
|
3372
|
+
}
|
|
3373
|
+
if (Array.isArray(value)) {
|
|
3374
|
+
var nextOptions = getNextInternalOptions(internalOptions, true);
|
|
3375
|
+
return value.map(v => computeRealValue(v, context, injectDeep, nextOptions));
|
|
3376
|
+
}
|
|
3377
|
+
return Object.fromEntries(Object.entries(value).map(_ref => {
|
|
3378
|
+
var [k, v] = _ref;
|
|
3379
|
+
return [computeRealValue(k, context, false), computeRealValue(v, context, injectDeep, getNextInternalOptions(internalOptions, false, k))];
|
|
3380
|
+
}).concat(internalOptions !== null && internalOptions !== void 0 && internalOptions.ignoreSymbols ? [] : Object.getOwnPropertySymbols(value).map(k => [k, value[k]])));
|
|
3381
|
+
};
|
|
3382
|
+
function setProperties(bricks, properties, context, injectDeep) {
|
|
3383
|
+
var realProps = computeRealProperties(properties, context, injectDeep);
|
|
3384
|
+
if (context.tplContextId) {
|
|
3385
|
+
realProps = setupUseBrickInTemplate(realProps, {
|
|
3386
|
+
templateContextId: context.tplContextId
|
|
3357
3387
|
});
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
}
|
|
3365
|
-
menuTitleCache.set(cacheKey, title);
|
|
3366
|
-
return title;
|
|
3367
|
-
});
|
|
3368
|
-
return _processMenuTitle.apply(this, arguments);
|
|
3369
|
-
}
|
|
3370
|
-
function clearMenuTitleCache() {
|
|
3371
|
-
menuTitleCache.clear();
|
|
3372
|
-
}
|
|
3373
|
-
function clearMenuCache() {
|
|
3374
|
-
menuCache.clear();
|
|
3375
|
-
}
|
|
3376
|
-
function reorderMenu(menuData) {
|
|
3377
|
-
menuData.items = reorderMenuItems(menuData.items);
|
|
3378
|
-
}
|
|
3379
|
-
function reorderMenuItems(list) {
|
|
3380
|
-
return sortMenuItems(list).map(item => _objectSpread__default["default"](_objectSpread__default["default"]({}, item), {}, {
|
|
3381
|
-
children: reorderMenuItems(item.children)
|
|
3382
|
-
}));
|
|
3383
|
-
}
|
|
3384
|
-
function sortMenuItems(list) {
|
|
3385
|
-
return _.sortBy(list, item => {
|
|
3386
|
-
var _item$sort;
|
|
3387
|
-
return (_item$sort = item.sort) !== null && _item$sort !== void 0 ? _item$sort : -Infinity;
|
|
3388
|
+
}
|
|
3389
|
+
if (!Array.isArray(bricks)) {
|
|
3390
|
+
bricks = [bricks];
|
|
3391
|
+
}
|
|
3392
|
+
bricks.forEach(brick => {
|
|
3393
|
+
setRealProperties(brick, realProps);
|
|
3388
3394
|
});
|
|
3389
3395
|
}
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3396
|
+
function setRealProperties(brick, realProps, extractProps) {
|
|
3397
|
+
for (var [propName, propValue] of Object.entries(realProps)) {
|
|
3398
|
+
if (propName === "style" || propName === "dataset") {
|
|
3399
|
+
for (var [k, v] of Object.entries(propValue)) {
|
|
3400
|
+
brick[propName][k] = v;
|
|
3401
|
+
}
|
|
3402
|
+
} else if (propName === "innerHTML") {
|
|
3403
|
+
// `innerHTML` is dangerous, use `textContent` instead.
|
|
3404
|
+
// eslint-disable-next-line no-console
|
|
3405
|
+
console.error("Please use `textContent` instead of `innerHTML`.");
|
|
3406
|
+
brick.textContent = propValue;
|
|
3407
|
+
} else {
|
|
3408
|
+
if (extractProps) {
|
|
3409
|
+
_.set(brick, propName, propValue);
|
|
3410
|
+
} else {
|
|
3411
|
+
brick[propName] = propValue;
|
|
3404
3412
|
}
|
|
3405
|
-
} else if (globals.includes("APP")) {
|
|
3406
|
-
return /\${\s*APP\s*\./.test(data);
|
|
3407
|
-
}
|
|
3408
|
-
} else if (brickUtils.isObject(data)) {
|
|
3409
|
-
// Avoid call stack overflow.
|
|
3410
|
-
// istanbul ignore next
|
|
3411
|
-
if (memo.has(data)) {
|
|
3412
|
-
return false;
|
|
3413
3413
|
}
|
|
3414
|
-
memo.add(data);
|
|
3415
|
-
return (Array.isArray(data) ? data : Object.values(data)).some(item => attemptToVisit(item, globals, memo));
|
|
3416
3414
|
}
|
|
3417
|
-
return false;
|
|
3418
3415
|
}
|
|
3419
|
-
function
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
if ("to" in data && data.to && !brickUtils.isEvaluable(data.to)) {
|
|
3434
|
-
var yaml = pipes.pipes.yaml(data.to);
|
|
3435
|
-
if (brickUtils.isObject(yaml) && ["pathname", "search", "hash"].some(key => brickUtils.hasOwnProperty(yaml, key))) {
|
|
3436
|
-
data.to = yaml;
|
|
3416
|
+
function computeRealProperties(properties, context, injectDeep, trackingContextList) {
|
|
3417
|
+
var result = {};
|
|
3418
|
+
if (brickUtils.isObject(properties)) {
|
|
3419
|
+
for (var [propName, propValue] of Object.entries(properties)) {
|
|
3420
|
+
// Related: https://github.com/facebook/react/issues/11347
|
|
3421
|
+
var realValue = computeRealValue(propValue, context, injectDeep, {
|
|
3422
|
+
$$lazyForUseBrick: true,
|
|
3423
|
+
$$stateOfUseBrick: propName === "useBrick" ? StateOfUseBrick.USE_BRICK : StateOfUseBrick.INITIAL
|
|
3424
|
+
});
|
|
3425
|
+
if (realValue !== undefined) {
|
|
3426
|
+
// For `style` and `dataset`, only object is acceptable.
|
|
3427
|
+
if (propName !== "style" && propName !== "dataset" || brickUtils.isObject(realValue)) {
|
|
3428
|
+
result[propName] = realValue;
|
|
3429
|
+
}
|
|
3437
3430
|
}
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3431
|
+
if (Array.isArray(trackingContextList)) {
|
|
3432
|
+
var {
|
|
3433
|
+
contextNames,
|
|
3434
|
+
stateNames,
|
|
3435
|
+
formStateNames
|
|
3436
|
+
} = getTracks(propValue);
|
|
3437
|
+
if (contextNames || stateNames || formStateNames) {
|
|
3438
|
+
trackingContextList.push({
|
|
3439
|
+
contextNames,
|
|
3440
|
+
stateNames,
|
|
3441
|
+
formStateNames,
|
|
3442
|
+
propName,
|
|
3443
|
+
propValue
|
|
3444
|
+
});
|
|
3444
3445
|
}
|
|
3445
|
-
newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
3446
|
-
overrideApp: data[symbolOverrideApp],
|
|
3447
|
-
appendI18nNamespace: data[symbolMenuI18nNamespace]
|
|
3448
|
-
});
|
|
3449
|
-
} else {
|
|
3450
|
-
var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
|
|
3451
|
-
newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
|
|
3452
|
-
overrideApp: storyboard === null || storyboard === void 0 ? void 0 : storyboard.app,
|
|
3453
|
-
appendI18nNamespace: data[symbolMenuI18nNamespace]
|
|
3454
|
-
});
|
|
3455
3446
|
}
|
|
3456
3447
|
}
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
});
|
|
3464
|
-
|
|
3448
|
+
}
|
|
3449
|
+
return result;
|
|
3450
|
+
}
|
|
3451
|
+
function getNextInternalOptions(internalOptions, isArray, key) {
|
|
3452
|
+
return internalOptions !== null && internalOptions !== void 0 && internalOptions.$$lazyForUseBrick ? _objectSpread__default["default"](_objectSpread__default["default"]({}, internalOptions), {}, {
|
|
3453
|
+
$$stateOfUseBrick: getNextStateOfUseBrick(internalOptions.$$stateOfUseBrick, isArray, key)
|
|
3454
|
+
}) : internalOptions;
|
|
3455
|
+
}
|
|
3456
|
+
|
|
3457
|
+
var brickTemplateRegistry = new Map();
|
|
3458
|
+
function registerBrickTemplate(name, factory) {
|
|
3459
|
+
if (brickTemplateRegistry.has(name)) {
|
|
3460
|
+
// eslint-disable-next-line no-console
|
|
3461
|
+
console.error("Brick template of \"".concat(name, "\" already registered."));
|
|
3462
|
+
return;
|
|
3463
|
+
}
|
|
3464
|
+
brickTemplateRegistry.set(name, factory);
|
|
3465
3465
|
}
|
|
3466
3466
|
|
|
3467
3467
|
var lazyBrickRegistry = new Map();
|
|
@@ -3653,10 +3653,39 @@
|
|
|
3653
3653
|
}
|
|
3654
3654
|
|
|
3655
3655
|
/* istanbul ignore next */
|
|
3656
|
+
function _dev_only_debugDataValue(_x, _x2) {
|
|
3657
|
+
return _dev_only_debugDataValue2.apply(this, arguments);
|
|
3658
|
+
}
|
|
3659
|
+
|
|
3660
|
+
/* istanbul ignore next */
|
|
3661
|
+
function _dev_only_debugDataValue2() {
|
|
3662
|
+
_dev_only_debugDataValue2 = _asyncToGenerator__default["default"](function* (debugData, _ref3) {
|
|
3663
|
+
var {
|
|
3664
|
+
tplContextId
|
|
3665
|
+
} = _ref3;
|
|
3666
|
+
var runtimeContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, _internalApiGetCurrentContext()), {}, {
|
|
3667
|
+
tplContextId
|
|
3668
|
+
});
|
|
3669
|
+
if (debugData.value) {
|
|
3670
|
+
return computeRealValue(debugData.value, runtimeContext, true);
|
|
3671
|
+
}
|
|
3672
|
+
var hasTransform = debugData.resolve.transform;
|
|
3673
|
+
var result = {};
|
|
3674
|
+
yield _internalApiGetResolver().resolveOne("reference", hasTransform ? debugData.resolve : _objectSpread__default["default"](_objectSpread__default["default"]({}, debugData.resolve), {}, {
|
|
3675
|
+
transform: "value"
|
|
3676
|
+
}), result, null, runtimeContext, {
|
|
3677
|
+
cache: "reload"
|
|
3678
|
+
});
|
|
3679
|
+
|
|
3680
|
+
// 跟 v3 的数据结构保持一致,有 transform 时返回完整定义,无 transform 时直接返回数据
|
|
3681
|
+
return hasTransform ? result : result.value;
|
|
3682
|
+
});
|
|
3683
|
+
return _dev_only_debugDataValue2.apply(this, arguments);
|
|
3684
|
+
}
|
|
3656
3685
|
function _dev_only_updateFormPreviewSettings(appId, formId, settings) {
|
|
3657
3686
|
kernel._dev_only_updateFormPreviewSettings(appId, formId, settings);
|
|
3658
3687
|
}
|
|
3659
|
-
function _dev_only_render(
|
|
3688
|
+
function _dev_only_render(_x3, _x4) {
|
|
3660
3689
|
return _dev_only_render2.apply(this, arguments);
|
|
3661
3690
|
}
|
|
3662
3691
|
function _dev_only_render2() {
|
|
@@ -14445,6 +14474,7 @@
|
|
|
14445
14474
|
getAddedContracts: _dev_only_getAddedContracts,
|
|
14446
14475
|
getContextValue: _dev_only_getContextValue,
|
|
14447
14476
|
getAllContextValues: _dev_only_getAllContextValues,
|
|
14477
|
+
debugDataValue: _dev_only_debugDataValue,
|
|
14448
14478
|
render: _dev_only_render,
|
|
14449
14479
|
setRealTimeDataInspectRoot,
|
|
14450
14480
|
addRealTimeDataInspectHook
|