@bit-sun/business-component 1.0.7 → 1.0.13

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.
package/.umirc.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-07 18:47:10
5
+ * @LastEditTime: 2021-12-29 16:14:33
6
6
  * @LastEditors: rodchen
7
7
  */
8
8
  import { defineConfig } from 'dumi';
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import 'antd/dist/antd.css';
3
2
  import './index.less';
4
3
  declare class DataValidation extends React.Component {
5
4
  constructor(props: any);
@@ -0,0 +1,5 @@
1
+ import './index.less';
2
+ declare const QueryMutipleInput: ({ onValueChange }: {
3
+ onValueChange: any;
4
+ }) => JSX.Element;
5
+ export default QueryMutipleInput;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { default as DataValidation } from './components/DataValidation';
2
- export { default as QueryInput } from './components/QueryInput';
2
+ export { default as QueryMutipleInput } from './components/QueryMutipleInput';
package/dist/index.esm.js CHANGED
@@ -2,22 +2,17 @@ import axios from 'axios';
2
2
  import React, { createContext, useContext, useEffect, forwardRef, createElement, useState } from 'react';
3
3
  import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal } from 'antd';
4
4
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
5
- import 'antd/dist/antd.css';
6
5
  import classNames from 'classnames';
6
+ import { useDebounceFn } from 'ahooks';
7
7
 
8
8
  function ownKeys(object, enumerableOnly) {
9
9
  var keys = Object.keys(object);
10
10
 
11
11
  if (Object.getOwnPropertySymbols) {
12
12
  var symbols = Object.getOwnPropertySymbols(object);
13
-
14
- if (enumerableOnly) {
15
- symbols = symbols.filter(function (sym) {
16
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
17
- });
18
- }
19
-
20
- keys.push.apply(keys, symbols);
13
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
14
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
15
+ })), keys.push.apply(keys, symbols);
21
16
  }
22
17
 
23
18
  return keys;
@@ -25,19 +20,12 @@ function ownKeys(object, enumerableOnly) {
25
20
 
26
21
  function _objectSpread2(target) {
27
22
  for (var i = 1; i < arguments.length; i++) {
28
- var source = arguments[i] != null ? arguments[i] : {};
29
-
30
- if (i % 2) {
31
- ownKeys(Object(source), true).forEach(function (key) {
32
- _defineProperty(target, key, source[key]);
33
- });
34
- } else if (Object.getOwnPropertyDescriptors) {
35
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
36
- } else {
37
- ownKeys(Object(source)).forEach(function (key) {
38
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
39
- });
40
- }
23
+ var source = null != arguments[i] ? arguments[i] : {};
24
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
25
+ _defineProperty(target, key, source[key]);
26
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
27
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
28
+ });
41
29
  }
42
30
 
43
31
  return target;
@@ -62,6 +50,9 @@ function _defineProperties(target, props) {
62
50
  function _createClass(Constructor, protoProps, staticProps) {
63
51
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
64
52
  if (staticProps) _defineProperties(Constructor, staticProps);
53
+ Object.defineProperty(Constructor, "prototype", {
54
+ writable: false
55
+ });
65
56
  return Constructor;
66
57
  }
67
58
 
@@ -92,6 +83,9 @@ function _inherits(subClass, superClass) {
92
83
  configurable: true
93
84
  }
94
85
  });
86
+ Object.defineProperty(subClass, "prototype", {
87
+ writable: false
88
+ });
95
89
  if (superClass) _setPrototypeOf(subClass, superClass);
96
90
  }
97
91
 
@@ -294,14 +288,9 @@ function ownKeys$1(object, enumerableOnly) {
294
288
 
295
289
  if (Object.getOwnPropertySymbols) {
296
290
  var symbols = Object.getOwnPropertySymbols(object);
297
-
298
- if (enumerableOnly) {
299
- symbols = symbols.filter(function (sym) {
300
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
301
- });
302
- }
303
-
304
- keys.push.apply(keys, symbols);
291
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
292
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
293
+ })), keys.push.apply(keys, symbols);
305
294
  }
