iglooform 2.5.16 → 2.5.19

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.
@@ -104,7 +104,7 @@ var ClaimList = function ClaimList(props) {
104
104
  }, []);
105
105
  setExpandedRowKeys(tableExtendKeys);
106
106
  setShowDetailKeys(claimExtendKeys);
107
- }, []);
107
+ }, [dateSource]);
108
108
 
109
109
  var handleClickRow = function handleClickRow(record, rowKey, showDetailKeys, expandedRowKeys, handleClaimOpenChange) {
110
110
  var copyExtendsKeys = _toConsumableArray(showDetailKeys);
@@ -104,6 +104,20 @@ InputId.formItemPropsHandler = function (config) {
104
104
  });
105
105
  }
106
106
 
107
+ if (idType === 'NIK') {
108
+ rules.push({
109
+ validator: function validator(rule, value) {
110
+ if (!/^((1[1-9])|(21)|([37][1-6])|(5[1-4])|(6[1-5])|([8-9][1-2]))[0-9]{4}(([0-6][0-9])|(7[0-1]))((0[1-9])|(1[0-2]))[0-9]{6}$/.test(value)) {
111
+ return Promise.reject(formatMessage({
112
+ id: 'Invalid NIK Number.'
113
+ }));
114
+ }
115
+
116
+ return Promise.resolve();
117
+ }
118
+ });
119
+ }
120
+
107
121
  return {
108
122
  rules: rules
109
123
  };
@@ -24,12 +24,17 @@
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 NIK Number.": "Invalid NIK Number.",
37
+ "Invalid password.": "Invalid password.",
33
38
  "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
39
  "Last 7 Days": "Last 7 Days",
35
40
  "Last Day": "Last Day",
@@ -39,6 +44,7 @@
39
44
  "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
45
  "Numbers only, please omit \" \" or \"-\".": "Numbers only, please omit \" \" or \"-\".",
41
46
  "OK": "OK",
47
+ "Ok": "Ok",
42
48
  "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
49
  "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
50
  "Optional": "Optional",
@@ -74,6 +80,7 @@
74
80
  "The file type is not supported.": "The file type is not supported.",
75
81
  "There are no options available currently": "There are no options available currently",
76
82
  "This Month": "This Month",
83
+ "This is an encrypted file, click to enter password.": "This is an encrypted file, click to enter password.",
77
84
  "Unselect All": "Unselect All",
78
85
  "Uploading": "Uploading",
79
86
  "We support CSV or XLSX files (less than 20M each).": "We support CSV or XLSX files (less than 20M each).",
@@ -24,12 +24,17 @@
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.": "Số KTP không hợp lệ.",
35
+ "Invalid KTP Number.": "Nomor KTP Tidak Valid",
36
+ "Invalid NIK Number.": "Nomor NIK Tidak Valid",
37
+ "Invalid password.": "Kata sandi salah.",
33
38
  "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
39
  "Last 7 Days": "7 hari terakhir",
35
40
  "Last Day": "hari terakhir",
@@ -39,6 +44,7 @@
39
44
  "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
45
  "Numbers only, please omit \" \" or \"-\".": "Angka saja, harap hilangkan \" \" atau \"-\".",
41
46
  "OK": "oke",
47
+ "Ok": "oke",
42
48
  "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
49
  "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
50
  "Optional": "Pilihan",
@@ -74,6 +80,7 @@
74
80
  "The file type is not supported.": "Jenis file tidak didukung.",
75
81
  "There are no options available currently": "Tidak ada opsi yang tersedia saat ini",
76
82
  "This Month": "Bulan ini",
83
+ "This is an encrypted file, click to enter password.": "Ini adalah file terenkripsi, klik untuk memasukkan kata sandi.",
77
84
  "Unselect All": "Batalkan semua",
78
85
  "Uploading": "Mengunggah",
79
86
  "We support CSV or XLSX files (less than 20M each).": "Kami mendukung file CSV atau XLSX (Ukuran maksimal 20 MB) .",
@@ -24,12 +24,17 @@
24
24
  "Done": "เสร็จแล้ว",
25
25
  "Drag and drop a file here": "ลากและวางไฟล์มาที่นี่",
26
26
  "Edit": "แก้ไข",
27
+ "Encrypted PDF": "PDF ที่เข้ารหัส",
28
+ "Enter the password to open this PDF file.": "ป้อนรหัสผ่านเพื่อเปิดไฟล์ PDF นี้",
27
29
  "Error Report": "รายงานข้อผิดพลาด",
30
+ "Failed to load PDF file.": "ไม่สามารถโหลดไฟล์ PDF",
28
31
  "Filter": "กรอง",
