@zgfe/business-lib 1.0.3 → 1.0.7

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 (54) hide show
  1. package/es/analysisLayout/index.js +3 -3
  2. package/es/assets/iconfont/demo.css +539 -0
  3. package/es/assets/iconfont/demo_index.html +832 -0
  4. package/es/assets/iconfont/iconfont.css +34 -30
  5. package/es/assets/iconfont/iconfont.js +15 -15
  6. package/es/assets/iconfont/iconfont.json +8 -1
  7. package/es/assets/iconfont/iconfont.ttf +0 -0
  8. package/es/assets/iconfont/iconfont.woff +0 -0
  9. package/es/assets/iconfont/iconfont.woff2 +0 -0
  10. package/es/attrConditions/components/stringList.js +2 -1
  11. package/es/attrConditions/components/valuesList.js +2 -2
  12. package/es/attributeSelector/index.js +2 -2
  13. package/es/attributeSelector/option.js +1 -1
  14. package/es/datePicker/datePicker.js +3 -3
  15. package/es/dialog/components/itemNode.js +2 -2
  16. package/es/dialog/components/list.js +1 -1
  17. package/es/dialog/components/selectToInput.js +5 -5
  18. package/es/dialog/components/tab.js +1 -1
  19. package/es/dialog/demo/index.js +7 -7
  20. package/es/icon/demo/index.d.ts +2 -0
  21. package/es/icon/demo/index.js +8 -0
  22. package/es/icon/demo/list.d.ts +2 -0
  23. package/es/icon/demo/list.js +28 -0
  24. package/es/icon/demo/list.less +32 -0
  25. package/es/{components → icon}/iconFont.d.ts +6 -1
  26. package/es/{components → icon}/iconFont.js +10 -4
  27. package/es/index.d.ts +2 -2
  28. package/es/index.js +2 -2
  29. package/es/searchInput/index.js +2 -2
  30. package/es/select/demo/group.js +2 -2
  31. package/es/select/demo/loading.d.ts +2 -0
  32. package/es/select/demo/loading.js +56 -0
  33. package/es/select/handle.js +2 -2
  34. package/es/select/option.js +3 -3
  35. package/es/select/overlay.js +34 -7
  36. package/es/select/styles/index.less +4 -0
  37. package/es/select/types.d.ts +2 -0
  38. package/es/targetConditionGroup/demo/group.js +1 -1
  39. package/es/targetSelector/editBox.js +2 -2
  40. package/es/targetSelector/index.js +3 -3
  41. package/es/targetSelector/optionIcon.js +1 -1
  42. package/es/targetSelector/optionMenu.js +4 -4
  43. package/es/userCondition/conditionTypeList.d.ts +1 -1
  44. package/es/userCondition/conditions/periodCondition.js +0 -1
  45. package/es/userCondition/conditions/propCondition.d.ts +2 -8
  46. package/es/userCondition/conditions/propCondition.js +73 -23
  47. package/es/userCondition/demo/index.js +11 -35
  48. package/es/userCondition/index.js +2 -5
  49. package/es/userCondition/types.d.ts +18 -1
  50. package/es/userCondition/util.d.ts +1 -0
  51. package/es/userCondition/util.js +19 -0
  52. package/es/userGroup/demo/group.js +1 -1
  53. package/es/userGroup/index.js +1 -1
  54. package/package.json +2 -2
@@ -8,20 +8,29 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
8
8
 
9
9
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
10
 
11
- 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); }
12
-
13
11
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
14
12
 
15
13
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
16
14
 
15
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
+
17
+ 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."); }
18
+
19
+ 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); }
20
+
17
21
  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; }
18
22
 
19
- import React from 'react';
23
+ 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; }
24
+
25
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
+
27
+ import React, { useEffect, useState } from 'react';
20
28
  import { PlusOutlined } from '@ant-design/icons';
21
29
  import BizConditionItem from '../../attrConditions';
22
30
  import './styles/propCondition.less';
23
31
  import { useContext } from 'react';
24
32
  import { BizUserConditionContext, classPrefix } from '..';