306
295
 
307
296
  return keys;
@@ -309,19 +298,12 @@ function ownKeys$1(object, enumerableOnly) {
309
298
 
310
299
  function _objectSpread2$1(target) {
311
300
  for (var i = 1; i < arguments.length; i++) {
312
- var source = arguments[i] != null ? arguments[i] : {};
313
-
314
- if (i % 2) {
315
- ownKeys$1(Object(source), true).forEach(function (key) {
316
- _defineProperty$1(target, key, source[key]);
317
- });
318
- } else if (Object.getOwnPropertyDescriptors) {
319
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
320
- } else {
321
- ownKeys$1(Object(source)).forEach(function (key) {
322
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
323
- });
324
- }
301
+ var source = null != arguments[i] ? arguments[i] : {};
302
+ i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
303
+ _defineProperty$1(target, key, source[key]);
304
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
305
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
306
+ });
325
307
  }
326
308
 
327
309
  return target;
@@ -425,17 +407,11 @@ function _objectWithoutProperties$1(source, excluded) {
425
407
  function _typeof(obj) {
426
408
  "@babel/helpers - typeof";
427
409
 
428
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
429
- _typeof = function _typeof(obj) {
430
- return typeof obj;
431
- };
432
- } else {
433
- _typeof = function _typeof(obj) {
434
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
435
- };
436
- }
437
-
438
- return _typeof(obj);
410
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
411
+ return typeof obj;
412
+ } : function (obj) {
413
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
414
+ }, _typeof(obj);
439
415
  }
440
416
 
