ztxkui 4.2.5 → 4.2.6

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.
@@ -47,6 +47,15 @@ var configInfo = {
47
47
  isDisplay: 1,
48
48
  },
49
49
  };
50
+ var getCustomDom = function () {
51
+ return (React.createElement(React.Fragment, { key: "search-form-fragment-id" },
52
+ React.createElement(SearchItem, { name: "type7", width: "half", label: "\u4F60\u597D7" },
53
+ React.createElement(Select, null)),
54
+ React.createElement(SearchItem, { name: "type8", width: "half", label: "\u4F60\u597D811" },
55
+ React.createElement(Select, null)),
56
+ React.createElement(SearchItem, { name: "type5", width: "all", label: "\u4F60\u597D" },
57
+ React.createElement(Input.TextArea, { showCount: true, rows: 3, handleSize: true }))));
58
+ };
50
59
  var FormDemo = function () {
51
60
  var form = Form.useForm()[0];
52
61
  var _a = useState('1'), status = _a[0], setStatus = _a[1];
@@ -57,15 +66,6 @@ var FormDemo = function () {
57
66
  return __assign(__assign({}, configInfo), { startTime: __assign(__assign({}, configInfo === null || configInfo === void 0 ? void 0 : configInfo.startTime), { isDisplay: status === '1' ? true : false }) });
58
67
  }, [status]);
59
68
  var handleRef = useRef(null);
