ztxkui 10.0.95 → 10.0.97

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 (150) hide show
  1. package/dist/components/TranslationButton/DownFile.d.ts +7 -0
  2. package/dist/components/TranslationButton/DownFile.js +97 -0
  3. package/dist/components/TranslationButton/PreviewFile.d.ts +5 -0
  4. package/dist/components/TranslationButton/PreviewFile.js +75 -0
  5. package/dist/components/TranslationButton/TranslationButton.d.ts +34 -0
  6. package/dist/components/TranslationButton/TranslationButton.js +247 -0
  7. package/dist/components/TranslationButton/demoComponents/index.d.ts +3 -0
  8. package/dist/components/TranslationButton/demoComponents/index.js +9 -0
  9. package/dist/components/TranslationButton/hooks.d.ts +8 -0
  10. package/dist/components/TranslationButton/hooks.js +143 -0
  11. package/dist/components/TranslationButton/index.d.ts +4 -0
  12. package/dist/components/TranslationButton/index.js +4 -0
  13. package/dist/components/Upload/utils.d.ts +8 -1
  14. package/dist/components/Upload/utils.js +56 -4
  15. package/dist/components/UploadCustom/hooks/useDg.d.ts +6 -0
  16. package/dist/components/UploadCustom/hooks/useDg.js +57 -0
  17. package/dist/components/business/Signatures/components/CodeModal.d.ts +3 -0
  18. package/dist/components/business/Signatures/components/CodeModal.js +159 -0
  19. package/dist/components/electron-signatures/content.d.ts +9 -0
  20. package/dist/components/electron-signatures/content.js +1126 -0
  21. package/dist/components/electron-signatures/demoComponents/data.d.ts +58 -0
  22. package/dist/components/electron-signatures/demoComponents/data.js +1307 -0
  23. package/dist/components/electron-signatures/demoComponents/detail.d.ts +6 -0
  24. package/dist/components/electron-signatures/demoComponents/detail.js +283 -0
  25. package/dist/components/electron-signatures/demoComponents/index.d.ts +2 -0
  26. package/dist/components/electron-signatures/demoComponents/index.js +27 -0
  27. package/dist/components/electron-signatures/demoComponents/index_old.d.ts +3 -0
  28. package/dist/components/electron-signatures/demoComponents/index_old.js +502 -0
  29. package/dist/components/electron-signatures/demoComponents/jgqrd.d.ts +6 -0
  30. package/dist/components/electron-signatures/demoComponents/jgqrd.js +135 -0
  31. package/dist/components/electron-signatures/demoComponents/making.d.ts +6 -0
  32. package/dist/components/electron-signatures/demoComponents/making.js +211 -0
  33. package/dist/components/electron-signatures/demoComponents/makingData.d.ts +663 -0
  34. package/dist/components/electron-signatures/demoComponents/makingData.js +1164 -0
  35. package/dist/components/electron-signatures/demoComponents/newDetail.d.ts +6 -0
  36. package/dist/components/electron-signatures/demoComponents/newDetail.js +283 -0
  37. package/dist/components/electron-signatures/demoComponents/preview.d.ts +3 -0
  38. package/dist/components/electron-signatures/demoComponents/preview.js +9 -0
  39. package/dist/components/electron-signatures/demoComponents/singleQjDetail.d.ts +6 -0
  40. package/dist/components/electron-signatures/demoComponents/singleQjDetail.js +530 -0
  41. package/dist/components/electron-signatures/demoComponents/singleQjMaking.d.ts +6 -0
  42. package/dist/components/electron-signatures/demoComponents/singleQjMaking.js +219 -0
  43. package/dist/components/electron-signatures/demoComponents/test.d.ts +6 -0
  44. package/dist/components/electron-signatures/demoComponents/test.js +119 -0
  45. package/dist/components/electron-signatures/dgComponents/contract-comparison.d.ts +39 -0
  46. package/dist/components/electron-signatures/dgComponents/contract-comparison.js +53 -0
  47. package/dist/components/electron-signatures/dgComponents/file-comparison-btn.d.ts +11 -0
  48. package/dist/components/electron-signatures/dgComponents/file-comparison-btn.js +180 -0
  49. package/dist/components/electron-signatures/dgComponents/new-contract-comparison.d.ts +45 -0
  50. package/dist/components/electron-signatures/dgComponents/new-contract-comparison.js +68 -0
  51. package/dist/components/electron-signatures/dgComponents/useContractColumns.d.ts +21 -0
  52. package/dist/components/electron-signatures/dgComponents/useContractColumns.js +171 -0
  53. package/dist/components/electron-signatures/electron-signatures-fragment.d.ts +8 -0
  54. package/dist/components/electron-signatures/electron-signatures-fragment.js +344 -0
  55. package/dist/components/electron-signatures/electronComponents/electron-seal-batch-download.d.ts +52 -0
  56. package/dist/components/electron-signatures/electronComponents/electron-seal-batch-download.js +513 -0
  57. package/dist/components/electron-signatures/electronComponents/electron-seal-detail.d.ts +8 -0
  58. package/dist/components/electron-signatures/electronComponents/electron-seal-detail.js +59 -0
  59. package/dist/components/electron-signatures/electronComponents/electron-seal-download.d.ts +16 -0
  60. package/dist/components/electron-signatures/electronComponents/electron-seal-download.js +89 -0
  61. package/dist/components/electron-signatures/electronComponents/electron-seal-firstLevelPerson.d.ts +9 -0
  62. package/dist/components/electron-signatures/electronComponents/electron-seal-firstLevelPerson.js +16 -0
  63. package/dist/components/electron-signatures/electronComponents/electron-seal-item-detail.d.ts +15 -0
  64. package/dist/components/electron-signatures/electronComponents/electron-seal-item-detail.js +16 -0
  65. package/dist/components/electron-signatures/electronComponents/electron-seal-item.d.ts +20 -0
  66. package/dist/components/electron-signatures/electronComponents/electron-seal-item.js +47 -0
  67. package/dist/components/electron-signatures/electronComponents/electron-seal-list.d.ts +11 -0
  68. package/dist/components/electron-signatures/electronComponents/electron-seal-list.js +191 -0
  69. package/dist/components/electron-signatures/electronComponents/electron-seal-setting.d.ts +15 -0
  70. package/dist/components/electron-signatures/electronComponents/electron-seal-setting.js +10 -0
  71. package/dist/components/electron-signatures/electronComponents/last-qys-modal.d.ts +7 -0
  72. package/dist/components/electron-signatures/electronComponents/last-qys-modal.js +42 -0
  73. package/dist/components/electron-signatures/electronComponents/useCheckedSealInfoList.d.ts +3 -0
  74. package/dist/components/electron-signatures/electronComponents/useCheckedSealInfoList.js +45 -0
  75. package/dist/components/electron-signatures/electronComponents/useElectronColumns.d.ts +30 -0
  76. package/dist/components/electron-signatures/electronComponents/useElectronColumns.js +380 -0
  77. package/dist/components/electron-signatures/electronComponents/useFetchElectronData.d.ts +20 -0
  78. package/dist/components/electron-signatures/electronComponents/useFetchElectronData.js +169 -0
  79. package/dist/components/electron-signatures/electronComponents/useGetDeptInfo.d.ts +3 -0
  80. package/dist/components/electron-signatures/electronComponents/useGetDeptInfo.js +38 -0
  81. package/dist/components/electron-signatures/fileComponents/file-operation.d.ts +7 -0
  82. package/dist/components/electron-signatures/fileComponents/file-operation.js +67 -0
  83. package/dist/components/electron-signatures/fileComponents/file-type-select.d.ts +12 -0
  84. package/dist/components/electron-signatures/fileComponents/file-type-select.js +10 -0
  85. package/dist/components/electron-signatures/fileComponents/file-upload.d.ts +11 -0
  86. package/dist/components/electron-signatures/fileComponents/file-upload.js +146 -0
  87. package/dist/components/electron-signatures/fileComponents/fileUtils.d.ts +17 -0
  88. package/dist/components/electron-signatures/fileComponents/fileUtils.js +36 -0
  89. package/dist/components/electron-signatures/fileComponents/new-file-operation.d.ts +10 -0
  90. package/dist/components/electron-signatures/fileComponents/new-file-operation.js +73 -0
  91. package/dist/components/electron-signatures/fileComponents/useFetchFileTypeData.d.ts +13 -0
  92. package/dist/components/electron-signatures/fileComponents/useFetchFileTypeData.js +45 -0
  93. package/dist/components/electron-signatures/fileComponents/useFileColumns.d.ts +38 -0
  94. package/dist/components/electron-signatures/fileComponents/useFileColumns.js +329 -0
  95. package/dist/components/electron-signatures/fileComponents/useFileTypeColumns.d.ts +19 -0
  96. package/dist/components/electron-signatures/fileComponents/useFileTypeColumns.js +72 -0
  97. package/dist/components/electron-signatures/hooks/useGetQjVerifyCode.d.ts +30 -0
  98. package/dist/components/electron-signatures/hooks/useGetQjVerifyCode.js +134 -0
  99. package/dist/components/electron-signatures/hooks/useMergeRecords.d.ts +17 -0
  100. package/dist/components/electron-signatures/hooks/useMergeRecords.js +49 -0
  101. package/dist/components/electron-signatures/hooks/useParseElectronListData.d.ts +49 -0
  102. package/dist/components/electron-signatures/hooks/useParseElectronListData.js +111 -0
  103. package/dist/components/electron-signatures/hooks/useParseElectronSetting.d.ts +102 -0
  104. package/dist/components/electron-signatures/hooks/useParseElectronSetting.js +365 -0
  105. package/dist/components/electron-signatures/hooks/useParseIsNeedElectronData.d.ts +40 -0
  106. package/dist/components/electron-signatures/hooks/useParseIsNeedElectronData.js +139 -0
  107. package/dist/components/electron-signatures/hooks/useParseIsNeedQunjData.d.ts +36 -0
  108. package/dist/components/electron-signatures/hooks/useParseIsNeedQunjData.js +48 -0
  109. package/dist/components/electron-signatures/hooks/useParseQunjListData.d.ts +56 -0
  110. package/dist/components/electron-signatures/hooks/useParseQunjListData.js +204 -0
  111. package/dist/components/electron-signatures/hooks/useParseQunjSingleData.d.ts +34 -0
  112. package/dist/components/electron-signatures/hooks/useParseQunjSingleData.js +110 -0
  113. package/dist/components/electron-signatures/hooks/useParseRecords.d.ts +65 -0
  114. package/dist/components/electron-signatures/hooks/useParseRecords.js +165 -0
  115. package/dist/components/electron-signatures/index.d.ts +13 -0
  116. package/dist/components/electron-signatures/index.js +54 -0
  117. package/dist/components/electron-signatures/index_old.d.ts +9 -0
  118. package/dist/components/electron-signatures/index_old.js +966 -0
  119. package/dist/components/electron-signatures/interface.d.ts +849 -0
  120. package/dist/components/electron-signatures/interface.js +57 -0
  121. package/dist/components/electron-signatures/qunjComponents/qunj-apply.d.ts +6 -0
  122. package/dist/components/electron-signatures/qunjComponents/qunj-apply.js +8 -0
  123. package/dist/components/electron-signatures/qunjComponents/qunj-check.d.ts +21 -0
  124. package/dist/components/electron-signatures/qunjComponents/qunj-check.js +41 -0
  125. package/dist/components/electron-signatures/qunjComponents/qunj-detail.d.ts +35 -0
  126. package/dist/components/electron-signatures/qunjComponents/qunj-detail.js +267 -0
  127. package/dist/components/electron-signatures/qunjComponents/qunj-list.d.ts +24 -0
  128. package/dist/components/electron-signatures/qunjComponents/qunj-list.js +346 -0
  129. package/dist/components/electron-signatures/qunjComponents/useFetchQunjData.d.ts +20 -0
  130. package/dist/components/electron-signatures/qunjComponents/useFetchQunjData.js +63 -0
  131. package/dist/components/electron-signatures/qunjComponents/useQunjColumns.d.ts +36 -0
  132. package/dist/components/electron-signatures/qunjComponents/useQunjColumns.js +321 -0
  133. package/dist/components/electron-signatures/translateComponents/TranslateButton.d.ts +10 -0
  134. package/dist/components/electron-signatures/translateComponents/TranslateButton.js +44 -0
  135. package/dist/components/electron-signatures/translateComponents/useTranslateCom.d.ts +22 -0
  136. package/dist/components/electron-signatures/translateComponents/useTranslateCom.js +50 -0
  137. package/dist/components/electron-signatures/utils.d.ts +26 -0
  138. package/dist/components/electron-signatures/utils.js +67 -0
  139. package/dist/components/utils/ZtxkContext.d.ts +16 -0
  140. package/dist/components/utils/ZtxkContext.js +4 -0
  141. package/dist/components/utils/useMemoizedFn.d.ts +6 -0
  142. package/dist/components/utils/useMemoizedFn.js +22 -0
  143. package/dist/components/utils/usePrevious.d.ts +3 -0
  144. package/dist/components/utils/usePrevious.js +13 -0
  145. package/dist/index.css +686 -0
  146. package/dist/index.css.map +1 -1
  147. package/dist/index.d.ts +3 -0
  148. package/dist/index.js +105 -87
  149. package/dist/request.js +1 -1
  150. package/package.json +4 -3