441
417
  /**
@@ -2075,7 +2051,8 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2075
2051
  return {
2076
2052
  id: "item-0".concat(index),
2077
2053
  content: mapping.get(item),
2078
- code: item
2054
+ code: item,
2055
+ type: "string"
2079
2056
  };
2080
2057
  });
2081
2058
  _this.state = {
@@ -2168,10 +2145,12 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2168
2145
  return DataValidation;
2169
2146
  }(React.Component);
2170
2147
 
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";
2148
+ var css_248z$1 = ".query_input_show {\n display: flex;\n}\n.query_input_expand_button {\n position: relative;\n width: 30px;\n color: #ffffff;\n cursor: pointer;\n}\n.query_input_expand_button span {\n position: absolute;\n height: 20px;\n line-height: 14px;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\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
2149
  styleInject(css_248z$1);
2173
2150
 
2174
- var QueryInput = function QueryInput() {
2151
+ var QueryMutipleInput = function QueryMutipleInput(_ref) {
2152
+ var onValueChange = _ref.onValueChange;
2153
+
2175
2154
  var _useState = useState(false),
2176
2155
  _useState2 = _slicedToArray(_useState, 2),
2177
2156
  isModalVisible = _useState2[0],
@@ -2182,16 +2161,37 @@ var QueryInput = function QueryInput() {
2182
2161
  value = _useState4[0],
2183
2162
  setValue = _useState4[1];
2184
2163
 
2164
+ var _useState5 = useState(''),
2165
+ _useState6 = _slicedToArray(_useState5, 2),
2166
+ popvalue = _useState6[0],
2167
+ setPopValue = _useState6[1];
2168
+
2169
+ var _useDebounceFn = useDebounceFn(function () {
2170
+ formaData(value);
2171
+ }, {
2172
+ wait: 1000
2173
+ }),
2174
+ run = _useDebounceFn.run;
2175
+
2176
+ useEffect(function () {
2177
+ setPopValue(value);
2178
+ onValueChange(value);
2179
+ }, [value]);
2180
+
2185
2181
  var showModal = function showModal() {
2186
2182
  setIsModalVisible(true);
2187
2183
  };
2188
2184
 
2189
2185
  var handleOk = function handleOk() {
2186
+ formaData(popvalue);
2187
+ setIsModalVisible(false);
2188
+ };
2189
+
2190
+ var formaData = function formaData(value) {
2190
2191
  var formatValue = ToCDB(value).split(/[/\n/\s,;]/).filter(function (item) {
2191
2192
  return item;
2192
2193
  }).join(',');
2193
2194
  setValue(formatValue);
2194
- setIsModalVisible(false);
2195
2195
  };
2196
2196
 
2197
2197
  var handleCancel = function handleCancel() {
@@ -2199,30 +2199,38 @@ var QueryInput = function QueryInput() {
2199
2199
  };
2200
2200
 
2201
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);
2202
+ setValue(e.target.value);
2203
+ run();
2207
2204
  };
2208
2205
 
2209
2206
  var onChange = function onChange(e) {
2210
- setValue(e.target.value);
2207
+ setPopValue(e.target.value);
2211
2208
  };
2212
2209
 
2213
2210
  return /*#__PURE__*/React.createElement("div", {
2214
- className: css_248z$1.query_input
2215
- }, /*#__PURE__*/React.createElement(Input.Group, {
2216
- compact: true
2211
+ className: 'query_input'
2212
+ }, /*#__PURE__*/React.createElement("div", {
2213
+ class: "query_input_show"
2217
2214
  }, /*#__PURE__*/React.createElement(Input, {
2218
2215
  value: value,
2219
2216
  onChange: outerChange,
2217
+ onBlur: function onBlur(e) {
2218
+ formaData(e.target.value);
2219
+ },
2220
+ onPaste: function onPaste(e) {
2221
+ formaData(e.clipboardData.getData('text'));
2222
+ e.preventDefault();
2223
+ },
2220
2224
  style: {
2221
- width: 'calc(100% - 50px)'
2225
+ width: 'calc(100% - 30px)'
2222
2226
  },
2223
2227
  placeholder: "\u8BF7\u8F93\u5165\uFF08\u67E5\u8BE2\u591A\u4E2A\u503C\u8BF7\u7528 ; \u6216 , \u5206\u5272\uFF09"
2224
2228
  }), /*#__PURE__*/React.createElement(Button, {
2225
- className: css_248z$1.button,
2229
+ style: {
2230
+ width: '30px',
2231
+ padding: '2px',
2232
+ height: 'auto'
2233
+ },
2226
2234
  onClick: showModal,
2227
2235
  type: "primary"
2228
2236
  }, "...")), /*#__PURE__*/React.createElement(Modal, {
@@ -2240,15 +2248,15 @@ var QueryInput = function QueryInput() {
2240
2248
  onClick: handleOk
2241
2249
  }, "\u5F55\u5165")]
2242
2250
  }, /*#__PURE__*/React.createElement("div", {
2243
- className: css_248z$1.query_input_wrapper
2251
+ className: 'query_input_wrapper'
2244
2252
  }, /*#__PURE__*/React.createElement("div", {
2245
- className: css_248z$1.query_input_wrapper_left
2253
+ className: 'query_input_wrapper_left'
2246
2254
  }, "\u5F55\u5165\u533A\uFF1A"), /*#__PURE__*/React.createElement("div", {
2247
- className: css_248z$1.query_input_wrapper_right
2255
+ className: 'query_input_wrapper_right'
2248
2256
  }, /*#__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
2257
+ className: 'query_input_textArea'
2250
2258
  }, /*#__PURE__*/React.createElement(Input.TextArea, {
2251
- value: value,
2259
+ value: popvalue,
2252
2260
  onChange: onChange,
2253
2261
  rows: 6,
2254
2262
  showCount: true
@@ -2273,10 +2281,10 @@ function ToCDB(str) {
2273
2281
  * @Description:
2274
2282
  * @Author: rodchen
2275
2283
  * @Date: 2021-11-30 22:59:39
2276
- * @LastEditTime: 2021-12-27 20:16:20
2284
+ * @LastEditTime: 2021-12-29 17:43:01
2277
2285
  * @LastEditors: rodchen
2278
2286
  */
2279
2287
  var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
2280
2288
  axios.defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
2281
2289
 
2282
- export { DataValidation, QueryInput };
2290
+ export { DataValidation, QueryMutipleInput };
package/dist/index.js CHANGED
@@ -6,8 +6,8 @@ var axios = require('axios');
6
6
  var React = require('react');
7
7
  var antd = require('antd');
8
8
  var reactBeautifulDnd = require('react-beautiful-dnd');
9
- require('antd/dist/antd.css');
10
9
  var classNames = require('classnames');
10
+ var ahooks = require('ahooks');
11
11
 
12
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
13
 
@@ -20,14 +20,9 @@ function ownKeys(object, enumerableOnly) {
20
20
 
21
21
  if (Object.getOwnPropertySymbols) {
22
22
  var symbols = Object.getOwnPropertySymbols(object);
23
-
24
- if (enumerableOnly) {
25
- symbols = symbols.filter(function (sym) {
26
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
27
- });
28
- }
29
-
30
- keys.push.apply(keys, symbols);
23
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
24
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
25
+ })), keys.push.apply(keys, symbols);
31
26
  }
32
27
 
33
28
  return keys;
@@ -35,19 +30,12 @@ function ownKeys(object, enumerableOnly) {
35
30
 
36
31
  function _objectSpread2(target) {
37
32
  for (var i = 1; i < arguments.length; i++) {
38
- var source = arguments[i] != null ? arguments[i] : {};
39
-
40
- if (i % 2) {
41
- ownKeys(Object(source), true).forEach(function (key) {
42
- _defineProperty(target, key, source[key]);
43
- });
44
- } else if (Object.getOwnPropertyDescriptors) {
45
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
46
- } else {
47
- ownKeys(Object(source)).forEach(function (key) {
48
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
49
- });
50
- }
33
+ var source = null != arguments[i] ? arguments[i] : {};
34
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
35
+ _defineProperty(target, key, source[key]);
36
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
37
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
38
+ });
51
39
  }
52
40
 
53
41
  return target;
@@ -72,6 +60,9 @@ function _defineProperties(target, props) {
72
60
  function _createClass(Constructor, protoProps, staticProps) {
73
61
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
74
62
  if (staticProps) _defineProperties(Constructor, staticProps);
63
+ Object.defineProperty(Constructor, "prototype", {
64
+ writable: false
65
+ });
75
66
  return Constructor;
76
67
  }
77
68
 
@@ -102,6 +93,9 @@ function _inherits(subClass, superClass) {
102
93
  configurable: true
103
94
  }
104
95
  });
96
+ Object.defineProperty(subClass, "prototype", {
97
+ writable: false
98
+ });
105
99
  if (superClass) _setPrototypeOf(subClass, superClass);
106
100
  }
107
101
 
@@ -304,14 +298,9 @@ function ownKeys$1(object, enumerableOnly) {
304
298
 
305
299
  if (Object.getOwnPropertySymbols) {
306
300
  var symbols = Object.getOwnPropertySymbols(object);
307
-
308
- if (enumerableOnly) {
309
- symbols = symbols.filter(function (sym) {
310
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
311
- });
312
- }
313
-
314
- keys.push.apply(keys, symbols);
301
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
302
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
303
+ })), keys.push.apply(keys, symbols);
315
304
  }
