@zgfe/business-lib 1.2.66-hxd.2 → 1.2.70-hxd.10

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.
Files changed (70) hide show
  1. package/README.md +1 -1
  2. package/es/assets/iconfont/demo_index.html +348 -3
  3. package/es/assets/iconfont/iconfont.css +63 -3
  4. package/es/assets/iconfont/iconfont.js +8 -8
  5. package/es/assets/iconfont/iconfont.json +105 -0
  6. package/es/assets/iconfont/iconfont.ttf +0 -0
  7. package/es/assets/iconfont/iconfont.woff +0 -0
  8. package/es/assets/iconfont/iconfont.woff2 +0 -0
  9. package/es/assets/styles/resetAntd.less +20 -7
  10. package/es/attrCondition/useAttrCondition.js +4 -1
  11. package/es/attrConditions/components/operateList.js +4 -4
  12. package/es/attrConditions/components/valuesList.js +1 -1
  13. package/es/attrConditions/types.d.ts +1 -0
  14. package/es/attributeSelector/index.js +3 -1
  15. package/es/attributeSelector/listPanel.js +3 -3
  16. package/es/attributeSelector/types.d.ts +2 -0
  17. package/es/attributeSelector/util.js +4 -0
  18. package/es/chart/demo/data/data7.d.ts +54 -0
  19. package/es/chart/demo/data/data7.js +1527 -0
  20. package/es/chart/demo/stack.d.ts +3 -0
  21. package/es/chart/demo/stack.js +31 -0
  22. package/es/chart/index.js +16 -6
  23. package/es/chart/types.d.ts +4 -1
  24. package/es/chart/util/chartOptionConfig.d.ts +4 -3
  25. package/es/chart/util/chartOptionConfig.js +84 -4
  26. package/es/chart/util/formatData.d.ts +1 -0
  27. package/es/chart/util/formatData.js +13 -0
  28. package/es/cycleTime/index.js +1 -1
  29. package/es/datePicker/index.js +6 -6
  30. package/es/datePickerV2/index.js +6 -3
  31. package/es/datePickerV2/popoverContent.d.ts +1 -0
  32. package/es/datePickerV2/popoverContent.js +3 -1
  33. package/es/datePickerV2/shortcut.d.ts +2 -0
  34. package/es/datePickerV2/shortcut.js +4 -3
  35. package/es/datePickerV2/types.d.ts +2 -0
  36. package/es/datePickerV2/utils.d.ts +1 -1
  37. package/es/datePickerV2/utils.js +5 -5
  38. package/es/dnd/demo/styles/index.less +34 -34
  39. package/es/eventSelector/listPanel.js +1 -1
  40. package/es/hooks/useBizStore.js +5 -2
  41. package/es/index.d.ts +4 -1
  42. package/es/index.js +4 -1
  43. package/es/layout/optionTitle/components/btnMenu/index.less +18 -18
  44. package/es/layout/optionTitle/components/title/index.less +43 -43
  45. package/es/layout/optionTitle/styles/index.less +30 -30
  46. package/es/layout/optionTitle/styles/layout.less +90 -90
  47. package/es/layout/optionTitle/styles/search.less +27 -27
  48. package/es/productCondition/conditions/order/runPeriodCondition.js +1 -1
  49. package/es/productCondition/conditions/periodCondition.js +1 -1
  50. package/es/productCondition/conditions/runTimesCondition.js +1 -1
  51. package/es/select/index.js +9 -1
  52. package/es/select/types.d.ts +3 -2
  53. package/es/subjectWrapper/demo/index.d.ts +3 -0
  54. package/es/subjectWrapper/demo/index.js +28 -0
  55. package/es/subjectWrapper/index.d.ts +5 -0
  56. package/es/subjectWrapper/index.js +98 -0
  57. package/es/subjectWrapper/index.less +12 -0
  58. package/es/subjectWrapper/types.d.ts +14 -0
  59. package/es/subjectWrapper/types.js +4 -0
  60. package/es/userCondition/conditions/cdpCshCondition.js +0 -1
  61. package/es/userCondition/conditions/order/runPeriodCondition.js +1 -1
  62. package/es/userCondition/conditions/periodCondition.js +1 -1
  63. package/es/userCondition/conditions/runTimesCondition.js +1 -1
  64. package/es/userGroup/index.js +2 -2
  65. package/es/userGroupHeader/demo/index.js +1 -1
  66. package/es/utils/ajax.js +15 -2
  67. package/es/utils/type.d.ts +1 -0
  68. package/es/utils/util.d.ts +3 -0
  69. package/es/utils/util.js +10 -0
  70. package/package.json +62 -62
