@bit-sun/business-component 1.1.25 → 1.1.26

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.
@@ -1,2 +1,3 @@
1
- declare const BusinessSearchSelect: (props: any) => JSX.Element;
2
- export default BusinessSearchSelect;
1
+ import React from 'react';
2
+ declare const _default: React.MemoExoticComponent<(props: any) => JSX.Element>;
3
+ export default _default;
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import axios from 'axios';
2
- import React, { createContext, useContext, useEffect, forwardRef, createElement, useState, useRef } from 'react';
2
+ import React, { createContext, useContext, useEffect, forwardRef, createElement, useState, useMemo, useRef } from 'react';
3
3
  import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag } from 'antd';
4
4
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
5
5
  import classNames from 'classnames';
@@ -78,14 +78,14 @@ function _inherits(subClass, superClass) {
78
78
  throw new TypeError("Super expression must either be null or a function");
79
79
  }
80
80
 
81
- subClass.prototype = Object.create(superClass && superClass.prototype, {
82
- constructor: {
83
- value: subClass,
84
- writable: true,
85
- configurable: true
86
- }
87
- });
88
81
  Object.defineProperty(subClass, "prototype", {
82
+ value: Object.create(superClass && superClass.prototype, {
83
+ constructor: {
84
+ value: subClass,
85
+ writable: true,
86
+ configurable: true
87
+ }
88
+ }),
89
89
  writable: false
90
90
  });
91
91
  if (superClass) _setPrototypeOf(subClass, superClass);