316
305
 
317
306
  return keys;
@@ -319,19 +308,12 @@ function ownKeys$1(object, enumerableOnly) {
319
308
 
320
309
  function _objectSpread2$1(target) {
321
310
  for (var i = 1; i < arguments.length; i++) {
322
- var source = arguments[i] != null ? arguments[i] : {};
323
-
324
- if (i % 2) {
325
- ownKeys$1(Object(source), true).forEach(function (key) {
326
- _defineProperty$1(target, key, source[key]);
327
- });
328
- } else if (Object.getOwnPropertyDescriptors) {
329
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
330
- } else {
331
- ownKeys$1(Object(source)).forEach(function (key) {
332
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
333
- });
334
- }
311
+ var source = null != arguments[i] ? arguments[i] : {};
312
+ i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
313
+ _defineProperty$1(target, key, source[key]);
314
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
315
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
316
+ });
335
317
  }
336
318
 
337
319
  return target;
@@ -435,17 +417,11 @@ function _objectWithoutProperties$1(source, excluded) {
435
417
  function _typeof(obj) {
436
418
  "@babel/helpers - typeof";
437
419
 
438
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
439
- _typeof = function _typeof(obj) {
440
- return typeof obj;
441
- };
442
- } else {
443
- _typeof = function _typeof(obj) {
444
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
445
- };
446
- }
447
-
448
- return _typeof(obj);
420
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
421
+ return typeof obj;
422
+ } : function (obj) {
423
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
424
+ }, _typeof(obj);
449
425
  }
