@bit-sun/business-component 1.0.6 → 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.
@@ -0,0 +1,3 @@
1
+ import 'antd/dist/antd.css';
2
+ declare const QueryInput: () => JSX.Element;
3
+ export default QueryInput;
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export { default as DataValidation } from './DataValidation';
1
+ export { default as DataValidation } from './components/DataValidation';
2
+ export { default as QueryInput } from './components/QueryInput';
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import axios from 'axios';
2
- import React, { createContext, useContext, useEffect, forwardRef, createElement } from 'react';
3
- import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox } from 'antd';
2
+ import React, { createContext, useContext, useEffect, forwardRef, createElement, useState } from 'react';
3
+ import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal } from 'antd';
4
4
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
5
5
  import 'antd/dist/antd.css';
6
6
  import classNames from 'classnames';
@@ -2168,14 +2168,115 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2168
2168
  return DataValidation;
2169
2169
  }(React.Component);
2170
2170
 
2171
+ var css_248z$1 = ".query_input button {\n width: '50px';\n}\n.query_input_wrapper {\n display: flex;\n}\n.query_input_wrapper_left {\n width: 100px;\n}\n.query_input_wrapper_right {\n color: #9e9e9e;\n}\n.query_input_textArea {\n margin-top: 15px;\n}\n";
2172
+ styleInject(css_248z$1);
2173
+
2174
+ var QueryInput = function QueryInput() {
2175
+ var _useState = useState(false),
2176
+ _useState2 = _slicedToArray(_useState, 2),
2177
+ isModalVisible = _useState2[0],
2178
+ setIsModalVisible = _useState2[1];
2179
+
2180
+ var _useState3 = useState(''),
2181
+ _useState4 = _slicedToArray(_useState3, 2),
2182
+ value = _useState4[0],
2183
+ setValue = _useState4[1];
2184
+
2185
+ var showModal = function showModal() {
2186
+ setIsModalVisible(true);
2187
+ };
2188
+
2189
+ var handleOk = function handleOk() {
2190
+ var formatValue = ToCDB(value).split(/[/\n/\s,;]/).filter(function (item) {
2191
+ return item;
2192
+ }).join(',');
2193
+ setValue(formatValue);
2194
+ setIsModalVisible(false);
2195
+ };
2196
+
2197
+ var handleCancel = function handleCancel() {
2198
+ setIsModalVisible(false);
2199
+ };
2200
+
2201
+ var outerChange = function outerChange(e) {
2202
+ debugger;
2203
+ var formatValue = ToCDB(e.target.value).split(/[/\n/\s,;]/).filter(function (item) {
2204
+ return item;
2205
+ }).join(',');
2206
+ setValue(formatValue);
2207
+ };
2208
+
2209
+ var onChange = function onChange(e) {
2210
+ setValue(e.target.value);
2211
+ };
2212
+
2213
+ return /*#__PURE__*/React.createElement("div", {
2214
+ className: css_248z$1.query_input
2215
+ }, /*#__PURE__*/React.createElement(Input.Group, {
2216
+ compact: true
2217
+ }, /*#__PURE__*/React.createElement(Input, {
2218
+ value: value,
2219
+ onChange: outerChange,
2220
+ style: {
2221
+ width: 'calc(100% - 50px)'
2222
+ },
2223
+ placeholder: "\u8BF7\u8F93\u5165\uFF08\u67E5\u8BE2\u591A\u4E2A\u503C\u8BF7\u7528 ; \u6216 , \u5206\u5272\uFF09"
2224
+ }), /*#__PURE__*/React.createElement(Button, {
2225
+ className: css_248z$1.button,
2226
+ onClick: showModal,
2227
+ type: "primary"
2228
+ }, "...")), /*#__PURE__*/React.createElement(Modal, {
2229
+ width: 600,
2230
+ title: "\u591A\u503C\u5F55\u5165",
2231
+ visible: isModalVisible,
2232
+ onOk: handleOk,
2233
+ onCancel: handleCancel,
2234
+ footer: [/*#__PURE__*/React.createElement(Button, {
2235
+ key: "back",
2236
+ onClick: handleCancel
2237
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
2238
+ key: "submit",
2239
+ type: "primary",
2240
+ onClick: handleOk
2241
+ }, "\u5F55\u5165")]
2242
+ }, /*#__PURE__*/React.createElement("div", {
2243
+ className: css_248z$1.query_input_wrapper
2244
+ }, /*#__PURE__*/React.createElement("div", {
2245
+ className: css_248z$1.query_input_wrapper_left
2246
+ }, "\u5F55\u5165\u533A\uFF1A"), /*#__PURE__*/React.createElement("div", {
2247
+ className: css_248z$1.query_input_wrapper_right
2248
+ }, /*#__PURE__*/React.createElement("div", null, "\u5982\u9700\u540C\u65F6\u4F7F\u7528\u591A\u4E2A\u503C\u8FDB\u884C\u67E5\u8BE2\uFF0C\u8BF7\u4F7F\u7528\u9017\u53F7\u3001\u5206\u53F7\u3001\u7A7A\u683C\u6216\u6362\u884C\u8FDB\u884C\u503C\u7684\u5206\u9694\uFF0C\u4E2D\u82F1\u6587\u683C\u5F0F\u7684\u7B26\u53F7\u5747\u652F\u6301"), /*#__PURE__*/React.createElement("div", {
2249
+ className: css_248z$1.query_input_textArea
2250
+ }, /*#__PURE__*/React.createElement(Input.TextArea, {
2251
+ value: value,
2252
+ onChange: onChange,
2253
+ rows: 6,
2254
+ showCount: true
2255
+ }))))));
2256
+ };
2257
+
2258
+ function ToCDB(str) {
2259
+ var tmp = '';
2260
+
2261
+ for (var i = 0; i < str.length; i++) {
2262
+ if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) {
2263
+ tmp += String.fromCharCode(str.charCodeAt(i) - 65248);
2264
+ } else {
2265
+ tmp += String.fromCharCode(str.charCodeAt(i));
2266
+ }
2267
+ }
2268
+
2269
+ return tmp;
2270
+ }
2271
+
2171
2272
  /*
2172
2273
  * @Description:
2173
2274
  * @Author: rodchen
2174
2275
  * @Date: 2021-11-30 22:59:39
2175
- * @LastEditTime: 2021-12-08 16:50:04
2276
+ * @LastEditTime: 2021-12-27 20:16:20
2176
2277
  * @LastEditors: rodchen
2177
2278
  */