29
32
  "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.": "ข้าพเจ้ายืนยันว่าข้อความที่ข้าพเจ้าได้อธิบายข้างต้นนั้นเป็นความจริง และยืนยันว่าความเสียหายที่เกิดขึ้นนั้นเกิดจากอุบัติเหตุ ปราศจากการวางแผน หรือ การเห็นพ้องร่วมกันกับฝ่ายอื่น",
31
34
  "Import": "นำเข้า",
32
- "Invalid KTP Number.": "",
35
+ "Invalid KTP Number.": "หมายเลข KTP ไม่ถูกต้อง",
36
+ "Invalid NIK Number.": "",
37
+ "Invalid password.": "รหัสผ่านไม่ถูกต้อง.",
33
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "แนะนำให้เลือกจำนวนไม่เกิน {colMax} เพื่อให้แน่ใจว่ามองเห็นค่าเริ่มต้นของข้อมูลแต่ละคอลัมน์",
34
39
  "Last 7 Days": "เมื่อ 7 วันที่แล้ว",
35
40
  "Last Day": "วันสุดท้าย",
@@ -39,6 +44,7 @@
39
44
  "No preview for this file. Only support image, video or PDF file.": "ไม่มีการแสดงตัวอย่างสำหรับไฟล์นี้ รองรับเฉพาะรูปภาพ, วิดีโอ หรือ ไฟล์ PDF",
40
45
  "Numbers only, please omit \" \" or \"-\".": "ตัวเลขเท่านั้น โปรดเว้น \" \" หรือ \"-\"",
41
46
  "OK": "ตกลง",
47
+ "Ok": "ตกลง",
42
48
  "Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.": "เมื่อคุณพอใจกับสิ่งด้านบนแล้ว และคุณได้ทำเครื่องหมายที่ช่องด้านล่างแล้ว โปรดดำเนินการต่อและส่งการเปิดใช้งานของคุณ",
43
49
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "หากตรวจสอบแล้วและต้องการยืนยันข้อมูลข้างต้น กรุณากดดำเนินการต่อและยืนยันการเคลมของคุณ",
44
50
  "Optional": "ไม่จำเป็น",
@@ -74,6 +80,7 @@
74
80
  "The file type is not supported.": "ประเภทไฟล์ไม่รองรับ",
75
81
  "There are no options available currently": "ไม่มีตัวเลือกในขณะนี้",
76
82
  "This Month": "เดือนนี้",
83
+ "This is an encrypted file, click to enter password.": "นี่เป็นไฟล์ที่เข้ารหัส คลิกเพื่อป้อนรหัสผ่าน",
77
84
  "Unselect All": "ไม่เลือกทั้งหมด",
78
85
  "Uploading": "กำลังอัพโหลด",
79
86
  "We support CSV or XLSX files (less than 20M each).": "เรารองรับ CSV หรือ XLSX ไฟล์ (แต่ละไฟล์ขนาดไฟล์ต้องไม่เกิน 20M)",
@@ -24,12 +24,17 @@
24
24
  "Done": "Xong",
25
25
  "Drag and drop a file here": "Thả tệp tin vào đây",
26
26
  "Edit": "Sửa",
27
+ "Encrypted PDF": "PDF được mã hóa",
28
+ "Enter the password to open this PDF file.": "Nhập mật khẩu để mở tệp PDF này.",
27
29
  "Error Report": "Báo cáo lỗi",
30
+ "Failed to load PDF file.": "Không tải được tệp PDF.",
28
31
  "Filter": "Lọc",
29
32
  "I agree to the Igloo": "Tôi đồng ý với 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.": "Tôi tuyên bố rằng những điều tôi đã mô tả ở trên là đúng sự thật. Tôi tuyên bố thêm rằng tổn thất xảy ra là do ngẫu nhiên, không có kế hoạch hoặc sự đồng thuận với các bên khác.",
31
34
  "Import": "Nhập",
32
- "Invalid KTP Number.": "",
35
+ "Invalid KTP Number.": "Số KTP không hợp lệ.",
36
+ "Invalid NIK Number.": "",
37
+ "Invalid password.": "Mật khẩu không hợp lệ.",
33
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "Vui lòng chọn không quá {colMax} cột.",
34
39
  "Last 7 Days": "7 ngày gần nhất",
35
40
  "Last Day": "ngày cuối",
@@ -39,6 +44,7 @@
39
44
  "No preview for this file. Only support image, video or PDF file.": "Không có bản xem trước cho tệp này. Chỉ hỗ trợ hình ảnh, video hoặc tệp PDF.",
