iglooform 3.0.2 → 3.0.4

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 (56) hide show
  1. package/.dumi/tmp/dumi/theme/ContextWrapper.tsx +1 -1
  2. package/es/admin-amount/style/index.d.ts +0 -0
  3. package/es/babel-plugin-import-option.d.ts +7 -0
  4. package/es/back-top/index.d.ts +5 -0
  5. package/es/input/phone-number.js +2 -2
  6. package/es/input/style/amount/index.d.ts +2 -0
  7. package/es/input/style/index.d.ts +2 -0
  8. package/es/input/style/input-date/index.d.ts +2 -0
  9. package/es/input/style/otp/index.d.ts +2 -0
  10. package/es/input/style/phone-number/index.d.ts +2 -0
  11. package/es/input/style/text-area/index.d.ts +2 -0
  12. package/es/locale/en-US/messages.json +2 -1
  13. package/es/locale/id-ID/messages.json +2 -1
  14. package/es/locale/locale-provider.d.ts +11 -0
  15. package/es/locale/th-TH/messages.json +2 -1
  16. package/es/locale/vi-VN/messages.json +2 -1
  17. package/es/locale/zh-CN/messages.json +2 -1
  18. package/es/locale/zh-TW/messages.json +2 -1
  19. package/es/login-page/index.d.ts +7 -0
  20. package/es/message/style/index.d.ts +1 -0
  21. package/es/ocr/micro-blink/style/index.d.ts +1 -0
  22. package/es/platform/platform-card/index.d.ts +12 -0
  23. package/es/platform/switch-platform/index.d.ts +12 -0
  24. package/es/tabs/index.d.ts +15 -0
  25. package/es/upload/index.js +43 -20
  26. package/es/upload-photo/index.js +20 -4
  27. package/es/utils/form-utils.js +3 -1
  28. package/es/utils/useAsyncEffect.d.ts +3 -0
  29. package/lib/admin-amount/style/index.d.ts +0 -0
  30. package/lib/babel-plugin-import-option.d.ts +7 -0
  31. package/lib/back-top/index.d.ts +5 -0
  32. package/lib/input/phone-number.js +2 -2
  33. package/lib/input/style/amount/index.d.ts +2 -0
  34. package/lib/input/style/index.d.ts +2 -0
  35. package/lib/input/style/input-date/index.d.ts +2 -0
  36. package/lib/input/style/otp/index.d.ts +2 -0
  37. package/lib/input/style/phone-number/index.d.ts +2 -0
  38. package/lib/input/style/text-area/index.d.ts +2 -0
  39. package/lib/locale/en-US/messages.json +2 -1
  40. package/lib/locale/id-ID/messages.json +2 -1
  41. package/lib/locale/locale-provider.d.ts +11 -0
  42. package/lib/locale/th-TH/messages.json +2 -1
  43. package/lib/locale/vi-VN/messages.json +2 -1
  44. package/lib/locale/zh-CN/messages.json +2 -1
  45. package/lib/locale/zh-TW/messages.json +2 -1
  46. package/lib/login-page/index.d.ts +7 -0
  47. package/lib/message/style/index.d.ts +1 -0
  48. package/lib/ocr/micro-blink/style/index.d.ts +1 -0
  49. package/lib/platform/platform-card/index.d.ts +12 -0
  50. package/lib/platform/switch-platform/index.d.ts +12 -0
  51. package/lib/tabs/index.d.ts +15 -0
  52. package/lib/upload/index.js +42 -20
  53. package/lib/upload-photo/index.js +19 -4
  54. package/lib/utils/form-utils.js +3 -1
  55. package/lib/utils/useAsyncEffect.d.ts +3 -0
  56. package/package.json +1 -1
