@zgfe/business-lib 1.0.9 → 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 (56) 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} +9 -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/assets/styles/chunks.less +12 -0
  28. package/es/attrConditions/components/stringList.js +3 -3
  29. package/es/constants/apis.d.ts +8 -0
  30. package/es/constants/apis.js +8 -0
  31. package/es/dialog/demo/index.d.ts +0 -29
  32. package/es/dialog/demo/index.js +6 -130
  33. package/es/dialog/index.d.ts +1 -2
  34. package/es/dialog/index.js +14 -183
  35. package/es/dialog/types.d.ts +2 -74
  36. package/es/index.d.ts +3 -1
  37. package/es/index.js +3 -1
  38. package/es/select/index.js +1 -0
  39. package/es/select/overlay.js +3 -1
  40. package/es/select/styles/handle.less +1 -0
  41. package/es/select/types.d.ts +1 -0
  42. package/es/utils/ajax.d.ts +21 -7
  43. package/es/utils/ajax.js +205 -111
  44. package/package.json +3 -2
  45. package/es/dialog/components/itemNode.d.ts +0 -10
  46. package/es/dialog/components/itemNode.js +0 -109
  47. package/es/dialog/components/list.d.ts +0 -5
  48. package/es/dialog/components/selectToInput.d.ts +0 -6
  49. package/es/dialog/components/selectToInput.js +0 -175
  50. package/es/dialog/components/styles/handle.less +0 -39
  51. package/es/dialog/components/styles/list.less +0 -60
  52. package/es/dialog/components/tab.d.ts +0 -5
  53. package/es/dialog/data/data.d.ts +0 -20
  54. package/es/dialog/data/data.js +0 -73
  55. package/es/dialog/demo/index2.js +0 -109
  56. 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 {};
@@ -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'
@@ -0,0 +1,8 @@
1
+ declare const Apis: {
2
+ querySceneGroup: string;
3
+ addScene: string;
4
+ esQuery: string;
5
+ addPanel: string;
6
+ queryPanelGroup: string;
7
+ };
8
+ export default Apis;
@@ -0,0 +1,8 @@
1
+ var Apis = {
2
+ querySceneGroup: '/scene/queryScenesOfGroup.jsp',
3
+ addScene: '/scene/addScene.jsp',
4
+ esQuery: '/data/queryEsData.jsp',
5
+ addPanel: '/web/sdk/v2/panel/addPanelElement',
6
+ queryPanelGroup: '/apppanel/panels.jsp'
7
+ };
8
+ export default Apis;
@@ -1,31 +1,2 @@
1
- export declare const chartTypes: ({
2
- label: string;
3
- value: string;
4
- icon: string;
5
- disabled?: undefined;
6
- children?: undefined;
7
- } | {
8
- label: string;
9
- value: string;
10
- icon: string;
11
- disabled: boolean;
12
- children?: undefined;
13
- } | {
14
- label: string;
15
- value: string;
16
- icon: string;
17
- children: ({
18
- label: string;
19
- value: string;
20
- icon: string;
21
- disabled?: undefined;
22
- } | {
23
- label: string;
24
- value: string;
25
- icon: string;
26
- disabled: boolean;
27
- })[];
28
- disabled?: undefined;
29
- })[];
30
1
  declare const _default: () => JSX.Element;
31
2
  export default _default;
@@ -1,9 +1,3 @@
1
- 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; }
2
-
3
- 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; }
4
-
5
- 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; }
6
-
7
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
2
 
9
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."); }
@@ -19,143 +13,25 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
13
  import React, { useState } from 'react';
20
14
  import { BizDialog } from '@zgfe/business-lib';
21
15
  import { Button } from 'antd';
