@zgfe/business-lib 1.0.7 → 1.0.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 (73) hide show
  1. package/es/addToPanel/components/addPanel.d.ts +7 -0
  2. package/es/addToPanel/components/addPanel.js +101 -0
  3. package/es/addToPanel/components/radioGroup.d.ts +7 -0
  4. package/es/addToPanel/components/radioGroup.js +29 -0
  5. package/es/addToPanel/components/styleList.d.ts +5 -0
  6. package/es/{dialog/components/tab.js → addToPanel/components/styleList.js} +10 -6
  7. package/es/{dialog/demo/index2.d.ts → addToPanel/demo/edit.d.ts} +0 -0
  8. package/es/{dialog/components/list.js → addToPanel/demo/edit.js} +63 -44
  9. package/es/{dialog/demo/index3.d.ts → addToPanel/demo/index.d.ts} +0 -0
  10. package/es/addToPanel/demo/index.js +78 -0
  11. package/es/addToPanel/index.d.ts +6 -0
  12. package/es/addToPanel/index.js +233 -0
  13. package/es/addToPanel/styles/addPanel.less +25 -0
  14. package/es/addToPanel/styles/index.less +6 -0
  15. package/es/{dialog/components/styles/tab.less → addToPanel/styles/style.less} +7 -2
  16. package/es/addToPanel/types.d.ts +56 -0
  17. package/es/addToPanel/types.js +1 -0
  18. package/es/addToScene/addGroup.d.ts +11 -0
  19. package/es/addToScene/addGroup.js +34 -0
  20. package/es/addToScene/demo/index.d.ts +2 -0
  21. package/es/addToScene/demo/index.js +34 -0
  22. package/es/addToScene/index.d.ts +6 -0
  23. package/es/addToScene/index.js +187 -0
  24. package/es/addToScene/styles/index.less +23 -0
  25. package/es/addToScene/types.d.ts +29 -0
  26. package/es/addToScene/types.js +1 -0
  27. package/es/analysisLayout/demo/index.js +6 -1
  28. package/es/analysisLayout/index.d.ts +1 -0
  29. package/es/analysisLayout/index.js +1 -0
  30. package/es/assets/styles/chunks.less +14 -2
  31. package/es/attrConditions/components/stringList.js +3 -3
  32. package/es/attrConditions/demo/group.js +2 -2
  33. package/es/attrConditions/demo/index.js +1 -1
  34. package/es/attrConditions/index.js +2 -2
  35. package/es/attrConditions/types.d.ts +1 -1
  36. package/es/attributeSelector/demo/index.js +1 -1
  37. package/es/attributeSelector/index.js +12 -2
  38. package/es/attributeSelector/styles/index.less +0 -1
  39. package/es/chart/demo/index.js +36 -4
  40. package/es/chart/index.d.ts +1 -1
  41. package/es/chart/index.js +16 -5
  42. package/es/constants/apis.d.ts +8 -0
  43. package/es/constants/apis.js +8 -0
  44. package/es/dialog/demo/index.d.ts +0 -23
  45. package/es/dialog/demo/index.js +6 -129
  46. package/es/dialog/index.d.ts +1 -2
  47. package/es/dialog/index.js +14 -183
  48. package/es/dialog/types.d.ts +2 -74
  49. package/es/index.d.ts +3 -1
  50. package/es/index.js +3 -1
  51. package/es/select/index.js +4 -2
  52. package/es/select/overlay.js +3 -1
  53. package/es/select/styles/handle.less +1 -0
  54. package/es/select/types.d.ts +2 -0
  55. package/es/targetConditionGroup/demo/index.js +1 -1
  56. package/es/userCondition/conditions/propCondition.js +3 -3
  57. package/es/userGroup/demo/index.js +4 -1
  58. package/es/userGroup/index.js +1 -1
  59. package/es/utils/ajax.d.ts +21 -7
  60. package/es/utils/ajax.js +205 -111
  61. package/package.json +3 -2
  62. package/es/dialog/components/itemNode.d.ts +0 -10
  63. package/es/dialog/components/itemNode.js +0 -109
  64. package/es/dialog/components/list.d.ts +0 -5
  65. package/es/dialog/components/selectToInput.d.ts +0 -6
  66. package/es/dialog/components/selectToInput.js +0 -175
  67. package/es/dialog/components/styles/handle.less +0 -39
  68. package/es/dialog/components/styles/list.less +0 -60
  69. package/es/dialog/components/tab.d.ts +0 -5
  70. package/es/dialog/data/data.d.ts +0 -20
  71. package/es/dialog/data/data.js +0 -73
  72. package/es/dialog/demo/index2.js +0 -109
  73. package/es/dialog/demo/index3.js +0 -61