@@ -30,7 +30,7 @@ export default function DumiContextWrapper() {
30
30
 
31
31
  return (
32
32
  <SiteContext.Provider value={{
33
- pkg: {"name":"iglooform","version":"3.0.1","license":"MIT"},
33
+ pkg: {"name":"iglooform","version":"3.0.2","license":"MIT"},
34
34
  historyType: "browser",
35
35
  entryExports,
36
36
  demos,
File without changes
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ libraryName: string;
3
+ libraryDirectory: string;
4
+ style: boolean;
5
+ customName: (name: string) => string;
6
+ };
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import './style';
3
+ import { BackTopProps } from 'antd';
4
+ declare const BackToTop: FC<BackTopProps>;
5
+ export default BackToTop;
@@ -187,10 +187,10 @@ PhoneNumber.formItemPropsHandler = function (_ref2) {
187
187
  var initialAreaCode = (initialValue === null || initialValue === void 0 ? void 0 : initialValue.areaCode) || (Array.isArray(areaCode) ? areaCode[0] : areaCode);
188
188
  var initialPhoneNumber = (initialValue === null || initialValue === void 0 ? void 0 : initialValue.phoneNumber) || phoneNumber;
189
189
  return {
190
- initialValue: {
190
+ initialValue: initialPhoneNumber ? {
191
191
  areaCode: initialAreaCode,
192
192
  phoneNumber: initialPhoneNumber
193
- },
193
+ } : undefined,
194
194
  rules: rules,
195
195
  previewFormater: function previewFormater(_ref3) {
196
196
  var areaCode = _ref3.areaCode,
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import './default-input.less';
2
+ import './common.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "Encrypted PDF",
28
28
  "Enter the password to open this PDF file.": "Enter the password to open this PDF file.",
29
29
  "Error Report": "Error Report",
30
- "Error during the initialization of the SDK! {error}": "Error during the initialization of the SDK! {error}",
31
30
  "Failed to load PDF file.": "Failed to load PDF file.",
31
+ "File Uploading": "File Uploading",
32
32
  "Filter": "Filter",
33
33
  "I agree to the Igloo": "I agree to the Igloo",
34
34
  "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.",
@@ -51,6 +51,7 @@
51
51
  "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.",
52
52
  "Optional": "Optional",
53
53
  "Other Reason": "Other Reason",
54
+ "Photo Uploading": "Photo Uploading",
54
55
  "Please enter a valid date.": "Please enter a valid date.",
55
56
  "Please enter a valid time.": "Please enter a valid time.",
56
57
  "Please input a date after {date}": "Please input a date after {date}",
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "PDF terenkripsi",
28
28
  "Enter the password to open this PDF file.": "Masukkan kata sandi untuk membuka file PDF ini.",
29
29
  "Error Report": "Laporan Kesalahan",
30
- "Error during the initialization of the SDK! {error}": "",
31
30
  "Failed to load PDF file.": "Gagal memuat file PDF.",
31
+ "File Uploading": "Mengunggah Berkas",
32
32
  "Filter": "Saring",
33
33
  "I agree to the Igloo": "Saya setuju dengan Igloo",
34
34
  "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.",
@@ -51,6 +51,7 @@
51
51
  "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.",
52
52
  "Optional": "Pilihan",
53
53
  "Other Reason": "Alasan lain",
54
+ "Photo Uploading": "Mengunggah Foto",
54
55
  "Please enter a valid date.": "Silakan tulis tanggal valid",
55
56
  "Please enter a valid time.": "Harap masukkan waktu yang valid",
56
57
  "Please input a date after {date}": "Harap masukkan tanggal setelah {date}",
@@ -0,0 +1,11 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export declare const locales: {
3
+ [key: string]: {
4
+ [id: string]: string;
5
+ };
6
+ };
7
+ declare const LocaleProvider: FC<{
8
+ currentLang: string;
9
+ children?: ReactNode;
10
+ }>;
11
+ export default LocaleProvider;
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "PDF ที่เข้ารหัส",
28
28
  "Enter the password to open this PDF file.": "ป้อนรหัสผ่านเพื่อเปิดไฟล์ PDF นี้",
29
29
  "Error Report": "รายงานข้อผิดพลาด",
30
- "Error during the initialization of the SDK! {error}": "",
31
30
  "Failed to load PDF file.": "ไม่สามารถโหลดไฟล์ PDF",
31
+ "File Uploading": "การอัพโหลดไฟล์",
32
32
  "Filter": "กรอง",
33
33
  "I agree to the Igloo": "ฉันเห็นด้วยกับกระท่อมน้ำแข็ง",
34
34
  "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.": "ข้าพเจ้ายืนยันว่าข้อความที่ข้าพเจ้าได้อธิบายข้างต้นนั้นเป็นความจริง และยืนยันว่าความเสียหายที่เกิดขึ้นนั้นเกิดจากอุบัติเหตุ ปราศจากการวางแผน หรือ การเห็นพ้องร่วมกันกับฝ่ายอื่น",
@@ -51,6 +51,7 @@
51
51
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "หากตรวจสอบแล้วและต้องการยืนยันข้อมูลข้างต้น กรุณากดดำเนินการต่อและยืนยันการเคลมของคุณ",
52
52
  "Optional": "ไม่จำเป็น",
53
53
  "Other Reason": "เหตุผลอื่น",
54
+ "Photo Uploading": "การอัพโหลดรูปภาพ",
54
55
  "Please enter a valid date.": "กรุณากรอกวันที่ถูกต้อง",
55
56
  "Please enter a valid time.": "กรุณากรอกเวลาที่ถูกต้อง",
56
57
  "Please input a date after {date}": "กรุณาใส่วันที่หลัง {date}",
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "PDF được mã hóa",
28
28
  "Enter the password to open this PDF file.": "Nhập mật khẩu để mở tệp PDF này.",
29
29
  "Error Report": "Báo cáo lỗi",
30
- "Error during the initialization of the SDK! {error}": "",
31
30
  "Failed to load PDF file.": "Không tải được tệp PDF.",
31
+ "File Uploading": "Tải lên tệp",
32
32
  "Filter": "Lọc",
33
33
  "I agree to the Igloo": "Tôi đồng ý với Igloo",
34
34
  "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.",
@@ -51,6 +51,7 @@
51
51
  "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.",
52
52
  "Optional": "Không bắt buộc",
53
53
  "Other Reason": "Lý do khác",
54
+ "Photo Uploading": "Tải ảnh lên",
54
55
  "Please enter a valid date.": "Vui lòng nhập đúng ngày:",
55
56
  "Please enter a valid time.": "Vui lòng nhập thời gian hợp lệ.",
56
57
  "Please input a date after {date}": "Vui lòng nhập ngày sau {date}",
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "加密的PDF文件",
28
28
  "Enter the password to open this PDF file.": "输入密码后预览该文件",
29
29
  "Error Report": "错误报告",
30
- "Error during the initialization of the SDK! {error}": "",
31
30
  "Failed to load PDF file.": "PDF文件加载失败",
31
+ "File Uploading": "文件上传中",
32
32
  "Filter": "过滤条件",
33
33
  "I agree to the Igloo": "我同意Igloo",
34
34
  "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.": "我承诺上述信息均真实有效,并且物品遗失纯属意外。",
@@ -51,6 +51,7 @@
51
51
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "如您对上述填写内容满意,在勾选以下申明后,请继续提交您的理赔申请。",
52
52
  "Optional": "可选",
53
53
  "Other Reason": "其他原因",
54
+ "Photo Uploading": "图片上传中",
54
55
  "Please enter a valid date.": "请输入一个有效的日期。",
55
56
  "Please enter a valid time.": "请输入一个有效的时间。",
56
57
  "Please input a date after {date}": "请输入一个{date}之后的日期",
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "",
28
28
  "Enter the password to open this PDF file.": "",
29
29
  "Error Report": "錯誤報告",
30
- "Error during the initialization of the SDK! {error}": "",
31
30
  "Failed to load PDF file.": "",
31
+ "File Uploading": "",
32
32
  "Filter": "篩選",
33
33
  "I agree to the Igloo": "",
34
34
  "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.": "我聲明我上面描述的陳述是真的。我進一步宣布發生損失是偶然的,沒有規劃或與其他方的共識。",
@@ -51,6 +51,7 @@
51
51
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "一旦您對上述內容感到滿意,您已檢查聲明,請繼續並提交您的索賠。",
52
52
  "Optional": "可選項",
53
53
  "Other Reason": "其他原因",
54
+ "Photo Uploading": "",
54
55
  "Please enter a valid date.": "請輸入有效的日期。",
55
56
  "Please enter a valid time.": "請輸入有效的時間。",
56
57
  "Please input a date after {date}": "",
@@ -0,0 +1,7 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import './style';
3
+ interface Props {
4
+ showAppStore?: boolean;
5
+ }
6
+ declare const LoginPage: FC<PropsWithChildren<Props>>;
7
+ export default LoginPage;
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1,12 @@
1
+ import { FC, CSSProperties } from 'react';
2
+ import './style';
3
+ declare const PlatformCard: FC<{
4
+ platform: string | {
5
+ name: string;
6
+ key: string;
7
+ };
8
+ onClick: any;
9
+ className?: any;
10
+ style?: CSSProperties;
11
+ }>;
12
+ export default PlatformCard;
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import './style';
3
+ interface Props {
4
+ platforms: (string | {
5
+ name: string;
6
+ key: string;
7
+ })[];
8
+ currentPlatform: string;
9
+ onChange: (platform: string) => any;
10
+ }
11
+ declare const SwitchPlatform: FC<Props>;
12
+ export default SwitchPlatform;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { TabsProps } from 'antd';
3
+ import './style';
4
+ interface IglooTabsProps extends TabsProps {
5
+ }
6
+ export declare const TabPane: React.FC<import("antd").TabPaneProps>;
7
+ /**
8
+ * Tab
9
+ * @param {*} 所有antd的tabs
10
+ */
11
+ declare function Tabs(props: IglooTabsProps): import("react/jsx-runtime").JSX.Element;
12
+ declare namespace Tabs {
13
+ var TabPane: React.FC<import("antd").TabPaneProps>;
14
+ }
15
+ export default Tabs;
@@ -36,6 +36,7 @@ import { LocaleContext } from "../locale";
36
36
  import Preview from "../upload-preview/media";
37
37
  import { classifyType } from "../utils/tools";
38
38
  import FormContext from "../form-context";
39
+ import { staticFormatMessage } from "../locale";
39
40
  import { jsx as _jsx } from "react/jsx-runtime";
40
41
  import { Fragment as _Fragment } from "react/jsx-runtime";
41
42
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -46,10 +47,14 @@ var IglooUpload = function IglooUpload(props) {
46
47
  var dataUrlRef = useRef([]);
47
48
  var _useContext = useContext(FormContext),
48
49
  uploadApi = _useContext.uploadApi;
50
+ var _useContext2 = useContext(LocaleContext),
51
+ formatMessage = _useContext2.formatMessage;
52
+ var staticMessage = formatMessage({
53
+ id: 'File Uploading'
54
+ });
49
55
  invariant(typeof props.handleUpload === 'function' || uploadApi, '"handleUpload" should be a function. Or uploadApi should be set at Form/FreeForm');
50
56
  invariant(!uploadApi || props.bizKey, '"bizKey" should be set if Upload is used with uploadApi');
51
- var _props$value = props.value,
52
- value = _props$value === void 0 ? [] : _props$value,
57
+ var value = props.value,
53
58
  limit = props.limit,
54
59
  limitErrorMessage = props.limitErrorMessage,
55
60
  descriptions = props.descriptions,
@@ -93,17 +98,7 @@ var IglooUpload = function IglooUpload(props) {
93
98
  containerRef = props.containerRef,
94
99
  placeholder = props.placeholder,
95
100
  rest = _objectWithoutProperties(props, _excluded);
96
- var _useState = useState(value.map(function (url, index) {
97
- return {
98
- url: url,
99
- dataUrl: url,
100
- status: 'success',
101
- type: '',
102
- name: "File".concat(index + 1),
103
- size: 0,
104
- uid: index
105
- };
106
- })),
101
+ var _useState = useState([]),
107
102
  _useState2 = _slicedToArray(_useState, 2),
108
103
  files = _useState2[0],
109
104
  setFiles = _useState2[1];
@@ -128,8 +123,24 @@ var IglooUpload = function IglooUpload(props) {
128
123
  return;
129
124
  }
130
125
  });
131
- var _useContext2 = useContext(LocaleContext),
132
- formatMessage = _useContext2.formatMessage;
126
+
127
+ // 有初始值的处理 (不是初始化)
128
+ useEffect(function () {
129
+ if (Array.isArray(value) && value.length && files.length === 0) {
130
+ var _files = (value || []).map(function (url, index) {
131
+ return {
132
+ url: url,
133
+ dataUrl: url,
134
+ status: 'success',
135
+ type: '',
136
+ name: "File".concat(index + 1),
137
+ size: 0,
138
+ uid: index
139
+ };
140
+ });
141
+ setFiles(_files);
142
+ }
143
+ }, [value]);
133
144
  useEffect(function () {
134
145
  return function () {
135
146
  dataUrlRef.current.forEach(function (dataUrl) {
@@ -138,8 +149,17 @@ var IglooUpload = function IglooUpload(props) {
138
149
  };
139
150
  }, []);
140
151
  useEffect(function () {
141
- if (!(value !== null && value !== void 0 && value.length) && !files.length) return;
152
+ if (!value && !files.length) return;
142
153
  if (files.length) {
154
+ var hasProcessing = files.find(function (f) {
155
+ return f.status === 'progress';
156
+ });
157
+ if (hasProcessing) {
158
+ onChange && onChange({
159
+ status: 'processing'
160
+ });
161
+ return;
162
+ }
143
163
  var urls = files.map(function (f) {
144
164
  var status = f.status,
145
165
  name = f.name,
@@ -150,13 +170,11 @@ var IglooUpload = function IglooUpload(props) {
150
170
  errorMsg: errorMsg
151
171
  };
152
172
  }
153
- if (f.url || f.dataUrl) {
154
- return f.url || f.dataUrl;
155
- }
173
+ return f.url;
156
174
  });
157
175
  onChange && onChange(urls);
158
176
  } else {
159
- onChange && onChange([]);
177
+ onChange && onChange(undefined);
160
178
  }
161
179
  }, [files]);
162
180
  invariant(limit === undefined || limit > 0, "\"limit\" should be a pasitive number.");
@@ -530,6 +548,11 @@ var FileList = function FileList(_ref6) {
530
548
  return /*#__PURE__*/ReactDOM.createPortal(children, containerRef.current);
531
549
  };
532
550
  function checkFileList(value) {
551
+ if ((value === null || value === void 0 ? void 0 : value.status) === 'processing') {
552
+ return Promise.reject(staticFormatMessage({
553
+ id: 'File Uploading'
554
+ }));
555
+ }
533
556
  if (!value) {
534
557
  return Promise.resolve();
535
558
  }
@@ -33,6 +33,7 @@ import Preview from "../upload-preview/media";
33
33
  import { classifyType } from "../utils/tools";
34
34
  import MediaItem from "./media";
35
35
  import FormContext from "../form-context";
36
+ import { staticFormatMessage } from "../locale";
36
37
  import { jsx as _jsx } from "react/jsx-runtime";
37
38
  import { jsxs as _jsxs } from "react/jsx-runtime";
38
39
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -150,6 +151,9 @@ var UploadPhoto = function UploadPhoto(props) {
150
151
  setMasks = _useState6[1];
151
152
  var _useBreakpoint = useBreakpoint(),
152
153
  md = _useBreakpoint.md;
154
+ var staticMessage = formatMessage({
155
+ id: 'Photo Uploading'
156
+ });
153
157
  var mapFilesFromValue = function mapFilesFromValue(urls) {
154
158
  var _files = [];
155
159
  Promise.all(urls.map( /*#__PURE__*/function () {
@@ -194,6 +198,15 @@ var UploadPhoto = function UploadPhoto(props) {
194
198
  useEffect(function () {
195
199
  if (!value && !files.length) return;
196
200
  if (files.length) {
201
+ var hasProcessing = files.find(function (f) {
202
+ return f.status === 'progress';
203
+ });
204
+ if (hasProcessing) {
205
+ onChange && onChange({
206
+ status: 'processing'
207
+ });
208
+ return;
209
+ }
197
210
  var urls = files.map(function (f) {
198
211
  var status = f.status,
199
212
  name = f.name,
@@ -204,13 +217,11 @@ var UploadPhoto = function UploadPhoto(props) {
204
217
  errorMsg: errorMsg
205
218
  };
206
219
  }
207
- if (f.url || f.dataUrl) {
208
- return f.url || f.dataUrl;
209
- }
220
+ return f.url;
210
221
  });
211
222
  onChange && onChange(urls);
212
223
  } else {
213
- onChange && onChange([]);
224
+ onChange && onChange(undefined);
214
225
  }
215
226
  }, [files]);
216
227
  var uploadId = useMemo(function () {
@@ -682,6 +693,11 @@ var UploadPhoto = function UploadPhoto(props) {
682
693
  });
683
694
  };
684
695
  function checkFileList(value) {
696
+ if ((value === null || value === void 0 ? void 0 : value.status) === 'processing') {
697
+ return Promise.reject(staticFormatMessage({
698
+ id: 'Photo Uploading'
699
+ }));
700
+ }
685
701
  if (!value) {
686
702
  return Promise.resolve();
687
703
  }
@@ -300,7 +300,9 @@ export var calcFormItemProps = function calcFormItemProps(config, extraProps, fo
300
300
  try {
301
301
  var fn = eval(code);
302
302
  var formValues = form === null || form === void 0 ? void 0 : form.getFieldsValue(true);
303
- var _result2 = fn(value, formValues);
303
+ var _result2 = fn(value, formValues, {
304
+ moment: moment
305
+ });
304
306
  return _result2 ? Promise.resolve() : Promise.reject(errorMessage);
305
307
  } catch (_unused) {
306
308
  return Promise.reject(errorMessage);
@@ -0,0 +1,3 @@
1
+ import type { DependencyList } from 'react';
2
+ declare function useAsyncEffect(effect: () => AsyncGenerator<void, void, void> | Promise<void>, deps?: DependencyList): void;
3
+ export default useAsyncEffect;
File without changes
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ libraryName: string;
3
+ libraryDirectory: string;
4
+ style: boolean;
5
+ customName: (name: string) => string;
6
+ };
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import './style';
3
+ import { BackTopProps } from 'antd';
4
+ declare const BackToTop: FC<BackTopProps>;
5
+ export default BackToTop;
@@ -193,10 +193,10 @@ PhoneNumber.formItemPropsHandler = function (_ref2) {
193
193
  var initialAreaCode = (initialValue === null || initialValue === void 0 ? void 0 : initialValue.areaCode) || (Array.isArray(areaCode) ? areaCode[0] : areaCode);
194
194
  var initialPhoneNumber = (initialValue === null || initialValue === void 0 ? void 0 : initialValue.phoneNumber) || phoneNumber;
195
195
  return {
196
- initialValue: {
196
+ initialValue: initialPhoneNumber ? {
197
197
  areaCode: initialAreaCode,
198
198
  phoneNumber: initialPhoneNumber
199
- },
199
+ } : undefined,
200
200
  rules: rules,
201
201
  previewFormater: function previewFormater(_ref3) {
202
202
  var areaCode = _ref3.areaCode,
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import './default-input.less';
2
+ import './common.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../index';
2
+ import './index.less';
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "Encrypted PDF",
28
28
  "Enter the password to open this PDF file.": "Enter the password to open this PDF file.",
29
29
  "Error Report": "Error Report",
30
- "Error during the initialization of the SDK! {error}": "Error during the initialization of the SDK! {error}",
31
30
  "Failed to load PDF file.": "Failed to load PDF file.",
31
+ "File Uploading": "File Uploading",
32
32
  "Filter": "Filter",
33
33
  "I agree to the Igloo": "I agree to the Igloo",
34
34
  "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.",
@@ -51,6 +51,7 @@
51
51
  "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.",
52
52
  "Optional": "Optional",
53
53
  "Other Reason": "Other Reason",
54
+ "Photo Uploading": "Photo Uploading",
54
55
  "Please enter a valid date.": "Please enter a valid date.",
55
56
  "Please enter a valid time.": "Please enter a valid time.",
56
57
  "Please input a date after {date}": "Please input a date after {date}",
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "PDF terenkripsi",
28
28
  "Enter the password to open this PDF file.": "Masukkan kata sandi untuk membuka file PDF ini.",
29
29
  "Error Report": "Laporan Kesalahan",
30
- "Error during the initialization of the SDK! {error}": "",
31
30
  "Failed to load PDF file.": "Gagal memuat file PDF.",
31
+ "File Uploading": "Mengunggah Berkas",
32
32
  "Filter": "Saring",
33
33
  "I agree to the Igloo": "Saya setuju dengan Igloo",
34
34
  "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.",
@@ -51,6 +51,7 @@
51
51
  "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.",
52
52
  "Optional": "Pilihan",
53
53
  "Other Reason": "Alasan lain",
54
+ "Photo Uploading": "Mengunggah Foto",
54
55
  "Please enter a valid date.": "Silakan tulis tanggal valid",
55
56
  "Please enter a valid time.": "Harap masukkan waktu yang valid",
56
57
  "Please input a date after {date}": "Harap masukkan tanggal setelah {date}",
@@ -0,0 +1,11 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export declare const locales: {
3
+ [key: string]: {
4
+ [id: string]: string;
5
+ };
6
+ };
7
+ declare const LocaleProvider: FC<{
8
+ currentLang: string;
9
+ children?: ReactNode;
10
+ }>;
11
+ export default LocaleProvider;
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "PDF ที่เข้ารหัส",
28
28
  "Enter the password to open this PDF file.": "ป้อนรหัสผ่านเพื่อเปิดไฟล์ PDF นี้",
29
29
  "Error Report": "รายงานข้อผิดพลาด",
30
- "Error during the initialization of the SDK! {error}": "",
31
30
  "Failed to load PDF file.": "ไม่สามารถโหลดไฟล์ PDF",
31
+ "File Uploading": "การอัพโหลดไฟล์",
32
32
  "Filter": "กรอง",
33
33
  "I agree to the Igloo": "ฉันเห็นด้วยกับกระท่อมน้ำแข็ง",
34
34
  "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.": "ข้าพเจ้ายืนยันว่าข้อความที่ข้าพเจ้าได้อธิบายข้างต้นนั้นเป็นความจริง และยืนยันว่าความเสียหายที่เกิดขึ้นนั้นเกิดจากอุบัติเหตุ ปราศจากการวางแผน หรือ การเห็นพ้องร่วมกันกับฝ่ายอื่น",
@@ -51,6 +51,7 @@
51
51
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "หากตรวจสอบแล้วและต้องการยืนยันข้อมูลข้างต้น กรุณากดดำเนินการต่อและยืนยันการเคลมของคุณ",
52
52
  "Optional": "ไม่จำเป็น",
53
53
  "Other Reason": "เหตุผลอื่น",
54
+ "Photo Uploading": "การอัพโหลดรูปภาพ",
54
55
  "Please enter a valid date.": "กรุณากรอกวันที่ถูกต้อง",
55
56
  "Please enter a valid time.": "กรุณากรอกเวลาที่ถูกต้อง",
56
57
  "Please input a date after {date}": "กรุณาใส่วันที่หลัง {date}",
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "PDF được mã hóa",
28
28
  "Enter the password to open this PDF file.": "Nhập mật khẩu để mở tệp PDF này.",
29
29
  "Error Report": "Báo cáo lỗi",
30
- "Error during the initialization of the SDK! {error}": "",
31
30
  "Failed to load PDF file.": "Không tải được tệp PDF.",
31
+ "File Uploading": "Tải lên tệp",
32
32
  "Filter": "Lọc",
33
33
  "I agree to the Igloo": "Tôi đồng ý với Igloo",
34
34
  "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.",
@@ -51,6 +51,7 @@
51
51
  "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.",
52
52
  "Optional": "Không bắt buộc",
53
53
  "Other Reason": "Lý do khác",
54
+ "Photo Uploading": "Tải ảnh lên",
54
55
  "Please enter a valid date.": "Vui lòng nhập đúng ngày:",
55
56
  "Please enter a valid time.": "Vui lòng nhập thời gian hợp lệ.",
56
57
  "Please input a date after {date}": "Vui lòng nhập ngày sau {date}",
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "加密的PDF文件",
28
28
  "Enter the password to open this PDF file.": "输入密码后预览该文件",
29
29
  "Error Report": "错误报告",
30
- "Error during the initialization of the SDK! {error}": "",
31
30
  "Failed to load PDF file.": "PDF文件加载失败",
31
+ "File Uploading": "文件上传中",
32
32
  "Filter": "过滤条件",
33
33
  "I agree to the Igloo": "我同意Igloo",
34
34
  "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.": "我承诺上述信息均真实有效,并且物品遗失纯属意外。",
@@ -51,6 +51,7 @@
51
51
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "如您对上述填写内容满意,在勾选以下申明后,请继续提交您的理赔申请。",
52
52
  "Optional": "可选",
53
53
  "Other Reason": "其他原因",
54
+ "Photo Uploading": "图片上传中",
54
55
  "Please enter a valid date.": "请输入一个有效的日期。",
55
56
  "Please enter a valid time.": "请输入一个有效的时间。",
56
57
  "Please input a date after {date}": "请输入一个{date}之后的日期",
@@ -27,8 +27,8 @@
27
27
  "Encrypted PDF": "",
28
28
  "Enter the password to open this PDF file.": "",
29
29
  "Error Report": "錯誤報告",
30
- "Error during the initialization of the SDK! {error}": "",
31
30
  "Failed to load PDF file.": "",
31
+ "File Uploading": "",
32
32
  "Filter": "篩選",
33
33
  "I agree to the Igloo": "",
34
34
  "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.": "我聲明我上面描述的陳述是真的。我進一步宣布發生損失是偶然的,沒有規劃或與其他方的共識。",
@@ -51,6 +51,7 @@
51
51
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "一旦您對上述內容感到滿意,您已檢查聲明,請繼續並提交您的索賠。",
52
52
  "Optional": "可選項",
53
53
  "Other Reason": "其他原因",
54
+ "Photo Uploading": "",
54
55
  "Please enter a valid date.": "請輸入有效的日期。",
55
56
  "Please enter a valid time.": "請輸入有效的時間。",
56
57
  "Please input a date after {date}": "",
@@ -0,0 +1,7 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import './style';
3
+ interface Props {
4
+ showAppStore?: boolean;
5
+ }
6
+ declare const LoginPage: FC<PropsWithChildren<Props>>;
7
+ export default LoginPage;
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1,12 @@
1
+ import { FC, CSSProperties } from 'react';
2
+ import './style';
3
+ declare const PlatformCard: FC<{
4
+ platform: string | {
5
+ name: string;
6
+ key: string;
7
+ };
8
+ onClick: any;
9
+ className?: any;
10
+ style?: CSSProperties;
11
+ }>;
12
+ export default PlatformCard;
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import './style';
3
+ interface Props {
4
+ platforms: (string | {
5
+ name: string;
6
+ key: string;
7
+ })[];
8
+ currentPlatform: string;
9
+ onChange: (platform: string) => any;
10
+ }
11
+ declare const SwitchPlatform: FC<Props>;
12
+ export default SwitchPlatform;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { TabsProps } from 'antd';
3
+ import './style';
4
+ interface IglooTabsProps extends TabsProps {
5
+ }
6
+ export declare const TabPane: React.FC<import("antd").TabPaneProps>;
7
+ /**
8
+ * Tab
9
+ * @param {*} 所有antd的tabs
10
+ */
11
+ declare function Tabs(props: IglooTabsProps): import("react/jsx-runtime").JSX.Element;
12
+ declare namespace Tabs {
13
+ var TabPane: React.FC<import("antd").TabPaneProps>;
14
+ }
15
+ export default Tabs;
@@ -50,10 +50,14 @@ var IglooUpload = function IglooUpload(props) {
50
50
  var dataUrlRef = (0, _react.useRef)([]);
51
51
  var _useContext = (0, _react.useContext)(_formContext.default),
52
52
  uploadApi = _useContext.uploadApi;
53
+ var _useContext2 = (0, _react.useContext)(_locale.LocaleContext),
54
+ formatMessage = _useContext2.formatMessage;
55
+ var staticMessage = formatMessage({
56
+ id: 'File Uploading'
57
+ });
53
58
  (0, _invariant.default)(typeof props.handleUpload === 'function' || uploadApi, '"handleUpload" should be a function. Or uploadApi should be set at Form/FreeForm');
54
59
  (0, _invariant.default)(!uploadApi || props.bizKey, '"bizKey" should be set if Upload is used with uploadApi');
55
- var _props$value = props.value,
56
- value = _props$value === void 0 ? [] : _props$value,
60
+ var value = props.value,
57
61
  limit = props.limit,
58
62
  limitErrorMessage = props.limitErrorMessage,
59
63
  descriptions = props.descriptions,
@@ -97,17 +101,7 @@ var IglooUpload = function IglooUpload(props) {
97
101
  containerRef = props.containerRef,
98
102
  placeholder = props.placeholder,
99
103
  rest = _objectWithoutProperties(props, _excluded);
100
- var _useState = (0, _react.useState)(value.map(function (url, index) {
101
- return {
102
- url: url,
103
- dataUrl: url,
104
- status: 'success',
105
- type: '',
106
- name: "File".concat(index + 1),
107
- size: 0,
108
- uid: index
109
- };
110
- })),
104
+ var _useState = (0, _react.useState)([]),
111
105
  _useState2 = _slicedToArray(_useState, 2),
112
106
  files = _useState2[0],
113
107
  setFiles = _useState2[1];
@@ -132,8 +126,24 @@ var IglooUpload = function IglooUpload(props) {
132
126
  return;
133
127
  }
134
128
  });
135
- var _useContext2 = (0, _react.useContext)(_locale.LocaleContext),
136
- formatMessage = _useContext2.formatMessage;
129
+
130
+ // 有初始值的处理 (不是初始化)
131
+ (0, _react.useEffect)(function () {
132
+ if (Array.isArray(value) && value.length && files.length === 0) {
133
+ var _files = (value || []).map(function (url, index) {
134
+ return {
135
+ url: url,
136
+ dataUrl: url,
137
+ status: 'success',
138
+ type: '',
139
+ name: "File".concat(index + 1),
140
+ size: 0,
141
+ uid: index
142
+ };
143
+ });
144
+ setFiles(_files);
145
+ }
146
+ }, [value]);
137
147
  (0, _react.useEffect)(function () {
138
148
  return function () {
139
149
  dataUrlRef.current.forEach(function (dataUrl) {
@@ -142,8 +152,17 @@ var IglooUpload = function IglooUpload(props) {
142
152
  };
143
153
  }, []);
144
154
  (0, _react.useEffect)(function () {
145
- if (!(value !== null && value !== void 0 && value.length) && !files.length) return;
155
+ if (!value && !files.length) return;
146
156
  if (files.length) {
157
+ var hasProcessing = files.find(function (f) {
158
+ return f.status === 'progress';
159
+ });
160
+ if (hasProcessing) {
161
+ onChange && onChange({
162
+ status: 'processing'
163
+ });
164
+ return;
165
+ }
147
166
  var urls = files.map(function (f) {
148
167
  var status = f.status,
149
168
  name = f.name,
@@ -154,13 +173,11 @@ var IglooUpload = function IglooUpload(props) {
154
173
  errorMsg: errorMsg
155
174
  };
156
175
  }
157
- if (f.url || f.dataUrl) {
158
- return f.url || f.dataUrl;
159
- }
176
+ return f.url;
160
177
  });
161
178
  onChange && onChange(urls);
162
179
  } else {
163
- onChange && onChange([]);
180
+ onChange && onChange(undefined);
164
181
  }
165
182
  }, [files]);
166
183
  (0, _invariant.default)(limit === undefined || limit > 0, "\"limit\" should be a pasitive number.");
@@ -534,6 +551,11 @@ var FileList = function FileList(_ref6) {
534
551
  return /*#__PURE__*/_reactDom.default.createPortal(children, containerRef.current);
535
552
  };
536
553
  function checkFileList(value) {
554
+ if ((value === null || value === void 0 ? void 0 : value.status) === 'processing') {
555
+ return Promise.reject((0, _locale.staticFormatMessage)({
556
+ id: 'File Uploading'
557
+ }));
558
+ }
537
559
  if (!value) {
538
560
  return Promise.resolve();
539
561
  }
@@ -155,6 +155,9 @@ var UploadPhoto = function UploadPhoto(props) {
155
155
  setMasks = _useState6[1];
156
156
  var _useBreakpoint = useBreakpoint(),
157
157
  md = _useBreakpoint.md;
158
+ var staticMessage = formatMessage({
159
+ id: 'Photo Uploading'
160
+ });
158
161
  var mapFilesFromValue = function mapFilesFromValue(urls) {
159
162
  var _files = [];
160
163
  Promise.all(urls.map( /*#__PURE__*/function () {
@@ -199,6 +202,15 @@ var UploadPhoto = function UploadPhoto(props) {
199
202
  (0, _react.useEffect)(function () {
200
203
  if (!value && !files.length) return;
201
204
  if (files.length) {
205
+ var hasProcessing = files.find(function (f) {
206
+ return f.status === 'progress';
207
+ });
208
+ if (hasProcessing) {
209
+ onChange && onChange({
210
+ status: 'processing'
211
+ });
212
+ return;
213
+ }
202
214
  var urls = files.map(function (f) {
203
215
  var status = f.status,
204
216
  name = f.name,
@@ -209,13 +221,11 @@ var UploadPhoto = function UploadPhoto(props) {
209
221
  errorMsg: errorMsg
210
222
  };
211
223
  }
212
- if (f.url || f.dataUrl) {
213
- return f.url || f.dataUrl;
214
- }
224
+ return f.url;
215
225
  });
216
226
  onChange && onChange(urls);
217
227
  } else {
218
- onChange && onChange([]);
228
+ onChange && onChange(undefined);
219
229
  }
220
230
  }, [files]);
221
231
  var uploadId = (0, _react.useMemo)(function () {
@@ -687,6 +697,11 @@ var UploadPhoto = function UploadPhoto(props) {
687
697
  });
688
698
  };
689
699
  function checkFileList(value) {
700
+ if ((value === null || value === void 0 ? void 0 : value.status) === 'processing') {
701
+ return Promise.reject((0, _locale.staticFormatMessage)({
702
+ id: 'Photo Uploading'
703
+ }));
704
+ }
690
705
  if (!value) {
691
706
  return Promise.resolve();
692
707
  }
@@ -308,7 +308,9 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
308
308
  try {
309
309
  var fn = eval(code);
310
310
  var formValues = form === null || form === void 0 ? void 0 : form.getFieldsValue(true);
311
- var _result2 = fn(value, formValues);
311
+ var _result2 = fn(value, formValues, {
312
+ moment: _dayjs.default
313
+ });
312
314
  return _result2 ? Promise.resolve() : Promise.reject(errorMessage);
313
315
  } catch (_unused) {
314
316
  return Promise.reject(errorMessage);
@@ -0,0 +1,3 @@
1
+ import type { DependencyList } from 'react';
2
+ declare function useAsyncEffect(effect: () => AsyncGenerator<void, void, void> | Promise<void>, deps?: DependencyList): void;
3
+ export default useAsyncEffect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",