22
- var options = [{
23
- id: 11,
24
- name: '分类一'
25
- }, {
26
- id: 22,
27
- name: '分类二'
28
- }, {
29
- id: 33,
30
- name: '分分类三一'
31
- }];
32
- export var chartTypes = [{
33
- label: '趋势图',
34
- value: 'line',
35
- icon: 'qushitu1'
36
- }, {
37
- label: '汇总图',
38
- value: 'bar',
39
- icon: 'huizongtu'
40
- }, {
41
- label: '地图',
42
- value: 'map',
43
- icon: 'ditu',
44
- disabled: true
45
- }, {
46
- label: '表格',
47
- value: 'table',
48
- icon: 'biaoge',
49
- children: [{
50
- label: '趋势图',
51
- value: 'line',
52
- icon: 'qushitu1'
53
- }, {
54
- label: '汇总图',
55
- value: 'bar',
56
- icon: 'huizongtu',
57
- disabled: true
58
- }]
59
- }, {
60
- label: '分数',
61
- value: 'fraction',
62
- icon: 'fenshu'
63
- }];
64
- var fields = [{
65
- label: '分类',
66
- name: 'class',
67
- extendName: 'range',
68
- type: 'selectToInput',
69
- options: options,
70
- children: ['range'],
71
- fieldNames: {
72
- label: 'name',
73
- value: 'id'
74
- },
75
- rules: [{
76
- required: true,
77
- message: '请选择分类'
78
- }],
79
- onChange: function onChange(val) {
80
- console.log('value>>>', val);
81
- }
82
- }, {
83
- label: '名称',
84
- name: 'name',
85
- type: 'input',
86
- rules: [{
87
- required: true,
88
- message: '请输入名称'
89
- }]
90
- }, {
91
- label: '图表',
92
- name: 'chart',
93
- type: 'tab',
94
- options: chartTypes,
95
- rules: [{
96
- required: true,
97
- message: '请选择图表'
98
- }]
99
- }, {
100
- label: '显示',
101
- name: 'show',
102
- type: 'radio',
103
- direction: 'vertical',
104
- dependenceFields: {
105
- chart: 'line'
106
- },
107
- options: [{
108
- label: '动态显示数据最多的10个分组',
109
- value: 'dynamic'
110
- }, {
111
- label: '固定显示当前选择的分组',
112
- value: 'fix'
113
- }],
114
- rules: [{
115
- required: true,
116
- message: '请选择'
117
- }]
118
- }];
119
- var formData = {
120
- class: {
121
- id: 11,
122
- name: '分类一'
123
- },
124
- range: 'public',
125
- show: 'dynamic',
126
- chart: 'line'
127
- };
128
16
  export default (function () {
129
17
  var _useState = useState(false),
130
18
  _useState2 = _slicedToArray(_useState, 2),
131
19
  visible = _useState2[0],
132
20
  setVisible = _useState2[1];
133
21
 
134
- var _useState3 = useState(),
135
- _useState4 = _slicedToArray(_useState3, 2),
136
- dialogData = _useState4[0],
137
- setDialogData = _useState4[1];
138
-
139
- var handleSubmit = function handleSubmit(data) {
140
- setDialogData(function () {
141
- return _objectSpread({}, data);
142
- });
143
- setVisible(false);
144
- };
145
-
146
22
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
147
23
  type: "primary",
148
24
  onClick: function onClick() {
149
25
  setVisible(true);
150
26
  }
151
- }, "\u5411\u770B\u677F\u6DFB\u52A0\u6307\u6807"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, JSON.stringify(dialogData)), /*#__PURE__*/React.createElement(BizDialog, {
152
- title: "\u5411\u770B\u677F\u6DFB\u52A0\u6307\u6807",
27
+ }, "\u6253\u5F00\u5F39\u7A97"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(BizDialog, {
28
+ title: "\u6807\u9898",
153
29
  visible: visible,
154
- onOk: handleSubmit,
155
- fields: fields,
156
- initialValues: formData,
30
+ onOk: function onOk() {
31
+ setVisible(false);
32
+ },
157
33
  onCancel: function onCancel() {
158
34
  setVisible(false);
159
35
  }
160
- }));
36
+ }, "fdfdfdsa"));
161
37
  });
@@ -1,7 +1,6 @@
1
- import { FormItemProps, ModalProps } from 'antd';
2
1
  import React from 'react';
3
2
  import { DialogTypes } from './types';
4
3
  import './styles/index.less';
5
4
  export declare const classPrefix = "biz-dialog";
6
- declare const BizDialog: React.FC<ModalProps & DialogTypes.Props & FormItemProps>;
5
+ declare const BizDialog: React.FC<DialogTypes.Props>;
7
6
  export default BizDialog;