@zgfe/business-lib 1.1.7-panel.2 → 1.1.7-path.0

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.
@@ -75,7 +75,7 @@ var BizAddToPanel = function BizAddToPanel(props) {
75
75
  return;
76
76
  }
77
77
 
78
- setGroupList(res.panels);
78
+ setGroupList(res.panels || []);
79
79
  }).catch(function () {
80
80
  notification.error({
81
81
  message: '获取看板列表失败'
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { EventGroup, UserProp, EnvProp } from '../attributeSelector/types';
3
+ import { UserGroupTypes } from '../userGroup/types';
3
4
  export interface AppInfoProps {
4
5
  appId?: string | number;
5
6
  platform?: string | number;
@@ -22,7 +23,7 @@ export interface Menu {
22
23
  childrens?: Menu[];
23
24
  }
24
25
  export interface GlobalContextProps {
25
- userGroupList?: Array<any>;
26
+ userGroupList?: Array<UserGroupTypes.Instance>;
26
27
  eventGroupList?: EventGroup[];
27
28
  userPropList?: UserProp[];
28
29
  eventEnvList?: EnvProp[];
@@ -17,27 +17,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
 
19
19
  import React, { useState } from 'react';
20
- import { BizUserGroup, IconFont } from '@zgfe/business-lib';
20
+ import { BizUserGroup, IconFont, DemoWrapper } from '@zgfe/business-lib';
21
21
  import { Form } from 'antd';
22
- var groupOptions = [{
23
- id: 1,
24
- name: '用户群1'
25
- }, {
26
- id: 2,
27
- name: '用户群2'
28
- }, {
29
- id: 3,
30
- name: '用户群3'
31
- }, {
32
- id: 4,
33
- name: '用户群4'
34
- }, {
35
- id: 5,
36
- name: '用户群5'
37
- }, {
38
- id: 6,
39
- name: '用户群6'
40
- }];
41
22
  var initValue = {
42
23
  id: 1,
43
24
  name: '用户群1'
@@ -58,7 +39,9 @@ export default (function () {
58
39
  setTarget(arguments.length <= 1 ? undefined : arguments[1]);
59
40
  };
60
41
 
61
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form, {
42
+ return /*#__PURE__*/React.createElement(DemoWrapper, {
43
+ needMeta: true
44
+ }, /*#__PURE__*/React.createElement(Form, {
62
45
  initialValues: target,
63
46
  form: form,
64
47
  name: "usert_form",
@@ -73,7 +56,6 @@ export default (function () {
73
56
  return /*#__PURE__*/React.createElement(Form.Item, _objectSpread(_objectSpread({}, field), {}, {
74
57
  key: field.key
75
58
  }), /*#__PURE__*/React.createElement(BizUserGroup, {
76
- options: groupOptions,
77
59
  onDelete: function onDelete() {
78
60
  return remove(index);
79
61
  },
@@ -11,7 +11,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
13
  import React, { useState } from 'react';
14
- import { BizUserGroup } from '@zgfe/business-lib';
14
+ import { BizUserGroup, DemoWrapper } from '@zgfe/business-lib';
15
15
  var groupOptions = [{
16
16
  id: 1,
17
17
  name: '用户群1'
@@ -43,13 +43,9 @@ var UserGroupDemo = function UserGroupDemo() {
43
43
  setGroup(value);
44
44
  };
45
45
 
46
- return /*#__PURE__*/React.createElement("div", {
47
- className: "biz-user-group-demo",
48
- style: {
49
- width: '200px'
50
- }
46
+ return /*#__PURE__*/React.createElement(DemoWrapper, {
47
+ needMeta: true
51
48
  }, /*#__PURE__*/React.createElement(BizUserGroup, {
52
- options: groupOptions,
53
49
  onChange: handleChange,
54
50
  defaultValue: groupOptions[0],
55
51
  enableDelete: true
@@ -10,22 +10,24 @@ 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
- import React, { useEffect, useState } from 'react';
13
+ import React, { useContext, useEffect, useState } from 'react';
14
14
  import './styles/index.less';
15
15
  import BizSelect from '../select';
16
16
  import BizTargetOptionIcon from '../targetSelector/optionIcon';
17
17
  import { Skeleton } from 'antd';
18
+ import BizGlobalDataContext from '../context';
18
19
 
19
20
  var BizUserGroup = function BizUserGroup(props) {
20
- var enableDelete = props.enableDelete,
21
- keyField = props.keyField,
22
- labelField = props.labelField;
21
+ var enableDelete = props.enableDelete;
23
22
 
24
23
  var _useState = useState(),
25
24
  _useState2 = _slicedToArray(_useState, 2),
26
25
  current = _useState2[0],
27
26
  setCurrent = _useState2[1];
28
27
 
28
+ var _useContext = useContext(BizGlobalDataContext),
29
+ userGroupList = _useContext.userGroupList;
30
+
29
31
  var _useState3 = useState(true),
30
32
  _useState4 = _slicedToArray(_useState3, 2),
31
33
  ready = _useState4[0],
@@ -61,9 +63,9 @@ var BizUserGroup = function BizUserGroup(props) {
61
63
  }
62
64
  }, /*#__PURE__*/React.createElement(BizSelect, {
63
65
  value: current,
64
- options: props.options,
65
- keyField: keyField,
66
- labelField: labelField,
66
+ options: userGroupList || [],
67
+ keyField: "id",
68
+ labelField: "name",
67
69
  theme: "secondary",
68
70
  border: false,
69
71
  disableItemList: props.disableItemList,
@@ -78,8 +80,4 @@ var BizUserGroup = function BizUserGroup(props) {
78
80
  })));
79
81
  };
80
82
 
81
- BizUserGroup.defaultProps = {
82
- keyField: 'id',
83
- labelField: 'name'
84
- };
85
83
  export default BizUserGroup;
@@ -1,12 +1,16 @@
1
1
  import { BizSelectTypes } from '../select/types';
2
2
  export declare namespace UserGroupTypes {
3
+ interface Instance {
4
+ id: number;
5
+ name: string;
6
+ color: string;
7
+ createTime: string;
8
+ updateTime: string;
9
+ }
3
10
  interface Props {
4
11
  defaultValue?: BizSelectTypes.Option;
5
12
  value?: BizSelectTypes.Option;
6
13
  className?: string;
7
- options: BizSelectTypes.Option[];
8
- labelField?: string;
9
- keyField?: string;
10
14
  enableDelete?: boolean;
11
15
  disableItemList?: BizSelectTypes.Option[];
12
16
  onChange?: (val: BizSelectTypes.Option) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.7-panel.2",
3
+ "version": "1.1.7-path.0",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.12.0 || ^17.0.0",
61
61
  "yorkie": "^2.0.0"
62
62
  },
63
- "gitHead": "e22bc32b4be87eb1d3390d9861ddfda9e099f1ca"
63
+ "gitHead": "eb0fff1951f7d299966eb4e5e9dc2ed03df62903"
64
64
  }