@kne/react-pdf-sign 1.1.1 → 1.1.2
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/README.md +66 -40
- package/dist/index.css +5 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +144 -103
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +144 -104
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -133,7 +133,9 @@ const { Flex, Button, Switch, App } = antd;
|
|
|
133
133
|
const BaseExample = () => {
|
|
134
134
|
const [pdfFile, setPdfFile] = useState(null);
|
|
135
135
|
const [isEdit, setIsEdit] = useState(true);
|
|
136
|
+
const [isFat, setIsFat] = useState(false);
|
|
136
137
|
const ref = useRef(null);
|
|
138
|
+
const [signatureList, setSignatureList] = useState([]);
|
|
137
139
|
const signatureModal = useSignature();
|
|
138
140
|
const { message } = App.useApp();
|
|
139
141
|
return (
|
|
@@ -149,44 +151,65 @@ const BaseExample = () => {
|
|
|
149
151
|
}}
|
|
150
152
|
/>
|
|
151
153
|
</Button>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
154
|
+
</Flex>
|
|
155
|
+
<Flex gap={8} align="center" justify="space-between">
|
|
156
|
+
<Flex gap={8} align="center">
|
|
157
|
+
{pdfFile && (
|
|
158
|
+
<Flex gap={8}>
|
|
159
|
+
<div>编辑模式:</div>
|
|
160
|
+
<Switch value={isEdit} onChange={setIsEdit} />
|
|
161
|
+
</Flex>
|
|
162
|
+
)}
|
|
163
|
+
{pdfFile && !isEdit && (
|
|
164
|
+
<Flex gap={8}>
|
|
165
|
+
<div>页面是否平铺:</div>
|
|
166
|
+
<Switch value={isFat} onChange={setIsFat} />
|
|
167
|
+
</Flex>
|
|
168
|
+
)}
|
|
169
|
+
{pdfFile && isEdit && (
|
|
170
|
+
<Button
|
|
171
|
+
onClick={() => {
|
|
172
|
+
ref.current.addSignLocation();
|
|
173
|
+
}}>
|
|
174
|
+
添加签名位置
|
|
175
|
+
</Button>
|
|
176
|
+
)}
|
|
177
|
+
</Flex>
|
|
178
|
+
<Flex gap={8} align="center">
|
|
179
|
+
{pdfFile && !isEdit && (
|
|
180
|
+
<Flex>
|
|
181
|
+
<div>已签名/签名区:</div>
|
|
182
|
+
<div>
|
|
183
|
+
{signatureList.filter(item => item.signature).length}/{signatureList.length}
|
|
184
|
+
</div>
|
|
185
|
+
</Flex>
|
|
186
|
+
)}
|
|
187
|
+
{pdfFile && !isEdit && (
|
|
188
|
+
<Button
|
|
189
|
+
onClick={async () => {
|
|
190
|
+
try {
|
|
191
|
+
const blob = await ref.current.sign();
|
|
192
|
+
const link = document.createElement('a');
|
|
193
|
+
const url = URL.createObjectURL(blob);
|
|
194
|
+
link.href = url;
|
|
195
|
+
link.download = 'signed-document.pdf';
|
|
196
|
+
link.click();
|
|
197
|
+
URL.revokeObjectURL(url);
|
|
198
|
+
} catch (e) {
|
|
199
|
+
message.error(e.message);
|
|
200
|
+
}
|
|
201
|
+
}}>
|
|
202
|
+
生成签名PDF
|
|
203
|
+
</Button>
|
|
204
|
+
)}
|
|
205
|
+
</Flex>
|
|
184
206
|
</Flex>
|
|
185
207
|
{pdfFile ? (
|
|
186
208
|
<PDFSignMulti
|
|
187
209
|
url={pdfFile}
|
|
188
210
|
ref={ref}
|
|
189
211
|
isEdit={isEdit}
|
|
212
|
+
isFlat={!isEdit && isFat}
|
|
190
213
|
onSign={({ size, callback }) => {
|
|
191
214
|
signatureModal({
|
|
192
215
|
mask: (
|
|
@@ -201,6 +224,7 @@ const BaseExample = () => {
|
|
|
201
224
|
}
|
|
202
225
|
});
|
|
203
226
|
}}
|
|
227
|
+
onChange={setSignatureList}
|
|
204
228
|
/>
|
|
205
229
|
) : null}
|
|
206
230
|
</Flex>
|
|
@@ -534,6 +558,7 @@ render(<BaseExample />);
|
|
|
534
558
|
| filename | string | 'signed-document.pdf' | 生成签名PDF的文件名 |
|
|
535
559
|
| defaultSignatureList | array | - | 默认签名位置列表 |
|
|
536
560
|
| isEdit | boolean | - | 是否处于编辑模式 |
|
|
561
|
+
| isFlat | boolean | - | 是否平铺显示所有页面 |
|
|
537
562
|
| onSign | function | - | 点击签名区域时的回调函数 |
|
|
538
563
|
| onChange | function | - | 签名位置列表变化回调函数 |
|
|
539
564
|
|
|
@@ -551,14 +576,15 @@ render(<BaseExample />);
|
|
|
551
576
|
|
|
552
577
|
PDF 文档查看器组件,提供 PDF 页面浏览功能。
|
|
553
578
|
|
|
554
|
-
| 属性 | 类型
|
|
555
|
-
|
|
556
|
-
| url | string
|
|
557
|
-
| className | string
|
|
558
|
-
| defaultPage | number
|
|
559
|
-
| maxWidth | number
|
|
560
|
-
| pdfjsUrl | string
|
|
561
|
-
| apis | object
|
|
579
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
580
|
+
|-------------|---------|------|-------------------|
|
|
581
|
+
| url | string | - | PDF 文件的 URL 地址 |
|
|
582
|
+
| className | string | - | 自定义 CSS 类名 |
|
|
583
|
+
| defaultPage | number | 1 | 默认显示的页码 |
|
|
584
|
+
| maxWidth | number | 1200 | 最大显示宽度 |
|
|
585
|
+
| pdfjsUrl | string | - | 自定义 pdf.js CDN 地址 |
|
|
586
|
+
| apis | object | - | API 配置对象 |
|
|
587
|
+
| isFlat | boolean | - | 是否平铺显示所有页面 |
|
|
562
588
|
|
|
563
589
|
#### children 渲染属性
|
|
564
590
|
|
package/dist/index.css
CHANGED
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["style.module.scss"],"names":[],"mappings":"AAAA;EACE,cAAc;EACd,kBAAkB;EAClB,iBAAiB;EACjB,WAAW;AACb;AACA;;EAEE,cAAc;AAChB;;AAEA;EACE,wEAAwE;AAC1E;;AAEA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,WAAW;AACb;;AAEA;;EAEE,kBAAkB;EAClB,eAAe;EACf,qBAAqB;EACrB,WAAW;EACX,YAAY;EACZ,eAAe;EACf,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,SAAS;EACT,2BAA2B;EAC3B,cAAc;EACd,0CAA0C;EAC1C,yCAAyC;EACzC,kBAAkB;AACpB;;AAEA;EACE,QAAQ;AACV;;AAEA;EACE,yBAAyB;EACzB,kBAAkB;EAClB,kBAAkB;AACpB;;AAEA;EACE,WAAW;EACX,YAAY;AACd;;AAEA;EACE,gBAAgB;EAChB,WAAW;AACb;;AAEA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,oBAAoB;AACtB","file":"index.css","sourcesContent":[".pdf-view-container {\n margin: 0 auto;\n position: relative;\n max-width: 1200px;\n width: 100%;\n}\n.pdf-view-container :global(.react-pdf__Page__canvas),\n.pdf-view-container :global(.textLayer) {\n margin: 0 auto;\n}\n\n.pdf-view {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);\n}\n\n.pdf-view-children {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10;\n}\n\n.pdf-view-page-control-left,\n.pdf-view-page-control-right {\n position: absolute;\n font-size: 30px;\n top: calc(50% - 19px);\n z-index: 10;\n padding: 8px;\n cursor: pointer;\n opacity: 0.3;\n}\n\n.pdf-view-page-control-current {\n position: absolute;\n bottom: 10px;\n left: 50%;\n transform: translateX(-50%);\n color: #666666;\n background-color: rgba(255, 255, 255, 0.5);\n text-shadow: 0 0 8px white, 0 0 8px white;\n border-radius: 4px;\n}\n\n.pdf-view-page-control-right {\n right: 0;\n}\n\n.signature-container {\n border: 1px solid #cccccc;\n border-radius: 4px;\n position: relative;\n}\n\n.signature-canvas {\n width: 100%;\n height: 100%;\n}\n\n.signature-modal :global .ant-modal-confirm-paragraph {\n max-width: unset;\n width: 100%;\n}\n\n.signature-mask {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}"]}
|
|
1
|
+
{"version":3,"sources":["style.module.scss"],"names":[],"mappings":"AAAA;EACE,cAAc;EACd,kBAAkB;EAClB,iBAAiB;EACjB,WAAW;AACb;AACA;;EAEE,cAAc;AAChB;;AAEA;EACE,WAAW;EACX,kBAAkB;AACpB;;AAEA;EACE,wEAAwE;AAC1E;;AAEA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,WAAW;AACb;;AAEA;;EAEE,kBAAkB;EAClB,eAAe;EACf,qBAAqB;EACrB,WAAW;EACX,YAAY;EACZ,eAAe;EACf,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,SAAS;EACT,2BAA2B;EAC3B,cAAc;EACd,0CAA0C;EAC1C,yCAAyC;EACzC,kBAAkB;AACpB;;AAEA;EACE,QAAQ;AACV;;AAEA;EACE,yBAAyB;EACzB,kBAAkB;EAClB,kBAAkB;AACpB;;AAEA;EACE,WAAW;EACX,YAAY;AACd;;AAEA;EACE,gBAAgB;EAChB,WAAW;AACb;;AAEA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,oBAAoB;AACtB","file":"index.css","sourcesContent":[".pdf-view-container {\n margin: 0 auto;\n position: relative;\n max-width: 1200px;\n width: 100%;\n}\n.pdf-view-container :global(.react-pdf__Page__canvas),\n.pdf-view-container :global(.textLayer) {\n margin: 0 auto;\n}\n\n.pdf-view-container {\n width: 100%;\n position: relative;\n}\n\n.pdf-view {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);\n}\n\n.pdf-view-children {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10;\n}\n\n.pdf-view-page-control-left,\n.pdf-view-page-control-right {\n position: absolute;\n font-size: 30px;\n top: calc(50% - 19px);\n z-index: 10;\n padding: 8px;\n cursor: pointer;\n opacity: 0.3;\n}\n\n.pdf-view-page-control-current {\n position: absolute;\n bottom: 10px;\n left: 50%;\n transform: translateX(-50%);\n color: #666666;\n background-color: rgba(255, 255, 255, 0.5);\n text-shadow: 0 0 8px white, 0 0 8px white;\n border-radius: 4px;\n}\n\n.pdf-view-page-control-right {\n right: 0;\n}\n\n.signature-container {\n border: 1px solid #cccccc;\n border-radius: 4px;\n position: relative;\n}\n\n.signature-canvas {\n width: 100%;\n height: 100%;\n}\n\n.signature-modal :global .ant-modal-confirm-paragraph {\n max-width: unset;\n width: 100%;\n}\n\n.signature-mask {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}"]}
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,7 @@ const PDFViewer = _ref => {
|
|
|
57
57
|
pdfjsUrl: pdfjsUrlProps,
|
|
58
58
|
url,
|
|
59
59
|
maxWidth = 1200,
|
|
60
|
+
isFlat,
|
|
60
61
|
children
|
|
61
62
|
} = _ref;
|
|
62
63
|
const {
|
|
@@ -84,29 +85,14 @@ const PDFViewer = _ref => {
|
|
|
84
85
|
setWidth(Math.min(ref.current.clientWidth, maxWidth));
|
|
85
86
|
}
|
|
86
87
|
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
children: /*#__PURE__*/jsxRuntime.jsx(reactPdf.Document, _extends({}, Object.assign({}, documentProps), {
|
|
96
|
-
loading: /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
|
|
97
|
-
justify: "center",
|
|
98
|
-
children: /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {})
|
|
99
|
-
}),
|
|
100
|
-
onLoadSuccess: _ref2 => {
|
|
101
|
-
let {
|
|
102
|
-
numPages
|
|
103
|
-
} = _ref2;
|
|
104
|
-
_objectWithoutPropertiesLoose(_ref2, _excluded$4);
|
|
105
|
-
setPageSize(numPages);
|
|
106
|
-
if (!Number.isInteger(defaultPage)) {
|
|
107
|
-
setCurrentPage(numPages);
|
|
108
|
-
}
|
|
109
|
-
},
|
|
88
|
+
const renderPage = _ref2 => {
|
|
89
|
+
let {
|
|
90
|
+
currentPage
|
|
91
|
+
} = _ref2;
|
|
92
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
93
|
+
className: classnames__default["default"](style['pdf-view-container'], 'pdf-view-container'),
|
|
94
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
95
|
+
className: classnames__default["default"](style['pdf-view'], 'pdf-view'),
|
|
110
96
|
children: /*#__PURE__*/jsxRuntime.jsx(reactPdf.Page, {
|
|
111
97
|
width: width,
|
|
112
98
|
pageNumber: currentPage,
|
|
@@ -120,31 +106,69 @@ const PDFViewer = _ref => {
|
|
|
120
106
|
});
|
|
121
107
|
}
|
|
122
108
|
})
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
109
|
+
}), size && children && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
110
|
+
className: classnames__default["default"](style['pdf-view-children'], 'pdf-view-children'),
|
|
111
|
+
children: typeof children === 'function' ? children({
|
|
112
|
+
size,
|
|
113
|
+
currentPage,
|
|
114
|
+
pageSize
|
|
115
|
+
}) : children
|
|
116
|
+
})]
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
120
|
+
ref: ref,
|
|
121
|
+
className: classnames__default["default"](className, style['pdf-view-container'], 'pdf-view-container'),
|
|
122
|
+
style: {
|
|
123
|
+
maxWidth: maxWidth
|
|
124
|
+
},
|
|
125
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(reactPdf.Document, _extends({}, Object.assign({}, documentProps), {
|
|
126
|
+
loading: /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
|
|
127
|
+
justify: "center",
|
|
128
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {})
|
|
129
|
+
}),
|
|
130
|
+
onLoadSuccess: _ref3 => {
|
|
131
|
+
let {
|
|
132
|
+
numPages
|
|
133
|
+
} = _ref3;
|
|
134
|
+
_objectWithoutPropertiesLoose(_ref3, _excluded$4);
|
|
135
|
+
setPageSize(numPages);
|
|
136
|
+
if (!Number.isInteger(defaultPage)) {
|
|
137
|
+
setCurrentPage(numPages);
|
|
142
138
|
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
},
|
|
140
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
|
|
141
|
+
vertical: true,
|
|
142
|
+
gap: 8,
|
|
143
|
+
children: isFlat ? Array.from({
|
|
144
|
+
length: pageSize
|
|
145
|
+
}).map((item, index) => {
|
|
146
|
+
return /*#__PURE__*/jsxRuntime.jsx(react.Fragment, {
|
|
147
|
+
children: renderPage({
|
|
148
|
+
currentPage: index + 1
|
|
149
|
+
})
|
|
150
|
+
}, index);
|
|
151
|
+
}) : renderPage({
|
|
152
|
+
currentPage
|
|
153
|
+
})
|
|
154
|
+
}), isFlat ? null : /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
155
|
+
className: classnames__default["default"](style['pdf-view-page-control'], 'pdf-view-page-control'),
|
|
156
|
+
children: [currentPage > 1 && /*#__PURE__*/jsxRuntime.jsx(icons.LeftOutlined, {
|
|
157
|
+
className: classnames__default["default"](style['pdf-view-page-control-left'], 'pdf-view-page-control-left'),
|
|
158
|
+
onClick: () => {
|
|
159
|
+
setCurrentPage(currentPage - 1);
|
|
160
|
+
}
|
|
161
|
+
}), currentPage < pageSize && /*#__PURE__*/jsxRuntime.jsx(icons.RightOutlined, {
|
|
162
|
+
className: classnames__default["default"](style['pdf-view-page-control-right'], 'pdf-view-page-control-right'),
|
|
163
|
+
onClick: () => {
|
|
164
|
+
setCurrentPage(currentPage + 1);
|
|
165
|
+
}
|
|
166
|
+
}), pageSize ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
167
|
+
className: classnames__default["default"](style['pdf-view-page-control-current'], 'pdf-view-page-control-current'),
|
|
168
|
+
children: [currentPage, "/", pageSize]
|
|
169
|
+
}) : null]
|
|
170
|
+
})]
|
|
171
|
+
}))
|
|
148
172
|
});
|
|
149
173
|
};
|
|
150
174
|
|
|
@@ -686,24 +710,25 @@ const PDFSignInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
686
710
|
height = 80,
|
|
687
711
|
padding,
|
|
688
712
|
filename = 'signed-document.pdf',
|
|
689
|
-
|
|
713
|
+
location,
|
|
714
|
+
setLocation,
|
|
690
715
|
onChange
|
|
691
716
|
} = _ref;
|
|
692
717
|
const initLocation = react.useMemo(() => {
|
|
693
718
|
return getInitLocation({
|
|
694
|
-
stageWidth: size.
|
|
695
|
-
stageHeight: size.
|
|
719
|
+
stageWidth: size.originalWidth,
|
|
720
|
+
stageHeight: size.originalHeight,
|
|
696
721
|
width,
|
|
697
722
|
height
|
|
698
723
|
});
|
|
699
724
|
}, [size, width, height]);
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
});
|
|
725
|
+
const targetLocation = react.useMemo(() => {
|
|
726
|
+
return Object.assign({}, initLocation, location);
|
|
727
|
+
}, [initLocation, location]);
|
|
728
|
+
const setTargetLocation = value => setLocation(Object.assign({}, initLocation, value));
|
|
704
729
|
const pdfSignature = react.useMemo(() => {
|
|
705
730
|
return Object.assign({}, computedPDFSignLocation({
|
|
706
|
-
location,
|
|
731
|
+
location: targetLocation,
|
|
707
732
|
size
|
|
708
733
|
}), {
|
|
709
734
|
signature,
|
|
@@ -713,7 +738,7 @@ const PDFSignInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
713
738
|
pageWidth: Math.round(size.originalWidth),
|
|
714
739
|
pageHeight: Math.round(size.originalHeight)
|
|
715
740
|
});
|
|
716
|
-
}, [
|
|
741
|
+
}, [targetLocation, signature, url, filename, size, currentPage]);
|
|
717
742
|
const signPdf = react.useCallback(function () {
|
|
718
743
|
try {
|
|
719
744
|
return Promise.resolve(signPdfFile(pdfSignature));
|
|
@@ -723,7 +748,7 @@ const PDFSignInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
723
748
|
}, [pdfSignature]);
|
|
724
749
|
react.useImperativeHandle(ref, () => ({
|
|
725
750
|
getLocation: () => location,
|
|
726
|
-
setLocation: value =>
|
|
751
|
+
setLocation: value => setTargetLocation(value),
|
|
727
752
|
getPdfSignature: () => pdfSignature,
|
|
728
753
|
sign: () => signPdf()
|
|
729
754
|
}));
|
|
@@ -734,16 +759,22 @@ const PDFSignInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
734
759
|
location
|
|
735
760
|
});
|
|
736
761
|
}, [pdfSignature, location, handlerChange]);
|
|
737
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
762
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
763
|
+
style: {
|
|
764
|
+
transform: "scale(" + size.width / size.originalWidth + ")",
|
|
765
|
+
transformOrigin: '0 0'
|
|
766
|
+
},
|
|
767
|
+
children: /*#__PURE__*/jsxRuntime.jsx(LocationLayer, {
|
|
768
|
+
stageWidth: size.originalWidth,
|
|
769
|
+
stageHeight: size.originalHeight,
|
|
770
|
+
width: width,
|
|
771
|
+
height: height,
|
|
772
|
+
padding: padding,
|
|
773
|
+
placeholder: placeholder,
|
|
774
|
+
signature: signature,
|
|
775
|
+
value: targetLocation,
|
|
776
|
+
onChange: setTargetLocation
|
|
777
|
+
})
|
|
747
778
|
});
|
|
748
779
|
});
|
|
749
780
|
const PDFSign = withLocale(/*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
@@ -759,6 +790,7 @@ const PDFSign = withLocale(/*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
|
759
790
|
onChange
|
|
760
791
|
} = _ref2,
|
|
761
792
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded$2);
|
|
793
|
+
const [location, setLocation] = react.useState(Object.assign({}, defaultLocation));
|
|
762
794
|
return /*#__PURE__*/jsxRuntime.jsx(PDFViewer, _extends({}, props, {
|
|
763
795
|
url: url,
|
|
764
796
|
children: _ref3 => {
|
|
@@ -772,7 +804,8 @@ const PDFSign = withLocale(/*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
|
772
804
|
currentPage: currentPage,
|
|
773
805
|
url: url,
|
|
774
806
|
filename: filename,
|
|
775
|
-
|
|
807
|
+
location: location,
|
|
808
|
+
setLocation: setLocation,
|
|
776
809
|
width: width,
|
|
777
810
|
height: height,
|
|
778
811
|
padding: padding,
|
|
@@ -4043,12 +4076,12 @@ const PDFSignMultiInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
4043
4076
|
height = 80,
|
|
4044
4077
|
padding,
|
|
4045
4078
|
filename = 'signed-document.pdf',
|
|
4046
|
-
|
|
4079
|
+
signatureList,
|
|
4080
|
+
setSignatureList,
|
|
4047
4081
|
isEdit,
|
|
4048
4082
|
onSign,
|
|
4049
4083
|
onChange
|
|
4050
4084
|
} = _ref;
|
|
4051
|
-
const [signatureList, setSignatureList] = react.useState(defaultSignatureList || []);
|
|
4052
4085
|
const {
|
|
4053
4086
|
formatMessage
|
|
4054
4087
|
} = reactIntl.useIntl();
|
|
@@ -4088,48 +4121,54 @@ const PDFSignMultiInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
4088
4121
|
signatureList: pdfSignatureList
|
|
4089
4122
|
});
|
|
4090
4123
|
},
|
|
4091
|
-
addSignLocation:
|
|
4124
|
+
addSignLocation: page => {
|
|
4092
4125
|
setSignatureList(signatureList => {
|
|
4093
4126
|
return [...signatureList, Object.assign({}, getInitLocation({
|
|
4094
4127
|
width,
|
|
4095
4128
|
height,
|
|
4096
|
-
stageWidth: size.
|
|
4097
|
-
stageHeight: size.
|
|
4129
|
+
stageWidth: size.originalWidth,
|
|
4130
|
+
stageHeight: size.originalHeight
|
|
4098
4131
|
}), {
|
|
4099
|
-
page: currentPage
|
|
4132
|
+
page: page || currentPage
|
|
4100
4133
|
})];
|
|
4101
4134
|
});
|
|
4102
4135
|
}
|
|
4103
4136
|
}));
|
|
4104
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4137
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4138
|
+
style: {
|
|
4139
|
+
transform: "scale(" + size.width / size.originalWidth + ")",
|
|
4140
|
+
transformOrigin: '0 0'
|
|
4141
|
+
},
|
|
4142
|
+
children: /*#__PURE__*/jsxRuntime.jsx(LocationGroup, {
|
|
4143
|
+
isEdit: isEdit,
|
|
4144
|
+
currentPage: currentPage,
|
|
4145
|
+
stageWidth: size.originalWidth,
|
|
4146
|
+
stageHeight: size.originalHeight,
|
|
4147
|
+
width: width,
|
|
4148
|
+
height: height,
|
|
4149
|
+
padding: padding,
|
|
4150
|
+
placeholder: placeholder,
|
|
4151
|
+
value: signatureList,
|
|
4152
|
+
onChange: setSignatureList,
|
|
4153
|
+
onClick: _ref2 => {
|
|
4154
|
+
let {
|
|
4155
|
+
index,
|
|
4156
|
+
value
|
|
4157
|
+
} = _ref2;
|
|
4158
|
+
onSign && onSign({
|
|
4159
|
+
size: value.size,
|
|
4160
|
+
callback: signature => {
|
|
4161
|
+
setSignatureList(value => {
|
|
4162
|
+
const newValue = value.slice(0);
|
|
4163
|
+
newValue[index] = Object.assign({}, newValue[index], {
|
|
4164
|
+
signature
|
|
4165
|
+
});
|
|
4166
|
+
return newValue;
|
|
4127
4167
|
});
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
}
|
|
4168
|
+
}
|
|
4169
|
+
});
|
|
4170
|
+
}
|
|
4171
|
+
})
|
|
4133
4172
|
});
|
|
4134
4173
|
});
|
|
4135
4174
|
const PDFSignMulti = withLocale(/*#__PURE__*/react.forwardRef((_ref3, ref) => {
|
|
@@ -4146,6 +4185,7 @@ const PDFSignMulti = withLocale(/*#__PURE__*/react.forwardRef((_ref3, ref) => {
|
|
|
4146
4185
|
isEdit
|
|
4147
4186
|
} = _ref3,
|
|
4148
4187
|
props = _objectWithoutPropertiesLoose(_ref3, _excluded$1);
|
|
4188
|
+
const [signatureList, setSignatureList] = react.useState(defaultSignatureList || []);
|
|
4149
4189
|
return /*#__PURE__*/jsxRuntime.jsx(PDFViewer, _extends({}, props, {
|
|
4150
4190
|
url: url,
|
|
4151
4191
|
children: _ref4 => {
|
|
@@ -4159,7 +4199,8 @@ const PDFSignMulti = withLocale(/*#__PURE__*/react.forwardRef((_ref3, ref) => {
|
|
|
4159
4199
|
currentPage: currentPage,
|
|
4160
4200
|
url: url,
|
|
4161
4201
|
filename: filename,
|
|
4162
|
-
|
|
4202
|
+
signatureList: signatureList,
|
|
4203
|
+
setSignatureList: setSignatureList,
|
|
4163
4204
|
width: width,
|
|
4164
4205
|
height: height,
|
|
4165
4206
|
padding: padding,
|