@next-core/brick-kit 2.91.0 → 2.92.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,50 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.92.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.92.0...@next-core/brick-kit@2.92.1) (2021-12-06)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix empty image ([f941e83](https://github.com/easyops-cn/next-core/commit/f941e835cf42b4a0a94418004c19b0c37b3d24e0))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.92.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.91.2...@next-core/brick-kit@2.92.0) (2021-12-06)
18
+
19
+
20
+ ### Features
21
+
22
+ * expose http code ([#1227](https://github.com/easyops-cn/next-core/issues/1227)) ([9e22deb](https://github.com/easyops-cn/next-core/commit/9e22deb2dc27b7d907bb782790fa4a59960ccc82))
23
+
24
+
25
+
26
+
27
+
28
+ ## [2.91.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.91.1...@next-core/brick-kit@2.91.2) (2021-12-05)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * add icons field ([7415b3f](https://github.com/easyops-cn/next-core/commit/7415b3ffaafe109c3bd555878a1d5ab2cd117183))
34
+
35
+
36
+
37
+
38
+
39
+ ## [2.91.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.91.0...@next-core/brick-kit@2.91.1) (2021-12-03)
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * fix page tracker ([dbf1d00](https://github.com/easyops-cn/next-core/commit/dbf1d003cd2e60ad18471e403c5dc9c9690b30fa))
45
+
46
+
47
+
48
+
49
+
6
50
  # [2.91.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.90.2...@next-core/brick-kit@2.91.0) (2021-12-03)
7
51
 
8
52
 
@@ -1,40 +1,21 @@
1
1
  (function (global, factory) {
2
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/asyncToGenerator'), require('@babel/runtime/helpers/defineProperty'), require('react'), require('lodash'), require('@next-core/brick-utils'), require('@next-core/brick-http'), require('i18next'), require('moment'), require('@next-core/pipes'), require('@next-core/easyops-analytics'), require('js-yaml'), require('antd'), require('@ant-design/icons'), require('react-i18next'), require('@babel/runtime/helpers/esm/extends'), require('@next-core/illustrations'), require('@babel/runtime/helpers/decorate')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'history', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/objectWithoutProperties', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/helpers/defineProperty', 'react', 'lodash', '@next-core/brick-utils', '@next-core/brick-http', 'i18next', 'moment', '@next-core/pipes', '@next-core/easyops-analytics', 'js-yaml', 'antd', '@ant-design/icons', '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._asyncToGenerator$4, global._defineProperty$1, global.React, global.lodash, global.brickUtils, global.brickHttp, global.i18next, global.moment, global.pipes, global.easyopsAnalytics, global.yaml, global.antd, global.icons, global.reactI18next, global._extends$1, global.illustrations, global._decorate));
5
- })(this, (function (exports, history$1, _objectSpread, _objectWithoutProperties, _asyncToGenerator$4, _defineProperty$1, React, lodash, brickUtils, brickHttp, i18next, moment, pipes, easyopsAnalytics, yaml, antd, icons, reactI18next, _extends$1, illustrations, _decorate) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickKit = {}, global.history$1, global._objectSpread, global._objectWithoutProperties, global._asyncToGenerator$4, global._defineProperty$1, global.React, global.lodash, global.brickUtils, global.brickHttp, global.i18next, global.moment, global.pipes, global.easyopsAnalytics, global.yaml, global.antd, global.icons, global.reactI18next, global._extends, global.illustrations, global._decorate));
5
+ })(this, (function (exports, history$1, _objectSpread, _objectWithoutProperties, _asyncToGenerator$4, _defineProperty$1, React, lodash, brickUtils, brickHttp, i18next, moment, pipes, easyopsAnalytics, yaml, antd, icons, 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
 
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () { return e[k]; }
19
- });
20
- }
21
- });
22
- }
23
- n["default"] = e;
24
- return Object.freeze(n);
25
- }
26
-
27
9
  var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
28
10
  var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
29
11
  var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator$4);
30
12
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty$1);
31
13
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
32
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
33
14
  var lodash__default = /*#__PURE__*/_interopDefaultLegacy(lodash);
34
15
  var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
35
16
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
36
17
  var yaml__default = /*#__PURE__*/_interopDefaultLegacy(yaml);
37
- var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends$1);
18
+ var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
38
19
  var _decorate__default = /*#__PURE__*/_interopDefaultLegacy(_decorate);
39
20
 