60
- var getDom = function () {
61
- return (React.createElement(React.Fragment, { key: "search-form-fragment-id" },
62
- React.createElement(SearchItem, { name: "type7", width: "half", label: "\u4F60\u597D7" },
63
- React.createElement(Select, null)),
64
- React.createElement(SearchItem, { name: "type8", width: "half", label: "\u4F60\u597D811" },
65
- React.createElement(Select, null)),
66
- React.createElement(SearchItem, { name: "type5", width: "all", label: "\u4F60\u597D" },
67
- React.createElement(Input.TextArea, { showCount: true, rows: 3, handleSize: true }))));
68
- };
69
69
  return (React.createElement(React.Fragment, null,
70
70
  React.createElement(Form, { name: "test-list", form: form },
71
71
  React.createElement(SearchContainer, { dark: true },
@@ -130,7 +130,7 @@ var FormDemo = function () {
130
130
  React.createElement(Select, null)),
131
131
  React.createElement(SearchItem, { name: "type6", width: "half", label: "\u4F60\u597D6" },
132
132
  React.createElement(Select, null)),
133
- getDom()),
133
+ getCustomDom()),
134
134
  React.createElement(SearchRight, { onSearchHandle: function () {
135
135
  var _a;
136
136
  (_a = handleRef.current) === null || _a === void 0 ? void 0 : _a.setToggleHandle(false);
@@ -46,6 +46,44 @@ import { dangerouslySetXss } from 'ztxkutils/dist/tools';
46
46
  var enhanceSelectCatchObj = {};
47
47
  var enhanceSelectCatchLruKeys = [];
48
48
  var enhanceSelectCatchLruMaxSize = 800;
49
+ // LRU缓存清除逻辑
50
+ var enhanceSelectCatchLruHandle = function (url) {
51
+ if (enhanceSelectCatchObj) {
52
+ enhanceSelectCatchObj[url] = enhanceSelectCatchObj[url]
53
+ ? enhanceSelectCatchObj[url]
54
+ : {};
55
+ var currentIndex = enhanceSelectCatchLruKeys.indexOf(url);
56
+ if (currentIndex !== -1) {
57
+ enhanceSelectCatchLruKeys.splice(currentIndex, 1);
58
+ enhanceSelectCatchLruKeys.push(url);
59
+ }
60
+ else {
61
+ enhanceSelectCatchLruKeys.push(url);
62
+ }
63
+ if (enhanceSelectCatchLruKeys.length > enhanceSelectCatchLruMaxSize) {
64
+ var oldKey = enhanceSelectCatchLruKeys.shift();
65
+ try {
66
+ delete enhanceSelectCatchLruKeys[oldKey];
67
+ }
68
+ catch (err) {
69
+ //
70
+ }
71
+ }
72
+ var keys = enhanceSelectCatchObj[url]
73
+ ? Object.keys(enhanceSelectCatchObj[url])
74
+ : [];
75
+ if (keys.length > 10) {
76
+ keys.slice(0, keys.length - 10).forEach(function (key) {
77
+ try {
78
+ delete enhanceSelectCatchObj[url][key];
79
+ }
80
+ catch (err) {
81
+ //
82
+ }
83
+ });
84
+ }
85
+ }
86
+ };
49
87
  export function clearCatchData(url) {
50
88
  enhanceSelectCatchObj[url] = {};
51
89
  }
@@ -436,27 +474,8 @@ function EnhanceSelect(_a) {
436
474
  return;
437
475
  }
438
476
  if (isCatch) {
477
+ enhanceSelectCatchLruHandle(url);
439
478
  if (enhanceSelectCatchObj) {
440
- enhanceSelectCatchObj[url] = enhanceSelectCatchObj[url]
441
- ? enhanceSelectCatchObj[url]
442
- : {};
443
- var currentIndex = enhanceSelectCatchLruKeys.indexOf(url);
444
- if (currentIndex !== -1) {
445
- enhanceSelectCatchLruKeys.splice(currentIndex, 1);
446
- enhanceSelectCatchLruKeys.push(url);
447
- }
448
- else {
449
- enhanceSelectCatchLruKeys.push(url);
450
- }
451
- if (enhanceSelectCatchLruKeys.length > enhanceSelectCatchLruMaxSize) {
452
- var oldKey = enhanceSelectCatchLruKeys.shift();
453
- try {
454
- delete enhanceSelectCatchLruKeys[oldKey];
455
- }
456
- catch (err) {
457
- //
458
- }
459
- }
460
479
  var catchData = enhanceSelectCatchObj[url];
461
480
  var catchDataKey = params ? JSON.stringify(params) : 'single';
462
481
  if (!catchData[catchDataKey]) {
@@ -493,27 +512,8 @@ function EnhanceSelect(_a) {
493
512
  return;
494
513
  }
495
514
  if (isCatch) {
515
+ enhanceSelectCatchLruHandle(url);
496
516
  if (enhanceSelectCatchObj) {
497
- enhanceSelectCatchObj[url] = enhanceSelectCatchObj[url]
498
- ? enhanceSelectCatchObj[url]
499
- : {};
500
- var currentIndex = enhanceSelectCatchLruKeys.indexOf(url);
501
- if (currentIndex !== -1) {
502
- enhanceSelectCatchLruKeys.splice(currentIndex, 1);
503
- enhanceSelectCatchLruKeys.push(url);
504
- }
505
- else {
506
- enhanceSelectCatchLruKeys.push(url);
507
- }
508
- if (enhanceSelectCatchLruKeys.length > enhanceSelectCatchLruMaxSize) {
509
- var oldKey = enhanceSelectCatchLruKeys.shift();
510
- try {
511
- delete enhanceSelectCatchLruKeys[oldKey];
512
- }
513
- catch (err) {
514
- //
515
- }
516
- }
517
517
  var catchData = enhanceSelectCatchObj[url];
518
518
  var catchDataKey = params ? JSON.stringify(params) : 'single';
519
519
  // 发送接口请求,并设置缓存数据
@@ -541,28 +541,8 @@ function EnhanceSelect(_a) {
541
541
  // console.log('TEST: 异步获取');
542
542
  if (isCatch) {
543
543
  // 如果是走缓存的话,那么先往缓存数据中取,有没有当前数据,如果没有就发请求
544
+ enhanceSelectCatchLruHandle(url);
544
545
  if (enhanceSelectCatchObj) {
545
- enhanceSelectCatchObj[url] = enhanceSelectCatchObj[url]
546
- ? enhanceSelectCatchObj[url]
547
- : {};
548
- var currentIndex = enhanceSelectCatchLruKeys.indexOf(url);
549
- // 当前访问数据置为最新鲜
550
- if (currentIndex !== -1) {
551
- enhanceSelectCatchLruKeys.splice(currentIndex, 1);
552
- enhanceSelectCatchLruKeys.push(url);
553
- }
554
- else {
555
- enhanceSelectCatchLruKeys.push(url);
556
- }
557
- if (enhanceSelectCatchLruKeys.length > enhanceSelectCatchLruMaxSize) {
558
- var oldKey = enhanceSelectCatchLruKeys.shift();
559
- try {
560
- delete enhanceSelectCatchLruKeys[oldKey];
561
- }
562
- catch (err) {
563
- //
564
- }
565
- }
566
546
  var catchData = enhanceSelectCatchObj[url];
567
547
  var catchDataKey = params ? JSON.stringify(params) : 'single';
568
548
  if (catchData[catchDataKey]) {
@@ -69,7 +69,7 @@ export function getNewChildren(children) {
69
69
  React.Children.forEach(children, function (item) {
70
70
  var _a;
71
71
  // 这个需要拉平这个数据
72
- if (item.key === 'search-form-fragment-id' &&
72
+ if ((item === null || item === void 0 ? void 0 : item.key) === 'search-form-fragment-id' &&
73
73
  (item === null || item === void 0 ? void 0 : item.props) &&
74
74
  Array.isArray((_a = item === null || item === void 0 ? void 0 : item.props) === null || _a === void 0 ? void 0 : _a.children)) {
75
75
  React.Children.forEach(item === null || item === void 0 ? void 0 : item.props.children, function (item) {
@@ -193,7 +193,7 @@ dynamicStorageKey // 动态列配置的key值
193
193
  React.Children.forEach(children, function (item) {
194
194
  var _a;
195
195
  // 这个需要拉平这个数据
196
- if (item.key === 'search-form-fragment-id' &&
196
+ if ((item === null || item === void 0 ? void 0 : item.key) === 'search-form-fragment-id' &&
197
197
  (item === null || item === void 0 ? void 0 : item.props) &&
198
198
  Array.isArray((_a = item === null || item === void 0 ? void 0 : item.props) === null || _a === void 0 ? void 0 : _a.children)) {
199
199
  React.Children.forEach(item === null || item === void 0 ? void 0 : item.props.children, function (item) {
@@ -223,6 +223,7 @@ dynamicStorageKey // 动态列配置的key值
223
223
  });
224
224
  // console.log(_initDynamicList, _currentDynamicList);
225
225
  setNewChildren(getNewChildren(children));
226
+ // setNewChildren(children);
226
227
  setDynamicArr(_currentDynamicList_1);
227
228
  setInitDynamicArr(_initDynamicList_1);
228
229
  }
@@ -4,14 +4,18 @@ import SearchDrawer from './search-drawer';
4
4
  import { SettingOutlined, DownOutlined } from '@ant-design/icons';
5
5
  import useDynamic, { setDynamicKey, getNewChildren } from './hooks/useDynamic';
6
6
  import useToggle from './hooks/useToggle';
7
- function useConfigChildren(children) {
7
+ function useConfigChildren(children, isDynamic) {
8
8
  var _a = useState(null), configChildren = _a[0], setConfigChildren = _a[1];
9
9
  useEffect(function () {
10
10
  if (children) {
11
- // setConfigChildren(children);
12
- setConfigChildren(getNewChildren(children));
11
+ if (isDynamic) {
12
+ setConfigChildren(getNewChildren(children));
13
+ }
14
+ else {
15
+ setConfigChildren(children);
16
+ }
13
17
  }
14
- }, [children]);
18
+ }, [children, isDynamic]);
15
19
  return { configChildren: configChildren };
16
20
  }
17
21
  var SearchLeft = function (_a) {
@@ -24,7 +28,7 @@ var SearchLeft = function (_a) {
24
28
  : window.location.pathname;
25
29
  /**缓存初始化值 */
26
30
  var _c = useDynamic(children, isDynamic, dynamicStorageKey), dynamicArr = _c.dynamicArr, initDynamicArr = _c.initDynamicArr, newChildren = _c.newChildren;
27
- var configChildren = useConfigChildren(children).configChildren;
31
+ var configChildren = useConfigChildren(children, isDynamic).configChildren;
28
32
  var classes = classNames('zt-search__left', className, {
29
33
  'zt-search__left--flex': isFlex,
30
34
  'zt-search__left--dynamic': isDynamic,
@@ -579,6 +579,7 @@ var Sinatures = function (_a) {
579
579
  setRecords(function (preRecords) {
580
580
  return getNewRecord_1(preRecords);
581
581
  });
582
+ setContractId(null);
582
583
  message.success('文件删除成功!');
583
584
  }
584
585
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "4.2.5",
3
+ "version": "4.2.6",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",