450
426
 
451
427
  /**
@@ -2085,7 +2061,8 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2085
2061
  return {
2086
2062
  id: "item-0".concat(index),
2087
2063
  content: mapping.get(item),
2088
- code: item
2064
+ code: item,
2065
+ type: "string"
2089
2066
  };
2090
2067
  });
2091
2068
  _this.state = {
@@ -2178,10 +2155,12 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2178
2155
  return DataValidation;
2179
2156
  }(React__default['default'].Component);
2180
2157
 
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";
2158
+ var css_248z$1 = ".query_input_show {\n display: flex;\n}\n.query_input_expand_button {\n position: relative;\n width: 30px;\n color: #ffffff;\n cursor: pointer;\n}\n.query_input_expand_button span {\n position: absolute;\n height: 20px;\n line-height: 14px;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\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
2159
  styleInject(css_248z$1);
2183
2160
 
2184
- var QueryInput = function QueryInput() {
2161
+ var QueryMutipleInput = function QueryMutipleInput(_ref) {
2162
+ var onValueChange = _ref.onValueChange;
2163
+
2185
2164
  var _useState = React.useState(false),
2186
2165
  _useState2 = _slicedToArray(_useState, 2),
2187
2166
  isModalVisible = _useState2[0],
@@ -2192,16 +2171,37 @@ var QueryInput = function QueryInput() {
2192
2171
  value = _useState4[0],
2193
2172
  setValue = _useState4[1];
2194
2173
 
2174
+ var _useState5 = React.useState(''),
2175
+ _useState6 = _slicedToArray(_useState5, 2),
2176
+ popvalue = _useState6[0],
2177
+ setPopValue = _useState6[1];
2178
+
2179
+ var _useDebounceFn = ahooks.useDebounceFn(function () {
2180
+ formaData(value);
2181
+ }, {
2182
+ wait: 1000
2183
+ }),
2184
+ run = _useDebounceFn.run;
2185
+
2186
+ React.useEffect(function () {
2187
+ setPopValue(value);
2188
+ onValueChange(value);
2189
+ }, [value]);
2190
+
2195
2191
  var showModal = function showModal() {
2196
2192
  setIsModalVisible(true);
2197
2193
  };
2198
2194
 
2199
2195
  var handleOk = function handleOk() {
2196
+ formaData(popvalue);
2197
+ setIsModalVisible(false);
2198
+ };
2199
+
2200
+ var formaData = function formaData(value) {
2200
2201
  var formatValue = ToCDB(value).split(/[/\n/\s,;]/).filter(function (item) {
2201
2202
  return item;
2202
2203
  }).join(',');
2203
2204
  setValue(formatValue);
2204
- setIsModalVisible(false);
2205
2205
  };
2206
2206
 
2207
2207
  var handleCancel = function handleCancel() {
@@ -2209,30 +2209,38 @@ var QueryInput = function QueryInput() {
2209
2209
  };
2210
2210
 
2211
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);
2212
+ setValue(e.target.value);
2213
+ run();
2217
2214
  };
2218
2215
 
2219
2216
  var onChange = function onChange(e) {
2220
- setValue(e.target.value);
2217
+ setPopValue(e.target.value);
2221
2218
  };
2222
2219
 
2223
2220
  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
2221
+ className: 'query_input'
2222
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
2223
+ class: "query_input_show"
2227
2224
  }, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
2228
2225
  value: value,
2229
2226
  onChange: outerChange,
2227
+ onBlur: function onBlur(e) {
2228
+ formaData(e.target.value);
2229
+ },
2230
+ onPaste: function onPaste(e) {
2231
+ formaData(e.clipboardData.getData('text'));
2232
+ e.preventDefault();
2233
+ },
2230
2234
  style: {
2231
- width: 'calc(100% - 50px)'
2235
+ width: 'calc(100% - 30px)'
2232
2236
  },
2233
2237
  placeholder: "\u8BF7\u8F93\u5165\uFF08\u67E5\u8BE2\u591A\u4E2A\u503C\u8BF7\u7528 ; \u6216 , \u5206\u5272\uFF09"
2234
2238
  }), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
2235
- className: css_248z$1.button,
2239
+ style: {
2240
+ width: '30px',
2241
+ padding: '2px',
2242
+ height: 'auto'
2243
+ },
2236
2244
  onClick: showModal,
2237
2245
  type: "primary"
2238
2246
  }, "...")), /*#__PURE__*/React__default['default'].createElement(antd.Modal, {
@@ -2250,15 +2258,15 @@ var QueryInput = function QueryInput() {
2250
2258
  onClick: handleOk
2251
2259
  }, "\u5F55\u5165")]