40
45
  "Numbers only, please omit \" \" or \"-\".": "Chỉ số, vui lòng bỏ qua \" \" hoặc \"-\".",
41
46
  "OK": "Vâng",
47
+ "Ok": "Vâng",
42
48
  "Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.": "Khi bạn hài lòng với những điều trên và đã chọn hộp bên dưới, hãy tiếp tục và gửi kích hoạt của bạn.",
43
49
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "Vui lòng xác nhận và gửi yêu cầu bồi thường.",
44
50
  "Optional": "Không bắt buộc",
@@ -74,6 +80,7 @@
74
80
  "The file type is not supported.": "Loại tệp không được hỗ trợ.",
75
81
  "There are no options available currently": "Hiện tại không có tùy chọn nào",
76
82
  "This Month": "Tháng này",
83
+ "This is an encrypted file, click to enter password.": "Đây là một tập tin được mã hóa, bấm vào để nhập mật khẩu.",
77
84
  "Unselect All": "Hủy chọn tất cả",
78
85
  "Uploading": "Đang tải lên",
79
86
  "We support CSV or XLSX files (less than 20M each).": "Hỗ trợ .CSV hoặc .XLSX (file nhỏ hơn 20MB)",
@@ -24,12 +24,17 @@
24
24
  "Done": "完成",
25
25
  "Drag and drop a file here": "拖拽一个文件到这里",
26
26
  "Edit": "编辑",
27
+ "Encrypted PDF": "加密的PDF文件",
28
+ "Enter the password to open this PDF file.": "输入密码后预览该文件",
27
29
  "Error Report": "错误报告",
30
+ "Failed to load PDF file.": "PDF文件加载失败",
28
31
  "Filter": "过滤条件",
29
32
  "I agree to the Igloo": "我同意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.": "我承诺上述信息均真实有效,并且物品遗失纯属意外。",
31
34
  "Import": "导入",
32
- "Invalid KTP Number.": "",
35
+ "Invalid KTP Number.": "不合法的ID",
36
+ "Invalid NIK Number.": "",
37
+ "Invalid password.": "无效的密码",
33
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建议不要选择超过{colMax}个字段,以确保最佳展示效果。",
34
39
  "Last 7 Days": "过去7天",
35
40
  "Last Day": "昨天",
@@ -39,6 +44,7 @@
39
44
  "No preview for this file. Only support image, video or PDF file.": "此文件不支持预览。仅支持图片、视频和PDF。",
40
45
  "Numbers only, please omit \" \" or \"-\".": "仅数字,请省略“ ”或“-”。",
41
46
  "OK": "确定",
47
+ "Ok": "确定",
42
48
  "Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.": "如您对上述填写内容满意,请继续提交。",
43
49
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "如您对上述填写内容满意,在勾选以下申明后,请继续提交您的理赔申请。",
44
50
  "Optional": "可选",
@@ -74,6 +80,7 @@
74
80
  "The file type is not supported.": "不支持上传该类型的文件。",
75
81
  "There are no options available currently": "当前没有可用的选项",
76
82
  "This Month": "当月",
83
+ "This is an encrypted file, click to enter password.": "该文件已加密,请输入密码。",
77
84
  "Unselect All": "反选",
78
85
  "Uploading": "上传中",
79
86
  "We support CSV or XLSX files (less than 20M each).": "支持上传20M以内的CSV和XLSX文件",
@@ -24,12 +24,17 @@
24
24
  "Done": "完成",
25
25
  "Drag and drop a file here": "拖放文件至此",
26
26
  "Edit": "編輯",
27
+ "Encrypted PDF": "",
28
+ "Enter the password to open this PDF file.": "",
27
29
  "Error Report": "錯誤報告",
30
+ "Failed to load PDF file.": "",
28
31
  "Filter": "篩選",
29
32
  "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.": "我聲明我上面描述的陳述是真的。我進一步宣布發生損失是偶然的,沒有規劃或與其他方的共識。",
31
34
  "Import": "導入",
32
35
  "Invalid KTP Number.": "",
36
+ "Invalid NIK Number.": "",
37
+ "Invalid password.": "",
33
38
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建議選擇不超過{colMax}指標以確保每個列輸入的默認可見性。",
34
39
  "Last 7 Days": "過去7天",
35
40
  "Last Day": "過去1天",
@@ -39,6 +44,7 @@
39
44
  "No preview for this file. Only support image, video or PDF file.": "不支持預覽此文件。只支持圖像,視頻或PDF文件。",
40
45
  "Numbers only, please omit \" \" or \"-\".": "只有數字,請省略“”或“ - ”。",
41
46
  "OK": "好",
