@zgfe/modules-page 1.0.1-alpha.2 → 1.0.1-alpha.4

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.
@@ -7,7 +7,7 @@ declare const PageContent: React.FC<{
7
7
  value?: PageColumnType[];
8
8
  groupId?: number;
9
9
  hasUserGroup?: boolean;
10
- onClick?: (data: any) => void;
10
+ onClick?: (data: ModulesPageTypes.PageGroup | ModulesPageTypes.Page) => void;
11
11
  onEdit?: (data: ModulesPageTypes.PageGroup) => void;
12
12
  onCreate?: () => void;
13
13
  }>;
@@ -1,17 +1,6 @@
1
- import { ColumnGroupType, ColumnType, ColumnsType } from 'antd/lib/table';
2
- import React from 'react';
3
- export declare const getColumns: (type: string, hasUserGroup?: boolean, onClickCallback?: Function, onEditCallback?: Function) => ((ColumnGroupType<object> | ColumnType<object>)[] & ColumnsType<any>) | ({
4
- title: string;
5
- dataIndex: string;
6
- key: string;
7
- render: (txt: string, record: any) => React.JSX.Element;
8
- width?: undefined;
9
- } | {
10
- title: string;
11
- dataIndex: string;
12
- key: string;
13
- width: number;
14
- render?: undefined;
15
- })[];
1
+ import { ColumnsType } from 'antd/lib/table';
2
+ import { PageColumnType } from './types';
3
+ import { ModulesPageTypes } from '../../modules/home/types';
4
+ export declare const getColumns: (type: string, hasUserGroup?: boolean, onClickCallback?: Function, onEditCallback?: Function) => ColumnsType<PageColumnType> | ColumnsType<ModulesPageTypes.PageGroup>;
16
5
  export declare const getNumPer: (viewUser: number, clickUser: number) => string;
17
6
  export declare const toThousands: (num?: number) => string | number | undefined;
