iglooform 2.5.15 → 2.5.18
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/es/claim-list/index.js +1 -1
- package/es/documents/index.d.ts +2 -0
- package/es/documents/index.js +8 -2
- package/es/locale/en-US/messages.json +6 -0
- package/es/locale/id-ID/messages.json +7 -1
- package/es/locale/th-TH/messages.json +7 -1
- package/es/locale/vi-VN/messages.json +7 -1
- package/es/locale/zh-CN/messages.json +7 -1
- package/es/locale/zh-TW/messages.json +6 -0
- package/es/media/index.d.ts +2 -0
- package/es/media/index.js +8 -3
- package/es/media/media.js +49 -0
- package/es/media/preview.d.ts +1 -0
- package/es/media/preview.js +212 -42
- package/es/media/style/index.less +3 -3
- package/es/upload-photo/media.js +28 -1
- package/es/upload-preview/index.js +1 -1
- package/es/upload-preview/media.js +96 -4
- package/lib/claim-list/index.js +1 -1
- package/lib/documents/index.d.ts +2 -0
- package/lib/documents/index.js +8 -2
- package/lib/locale/en-US/messages.json +6 -0
- package/lib/locale/id-ID/messages.json +7 -1
- package/lib/locale/th-TH/messages.json +7 -1
- package/lib/locale/vi-VN/messages.json +7 -1
- package/lib/locale/zh-CN/messages.json +7 -1
- package/lib/locale/zh-TW/messages.json +6 -0
- package/lib/media/index.d.ts +2 -0
- package/lib/media/index.js +8 -3
- package/lib/media/media.js +50 -0
- package/lib/media/preview.d.ts +1 -0
- package/lib/media/preview.js +222 -40
- package/lib/media/style/index.less +3 -3
- package/lib/upload-photo/media.js +30 -1
- package/lib/upload-preview/index.js +1 -1
- package/lib/upload-preview/media.js +100 -3
- package/package.json +1 -1
package/es/media/preview.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import "antd/es/message/style";
|
|
2
|
+
import _message from "antd/es/message";
|
|
3
|
+
import "antd/es/grid/style";
|
|
4
|
+
import _Grid from "antd/es/grid";
|
|
5
|
+
|
|
1
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
7
|
|
|
3
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -16,22 +21,60 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
16
21
|
|
|
17
22
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
23
|
|
|
19
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
import { useState } from 'react';
|
|
24
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
25
|
+
import { useState, useRef, useContext, useReducer } from 'react';
|
|
21
26
|
import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
|
|
27
|
+
import classnames from 'classnames';
|
|
28
|
+
import { ArrowLeftOutlined, ArrowRightOutlined } from 'iglooicon';
|
|
29
|
+
import Modal from '../modal';
|
|
30
|
+
import Password from '../input/password';
|
|
31
|
+
import Button from '../button';
|
|
32
|
+
import { LocaleContext } from '../locale';
|
|
33
|
+
var useBreakpoint = _Grid.useBreakpoint;
|
|
34
|
+
var PasswordResponses = {
|
|
35
|
+
NEED_PASSWORD: 1,
|
|
36
|
+
INCORRECT_PASSWORD: 2
|
|
37
|
+
};
|
|
22
38
|
|
|
23
39
|
var PdfViewer = function PdfViewer(_ref) {
|
|
24
40
|
var src = _ref.src,
|
|
25
41
|
left = _ref.left,
|
|
26
42
|
top = _ref.top,
|
|
27
43
|
scale = _ref.scale,
|
|
28
|
-
isCurrent = _ref.isCurrent
|
|
44
|
+
isCurrent = _ref.isCurrent,
|
|
45
|
+
_ref$showAllPages = _ref.showAllPages,
|
|
46
|
+
showAllPages = _ref$showAllPages === void 0 ? true : _ref$showAllPages;
|
|
47
|
+
|
|
48
|
+
var _useContext = useContext(LocaleContext),
|
|
49
|
+
formatMessage = _useContext.formatMessage;
|
|
29
50
|
|
|
30
51
|
var _useState = useState(1),
|
|
31
52
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
53
|
pageSize = _useState2[0],
|
|
33
54
|
setPageSize = _useState2[1];
|
|
34
55
|
|
|
56
|
+
var _useState3 = useState(1),
|
|
57
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
58
|
+
page = _useState4[0],
|
|
59
|
+
setPage = _useState4[1];
|
|
60
|
+
|
|
61
|
+
var documentRef = useRef(null);
|
|
62
|
+
|
|
63
|
+
var _useState5 = useState(false),
|
|
64
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
65
|
+
needPassword = _useState6[0],
|
|
66
|
+
setNeedPassword = _useState6[1];
|
|
67
|
+
|
|
68
|
+
var _useBreakpoint = useBreakpoint(),
|
|
69
|
+
md = _useBreakpoint.md;
|
|
70
|
+
|
|
71
|
+
var _useReducer = useReducer(function (a) {
|
|
72
|
+
return a + 1;
|
|
73
|
+
}, 0),
|
|
74
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
75
|
+
index = _useReducer2[0],
|
|
76
|
+
update = _useReducer2[1];
|
|
77
|
+
|
|
35
78
|
var handlePageInit = function handlePageInit(document) {
|
|
36
79
|
var _ref2 = document || {},
|
|
37
80
|
numPages = _ref2.numPages;
|
|
@@ -41,27 +84,149 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
41
84
|
}
|
|
42
85
|
};
|
|
43
86
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
87
|
+
var handleCancelLoad = function handleCancelLoad() {
|
|
88
|
+
var current = documentRef === null || documentRef === void 0 ? void 0 : documentRef.current;
|
|
89
|
+
|
|
90
|
+
if (current) {
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
current.setState({
|
|
93
|
+
pdf: false
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
setNeedPassword(true);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
var onPassword = function onPassword(callback, reason) {
|
|
101
|
+
if (reason) {
|
|
102
|
+
var password = '';
|
|
103
|
+
|
|
104
|
+
if (reason === PasswordResponses.INCORRECT_PASSWORD) {
|
|
105
|
+
_message.error(formatMessage({
|
|
106
|
+
id: 'Invalid password.'
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
Modal.confirm({
|
|
111
|
+
title: formatMessage({
|
|
112
|
+
id: 'Enter the password to open this PDF file.'
|
|
113
|
+
}),
|
|
114
|
+
maskClosable: false,
|
|
115
|
+
content: _jsx("div", {
|
|
116
|
+
children: _jsx(Password, {
|
|
117
|
+
onChange: function onChange(event) {
|
|
118
|
+
return password = event.target.value;
|
|
119
|
+
},
|
|
120
|
+
placeholder: "input password"
|
|
121
|
+
})
|
|
122
|
+
}),
|
|
123
|
+
okText: formatMessage({
|
|
124
|
+
id: 'Ok'
|
|
125
|
+
}),
|
|
126
|
+
cancelText: formatMessage({
|
|
127
|
+
id: 'Cancel'
|
|
128
|
+
}),
|
|
129
|
+
onOk: function onOk() {
|
|
130
|
+
return callback(password);
|
|
131
|
+
},
|
|
132
|
+
onCancel: handleCancelLoad
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
var reopen = function reopen() {
|
|
138
|
+
setNeedPassword(false);
|
|
139
|
+
update();
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
if (needPassword) {
|
|
143
|
+
return _jsx(Button, {
|
|
144
|
+
onClick: reopen,
|
|
145
|
+
style: {
|
|
146
|
+
color: '#ffffff'
|
|
147
|
+
},
|
|
148
|
+
type: "text",
|
|
149
|
+
children: formatMessage({
|
|
150
|
+
id: 'This is an encrypted file, click to enter password.'
|
|
151
|
+
})
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (showAllPages) {
|
|
156
|
+
return _jsx("div", {
|
|
157
|
+
style: {
|
|
158
|
+
display: 'flex',
|
|
159
|
+
flexDirection: 'column',
|
|
160
|
+
maxWidth: "calc(100vw - ".concat(md ? 64 : 32, "px)"),
|
|
161
|
+
maxHeight: '100%',
|
|
162
|
+
transform: "translate(".concat(left, "px, ").concat(top, "px)"),
|
|
163
|
+
position: 'absolute',
|
|
164
|
+
overflow: 'auto'
|
|
165
|
+
},
|
|
166
|
+
children: _jsx(Document, {
|
|
167
|
+
file: src,
|
|
168
|
+
onLoadSuccess: handlePageInit,
|
|
169
|
+
ref: documentRef,
|
|
170
|
+
onPassword: onPassword,
|
|
171
|
+
children: Array.from({
|
|
172
|
+
length: pageSize
|
|
173
|
+
}).map(function (_, index) {
|
|
174
|
+
return _jsx(Page, {
|
|
175
|
+
pageNumber: index + 1,
|
|
176
|
+
scale: scale
|
|
177
|
+
}, index);
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
}, index);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return _jsxs(_Fragment, {
|
|
184
|
+
children: [_jsx("div", {
|
|
185
|
+
style: {
|
|
186
|
+
maxWidth: "calc(100vw - ".concat(md ? 64 : 32, "px)"),
|
|
187
|
+
maxHeight: '100%',
|
|
188
|
+
transform: "translate(".concat(left, "px, ").concat(top, "px)"),
|
|
189
|
+
position: 'absolute',
|
|
190
|
+
overflow: 'auto'
|
|
191
|
+
},
|
|
192
|
+
children: _jsx(Document, {
|
|
193
|
+
file: src,
|
|
194
|
+
onLoadSuccess: handlePageInit,
|
|
195
|
+
ref: documentRef,
|
|
196
|
+
onPassword: onPassword,
|
|
197
|
+
children: _jsx(Page, {
|
|
198
|
+
pageNumber: page,
|
|
61
199
|
scale: scale
|
|
62
|
-
}
|
|
200
|
+
})
|
|
63
201
|
})
|
|
64
|
-
})
|
|
202
|
+
}, index), isCurrent && Boolean(pageSize > 1) && _jsxs("div", {
|
|
203
|
+
style: {
|
|
204
|
+
position: 'fixed',
|
|
205
|
+
bottom: 0,
|
|
206
|
+
right: 96,
|
|
207
|
+
height: 48,
|
|
208
|
+
zIndex: 2
|
|
209
|
+
},
|
|
210
|
+
children: [_jsx(ArrowLeftOutlined, {
|
|
211
|
+
onClick: function onClick() {
|
|
212
|
+
return setPage(page - 1);
|
|
213
|
+
},
|
|
214
|
+
className: classnames({
|
|
215
|
+
'igloo-preview-page-btn': true,
|
|
216
|
+
'igloo-preview-previous': true,
|
|
217
|
+
'igloo-preview-disabled': page === 1
|
|
218
|
+
})
|
|
219
|
+
}), _jsx(ArrowRightOutlined, {
|
|
220
|
+
onClick: function onClick() {
|
|
221
|
+
return setPage(page + 1);
|
|
222
|
+
},
|
|
223
|
+
className: classnames({
|
|
224
|
+
'igloo-preview-page-btn': true,
|
|
225
|
+
'igloo-preview-next': true,
|
|
226
|
+
'igloo-preview-disabled': page === pageSize
|
|
227
|
+
})
|
|
228
|
+
})]
|
|
229
|
+
})]
|
|
65
230
|
});
|
|
66
231
|
};
|
|
67
232
|
|
|
@@ -70,7 +235,8 @@ var MediaItem = function MediaItem(_ref3) {
|
|
|
70
235
|
src = _ref3.src,
|
|
71
236
|
scale = _ref3.scale,
|
|
72
237
|
offset = _ref3.offset,
|
|
73
|
-
isCurrent = _ref3.isCurrent
|
|
238
|
+
isCurrent = _ref3.isCurrent,
|
|
239
|
+
showAllPages = _ref3.showAllPages;
|
|
74
240
|
var top = offset.top,
|
|
75
241
|
left = offset.left;
|
|
76
242
|
|
|
@@ -91,7 +257,8 @@ var MediaItem = function MediaItem(_ref3) {
|
|
|
91
257
|
top: top,
|
|
92
258
|
left: left,
|
|
93
259
|
scale: scale,
|
|
94
|
-
isCurrent: isCurrent
|
|
260
|
+
isCurrent: isCurrent,
|
|
261
|
+
showAllPages: showAllPages
|
|
95
262
|
});
|
|
96
263
|
|
|
97
264
|
default:
|
|
@@ -115,36 +282,38 @@ var Media = function Media(_ref4) {
|
|
|
115
282
|
scale = _ref4$scale === void 0 ? 1 : _ref4$scale,
|
|
116
283
|
type = _ref4.type,
|
|
117
284
|
_ref4$isCurrent = _ref4.isCurrent,
|
|
118
|
-
isCurrent = _ref4$isCurrent === void 0 ? false : _ref4$isCurrent
|
|
285
|
+
isCurrent = _ref4$isCurrent === void 0 ? false : _ref4$isCurrent,
|
|
286
|
+
_ref4$showAllPages = _ref4.showAllPages,
|
|
287
|
+
showAllPages = _ref4$showAllPages === void 0 ? true : _ref4$showAllPages;
|
|
119
288
|
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
isDrag =
|
|
123
|
-
setIsDrag =
|
|
289
|
+
var _useState7 = useState(false),
|
|
290
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
291
|
+
isDrag = _useState8[0],
|
|
292
|
+
setIsDrag = _useState8[1];
|
|
124
293
|
|
|
125
|
-
var
|
|
294
|
+
var _useState9 = useState({
|
|
126
295
|
startX: 0,
|
|
127
296
|
startY: 0
|
|
128
297
|
}),
|
|
129
|
-
|
|
130
|
-
startPos =
|
|
131
|
-
setStartPos =
|
|
298
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
299
|
+
startPos = _useState10[0],
|
|
300
|
+
setStartPos = _useState10[1];
|
|
132
301
|
|
|
133
|
-
var
|
|
302
|
+
var _useState11 = useState({
|
|
134
303
|
top: 0,
|
|
135
304
|
left: 0
|
|
136
305
|
}),
|
|
137
|
-
|
|
138
|
-
offset =
|
|
139
|
-
setOffset =
|
|
306
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
307
|
+
offset = _useState12[0],
|
|
308
|
+
setOffset = _useState12[1];
|
|
140
309
|
|
|
141
|
-
var
|
|
310
|
+
var _useState13 = useState({
|
|
142
311
|
top: 0,
|
|
143
312
|
left: 0
|
|
144
313
|
}),
|
|
145
|
-
|
|
146
|
-
lastOffset =
|
|
147
|
-
setLastOffset =
|
|
314
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
315
|
+
lastOffset = _useState14[0],
|
|
316
|
+
setLastOffset = _useState14[1];
|
|
148
317
|
|
|
149
318
|
var handleMouseUp = function handleMouseUp(e) {
|
|
150
319
|
e.preventDefault();
|
|
@@ -212,7 +381,8 @@ var Media = function Media(_ref4) {
|
|
|
212
381
|
src: src,
|
|
213
382
|
scale: scale,
|
|
214
383
|
offset: offset,
|
|
215
|
-
isCurrent: isCurrent
|
|
384
|
+
isCurrent: isCurrent,
|
|
385
|
+
showAllPages: showAllPages
|
|
216
386
|
})
|
|
217
387
|
});
|
|
218
388
|
};
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
position: absolute;
|
|
78
78
|
width: 100%;
|
|
79
79
|
height: calc(100% - 200px);
|
|
80
|
-
top:
|
|
80
|
+
top: 92px;
|
|
81
81
|
|
|
82
82
|
.image {
|
|
83
83
|
max-width: 100%;
|
|
@@ -142,12 +142,12 @@
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
.igloo-preview-next {
|
|
145
|
-
right:
|
|
145
|
+
right: 136px;
|
|
146
146
|
user-select: none;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
.igloo-preview-previous {
|
|
150
|
-
right:
|
|
150
|
+
right: 192px;
|
|
151
151
|
user-select: none;
|
|
152
152
|
}
|
|
153
153
|
|
package/es/upload-photo/media.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
1
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { useState, useContext } from 'react';
|
|
2
15
|
import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
|
|
16
|
+
import { LocaleContext } from '../locale';
|
|
3
17
|
|
|
4
18
|
var MediaItem = function MediaItem(_ref) {
|
|
5
19
|
var type = _ref.type,
|
|
6
20
|
src = _ref.src,
|
|
7
21
|
className = _ref.className;
|
|
8
22
|
|
|
23
|
+
var _useState = useState(false),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
needPassword = _useState2[0],
|
|
26
|
+
setNeedPassword = _useState2[1];
|
|
27
|
+
|
|
28
|
+
var _useContext = useContext(LocaleContext),
|
|
29
|
+
formatMessage = _useContext.formatMessage;
|
|
30
|
+
|
|
9
31
|
switch (type) {
|
|
10
32
|
case 'video':
|
|
11
33
|
return _jsx("video", {
|
|
@@ -21,8 +43,13 @@ var MediaItem = function MediaItem(_ref) {
|
|
|
21
43
|
case 'pdf':
|
|
22
44
|
return _jsx("div", {
|
|
23
45
|
className: className,
|
|
24
|
-
children:
|
|
46
|
+
children: needPassword ? formatMessage({
|
|
47
|
+
id: 'Encrypted PDF'
|
|
48
|
+
}) : _jsx(Document, {
|
|
25
49
|
file: src,
|
|
50
|
+
onPassword: function onPassword() {
|
|
51
|
+
setNeedPassword(true);
|
|
52
|
+
},
|
|
26
53
|
children: _jsx(Page, {
|
|
27
54
|
pageNumber: 1,
|
|
28
55
|
height: 96
|
|
@@ -152,7 +152,7 @@ var UploadPreview = function UploadPreview(_ref) {
|
|
|
152
152
|
}), src && type && _jsx(Media, {
|
|
153
153
|
src: src,
|
|
154
154
|
type: type
|
|
155
|
-
}), _jsx(Button, {
|
|
155
|
+
}, current), _jsx(Button, {
|
|
156
156
|
icon: _jsx(ArrowRightOutlined, {}),
|
|
157
157
|
className: classnames('igloo-upload-preview-modal-button', 'igloo-upload-preview-modal-button-right'),
|
|
158
158
|
onClick: next,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "antd/es/message/style";
|
|
2
|
+
import _message from "antd/es/message";
|
|
1
3
|
import "antd/es/grid/style";
|
|
2
4
|
import _Grid from "antd/es/grid";
|
|
3
5
|
|
|
@@ -14,13 +16,20 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
14
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
17
|
|
|
16
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
import { useState, useContext } from 'react';
|
|
19
|
+
import { useState, useContext, useReducer, useRef } from 'react';
|
|
18
20
|
import Typography from '../typography';
|
|
19
21
|
import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
|
|
20
22
|
import { ErrorFilled } from 'iglooicon';
|
|
21
23
|
import LocaleContext from '../locale/locale-context';
|
|
24
|
+
import Modal from '../modal';
|
|
25
|
+
import Password from '../input/password';
|
|
26
|
+
import Button from '../button';
|
|
22
27
|
import classNames from 'classnames';
|
|
23
28
|
var useBreakpoint = _Grid.useBreakpoint;
|
|
29
|
+
var PasswordResponses = {
|
|
30
|
+
NEED_PASSWORD: 1,
|
|
31
|
+
INCORRECT_PASSWORD: 2
|
|
32
|
+
};
|
|
24
33
|
|
|
25
34
|
var PDF = function PDF(_ref) {
|
|
26
35
|
var src = _ref.src;
|
|
@@ -30,9 +39,26 @@ var PDF = function PDF(_ref) {
|
|
|
30
39
|
pageSize = _useState2[0],
|
|
31
40
|
setPageSize = _useState2[1];
|
|
32
41
|
|
|
42
|
+
var _useState3 = useState(false),
|
|
43
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
44
|
+
needPassword = _useState4[0],
|
|
45
|
+
setNeedPassword = _useState4[1];
|
|
46
|
+
|
|
33
47
|
var _useBreakpoint = useBreakpoint(),
|
|
34
48
|
md = _useBreakpoint.md;
|
|
35
49
|
|
|
50
|
+
var _useReducer = useReducer(function (a) {
|
|
51
|
+
return a + 1;
|
|
52
|
+
}, 0),
|
|
53
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
54
|
+
index = _useReducer2[0],
|
|
55
|
+
update = _useReducer2[1];
|
|
56
|
+
|
|
57
|
+
var documentRef = useRef(null);
|
|
58
|
+
|
|
59
|
+
var _useContext = useContext(LocaleContext),
|
|
60
|
+
formatMessage = _useContext.formatMessage;
|
|
61
|
+
|
|
36
62
|
var handlePageInit = function handlePageInit(document) {
|
|
37
63
|
var _ref2 = document || {},
|
|
38
64
|
numPages = _ref2.numPages;
|
|
@@ -42,11 +68,77 @@ var PDF = function PDF(_ref) {
|
|
|
42
68
|
}
|
|
43
69
|
};
|
|
44
70
|
|
|
71
|
+
var handleCancelLoad = function handleCancelLoad() {
|
|
72
|
+
var current = documentRef === null || documentRef === void 0 ? void 0 : documentRef.current;
|
|
73
|
+
|
|
74
|
+
if (current) {
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
current.setState({
|
|
77
|
+
pdf: false
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setNeedPassword(true);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
var onPassword = function onPassword(callback, reason) {
|
|
85
|
+
if (reason) {
|
|
86
|
+
var password = '';
|
|
87
|
+
|
|
88
|
+
if (reason === PasswordResponses.INCORRECT_PASSWORD) {
|
|
89
|
+
_message.error(formatMessage({
|
|
90
|
+
id: 'Invalid password.'
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
Modal.confirm({
|
|
95
|
+
title: formatMessage({
|
|
96
|
+
id: 'Enter the password to open this PDF file.'
|
|
97
|
+
}),
|
|
98
|
+
maskClosable: false,
|
|
99
|
+
content: _jsx("div", {
|
|
100
|
+
children: _jsx(Password, {
|
|
101
|
+
onChange: function onChange(event) {
|
|
102
|
+
return password = event.target.value;
|
|
103
|
+
},
|
|
104
|
+
placeholder: "input password"
|
|
105
|
+
})
|
|
106
|
+
}),
|
|
107
|
+
okText: formatMessage({
|
|
108
|
+
id: 'Ok'
|
|
109
|
+
}),
|
|
110
|
+
cancelText: formatMessage({
|
|
111
|
+
id: 'Cancel'
|
|
112
|
+
}),
|
|
113
|
+
onOk: function onOk() {
|
|
114
|
+
return callback(password);
|
|
115
|
+
},
|
|
116
|
+
onCancel: handleCancelLoad
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
var reopen = function reopen() {
|
|
122
|
+
setNeedPassword(false);
|
|
123
|
+
update();
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
if (needPassword) {
|
|
127
|
+
return _jsx(Button, {
|
|
128
|
+
onClick: reopen,
|
|
129
|
+
type: "text",
|
|
130
|
+
children: formatMessage({
|
|
131
|
+
id: 'This is an encrypted file, click to enter password.'
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
45
136
|
return _jsx("div", {
|
|
46
137
|
className: "igloo-upload-preview-pdf",
|
|
47
138
|
children: _jsx(Document, {
|
|
48
139
|
file: src,
|
|
49
140
|
onLoadSuccess: handlePageInit,
|
|
141
|
+
onPassword: onPassword,
|
|
50
142
|
children: Array.from({
|
|
51
143
|
length: pageSize
|
|
52
144
|
}).map(function (_, index) {
|
|
@@ -55,7 +147,7 @@ var PDF = function PDF(_ref) {
|
|
|
55
147
|
scale: md ? 1 : 0.5
|
|
56
148
|
}, index);
|
|
57
149
|
})
|
|
58
|
-
})
|
|
150
|
+
}, index)
|
|
59
151
|
});
|
|
60
152
|
};
|
|
61
153
|
|
|
@@ -64,8 +156,8 @@ var Media = function Media(_ref3) {
|
|
|
64
156
|
type = _ref3.type,
|
|
65
157
|
className = _ref3.className;
|
|
66
158
|
|
|
67
|
-
var
|
|
68
|
-
formatMessage =
|
|
159
|
+
var _useContext2 = useContext(LocaleContext),
|
|
160
|
+
formatMessage = _useContext2.formatMessage;
|
|
69
161
|
|
|
70
162
|
var children = _jsxs("div", {
|
|
71
163
|
className: "igloo-upload-prevew-not-supported",
|
package/lib/claim-list/index.js
CHANGED
|
@@ -131,7 +131,7 @@ var ClaimList = function ClaimList(props) {
|
|
|
131
131
|
}, []);
|
|
132
132
|
setExpandedRowKeys(tableExtendKeys);
|
|
133
133
|
setShowDetailKeys(claimExtendKeys);
|
|
134
|
-
}, []);
|
|
134
|
+
}, [dateSource]);
|
|
135
135
|
|
|
136
136
|
var handleClickRow = function handleClickRow(record, rowKey, showDetailKeys, expandedRowKeys, handleClaimOpenChange) {
|
|
137
137
|
var copyExtendsKeys = _toConsumableArray(showDetailKeys);
|
package/lib/documents/index.d.ts
CHANGED
package/lib/documents/index.js
CHANGED
|
@@ -39,7 +39,11 @@ var Documents = function Documents(_ref) {
|
|
|
39
39
|
var _ref$docList = _ref.docList,
|
|
40
40
|
docList = _ref$docList === void 0 ? [] : _ref$docList,
|
|
41
41
|
_ref$docNames = _ref.docNames,
|
|
42
|
-
docNames = _ref$docNames === void 0 ? [] : _ref$docNames
|
|
42
|
+
docNames = _ref$docNames === void 0 ? [] : _ref$docNames,
|
|
43
|
+
_ref$showAllPages = _ref.showAllPages,
|
|
44
|
+
showAllPages = _ref$showAllPages === void 0 ? true : _ref$showAllPages,
|
|
45
|
+
_ref$destroyOnClose = _ref.destroyOnClose,
|
|
46
|
+
destroyOnClose = _ref$destroyOnClose === void 0 ? true : _ref$destroyOnClose;
|
|
43
47
|
|
|
44
48
|
var _useState = (0, _react.useState)(0),
|
|
45
49
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -122,7 +126,9 @@ var Documents = function Documents(_ref) {
|
|
|
122
126
|
src: src,
|
|
123
127
|
type: type,
|
|
124
128
|
docNames: docNames,
|
|
125
|
-
name: docNames[index]
|
|
129
|
+
name: docNames[index],
|
|
130
|
+
showAllPages: showAllPages,
|
|
131
|
+
destroyOnClose: destroyOnClose
|
|
126
132
|
})
|
|
127
133
|
}, index);
|
|
128
134
|
})
|
|
@@ -24,12 +24,16 @@
|
|
|
24
24
|
"Done": "Done",
|
|
25
25
|
"Drag and drop a file here": "Drag and drop a file here",
|
|
26
26
|
"Edit": "Edit",
|
|
27
|
+
"Encrypted PDF": "Encrypted PDF",
|
|
28
|
+
"Enter the password to open this PDF file.": "Enter the password to open this PDF file.",
|
|
27
29
|
"Error Report": "Error Report",
|
|
30
|
+
"Failed to load PDF file.": "Failed to load PDF file.",
|
|
28
31
|
"Filter": "Filter",
|
|
29
32
|
"I agree to the Igloo": "I agree to the Igloo",
|
|
30
33
|
"I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.",
|
|
31
34
|
"Import": "Import",
|
|
32
35
|
"Invalid KTP Number.": "Invalid KTP Number.",
|
|
36
|
+
"Invalid password.": "Invalid password.",
|
|
33
37
|
"It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.",
|
|
34
38
|
"Last 7 Days": "Last 7 Days",
|
|
35
39
|
"Last Day": "Last Day",
|
|
@@ -39,6 +43,7 @@
|
|
|
39
43
|
"No preview for this file. Only support image, video or PDF file.": "No preview for this file. Only support image, video or PDF file.",
|
|
40
44
|
"Numbers only, please omit \" \" or \"-\".": "Numbers only, please omit \" \" or \"-\".",
|
|
41
45
|
"OK": "OK",
|
|
46
|
+
"Ok": "Ok",
|
|
42
47
|
"Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.": "Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.",
|
|
43
48
|
"Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.",
|
|
44
49
|
"Optional": "Optional",
|
|
@@ -74,6 +79,7 @@
|
|
|
74
79
|
"The file type is not supported.": "The file type is not supported.",
|
|
75
80
|
"There are no options available currently": "There are no options available currently",
|
|
76
81
|
"This Month": "This Month",
|
|
82
|
+
"This is an encrypted file, click to enter password.": "This is an encrypted file, click to enter password.",
|
|
77
83
|
"Unselect All": "Unselect All",
|
|
78
84
|
"Uploading": "Uploading",
|
|
79
85
|
"We support CSV or XLSX files (less than 20M each).": "We support CSV or XLSX files (less than 20M each).",
|
|
@@ -24,12 +24,16 @@
|
|
|
24
24
|
"Done": "Selesai",
|
|
25
25
|
"Drag and drop a file here": "Geser dan Letakkan Dokumen disini",
|
|
26
26
|
"Edit": "Ubah",
|
|
27
|
+
"Encrypted PDF": "PDF terenkripsi",
|
|
28
|
+
"Enter the password to open this PDF file.": "Masukkan kata sandi untuk membuka file PDF ini.",
|
|
27
29
|
"Error Report": "Laporan Kesalahan",
|
|
30
|
+
"Failed to load PDF file.": "Gagal memuat file PDF.",
|
|
28
31
|
"Filter": "Saring",
|
|
29
32
|
"I agree to the Igloo": "Saya setuju dengan Igloo",
|
|
30
33
|
"I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "Saya menyatakan bahwa pernyataan yang saya jelaskan di atas adalah benar. Selanjutnya saya nyatakan bahwa kerugian yang terjadi merupakan ketidaksengajaan, dan terjadi tanpa perencanaan atau hasil musyawarah dengan pihak lain.",
|
|
31
34
|
"Import": "Impor",
|
|
32
|
-
"Invalid KTP Number.": "
|
|
35
|
+
"Invalid KTP Number.": "Nomor KTP Tidak Valid",
|
|
36
|
+
"Invalid password.": "Kata sandi salah.",
|
|
33
37
|
"It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "Direkomendasikan untuk memilih tidak lebih dari {colMax} metrik untuk memastikan sudut pandang default dari setiap isi kolom.",
|
|
34
38
|
"Last 7 Days": "7 hari terakhir",
|
|
35
39
|
"Last Day": "hari terakhir",
|
|
@@ -39,6 +43,7 @@
|
|
|
39
43
|
"No preview for this file. Only support image, video or PDF file.": "Tidak ada pratinjau untuk file ini. Hanya mendukung file gambar, video atau PDF.",
|
|
40
44
|
"Numbers only, please omit \" \" or \"-\".": "Angka saja, harap hilangkan \" \" atau \"-\".",
|
|
41
45
|
"OK": "oke",
|
|
46
|
+
"Ok": "oke",
|
|
42
47
|
"Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.": "Setelah Anda puas dengan hal di atas, dan Anda telah mencentang kotak di bawah, silakan lanjutkan dan kirimkan aktivasi Anda.",
|
|
43
48
|
"Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "Jika Anda puas dengan apa yang telah disampaikan, dan Anda telah memeriksa deklarasi tersebut, silakan lanjutkan dan ajukan klaim Anda.",
|
|
44
49
|
"Optional": "Pilihan",
|
|
@@ -74,6 +79,7 @@
|
|
|
74
79
|
"The file type is not supported.": "Jenis file tidak didukung.",
|
|
75
80
|
"There are no options available currently": "Tidak ada opsi yang tersedia saat ini",
|
|
76
81
|
"This Month": "Bulan ini",
|
|
82
|
+
"This is an encrypted file, click to enter password.": "Ini adalah file terenkripsi, klik untuk memasukkan kata sandi.",
|
|
77
83
|
"Unselect All": "Batalkan semua",
|
|
78
84
|
"Uploading": "Mengunggah",
|
|
79
85
|
"We support CSV or XLSX files (less than 20M each).": "Kami mendukung file CSV atau XLSX (Ukuran maksimal 20 MB) .",
|