47
+ "Ok": "",
42
48
  "Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.": "",
43
49
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "一旦您對上述內容感到滿意,您已檢查聲明,請繼續並提交您的索賠。",
44
50
  "Optional": "可選項",
@@ -74,6 +80,7 @@
74
80
  "The file type is not supported.": "不支持文件類型。",
75
81
  "There are no options available currently": "當前沒有可用的選項",
76
82
  "This Month": "本月",
83
+ "This is an encrypted file, click to enter password.": "",
77
84
  "Unselect All": "全部取消選擇",
78
85
  "Uploading": "上傳",
79
86
  "We support CSV or XLSX files (less than 20M each).": "我們支持CSV或XLSX文件(小於20M)。",
package/es/media/media.js CHANGED
@@ -1,12 +1,39 @@
1
1
  import "antd/es/tooltip/style";
2
2
  import _Tooltip from "antd/es/tooltip";
3
+
4
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
+
6
+ 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."); }
7
+
8
+ 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); }
9
+
10
+ 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; }
11
+
12
+ 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; }
13
+
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
+
3
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
+ import { useRef, useState, useContext } from 'react';
4
18
  import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
19
+ import { LocaleContext } from '../locale';
5
20
 
6
21
  var MediaItem = function MediaItem(_ref) {
7
22
  var type = _ref.type,
8
23
  src = _ref.src;
9
24
 
25
+ var _useContext = useContext(LocaleContext),
26
+ formatMessage = _useContext.formatMessage;
27
+
28
+ var documentRef = useRef(null);
29
+
30
+ var _useState = useState(formatMessage({
31
+ id: 'Failed to load PDF file.'
32
+ })),
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ errorText = _useState2[0],
35
+ setErrorText = _useState2[1];
36
+
10
37
  switch (type) {
11
38
  case 'video':
12
39
  return _jsx("video", {
@@ -19,6 +46,20 @@ var MediaItem = function MediaItem(_ref) {
19
46
  });
20
47
 
21
48
  case 'pdf':
49
+ var needPassword = function needPassword() {
50
+ var current = documentRef === null || documentRef === void 0 ? void 0 : documentRef.current;
51
+
52
+ if (current) {
53
+ // @ts-ignore
54
+ current.setState({
55
+ pdf: false
56
+ });
57
+ setErrorText(formatMessage({
58
+ id: 'Encrypted PDF'
59
+ }));
60
+ }
61
+ };
62
+
22
63
  return _jsx("div", {
23
64
  style: {
24
65
  maxWidth: 80,
@@ -26,7 +67,15 @@ var MediaItem = function MediaItem(_ref) {
26
67
  position: 'absolute'
27
68
  },
28
69
  children: _jsx(Document, {
70
+ ref: documentRef,
29
71
  file: src,
72
+ onPassword: needPassword,
73
+ error: _jsx("div", {
74
+ style: {
75
+ textAlign: 'center'
76
+ },
77
+ children: errorText
78
+ }),
30
79
  children: _jsx(Page, {
31
80
  pageNumber: 1,
32
81
  scale: 0.1
@@ -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
 
@@ -20,11 +22,19 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
20
22
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
23
 
22
24
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
23
- import { useState } from 'react';
25
+ import { useState, useRef, useContext, useReducer } from 'react';
24
26
  import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
25
27
  import classnames from 'classnames';
26
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';
27
33
  var useBreakpoint = _Grid.useBreakpoint;
34
+ var PasswordResponses = {
35
+ NEED_PASSWORD: 1,
36
+ INCORRECT_PASSWORD: 2
37
+ };
28
38
 
29
39
  var PdfViewer = function PdfViewer(_ref) {
30
40
  var src = _ref.src,
@@ -35,6 +45,9 @@ var PdfViewer = function PdfViewer(_ref) {
35
45
  _ref$showAllPages = _ref.showAllPages,
36
46
  showAllPages = _ref$showAllPages === void 0 ? true : _ref$showAllPages;
37
47
 
48
+ var _useContext = useContext(LocaleContext),
49
+ formatMessage = _useContext.formatMessage;
50
+
38
51
  var _useState = useState(1),
39
52
  _useState2 = _slicedToArray(_useState, 2),
40
53
  pageSize = _useState2[0],
@@ -45,9 +58,23 @@ var PdfViewer = function PdfViewer(_ref) {
45
58
  page = _useState4[0],
46
59
  setPage = _useState4[1];
47
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
+
48
68
  var _useBreakpoint = useBreakpoint(),
49
69
  md = _useBreakpoint.md;
50
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
+
51
78
  var handlePageInit = function handlePageInit(document) {
52
79
  var _ref2 = document || {},
53
80
  numPages = _ref2.numPages;
@@ -57,6 +84,74 @@ var PdfViewer = function PdfViewer(_ref) {
57
84
  }
58
85
  };
59
86
 
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
+
60
155
  if (showAllPages) {
61
156
  return _jsx("div", {
62
157
  style: {
@@ -71,6 +166,8 @@ var PdfViewer = function PdfViewer(_ref) {
71
166
  children: _jsx(Document, {
72
167
  file: src,
73
168
  onLoadSuccess: handlePageInit,
169
+ ref: documentRef,
170
+ onPassword: onPassword,
74
171
  children: Array.from({
75
172
  length: pageSize
76
173
  }).map(function (_, index) {
@@ -80,7 +177,7 @@ var PdfViewer = function PdfViewer(_ref) {
80
177
  }, index);
81
178
  })
82
179
  })
83
- });
180
+ }, index);
84
181
  }
85
182
 
86
183
  return _jsxs(_Fragment, {
@@ -95,12 +192,14 @@ var PdfViewer = function PdfViewer(_ref) {
95
192
  children: _jsx(Document, {
96
193
  file: src,
97
194
  onLoadSuccess: handlePageInit,
195
+ ref: documentRef,
196
+ onPassword: onPassword,
98
197
  children: _jsx(Page, {
99
198
  pageNumber: page,
100
199
  scale: scale
101
200
  })
102
201
  })
103
- }), isCurrent && Boolean(pageSize > 1) && _jsxs("div", {
202
+ }, index), isCurrent && Boolean(pageSize > 1) && _jsxs("div", {
104
203
  style: {
105
204
  position: 'fixed',
106
205
  bottom: 0,
@@ -187,34 +286,34 @@ var Media = function Media(_ref4) {
187
286
  _ref4$showAllPages = _ref4.showAllPages,
188
287
  showAllPages = _ref4$showAllPages === void 0 ? true : _ref4$showAllPages;
189
288
 
190
- var _useState5 = useState(false),
191
- _useState6 = _slicedToArray(_useState5, 2),
192
- isDrag = _useState6[0],
193
- setIsDrag = _useState6[1];
289
+ var _useState7 = useState(false),
290
+ _useState8 = _slicedToArray(_useState7, 2),
291
+ isDrag = _useState8[0],
292
+ setIsDrag = _useState8[1];
194
293
 
195
- var _useState7 = useState({
294
+ var _useState9 = useState({
196
295
  startX: 0,
197
296
  startY: 0
198
297
  }),
199
- _useState8 = _slicedToArray(_useState7, 2),
200
- startPos = _useState8[0],
201
- setStartPos = _useState8[1];
298
+ _useState10 = _slicedToArray(_useState9, 2),
299
+ startPos = _useState10[0],
300
+ setStartPos = _useState10[1];
202
301
 
203
- var _useState9 = useState({
302
+ var _useState11 = useState({
204
303
  top: 0,
205
304
  left: 0
206
305
  }),
207
- _useState10 = _slicedToArray(_useState9, 2),
208
- offset = _useState10[0],
209
- setOffset = _useState10[1];
306
+ _useState12 = _slicedToArray(_useState11, 2),
307
+ offset = _useState12[0],
308
+ setOffset = _useState12[1];
210
309
 
211
- var _useState11 = useState({
310
+ var _useState13 = useState({
212
311
  top: 0,
213
312
  left: 0
214
313
  }),
215
- _useState12 = _slicedToArray(_useState11, 2),
216
- lastOffset = _useState12[0],
217
- setLastOffset = _useState12[1];
314
+ _useState14 = _slicedToArray(_useState13, 2),
315
+ lastOffset = _useState14[0],
316
+ setLastOffset = _useState14[1];
218
317
 
219
318
  var handleMouseUp = function handleMouseUp(e) {
220
319
  e.preventDefault();
package/es/types.d.ts CHANGED
@@ -110,7 +110,7 @@ export interface FormItemExtraConfig extends FormItemProps {
110
110
  length?: number;
111
111
  minLength?: number;
112
112
  maxLength?: number;
113
- idType?: 'KTP';
113
+ idType?: 'KTP' | 'NIK';
114
114
  [key: string]: any;
115
115
  }
116
116
  export interface FormItemConfig extends FormItemExtraConfig {
@@ -1,5 +1,6 @@
1
1
  .word-wrap {
2
2
  word-wrap: break-word;
3
+ white-space: pre-wrap;
3
4
  }
4
5
 
5
6
  .igloo-typography {
@@ -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: _jsx(Document, {
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,