40
21
  class BaseBar {
@@ -6270,7 +6251,7 @@
6270
6251
 
6271
6252
  return _asyncToGenerator__default["default"](function* () {
6272
6253
  var data = yield window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : BootstrapV2Api_bootstrapV2(_objectSpread__default["default"]({
6273
- appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status",
6254
+ appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons",
6274
6255
  ignoreTemplateFields: "templates",
6275
6256
  ignoreBrickFields: "bricks,processors,providers,editors"
6276
6257
  }, params), {
@@ -9287,6 +9268,8 @@
9287
9268
  var _this3 = this;
9288
9269
 
9289
9270
  return _asyncToGenerator__default["default"](function* () {
9271
+ var _apiAnalyzer$getInsta;
9272
+
9290
9273
  _this3.state = "initial";
9291
9274
  _this3.renderId = lodash.uniqueId("render-id-");
9292
9275
  resetAllInjected();
@@ -9297,7 +9280,10 @@
9297
9280
  }
9298
9281
 
9299
9282
  var history = getHistory();
9300
- history.unblock();
9283
+ history.unblock(); // Create the page tracker before page load.
9284
+ // And the API Analyzer maybe disabled.
9285
+
9286
+ var pageTracker = (_apiAnalyzer$getInsta = easyopsAnalytics.apiAnalyzer.getInstance()) === null || _apiAnalyzer$getInsta === void 0 ? void 0 : _apiAnalyzer$getInsta.pageTracker();
9301
9287
  var locationContext = _this3.locationContext = new LocationContext(_this3.kernel, location);
9302
9288
  var storyboard = locationContext.matchStoryboard(_this3.kernel.bootstrapData.storyboards);
9303
9289
 
@@ -9385,7 +9371,8 @@
9385
9371
  mountRoutesResult.main = [{
9386
9372
  type: brickPageError,
9387
9373
  properties: {
9388
- error: httpErrorToString(error)
9374
+ error: httpErrorToString(error),
9375
+ code: error instanceof brickHttp.HttpResponseError ? error.response.status : null
9389
9376
  },
9390
9377
  events: {}
9391
9378
  }];
@@ -9493,8 +9480,6 @@
9493
9480
  });
9494
9481
 
9495
9482
  if (main.length > 0 || portal.length > 0) {
9496
- var _apiAnalyzer$getInsta;
9497
-
9498
9483
  main.length > 0 && mountTree(main, mountPoints.main);
9499
9484
  portal.length > 0 && mountTree(portal, mountPoints.portal);
9500
9485
  afterMountTree(mountPoints.main);
@@ -9513,9 +9498,8 @@
9513
9498
  // See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md
9514
9499
 
9515
9500
 
9516
- window.scrollTo(0, 0); // API Analyzer maybe disabled.
9517
-
9518
- (_apiAnalyzer$getInsta = easyopsAnalytics.apiAnalyzer.getInstance()) === null || _apiAnalyzer$getInsta === void 0 ? void 0 : _apiAnalyzer$getInsta.pageTracker()(locationContext.getCurrentMatch().path); // analytics page_view event
9501
+ window.scrollTo(0, 0);
9502
+ pageTracker === null || pageTracker === void 0 ? void 0 : pageTracker(locationContext.getCurrentMatch().path); // analytics page_view event
9519
9503
 
9520
9504
  easyopsAnalytics.userAnalytics.event("page_view", _objectSpread__default["default"]({
9521
9505
  micro_app_id: _this3.kernel.currentApp.id,
@@ -10812,165 +10796,31 @@
10812
10796
  };
10813
10797
  var defaultLocale = localeValues;
10814
10798
 
10815
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
10816
-
10817
- var _ref = /*#__PURE__*/React__namespace.createElement("defs", null, /*#__PURE__*/React__namespace.createElement("linearGradient", {
10818
- x1: "5.718%",
10819
- y1: "4.311%",
10820
- x2: "83.05%",
10821
- y2: "88.915%",
10822
- id: "empty-image_svg__a"
10823
- }, /*#__PURE__*/React__namespace.createElement("stop", {
10824
- stopColor: "#D4D8E4",
10825
- offset: "0%"
10826
- }), /*#__PURE__*/React__namespace.createElement("stop", {
10827
- stopColor: "#A9B0C4",
10828
- offset: "100%"
10829
- })), /*#__PURE__*/React__namespace.createElement("linearGradient", {
10830
- x1: "0%",
10831
- y1: "11.08%",
10832
- x2: "80.548%",
10833
- y2: "107.704%",
10834
- id: "empty-image_svg__d"
10835
- }, /*#__PURE__*/React__namespace.createElement("stop", {
10836
- stopColor: "#C2C7DA",
10837
- offset: "0%"
10838
- }), /*#__PURE__*/React__namespace.createElement("stop", {
10839
- stopColor: "#8F96B3",
10840
- offset: "100%"
10841
- })), /*#__PURE__*/React__namespace.createElement("path", {
10842
- d: "M34 36h8a4 4 0 0 1 4 4v8a4 4 0 0 1-4 4h-8a4 4 0 0 1-4-4v-8a4 4 0 0 1 4-4z",
10843
- id: "empty-image_svg__c"
10844
- }), /*#__PURE__*/React__namespace.createElement("filter", {
10845
- x: "-37.5%",
10846
- y: "-31.3%",
10847
- width: "187.5%",
10848
- height: "187.5%",
10849
- filterUnits: "objectBoundingBox",
10850
- id: "empty-image_svg__b"
10851
- }, /*#__PURE__*/React__namespace.createElement("feOffset", {
10852
- dx: 1,
10853
- dy: 2,
10854
- in: "SourceAlpha",
10855
- result: "shadowOffsetOuter1"
10856
- }), /*#__PURE__*/React__namespace.createElement("feGaussianBlur", {
10857
- stdDeviation: 2,
10858
- in: "shadowOffsetOuter1",
10859
- result: "shadowBlurOuter1"
10860
- }), /*#__PURE__*/React__namespace.createElement("feComposite", {
10861
- in: "shadowBlurOuter1",
10862
- in2: "SourceAlpha",
10863
- operator: "out",
10864
- result: "shadowBlurOuter1"
10865
- }), /*#__PURE__*/React__namespace.createElement("feColorMatrix", {
10866
- values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.22 0",
10867
- in: "shadowBlurOuter1"
10868
- })), /*#__PURE__*/React__namespace.createElement("linearGradient", {
10869
- x1: "41.823%",
10870
- y1: "24.795%",
10871
- x2: "8.813%",
10872
- y2: "86.427%",
10873
- id: "empty-image_svg__g"
10874
- }, /*#__PURE__*/React__namespace.createElement("stop", {
10875
- stopColor: "#CCD0DD",
10876
- offset: "0%"
10877
- }), /*#__PURE__*/React__namespace.createElement("stop", {
10878
- stopColor: "#9DA3B9",
10879
- offset: "100%"
10880
- })), /*#__PURE__*/React__namespace.createElement("path", {
10881
- d: "M59 19a4 4 0 0 1 4 4v7.314L51.686 19H59z",
10882
- id: "empty-image_svg__f"
10883
- }), /*#__PURE__*/React__namespace.createElement("filter", {
10884
- x: "-61.9%",
10885
- y: "-79.5%",
10886
- width: "223.7%",
10887
- height: "223.7%",
10888
- filterUnits: "objectBoundingBox",
10889
- id: "empty-image_svg__e"
10890
- }, /*#__PURE__*/React__namespace.createElement("feOffset", {
10891
- dy: -2,
10892
- in: "SourceAlpha",
10893
- result: "shadowOffsetOuter1"
10894
- }), /*#__PURE__*/React__namespace.createElement("feGaussianBlur", {
10895
- stdDeviation: 2,
10896
- in: "shadowOffsetOuter1",
10897
- result: "shadowBlurOuter1"
10898
- }), /*#__PURE__*/React__namespace.createElement("feColorMatrix", {
10899
- values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0",
10900
- in: "shadowBlurOuter1"
10901
- })));
10902
-
10903
- var _ref2 = /*#__PURE__*/React__namespace.createElement("g", {
10904
- fill: "none",
10905
- fillRule: "evenodd"
10906
- }, /*#__PURE__*/React__namespace.createElement("path", {
10907
- d: "M61.108 51.8H15.892a2.8 2.8 0 0 0-1.941.782L5.6 60.615V74.2a5.6 5.6 0 0 0 5.6 5.6h54.6a5.6 5.6 0 0 0 5.6-5.6V60.615l-8.35-8.033a2.8 2.8 0 0 0-1.942-.782z",
10908
- fill: "#A6AAC3"
10909
- }), /*#__PURE__*/React__namespace.createElement("path", {
10910
- d: "M51.686 19L63 30.314V66.2a2.8 2.8 0 0 1-2.8 2.8H16.8a2.8 2.8 0 0 1-2.8-2.8V25a6 6 0 0 1 6-6h31.686z",
10911
- fill: "url(#empty-image_svg__a)"
10912
- }), /*#__PURE__*/React__namespace.createElement("g", null, /*#__PURE__*/React__namespace.createElement("use", {
10913
- fill: "#000",
10914
- filter: "url(#empty-image_svg__b)",
10915
- xlinkHref: "#empty-image_svg__c"
10916
- }), /*#__PURE__*/React__namespace.createElement("path", {
10917
- stroke: "#FFF",
10918
- d: "M42 36.5c.966 0 1.841.392 2.475 1.025A3.489 3.489 0 0 1 45.5 40h0v8c0 .966-.392 1.841-1.025 2.475A3.489 3.489 0 0 1 42 51.5h0-8a3.489 3.489 0 0 1-2.475-1.025A3.489 3.489 0 0 1 30.5 48h0v-8c0-.966.392-1.841 1.025-2.475A3.489 3.489 0 0 1 34 36.5h0z",
10919
- strokeLinejoin: "square",
10920
- fill: "url(#empty-image_svg__d)"
10921
- })), /*#__PURE__*/React__namespace.createElement("g", {
10922
- transform: "rotate(180 57.343 24.657)"
10923
- }, /*#__PURE__*/React__namespace.createElement("use", {
10924
- fill: "#000",
10925
- filter: "url(#empty-image_svg__e)",
10926
- xlinkHref: "#empty-image_svg__f"
10927
- }), /*#__PURE__*/React__namespace.createElement("use", {
10928
- fill: "url(#empty-image_svg__g)",
10929
- xlinkHref: "#empty-image_svg__f"
10930
- })), /*#__PURE__*/React__namespace.createElement("path", {
10931
- d: "M82.6 42a.7.7 0 0 1 .7.7v1.399l1.4.001a.7.7 0 0 1 0 1.4l-1.4-.001V46.9a.7.7 0 0 1-1.4 0v-1.401l-1.4.001a.7.7 0 0 1 0-1.4l1.4-.001V42.7a.7.7 0 0 1 .7-.7zM2.1 30.8c.29 0 .525.235.525.525l-.001.874.876.001a.7.7 0 0 1 0 1.4h-.876l.001.875a.525.525 0 1 1-1.05 0l-.001-.875H.7a.7.7 0 0 1 0-1.4l.874-.001.001-.874c0-.29.235-.525.525-.525z",
10932
- fill: "#D6D8E4",
10933
- opacity: 0.3
10934
- }), /*#__PURE__*/React__namespace.createElement("path", {
10935
- d: "M8.4 79.8l-.17-.005A2.8 2.8 0 0 1 5.6 77V60.2h12.393l.175-.006c3.802-.04 7.95 5.943 19.61 6.19l.022-.002.022.002c10.856.218 15.009-5.902 19.558-6.175l.227-.009H71.4V77a2.8 2.8 0 0 1-2.63 2.795l-.17.005H8.4z",
10936
- fill: "#D6D8E4"
10937
- }), /*#__PURE__*/React__namespace.createElement("path", {
10938
- d: "M21 3.356S24.518 2.509 25.516 0c1.438 2.057 2.18 2.947 3.884 3.338-2.321.692-3.33 1.468-4.123 3.662-.912-2.584-1.741-2.919-4.277-3.644",
10939
- fill: "#D6D8E4",
10940
- opacity: 0.5
10941
- }), /*#__PURE__*/React__namespace.createElement("path", {
10942
- d: "M63 10.125S72.382 7.923 75.044 1.4c3.834 5.35 5.81 7.663 10.356 8.68-6.19 1.797-8.878 3.816-10.995 9.52-2.43-6.72-4.643-7.59-11.405-9.475",
10943
- fill: "#D6D8E4",
10944
- opacity: 0.8
10945
- }));
10946
-
10947
- function SvgEmptyImage(props) {
10948
- return /*#__PURE__*/React__namespace.createElement("svg", _extends({
10949
- width: 86,
10950
- height: 80,
10951
- viewBox: "0 0 86 80",
10952
- xmlns: "http://www.w3.org/2000/svg",
10953
- xmlnsXlink: "http://www.w3.org/1999/xlink"
10954
- }, props), _ref, _ref2);
10955
- }
10799
+ var emptyImage = "empty-image.397ff6359f4066d8.png";
10956
10800
 
10957
10801
  /**
10958
10802
  * 用于展示空数据的 React 组件。
10959
10803
  */
10960
10804
  function EasyopsEmpty(props) {
10961
- var emptyImage = SvgEmptyImage;
10962
10805
  var illustration = React.useMemo(() => props.illustration && illustrations.getIllustration(props.illustration), [props.illustration]);
10963
- var image = props.illustration ? illustration : /*#__PURE__*/React__default["default"].createElement(emptyImage);
10806
+ var image = props.illustration ? illustration : getImageUrl(emptyImage);
10964
10807
  return /*#__PURE__*/React__default["default"].createElement(antd.Empty, {
10965
10808
  image: image,
10966
10809
  imageStyle: props.imageStyle,
10967
10810
  description: props.description
10968
10811
  });
10969
10812
  }
10813
+
10814
+ function getImageUrl(url) {
10815
+ var _window$CORE_ROOT;
10816
+
10817
+ return "".concat((_window$CORE_ROOT = window.CORE_ROOT) !== null && _window$CORE_ROOT !== void 0 ? _window$CORE_ROOT : "", "assets/").concat(url);
10818
+ }
10970
10819
  /**
10971
10820
  * 调用后获得一个默认的展示空数据的 React 组件。
10972
10821
  */
10973
10822
 
10823
+
10974
10824
  function renderEasyopsEmpty() {
10975
10825
  return /*#__PURE__*/React__default["default"].createElement(EasyopsEmpty, null);
10976
10826
  }