@@ -1,6 +1,6 @@
1
- @import '../../../assets/styles/inner.less';
1
+ @import '../../assets/styles/inner.less';
2
2
 
3
- .biz-tab {
3
+ .biz-style {
4
4
  display: flex;
5
5
  color: @text-color-secondary;
6
6
 
@@ -45,6 +45,7 @@
45
45
  margin-right: 7px;
46
46
  font-size: 18px;
47
47
  }
48
+
48
49
  &-radio-icon {
49
50
  font-size: 18px;
50
51
  }
@@ -53,3 +54,7 @@
53
54
  .__select-panel();
54
55
  }
55
56
  }
57
+
58
+ .ant-radio-wrapper {
59
+ margin-right: 0;
60
+ }
@@ -0,0 +1,56 @@
1
+ declare namespace AddToPanel {
2
+ export interface Option {
3
+ label: string;
4
+ value: string;
5
+ }
6
+ export interface PanelOption {
7
+ id: number;
8
+ name: string;
9
+ [prop: string]: any;
10
+ }
11
+ export interface Props {
12
+ defaultValue?: Value;
13
+ params: Record<string, any>;
14
+ type?: string;
15
+ styleOptions: TabItem[];
16
+ showOptions?: Option[];
17
+ showList?: string[];
18
+ onOk?: () => void;
19
+ onCancel?: () => void;
20
+ }
21
+ interface PanelValue {
22
+ id: number;
23
+ name: string;
24
+ open_type: number;
25
+ }
26
+ export interface Value {
27
+ panel: PanelValue;
28
+ name: string;
29
+ chartType: string;
30
+ showList?: 'dynamic' | 'fix';
31
+ }
32
+ export interface AddPanelParam {
33
+ appId: number;
34
+ platform: number;
35
+ name: string;
36
+ panelId: number;
37
+ panelName: string;
38
+ openType: number;
39
+ webData: Record<string, any>;
40
+ mobileData: Record<string, any>;
41
+ }
42
+ export interface StyleProps {
43
+ value?: string;
44
+ options?: Array<TabItem>;
45
+ onChange?: (value: string) => void;
46
+ }
47
+ export interface TabItemChild extends Option {
48
+ icon: string;
49
+ disabled?: boolean;
50
+ }
51
+ export interface TabItem extends TabItemChild {
52
+ children?: Array<TabItemChild>;
53
+ }
54
+ export {};
55
+ }
56
+ export default AddToPanel;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface Val {
3
+ groupName: string;
4
+ groupId: number;
5
+ }
6
+ declare const AddGroup: React.FC<{
7
+ value?: Val;
8
+ onChange?: (val: Val) => void;
9
+ onBack: () => void;
10
+ }>;
11
+ export default AddGroup;
@@ -0,0 +1,34 @@
1
+ import { Button, Input } from 'antd';
2
+ import React from 'react';
3
+ import { classPrefix } from '.';
4
+ import IconFont from '../icon/iconFont';
5
+
6
+ var AddGroup = function AddGroup(props) {
7
+ var onBack = props.onBack;
8
+
9
+ function onInput(e) {
10
+ e.persist();
11
+ if (props.onChange) props.onChange({
12
+ groupName: e.target.value,
13
+ groupId: 0
14
+ });
15
+ }
16
+
17
+ return /*#__PURE__*/React.createElement("div", {
18
+ className: "".concat(classPrefix, "-addgroup")
19
+ }, /*#__PURE__*/React.createElement(Input, {
20
+ placeholder: "\u6DFB\u52A0\u5206\u7C7B",
21
+ autoFocus: true,
22
+ onInput: onInput,
23
+ allowClear: true
24
+ }), /*#__PURE__*/React.createElement(Button, {
25
+ onClick: onBack,
26
+ icon: /*#__PURE__*/React.createElement(IconFont, {
27
+ type: "shurukuang_fanhui"
28
+ }),
29
+ className: "btn-back",
30
+ type: "ghost"
31
+ }));
32
+ };
33
+
34
+ export default AddGroup;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => JSX.Element;
2
+ export default _default;
@@ -0,0 +1,34 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ 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."); }
4
+
5
+ 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); }
6
+
7
+ 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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ import { Button } from 'antd';
14
+ import React, { useState } from 'react';
15
+ import { BizAddToScene } from '@zgfe/business-lib';
16
+ export default (function () {
17
+ var _useState = useState(false),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ showDialog = _useState2[0],
20
+ setShowDialog = _useState2[1];
21
+
22
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
23
+ onClick: function onClick() {
24
+ setShowDialog(true);
25
+ }
26
+ }, "\u6DFB\u52A0\u5E38\u7528\u573A\u666F"), showDialog && /*#__PURE__*/React.createElement(BizAddToScene, {
27
+ onOk: function onOk() {
28
+ setShowDialog(false);
29
+ },
30
+ onCancel: function onCancel() {
31
+ setShowDialog(false);
32
+ }
33
+ }));
34
+ });
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import AddToScene from './types';
3
+ import './styles/index.less';
4
+ export declare const classPrefix = "biz-addtoscene";
5
+ declare const BizAddToScene: React.FC<AddToScene.Props>;
6
+ export default BizAddToScene;
@@ -0,0 +1,187 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ 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."); }
4
+
5
+ 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); }
6
+
7
+ 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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ import { Button, Form, Input, notification } from 'antd';
14
+ import React, { useContext, useEffect, useRef, useState } from 'react';
15
+ import BizDialog from '../dialog';
16
+ import BizSelect from '../select';
17
+ import './styles/index.less';
18
+ import AddGroup from './addGroup';
19
+ import BizGlobalDataContext from '../context';
20
+ import Apis from '../constants/apis';
21
+ import request from '../utils/ajax';
22
+ import IconFont from '../icon/iconFont';
23
+ export var classPrefix = 'biz-addtoscene';
24
+
25
+ var BizAddToScene = function BizAddToScene(props) {
26
+ var params = props.params;
27
+
28
+ var _useState = useState([]),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ groupList = _useState2[0],
31
+ setGroupList = _useState2[1];
32
+
33
+ var _useState3 = useState(false),
34
+ _useState4 = _slicedToArray(_useState3, 2),
35
+ addMode = _useState4[0],
36
+ setAddMode = _useState4[1];
37
+
38
+ var _useState5 = useState(false),
39
+ _useState6 = _slicedToArray(_useState5, 2),
40
+ loading = _useState6[0],
41
+ setLoading = _useState6[1];
42
+
43
+ var _useContext = useContext(BizGlobalDataContext),
44
+ currentApp = _useContext.currentApp;
45
+
46
+ var refForm = useRef();
47
+
48
+ function toAddGroup() {
49
+ var _refForm$current;
50
+
51
+ (_refForm$current = refForm.current) === null || _refForm$current === void 0 ? void 0 : _refForm$current.resetFields(['group']);
52
+ setAddMode(true);
53
+ }
54
+
55
+ function onBack() {
56
+ var _refForm$current2;
57
+
58
+ (_refForm$current2 = refForm.current) === null || _refForm$current2 === void 0 ? void 0 : _refForm$current2.resetFields(['group']);
59
+ setAddMode(false);
60
+ }
61
+
62
+ function onSave() {
63
+ var _refForm$current3;
64
+
65
+ (_refForm$current3 = refForm.current) === null || _refForm$current3 === void 0 ? void 0 : _refForm$current3.submit();
66
+ }
67
+
68
+ function onCancel() {
69
+ if (props.onCancel) props.onCancel();
70
+ }
71
+
72
+ function onSubmit(form) {
73
+ setLoading(true);
74
+ var data = {
75
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
76
+ platform: 0,
77
+ groupId: form.group.groupId,
78
+ groupName: form.group.groupName,
79
+ json: params,
80
+ name: form.name
81
+ };
82
+ request(Apis.addScene, {
83
+ method: 'post',
84
+ data: data
85
+ }).then(function (res) {
86
+ setLoading(false);
87
+ var result = res;
88
+
89
+ if (result.code === 10001) {
90
+ notification.success({
91
+ message: '添加成功'
92
+ });
93
+ if (props.onOk) props.onOk();
94
+ } else if (result.code === -10010) {
95
+ notification.error({
96
+ message: '添加失败',
97
+ description: data.groupId === 0 ? '场景分类已存在' : '场景名称已存在'
98
+ });
99
+ } else {
100
+ notification.error({
101
+ message: '添加失败'
102
+ });
103
+ }
104
+ }).catch(function () {
105
+ setLoading(false);
106
+ });
107
+ }
108
+
109
+ function queryGroups() {
110
+ request(Apis.querySceneGroup, {
111
+ method: 'post',
112
+ data: {
113
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
114
+ platform: 0
115
+ }
116
+ }).then(function (res) {
117
+ if (!res) {
118
+ notification.error({
119
+ message: '获取常用场景分类列表失败'
120
+ });
121
+ return;
122
+ }
123
+
124
+ setGroupList(res.groups);
125
+ });
126
+ }
127
+
128
+ useEffect(function () {
129
+ queryGroups();
130
+ }, []);
131
+ return /*#__PURE__*/React.createElement(BizDialog, {
132
+ title: "\u6DFB\u52A0\u5230\u5E38\u7528\u573A\u666F",
133
+ visible: true,
134
+ onOk: onSave,
135
+ onCancel: onCancel,
136
+ confirmLoading: loading
137
+ }, /*#__PURE__*/React.createElement(Form, {
138
+ autoComplete: "off",
139
+ ref: refForm,
140
+ onFinish: onSubmit,
141
+ requiredMark: false
142
+ }, /*#__PURE__*/React.createElement(Form.Item, {
143
+ label: "\u573A\u666F\u5206\u7C7B",
144
+ name: "group",
145
+ rules: [{
146
+ validator: function validator(_, value) {
147
+ if (!value || !/\S+/.test(value.groupName)) return Promise.reject("\u8BF7".concat(addMode ? '输入' : '选择', "\u573A\u666F\u5206\u7C7B!"));
148
+ if (!/^[\S\s]{1,20}$/.test(value.groupName)) return Promise.reject('场景分类最多为20个字符!');
149
+ return Promise.resolve();
150
+ }
151
+ }]
152
+ }, addMode ? /*#__PURE__*/React.createElement(AddGroup, {
153
+ onBack: onBack
154
+ }) : /*#__PURE__*/React.createElement(BizSelect, {
155
+ options: groupList,
156
+ enableSearch: true,
157
+ keyField: "groupId",
158
+ labelField: "groupName",
159
+ dropdownExtra: /*#__PURE__*/React.createElement(Button, {
160
+ className: "".concat(classPrefix, "-btn-add"),
161
+ type: "ghost",
162
+ onClick: toAddGroup
163
+ }, /*#__PURE__*/React.createElement(IconFont, {
164
+ className: "".concat(classPrefix, "-icon-add"),
165
+ type: 'tianjia1'
166
+ }), " \u6DFB\u52A0\u5206\u7C7B")
167
+ })), /*#__PURE__*/React.createElement(Form.Item, {
168
+ label: "\u573A\u666F\u540D\u79F0",
169
+ name: "name",
170
+ rules: [{
171
+ validator: function validator(_, value) {
172
+ if (!value || !/\S+/.test(value)) return Promise.reject('请输入场景名称!');
173
+ if (!/^[\S\s]{1,20}$/.test(value)) return Promise.reject('场景名称最多为20个字符!');
174
+ return Promise.resolve();
175
+ }
176
+ }]
177
+ }, /*#__PURE__*/React.createElement(Input, {
178
+ placeholder: "\u573A\u666F\u540D\u79F0",
179
+ allowClear: {
180
+ clearIcon: /*#__PURE__*/React.createElement(IconFont, {
181
+ type: 'qingchu'
182
+ })
183
+ }
184
+ }))));
185
+ };
186
+
187
+ export default BizAddToScene;
@@ -0,0 +1,23 @@
1
+ @import '../../assets/styles/inner.less';
2
+
3
+ .biz-addtoscene {
4
+ &-btn-add {
5
+ .__text-btn();
6
+ }
7
+
8
+ &-addgroup {
9
+ display: flex;
10
+ flex-direction: row;
11
+ align-items: center;
12
+
13
+ .ant-input {
14
+ flex: 1;
15
+ }
16
+
17
+ .btn-back {
18
+ flex: none;
19
+ border: none;
20
+ box-shadow: none;
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,29 @@
1
+ declare namespace AddToScene {
2
+ interface Props {
3
+ params: Record<string, any>;
4
+ onOk?: () => void;
5
+ onCancel?: () => void;
6
+ }
7
+ interface Scene {
8
+ groupId: number;
9
+ id: number;
10
+ json: Record<string, any>;
11
+ name: string;
12
+ }
13
+ interface Group {
14
+ appId: number;
15
+ groupId: number;
16
+ groupName: string;
17
+ platform: number;
18
+ scenes: Scene;
19
+ }
20
+ interface AddSceneParam {
21
+ appId: number;
22
+ platform: number;
23
+ groupId: number;
24
+ groupName?: string;
25
+ name: string;
26
+ json: Record<string, any>;
27
+ }
28
+ }
29
+ export default AddToScene;
@@ -0,0 +1 @@
1
+ export {};
@@ -19,12 +19,17 @@ var RightContent = function RightContent() {
19
19
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", null, "right"));
20
20
  };
21
21
 
22
+ var onCollapse = function onCollapse(flag) {
23
+ console.log('是否收起', flag);
24
+ };
25
+
22
26
  var LayoutDemo = function LayoutDemo() {
23
27
  return /*#__PURE__*/React.createElement("div", {
24
28
  className: "root"
25
29
  }, /*#__PURE__*/React.createElement(BizAnalysisLayout, {
26
30
  leftPanel: /*#__PURE__*/React.createElement(LeftContent, null),
27
- leftHandle: /*#__PURE__*/React.createElement(Footer, null)
31
+ leftHandle: /*#__PURE__*/React.createElement(Footer, null),
32
+ onCollapse: onCollapse
28
33
  }, /*#__PURE__*/React.createElement(RightContent, null)));
29
34
  };
30
35
 
@@ -9,6 +9,7 @@ declare type AnalysisLayoutProps = {
9
9
  defaultLeftWidth?: number;
10
10
  minWidthOfLeft?: number;
11
11
  maxWidthOfLeft?: number;
12
+ onCollapse?: (flag: boolean) => void;
12
13
  };
13
14
  declare const BizAnalysisLayout: React.FC<AnalysisLayoutProps>;
14
15
  export default BizAnalysisLayout;
@@ -77,6 +77,7 @@ var BizAnalysisLayout = function BizAnalysisLayout(props) {
77
77
  };
78
78
 
79
79
  function onCollapse() {
80
+ if (props.onCollapse) props.onCollapse(showLeft);
80
81
  setShowLeft(function (show) {
81
82
  setWidth(show ? 56 : minWidthOfLeft);
82
83
  return !show;
@@ -42,7 +42,7 @@
42
42
  border-radius: @border-radius-normal;
43
43
  .__default-overflow();
44
44
 
45
- &:hover {
45
+ &:not(.disabled, .active):hover {
46
46
  .__default-hover();
47
47
  }
48
48
 
@@ -51,7 +51,7 @@
51
51
  background: @primary-color;
52
52
  }
53
53
 
54
- &.disabled {
54
+ &:not(.active).disabled {
55
55
  color: @disabled-color;
56
56
  cursor: not-allowed;
57
57
 
@@ -141,3 +141,15 @@
141
141
  }
142
142
  }
143
143
  }
144
+
145
+ // 文字按钮
146
+ .__text-btn {
147
+ width: fit-content;
148
+ padding: 2px 4px;
149
+ border: none;
150
+ border-radius: @border-radius-small;
151
+
152
+ &:hover {
153
+ .__default-hover();
154
+ }
155
+ }
@@ -17,9 +17,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  import React, { useContext, useEffect, useState } from 'react';
18
18
  import { classPrefix } from '..';
19
19
  import { PropCategory } from '../../attributeSelector/types';
20
+ import Apis from '../../constants/apis';
20
21
  import BizGlobalDataContext from '../../context';
21
22
  import BizSelect from '../../select';
22
- import { ajax } from '../../utils';
23
+ import request from '../../utils/ajax';
23
24
  import { OperateTypes } from '../types';
24
25
 
25
26
  var StringList = function StringList(props) {
@@ -99,8 +100,7 @@ var StringList = function StringList(props) {
99
100
  };
100
101
 
101
102
  formData = transformRequest(requestData);
102
- ajax({
103
- url: '/data/queryEsData.jsp',
103
+ request(Apis.esQuery, {
104
104
  data: formData,
105
105
  headers: {
106
106
  'Content-Type': 'application/x-www-form-urlencoded'
@@ -19,7 +19,7 @@ import { Button } from 'antd';
19
19
  var conditions = [{
20
20
  propCategory: 'userProp',
21
21
  type: 2,
22
- operation: 'gt',
22
+ operator: 'gt',
23
23
  values: ['25200', '1'],
24
24
  attrName: 'duration',
25
25
  category: 'fixed',
@@ -27,7 +27,7 @@ var conditions = [{
27
27
  }, {
28
28
  propCategory: 'eventProp',
29
29
  type: 1,
30
- operation: 'equal',
30
+ operator: 'equal',
31
31
  values: ['Safari', 'Apple WebKit'],
32
32
  attrId: 30183426
33
33
  }];
@@ -25,7 +25,7 @@ export default (function () {
25
25
  condition: {
26
26
  propCategory: 'userProp',
27
27
  type: 2,
28
- operation: 'lt',
28
+ operator: 'lt',
29
29
  values: ['25200', '1'],
30
30
  subtype: 2,
31
31
  attrName: 'duration',
@@ -35,7 +35,7 @@ var BizConditionItem = function BizConditionItem(props) {
35
35
  attr = _useState2[0],
36
36
  setAttr = _useState2[1];
37
37
 
38
- var _useState3 = useState(((_props$defaultValue = props.defaultValue) === null || _props$defaultValue === void 0 ? void 0 : _props$defaultValue.operation) || ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.operation)),
38
+ var _useState3 = useState(((_props$defaultValue = props.defaultValue) === null || _props$defaultValue === void 0 ? void 0 : _props$defaultValue.operator) || ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.operator)),
39
39
  _useState4 = _slicedToArray(_useState3, 2),
40
40
  operate = _useState4[0],
41
41
  setOperate = _useState4[1];
@@ -94,7 +94,7 @@ var BizConditionItem = function BizConditionItem(props) {
94
94
  var responseData = {
95
95
  propCategory: attr.propCategory,
96
96
  type: attr.type,
97
- operation: operate,
97
+ operator: operate,
98
98
  values: values || []
99
99
  };
100
100
 
@@ -15,7 +15,7 @@ export declare namespace AttrConditionTypes {
15
15
  type?: PropType;
16
16
  propCategory?: 'userProp' | 'eventProp' | 'envProp';
17
17
  category?: 'fixed' | 'custom';
18
- operation?: string;
18
+ operator?: string;
19
19
  values?: string[];
20
20
  }
21
21
  interface GroupValue {
@@ -51,7 +51,7 @@ export default (function () {
51
51
  enableDelete: true,
52
52
  disableItemList: [{
53
53
  propCategory: 'eventProp',
54
- id: 30183424
54
+ id: 30183426
55
55
  }, {
56
56
  name: 'is_anonymous',
57
57
  propCategory: 'userProp'
@@ -16,7 +16,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
16
16
 
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
 
19
- import React, { useContext, useEffect, useState } from 'react';
19
+ import React, { useContext, useEffect, useRef, useState } from 'react';
20
20
  import './styles/index.less';
21
21
  import { Dropdown, Tooltip } from 'antd';
22
22
  import AttrListPanel from './listPanel';
@@ -49,7 +49,15 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
49
49
  userPropList = _useContext.userPropList,
50
50
  eventEnvList = _useContext.eventEnvList;
51
51
 
52
+ var boxRef = useRef(null);
53
+
54
+ var _useState7 = useState(200),
55
+ _useState8 = _slicedToArray(_useState7, 2),
56
+ width = _useState8[0],
57
+ setWidth = _useState8[1];
58
+
52
59
  useEffect(function () {
60
+ setWidth(boxRef.current.width || 284);
53
61
  if (!props.defaultValue) return;
54
62
  setCurrentAttr(getValue(props.defaultValue));
55
63
  }, []);
@@ -108,7 +116,8 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
108
116
  })),
109
117
  trigger: ['click'],
110
118
  overlayStyle: {
111
- minWidth: 0
119
+ minWidth: 284,
120
+ width: width
112
121
  },
113
122
  visible: visible,
114
123
  onVisibleChange: onVisibleChange
@@ -117,6 +126,7 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
117
126
  width: '100%'
118
127
  }
119
128
  }, /*#__PURE__*/React.createElement(SelectHandle, {
129
+ ref: boxRef,
120
130
  theme: "secondary",
121
131
  border: false,
122
132
  label: currentAttr === null || currentAttr === void 0 ? void 0 : currentAttr.label,
@@ -20,7 +20,6 @@
20
20
  }
21
21
  }
22
22
  &-drowdown {
23
- width: 284px;
24
23
  .__select-panel();
25
24
  &.nodata {
26
25
  .__select-nodata();