2252
2260
  }, /*#__PURE__*/React__default['default'].createElement("div", {
2253
- className: css_248z$1.query_input_wrapper
2261
+ className: 'query_input_wrapper'
2254
2262
  }, /*#__PURE__*/React__default['default'].createElement("div", {
2255
- className: css_248z$1.query_input_wrapper_left
2263
+ className: 'query_input_wrapper_left'
2256
2264
  }, "\u5F55\u5165\u533A\uFF1A"), /*#__PURE__*/React__default['default'].createElement("div", {
2257
- className: css_248z$1.query_input_wrapper_right
2265
+ className: 'query_input_wrapper_right'
2258
2266
  }, /*#__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
2267
+ className: 'query_input_textArea'
2260
2268
  }, /*#__PURE__*/React__default['default'].createElement(antd.Input.TextArea, {
2261
- value: value,
2269
+ value: popvalue,
2262
2270
  onChange: onChange,
2263
2271
  rows: 6,
2264
2272
  showCount: true
@@ -2283,11 +2291,11 @@ function ToCDB(str) {
2283
2291
  * @Description:
2284
2292
  * @Author: rodchen
2285
2293
  * @Date: 2021-11-30 22:59:39
2286
- * @LastEditTime: 2021-12-27 20:16:20
2294
+ * @LastEditTime: 2021-12-29 17:43:01
2287
2295
  * @LastEditors: rodchen
2288
2296
  */
2289
2297
  var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
2290
2298
  axios__default['default'].defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
2291
2299
 
2292
2300
  exports.DataValidation = DataValidation;
2293
- exports.QueryInput = QueryInput;
2301
+ exports.QueryMutipleInput = QueryMutipleInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "1.0.7",
3
+ "version": "1.0.13",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -27,9 +27,9 @@
27
27
  ]
28
28
  },
29
29
  "dependencies": {
30
+ "ahooks": "^3.1.2",
30
31
  "antd": "4.17.2",
31
32
  "axios": "^0.24.0",
32
- "bs-business-component": "^1.0.1",
33
33
  "classnames": "^2.3.1",
34
34
  "react": "^16.12.0",
35
35
  "react-beautiful-dnd": "10.0.0"
@@ -40,10 +40,9 @@
40
40
  "father-build": "^1.17.2",
41
41
  "gh-pages": "^3.0.0",
42
42
  "lint-staged": "^10.0.7",
43
- "prettier": "^2.2.1",
44
- "yorkie": "^2.0.0"
43
+ "prettier": "^2.2.1"
45
44
  },
46
45
  "publishConfig": {
47
46
  "access": "public"
48
47
  }
49
- }
48
+ }
@@ -2,7 +2,7 @@
2
2
  * @Description:
3
3
  * @Author: rodchen
4
4
  * @Date: 2021-12-01 10:52:08
5
- * @LastEditTime: 2021-12-22 14:24:35
5
+ * @LastEditTime: 2021-12-29 17:11:56
6
6
  * @LastEditors: rodchen
7
7
  */
8
8
  // @ts-nocheck
@@ -19,7 +19,6 @@ import {
19
19
  message,
20
20
  } from 'antd';
21
21
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
22
- import 'antd/dist/antd.css';
23
22
  import {
24
23
  ExclamationCircleOutlined,
25
24
  DownOutlined,
@@ -107,6 +106,7 @@ class DataValidation extends React.Component {
107
106
  id: `item-0${index}`,
108
107
  content: mapping.get(item),
109
108
  code: item,
109
+ type: "string"
110
110
  };
111
111
  });