@@ -1,18 +1,18 @@
1
- @import '~@zgfe/business-lib/es/assets/styles/variable.less';
2
- .btn-menu {
3
- display: flex;
4
- align-items: center;
5
-
6
- &-btn {
7
- margin-right: 16px;
8
- border-radius: @border-radius-small;
9
- }
10
-
11
- &-divider {
12
- width: 1px;
13
- height: 32px;
14
- margin-right: 32px;
15
- margin-left: 16px;
16
- background-color: #ecedf0;
17
- }
18
- }
1
+ @import '~@zgfe/business-lib/es/assets/styles/variable.less';
2
+ .btn-menu {
3
+ display: flex;
4
+ align-items: center;
5
+
6
+ &-btn {
7
+ margin-right: 16px;
8
+ border-radius: @border-radius-small;
9
+ }
10
+
11
+ &-divider {
12
+ width: 1px;
13
+ height: 32px;
14
+ margin-right: 32px;
15
+ margin-left: 16px;
16
+ background-color: #ecedf0;
17
+ }
18
+ }
@@ -1,43 +1,43 @@
1
- @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
- .biz-edit-text {
3
- display: flex;
4
- align-items: center;
5
- &-input {
6
- position: relative;
7
- width: 350px;
8
- height: 100%;
9
- .ant-input {
10
- background-color: #fff !important;
11
- border-color: #fff;
12
- &:not(.ant-input-status-error):hover {
13
- border-color: @primary-color!important;
14
- }
15
- &:not(.ant-input-status-error):focus {
16
- border-color: @primary-color!important;
17
- }
18
- }
19
- }
20
- &-error-tip {
21
- position: absolute;
22
- top: 100%;
23
- left: 0;
24
- color: @error-color;
25
- line-height: 1.2;
26
- }
27
-
28
- &-content {
29
- display: inline-block;
30
- max-width: 330px;
31
- height: @height-sm;
32
- color: @text-color;
33
- font-weight: bold;
34
- font-size: 16px;
35
- line-height: @height-sm;
36
- .__default-overflow();
37
- }
38
- &-icon {
39
- margin-left: @margin-xs;
40
- color: @primary-color;
41
- cursor: pointer;
42
- }
43
- }
1
+ @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
+ .biz-edit-text {
3
+ display: flex;
4
+ align-items: center;
5
+ &-input {
6
+ position: relative;
7
+ width: 350px;
8
+ height: 100%;
9
+ .ant-input {
10
+ background-color: #fff !important;
11
+ border-color: #fff;
12
+ &:not(.ant-input-status-error):hover {
13
+ border-color: @primary-color!important;
14
+ }
15
+ &:not(.ant-input-status-error):focus {
16
+ border-color: @primary-color!important;
17
+ }
18
+ }
19
+ }
20
+ &-error-tip {
21
+ position: absolute;
22
+ top: 100%;
23
+ left: 0;
24
+ color: @error-color;
25
+ line-height: 1.2;
26
+ }
27
+
28
+ &-content {
29
+ display: inline-block;
30
+ max-width: 330px;
31
+ height: @height-sm;
32
+ color: @text-color;
33
+ font-weight: bold;
34
+ font-size: 16px;
35
+ line-height: @height-sm;
36
+ .__default-overflow();
37
+ }
38
+ &-icon {
39
+ margin-left: @margin-xs;
40
+ color: @primary-color;
41
+ cursor: pointer;
42
+ }
43
+ }
@@ -1,30 +1,30 @@
1
- @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
-
3
- .biz-layout-panel {
4
- width: 100%;
5
- height: 100%;
6
- & > .ant-spin-container {
7
- height: 100%;
8
- }
9
- /*更多按钮*/
10
- &-btn-more {
11
- width: @height-base;
12
- height: @height-base;
13
- color: @text-color-secondary;
14
- font-size: 16px;
15
- line-height: @height-base;
16
- text-align: center;
17
- border-radius: @border-radius-small;
18
- transform: rotate(90deg);
19
-
20
- &:hover {
21
- .__default-hover();
22
- }
23
- }
24
-
25
- &-content {
26
- width: 100%;
27
- height: 100%;
28
- overflow: auto;
29
- }
30
- }
1
+ @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
+
3
+ .biz-layout-panel {
4
+ width: 100%;
5
+ height: 100%;
6
+ & > .ant-spin-container {
7
+ height: 100%;
8
+ }
9
+ /*更多按钮*/
10
+ &-btn-more {
11
+ width: @height-base;
12
+ height: @height-base;
13
+ color: @text-color-secondary;
14
+ font-size: 16px;
15
+ line-height: @height-base;
16
+ text-align: center;
17
+ border-radius: @border-radius-small;
18
+ transform: rotate(90deg);
19
+
20
+ &:hover {
21
+ .__default-hover();
22
+ }
23
+ }
24
+
25
+ &-content {
26
+ width: 100%;
27
+ height: 100%;
28
+ overflow: auto;
29
+ }
30
+ }
@@ -1,90 +1,90 @@
1
- @import '~@zgfe/business-lib/es/assets/styles/variable.less';
2
-
3
- .biz-option-layout {
4
- height: 100%;
5
- border-radius: @border-radius-normal;
6
- &-header {
7
- display: flex;
8
- align-items: center;
9
- justify-content: space-between;
10
- width: 100%;
11
- height: 64px;
12
- padding: 0 16px;
13
- background-color: #fff;
14
- border-bottom: 1px solid @border-color-base;
15
-
16
- &-title {
17
- display: flex;
18
- align-items: center;
19
- &-text {
20
- margin-right: @margin-md;
21
- color: @text-color-secondary;
22
- }
23
- &-btn {
24
- color: @text-color-secondary;
25
- &:hover {
26
- color: @primary-color;
27
- }
28
- }
29
- &-icon {
30
- display: flex;
31
- align-items: center;
32
- justify-content: center;
33
- width: 20px;
34
- height: 20px;
35
- margin-left: 8px;
36
- color: #5f6085;
37
- font-size: 12px;
38
- background: #f2f3f4;
39
- border-radius: 10px;
40
- }
41
- &-icon:hover {
42
- color: #165dff;
43
- background: #e8efff;
44
- }
45
- }
46
- &-option {
47
- display: flex;
48
- flex: 1;
49
- flex-direction: row-reverse;
50
- align-items: center;
51
- justify-content: space-between;
52
- }
53
- }
54
-
55
- &-content {
56
- width: 100%;
57
- height: calc(100% - 64px);
58
- overflow: auto;
59
- }
60
-
61
- &-panel-content {
62
- z-index: 1000;
63
- width: 284px;
64
- max-height: 304px;
65
- padding: 0;
66
- overflow: auto;
67
- background: #fff;
68
- border-radius: 10px;
69
- box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.1);
70
- .ant-popover-arrow {
71
- display: none !important;
72
- }
73
- .ant-popover-inner-content {
74
- width: 100%;
75
- padding: 8px;
76
- }
77
- .ant-tabs {
78
- .ant-tabs-tab-btn {
79
- font-size: 16px;
80
- }
81
- .ant-tabs-nav {
82
- margin-bottom: 4px;
83
- padding-left: 45px;
84
- }
85
- .ant-tabs-nav::before {
86
- border: none !important;
87
- }
88
- }
89
- }
90
- }
1
+ @import '~@zgfe/business-lib/es/assets/styles/variable.less';
2
+
3
+ .biz-option-layout {
4
+ height: 100%;
5
+ border-radius: @border-radius-normal;
6
+ &-header {
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: space-between;
10
+ width: 100%;
11
+ height: 64px;
12
+ padding: 0 16px;
13
+ background-color: #fff;
14
+ border-bottom: 1px solid @border-color-base;
15
+
16
+ &-title {
17
+ display: flex;
18
+ align-items: center;
19
+ &-text {
20
+ margin-right: @margin-md;
21
+ color: @text-color-secondary;
22
+ }
23
+ &-btn {
24
+ color: @text-color-secondary;
25
+ &:hover {
26
+ color: @primary-color;
27
+ }
28
+ }
29
+ &-icon {
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ width: 20px;
34
+ height: 20px;
35
+ margin-left: 8px;
36
+ color: #5f6085;
37
+ font-size: 12px;
38
+ background: #f2f3f4;
39
+ border-radius: 10px;
40
+ }
41
+ &-icon:hover {
42
+ color: #165dff;
43
+ background: #e8efff;
44
+ }
45
+ }
46
+ &-option {
47
+ display: flex;
48
+ flex: 1;
49
+ flex-direction: row-reverse;
50
+ align-items: center;
51
+ justify-content: space-between;
52
+ }
53
+ }
54
+
55
+ &-content {
56
+ width: 100%;
57
+ height: calc(100% - 64px);
58
+ overflow: auto;
59
+ }
60
+
61
+ &-panel-content {
62
+ z-index: 1000;
63
+ width: 284px;
64
+ max-height: 304px;
65
+ padding: 0;
66
+ overflow: auto;
67
+ background: #fff;
68
+ border-radius: 10px;
69
+ box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.1);
70
+ .ant-popover-arrow {
71
+ display: none !important;
72
+ }
73
+ .ant-popover-inner-content {
74
+ width: 100%;
75
+ padding: 8px;
76
+ }
77
+ .ant-tabs {
78
+ .ant-tabs-tab-btn {
79
+ font-size: 16px;
80
+ }
81
+ .ant-tabs-nav {
82
+ margin-bottom: 4px;
83
+ padding-left: 45px;
84
+ }
85
+ .ant-tabs-nav::before {
86
+ border: none !important;
87
+ }
88
+ }
89
+ }
90
+ }
@@ -1,27 +1,27 @@
1
- @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
-
3
- .search-title {
4
- display: flex;
5
- align-items: center;
6
- height: 24px;
7
- transition: all 0.3s;
8
-
9
- &-title {
10
- margin-right: 15px;
11
- }
12
-
13
- &-input {
14
- min-width: 100px;
15
- max-width: 200px;
16
- height: 24px;
17
- background-color: #fff !important;
18
- .ant-input {
19
- background-color: #fff !important;
20
- }
21
- }
22
-
23
- &-icon {
24
- color: #5f6085;
25
- font-size: 12px;
26
- }
27
- }
1
+ @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
+
3
+ .search-title {
4
+ display: flex;
5
+ align-items: center;
6
+ height: 24px;
7
+ transition: all 0.3s;
8
+
9
+ &-title {
10
+ margin-right: 15px;
11
+ }
12
+
13
+ &-input {
14
+ min-width: 100px;
15
+ max-width: 200px;
16
+ height: 24px;
17
+ background-color: #fff !important;
18
+ .ant-input {
19
+ background-color: #fff !important;
20
+ }
21
+ }
22
+
23
+ &-icon {
24
+ color: #5f6085;
25
+ font-size: 12px;
26
+ }
27
+ }
@@ -26,7 +26,7 @@ var RunPeriodCondition = function RunPeriodCondition(props) {
26
26
  }];