@@ -0,0 +1,321 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import i18next from 'ztxkutils/dist/i18next';
13
+ import React, { useContext } from 'react';
14
+ import QunjList, { isFilterAreaType } from './qunj-list';
15
+ import QunjDetail, { NoUseQj } from './qunj-detail';
16
+ import QunjCheck from './qunj-check';
17
+ import { getColumnMergeProp } from '../hooks/useParseRecords';
18
+ import { ElectronSignaturesContext } from '..';
19
+ import { Button } from '../../../index';
20
+ function WorkflowIdButton(props) {
21
+ var children = props.children, wfProcessInstId = props.wfProcessInstId, isShowSealApply = props.isShowSealApply, isEdit = props.isEdit, goWorkflowSeal = props.goWorkflowSeal;
22
+ var onGoWorkflowSeal = function () {
23
+ if (!wfProcessInstId) {
24
+ return;
25
+ }
26
+ goWorkflowSeal && goWorkflowSeal(wfProcessInstId);
27
+ };
28
+ return (React.createElement("div", { style: {
29
+ // color: 'rgb(255, 102, 102)',
30
+ fontSize: '15px',
31
+ } },
32
+ children,
33
+ isShowSealApply && !isEdit ? (React.createElement(Button, { type: "link", onClick: onGoWorkflowSeal }, i18next.t('用印增加申请'))) : null));
34
+ }
35
+ // 群杰印章的clomuns
36
+ export default function useQunjColumns(options) {
37
+ var records = options.records, dataTypeSort = options.dataTypeSort, allData = options.allData, contractNumFlowIds = options.contractNumFlowIds, refreshCode = options.refreshCode, request = options.request, isSingleQj = options.isSingleQj, isQjUseModal = options.isQjUseModal, apiBaseUrl = options.apiBaseUrl, caseId = options.caseId, qjVerifyCodeData = options.qjVerifyCodeData, getQjVerifyCodeHandle = options.getQjVerifyCodeHandle, isShowSealApply = options.isShowSealApply, goWorkflowSeal = options.goWorkflowSeal, qunjListRenderFilter = options.qunjListRenderFilter;
38
+ var _a = useContext(ElectronSignaturesContext), isNewQys = _a.isNewQys, isNewQunjSealStyle = _a.isNewQunjSealStyle;
39
+ var useSealTitle = isNewQunjSealStyle
40
+ ? i18next.t('选择群杰印章')
41
+ : isNewQys
42
+ ? i18next.t('已选群杰印章')
43
+ : i18next.t('申请用章情况');
44
+ var qjColumn = isSingleQj
45
+ ? [
46
+ {
47
+ title: i18next.t('盖群杰印章'),
48
+ dataIndex: 'isStampQunj',
49
+ key: 'isStampQunj',
50
+ width: 100,
51
+ align: 'center',
52
+ render: function (text, record, index) {
53
+ // 需要合并
54
+ var _a = getColumnMergeProp({
55
+ record: record,
56
+ index: index,
57
+ records: records,
58
+ dataTypeSort: dataTypeSort,
59
+ }), currentDataType = _a.currentDataType, preDataTypeRecordsLength = _a.preDataTypeRecordsLength;
60
+ var _b = allData[currentDataType] || {}, isEdit = _b.isEdit, fileFieldsNameRef = _b.fileFieldsNameRef, onIsStampQunjChange = _b.onIsStampQunjChange,
61
+ // 当前流程下的群杰章信息
62
+ qunjList = _b.qunjList,
63
+ // 是否显示合同分数
64
+ isContranctNum = _b.isContranctNum,
65
+ // 是否显示群杰章地址
66
+ isQunjAddress = _b.isQunjAddress, onQunjAddressSingleChange = _b.onQunjAddressSingleChange, onQunjSealSingleChange = _b.onQunjSealSingleChange, wfProcessInstId = _b.wfProcessInstId;
67
+ var _c = (fileFieldsNameRef === null || fileFieldsNameRef === void 0 ? void 0 : fileFieldsNameRef.current) || {}, isQunj = _c.isQunj, qunjSeal = _c.qunjSeal, qunjAddress = _c.qunjAddress;
68
+ // 是否显示群杰印章信息
69
+ var isShowQunjDetail = isQunj
70
+ ? record[isQunj] + '' === '1'
71
+ : false;
72
+ // 因为数据是按照类型来归类了,那么这个索引的长度 实际应该减去之前的所有数据类型的长度
73
+ var dataTypeIndex = index - preDataTypeRecordsLength;
74
+ // 当前选中的群杰章信息
75
+ var currentQunjSeal = qunjSeal ? record[qunjSeal] : null;
76
+ // 当前选中的盖章地址信息
77
+ var currentQunjAddress = qunjAddress ? record[qunjAddress] : null;
78
+ return (React.createElement(React.Fragment, null,
79
+ React.createElement(QunjCheck, { disabled: !isEdit, checked: isShowQunjDetail, onChange: function (checked) {
80
+ onIsStampQunjChange === null || onIsStampQunjChange === void 0 ? void 0 : onIsStampQunjChange(checked, dataTypeIndex);
81
+ }, qunjList: qunjList, currentQunjSeal: currentQunjSeal, currentQunjAddress: currentQunjAddress, isContranctNum: isContranctNum, isQunjAddress: isQunjAddress, onQunjAddressSingleChange: function (data) {
82
+ var _a, _b, _c;
83
+ // 如果切换了盖章地点,需要将非当前地点的数据删除
84
+ var copyDetails = ((_c = (_b = (_a = currentQunjSeal === null || currentQunjSeal === void 0 ? void 0 : currentQunjSeal.details) === null || _a === void 0 ? void 0 : _a.slice()) === null || _b === void 0 ? void 0 : _b.map) === null || _c === void 0 ? void 0 : _c.call(_b, function (detail) { return (__assign({}, detail)); })) || [];
85
+ var newDetails = copyDetails.filter(function (qunjItem) {
86
+ return isFilterAreaType(data === null || data === void 0 ? void 0 : data.id, qunjItem.areaType);
87
+ });
88
+ var qunjSeal = {};
89
+ if (copyDetails.length !== newDetails.length) {
90
+ qunjSeal.details = newDetails;
91
+ }
92
+ onQunjAddressSingleChange === null || onQunjAddressSingleChange === void 0 ? void 0 : onQunjAddressSingleChange(data, dataTypeIndex, qunjSeal);
93
+ }, onQunjSealSingleChange: function (data) {
94
+ onQunjSealSingleChange === null || onQunjSealSingleChange === void 0 ? void 0 : onQunjSealSingleChange(data, dataTypeIndex);
95
+ }, qunjListRenderFilter: qunjListRenderFilter }),
96
+ wfProcessInstId ? (React.createElement(WorkflowIdButton, { wfProcessInstId: wfProcessInstId, isShowSealApply: isShowSealApply, isEdit: isEdit, goWorkflowSeal: goWorkflowSeal }, wfProcessInstId)) : ('')));
97
+ },
98
+ },
99
+ {
100
+ title: useSealTitle,
101
+ dataIndex: 'qunjDetail',
102
+ key: 'qunjDetail',
103
+ width: 260,
104
+ align: 'center',
105
+ render: function (text, record, index) {
106
+ // 需要合并
107
+ var currentDataType = getColumnMergeProp({
108
+ record: record,
109
+ index: index,
110
+ records: records,
111
+ dataTypeSort: dataTypeSort,
112
+ }).currentDataType;
113
+ var _a = allData[currentDataType] || {}, fileFieldsNameRef = _a.fileFieldsNameRef, wfProcessInstId = _a.wfProcessInstId, verifyUserIds = _a.verifyUserIds;
114
+ var _b = (fileFieldsNameRef === null || fileFieldsNameRef === void 0 ? void 0 : fileFieldsNameRef.current) || {}, isQunj = _b.isQunj, qunjSeal = _b.qunjSeal, qunjAddress = _b.qunjAddress;
115
+ // 是否显示群杰印章信息
116
+ var isShowQunjDetail = isQunj
117
+ ? record[isQunj] + '' === '1'
118
+ : false;
119
+ // 当前选中的群杰章信息
120
+ var currentQunjSeal = qunjSeal ? record[qunjSeal] : null;
121
+ // 当前选中的盖章地址信息
122
+ var currentQunjAddress = qunjAddress ? record[qunjAddress] : null;
123
+ // 公用信息获取
124
+ var _c = allData[currentDataType] || {}, isEdit = _c.isEdit,
125
+ // 当前流程下的群杰章信息
126
+ qunjList = _c.qunjList,
127
+ // 是否显示合同分数
128
+ isContranctNum = _c.isContranctNum,
129
+ // 是否显示群杰章地址
130
+ isQunjAddress = _c.isQunjAddress, flowStatus = _c.flowStatus;
131
+ return isShowQunjDetail ? (React.createElement(QunjDetail, { qunjList: qunjList, qunjSeal: currentQunjSeal, isContranctNum: isContranctNum, isQunjAddress: isQunjAddress, currentQunjAddress: currentQunjAddress, isEdit: isEdit, refreshCode: refreshCode, request: request, wfProcessInstId: wfProcessInstId, verifyUserIds: verifyUserIds, qjVerifyCodeData: qjVerifyCodeData, getQjVerifyCodeHandle: getQjVerifyCodeHandle, flowStatus: flowStatus })) : null;
132
+ },
133
+ },
134
+ ]
135
+ : isQjUseModal
136
+ ? // 新版模式:合并为单列"选择群杰印章";旧版模式:两列(盖群杰印章 + 已选群杰印章)
137
+ isNewQunjSealStyle
138
+ ? [
139
+ {
140
+ title: i18next.t('选择群杰印章'),
141
+ dataIndex: 'qunjDetail',
142
+ key: 'qunjDetail',
143
+ width: 326,
144
+ align: 'center',
145
+ // 固定列宽(scroll.x=max-content 时 width 会被内容撑开)
146
+ onHeaderCell: function () { return ({
147
+ style: { width: 326, minWidth: 326, maxWidth: 326 },
148
+ }); },
149
+ onCell: function () { return ({
150
+ // 内容从顶部往下排,避免切换公司时因印章数量不同导致内容垂直居中抖动
151
+ style: {
152
+ width: 326,
153
+ minWidth: 326,
154
+ maxWidth: 326,
155
+ verticalAlign: 'top',
156
+ },
157
+ }); },
158
+ render: function (text, record, index) {
159
+ var _a;
160
+ var _b = getColumnMergeProp({
161
+ record: record,
162
+ index: index,
163
+ records: records,
164
+ dataTypeSort: dataTypeSort,
165
+ }), props = _b.props, currentDataType = _b.currentDataType;
166
+ var _c = allData[currentDataType] || {}, isEdit = _c.isEdit, qunjList = _c.qunjList, isContranctNum = _c.isContranctNum, isQunjAddress = _c.isQunjAddress, currentQunjSeal = _c.currentQunjSeal, onQunjSealChange = _c.onQunjSealChange, qunjChecked = _c.qunjChecked, setQunjChecked = _c.setQunjChecked, qunjAddressList = _c.qunjAddressList, currentQunjAddress = _c.currentQunjAddress, onQunjAddressChange = _c.onQunjAddressChange, needQj = _c.needQj, wfProcessInstId = _c.wfProcessInstId, verifyUserIds = _c.verifyUserIds, flowStatus = _c.flowStatus;
167
+ return {
168
+ children: !needQj ? (React.createElement(NoUseQj, null)) : isEdit ? (React.createElement(QunjList, { qunjList: qunjList, qunjSeal: currentQunjSeal, onChange: onQunjSealChange, isContranctNum: isContranctNum, isQunjAddress: isQunjAddress, qunjAddressList: qunjAddressList, currentQunjAddress: currentQunjAddress, onQunjAddressChange: onQunjAddressChange, qunjChecked: qunjChecked, setQunjChecked: setQunjChecked, qunjListRenderFilter: qunjListRenderFilter })) : ((_a = currentQunjSeal === null || currentQunjSeal === void 0 ? void 0 : currentQunjSeal.details) === null || _a === void 0 ? void 0 : _a.length) !== 0 ? (React.createElement(QunjDetail, { qunjList: qunjList, qunjSeal: currentQunjSeal, isContranctNum: isContranctNum, isQunjAddress: isQunjAddress, currentQunjAddress: currentQunjAddress, isEdit: isEdit, refreshCode: refreshCode, request: request, apiBaseUrl: apiBaseUrl, caseId: caseId, wfProcessInstId: wfProcessInstId, verifyUserIds: verifyUserIds, qjVerifyCodeData: qjVerifyCodeData, getQjVerifyCodeHandle: getQjVerifyCodeHandle, flowStatus: flowStatus, isShowSealApply: isShowSealApply, goWorkflowSeal: goWorkflowSeal })) : (React.createElement(NoUseQj, null)),
169
+ props: props,
170
+ };
171
+ },
172
+ },
173
+ ]
174
+ : // 旧版模式:两列(盖群杰印章 + 已选群杰印章)
175
+ [
176
+ {
177
+ title: i18next.t('盖群杰印章'),
178
+ dataIndex: 'isStampQunj',
179
+ key: 'isStampQunj',
180
+ width: 100,
181
+ align: 'center',
182
+ render: function (text, record, index) {
183
+ var _a;
184
+ // 需要合并
185
+ var _b = getColumnMergeProp({
186
+ record: record,
187
+ index: index,
188
+ records: records,
189
+ dataTypeSort: dataTypeSort,
190
+ }), props = _b.props, currentDataType = _b.currentDataType;
191
+ var _c = allData[currentDataType] || {}, isEdit = _c.isEdit, qunjList = _c.qunjList, currentQunjSeal = _c.currentQunjSeal, onQunjSealChange = _c.onQunjSealChange, needQj = _c.needQj, isContranctNum = _c.isContranctNum, qunjChecked = _c.qunjChecked, setQunjChecked = _c.setQunjChecked, currentQunjAddress = _c.currentQunjAddress, onQunjAddressChange = _c.onQunjAddressChange, isQunjAddress = _c.isQunjAddress, wfProcessInstId = _c.wfProcessInstId;
192
+ // 是否显示群杰印章信息 如果非编辑状态下,使用数据中的字段来判断是否选择了群杰印章
193
+ var isShowQunjDetail = !isEdit
194
+ ? (currentQunjSeal === null || currentQunjSeal === void 0 ? void 0 : currentQunjSeal.details) &&
195
+ ((_a = currentQunjSeal === null || currentQunjSeal === void 0 ? void 0 : currentQunjSeal.details) === null || _a === void 0 ? void 0 : _a.length) !== 0
196
+ : qunjChecked;
197
+ return {
198
+ children: !needQj ? (React.createElement(React.Fragment, null,
199
+ React.createElement(NoUseQj, null),
200
+ wfProcessInstId ? (React.createElement(WorkflowIdButton, { wfProcessInstId: wfProcessInstId, isShowSealApply: isShowSealApply, isEdit: isEdit, goWorkflowSeal: goWorkflowSeal }, wfProcessInstId)) : (''))) : (React.createElement(React.Fragment, null,
201
+ React.createElement(QunjCheck, { disabled: !isEdit, checked: isShowQunjDetail, onChange: function (checked) {
202
+ setQunjChecked && setQunjChecked(checked);
203
+ }, qunjList: qunjList, currentQunjSeal: currentQunjSeal, currentQunjAddress: currentQunjAddress, isContranctNum: isContranctNum, isQunjAddress: isQunjAddress, onQunjAddressSingleChange: function (data) {
204
+ var _a, _b, _c;
205
+ // 如果切换了盖章地点,需要将非当前地点的数据删除
206
+ var copyDetails = ((_c = (_b = (_a = currentQunjSeal === null || currentQunjSeal === void 0 ? void 0 : currentQunjSeal.details) === null || _a === void 0 ? void 0 : _a.slice()) === null || _b === void 0 ? void 0 : _b.map) === null || _c === void 0 ? void 0 : _c.call(_b, function (detail) { return (__assign({}, detail)); })) || [];
207
+ var newDetails = copyDetails.filter(function (qunjItem) {
208
+ return isFilterAreaType(data === null || data === void 0 ? void 0 : data.id, qunjItem.areaType);
209
+ });
210
+ var qunjSeal = {};
211
+ if (copyDetails.length !== newDetails.length) {
212
+ qunjSeal.details = newDetails;
213
+ }
214
+ onQunjAddressChange &&
215
+ onQunjAddressChange(data, { qunjSeal: qunjSeal });
216
+ }, onQunjSealSingleChange: function (data) {
217
+ onQunjSealChange && onQunjSealChange(data);
218
+ }, qunjListRenderFilter: qunjListRenderFilter }),
219
+ wfProcessInstId ? (React.createElement(WorkflowIdButton, { wfProcessInstId: wfProcessInstId, isShowSealApply: isShowSealApply, isEdit: isEdit, goWorkflowSeal: goWorkflowSeal }, wfProcessInstId)) : (''))),
220
+ props: props,
221
+ };
222
+ },
223
+ },
224
+ {
225
+ title: useSealTitle,
226
+ dataIndex: 'qunjDetail',
227
+ key: 'qunjDetail',
228
+ width: 260,
229
+ align: 'center',
230
+ render: function (text, record, index) {
231
+ var _a;
232
+ // 需要合并
233
+ var _b = getColumnMergeProp({
234
+ record: record,
235
+ index: index,
236
+ records: records,
237
+ dataTypeSort: dataTypeSort,
238
+ }), props = _b.props, currentDataType = _b.currentDataType;
239
+ // 公用信息获取
240
+ var _c = allData[currentDataType] || {}, isEdit = _c.isEdit,
241
+ // 当前流程下的群杰章信息
242
+ qunjList = _c.qunjList,
243
+ // 是否显示合同分数
244
+ isContranctNum = _c.isContranctNum,
245
+ // 是否显示群杰章地址
246
+ isQunjAddress = _c.isQunjAddress, currentQunjSeal = _c.currentQunjSeal, qunjChecked = _c.qunjChecked, currentQunjAddress = _c.currentQunjAddress, wfProcessInstId = _c.wfProcessInstId, verifyUserIds = _c.verifyUserIds, flowStatus = _c.flowStatus;
247
+ // 是否显示群杰印章信息 如果非编辑状态下,使用数据中的字段来判断是否选择了群杰印章
248
+ var isShowQunjDetail = !isEdit
249
+ ? (currentQunjSeal === null || currentQunjSeal === void 0 ? void 0 : currentQunjSeal.details) &&
250
+ ((_a = currentQunjSeal === null || currentQunjSeal === void 0 ? void 0 : currentQunjSeal.details) === null || _a === void 0 ? void 0 : _a.length) !== 0
251
+ : qunjChecked;
252
+ return {
253
+ children: isShowQunjDetail ? (React.createElement(QunjDetail, { qunjList: qunjList, qunjSeal: currentQunjSeal, isContranctNum: isContranctNum, isQunjAddress: isQunjAddress, currentQunjAddress: currentQunjAddress, isEdit: isEdit, refreshCode: refreshCode, request: request, apiBaseUrl: apiBaseUrl, caseId: caseId, wfProcessInstId: wfProcessInstId, verifyUserIds: verifyUserIds, qjVerifyCodeData: qjVerifyCodeData, getQjVerifyCodeHandle: getQjVerifyCodeHandle, flowStatus: flowStatus })) : null,
254
+ props: props,
255
+ };
256
+ },
257
+ },
258
+ ]
259
+ : [
260
+ {
261
+ title: React.createElement("div", null, i18next.t('群杰用印申请')),
262
+ dataIndex: 'isStampQunj',
263
+ key: 'isStampQunj',
264
+ width: 330,
265
+ align: 'center',
266
+ // 固定列宽(scroll.x=max-content 时 width 会被内容撑开)
267
+ onHeaderCell: function () { return ({
268
+ style: { width: 330, minWidth: 330, maxWidth: 330 },
269
+ }); },
270
+ onCell: function () { return ({
271
+ // 内容从顶部往下排,避免切换公司时因印章数量不同导致内容垂直居中抖动
272
+ style: {
273
+ width: 330,
274
+ minWidth: 330,
275
+ maxWidth: 330,
276
+ verticalAlign: 'top',
277
+ },
278
+ }); },
279
+ render: function (text, record, index) {
280
+ // 需要合并
281
+ var _a = getColumnMergeProp({
282
+ record: record,
283
+ index: index,
284
+ records: records,
285
+ dataTypeSort: dataTypeSort,
286
+ }), props = _a.props, currentDataType = _a.currentDataType;
287
+ var _b = allData[currentDataType] || {}, isEdit = _b.isEdit, qunjList = _b.qunjList, currentQunjSeal = _b.currentQunjSeal, onQunjSealChange = _b.onQunjSealChange, needQj = _b.needQj, isContranctNum = _b.isContranctNum, qunjChecked = _b.qunjChecked, setQunjChecked = _b.setQunjChecked, qunjAddressList = _b.qunjAddressList, currentQunjAddress = _b.currentQunjAddress, onQunjAddressChange = _b.onQunjAddressChange, isQunjAddress = _b.isQunjAddress, wfProcessInstId = _b.wfProcessInstId, verifyUserIds = _b.verifyUserIds, flowStatus = _b.flowStatus;
288
+ return {
289
+ children: !needQj ? (React.createElement(NoUseQj, null)) : isEdit ? (React.createElement(QunjList, { qunjList: qunjList, contractNumFlowIds: contractNumFlowIds, qunjSeal: currentQunjSeal, onChange: onQunjSealChange, isContranctNum: isContranctNum, qunjChecked: qunjChecked, setQunjChecked: setQunjChecked, qunjAddressList: qunjAddressList, currentQunjAddress: currentQunjAddress, onQunjAddressChange: function (data) {
290
+ var _a, _b, _c;
291
+ // 如果切换了盖章地点,需要将非当前地点的数据删除
292
+ var copyDetails = ((_c = (_b = (_a = currentQunjSeal === null || currentQunjSeal === void 0 ? void 0 : currentQunjSeal.details) === null || _a === void 0 ? void 0 : _a.slice()) === null || _b === void 0 ? void 0 : _b.map) === null || _c === void 0 ? void 0 : _c.call(_b, function (detail) { return (__assign({}, detail)); })) || [];
293
+ var newDetails = copyDetails.filter(function (qunjItem) {
294
+ return isFilterAreaType(data === null || data === void 0 ? void 0 : data.id, qunjItem.areaType);
295
+ });
296
+ var qunjSeal = {};
297
+ if (copyDetails.length !== newDetails.length) {
298
+ qunjSeal.details = newDetails;
299
+ }
300
+ onQunjAddressChange &&
301
+ onQunjAddressChange(data, { qunjSeal: qunjSeal });
302
+ }, isQunjAddress: isQunjAddress, qunjListRenderFilter: qunjListRenderFilter })) : (React.createElement(QunjDetail, { qunjList: qunjList, qunjSeal: currentQunjSeal, isContranctNum: isContranctNum, isQunjAddress: isQunjAddress, currentQunjAddress: currentQunjAddress, refreshCode: refreshCode, request: request, wfProcessInstId: wfProcessInstId, verifyUserIds: verifyUserIds, qjVerifyCodeData: qjVerifyCodeData, getQjVerifyCodeHandle: getQjVerifyCodeHandle, flowStatus: flowStatus })),
303
+ props: props,
304
+ };
305
+ },
306
+ },
307
+ ];
308
+ var qunjColumns = isNewQys
309
+ ? qjColumn
310
+ : // 下面是最初设计的模式
311
+ [
312
+ {
313
+ title: i18next.t('群杰印章'),
314
+ align: 'center',
315
+ children: qjColumn,
316
+ },
317
+ ];
318
+ return {
319
+ qunjColumns: qunjColumns,
320
+ };
321
+ }
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ declare function TranslationButtonComponents({ isTranslation, previewUrl, request, record, realIndex, setRecords, }: {
3
+ isTranslation: any;
4
+ previewUrl: any;
5
+ request: any;
6
+ record: any;
7
+ realIndex: any;
8
+ setRecords: any;
9
+ }): JSX.Element;
10
+ export default TranslationButtonComponents;
@@ -0,0 +1,44 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React from 'react';
13
+ import { TranslationButton } from '../../../index';
14
+ function TranslationButtonComponents(_a) {
15
+ var isTranslation = _a.isTranslation, previewUrl = _a.previewUrl, request = _a.request, record = _a.record, realIndex = _a.realIndex, setRecords = _a.setRecords;
16
+ var attachId = record.attachId, attachName = record.attachName;
17
+ // 翻译的任务id改变时触发
18
+ var tidChange = function (tid) {
19
+ // 更新tid 如果需要 将任务id存储
20
+ if (typeof realIndex === 'number') {
21
+ setRecords(function (preRecords) {
22
+ var copyRecords = preRecords.slice();
23
+ var item = copyRecords[realIndex];
24
+ copyRecords.splice(realIndex, 1, __assign(__assign({}, item), { tid: tid }));
25
+ return copyRecords;
26
+ });
27
+ }
28
+ };
29
+ // 翻译组件
30
+ var transaltionCom = isTranslation && attachId && attachName && previewUrl ? (
31
+ // <div
32
+ // style={{
33
+ // display: 'flex',
34
+ // justifyContent: 'space-between',
35
+ // alignItems: 'center',
36
+ // }}
37
+ // >
38
+ React.createElement(TranslationButton, { request: request, attachId: attachId, attachName: attachName, tidChange: tidChange, previewUrl: previewUrl,
39
+ // 如果业务存储了tid的话
40
+ tid: record === null || record === void 0 ? void 0 : record.tid })) : // </div>
41
+ null;
42
+ return transaltionCom;
43
+ }
44
+ export default TranslationButtonComponents;
@@ -0,0 +1,22 @@
1
+ import type { ColumnsType } from 'antd/es/table';
2
+ import { ITrackAllData, IFileItem } from '../interface';
3
+ interface IOptions {
4
+ /** 所有数据类型合并之后的数据 */
5
+ records: IFileItem[];
6
+ /** 所有数据类型的排序规则 */
7
+ dataTypeSort: string[];
8
+ /** 所有数据类型的相关操作 */
9
+ allData: ITrackAllData;
10
+ isTranslation?: boolean;
11
+ request?: any;
12
+ /**预览地址 */
13
+ previewUrl?: string;
14
+ /**文件id */
15
+ attachId?: string;
16
+ /**文件名称 */
17
+ attachName?: string;
18
+ }
19
+ declare function useTranslateCom({ isTranslation, previewUrl, request, records, dataTypeSort, allData, }: IOptions): {
20
+ translateColumns: ColumnsType<any>;
21
+ };
22
+ export default useTranslateCom;
@@ -0,0 +1,50 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import i18next from 'ztxkutils/dist/i18next';
13
+ import React, { useContext } from 'react';
14
+ import TranslationButton from './TranslateButton';
15
+ import { getColumnMergeProp } from '../hooks/useParseRecords';
16
+ import { Checkbox } from '../../../index';
17
+ import { ElectronSignaturesContext } from '..';
18
+ function useTranslateCom(_a) {
19
+ var isTranslation = _a.isTranslation, previewUrl = _a.previewUrl, request = _a.request, records = _a.records, dataTypeSort = _a.dataTypeSort, allData = _a.allData;
20
+ var isNewQys = useContext(ElectronSignaturesContext).isNewQys;
21
+ var translateColumns = [
22
+ __assign(__assign({ title: i18next.t('附件扩展功能'), dataIndex: 'translatedFile', key: 'translatedFile', width: 180, align: 'center' }, (isNewQys
23
+ ? {
24
+ onHeaderCell: function () { return ({
25
+ style: { width: 180, minWidth: 180, maxWidth: 180 },
26
+ }); },
27
+ onCell: function () { return ({
28
+ style: { width: 180, minWidth: 180, maxWidth: 180 },
29
+ }); },
30
+ }
31
+ : {})), { render: function (text, record, index) {
32
+ var currentDataType = getColumnMergeProp({
33
+ record: record,
34
+ index: index,
35
+ records: records,
36
+ dataTypeSort: dataTypeSort,
37
+ }).currentDataType;
38
+ var _a = allData[currentDataType] || {}, setSameTypeRecords = _a.setRecords, isShowSaveTemplate = _a.isShowSaveTemplate;
39
+ // 是否存模板
40
+ var isCustomerReference = (record === null || record === void 0 ? void 0 : record.isCustomerReference) + '' === '1' ? true : false;
41
+ return (React.createElement(React.Fragment, null,
42
+ !record.isHideSaveCustomerReference && isShowSaveTemplate ? (React.createElement(Checkbox, { checked: isCustomerReference, disabled: true }, i18next.t('存样板'))) : null,
43
+ React.createElement(TranslationButton, { request: request, previewUrl: previewUrl, isTranslation: isTranslation, record: record, realIndex: index, setRecords: setSameTypeRecords })));
44
+ } }),
45
+ ];
46
+ return {
47
+ translateColumns: translateColumns,
48
+ };
49
+ }
50
+ export default useTranslateCom;
@@ -0,0 +1,26 @@
1
+ /** 需要存样板合同类型 采购合同 销售合同 双边合同 */
2
+ export declare const NEED_SAVE_TEMPLATE: string[];
3
+ /** 采购合同 销售合同 双边合同 部门间交易合同 */
4
+ export declare const FLOW_IDS: string[];
5
+ /** 如果仅需要群杰印章的话 */
6
+ export declare const onlyQunjAttachId = "123456789";
7
+ export declare const detailOnlyQunjAttachId = "1234567891";
8
+ export declare function currentRecordIsOnlyQunj(record: any): boolean;
9
+ /**
10
+ * 判断流程状态是否在允许的状态列表中
11
+ * @param flowStatus 当前流程状态
12
+ * @param allowedStatus 允许的状态列表,逗号分隔的字符串,如 '50,60,70',默认为 '50'
13
+ */
14
+ export declare function isFlowCompleted(flowStatus: string, allowedStatus?: string): boolean;
15
+ /**
16
+ * 将字节数加上合适的单位
17
+ * @param numBytes 字节数
18
+ * @returns
19
+ */
20
+ export declare function formatUnit(numBytes: number): string | number;
21
+ /**
22
+ * 获取文件名中的后缀 返回文件名 + 后缀
23
+ * @param fileName 文件名
24
+ * @returns
25
+ */
26
+ export declare function getFileExtension(fileName: string): [string, string];
@@ -0,0 +1,67 @@
1
+ /** 需要存样板合同类型 采购合同 销售合同 双边合同 */
2
+ export var NEED_SAVE_TEMPLATE = [
3
+ 'scm_order_contract_cght',
4
+ 'scm_order_contract_xsht',
5
+ 'scm_order_contract_sbht',
6
+ ];
7
+ /** 采购合同 销售合同 双边合同 部门间交易合同 */
8
+ export var FLOW_IDS = [
9
+ 'scm_order_contract_cght',
10
+ 'scm_order_contract_xsht',
11
+ 'scm_order_contract_sbht',
12
+ 'scm_order_contract_bjjyht',
13
+ ];
14
+ /** 如果仅需要群杰印章的话 */
15
+ export var onlyQunjAttachId = '123456789';
16
+ export var detailOnlyQunjAttachId = '1234567891';
17
+ export function currentRecordIsOnlyQunj(record) {
18
+ return ((record === null || record === void 0 ? void 0 : record.attachId) + '' === onlyQunjAttachId ||
19
+ (record === null || record === void 0 ? void 0 : record.attachId) + '' === detailOnlyQunjAttachId);
20
+ }
21
+ /**
22
+ * 判断流程状态是否在允许的状态列表中
23
+ * @param flowStatus 当前流程状态
24
+ * @param allowedStatus 允许的状态列表,逗号分隔的字符串,如 '50,60,70',默认为 '50'
25
+ */
26
+ export function isFlowCompleted(flowStatus, allowedStatus) {
27
+ if (allowedStatus === void 0) { allowedStatus = '50'; }
28
+ console.log('当前流程状态:', flowStatus);
29
+ console.log('允许的状态列表:', allowedStatus);
30
+ var statusList = allowedStatus.split(',').map(function (s) { return s.trim(); });
31
+ return statusList.includes(flowStatus + '');
32
+ }
33
+ /**
34
+ * 将字节数加上合适的单位
35
+ * @param numBytes 字节数
36
+ * @returns
37
+ */
38
+ export function formatUnit(numBytes) {
39
+ var _numBytes = Number(numBytes);
40
+ if (isNaN(_numBytes)) {
41
+ return numBytes;
42
+ }
43
+ var units = ['B', 'KB', 'MB', 'GB', 'TB'];
44
+ var unitIndex = 0;
45
+ while (_numBytes >= 1024 && unitIndex < units.length - 1) {
46
+ _numBytes /= 1024;
47
+ unitIndex++;
48
+ }
49
+ return _numBytes.toFixed(2) + units[unitIndex];
50
+ }
51
+ /**
52
+ * 获取文件名中的后缀 返回文件名 + 后缀
53
+ * @param fileName 文件名
54
+ * @returns
55
+ */
56
+ export function getFileExtension(fileName) {
57
+ if (!fileName) {
58
+ return ['', ''];
59
+ }
60
+ var lastPointIndex = fileName.lastIndexOf('.'); // 从最后取点
61
+ if (lastPointIndex === -1) {
62
+ return [fileName, ''];
63
+ }
64
+ var filePreName = fileName.substring(0, lastPointIndex); // 前面的名字
65
+ var fileExtension = fileName.substring(lastPointIndex + 1).toLowerCase(); // 后面的文件后缀
66
+ return [filePreName, fileExtension];
67
+ }
@@ -26,6 +26,22 @@ export interface IZtxkConfig {
26
26
  saasConfig?: {
27
27
  deptDetailApi?: string;
28
28
  };
29
+ /**
30
+ * 电子印章是否使用新版展示样式(公司简称分组 + 三段式布局)
31
+ */
32
+ isNewElectronSealStyle?: boolean;
33
+ /**
34
+ * 群杰印章是否使用新版展示样式(公司分组 + 三段式布局)
35
+ */
36
+ isNewQunjSealStyle?: boolean;
37
+ /**
38
+ * 电子印章公司标签切换方式:hover 悬浮切换(默认),click 点击切换
39
+ */
40
+ electronSealTabTrigger?: 'hover' | 'click';
41
+ /**
42
+ * 群杰印章公司标签切换方式:hover 悬浮切换(默认),click 点击切换
43
+ */
44
+ qunjSealTabTrigger?: 'hover' | 'click';
29
45
  }