112
112
 
@@ -419,7 +419,7 @@ class DataValidation extends React.Component {
419
419
  console.log(setExportData);
420
420
  setExportData([123123]);
421
421
  })
422
- .catch((err) => {});
422
+ .catch((err) => { });
423
423
  };
424
424
 
425
425
  filterData = (type: string) => {
@@ -0,0 +1,37 @@
1
+ .query_input {
2
+ &_show {
3
+ display: flex;
4
+ }
5
+
6
+ &_expand_button {
7
+ position: relative;
8
+ width: 30px;
9
+ color: #ffffff;
10
+ cursor: pointer;
11
+
12
+ span {
13
+ position: absolute;
14
+ height: 20px;
15
+ line-height: 14px;
16
+ left: 50%;
17
+ top: 50%;
18
+ transform: translate(-50%, -50%);
19
+ }
20
+ }
21
+
22
+ &_wrapper {
23
+ display: flex;
24
+
25
+ &_left {
26
+ width: 100px;
27
+ }
28
+
29
+ &_right {
30
+ color: #9e9e9e;
31
+ }
32
+ }
33
+
34
+ &_textArea {
35
+ margin-top: 15px;
36
+ }
37
+ }
@@ -9,20 +9,22 @@ title: 批量查询组件
9
9
  order: 1
10
10
  ---
11
11
 
12
- ## QueryInput
12
+ ## QueryMutipleInput
13
13
 
14
14
  Demo:
15
15
 
16
16
  ```tsx
17
17
  import React, { useRef } from 'react';
18
- import { QueryInput } from '../../index';
18
+ import { QueryMutipleInput } from '../../index';
19
19
 
20
20
  export default () => {
21
- let dataValidationRef: QueryInput = useRef();
21
+ const handleOnChange = (value) => {
22
+ console.log(value);
23
+ };
22
24
 
23
25
  return (
24
26
  <div>
25
- <QueryInput />
27
+ <QueryMutipleInput onValueChange={handleOnChange} />
26
28
  </div>
27
29
  );
28
30
  };
@@ -2,30 +2,48 @@
2
2
  * @Description:
3
3
  * @Author: rodchen
4
4
  * @Date: 2021-12-01 10:52:08
5
- * @LastEditTime: 2021-12-27 21:29:23
5
+ * @LastEditTime: 2021-12-29 19:14:56
6
6
  * @LastEditors: rodchen
7
7
  */
8
8
  // @ts-nocheck
9
- import React, { useState } from 'react';
9
+ import React, { useState, useEffect } from 'react';
10
+ import { useDebounceFn } from 'ahooks';
10
11
  import { Input, Button, Modal } from 'antd';
11
- import 'antd/dist/antd.css';
12
- import styles from './index.less';
12
+ import './index.less';
13
13
 
14
- const QueryInput = () => {
14
+ const QueryMutipleInput = ({ onValueChange }) => {
15
15
  const [isModalVisible, setIsModalVisible] = useState(false);
16
16
  const [value, setValue] = useState('');
17
+ const [popvalue, setPopValue] = useState('');
18
+ const { run } = useDebounceFn(
19
+ () => {
20
+ formaData(value);
21
+ },
22
+ {
23
+ wait: 1000,
24
+ },
25
+ );
26
+
27
+ useEffect(() => {
28
+ setPopValue(value);
29
+ onValueChange(value);
30
+ }, [value]);
17
31
 
18
32
  const showModal = () => {
19
33
  setIsModalVisible(true);
20
34
  };
21
35
 
22
36
  const handleOk = () => {
37
+ formaData(popvalue);
38
+ setIsModalVisible(false);
39
+ };
40
+
41
+ const formaData = (value) => {
23
42
  let formatValue = ToCDB(value)
24
43
  .split(/[/\n/\s,;]/)
25
44
  .filter((item) => item)
26
45
  .join(',');
27
46
  setValue(formatValue);
28
- setIsModalVisible(false);
29
47
  };
30
48
 
31
49
  const handleCancel = () => {
@@ -33,31 +51,32 @@ const QueryInput = () => {
33
51
  };
34
52
 
35
53
  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);
54
+ setValue(e.target.value);
55
+ run();
42
56
  };
43
57
 
44
58
  const onChange = (e) => {
45
- setValue(e.target.value);
59
+ setPopValue(e.target.value);
46
60
  };
47
61
 
48
62
  return (
49
- <div className={styles.query_input}>
50
- <Input.Group compact>
63
+ <div className={'query_input'}>
64
+ <div class="query_input_show">
51
65
  <Input
52
66
  value={value}
53
67
  onChange={outerChange}
54
- style={{ width: 'calc(100% - 50px)' }}
68
+ onBlur={(e) => {
69
+ formaData(e.target.value);
70
+ }}
71
+ onPaste={(e) => {
72
+ formaData(e.clipboardData.getData('text'));
73
+ e.preventDefault();
74
+ }}
75
+ style={{ width: 'calc(100% - 30px)' }}
55
76
  placeholder="请输入(查询多个值请用 ; 或 , 分割)"
56
77
  />
57
- <Button className={styles.button} onClick={showModal} type="primary">
58
- ...
59
- </Button>
60
- </Input.Group>
78
+ <Button style={{width: '30px', padding: '2px', height: 'auto'}} onClick={showModal} type="primary">...</Button>
79
+ </div>
61
80
  <Modal
62
81
  width={600}
63
82
  title="多值录入"
@@ -73,15 +92,15 @@ const QueryInput = () => {
73
92
  </Button>,
74
93
  ]}
75
94
  >
76
- <div className={styles.query_input_wrapper}>
77
- <div className={styles.query_input_wrapper_left}>录入区:</div>
78
- <div className={styles.query_input_wrapper_right}>
95
+ <div className={'query_input_wrapper'}>
96
+ <div className={'query_input_wrapper_left'}>录入区:</div>
97
+ <div className={'query_input_wrapper_right'}>
79
98
  <div>
80
99
  如需同时使用多个值进行查询,请使用逗号、分号、空格或换行进行值的分隔,中英文格式的符号均支持
81
100
  </div>
82
- <div className={styles.query_input_textArea}>
101
+ <div className={'query_input_textArea'}>
83
102
  <Input.TextArea
84
- value={value}
103
+ value={popvalue}
85
104
  onChange={onChange}
86
105
  rows={6}
87
106
  showCount
@@ -106,4 +125,4 @@ function ToCDB(str) {
106
125
  return tmp;
107
126
  }
108
127
 
109
- export default QueryInput;
128
+ export default QueryMutipleInput;
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-27 20:16:20
5
+ * @LastEditTime: 2021-12-29 17:43:01
6
6
  * @LastEditors: rodchen
7
7
  */
8
8
 
@@ -13,4 +13,4 @@ const resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
13
13
  axios.defaults.headers.common['sso-sessionid'] = resposne?.sessionId || '';
14
14
 
15
15
  export { default as DataValidation } from './components/DataValidation';
16
- export { default as QueryInput } from './components/QueryInput';
16
+ export { default as QueryMutipleInput } from './components/QueryMutipleInput';
@@ -1,3 +0,0 @@
1
- import 'antd/dist/antd.css';
2
- declare const QueryInput: () => JSX.Element;
3
- export default QueryInput;
@@ -1,21 +0,0 @@
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
- }