@@ -484,7 +484,7 @@ function boundAlpha(a) {
484
484
  */
485
485
  function convertToPercentage(n) {
486
486
  if (n <= 1) {
487
- return "".concat(Number(n) * 100, "%");
487
+ return Number(n) * 100 + "%";
488
488
  }
489
489
  return n;
490
490
  }
@@ -866,12 +866,12 @@ var CSS_INTEGER = '[-\\+]?\\d+%?';
866
866
  // <http://www.w3.org/TR/css3-values/#number-value>
867
867
  var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
868
868
  // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
869
- var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
869
+ var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
870
870
  // Actual matching.
871
871
  // Parentheses and commas are optional, but not required.
872
872
  // Whitespace can take the place of commas or opening paren
873
- var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
874
- var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
873
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
874
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
875
875
  var matchers = {
876
876
  CSS_UNIT: new RegExp(CSS_UNIT),
877
877
  rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
@@ -1222,17 +1222,6 @@ function canUseDom() {
1222
1222
 
1223
1223
  var MARK_KEY = "rc-util-key";
1224
1224
 
1225
- function getMark() {
1226
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1227
- mark = _ref.mark;
1228
-
1229
- if (mark) {
1230
- return mark.startsWith('data-') ? mark : "data-".concat(mark);
1231
- }
1232
-
1233
- return MARK_KEY;
1234
- }
1235
-
1236
1225
  function getContainer(option) {
1237
1226
  if (option.attachTo) {
1238
1227
  return option.attachTo;
@@ -1276,14 +1265,6 @@ function injectCSS(css) {
1276
1265
  return styleNode;
1277
1266
  }
1278
1267
  var containerCache = new Map();
1279
-
1280
- function findExistNode(key) {
1281
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1282
- var container = getContainer(option);
1283
- return Array.from(containerCache.get(container).children).find(function (node) {
1284
- return node.tagName === 'STYLE' && node.getAttribute(getMark(option)) === key;
1285
- });
1286
- }
1287
1268
  function updateCSS(css, key) {
1288
1269
  var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1289
1270
  var container = getContainer(option); // Get real parent
@@ -1295,7 +1276,9 @@ function updateCSS(css, key) {
1295
1276
  parentNode.removeChild(placeholderStyle);
1296
1277
  }
1297
1278
 
1298
- var existNode = findExistNode(key, option);
1279
+ var existNode = Array.from(containerCache.get(container).children).find(function (node) {
1280
+ return node.tagName === 'STYLE' && node[MARK_KEY] === key;
1281
+ });
1299
1282
 
1300
1283
  if (existNode) {
1301
1284
  var _option$csp3, _option$csp4;
@@ -1314,7 +1297,7 @@ function updateCSS(css, key) {
1314
1297
  }
1315
1298
 
1316
1299
  var newNode = injectCSS(css, option);
1317
- newNode.setAttribute(getMark(option), key);
1300
+ newNode[MARK_KEY] = key;
1318
1301
  return newNode;
1319
1302
  }
1320
1303
 
@@ -4366,6 +4349,8 @@ function commonFun(type, prefixUrl) {
4366
4349
  };
4367
4350
  }
4368
4351
 
4352
+ var MemoSearchSelect = /*#__PURE__*/React.memo(SearchSelect);
4353
+
4369
4354
  var BusinessSearchSelect = function BusinessSearchSelect(props) {
4370
4355
  var businessType = (props === null || props === void 0 ? void 0 : props.selectBusinessType) || 'supplier';
4371
4356
  var prefixUrl = (props === null || props === void 0 ? void 0 : props.prefixUrl) || {
@@ -4378,16 +4363,21 @@ var BusinessSearchSelect = function BusinessSearchSelect(props) {
4378
4363
  modalTableProps = _commonFun.modalTableProps,
4379
4364
  needModalTable = _commonFun.needModalTable;
4380
4365
 
4381
- var currentProps = _objectSpread2(_objectSpread2({
4382
- requestConfig: requestConfig
4383
- }, props), {}, {
4384
- needModalTable: needModalTable,
4385
- modalTableProps: modalTableProps
4386
- });
4387
-
4388
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SearchSelect, _objectSpread2({}, currentProps)));
4366
+ var currentProps = useMemo(function () {
4367
+ return _objectSpread2(_objectSpread2({
4368
+ requestConfig: requestConfig
4369
+ }, props), {}, {
4370
+ needModalTable: needModalTable,
4371
+ modalTableProps: modalTableProps
4372
+ });
4373
+ }, []);
4374
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MemoSearchSelect, _objectSpread2({}, currentProps)));
4389
4375
  };
4390
4376
 
4377
+ var index = /*#__PURE__*/React.memo(BusinessSearchSelect, function () {
4378
+ return true;
4379
+ });
4380
+
4391
4381
  var CommodityEntry = function CommodityEntry(props) {
4392
4382
  var dataValidationRef = useRef();
4393
4383
  var _props$buttonName = props.buttonName,
@@ -4473,7 +4463,7 @@ var CommodityEntry = function CommodityEntry(props) {
4473
4463
  * @LastEditTime: 2022-01-14 17:17:26
4474
4464
  * @LastEditors: rodchen
4475
4465
  */
4476
- var index = (function (storageKeyString) {
4466
+ var index$1 = (function (storageKeyString) {
4477
4467
  var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
4478
4468
  var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
4479
4469
  if (typeof seconds !== 'number') throw new Error('seconds should be number');
@@ -4533,4 +4523,4 @@ function getStorageVale(storageKeyString) {
4533
4523
  var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
4534
4524
  axios.defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
4535
4525
 
4536
- export { BusinessSearchSelect, index as CheckOneUser, CommodityEntry, DataValidation, QueryMutipleInput, SearchSelect };
4526
+ export { index as BusinessSearchSelect, index$1 as CheckOneUser, CommodityEntry, DataValidation, QueryMutipleInput, SearchSelect };
package/dist/index.js CHANGED
@@ -89,14 +89,14 @@ function _inherits(subClass, superClass) {
89
89
  throw new TypeError("Super expression must either be null or a function");
90
90
  }
91
91
 
92
- subClass.prototype = Object.create(superClass && superClass.prototype, {
93
- constructor: {
94
- value: subClass,
95
- writable: true,
96
- configurable: true
97
- }
98
- });
99
92
  Object.defineProperty(subClass, "prototype", {
93
+ value: Object.create(superClass && superClass.prototype, {
94
+ constructor: {
95
+ value: subClass,
96
+ writable: true,
97
+ configurable: true
98
+ }
99
+ }),
100
100
  writable: false
101
101
  });
102
102
  if (superClass) _setPrototypeOf(subClass, superClass);
@@ -495,7 +495,7 @@ function boundAlpha(a) {
495
495
  */
496
496
  function convertToPercentage(n) {
497
497
  if (n <= 1) {
498
- return "".concat(Number(n) * 100, "%");
498
+ return Number(n) * 100 + "%";
499
499
  }
500
500
  return n;
501
501
  }
@@ -877,12 +877,12 @@ var CSS_INTEGER = '[-\\+]?\\d+%?';
877
877
  // <http://www.w3.org/TR/css3-values/#number-value>
878
878
  var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
879
879
  // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
880
- var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
880
+ var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
881
881
  // Actual matching.
882
882
  // Parentheses and commas are optional, but not required.
883
883
  // Whitespace can take the place of commas or opening paren
884
- var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
885
- var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
884
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
885
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
886
886
  var matchers = {
887
887
  CSS_UNIT: new RegExp(CSS_UNIT),
888
888
  rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
@@ -1233,17 +1233,6 @@ function canUseDom() {
1233
1233
 
1234
1234
  var MARK_KEY = "rc-util-key";
1235
1235
 
1236
- function getMark() {
1237
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1238
- mark = _ref.mark;
1239
-
1240
- if (mark) {
1241
- return mark.startsWith('data-') ? mark : "data-".concat(mark);
1242
- }
1243
-
1244
- return MARK_KEY;
1245
- }
1246
-
1247
1236
  function getContainer(option) {
1248
1237
  if (option.attachTo) {
1249
1238
  return option.attachTo;
@@ -1287,14 +1276,6 @@ function injectCSS(css) {
1287
1276
  return styleNode;
1288
1277
  }
1289
1278
  var containerCache = new Map();
1290
-
1291
- function findExistNode(key) {
1292
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1293
- var container = getContainer(option);
1294
- return Array.from(containerCache.get(container).children).find(function (node) {
1295
- return node.tagName === 'STYLE' && node.getAttribute(getMark(option)) === key;
1296
- });
1297
- }
1298
1279
  function updateCSS(css, key) {
1299
1280
  var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1300
1281
  var container = getContainer(option); // Get real parent
@@ -1306,7 +1287,9 @@ function updateCSS(css, key) {
1306
1287
  parentNode.removeChild(placeholderStyle);
1307
1288
  }
1308
1289
 
1309
- var existNode = findExistNode(key, option);
1290
+ var existNode = Array.from(containerCache.get(container).children).find(function (node) {
1291
+ return node.tagName === 'STYLE' && node[MARK_KEY] === key;
1292
+ });
1310
1293
 
1311
1294
  if (existNode) {
1312
1295
  var _option$csp3, _option$csp4;
@@ -1325,7 +1308,7 @@ function updateCSS(css, key) {
1325
1308
  }
1326
1309
 
1327
1310
  var newNode = injectCSS(css, option);
1328
- newNode.setAttribute(getMark(option), key);
1311
+ newNode[MARK_KEY] = key;
1329
1312
  return newNode;
1330
1313
  }
1331
1314
 
@@ -4377,6 +4360,8 @@ function commonFun(type, prefixUrl) {
4377
4360
  };
4378
4361
  }
4379
4362
 
4363
+ var MemoSearchSelect = /*#__PURE__*/React__default['default'].memo(SearchSelect);
4364
+
4380
4365
  var BusinessSearchSelect = function BusinessSearchSelect(props) {
4381
4366
  var businessType = (props === null || props === void 0 ? void 0 : props.selectBusinessType) || 'supplier';
4382
4367
  var prefixUrl = (props === null || props === void 0 ? void 0 : props.prefixUrl) || {
@@ -4389,16 +4374,21 @@ var BusinessSearchSelect = function BusinessSearchSelect(props) {
4389
4374
  modalTableProps = _commonFun.modalTableProps,
4390
4375
  needModalTable = _commonFun.needModalTable;
4391
4376
 
4392
- var currentProps = _objectSpread2(_objectSpread2({
4393
- requestConfig: requestConfig
4394
- }, props), {}, {
4395
- needModalTable: needModalTable,
4396
- modalTableProps: modalTableProps
4397
- });
4398
-
4399
- return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(SearchSelect, _objectSpread2({}, currentProps)));
4377
+ var currentProps = React.useMemo(function () {
4378
+ return _objectSpread2(_objectSpread2({
4379
+ requestConfig: requestConfig
4380
+ }, props), {}, {
4381
+ needModalTable: needModalTable,
4382
+ modalTableProps: modalTableProps
4383
+ });
4384
+ }, []);
4385
+ return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(MemoSearchSelect, _objectSpread2({}, currentProps)));
4400
4386
  };
4401
4387
 
4388
+ var index = /*#__PURE__*/React__default['default'].memo(BusinessSearchSelect, function () {
4389
+ return true;
4390
+ });
4391
+
4402
4392
  var CommodityEntry = function CommodityEntry(props) {
4403
4393
  var dataValidationRef = React.useRef();
4404
4394
  var _props$buttonName = props.buttonName,
@@ -4484,7 +4474,7 @@ var CommodityEntry = function CommodityEntry(props) {
4484
4474
  * @LastEditTime: 2022-01-14 17:17:26
4485
4475
  * @LastEditors: rodchen
4486
4476
  */
4487
- var index = (function (storageKeyString) {
4477
+ var index$1 = (function (storageKeyString) {
4488
4478
  var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
4489
4479
  var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
4490
4480
  if (typeof seconds !== 'number') throw new Error('seconds should be number');
@@ -4544,8 +4534,8 @@ function getStorageVale(storageKeyString) {
4544
4534
  var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
4545
4535
  axios__default['default'].defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
4546
4536
 
4547
- exports.BusinessSearchSelect = BusinessSearchSelect;
4548
- exports.CheckOneUser = index;
4537
+ exports.BusinessSearchSelect = index;
4538
+ exports.CheckOneUser = index$1;
4549
4539
  exports.CommodityEntry = CommodityEntry;
4550
4540
  exports.DataValidation = DataValidation;
4551
4541
  exports.QueryMutipleInput = QueryMutipleInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "1.1.25",
3
+ "version": "1.1.26",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -1,26 +1,35 @@
1
- import React from 'react';
1
+ /*
2
+ * @Description:
3
+ * @Author: rodchen
4
+ * @Date: 2022-05-07 15:17:28
5
+ * @LastEditTime: 2022-05-08 21:01:21
6
+ * @LastEditors: rodchen
7
+ */
8
+ import React, { useMemo } from 'react';
2
9
  import { commonFun } from './BusinessUtils';
3
10
  import SearchSelect from '@/components/Functional/SearchSelect';
4
11
 
12
+ const MemoSearchSelect = React.memo(SearchSelect)
5
13
 
6
14
  const BusinessSearchSelect = (props: any) => {
7
15
  const businessType = props?.selectBusinessType || 'supplier';
8
16
  const prefixUrl = props?.prefixUrl || { selectPrefix: '/bop/api', formSelectFix: '/bop/api' };
9
17
 
10
18
  const { requestConfig, modalTableProps, needModalTable } = commonFun(businessType, prefixUrl);
11
-
12
- const currentProps = {
13
- requestConfig,
14
- ...props,
15
- needModalTable,
16
- modalTableProps
17
- }
19
+ const currentProps = useMemo(() => {
20
+ return {
21
+ requestConfig,
22
+ ...props,
23
+ needModalTable,
24
+ modalTableProps
25
+ }
26
+ }, [])
18
27
 
19
28
  return (
20
29
  <div>
21
- <SearchSelect {...currentProps} />
30
+ <MemoSearchSelect {...currentProps} />
22
31
  </div>
23
32
  );
24
33
  };
25
34
 
26
- export default BusinessSearchSelect;
35
+ export default React.memo(BusinessSearchSelect, () => true);