30
46
  declare const ZtxkContext: React.Context<IZtxkConfig>;
31
47
  export default ZtxkContext;
@@ -19,6 +19,10 @@ var ztxkConfig = {
19
19
  isPdf: true,
20
20
  },
21
21
  saasConfig: {},
22
+ isNewElectronSealStyle: false,
23
+ isNewQunjSealStyle: false,
24
+ electronSealTabTrigger: 'hover',
25
+ qunjSealTabTrigger: 'hover',
22
26
  };
23
27
  var ZtxkContext = React.createContext(ztxkConfig);
24
28
  export default ZtxkContext;
@@ -0,0 +1,6 @@
1
+ declare type noop = (this: any, ...args: any[]) => any;
2
+ /**
3
+ * 持久化function的Hook
4
+ */
5
+ declare function useMemoizedFn<T extends noop>(fn: T): T;
6
+ export default useMemoizedFn;
@@ -0,0 +1,22 @@
1
+ import { useMemo, useRef } from 'react';
2
+ /**
3
+ * 持久化function的Hook
4
+ */
5
+ function useMemoizedFn(fn) {
6
+ var fnRef = useRef(fn);
7
+ // why not write `fnRef.current = fn`?
8
+ // https://github.com/alibaba/hooks/issues/728
9
+ fnRef.current = useMemo(function () { return fn; }, [fn]);
10
+ var memoizedFn = useRef();
11
+ if (!memoizedFn.current) {
12
+ memoizedFn.current = function () {
13
+ var args = [];
14
+ for (var _i = 0; _i < arguments.length; _i++) {
15
+ args[_i] = arguments[_i];
16
+ }
17
+ return fnRef.current.apply(this, args);
18
+ };
19
+ }
20
+ return memoizedFn.current;
21
+ }
22
+ export default useMemoizedFn;
@@ -0,0 +1,3 @@
1
+ export declare type ShouldUpdateFunc<T> = (prev: T | undefined, next: T) => boolean;
2
+ declare function usePrevious<T>(state: T, shouldUpdate?: ShouldUpdateFunc<T>): T | undefined;
3
+ export default usePrevious;
@@ -0,0 +1,13 @@
1
+ import { useRef } from 'react';
2
+ var defaultShouldUpdate = function (a, b) { return !Object.is(a, b); };
3
+ function usePrevious(state, shouldUpdate) {
4
+ if (shouldUpdate === void 0) { shouldUpdate = defaultShouldUpdate; }
5
+ var prevRef = useRef();
6
+ var curRef = useRef();
7
+ if (shouldUpdate(curRef.current, state)) {
8
+ prevRef.current = curRef.current;
9
+ curRef.current = state;
10
+ }
11
+ return prevRef.current;
12
+ }
13
+ export default usePrevious;