@zgfe/modules-dm 1.0.2-dm.9 → 1.0.2-y.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.
@@ -17,6 +17,7 @@ import React, { useEffect, useState, useContext } from 'react';
17
17
  import './styles/index.less';
18
18
  import request from '../../utils/ajax';
19
19
  import apis from '../../constants/api';
20
+ import { getAppID } from '../../utils';
20
21
  import AddPlan from './addPlan';
21
22
 
22
23
  var PlanList = function PlanList(props) {
@@ -24,8 +25,9 @@ var PlanList = function PlanList(props) {
24
25
 
25
26
  var _useContext = useContext(BizGlobalDataContext),
26
27
  currentApp = _useContext.currentApp,
27
- isDemo = _useContext.isDemo; // 查看方案
28
+ isDemo = _useContext.isDemo;
28
29
 
30
+ console.log('②埋点方案管理', currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId, getAppID(currentApp)); // 查看方案
29
31
 
30
32
  var tableSee = function tableSee(data) {
31
33
  setDetailId(data.id);
@@ -35,6 +37,11 @@ var PlanList = function PlanList(props) {
35
37
 
36
38
 
37
39
  var tableDel = function tableDel(data) {
40
+ if (isDemo) {
41
+ message.error('demo环境,无法删除');
42
+ return;
43
+ }
44
+
38
45
  Modal.confirm({
39
46
  centered: true,
40
47
  title: '是否确认删除方案?',
@@ -45,7 +52,7 @@ var PlanList = function PlanList(props) {
45
52
  request(apis.deletePlan, {
46
53
  method: 'post',
47
54
  data: {
48
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
55
+ appId: getAppID(currentApp),
49
56
  planName: data
50
57
  }
51
58
  }).then(function (res) {
@@ -117,11 +124,10 @@ var PlanList = function PlanList(props) {
117
124
  request(apis.getAllPlan, {
118
125
  method: 'get',
119
126
  params: {
120
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
127
+ appId: getAppID(currentApp)
121
128
  }
122
129
  }).then(function (res) {
123
- if (!res) throw new Error();
124
- setListData(res.data.planList);
130
+ res.data && res.data.planList && setListData(res.data.planList);
125
131
  }).catch(function (err) {
126
132
  console.error('查询列表失败', err);
127
133
  }).finally(function () {});
@@ -158,7 +164,7 @@ var PlanList = function PlanList(props) {
158
164
  request(apis.queryControlSwitch, {
159
165
  method: 'get',
160
166
  params: {
161
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
167
+ appId: getAppID(currentApp)
162
168
  }
163
169
  }).then(function (res) {
164
170
  var _res$data;
@@ -176,7 +182,7 @@ var PlanList = function PlanList(props) {
176
182
  request(apis.updateControlSwitch, {
177
183
  method: 'post',
178
184
  data: {
179
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
185
+ appId: getAppID(currentApp),
180
186
  isOpen: !isOpen ? '1' : '0'
181
187
  }
182
188
  }).then(function (res) {
@@ -194,17 +200,26 @@ var PlanList = function PlanList(props) {
194
200
 
195
201
  return /*#__PURE__*/React.createElement("div", {
196
202
  className: classPrefix
197
- }, !drawerShow && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
203
+ }, /*#__PURE__*/React.createElement("div", {
198
204
  className: "".concat(classPrefix, "-switchbox clearfix")
199
205
  }, /*#__PURE__*/React.createElement("div", {
200
206
  className: "switch-div"
201
- }, /*#__PURE__*/React.createElement("span", null, "\u57CB\u70B9\u65B9\u6848\u63A7\u5236"), /*#__PURE__*/React.createElement(Switch, {
207
+ }, /*#__PURE__*/React.createElement("span", {
208
+ style: {
209
+ lineHeight: '32px'
210
+ }
211
+ }, "\u57CB\u70B9\u65B9\u6848\u63A7\u5236"), /*#__PURE__*/React.createElement(Switch, {
202
212
  onChange: isOpenChang,
203
213
  checkedChildren: "\u5F00",
204
214
  unCheckedChildren: "\u5173",
205
215
  checked: isOpen
206
216
  })), /*#__PURE__*/React.createElement(Button, {
217
+ disabled: isDemo,
207
218
  onClick: function onClick() {
219
+ if (listData.length >= 10) {
220
+ return message.error('最多创建10个埋点方案');
221
+ }
222
+
208
223
  setDrawerShow(true);
209
224
  },
210
225
  type: "primary",
@@ -213,7 +228,7 @@ var PlanList = function PlanList(props) {
213
228
  type: "tianjia",
214
229
  style: {
215
230
  marginRight: '5px',
216
- verticalAlign: '-2px'
231
+ verticalAlign: '-1px'
217
232
  }
218
233
  }), "\u65B0\u589E\u57CB\u70B9\u65B9\u6848")), /*#__PURE__*/React.createElement(Table, {
219
234
  className: "".concat(classPrefix, "-table"),
@@ -222,7 +237,7 @@ var PlanList = function PlanList(props) {
222
237
  dataSource: listData,
223
238
  // onChange={onChange}
224
239
  pagination: false
225
- })), /*#__PURE__*/React.createElement(AddPlan, {
240
+ }), /*#__PURE__*/React.createElement(AddPlan, {
226
241
  listData: listData,
227
242
  detailName: detailName,
228
243
  drawerShow: drawerShow,
@@ -6,6 +6,7 @@ interface PropsType {
6
6
  searchData: string;
7
7
  setSearchData: Function;
8
8
  setVisible: Function;
9
+ isDemo?: boolean;
9
10
  }
10
11
  declare const Search: React.FC<PropsType>;
11
12
  export default Search;
@@ -23,15 +23,16 @@ var Search = function Search(props) {
23
23
  })
24
24
  }), /*#__PURE__*/React.createElement("div", {
25
25
  className: "".concat(classPrefix, "-text")
26
- }, "\u5171", /*#__PURE__*/React.createElement("span", null, props.total), "\u6761 / \u4E0A\u9650500\u6761"), /*#__PURE__*/React.createElement(Button, {
26
+ }, "\u5171 ", /*#__PURE__*/React.createElement("span", null, props.total), " \u6761 / \u4E0A\u9650500\u6761"), /*#__PURE__*/React.createElement(Button, {
27
27
  icon: /*#__PURE__*/React.createElement(IconFont, {
28
28
  type: "tianjia",
29
29
  style: {
30
30
  marginRight: '5px',
31
- verticalAlign: '-2px'
31
+ verticalAlign: '-1px'
32
32
  }
33
33
  }),
34
34
  type: "primary",
35
+ disabled: props.isDemo,
35
36
  className: "".concat(classPrefix, "-add-button"),
36
37
  onClick: function onClick() {
37
38
  props.setVisible(true);
@@ -1,11 +1,11 @@
1
1
  @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
2
  .plan-list {
3
3
  position: relative;
4
- width: calc(100% - 264px);
5
4
  height: 100%;
6
- margin-top: 16px;
7
- padding: 24px;
5
+ margin-right: 24px;
6
+ padding: 20px 24px 24px 24px;
8
7
  background: #fff;
8
+ border-radius: 8px;
9
9
  .clearfix:after {
10
10
  display: block;
11
11
  clear: both;
@@ -42,12 +42,17 @@
42
42
  // border-top: 1px solid #e8efff;
43
43
  .switch-div {
44
44
  float: left;
45
+ .ant-switch {
46
+ width: 24px;
47
+ margin-top: -2px;
48
+ }
45
49
  span {
46
50
  margin-right: 20px;
47
51
  }
48
52
  }
49
53
  .add {
50
54
  float: right;
55
+ line-height: 20px;
51
56
  }
52
57
  }
53
58
  &-table-see {
@@ -76,6 +81,23 @@
76
81
  .add-plan {
77
82
  position: relative;
78
83
  height: 100%;
84
+ &-drawer {
85
+ .ant-drawer-header-title {
86
+ height: 20px;
87
+ .ant-drawer-close {
88
+ position: absolute;
89
+ right: 6px;
90
+ }
91
+ }
92
+ .ant-drawer-mask {
93
+ background: rgba(0, 0, 0, 0.8);
94
+ }
95
+ }
96
+ .spin {
97
+ position: absolute;
98
+ top: 50%;
99
+ left: 50%;
100
+ }
79
101
  .point-active,
80
102
  .point-active-null {
81
103
  display: inline-block;
@@ -94,7 +116,7 @@
94
116
  &-top {
95
117
  position: relative;
96
118
  display: flex;
97
- margin-bottom: 30px;
119
+ margin-top: -8px;
98
120
  .input-waring {
99
121
  position: absolute;
100
122
  bottom: -30px;
@@ -107,6 +129,8 @@
107
129
  .plan-name-div {
108
130
  display: flex;
109
131
  height: 32px;
132
+ margin-top: -10px;
133
+ margin-bottom: -8px;
110
134
  color: #242541;
111
135
  font-weight: 500;
112
136
  font-size: 16px;
@@ -131,8 +155,8 @@
131
155
  }
132
156
  &-tabs {
133
157
  position: relative;
134
- display: flex;
135
- margin-bottom: 15px;
158
+ // display: flex;
159
+ // margin-bottom: 15px;
136
160
  > :nth-child(1) {
137
161
  border-radius: 4px 0 0 4px !important;
138
162
  }
@@ -141,8 +165,8 @@
141
165
  }
142
166
  .handle-box {
143
167
  position: absolute;
144
- top: 14px;
145
- right: 20px;
168
+ top: 5px;
169
+ right: 0;
146
170
  .bsicon {
147
171
  margin-right: 10px;
148
172
  }
@@ -158,15 +182,22 @@
158
182
  }
159
183
  }
160
184
  &-table-header {
161
- display: flex;
162
- margin: 0;
163
- padding: 0;
164
- list-style-type: none;
165
- background: #fff;
166
- li {
167
- width: 25%;
168
- padding: 16px;
169
- border: 1px solid #e8efff;
185
+ .ant-table-tbody {
186
+ display: none;
187
+ }
188
+ .ant-table {
189
+ border-radius: 8px 8px 0 0 !important;
190
+ }
191
+ }
192
+ &-table-header.empty {
193
+ .ant-table {
194
+ border-radius: 8px !important;
195
+ }
196
+ .ant-table-tbody {
197
+ display: contents;
198
+ }
199
+ .ant-table-tbody > tr > td {
200
+ border-bottom: 0px solid #e8efff;
170
201
  }
171
202
  }
172
203
  .user-list,
@@ -209,6 +240,10 @@
209
240
  .ant-table-thead {
210
241
  display: none;
211
242
  }
243
+ .ant-table {
244
+ border: none;
245
+ border-radius: 0;
246
+ }
212
247
  }
213
248
  // &-table-header {
214
249
  // display: flex;
@@ -235,6 +270,17 @@
235
270
  }
236
271
  }
237
272
  .add-event {
273
+ .set-del {
274
+ margin-left: 15px;
275
+ color: #021429;
276
+ }
277
+ .set-del-err {
278
+ color: #cacdd4;
279
+ cursor: not-allowed;
280
+ }
281
+ .ant-modal-body {
282
+ padding: 5px 24px 24px 24px;
283
+ }
238
284
  .ant-form-item {
239
285
  margin: 0;
240
286
  }
@@ -259,11 +305,13 @@
259
305
  &-text {
260
306
  span {
261
307
  color: @primary-color;
308
+ font-weight: bold;
262
309
  }
263
310
  }
264
311
  &-add-button {
265
312
  position: absolute;
266
- right: 20px;
313
+ right: 0;
314
+ line-height: 20px;
267
315
  }
268
316
  }
269
317
  }
@@ -1,31 +1,11 @@
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
1
  import { Select, Table, Checkbox } from 'antd';
14
2
  var Option = Select.Option;
15
- import React, { useEffect, useState } from 'react';
3
+ import React from 'react';
16
4
  import './styles/index.less';
17
5
 
18
6
  var UserAttributeList = function UserAttributeList(props) {
19
7
  var classPrefix = 'user-list'; // console.log('userAttrData', props.userAttrData);
20
-
21
- var _useState = useState([]),
22
- _useState2 = _slicedToArray(_useState, 2),
23
- renderData = _useState2[0],
24
- setRenderData = _useState2[1];
25
-
26
- useEffect(function () {
27
- setRenderData(props.userAttrData);
28
- }, [props.userAttrData]); // 表格列
8
+ // 表格列
29
9
 
30
10
  var columns = [{
31
11
  title: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Checkbox, {
@@ -68,8 +48,7 @@ var UserAttributeList = function UserAttributeList(props) {
68
48
  }, /*#__PURE__*/React.createElement(Table, {
69
49
  className: "".concat(classPrefix, "-table"),
70
50
  columns: columns,
71
- dataSource: renderData,
72
- bordered: true,
51
+ dataSource: props.userAttrData,
73
52
  pagination: false
74
53
  }));
75
54
  };
package/es/store/index.js CHANGED
@@ -10,18 +10,23 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
10
 
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
+ 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; }
14
+
15
+ 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; }
16
+
17
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
+
13
19
  import { useReducer, createContext } from 'react';
14
20
  import { initState } from './state';
15
21
  import { ActionType } from './action';
16
22
 
17
23
  var DmReducer = function DmReducer(prevState, action) {
18
- console.log('DmReducer', prevState, action);
19
-
24
+ // console.log('DmReducer', prevState, action);
20
25
  switch (action.type) {
21
26
  case ActionType.SET_GLOBAL:
22
- return {
27
+ return _objectSpread(_objectSpread({}, prevState), {}, {
23
28
  updateEventMetas: action.payload
24
- };
29
+ });
25
30
 
26
31
  default:
27
32
  return initState;
package/es/store/state.js CHANGED
@@ -1,6 +1,4 @@
1
1
  export var initState = {
2
2
  // 更新主应用回调
3
- updateEventMetas: function updateEventMetas() {
4
- console.log('1更新主应用回调');
5
- }
3
+ updateEventMetas: function updateEventMetas() {}
6
4
  };
@@ -0,0 +1,7 @@
1
+ export declare const getAppID: (currentApp: any) => any;
2
+ /**
3
+ * 获取第一个表格的可视化高度
4
+ * @param {*} extraHeight 额外的高度(表格底部的内容高度 Number类型,默认为74)
5
+ * @param {*} id 当前页面中有多个table时需要制定table的id
6
+ */
7
+ export declare function getTableScroll(extraHeight?: any, id?: any): string;
@@ -0,0 +1,43 @@
1
+ export var getAppID = function getAppID(currentApp) {
2
+ var href = window.location.href;
3
+
4
+ if (href.indexOf('/app/') != -1 && href.indexOf('localhost') == -1) {
5
+ return href.split('/app/')[1].split('/')[0];
6
+ } else {
7
+ return currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId;
8
+ }
9
+ };
10
+ /**
11
+ * 获取第一个表格的可视化高度
12
+ * @param {*} extraHeight 额外的高度(表格底部的内容高度 Number类型,默认为74)
13
+ * @param {*} id 当前页面中有多个table时需要制定table的id
14
+ */
15
+
16
+ export function getTableScroll(extraHeight, id) {
17
+ if (typeof extraHeight == 'undefined') {
18
+ // 默认底部分页64 + 边距10
19
+ extraHeight = 74;
20
+ }
21
+
22
+ var tHeader = null;
23
+
24
+ if (id) {
25
+ var _document$getElementB;
26
+
27
+ tHeader = document.getElementById(id) ? (_document$getElementB = document.getElementById(id)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.getElementsByClassName('ant-table-thead')[0] : null;
28
+ } else {
29
+ tHeader = document.getElementsByClassName('ant-table-thead')[0];
30
+ } //表格内容距离顶部的距离
31
+
32
+
33
+ var tHeaderBottom = 0;
34
+
35
+ if (tHeader) {
36
+ tHeaderBottom = tHeader.getBoundingClientRect().bottom;
37
+ } //窗体高度-表格内容顶部的高度-表格内容底部的高度
38
+ // let height = document.body.clientHeight - tHeaderBottom - extraHeight
39
+
40
+
41
+ var height = "calc(100vh - ".concat(tHeaderBottom + extraHeight, "px)");
42
+ return height;
43
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-dm",
3
- "version": "1.0.2-dm.9",
3
+ "version": "1.0.2-y.1",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "license": "ISC",
@@ -41,7 +41,7 @@
41
41
  "@types/lodash": "^4.14.182",
42
42
  "@umijs/fabric": "^2.8.1",
43
43
  "@umijs/test": "^3.0.5",
44
- "@zgfe/business-lib": "1.1.7-dmd.1",
44
+ "@zgfe/business-lib": "1.1.7-dmd2.8",
45
45
  "antd": "4.22.6",
46
46
  "dumi": "^1.1.0",
47
47
  "father-build": "^1.17.2",
@@ -53,7 +53,7 @@
53
53
  "umi-request": "^1.4.0",
54
54
  "yorkie": "^2.0.0"
55
55
  },
56
- "gitHead": "d8ae6500f3351c63b291bbadcae1b688d4a3e8e1",
56
+ "gitHead": "370c8eb31239d14d50c9a08c37fc8ec45b461ff0",
57
57
  "gitHooks": {
58
58
  "pre-commit": "lint-staged"
59
59
  }