2178
2279
  var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
2179
2280
  axios.defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
2180
2281
 
2181
- export { DataValidation };
2282
+ export { DataValidation, QueryInput };
package/dist/index.js CHANGED
@@ -2178,14 +2178,116 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2178
2178
  return DataValidation;
2179
2179
  }(React__default['default'].Component);
2180
2180
 
2181
+ var css_248z$1 = ".query_input button {\n width: '50px';\n}\n.query_input_wrapper {\n display: flex;\n}\n.query_input_wrapper_left {\n width: 100px;\n}\n.query_input_wrapper_right {\n color: #9e9e9e;\n}\n.query_input_textArea {\n margin-top: 15px;\n}\n";
2182
+ styleInject(css_248z$1);
2183
+
2184
+ var QueryInput = function QueryInput() {
2185
+ var _useState = React.useState(false),
2186
+ _useState2 = _slicedToArray(_useState, 2),
2187
+ isModalVisible = _useState2[0],
2188
+ setIsModalVisible = _useState2[1];
2189
+
2190
+ var _useState3 = React.useState(''),
2191
+ _useState4 = _slicedToArray(_useState3, 2),
2192
+ value = _useState4[0],
2193
+ setValue = _useState4[1];
2194
+
2195
+ var showModal = function showModal() {
2196
+ setIsModalVisible(true);
2197
+ };
2198
+
2199
+ var handleOk = function handleOk() {
2200
+ var formatValue = ToCDB(value).split(/[/\n/\s,;]/).filter(function (item) {
2201
+ return item;
2202
+ }).join(',');
2203
+ setValue(formatValue);
2204
+ setIsModalVisible(false);
2205
+ };
2206
+
2207
+ var handleCancel = function handleCancel() {
2208
+ setIsModalVisible(false);
2209
+ };
2210
+
2211
+ var outerChange = function outerChange(e) {
2212
+ debugger;
2213
+ var formatValue = ToCDB(e.target.value).split(/[/\n/\s,;]/).filter(function (item) {
2214
+ return item;
2215
+ }).join(',');
2216
+ setValue(formatValue);
2217
+ };
2218
+
2219
+ var onChange = function onChange(e) {
2220
+ setValue(e.target.value);
2221
+ };
2222
+
2223
+ return /*#__PURE__*/React__default['default'].createElement("div", {
2224
+ className: css_248z$1.query_input
2225
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Input.Group, {
2226
+ compact: true
2227
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
2228
+ value: value,
2229
+ onChange: outerChange,
2230
+ style: {
2231
+ width: 'calc(100% - 50px)'
2232
+ },
2233
+ placeholder: "\u8BF7\u8F93\u5165\uFF08\u67E5\u8BE2\u591A\u4E2A\u503C\u8BF7\u7528 ; \u6216 , \u5206\u5272\uFF09"
2234
+ }), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
2235
+ className: css_248z$1.button,
2236
+ onClick: showModal,
2237
+ type: "primary"
2238
+ }, "...")), /*#__PURE__*/React__default['default'].createElement(antd.Modal, {
2239
+ width: 600,
2240
+ title: "\u591A\u503C\u5F55\u5165",
2241
+ visible: isModalVisible,
2242
+ onOk: handleOk,
2243
+ onCancel: handleCancel,
2244
+ footer: [/*#__PURE__*/React__default['default'].createElement(antd.Button, {
2245
+ key: "back",
2246
+ onClick: handleCancel
2247
+ }, "\u53D6\u6D88"), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
2248
+ key: "submit",
2249
+ type: "primary",
2250
+ onClick: handleOk
2251
+ }, "\u5F55\u5165")]
2252
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
2253
+ className: css_248z$1.query_input_wrapper
2254
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
2255
+ className: css_248z$1.query_input_wrapper_left
2256
+ }, "\u5F55\u5165\u533A\uFF1A"), /*#__PURE__*/React__default['default'].createElement("div", {
2257
+ className: css_248z$1.query_input_wrapper_right
2258
+ }, /*#__PURE__*/React__default['default'].createElement("div", null, "\u5982\u9700\u540C\u65F6\u4F7F\u7528\u591A\u4E2A\u503C\u8FDB\u884C\u67E5\u8BE2\uFF0C\u8BF7\u4F7F\u7528\u9017\u53F7\u3001\u5206\u53F7\u3001\u7A7A\u683C\u6216\u6362\u884C\u8FDB\u884C\u503C\u7684\u5206\u9694\uFF0C\u4E2D\u82F1\u6587\u683C\u5F0F\u7684\u7B26\u53F7\u5747\u652F\u6301"), /*#__PURE__*/React__default['default'].createElement("div", {
2259
+ className: css_248z$1.query_input_textArea
2260
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Input.TextArea, {
2261
+ value: value,
2262
+ onChange: onChange,
2263
+ rows: 6,
2264
+ showCount: true
2265
+ }))))));
2266
+ };
2267
+
2268
+ function ToCDB(str) {
2269
+ var tmp = '';
2270
+
2271
+ for (var i = 0; i < str.length; i++) {
2272
+ if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) {
2273
+ tmp += String.fromCharCode(str.charCodeAt(i) - 65248);
2274
+ } else {
2275
+ tmp += String.fromCharCode(str.charCodeAt(i));
2276
+ }
2277
+ }
2278
+
2279
+ return tmp;
2280
+ }
2281
+
2181
2282
  /*
2182
2283
  * @Description:
2183
2284
  * @Author: rodchen
2184
2285
  * @Date: 2021-11-30 22:59:39
2185
- * @LastEditTime: 2021-12-08 16:50:04
2286
+ * @LastEditTime: 2021-12-27 20:16:20
2186
2287
  * @LastEditors: rodchen
2187
2288
  */