33
+ import { transformNumberOperate } from '../util';
25
34
  var numAttrTypeMap = {
26
35
  1: 'cont-string',
27
36
  2: 'cont-num',
@@ -42,6 +51,39 @@ var PropCondition = function PropCondition(props) {
42
51
  attrs = props.attrs,
43
52
  dataId = props.dataId;
44
53
 
54
+ var _useState = useState([]),
55
+ _useState2 = _slicedToArray(_useState, 2),
56
+ showList = _useState2[0],
57
+ setShowList = _useState2[1];
58
+
59
+ useEffect(function () {
60
+ buildDefault();
61
+ }, []);
62
+
63
+ function buildDefault() {
64
+ var list = [];
65
+ attrs.forEach(function (attr) {
66
+ var attrId = attr.attrId,
67
+ attrName = attr.attrName,
68
+ operator = attr.operator;
69
+
70
+ if ((attrName || attrId) && operator) {
71
+ attr.operator = transformNumberOperate(operator, false);
72
+ list.push({
73
+ attr: attr,
74
+ default: attr,
75
+ id: Math.random()
76
+ });
77
+ } else {
78
+ list.push({
79
+ attr: attr,
80
+ id: Math.random()
81
+ });
82
+ }
83
+ });
84
+ setShowList(list);
85
+ }
86
+
45
87
  function _onChange(data, i) {
46
88
  var attrName = data.attrName,
47
89
  attrId = data.attrId,
@@ -56,24 +98,33 @@ var PropCondition = function PropCondition(props) {
56
98
  attrName: attrName,
57
99
  attrId: attrId,
58
100
  category: category,
59
- operator: operation,
101
+ operator: transformNumberOperate(operation),
60
102
  params: values,
61
103
  attrType: numAttrTypeMap[type]
62
104
  };
63
- newAttrs[i] = newAttr;
105
+ Object.assign(newAttrs[i], newAttr);
64
106
  props.onChange(dataId, newAttrs);
65
107
  }
66
108
 
67
109
  function onAddAttr() {
68
- props.onChange(dataId, [].concat(_toConsumableArray(attrs), [{
110
+ var attr = {
69
111
  attrId: 0
112
+ };
113
+ setShowList([].concat(_toConsumableArray(showList), [{
114
+ id: Math.random(),
115
+ attr: attr
70
116
  }]));
117
+ props.onChange(dataId, [].concat(_toConsumableArray(attrs), [attr]));
71
118
  }
72
119
 
73
120
  function onRemoveAttr(i) {
74
121
  var newAttrs = _toConsumableArray(attrs);
75
122
 
123
+ var newList = _toConsumableArray(showList);
124
+
125
+ newList.splice(i, 1);
76
126
  newAttrs.splice(i, 1);
127
+ setShowList(newList);
77
128
  props.onChange(dataId, newAttrs);
78
129
  }
79
130
 
@@ -82,18 +133,19 @@ var PropCondition = function PropCondition(props) {
82
133
  return attrName === undefined ? 'eventProp' : 'envProp';
83
134
  }
84
135
 
85
- function renderAttr(attr, i) {
86
- var attrId = attr.attrId,
87
- attrName = attr.attrName,
88
- category = attr.category,
89
- operator = attr.operator,
90
- params = attr.params,
91
- attrType = attr.attrType;
92
- console.log(attrType);
136
+ function renderAttr(item, i) {
93
137
  var props = {};
94
-
95
- if ((attrName || attrId) && operator) {
96
- props.value = {
138
+ var id = item.id;
139
+
140
+ if (item.default) {
141
+ var _item$default = item.default,
142
+ attrId = _item$default.attrId,
143
+ attrName = _item$default.attrName,
144
+ category = _item$default.category,
145
+ operator = _item$default.operator,
146
+ params = _item$default.params,
147
+ attrType = _item$default.attrType;
148
+ props.defaultValue = {
97
149
  attrName: attrName,
98
150
  category: category || 'custom',
99
151
  operation: operator,
@@ -101,14 +153,12 @@ var PropCondition = function PropCondition(props) {
101
153
  propCategory: getPropCategory(attrName),
102
154
  type: attrNumTypeMap[attrType]
103
155
  };
104
- props.key = attrName || attrId;
105
- attrId && (props.value.attrId = attrId);
156
+ attrId && (props.defaultValue.attrId = attrId);
106
157
  }
107
158
 
108
- console.log(props);
109
159
  return /*#__PURE__*/React.createElement("div", {
110
160
  className: "".concat(classPrefix, "-prop-condition-attr"),
111
- key: attrName || attrId || Math.random()
161
+ key: id
112
162
  }, /*#__PURE__*/React.createElement("div", {
113
163
  className: "".concat(classPrefix, "-prop-condition-item-wrap")
114
164
  }, /*#__PURE__*/React.createElement(BizConditionItem, _objectSpread({
@@ -131,8 +181,8 @@ var PropCondition = function PropCondition(props) {
131
181
  className: "".concat(classPrefix, "-prop-condition-label")
132
182
  }, label) : null, /*#__PURE__*/React.createElement("div", {
133
183
  className: "".concat(classPrefix, "-prop-condition-attrs")
134
- }, attrs.map(function (attr, i) {
135
- return renderAttr(attr, i);
184
+ }, showList && showList.map(function (item, i) {
185
+ return renderAttr(item, i);
136
186
  })), attrs.length < eventAttrNum && isEvent ? /*#__PURE__*/React.createElement("div", {
137
187
  className: "".concat(classPrefix, "-prop-condition-add")
138
188
  }, /*#__PURE__*/React.createElement("div", {
@@ -38,51 +38,26 @@ export default (function () {
38
38
  }
39
39
 
40
40
  var defaultValue = [[{
41
- attrs: [{
42
- attrName: 'is_anonymous',
43
- category: 'fixed',
44
- operator: 'equal',
45
- params: ['Safari', 'Apple WebKit', 'Unknown', 'Mobile Safari', 'BlackBerry', 'Microsoft Edge Mobile'],
46
- attrType: 'cont-string'
47
- }]
48
- }, {
49
- eventId: 24143017,
41
+ eventId: 7086293,
50
42
  runTimes: {
51
43
  operator: '>=',
52
44
  values: ['1']
53
45
  },
54
46
  attrs: [{
55
- attrId: 30183430,
56
- operator: 'equal',
57
- params: ['Safari', 'Mobile Safari', 'BlackBerry', 'Unknown'],
47
+ attrId: 30183425,
48
+ operator: '=',
49
+ params: ['Apple WebKit', 'Unknown'],
58
50
  attrType: 'cont-string'
51
+ }, {
52
+ attrId: 5461057,
53
+ operator: '>',
54
+ params: ['123'],
55
+ attrType: 'cont-num'
59
56
  }],
60
57
  runPeriod: {
61
58
  operator: 'relative',
62
59
  values: ['30', '0']
63
60
  }
64
- }], [{
65
- eventId: '-3',
66
- runPeriod: {
67
- operator: 'relative',
68
- values: ['30', '0']
69
- },
70
- runTimes: {
71
- operator: '>=',
72
- values: ['1']
73
- },
74
- attrs: []
75
- }, {
76
- eventId: '-4',
77
- runPeriod: {
78
- operator: 'relative',
79
- values: ['30', '1']
80
- },
81
- runTimes: {
82
- operator: '>=',
83
- values: ['1']
84
- },
85
- attrs: []
86
61
  }]];
87
62
  return /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
88
63
  value: {
@@ -92,6 +67,7 @@ export default (function () {
92
67
  }
93
68
  }, /*#__PURE__*/React.createElement(BizUserCondition, {
94
69
  defaultValue: defaultValue,
95
- onChange: onChange
70
+ onChange: onChange,
71
+ eventAttrNum: 3
96
72
  }));
97
73
  });
@@ -50,11 +50,8 @@ var BizUserCondition = function BizUserCondition(props) {
50
50
  setValue = _useState6[1];
51
51
 
52
52
  useEffect(function () {
53
- if (props.defaultValue) {
54
- setValue(props.defaultValue);
55
- initShowList();
56
- }
57
- }, [props.defaultValue]);
53
+ initShowList();
54
+ }, []);
58
55
 
59
56
  function initShowList() {
60
57
  var showList = [];
@@ -1,3 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare type Unpacked<T, U extends keyof T> = Required<T> extends {
3
+ [key in U]: infer R;
4
+ } ? R : never;
1
5
  export interface RunPeriodI {
2
6
  operator: 'relative' | 'unlimited_time' | 'join_time' | 'absolute';
3
7
  values: string[];
@@ -22,7 +26,7 @@ export declare namespace BizUserConditionT {
22
26
  interface AttrCondition {
23
27
  attrId: number;
24
28
  attrName: string;
25
- operator: 'is not null' | 'is null' | 'not contains' | 'contains' | 'equal' | 'not equal' | 'begin with' | 'not begin with' | 'end with' | 'not end with';
29
+ operator: 'is not null' | 'is null' | 'not contains' | 'contains' | 'equal' | 'not equal' | 'begin with' | 'not begin with' | 'end with' | 'not end with' | Unpacked<RunTimesI, 'operator'>;
26
30
  params: string[];
27
31
  attrType: 'cont-string' | 'cont-num' | 'cont-date';
28
32
  category: 'fixed' | 'custom';
@@ -77,3 +81,16 @@ export declare namespace RunTimesConditionTypes {
77
81
  } ? U : never;
78
82
  }[];
79
83
  }
84
+ export declare namespace PropConditionType {
85
+ type ShowListI = {
86
+ attr: BizUserConditionT.AttrCondition;
87
+ id: number;
88
+ default?: BizUserConditionT.AttrCondition;
89
+ }[];
90
+ interface PropsI extends AllConditionBasePropsI<any> {
91
+ isEvent?: boolean;
92
+ label?: string | React.ReactDOM;
93
+ eventId?: number;
94
+ attrs: BizUserConditionT.AttrCondition[];
95
+ }
96
+ }
@@ -1,2 +1,3 @@
1
1
  import { BizUserConditionT } from './types';
2
2
  export declare function buildCondition(type: BizUserConditionT.ConditionType): BizUserConditionT.EventCondition | BizUserConditionT.AddCondition | BizUserConditionT.ActiveCondition | BizUserConditionT.PropCondition;
3
+ export declare function transformNumberOperate(key: string, output?: boolean): string;
@@ -51,4 +51,23 @@ export function buildCondition(type) {
51
51
  }]
52
52
  };
53
53
  }
54
+ }
55
+ export function transformNumberOperate(key) {
56
+ var output = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
57
+ var outputMap = {
58
+ gt: '>',
59
+ equal: '=',
60
+ lt: '<',
61
+ ge: '>=',
62
+ le: '<='
63
+ };
64
+ var inputMap = {
65
+ '>': 'gt',
66
+ '=': 'equal',
67
+ '<': 'lt',
68
+ '>=': 'ge',
69
+ '<=': 'le'
70
+ };
71
+ if (output) return outputMap[key] || key;
72
+ return inputMap[key] || key;
54
73
  }
@@ -86,7 +86,7 @@ export default (function () {
86
86
  }
87
87
  }, /*#__PURE__*/React.createElement(IconFont, {
88
88
  className: "biz-icon",
89
- type: 'icon-tianjia1'
89
+ type: 'tianjia1'
90
90
  }), "\u6DFB\u52A0\u7528\u6237\u7FA4")));
91
91
  })), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u503C\uFF1A", JSON.stringify(target.user)));
92
92
  });
@@ -71,7 +71,7 @@ var BizUserGroup = function BizUserGroup(props) {
71
71
  overlayWidth: 284
72
72
  }), /*#__PURE__*/React.createElement(BizTargetOptionIcon, {
73
73
  name: "delete",
74
- icon: "icon-qingchu",
74
+ icon: "qingchu",
75
75
  title: "\u5220\u9664",
76
76
  enabled: enableDelete,
77
77
  onClick: onClickDelete
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.0.3",
3
+ "version": "1.0.7",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -58,5 +58,5 @@
58
58
  "prettier": "^2.2.1",
59
59
  "yorkie": "^2.0.0"
60
60
  },
61
- "gitHead": "81e9003818182ca6aa3755ba71f55cf8964d7d09"
61
+ "gitHead": "8cc6c3399b1ac402aaefc6df41f329afd93e0370"
62
62
  }