ztxkui 4.0.7 → 4.0.9
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/dist/components/EnhanceSelect/index.js +17 -0
- package/dist/components/PrintContainer/handle.js +1 -1
- package/dist/components/PrintContainer/print-container.d.ts +5 -0
- package/dist/components/PrintContainer/print-container.js +13 -3
- package/dist/components/Table/table.js +8 -5
- package/package.json +1 -1
|
@@ -978,6 +978,23 @@ function EnhanceSelect(_a) {
|
|
|
978
978
|
// 暴露一些方法给外部使用
|
|
979
979
|
useImperativeHandle(handleRef, function () { return ({
|
|
980
980
|
sendRequestNoCatch: sendRequestNoCatch,
|
|
981
|
+
// 手动刷新缓存数据
|
|
982
|
+
refreshCatch: function (newData) {
|
|
983
|
+
if (!url) {
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
if (enhanceSelectCatchObj) {
|
|
987
|
+
enhanceSelectCatchObj[url] = enhanceSelectCatchObj[url]
|
|
988
|
+
? enhanceSelectCatchObj[url]
|
|
989
|
+
: {};
|
|
990
|
+
var catchData = enhanceSelectCatchObj[url];
|
|
991
|
+
var catchDataKey = params ? JSON.stringify(params) : 'single';
|
|
992
|
+
catchData[catchDataKey] = catchData[catchDataKey]
|
|
993
|
+
? catchData[catchDataKey]
|
|
994
|
+
: [];
|
|
995
|
+
catchData[catchDataKey] = __spreadArray(__spreadArray([], catchData[catchDataKey]), newData);
|
|
996
|
+
}
|
|
997
|
+
},
|
|
981
998
|
}); });
|
|
982
999
|
return (React.createElement(Select, __assign({ defaultValue: showAll ? '' : undefined, allowClear: true, showSearch: true, filterOption: remoteSearch ? false : filterOptionHandle, onSearch: remoteSearch ? onSearchHandle : onSearchHandleInner, onChange: onChangeHandle, optionLabelProp: "title", loading: loading, onFocus: onFocusHandle, onBlur: onBlurHandle, onClear: onClearHandle, onSelect: onSelectHandle, onClick: onClickHandle,
|
|
983
1000
|
// getPopupContainer={(trigger) => trigger || document.body}
|
|
@@ -324,7 +324,7 @@ export function setPositionDeviation(value) {
|
|
|
324
324
|
export function setMinusPosition(dom, style) {
|
|
325
325
|
try {
|
|
326
326
|
var childrenDom = dom.querySelectorAll('.set-box');
|
|
327
|
-
if (childrenDom) {
|
|
327
|
+
if (childrenDom && childrenDom[0]) {
|
|
328
328
|
var top_1 = childrenDom[0].dataset.top
|
|
329
329
|
? parseInt(childrenDom[0].dataset.top)
|
|
330
330
|
: 0;
|
|
@@ -67,6 +67,11 @@ export interface IProps {
|
|
|
67
67
|
defaultAddWater?: boolean;
|
|
68
68
|
/** 设置插件打印方法 */
|
|
69
69
|
ecPrintFn?: any;
|
|
70
|
+
/** 点击生成PDF前 */
|
|
71
|
+
clickCreatePdfHandlePre?: any;
|
|
72
|
+
/** 点击生成PDF后 */
|
|
73
|
+
clickCreatePdfHandleNext?: any;
|
|
74
|
+
handleRef?: any;
|
|
70
75
|
}
|
|
71
76
|
declare const PrintContainer: React.FC<IProps>;
|
|
72
77
|
export default PrintContainer;
|
|
@@ -54,7 +54,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
|
54
54
|
* @author 陈亚雄
|
|
55
55
|
* @description
|
|
56
56
|
*/
|
|
57
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
57
|
+
import React, { useEffect, useRef, useState, useImperativeHandle } from 'react';
|
|
58
58
|
// redux
|
|
59
59
|
// ztxkui公共组件
|
|
60
60
|
import { Button, Spin, message, Modal, Dropdown, Menu } from '../../index';
|
|
@@ -68,6 +68,7 @@ import { createDownloadUrlNoBase, createDownloadUrl, } from 'ztxkutils/dist/file
|
|
|
68
68
|
import { dataURLtoFile, setPositionLocal, getPositionLocal, setPositionDom, setPositionDeviation, useInitSetPostion, } from './handle';
|
|
69
69
|
import { createTask } from './lodop';
|
|
70
70
|
import { useNeedLodop } from './utils';
|
|
71
|
+
import { useCallback } from '@storybook/addons';
|
|
71
72
|
var fontTTF = {
|
|
72
73
|
data: '',
|
|
73
74
|
};
|
|
@@ -94,7 +95,7 @@ function downloadFontTTF(_a) {
|
|
|
94
95
|
}
|
|
95
96
|
var PrintContainer = function (_a) {
|
|
96
97
|
var children = _a.children, waterText = _a.waterText, onFonsizeChange = _a.onFonsizeChange, hiddenClassName = _a.hiddenClassName, _b = _a.isAddExportPage, isAddExportPage = _b === void 0 ? false : _b, _c = _a.loading, loading = _c === void 0 ? false : _c, _d = _a.pdfName, pdfName = _d === void 0 ? 'pdf文件' : _d, request = _a.request, sealIdList = _a.sealIdList, _e = _a.showHandSeal, showHandSeal = _e === void 0 ? true : _e, _f = _a.showAutoSeal, showAutoSeal = _f === void 0 ? true : _f, _g = _a.needWatermark, needWatermark = _g === void 0 ? 0 : _g, fileId = _a.fileId, deptId = _a.deptId, flowId = _a.flowId, imgWaterBg = _a.imgWaterBg, onPrintCallback = _a.onPrintCallback, showPrintMessage = _a.showPrintMessage, onPrintBeforeCallback = _a.onPrintBeforeCallback, _h = _a.showPrintBtn, showPrintBtn = _h === void 0 ? true : _h, _j = _a.showPluginPrintBtn, showPluginPrintBtn = _j === void 0 ? true : _j, isUseXy = _a.isUseXy, localKey = _a.localKey, _k = _a.showExportBtn, showExportBtn = _k === void 0 ? true : _k, showSetFontBtn = _a.showSetFontBtn, isSetPosition = _a.isSetPosition, // 默认不需要偏移
|
|
97
|
-
showAddSeal = _a.showAddSeal, apiUrl = _a.apiUrl, defaultAddWater = _a.defaultAddWater, fileBaseUrl = _a.fileBaseUrl, ecPrintFn = _a.ecPrintFn;
|
|
98
|
+
showAddSeal = _a.showAddSeal, apiUrl = _a.apiUrl, defaultAddWater = _a.defaultAddWater, fileBaseUrl = _a.fileBaseUrl, ecPrintFn = _a.ecPrintFn, clickCreatePdfHandlePre = _a.clickCreatePdfHandlePre, clickCreatePdfHandleNext = _a.clickCreatePdfHandleNext, handleRef = _a.handleRef;
|
|
98
99
|
var _l = useState(false), showWater = _l[0], setShowWater = _l[1];
|
|
99
100
|
var _m = useState(false), showSeal = _m[0], setShowSeal = _m[1];
|
|
100
101
|
var containerRef = useRef();
|
|
@@ -118,11 +119,17 @@ var PrintContainer = function (_a) {
|
|
|
118
119
|
}), value = _v[0], setValue = _v[1];
|
|
119
120
|
useNeedLodop();
|
|
120
121
|
useInitSetPostion();
|
|
121
|
-
|
|
122
|
+
var initDomPosition = useCallback(function () {
|
|
122
123
|
var v = getPositionLocal(localKey);
|
|
123
124
|
setValue(v);
|
|
124
125
|
setPositionDom(v);
|
|
125
126
|
}, [localKey]);
|
|
127
|
+
useEffect(function () {
|
|
128
|
+
initDomPosition();
|
|
129
|
+
}, [initDomPosition]);
|
|
130
|
+
useImperativeHandle(handleRef, function () { return ({
|
|
131
|
+
initDomPosition: initDomPosition,
|
|
132
|
+
}); });
|
|
126
133
|
// 根据传入参数设置印章 关键字
|
|
127
134
|
useEffect(function () {
|
|
128
135
|
if (sealIdList) {
|
|
@@ -553,6 +560,7 @@ var PrintContainer = function (_a) {
|
|
|
553
560
|
*/
|
|
554
561
|
function createPdf(_a) {
|
|
555
562
|
var successCallback = _a.successCallback, options = _a.options;
|
|
563
|
+
clickCreatePdfHandlePre && clickCreatePdfHandlePre();
|
|
556
564
|
setTimeout(function () {
|
|
557
565
|
if (isSetPosition) {
|
|
558
566
|
setPositionDom(setPositionDeviation(value));
|
|
@@ -571,11 +579,13 @@ var PrintContainer = function (_a) {
|
|
|
571
579
|
},
|
|
572
580
|
})
|
|
573
581
|
.then(function (option) {
|
|
582
|
+
clickCreatePdfHandleNext && clickCreatePdfHandleNext();
|
|
574
583
|
setPositionDom(value);
|
|
575
584
|
// 成功回调
|
|
576
585
|
successCallback(option);
|
|
577
586
|
})
|
|
578
587
|
.catch(function () {
|
|
588
|
+
clickCreatePdfHandleNext && clickCreatePdfHandleNext();
|
|
579
589
|
setPositionDom(value);
|
|
580
590
|
setSpinning(false);
|
|
581
591
|
});
|
|
@@ -404,6 +404,13 @@ function Table(props) {
|
|
|
404
404
|
/** 移除错误样式 */
|
|
405
405
|
clearErrorClass: clearErrorClass,
|
|
406
406
|
}); });
|
|
407
|
+
var tableResizableTitle = useMemo(function () {
|
|
408
|
+
return {
|
|
409
|
+
header: {
|
|
410
|
+
cell: TableResizableTitle,
|
|
411
|
+
},
|
|
412
|
+
};
|
|
413
|
+
}, []);
|
|
407
414
|
return (React.createElement("div", { style: isFlex
|
|
408
415
|
? { position: 'relative', overflow: 'hidden', flex: 1 }
|
|
409
416
|
: { position: 'relative', overflow: 'hidden' }, ref: tableRef },
|
|
@@ -411,11 +418,7 @@ function Table(props) {
|
|
|
411
418
|
React.createElement(AntTable, __assign({ className: classes, bordered: bordered, pagination: pagination, scroll: myScroll, columns: mergeColumns, dataSource: dataSource, components: onMoveRow || onEditableSave
|
|
412
419
|
? components
|
|
413
420
|
: isResizableColumn
|
|
414
|
-
?
|
|
415
|
-
header: {
|
|
416
|
-
cell: TableResizableTitle,
|
|
417
|
-
},
|
|
418
|
-
}
|
|
421
|
+
? tableResizableTitle
|
|
419
422
|
: undefined, onRow: onMoveRow
|
|
420
423
|
? function (record, index) {
|
|
421
424
|
return ({
|