2188
2289
  var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
2189
2290
  axios__default['default'].defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
2190
2291
 
2191
2292
  exports.DataValidation = DataValidation;
2293
+ exports.QueryInput = QueryInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -1,7 +1,12 @@
1
1
  ---
2
2
  nav:
3
- title: Components
4
- path: /components
3
+ title: '组件'
4
+ order: 1
5
+ group:
6
+ title: 组件
7
+ order: 0
8
+ title: 数据校验
9
+ order: 1
5
10
  ---
6
11
 
7
12
  ## DataValidation
@@ -10,7 +15,7 @@ Demo:
10
15
 
11
16
  ```tsx
12
17
  import React, { useRef } from 'react';
13
- import { DataValidation } from '../index';
18
+ import { DataValidation } from '../../index';
14
19
 
15
20
  export default () => {
16
21
  let dataValidationRef: DataValidation = useRef();
@@ -0,0 +1,21 @@
1
+ .query_input {
2
+ button {
3
+ width: '50px';
4
+ }
5
+
6
+ &_wrapper {
7
+ display: flex;
8
+
9
+ &_left {
10
+ width: 100px;
11
+ }
12
+
13
+ &_right {
14
+ color: #9e9e9e;
15
+ }
16
+ }
17
+
18
+ &_textArea {
19
+ margin-top: 15px;
20
+ }
21
+ }
@@ -0,0 +1,31 @@
1
+ ---
2
+ nav:
3
+ title: '组件'
4
+ order: 1
5
+ group:
6
+ title: 组件
7
+ order: 0
8
+ title: 批量查询组件
9
+ order: 1
10
+ ---
11
+
12
+ ## QueryInput
13
+
14
+ Demo:
15
+
16
+ ```tsx
17
+ import React, { useRef } from 'react';
18
+ import { QueryInput } from '../../index';
19
+
20
+ export default () => {
21
+ let dataValidationRef: QueryInput = useRef();
22
+
23
+ return (
24
+ <div>
25
+ <QueryInput />
26
+ </div>
27
+ );
28
+ };
29
+ ```
30
+
31
+ More skills for writing demo: https://d.umijs.org/guide/demo-principle
@@ -0,0 +1,109 @@
1
+ /*
2
+ * @Description:
3
+ * @Author: rodchen
4
+ * @Date: 2021-12-01 10:52:08
5
+ * @LastEditTime: 2021-12-27 21:29:23
6
+ * @LastEditors: rodchen
7
+ */
8
+ // @ts-nocheck
9
+ import React, { useState } from 'react';
10
+ import { Input, Button, Modal } from 'antd';
11
+ import 'antd/dist/antd.css';
12
+ import styles from './index.less';
13
+
14
+ const QueryInput = () => {
15
+ const [isModalVisible, setIsModalVisible] = useState(false);
16
+ const [value, setValue] = useState('');
17
+
18
+ const showModal = () => {
19
+ setIsModalVisible(true);
20
+ };
21
+
22
+ const handleOk = () => {
23
+ let formatValue = ToCDB(value)
24
+ .split(/[/\n/\s,;]/)
25
+ .filter((item) => item)
26
+ .join(',');
27
+ setValue(formatValue);
28
+ setIsModalVisible(false);
29
+ };
30
+
31
+ const handleCancel = () => {
32
+ setIsModalVisible(false);
33
+ };
34
+
35
+ const outerChange = (e) => {
36
+ debugger;
37
+ let formatValue = ToCDB(e.target.value)
38
+ .split(/[/\n/\s,;]/)
39
+ .filter((item) => item)
40
+ .join(',');
41
+ setValue(formatValue);
42
+ };
43
+
44
+ const onChange = (e) => {
45
+ setValue(e.target.value);
46
+ };
47
+
48
+ return (
49
+ <div className={styles.query_input}>
50
+ <Input.Group compact>
51
+ <Input
52
+ value={value}
53
+ onChange={outerChange}
54
+ style={{ width: 'calc(100% - 50px)' }}
55
+ placeholder="请输入(查询多个值请用 ; 或 , 分割)"
56
+ />
57
+ <Button className={styles.button} onClick={showModal} type="primary">
58
+ ...
59
+ </Button>
60
+ </Input.Group>
61
+ <Modal
62
+ width={600}
63
+ title="多值录入"
64
+ visible={isModalVisible}
65
+ onOk={handleOk}
66
+ onCancel={handleCancel}
67
+ footer={[
68
+ <Button key="back" onClick={handleCancel}>
69
+ 取消
70
+ </Button>,
71
+ <Button key="submit" type="primary" onClick={handleOk}>
72
+ 录入
73
+ </Button>,
74
+ ]}
75
+ >
76
+ <div className={styles.query_input_wrapper}>
77
+ <div className={styles.query_input_wrapper_left}>录入区:</div>
78
+ <div className={styles.query_input_wrapper_right}>
79
+ <div>
80
+ 如需同时使用多个值进行查询,请使用逗号、分号、空格或换行进行值的分隔,中英文格式的符号均支持
81
+ </div>
82
+ <div className={styles.query_input_textArea}>
83
+ <Input.TextArea
84
+ value={value}
85
+ onChange={onChange}
86
+ rows={6}
87
+ showCount
88
+ />
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </Modal>
93
+ </div>
94
+ );
95
+ };
96
+
97
+ function ToCDB(str) {
98
+ var tmp = '';
99
+ for (var i = 0; i < str.length; i++) {
100
+ if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) {
101
+ tmp += String.fromCharCode(str.charCodeAt(i) - 65248);
102
+ } else {
103
+ tmp += String.fromCharCode(str.charCodeAt(i));
104
+ }
105
+ }
106
+ return tmp;
107
+ }
108
+
109
+ export default QueryInput;
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @Description:
3
3
  * @Author: rodchen
4
4
  * @Date: 2021-11-30 22:59:39
5
- * @LastEditTime: 2021-12-08 16:50:04
5
+ * @LastEditTime: 2021-12-27 20:16:20
6
6
  * @LastEditors: rodchen
7
7
  */
8
8
 
@@ -12,4 +12,5 @@ const resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
12
12
 
13
13
  axios.defaults.headers.common['sso-sessionid'] = resposne?.sessionId || '';
14
14
 
15
- export { default as DataValidation } from './DataValidation';
15
+ export { default as DataValidation } from './components/DataValidation';
16
+ export { default as QueryInput } from './components/QueryInput';