27
27
  function onOperatorChange(option) {
28
28
  var newData = {
29
- operator: option.value
29
+ operator: option === null || option === void 0 ? void 0 : option.value
30
30
  };
31
31
  if (newData.operator === 'absolute') {
32
32
  var endDate = moment().format('YYYY-MM-DD');
@@ -38,7 +38,7 @@ var PeriodCondition = function PeriodCondition(props) {
38
38
  }
39
39
  function onOperatorChange(option) {
40
40
  var newData = {
41
- operator: option.value
41
+ operator: option === null || option === void 0 ? void 0 : option.value
42
42
  };
43
43
  if (newData.operator === 'absolute') {
44
44
  var endDate = moment().format('YYYY-MM-DD');
@@ -34,7 +34,7 @@ var RunTimesCondition = function RunTimesCondition(props) {
34
34
  onChange = props.onChange;
35
35
  function onOperatorChange(data) {
36
36
  onChange(_objectSpread(_objectSpread({}, runTimes), {}, {
37
- operator: data.value
37
+ operator: data === null || data === void 0 ? void 0 : data.value
38
38
  }));
39
39
  }
40
40
  function onValueChange(e) {
@@ -1,5 +1,5 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["overlayWidth", "minDropdownWidth", "labelField", "aliasField", "keyField"];
2
+ var _excluded = ["overlayWidth", "minDropdownWidth", "labelField", "aliasField", "keyField", "enableClear"];
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -27,6 +27,7 @@ var BizSelect = function BizSelect(props) {
27
27
  labelField = props.labelField,
28
28
  aliasField = props.aliasField,
29
29
  keyField = props.keyField,
30
+ enableClear = props.enableClear,
30
31
  res = _objectWithoutProperties(props, _excluded);
31
32
  var _useState = useState(),
32
33
  _useState2 = _slicedToArray(_useState, 2),
@@ -147,6 +148,12 @@ var BizSelect = function BizSelect(props) {
147
148
  setVisible(true);
148
149
  props.onVisibleChange && props.onVisibleChange(true);
149
150
  };
151
+ var onSelectDelete = function onSelectDelete() {
152
+ if (enableClear) {
153
+ setCurrent(undefined);
154
+ if (props.onChange) props.onChange(undefined);
155
+ }
156
+ };
150
157
  return /*#__PURE__*/React.createElement(Dropdown, {
151
158
  dropdownRender: function dropdownRender() {
152
159
  return /*#__PURE__*/React.createElement(SelectOverlay, _objectSpread(_objectSpread({}, res), {}, {
@@ -197,6 +204,7 @@ var BizSelect = function BizSelect(props) {
197
204
  setSearchValue(v);
198
205
  if (props.onSearch) props.onSearch(v);
199
206
  },
207
+ onSelectDelete: enableClear ? onSelectDelete : undefined,
200
208
  onCreate: onCreate,
201
209
  onVisible: onVisible,
202
210
  disableItemList: props.disableItemList
@@ -13,7 +13,7 @@ export declare namespace BizSelectTypes {
13
13
  disable?: boolean;
14
14
  placeholder?: string;
15
15
  defaultValue?: Option | Option[];
16
- value?: Option | Option[];
16
+ value?: Option | Option[] | undefined;
17
17
  className?: string;
18
18
  type?: 'group' | 'normal';
19
19
  theme?: 'secondary' | 'borderless';
@@ -42,7 +42,8 @@ export declare namespace BizSelectTypes {
42
42
  showSelectIcon?: boolean;
43
43
  loading?: boolean;
44
44
  status?: string;
45
- onChange?: (val: Option) => void;
45
+ enableClear?: boolean;
46
+ onChange?: (val: Option | any) => void;
46
47
  onVisibleChange?: (visible: boolean) => void;
47
48
  destroyPopupOnHide?: boolean;
48
49
  customLabel?: (node: ReactNode, option: Option) => ReactNode;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: () => React.JSX.Element;
3
+ export default _default;
@@ -0,0 +1,28 @@
1
+ import React, { useContext } from 'react';
2
+ import { SubjectWrapper, BizGlobalDataContext, useChanged } from '@zgfe/business-lib';
3
+ function Test() {
4
+ var _useContext = useContext(BizGlobalDataContext),
5
+ currentApp = _useContext.currentApp,
6
+ currentProject = _useContext.currentProject;
7
+ useChanged(function () {
8
+ console.log('currentApp changed', currentApp);
9
+ }, currentApp);
10
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
11
+ style: {
12
+ margin: '20px',
13
+ padding: '20px 20px 10px 20px',
14
+ background: 'pink'
15
+ }
16
+ }, /*#__PURE__*/React.createElement("p", null, " \u5F53\u524D\u5E94\u7528\u540D\u79F0: ", currentProject === null || currentProject === void 0 ? void 0 : currentProject.projectName), /*#__PURE__*/React.createElement("p", null, " \u5F53\u524D\u5E94\u7528id: ", currentProject === null || currentProject === void 0 ? void 0 : currentProject.projectId)), /*#__PURE__*/React.createElement("div", {
17
+ style: {
18
+ margin: '20px',
19
+ padding: '20px 20px 10px 20px',
20
+ background: '#FFEB3B'
21
+ }
22
+ }, /*#__PURE__*/React.createElement("p", null, " \u5F53\u524D\u4E3B\u4F53\u540D\u79F0: ", currentApp === null || currentApp === void 0 ? void 0 : currentApp.appName), /*#__PURE__*/React.createElement("p", null, " \u5F53\u524D\u4E3B\u4F53id: ", currentApp === null || currentApp === void 0 ? void 0 : currentApp.id)));
23
+ }
24
+ export default (function () {
25
+ return /*#__PURE__*/React.createElement(SubjectWrapper, {
26
+ needMeta: true
27
+ }, /*#__PURE__*/React.createElement(Test, null));
28
+ });
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import DemoWrapperTypes from './types';
3
+ import './index.less';
4
+ declare const SubjectWrapper: React.FC<DemoWrapperTypes.Props>;
5
+ export default SubjectWrapper;
@@ -0,0 +1,98 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import { Spin } from 'antd';
14
+ import BizGlobalDataContext from '../context';
15
+ import React, { useEffect, useState, useContext, Fragment } from 'react';
16
+ import useBizStore from '../hooks/useBizStore';
17
+ import './index.less';
18
+ var SubjectWrapper = function SubjectWrapper(_ref) {
19
+ var children = _ref.children,
20
+ className = _ref.className,
21
+ defaultApp = _ref.defaultApp,
22
+ needMeta = _ref.needMeta,
23
+ contextProps = _ref.contextProps;
24
+ if (!needMeta || defaultApp === undefined) {
25
+ return /*#__PURE__*/React.createElement(Fragment, null, children);
26
+ }
27
+ var globalData = useContext(BizGlobalDataContext);
28
+ var _useState = useState(true),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ loading = _useState2[0],
31
+ setLoading = _useState2[1];
32
+ var _useState3 = useState(globalData.currentApp),
33
+ _useState4 = _slicedToArray(_useState3, 2),
34
+ currentApp = _useState4[0],
35
+ setCurrentApp = _useState4[1];
36
+ var _useBizStore = useBizStore({
37
+ currentApp: currentApp
38
+ }),
39
+ useBizStoreLoading = _useBizStore.useBizStoreLoading,
40
+ eventGroupList = _useBizStore.eventGroupList,
41
+ userPropList = _useBizStore.userPropList,
42
+ envPropList = _useBizStore.envPropList,
43
+ eventNameMap = _useBizStore.eventNameMap,
44
+ eventIdMap = _useBizStore.eventIdMap,
45
+ userGroupList = _useBizStore.userGroupList,
46
+ groupLoading = _useBizStore.groupLoading,
47
+ setUserGroupList = _useBizStore.setUserGroupList,
48
+ tagList = _useBizStore.tagList,
49
+ tagLoading = _useBizStore.tagLoading,
50
+ setTagList = _useBizStore.setTagList,
51
+ queryGroups = _useBizStore.queryGroups,
52
+ queryTags = _useBizStore.queryTags;
53
+ useEffect(function () {
54
+ appInfo(globalData.projectList);
55
+ }, [defaultApp]);
56
+ var appInfo = function appInfo(data) {
57
+ var hasDefaultApp = false;
58
+ if (defaultApp) {
59
+ data.map(function (item) {
60
+ item.appList.map(function (_item) {
61
+ if (defaultApp === _item.id) {
62
+ hasDefaultApp = true;
63
+ setCurrentApp(_item);
64
+ }
65
+ });
66
+ });
67
+ } else {
68
+ setCurrentApp(data[0].appList[0]);
69
+ }
70
+ if (!hasDefaultApp) {
71
+ setCurrentApp(data[0].appList[0]);
72
+ }
73
+ setLoading(false);
74
+ };
75
+ return /*#__PURE__*/React.createElement("div", {
76
+ className: "lib-subjectWrapper ".concat(className, " ").concat(useBizStoreLoading ? 'lib-subjectWrapper-loading' : '')
77
+ }, (useBizStoreLoading || loading) && /*#__PURE__*/React.createElement(Spin, null), !(useBizStoreLoading || loading) && /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
78
+ value: _objectSpread(_objectSpread({}, globalData), {}, {
79
+ currentApp: _objectSpread(_objectSpread({}, currentApp), {}, {
80
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.id
81
+ }),
82
+ eventGroupList: eventGroupList,
83
+ userPropList: userPropList,
84
+ eventEnvList: envPropList,
85
+ eventIdMap: eventIdMap,
86
+ eventNameMap: eventNameMap,
87
+ userGroupList: userGroupList,
88
+ groupLoading: groupLoading,
89
+ setUserGroupList: setUserGroupList,
90
+ tagList: tagList,
91
+ tagLoading: tagLoading,
92
+ setTagList: setTagList,
93
+ queryGroups: queryGroups,
94
+ queryTags: queryTags
95
+ }, contextProps)
96
+ }, children));
97
+ };
98
+ export default SubjectWrapper;
@@ -0,0 +1,12 @@
1
+ @import '~antd/dist/antd.less';
2
+ @import '../assets/iconfont/iconfont.css';
3
+ @import '../assets/styles/resetAntd.less';
4
+ .lib-subjectWrapper {
5
+ width: 100%;
6
+ height: 100%;
7
+ &-loading {
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ }
12
+ }