@@ -19,7 +19,10 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
19
19
  return /*#__PURE__*/React.createElement("div", {
20
20
  className: "table-td-page",
21
21
  onClick: function onClick() {
22
- return onClickCallback && onClickCallback(record);
22
+ return onClickCallback && onClickCallback({
23
+ pageTitle: record.pageTitle,
24
+ pageUrl: record.pageUrl
25
+ });
23
26
  }
24
27
  }, /*#__PURE__*/React.createElement(Tooltip, {
25
28
  title: record.pageTitle
@@ -37,9 +40,10 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
37
40
  onClick: function onClick(e) {
38
41
  var _navigator, _navigator$clipboard;
39
42
  e.stopPropagation();
40
- (_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$clipboard = _navigator.clipboard) === null || _navigator$clipboard === void 0 ? void 0 : _navigator$clipboard.writeText(record.pageUrl).catch(function () {
43
+ if (!(record !== null && record !== void 0 && record.pageUrl)) return;
44
+ (_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$clipboard = _navigator.clipboard) === null || _navigator$clipboard === void 0 ? void 0 : _navigator$clipboard.writeText(record === null || record === void 0 ? void 0 : record.pageUrl).catch(function () {
41
45
  var el = document.createElement('textarea');
42
- el.value = record.pageUrl;
46
+ el.value = record.pageUrl || '';
43
47
  document.body.appendChild(el);
44
48
  el.select();
45
49
  document.execCommand('copy');
@@ -117,7 +121,7 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
117
121
  },
118
122
  showSorterTooltip: false,
119
123
  render: function render(_txt, record) {
120
- return getNumPer(record.viewUser, record.clickUser);
124
+ return getNumPer(record.viewUser || 0, record.clickUser || 0);
121
125
  }
122
126
  }];
123
127
  if (hasUserGroup) {
@@ -140,7 +144,7 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
140
144
  onClick: function onClick() {
141
145
  return onClickCallback && onClickCallback(record);
142
146
  }
143
- }, ' ', txt), /*#__PURE__*/React.createElement(IconFont, {
147
+ }, txt), /*#__PURE__*/React.createElement(IconFont, {
144
148
  type: "bianji1",
145
149
  onClick: function onClick() {
146
150
  return onEditCallback && onEditCallback(record);
@@ -156,7 +160,7 @@ export var getColumns = function getColumns(type, hasUserGroup, onClickCallback,
156
160
  return type === 'page' ? pageColumns : groupColumns;
157
161
  };
158
162
  export var getNumPer = function getNumPer(viewUser, clickUser) {
159
- if (viewUser === -1) {
163
+ if (!viewUser || viewUser === -1) {
160
164
  return '-';
161
165
  }
162
166
  return viewUser ? (clickUser / viewUser * 100).toFixed(1) + '%' : 0 + '%';
@@ -166,9 +170,4 @@ export var toThousands = function toThousands(num) {
166
170
  return num === -1 ? '-' : util.toThousands(num);
167
171
  }
168
172
  return num;
169
- };
170
- var sorter = function sorter(a, b) {
171
- if (a.viewUser === -1 || !a.viewUser) return 0;
172
- if (b.viewUser === -1 || !b.viewUser) return 1;
173
- return a.clickUser / a.viewUser - b.clickUser / b.viewUser;
174
173
  };
@@ -88,8 +88,8 @@ var DetailContent = function DetailContent(props) {
88
88
  });
89
89
  client.onConnected(function () {
90
90
  client.emit('openAutoTrack', _objectSpread({
91
- app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
92
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0
91
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
92
+ platform: 3
93
93
  }, props.params));
94
94
  });
95
95
  client.onError(function (err) {
@@ -131,8 +131,8 @@ var DetailContent = function DetailContent(props) {
131
131
  href: pageUrl
132
132
  });
133
133
  client.emit('updateAutoTrackParam', _objectSpread({
134
- app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
135
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0
134
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
135
+ platform: 3
136
136
  }, props.params));
137
137
  // if (timer) {
138
138
  // clearTimeout(timer);
@@ -1,10 +1,6 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
+ import { GroupModalType } from './types';
3
4
  export declare const classPrefix = "group-modal";
4
- declare const GroupModal: React.FC<{
5
- value?: any;
6
- type?: string;
7
- onOk?: () => void;
8
- onCancel?: () => void;
9
- }>;
5
+ declare const GroupModal: React.FC<GroupModalType.Props>;
10
6
  export default GroupModal;
@@ -11,12 +11,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
11
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
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { BizDialog, BizGlobalDataContext, IconFont, ajax } from '@zgfe/business-lib';
14
- import { Button, Form, Input, Spin } from 'antd';
14
+ import { Button, Form, Input, Spin, message } from 'antd';
15
15
  import React, { useContext, useEffect, useRef, useState } from 'react';
16
16
  import "./index.less";
17
17
  import PageItem from "./pageItem";
18
- import { getPageEsData } from "./utils";
19
- import mockData from "./mock";
20
18
  import api from "../../constants/api";
21
19
  export var classPrefix = 'group-modal';
22
20
  var GroupModal = function GroupModal(props) {
@@ -28,23 +26,17 @@ var GroupModal = function GroupModal(props) {
28
26
  currentApp = _useContext.currentApp,
29
27
  isDemo = _useContext.isDemo;
30
28
  var refForm = useRef();
31
- // 默认的url数组
32
- var _useState3 = useState(mockData),
33
- _useState4 = _slicedToArray(_useState3, 2),
34
- defaultOption = _useState4[0],
35
- setDefaultOption = _useState4[1];
36
29
  // 是否校验
37
- var _useState5 = useState(false),
38
- _useState6 = _slicedToArray(_useState5, 2),
39
- validate = _useState6[0],
40
- setValidate = _useState6[1];
30
+ var _useState3 = useState(false),
31
+ _useState4 = _slicedToArray(_useState3, 2),
32
+ validate = _useState4[0],
33
+ setValidate = _useState4[1];
41
34
  // 按钮组
42
- var _useState7 = useState([]),
43
- _useState8 = _slicedToArray(_useState7, 2),
44
- btnList = _useState8[0],
45
- setBtnList = _useState8[1];
35
+ var _useState5 = useState([]),
36
+ _useState6 = _slicedToArray(_useState5, 2),
37
+ btnList = _useState6[0],
38
+ setBtnList = _useState6[1];
46
39
  useEffect(function () {
47
- getPageEsData('', setDefaultOption, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform);
48
40
  setBtnList(function () {
49
41
  var btnGroup = [/*#__PURE__*/React.createElement(Button, {
50
42
  key: "cancel",
@@ -70,16 +62,21 @@ var GroupModal = function GroupModal(props) {
70
62
  });
71
63
  }, []);
72
64
  var onDelete = function onDelete() {
65
+ var _props$value;
73
66
  setLoading(true);
74
67
  ajax(api.deletePageGroup, {
75
68
  method: 'post',
76
69
  data: {
77
70
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
78
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0,
79
- id: props.value.id
71
+ platform: 3,
72
+ id: (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id
80
73
  }
81
74
  }).then(function (res) {
82
- if (!res) return;
75
+ if (!res) {
76
+ message.error("\u5220\u9664\u5931\u8D25");
77
+ return;
78
+ }
79
+ message.success("\u5220\u9664\u6210\u529F");
83
80
  props.onOk && props.onOk();
84
81
  }).finally(function () {
85
82
  setLoading(false);
@@ -90,7 +87,7 @@ var GroupModal = function GroupModal(props) {
90
87
  (_refForm$current = refForm.current) === null || _refForm$current === void 0 ? void 0 : _refForm$current.submit();
91
88
  };
92
89
  var onSubmit = function onSubmit(data) {
93
- var _props$value;
90
+ var _props$value2;
94
91
  setValidate(true);
95
92
  var flag = true;
96
93
  data.filters.forEach(function (item) {
@@ -104,10 +101,18 @@ var GroupModal = function GroupModal(props) {
104
101
  ajax(url, {
105
102
  method: 'post',
106
103
  data: _objectSpread({
107
- id: (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.id
104
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
105
+ platform: 3,
106
+ id: (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.id
108
107
  }, data)
109
108
  }).then(function (res) {
110
- if (!res) return;
109
+ var _props$value4;
110
+ if (!res) {
111
+ var _props$value3;
112
+ message.error("".concat((_props$value3 = props.value) !== null && _props$value3 !== void 0 && _props$value3.id ? '修改' : '创建', "\u5931\u8D25"));
113
+ return;
114
+ }
115
+ message.success("".concat((_props$value4 = props.value) !== null && _props$value4 !== void 0 && _props$value4.id ? '修改' : '创建', "\u6210\u529F"));
111
116
  props.onOk && props.onOk();
112
117
  }).finally(function () {
113
118
  setLoading(false);
@@ -160,7 +165,6 @@ var GroupModal = function GroupModal(props) {
160
165
  }, " \u6DFB\u52A0\u9875\u9762"), /*#__PURE__*/React.createElement(Form.Item, {
161
166
  name: "filters"
162
167
  }, /*#__PURE__*/React.createElement(PageItem, {
163
- defaultOption: defaultOption,
164
168
  validate: validate
165
169
  }))), /*#__PURE__*/React.createElement(Button, null)));
166
170
  };
@@ -137,6 +137,23 @@
137
137
  }
138
138
  }
139
139
 
140
+ &-dropdown {
141
+ width: 300px;
142
+ &-handle {
143
+ width: 300px;
144
+ }
145
+ }
146
+ &-dropdown-panel {
147
+ .__select-panel();
148
+ }
149
+
150
+ .ant-input {
151
+ border-color: #fafafb;
152
+ &:not([disabled]):hover,
153
+ &:not([disabled]):focus {
154
+ border-color: @primary-color;
155
+ }
156
+ }
140
157
  .ant-modal-content {
141
158
  .ant-modal-body {
142
159
  padding-bottom: 0;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare const InputSelect: React.FC<{
3
+ value?: string;
4
+ options?: string[];
5
+ status?: '' | 'warning' | 'error';
6
+ onChange?: (data: string) => void;
7
+ onSearch?: (data: string) => void;
8
+ }>;
9
+ export default InputSelect;
@@ -0,0 +1,67 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { Dropdown, Input } from 'antd';
8
+ import React, { useEffect, useMemo, useState } from 'react';
9
+ import { classPrefix } from '.';
10
+ import { IconFont } from '@zgfe/business-lib';
11
+ var InputSelect = function InputSelect(props) {
12
+ var _useState = useState(props.value),
13
+ _useState2 = _slicedToArray(_useState, 2),
14
+ searchValue = _useState2[0],
15
+ setSearchValue = _useState2[1];
16
+ useEffect(function () {}, []);
17
+ var options = useMemo(function () {
18
+ if (!props.options) return [];
19
+ return props.options.map(function (item) {
20
+ return {
21
+ key: item,
22
+ label: item,
23
+ title: item
24
+ };
25
+ });
26
+ }, [props.options]);
27
+ var onChange = function onChange(e) {
28
+ var val = e.target.value;
29
+ if (searchValue === val) return;
30
+ setSearchValue(val);
31
+ props.onSearch && props.onSearch(val);
32
+ };
33
+ var onClick = function onClick(data) {
34
+ setSearchValue(data.key);
35
+ props.onChange && props.onChange(data.key);
36
+ };
37
+ return /*#__PURE__*/React.createElement(Dropdown, {
38
+ overlayClassName: "".concat(classPrefix, "-dropdown"),
39
+ trigger: ['click'],
40
+ menu: {
41
+ items: options,
42
+ selectedKeys: props.value ? [props.value] : undefined,
43
+ onClick: onClick
44
+ },
45
+ dropdownRender: function dropdownRender(menus) {
46
+ var _props$options;
47
+ if ((_props$options = props.options) !== null && _props$options !== void 0 && _props$options.length) {
48
+ return menus;
49
+ }
50
+ return /*#__PURE__*/React.createElement("div", {
51
+ className: "".concat(classPrefix, "-dropdown-panel")
52
+ }, "\u6682\u65E0\u6570\u636E");
53
+ }
54
+ }, /*#__PURE__*/React.createElement(Input, {
55
+ className: "".concat(classPrefix, "-dropdown-handle"),
56
+ value: searchValue,
57
+ allowClear: true,
58
+ title: searchValue,
59
+ status: props.status,
60
+ onChange: onChange,
61
+ suffix: /*#__PURE__*/React.createElement(IconFont, {
62
+ className: "".concat(classPrefix, "-item-down-icon"),
63
+ type: "xiangxia"
64
+ })
65
+ }));
66
+ };
67
+ export default InputSelect;
@@ -21,6 +21,7 @@ import "./index.less";
21
21
  import { Input, Select } from 'antd';
22
22
  import _ from 'lodash';
23
23
  import { getPageEsData } from "./utils";
24
+ import InputSelect from "./inputSelect";
24
25
  var PageItem = function PageItem(props) {
25
26
  var prefix = "".concat(classPrefix, "-item");
26
27
  var operatorStore = [{
@@ -42,20 +43,19 @@ var PageItem = function PageItem(props) {
42
43
  _useState2 = _slicedToArray(_useState, 2),
43
44
  pageList = _useState2[0],
44
45
  setPageList = _useState2[1];
45
- // 文本框中输入关键词搜索
46
- var _useState3 = useState(''),
46
+ var _useState3 = useState(0),
47
47
  _useState4 = _slicedToArray(_useState3, 2),
48
- searchValue = _useState4[0],
49
- setSearchValue = _useState4[1];
50
- var _useState5 = useState(0),
51
- _useState6 = _slicedToArray(_useState5, 2),
52
- timer = _useState6[0],
53
- setTimer = _useState6[1];
48
+ timer = _useState4[0],
49
+ setTimer = _useState4[1];
54
50
  // param options
55
- var _useState7 = useState(props.defaultOption || []),
51
+ var _useState5 = useState([]),
52
+ _useState6 = _slicedToArray(_useState5, 2),
53
+ paramOption = _useState6[0],
54
+ setParamOption = _useState6[1];
55
+ var _useState7 = useState([]),
56
56
  _useState8 = _slicedToArray(_useState7, 2),
57
- paramOption = _useState8[0],
58
- setParamOption = _useState8[1];
57
+ defaultOption = _useState8[0],
58
+ setDefaultOption = _useState8[1];
59
59
  var _useContext = useContext(BizGlobalDataContext),
60
60
  currentApp = _useContext.currentApp;
61
61
  useEffect(function () {
@@ -66,7 +66,11 @@ var PageItem = function PageItem(props) {
66
66
  }, item);
67
67
  });
68
68
  });
69
+ getPageEsData('', setDefaultOption, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform);
69
70
  }, []);
71
+ useEffect(function () {
72
+ setParamOption(new Array((props.value || [newItem]).length).fill(defaultOption));
73
+ }, [defaultOption]);
70
74
  useEffect(function () {
71
75
  props.onChange && props.onChange(pageList.map(function (item) {
72
76
  var data = _.cloneDeep(item);
@@ -80,6 +84,9 @@ var PageItem = function PageItem(props) {
80
84
  id: util.guid()
81
85
  }, newItem)]);
82
86
  });
87
+ setParamOption(function (options) {
88
+ return [].concat(_toConsumableArray(options), [defaultOption]);
89
+ });
83
90
  };
84
91
  var onDelete = function onDelete(index) {
85
92
  if (pageList.length <= 1) return;
@@ -88,6 +95,11 @@ var PageItem = function PageItem(props) {
88
95
  data.splice(index, 1);
89
96
  return data;
90
97
  });
98
+ setParamOption(function (options) {
99
+ var data = _.cloneDeep(options);
100
+ data.splice(index, 1);
101
+ return data;
102
+ });
91
103
  };
92
104
  // 改变关系
93
105
  var onChangeOperator = function onChangeOperator(operator, index) {
@@ -97,44 +109,34 @@ var PageItem = function PageItem(props) {
97
109
  return data;
98
110
  });
99
111
  };
100
- // 键盘enter确定时的方法
101
- var handleValue = function handleValue(e, index) {
102
- //当点击回车键或失去焦点后执行,并且verify为true,保证只有页面和埋点这里需要使用此处逻辑
103
- if (e.key === 'Enter') {
104
- e.stopPropagation();
105
- setPageList(function (list) {
106
- var data = _.cloneDeep(list);
107
- data[index].param = searchValue;
108
- return data;
109
- });
110
- }
111
- };
112
- // 失焦
113
- var _onBlur = function onBlur(e, index) {
114
- e.stopPropagation();
115
- setPageList(function (list) {
116
- var data = _.cloneDeep(list);
117
- data[index].param = searchValue;
118
- return data;
119
- });
120
- };
112
+
121
113
  // 搜索
122
- var onSearch = function onSearch(newValue) {
123
- newValue && setSearchValue(newValue);
114
+ var _onSearch = function onSearch(newValue, index) {
124
115
  if (timer) {
125
116
  clearTimeout(timer);
126
117
  }
127
- if (!newValue) {
128
- setParamOption(_toConsumableArray(props.defaultOption));
129
- return;
130
- }
118
+ var handle = function handle(optionData) {
119
+ setParamOption(function (options) {
120
+ var data = _.cloneDeep(options);
121
+ data[index] = optionData;
122
+ return data;
123
+ });
124
+ };
131
125
  setTimer(setTimeout(function () {
132
- getPageEsData(newValue, setParamOption, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform);
126
+ if (!newValue) {
127
+ handle(defaultOption);
128
+ } else {
129
+ getPageEsData(newValue, handle, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId, currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform);
130
+ }
131
+ setPageList(function (list) {
132
+ var data = _.cloneDeep(list);
133
+ data[index].param = newValue;
134
+ return data;
135
+ });
133
136
  }, 300));
134
137
  };
135
138
  // 改变值
136
139
  var onChangeParam = function onChangeParam(param, index) {
137
- setSearchValue(param);
138
140
  setPageList(function (list) {
139
141
  var data = _.cloneDeep(list);
140
142
  data[index].param = param;
@@ -175,26 +177,16 @@ var PageItem = function PageItem(props) {
175
177
  onChange: function onChange(e) {
176
178
  return onChangeParam(e.target.value, index);
177
179
  }
178
- }) : /*#__PURE__*/React.createElement(Select, {
179
- className: "".concat(prefix, "-content-item-param"),
180
- options: paramOption,
180
+ }) : /*#__PURE__*/React.createElement(InputSelect, {
181
181
  value: item.param,
182
- suffixIcon: /*#__PURE__*/React.createElement(IconFont, {
183
- className: "".concat(prefix, "-down-icon"),
184
- type: "xiangxia"
185
- }),
182
+ options: paramOption ? paramOption[index] : [],
186
183
  status: !item.param && props.validate ? 'error' : '',
187
- showSearch: true,
188
- onBlur: function onBlur(e) {
189
- return _onBlur(e, index);
190
- },
191
- onInputKeyDown: function onInputKeyDown(e) {
192
- return handleValue(e, index);
184
+ onSearch: function onSearch(val) {
185
+ return _onSearch(val, index);
193
186
  },
194
187
  onChange: function onChange(data) {
195
188
  return onChangeParam(data, index);
196
- },
197
- onSearch: onSearch
189
+ }
198
190
  }), !item.param && props.validate ? /*#__PURE__*/React.createElement("div", {
199
191
  className: "".concat(prefix, "-tip")
200
192
  }, "\u6761\u4EF6\u4E0D\u80FD\u4E3A\u7A7A") : null), /*#__PURE__*/React.createElement(IconFont, {
@@ -211,7 +203,4 @@ var PageItem = function PageItem(props) {
211
203
  type: "tianjia1"
212
204
  }), /*#__PURE__*/React.createElement("span", null, "\u6DFB\u52A0\u9875\u9762")) : null);
213
205
  };
214
- PageItem.defaultProps = {
215
- defaultOption: []
216
- };
217
206
  export default PageItem;
@@ -1,12 +1,12 @@
1
- import { SelectProps } from 'antd';
2
1
  import { ModulesPageTypes } from '../../modules/home/types';
3
2
  export declare namespace GroupModalType {
4
3
  interface Props {
5
4
  value?: ModulesPageTypes.PageGroup;
5
+ onOk?: () => void;
6
+ onCancel?: () => void;
6
7
  }
7
8
  interface ItemProps {
8
9
  value?: ModulesPageTypes.ItemValue[];
9
- defaultOption?: SelectProps['options'];
10
10
  validate?: boolean;
11
11
  onChange?: (data: ModulesPageTypes.ItemValue[]) => void;
12
12
  }
@@ -6,18 +6,12 @@ export var getPageEsData = function getPageEsData(searchValue, callback, appId,
6
6
  data: {
7
7
  appId: appId,
8
8
  platform: platform || 0,
9
- limit: 10000,
9
+ dimensionSub: 'current_url',
10
10
  attr: 0,
11
11
  v: searchValue
12
12
  }
13
13
  }).then(function (res) {
14
14
  if (!res || !res.data) return;
15
- var list = res.data.sources;
16
- callback(list.map(function (item) {
17
- return {
18
- name: item,
19
- value: item
20
- };
21
- }));
15
+ callback(res.data.sources);
22
16
  });
23
17
  };
@@ -1,8 +1,6 @@
1
1
  export declare namespace PageSelectTypes {
2
2
  interface Props {
3
3
  value?: Value;
4
- pageList?: any[];
5
- pageGroupList?: any[];
6
4
  enableAdd?: boolean;
7
5
  onAdd?: () => void;
8
6
  onChange?: (data: Value) => void;
@@ -89,6 +89,7 @@ var SearchPanel = function SearchPanel(props) {
89
89
  className: "".concat(classPrefix, "-item"),
90
90
  key: field.key
91
91
  }), /*#__PURE__*/React.createElement(BizUserGroup, {
92
+ enableDelete: fields.length > 1,
92
93
  onDelete: function onDelete() {
93
94
  return remove(index);
94
95
  }
@@ -0,0 +1,23 @@
1
+ declare const _default: {
2
+ _keyStr: string;
3
+ _utf8_encode: (string: string) => string;
4
+ _utf8_decode: (utftext: string) => string;
5
+ encode: (input: string, type?: boolean) => string;
6
+ decode: (input: string) => string;
7
+ _$: string[];
8
+ pw: string;
9
+ gString: (O6b8: {
10
+ [x: string]: (arg0: number) => {
11
+ (): any;
12
+ new (): any;
13
+ [x: string]: () => any;
14
+ };
15
+ }[], O492: {
16
+ [x: string]: (arg0: number) => {
17
+ (): any;
18
+ new (): any;
19
+ [x: string]: () => any;
20
+ };
21
+ }[]) => string;
22
+ };
23
+ export default _default;
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Created by yqdong on 16/3/15.
3
+ * qq: 1013501639
4
+ * @author yqdong
5
+ *
6
+ */
7
+ export default {
8
+ _keyStr: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
9
+ _utf8_encode: function _utf8_encode(string) {
10
+ string = string.replace(/\r\n/g, '\n');
11
+ var utftext = '';
12
+ for (var n = 0; n < string.length; n++) {
13
+ var c = string.charCodeAt(n);
14
+ if (c < 128) {
15
+ utftext += String.fromCharCode(c);
16
+ } else if (c > 127 && c < 2048) {
17
+ utftext += String.fromCharCode(c >> 6 | 192); // jshint ignore:line
18
+ utftext += String.fromCharCode(c & 63 | 128); // jshint ignore:line
19
+ } else {
20
+ utftext += String.fromCharCode(c >> 12 | 224); // jshint ignore:line
21
+ utftext += String.fromCharCode(c >> 6 & 63 | 128); // jshint ignore:line
22
+ utftext += String.fromCharCode(c & 63 | 128); // jshint ignore:line
23
+ }
24
+ }
25
+
26
+ return utftext;
27
+ },
28
+ _utf8_decode: function _utf8_decode(utftext) {
29
+ var string = '';
30
+ var i = 0,
31
+ c = 0,
32
+ c2 = 0,
33
+ c3 = 0;
34
+ while (i < utftext.length) {
35
+ c = utftext.charCodeAt(i);
36
+ if (c < 128) {
37
+ string += String.fromCharCode(c);
38
+ i++;
39
+ } else if (c > 191 && c < 224) {
40
+ c2 = utftext.charCodeAt(i + 1);
41
+ string += String.fromCharCode((c & 31) << 6 | c2 & 63); // jshint ignore:line
42
+ i += 2;
43
+ } else {
44
+ c2 = utftext.charCodeAt(i + 1);
45
+ c3 = utftext.charCodeAt(i + 2);
46
+ string += String.fromCharCode((c & 15) << 12 | (c2 & 63) << 6 | c3 & 63); // jshint ignore:line
47
+ i += 3;
48
+ }
49
+ }
50
+ return string;
51
+ },
52
+ encode: function encode(input, type) {
53
+ var output = '';
54
+ var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
55
+ var i = 0;
56
+ input = this._utf8_encode(input);
57
+ while (i < input.length) {
58
+ chr1 = input.charCodeAt(i++);
59
+ chr2 = input.charCodeAt(i++);
60
+ chr3 = input.charCodeAt(i++);
61
+ enc1 = chr1 >> 2; // jshint ignore:line
62
+ enc2 = (chr1 & 3) << 4 | chr2 >> 4; // jshint ignore:line
63
+ enc3 = (chr2 & 15) << 2 | chr3 >> 6; // jshint ignore:line
64
+ enc4 = chr3 & 63; // jshint ignore:line
65
+ if (isNaN(chr2)) {
66
+ enc3 = enc4 = 64;
67
+ } else if (isNaN(chr3)) {
68
+ enc4 = 64;
69
+ }
70
+ output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
71
+ }
72
+ if (type) {
73
+ return output.replace(/[\+]?[\/]?[\=]?/g, '');
74
+ } else {
75
+ return output.replace(/\+/g, '-');
76
+ }
77
+ },
78
+ decode: function decode(input) {
79
+ input = input.replace(/\-/g, '+');
80
+ var output = '';
81
+ var chr1, chr2, chr3;
82
+ var enc1, enc2, enc3, enc4;
83
+ var i = 0;
84
+ while (i < input.length) {
85
+ enc1 = this._keyStr.indexOf(input.charAt(i++));
86
+ enc2 = this._keyStr.indexOf(input.charAt(i++));
87
+ enc3 = this._keyStr.indexOf(input.charAt(i++));
88
+ enc4 = this._keyStr.indexOf(input.charAt(i++));
89
+ chr1 = enc1 << 2 | enc2 >> 4; // jshint ignore:line
90
+ chr2 = (enc2 & 15) << 4 | enc3 >> 2; // jshint ignore:line
91
+ chr3 = (enc3 & 3) << 6 | enc4; // jshint ignore:line
92
+ output = output + String.fromCharCode(chr1);
93
+ if (enc3 != 64) {
94
+ output = output + String.fromCharCode(chr2);
95
+ }
96
+ if (enc4 != 64) {
97
+ output = output + String.fromCharCode(chr3);
98
+ }
99
+ }
100
+ output = this._utf8_decode(output);
101
+ return output;
102
+ },
103
+ _$: [''],
104
+ pw: '0&Gqs0a5',
105
+ gString: function gString(O6b8, O492) {
106
+ var dfc4 = Array(0x100);
107
+ var O26e = Array(0x100);
108
+ var O999 = O492['\x6c\x65\x6e\x67\x74\x68'];
109
+ var O453 = O6b8['\x6c\x65\x6e\x67\x74\x68'];
110
+ for (var O98c = 0x0; O98c < 0x100; O98c++) {
111
+ dfc4[O98c] = O492[O98c % O999]['\x63\x68\x61\x72\x41\x74'](0x0)['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74']();
112
+ O26e[O98c] = O98c;
113
+ }
114
+ for (var O8cf = O98c = 0x0; O98c < 0x100; O98c++) {
115
+ O8cf = (O8cf + O26e[O98c] + dfc4[O98c]) % 0x100;
116
+ var O23f = O26e[O98c];
117
+ O26e[O98c] = O26e[O8cf];
118
+ O26e[O8cf] = O23f;
119
+ }
120
+ var ac35 = this._$[0];
121
+ for (var O577 = O8cf = O98c = 0x0; O98c < O453; O98c++) {
122
+ O577 = (O577 + 0x1) % 0x100;
123
+ O8cf = (O8cf + O26e[O577]) % 0x100;
124
+ var tmp = O26e[O577];
125
+ O26e[O577] = O26e[O8cf];
126
+ O26e[O8cf] = tmp;
127
+ var O3d6 = O26e[(O26e[O577] + O26e[O8cf]) % 0x100];
128
+ ac35 += String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](O6b8[O98c]['\x63\x68\x61\x72\x41\x74'](0x0)['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74']() ^ O3d6);
129
+ }
130
+ return ac35;
131
+ }
132
+ };
@@ -4,7 +4,7 @@ import { DemoWrapper } from '@zgfe/business-lib';
4
4
  export default (function () {
5
5
  return /*#__PURE__*/React.createElement(DemoWrapper, {
6
6
  needMeta: true,
7
- defaultApp: 269
7
+ defaultApp: 266
8
8
  }, /*#__PURE__*/React.createElement("div", {
9
9
  style: {
10
10
  height: 750,
@@ -58,25 +58,29 @@ var ModulesPage = function ModulesPage(props) {
58
58
  _useState14 = _slicedToArray(_useState13, 2),
59
59
  loading = _useState14[0],
60
60
  setLoading = _useState14[1];
61
- // 要编辑的分组
62
- var _useState15 = useState(),
61
+ var _useState15 = useState(true),
63
62
  _useState16 = _slicedToArray(_useState15, 2),
64
- editGroup = _useState16[0],
65
- setEditGroup = _useState16[1];
66
- // 当前页面类型 list/detail
67
- var _useState17 = useState('list'),
63
+ pageLoading = _useState16[0],
64
+ setPageLoading = _useState16[1];
65
+ // 要编辑的分组
66
+ var _useState17 = useState(),
68
67
  _useState18 = _slicedToArray(_useState17, 2),
69
- pageType = _useState18[0],
70
- setPageType = _useState18[1];
71
- var _useState19 = useState(0),
68
+ editGroup = _useState18[0],
69
+ setEditGroup = _useState18[1];
70
+ // 当前页面类型 list/detail
71
+ var _useState19 = useState('list'),
72
72
  _useState20 = _slicedToArray(_useState19, 2),
73
- timer = _useState20[0],
74
- setTimer = _useState20[1];
75
- //当前点击内容(用于同步查询条件中的内容)
76
- var _useState21 = useState(),
73
+ pageType = _useState20[0],
74
+ setPageType = _useState20[1];
75
+ var _useState21 = useState(0),
77
76
  _useState22 = _slicedToArray(_useState21, 2),
78
- currentClickPage = _useState22[0],
79
- setCurrentClickPage = _useState22[1];
77
+ timer = _useState22[0],
78
+ setTimer = _useState22[1];
79
+ //当前点击内容(用于同步查询条件中的内容)
80
+ var _useState23 = useState(),
81
+ _useState24 = _slicedToArray(_useState23, 2),
82
+ currentClickPage = _useState24[0],
83
+ setCurrentClickPage = _useState24[1];
80
84
  var _useContext = useContext(BizGlobalDataContext),
81
85
  eventGroupList = _useContext.eventGroupList,
82
86
  currentApp = _useContext.currentApp;
@@ -95,10 +99,10 @@ var ModulesPage = function ModulesPage(props) {
95
99
  useEffect(function () {
96
100
  var param = {
97
101
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
98
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0
102
+ platform: 3
99
103
  };
100
- getPageGroupList(param, setPageGroupList);
101
104
  getPageList(param, setPageList);
105
+ getPageGroupList(param, setPageGroupList, setPageLoading);
102
106
  }, []);
103
107
  useEffect(function () {
104
108
  if (!showGroup) {
@@ -115,6 +119,7 @@ var ModulesPage = function ModulesPage(props) {
115
119
  if (type === 'page' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageUrl) || type === 'pageGroup' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageGroup)) {
116
120
  setPageType('list');
117
121
  }
122
+ if (type === 'pageGroup' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageGroup)) return;
118
123
  if (type === 'page' || pageType === 'detail') {
119
124
  fetch();
120
125
  }
@@ -128,7 +133,7 @@ var ModulesPage = function ModulesPage(props) {
128
133
  setTimer(setTimeout(function () {
129
134
  var param = _objectSpread({
130
135
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
131
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0
136
+ platform: 3
132
137
  }, searchValue);
133
138
  getPageResult(param, setResult, setLoading);
134
139
  }, 500));
@@ -150,11 +155,12 @@ var ModulesPage = function ModulesPage(props) {
150
155
  };
151
156
  // 分组弹窗编辑回调,更新分组列表
152
157
  var onOk = function onOk() {
158
+ setShowGroup(false);
153
159
  var param = {
154
160
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
155
- platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0
161
+ platform: 3
156
162
  };
157
- getPageGroupList(param, setPageGroupList);
163
+ getPageGroupList(param, setPageGroupList, setPageLoading);
158
164
  };
159
165
 
160
166
  // 点击表格中页面
@@ -191,7 +197,9 @@ var ModulesPage = function ModulesPage(props) {
191
197
  onChange: onChange
192
198
  }),
193
199
  topRender: props.onClickWarn ? render : null
194
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(TopContent, {
200
+ }, /*#__PURE__*/React.createElement(Spin, {
201
+ spinning: pageLoading
202
+ }, /*#__PURE__*/React.createElement(TopContent, {
195
203
  value: searchValue === null || searchValue === void 0 ? void 0 : searchValue.time,
196
204
  type: currentType,
197
205
  disabled: !result.length,
@@ -29,10 +29,14 @@ export declare namespace ModulesPageTypes {
29
29
  param?: string;
30
30
  id?: string;
31
31
  }
32
+ interface Params {
33
+ appId?: number | string;
34
+ platform: number;
35
+ }
32
36
  }
33
37
  export declare const ModulesPageContext: import("react").Context<{
34
38
  pageList: ModulesPageTypes.Page[];
35
39
  pageGroupList: ModulesPageTypes.PageGroup[];
36
- currentClickPage?: ModulesPageTypes.PageGroup | ModulesPageTypes.Page | undefined;
40
+ currentClickPage?: ModulesPageTypes.Page | ModulesPageTypes.PageGroup | undefined;
37
41
  setCurrentClickPage?: ((data: ModulesPageTypes.Page) => void) | undefined;
38
42
  }>;
@@ -1,7 +1,7 @@
1
1
  import { ModulesPageTypes } from './types';
2
2
  import { AppInfoProps } from '@zgfe/business-lib/es/context';
3
- export declare const getPageList: (data: any, callback: Function) => void;
4
- export declare const getPageGroupList: (data: any, callback: Function) => void;
5
- export declare const getPageResult: (params: any, callback: Function, loadingCallback: Function) => void;
3
+ export declare const getPageList: (data: ModulesPageTypes.Params, callback: Function) => void;
4
+ export declare const getPageGroupList: (data: ModulesPageTypes.Params, callback: Function, loadingCallback?: Function) => void;
5
+ export declare const getPageResult: (params: ModulesPageTypes.Params & ModulesPageTypes.Value, callback: Function, loadingCallback: Function) => void;
6
6
  export declare const getSocketSecret: () => string;
7
7
  export declare const onDownload: (params?: ModulesPageTypes.Value, currentApp?: AppInfoProps) => void;
@@ -6,6 +6,8 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
6
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
7
  import { ajax, util } from '@zgfe/business-lib';
8
8
  import api from "../../constants/api";
9
+ import base64 from "./base64";
10
+
9
11
  // 获取页面列表
10
12
  export var getPageList = function getPageList(data, callback) {
11
13
  ajax(api.getPageList, {
@@ -36,7 +38,8 @@ export var getPageList = function getPageList(data, callback) {
36
38
  };
37
39
 
38
40
  // 获取页面分组列表
39
- export var getPageGroupList = function getPageGroupList(data, callback) {
41
+ export var getPageGroupList = function getPageGroupList(data, callback, loadingCallback) {
42
+ loadingCallback && loadingCallback(true);
40
43
  ajax(api.getPageGroup, {
41
44
  method: 'post',
42
45
  data: data
@@ -54,6 +57,8 @@ export var getPageGroupList = function getPageGroupList(data, callback) {
54
57
  name: '全部页面组'
55
58
  });
56
59
  callback(list);
60
+ }).finally(function () {
61
+ loadingCallback && loadingCallback(false);
57
62
  });
58
63
  };
59
64
 
@@ -80,14 +85,20 @@ export var getSocketSecret = function getSocketSecret() {
80
85
  };
81
86
  export var onDownload = function onDownload(params, currentApp) {
82
87
  if (!params || !currentApp) return;
88
+ var title = params.pageTitle || '页面列表';
83
89
  ajax(api.download, {
84
90
  method: 'post',
85
- data: _objectSpread({
91
+ data: _objectSpread(_objectSpread({
86
92
  appId: currentApp.appId,
87
- platform: currentApp.platform
88
- }, params),
93
+ platform: 3
94
+ }, params), {}, {
95
+ down: {
96
+ fname: base64.encode(title),
97
+ titles: []
98
+ }
99
+ }),
89
100
  responseType: 'blob',
90
- fileName: '页面列表',
101
+ fileName: title,
91
102
  getResponse: true
92
103
  }).then(function () {});
93
104
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-page",
3
- "version": "1.0.1-alpha.2",
3
+ "version": "1.0.1-alpha.4",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -49,5 +49,6 @@
49
49
  "lodash": "^4.17.21",
50
50
  "prettier": "^2.2.1",
51
51
  "yorkie": "^2.0.0"
52
- }
52
+ },
53
+ "gitHead": "ae6d184074446e41bb350aa79c0788ccc33c26d3"
53
54
  }
@@ -1,5 +0,0 @@
1
- declare const _default: {
2
- label: string;
3
- value: string;
4
- }[];
5
- export default _default;
@@ -1,16 +0,0 @@
1
- export default [{
2
- label: 'file:///C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/test/test.html',
3
- value: 'file:///C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/test/test.html'
4
- }, {
5
- label: 'file:///C:/Users/54451/Desktop/sign/signin.html',
6
- value: 'file:///C:/Users/54451/Desktop/sign/signin.html'
7
- }, {
8
- label: 'http://localhost:8080/sign/signup.html',
9
- value: 'http://localhost:8080/sign/signup.html'
10
- }, {
11
- label: 'http://www.yayibang.com/html/web/article/index.html',
12
- value: 'http://www.yayibang.com/html/web/article/index.html'
13
- }, {
14
- label: 'http://localhost:8080/#/login',
15
- value: 'http://localhost:8080/#/login'
16
- }];