iglooform 4.0.0-alpha.1 → 4.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.dumirc.ts CHANGED
@@ -1,4 +1,3 @@
1
- import os from 'node:os';
2
1
  import { defineConfig } from 'dumi';
3
2
  import theme, { colors, token, components } from 'iglootheme';
4
3
 
@@ -23,7 +22,9 @@ export default defineConfig({
23
22
  lessLoader: {
24
23
  modifyVars: theme,
25
24
  },
26
- mako: ['Darwin', 'Linux'].includes(os.type()) ? {} : false,
25
+ chainWebpack: (memo) => {
26
+ memo.module.rule('font').test(/\.otf/).set('type', 'asset/inline');
27
+ },
27
28
  plugins: ['@umijs/plugins/dist/antd'],
28
29
  antd: {
29
30
  theme: {
@@ -16,7 +16,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
16
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
18
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
19
- import { useState } from 'react';
19
+ import { useMemo, useState } from 'react';
20
20
  import { DatePicker } from 'antd';
21
21
  import omit from 'omit.js';
22
22
  import moment from 'dayjs';
@@ -87,6 +87,7 @@ IglooDatePicker.formItemPropsHandler = function (_ref2) {
87
87
  };
88
88
  export default IglooDatePicker;
89
89
  export var IglooRangePicker = function IglooRangePicker(_ref3) {
90
+ var _value$0$valueOf, _value$, _value$$valueOf, _value$1$valueOf, _value$2, _value$2$valueOf;
90
91
  var value = _ref3.value,
91
92
  format = _ref3.format,
92
93
  _ref3$suffixIcon = _ref3.suffixIcon,
@@ -102,8 +103,12 @@ export var IglooRangePicker = function IglooRangePicker(_ref3) {
102
103
  _useState4 = _slicedToArray(_useState3, 2),
103
104
  focusStaus = _useState4[0],
104
105
  setFocus = _useState4[1];
106
+ var memoizedValue = useMemo(function () {
107
+ if (!value) return value;
108
+ return [moment(value[0]), moment(value[1])];
109
+ }, [(_value$0$valueOf = value === null || value === void 0 || (_value$ = value[0]) === null || _value$ === void 0 || (_value$$valueOf = _value$.valueOf) === null || _value$$valueOf === void 0 ? void 0 : _value$$valueOf.call(_value$)) !== null && _value$0$valueOf !== void 0 ? _value$0$valueOf : value === null || value === void 0 ? void 0 : value[0], (_value$1$valueOf = value === null || value === void 0 || (_value$2 = value[1]) === null || _value$2 === void 0 || (_value$2$valueOf = _value$2.valueOf) === null || _value$2$valueOf === void 0 ? void 0 : _value$2$valueOf.call(_value$2)) !== null && _value$1$valueOf !== void 0 ? _value$1$valueOf : value === null || value === void 0 ? void 0 : value[1]]);
105
110
  return /*#__PURE__*/_jsx(RangePicker, _objectSpread(_objectSpread({}, omit(props, formMethods)), {}, {
106
- value: value ? [moment(value[0]), moment(value[1])] : value,
111
+ value: memoizedValue,
107
112
  format: format || dateFormater,
108
113
  inputReadOnly: true,
109
114
  suffixIcon: suffixIcon,
@@ -14,8 +14,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
14
14
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
15
15
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
16
16
  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; }
17
- import React, { useReducer, useContext, useCallback } from 'react';
18
- import { Col, Divider, Row, Grid } from 'antd';
17
+ import React, { useReducer, useContext, useCallback, useEffect } from 'react';
18
+ import { Col, Divider, Row, Grid, Form } from 'antd';
19
19
  import Element from "../element";
20
20
  import FormContext from "../../form-context";
21
21
  import { calcNamePath, calcFormItemProps, calcAddableSectionAssertField } from "../../utils/form-utils";
@@ -66,6 +66,21 @@ var AddableSection = function AddableSection(_ref) {
66
66
  if (action.type === 'add') {
67
67
  return [].concat(_toConsumableArray(state), [action.key]);
68
68
  }
69
+ if (action.type === 'sync' && action.count !== undefined) {
70
+ var targetCount = Math.min(max, Math.max(min, action.count, initCount));
71
+ if (targetCount === state.length) {
72
+ return state;
73
+ }
74
+ if (targetCount > state.length) {
75
+ var newKeys = [];
76
+ for (var i = state.length; i < targetCount; i++) {
77
+ newKeys.push(Date.now() + Math.random());
78
+ }
79
+ return [].concat(_toConsumableArray(state), newKeys);
80
+ }
81
+ // targetCount < state.length
82
+ return state.slice(0, targetCount);
83
+ }
69
84
  var found = false;
70
85
  return state.filter(function (key, index) {
71
86
  if (key === action.key) {
@@ -86,7 +101,7 @@ var AddableSection = function AddableSection(_ref) {
86
101
  }
87
102
  return key !== action.key;
88
103
  });
89
- }, []);
104
+ }, [min, max, initCount]);
90
105
  var _useReducer = useReducer(reducer, function () {
91
106
  var init = [];
92
107
  var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
@@ -98,6 +113,18 @@ var AddableSection = function AddableSection(_ref) {
98
113
  _useReducer2 = _slicedToArray(_useReducer, 2),
99
114
  groupKeys = _useReducer2[0],
100
115
  dispath = _useReducer2[1];
116
+
117
+ // 监听外部通过 form.setFieldsValue 设置的值变化
118
+ Form.useWatch(namePath, form);
119
+ var fieldValue = form === null || form === void 0 ? void 0 : form.getFieldValue(namePath);
120
+ useEffect(function () {
121
+ if (Array.isArray(fieldValue)) {
122
+ dispath({
123
+ type: 'sync',
124
+ count: fieldValue.length
125
+ });
126
+ }
127
+ }, [fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.length]);
101
128
  var _calcFormItemProps = calcFormItemProps(config, {
102
129
  requiredMark: requiredMark
103
130
  }, form, parentName, validationCodeExtraParams),
@@ -182,6 +209,23 @@ var AddableSection = function AddableSection(_ref) {
182
209
  return calcAddableSectionAssertField(namePath, path, index, elements);
183
210
  });
184
211
  }
212
+ if (child.copyValue) {
213
+ _child.copyValue = _objectSpread(_objectSpread({}, child.copyValue), {}, {
214
+ assert: _objectSpread(_objectSpread({}, child.copyValue.assert), {}, {
215
+ field: calcAddableSectionAssertField(namePath, child.copyValue.assert.field, index, elements)
216
+ }),
217
+ copyFrom: calcAddableSectionAssertField(namePath, child.copyValue.copyFrom, index, elements)
218
+ });
219
+ }
220
+ if (Array.isArray(child.selectValue)) {
221
+ _child.selectValue = child.selectValue.map(function (sv) {
222
+ return _objectSpread(_objectSpread({}, sv), {}, {
223
+ assert: _objectSpread(_objectSpread({}, sv.assert), {}, {
224
+ field: calcAddableSectionAssertField(namePath, sv.assert.field, index, elements)
225
+ })
226
+ });
227
+ });
228
+ }
185
229
  return /*#__PURE__*/_jsx(Element, {
186
230
  parentName: parentName,
187
231
  config: _child,
@@ -15,7 +15,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
15
15
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  import React, { useReducer, useContext, useEffect, useCallback, cloneElement, isValidElement } from 'react';
18
- import { Col, Row } from 'antd';
18
+ import { Col, Row, Form } from 'antd';
19
19
  import FormContext from "../../form-context";
20
20
  import { calcNamePath, calcFormItemProps, calcAddableSectionAssertField } from "../../utils/form-utils";
21
21
  import Typography from "../../typography";
@@ -68,6 +68,21 @@ var AddableSection = function AddableSection(props) {
68
68
  if (action.type === 'add') {
69
69
  return [].concat(_toConsumableArray(state), [action.key]);
70
70
  }
71
+ if (action.type === 'sync' && action.count !== undefined) {
72
+ var targetCount = Math.min(max, Math.max(min, action.count, initCount));
73
+ if (targetCount === state.length) {
74
+ return state;
75
+ }
76
+ if (targetCount > state.length) {
77
+ var newKeys = [];
78
+ for (var i = state.length; i < targetCount; i++) {
79
+ newKeys.push(Date.now() + Math.random());
80
+ }
81
+ return [].concat(_toConsumableArray(state), newKeys);
82
+ }
83
+ // targetCount < state.length
84
+ return state.slice(0, targetCount);
85
+ }
71
86
  var found = false;
72
87
  return state.filter(function (key, index) {
73
88
  if (key === action.key) {
@@ -88,7 +103,7 @@ var AddableSection = function AddableSection(props) {
88
103
  }
89
104
  return key !== action.key;
90
105
  });
91
- }, []);
106
+ }, [min, max, initCount]);
92
107
  var _useReducer3 = useReducer(reducer, function () {
93
108
  var init = [];
94
109
  var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
@@ -100,6 +115,18 @@ var AddableSection = function AddableSection(props) {
100
115
  _useReducer4 = _slicedToArray(_useReducer3, 2),
101
116
  groupKeys = _useReducer4[0],
102
117
  dispath = _useReducer4[1];
118
+
119
+ // 监听外部通过 form.setFieldsValue 设置的值变化
120
+ Form.useWatch(namePath, form);
121
+ var fieldValue = form === null || form === void 0 ? void 0 : form.getFieldValue(namePath);
122
+ useEffect(function () {
123
+ if (Array.isArray(fieldValue)) {
124
+ dispath({
125
+ type: 'sync',
126
+ count: fieldValue.length
127
+ });
128
+ }
129
+ }, [fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.length]);
103
130
  useEffect(function () {
104
131
  var dependencies = props.dependencies,
105
132
  asserts = props.asserts,
@@ -191,6 +218,23 @@ var AddableSection = function AddableSection(props) {
191
218
  return calcAddableSectionAssertField(namePath, path, index, children);
192
219
  });
193
220
  }
221
+ if (_child.copyValue) {
222
+ _child.copyValue = _objectSpread(_objectSpread({}, _child.copyValue), {}, {
223
+ assert: _objectSpread(_objectSpread({}, _child.copyValue.assert), {}, {
224
+ field: calcAddableSectionAssertField(namePath, _child.copyValue.assert.field, index, children)
225
+ }),
226
+ copyFrom: calcAddableSectionAssertField(namePath, _child.copyValue.copyFrom, index, children)
227
+ });
228
+ }
229
+ if (Array.isArray(_child.selectValue)) {
230
+ _child.selectValue = _child.selectValue.map(function (sv) {
231
+ return _objectSpread(_objectSpread({}, sv), {}, {
232
+ assert: _objectSpread(_objectSpread({}, sv.assert), {}, {
233
+ field: calcAddableSectionAssertField(namePath, sv.assert.field, index, children)
234
+ })
235
+ });
236
+ });
237
+ }
194
238
  if (['Igloo_Free_Form_Item', 'Igloo_Free_Form_Section', 'Igloo_Free_Form_AddableSection'].includes(c === null || c === void 0 || (_c$type = c.type) === null || _c$type === void 0 ? void 0 : _c$type.displayName)) {
195
239
  return /*#__PURE__*/cloneElement(c, _objectSpread(_objectSpread({
196
240
  key: _index
@@ -236,6 +280,23 @@ var AddableSection = function AddableSection(props) {
236
280
  return calcAddableSectionAssertField(namePath, path, index, [children]);
237
281
  });
238
282
  }
283
+ if (_child.copyValue) {
284
+ _child.copyValue = _objectSpread(_objectSpread({}, _child.copyValue), {}, {
285
+ assert: _objectSpread(_objectSpread({}, _child.copyValue.assert), {}, {
286
+ field: calcAddableSectionAssertField(namePath, _child.copyValue.assert.field, index, [children])
287
+ }),
288
+ copyFrom: calcAddableSectionAssertField(namePath, _child.copyValue.copyFrom, index, [children])
289
+ });
290
+ }
291
+ if (Array.isArray(_child.selectValue)) {
292
+ _child.selectValue = _child.selectValue.map(function (sv) {
293
+ return _objectSpread(_objectSpread({}, sv), {}, {
294
+ assert: _objectSpread(_objectSpread({}, sv.assert), {}, {
295
+ field: calcAddableSectionAssertField(namePath, sv.assert.field, index, [children])
296
+ })
297
+ });
298
+ });
299
+ }
239
300
  return /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread({}, _child), {}, {
240
301
  // @ts-ignore
241
302
  parentName: parentName,
package/es/media/media.js CHANGED
@@ -5,15 +5,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React, { useRef, useState, useContext } from 'react';
8
- import { Document, Page } from 'react-pdf';
8
+ import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
9
9
  import { Tooltip } from 'antd';
10
10
  import { LocaleContext } from "../locale";
11
11
  import { LoadingOutlined } from 'iglooicon';
12
- import { addPdfjsWorker } from "../utils/tools";
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
13
  import { Fragment as _Fragment } from "react/jsx-runtime";
15
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
- addPdfjsWorker();
17
15
  var Loading = function Loading() {
18
16
  return /*#__PURE__*/_jsx("div", {
19
17
  style: {
@@ -11,7 +11,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
11
11
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import React, { useState, useRef, useContext, useReducer } from 'react';
14
- import { Document, Page } from 'react-pdf';
14
+ import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
15
15
  import classnames from 'classnames';
16
16
  import { ArrowLeftOutlined, ArrowRightOutlined } from 'iglooicon';
17
17
  import { Grid, message } from 'antd';
@@ -21,11 +21,9 @@ import Modal from "../modal";
21
21
  import Password from "../input/password";
22
22
  import Button from "../button";
23
23
  import { LocaleContext } from "../locale";
24
- import { addPdfjsWorker } from "../utils/tools";
25
24
  import { jsx as _jsx } from "react/jsx-runtime";
26
25
  import { jsxs as _jsxs } from "react/jsx-runtime";
27
26
  import { Fragment as _Fragment } from "react/jsx-runtime";
28
- addPdfjsWorker();
29
27
  var useBreakpoint = Grid.useBreakpoint;
30
28
  var PasswordResponses = {
31
29
  NEED_PASSWORD: 1,
@@ -177,19 +177,16 @@
177
177
  }
178
178
 
179
179
  .ant-modal-root .igloo-modal {
180
- @media screen and (width >= 1200px) {
180
+ @media screen and (min-width: 1200px) {
181
181
  width: 760px;
182
182
  }
183
-
184
- @media screen and (992px <= width < 1200px) {
183
+ @media screen and (min-width: 992px) and (max-width: 1200px) {
185
184
  width: 660px;
186
185
  }
187
-
188
- @media screen and (768px <= width < 992px) {
186
+ @media screen and (min-width: 768px) and (max-width: 992px) {
189
187
  width: 512px;
190
188
  }
191
-
192
- @media screen and (width < 768px) {
189
+ @media screen and (max-width: 768px) {
193
190
  width: calc(~'100%' - 32px);
194
191
  }
195
192
  }
@@ -5,11 +5,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React, { useState, useContext } from 'react';
8
- import { Document, Page } from 'react-pdf';
8
+ import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
9
9
  import { LocaleContext } from "../locale";
10
- import { addPdfjsWorker } from "../utils/tools";
11
10
  import { jsx as _jsx } from "react/jsx-runtime";
12
- addPdfjsWorker();
13
11
  var MediaItem = function MediaItem(_ref) {
14
12
  var type = _ref.type,
15
13
  src = _ref.src,
@@ -7,17 +7,15 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { useState, useContext, useReducer, useRef } from 'react';
8
8
  import { Grid, message } from 'antd';
9
9
  import Typography from "../typography";
10
- import { Document, Page } from 'react-pdf';
10
+ import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
11
11
  import { ErrorFilled } from 'iglooicon';
12
12
  import LocaleContext from "../locale/locale-context";
13
13
  import Modal from "../modal";
14
14
  import Password from "../input/password";
15
15
  import Button from "../button";
16
16
  import classNames from 'classnames';
17
- import { addPdfjsWorker } from "../utils/tools";
18
17
  import { jsx as _jsx } from "react/jsx-runtime";
19
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
20
- addPdfjsWorker();
21
19
  var useBreakpoint = Grid.useBreakpoint;
22
20
  var PasswordResponses = {
23
21
  NEED_PASSWORD: 1,
@@ -3,4 +3,3 @@ export declare function classifyType(mimeType: string): string;
3
3
  export declare const downloadByUrl: (filename: string, url: string) => void;
4
4
  export declare const getFileNameByUrl: (fileUrl: string) => string;
5
5
  export declare const getResourceContentType: (resourceUrl: string) => Promise<string | undefined>;
6
- export declare const addPdfjsWorker: () => void;
package/es/utils/tools.js CHANGED
@@ -87,10 +87,4 @@ export var getResourceContentType = /*#__PURE__*/function () {
87
87
  return function getResourceContentType(_x) {
88
88
  return _ref.apply(this, arguments);
89
89
  };
90
- }();
91
- export var addPdfjsWorker = function addPdfjsWorker() {
92
- import('react-pdf').then(function (_ref2) {
93
- var pdfjs = _ref2.pdfjs;
94
- pdfjs.GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/legacy/build/pdf.worker.min.js', import.meta.url).toString();
95
- });
96
- };
90
+ }();
@@ -100,6 +100,7 @@ IglooDatePicker.formItemPropsHandler = function (_ref2) {
100
100
  };
101
101
  var _default = exports.default = IglooDatePicker;
102
102
  var IglooRangePicker = exports.IglooRangePicker = function IglooRangePicker(_ref3) {
103
+ var _value$0$valueOf, _value$, _value$$valueOf, _value$1$valueOf, _value$2, _value$2$valueOf;
103
104
  var value = _ref3.value,
104
105
  format = _ref3.format,
105
106
  _ref3$suffixIcon = _ref3.suffixIcon,
@@ -115,8 +116,12 @@ var IglooRangePicker = exports.IglooRangePicker = function IglooRangePicker(_ref
115
116
  _useState4 = _slicedToArray(_useState3, 2),
116
117
  focusStaus = _useState4[0],
117
118
  setFocus = _useState4[1];
119
+ var memoizedValue = (0, _react.useMemo)(function () {
120
+ if (!value) return value;
121
+ return [(0, _dayjs.default)(value[0]), (0, _dayjs.default)(value[1])];
122
+ }, [(_value$0$valueOf = value === null || value === void 0 || (_value$ = value[0]) === null || _value$ === void 0 || (_value$$valueOf = _value$.valueOf) === null || _value$$valueOf === void 0 ? void 0 : _value$$valueOf.call(_value$)) !== null && _value$0$valueOf !== void 0 ? _value$0$valueOf : value === null || value === void 0 ? void 0 : value[0], (_value$1$valueOf = value === null || value === void 0 || (_value$2 = value[1]) === null || _value$2 === void 0 || (_value$2$valueOf = _value$2.valueOf) === null || _value$2$valueOf === void 0 ? void 0 : _value$2$valueOf.call(_value$2)) !== null && _value$1$valueOf !== void 0 ? _value$1$valueOf : value === null || value === void 0 ? void 0 : value[1]]);
118
123
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(RangePicker, _objectSpread(_objectSpread({}, (0, _omit.default)(props, _formMethods.default)), {}, {
119
- value: value ? [(0, _dayjs.default)(value[0]), (0, _dayjs.default)(value[1])] : value,
124
+ value: memoizedValue,
120
125
  format: format || dateFormater,
121
126
  inputReadOnly: true,
122
127
  suffixIcon: suffixIcon,
@@ -74,6 +74,21 @@ var AddableSection = function AddableSection(_ref) {
74
74
  if (action.type === 'add') {
75
75
  return [].concat(_toConsumableArray(state), [action.key]);
76
76
  }
77
+ if (action.type === 'sync' && action.count !== undefined) {
78
+ var targetCount = Math.min(max, Math.max(min, action.count, initCount));
79
+ if (targetCount === state.length) {
80
+ return state;
81
+ }
82
+ if (targetCount > state.length) {
83
+ var newKeys = [];
84
+ for (var i = state.length; i < targetCount; i++) {
85
+ newKeys.push(Date.now() + Math.random());
86
+ }
87
+ return [].concat(_toConsumableArray(state), newKeys);
88
+ }
89
+ // targetCount < state.length
90
+ return state.slice(0, targetCount);
91
+ }
77
92
  var found = false;
78
93
  return state.filter(function (key, index) {
79
94
  if (key === action.key) {
@@ -94,7 +109,7 @@ var AddableSection = function AddableSection(_ref) {
94
109
  }
95
110
  return key !== action.key;
96
111
  });
97
- }, []);
112
+ }, [min, max, initCount]);
98
113
  var _useReducer = (0, _react.useReducer)(reducer, function () {
99
114
  var init = [];
100
115
  var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
@@ -106,6 +121,18 @@ var AddableSection = function AddableSection(_ref) {
106
121
  _useReducer2 = _slicedToArray(_useReducer, 2),
107
122
  groupKeys = _useReducer2[0],
108
123
  dispath = _useReducer2[1];
124
+
125
+ // 监听外部通过 form.setFieldsValue 设置的值变化
126
+ _antd.Form.useWatch(namePath, form);
127
+ var fieldValue = form === null || form === void 0 ? void 0 : form.getFieldValue(namePath);
128
+ (0, _react.useEffect)(function () {
129
+ if (Array.isArray(fieldValue)) {
130
+ dispath({
131
+ type: 'sync',
132
+ count: fieldValue.length
133
+ });
134
+ }
135
+ }, [fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.length]);
109
136
  var _calcFormItemProps = (0, _formUtils.calcFormItemProps)(config, {
110
137
  requiredMark: requiredMark
111
138
  }, form, parentName, validationCodeExtraParams),
@@ -190,6 +217,23 @@ var AddableSection = function AddableSection(_ref) {
190
217
  return (0, _formUtils.calcAddableSectionAssertField)(namePath, path, index, elements);
191
218
  });
192
219
  }
220
+ if (child.copyValue) {
221
+ _child.copyValue = _objectSpread(_objectSpread({}, child.copyValue), {}, {
222
+ assert: _objectSpread(_objectSpread({}, child.copyValue.assert), {}, {
223
+ field: (0, _formUtils.calcAddableSectionAssertField)(namePath, child.copyValue.assert.field, index, elements)
224
+ }),
225
+ copyFrom: (0, _formUtils.calcAddableSectionAssertField)(namePath, child.copyValue.copyFrom, index, elements)
226
+ });
227
+ }
228
+ if (Array.isArray(child.selectValue)) {
229
+ _child.selectValue = child.selectValue.map(function (sv) {
230
+ return _objectSpread(_objectSpread({}, sv), {}, {
231
+ assert: _objectSpread(_objectSpread({}, sv.assert), {}, {
232
+ field: (0, _formUtils.calcAddableSectionAssertField)(namePath, sv.assert.field, index, elements)
233
+ })
234
+ });
235
+ });
236
+ }
193
237
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_element.default, {
194
238
  parentName: parentName,
195
239
  config: _child,
@@ -75,6 +75,21 @@ var AddableSection = function AddableSection(props) {
75
75
  if (action.type === 'add') {
76
76
  return [].concat(_toConsumableArray(state), [action.key]);
77
77
  }
78
+ if (action.type === 'sync' && action.count !== undefined) {
79
+ var targetCount = Math.min(max, Math.max(min, action.count, initCount));
80
+ if (targetCount === state.length) {
81
+ return state;
82
+ }
83
+ if (targetCount > state.length) {
84
+ var newKeys = [];
85
+ for (var i = state.length; i < targetCount; i++) {
86
+ newKeys.push(Date.now() + Math.random());
87
+ }
88
+ return [].concat(_toConsumableArray(state), newKeys);
89
+ }
90
+ // targetCount < state.length
91
+ return state.slice(0, targetCount);
92
+ }
78
93
  var found = false;
79
94
  return state.filter(function (key, index) {
80
95
  if (key === action.key) {
@@ -95,7 +110,7 @@ var AddableSection = function AddableSection(props) {
95
110
  }
96
111
  return key !== action.key;
97
112
  });
98
- }, []);
113
+ }, [min, max, initCount]);
99
114
  var _useReducer3 = (0, _react.useReducer)(reducer, function () {
100
115
  var init = [];
101
116
  var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
@@ -107,6 +122,18 @@ var AddableSection = function AddableSection(props) {
107
122
  _useReducer4 = _slicedToArray(_useReducer3, 2),
108
123
  groupKeys = _useReducer4[0],
109
124
  dispath = _useReducer4[1];
125
+
126
+ // 监听外部通过 form.setFieldsValue 设置的值变化
127
+ _antd.Form.useWatch(namePath, form);
128
+ var fieldValue = form === null || form === void 0 ? void 0 : form.getFieldValue(namePath);
129
+ (0, _react.useEffect)(function () {
130
+ if (Array.isArray(fieldValue)) {
131
+ dispath({
132
+ type: 'sync',
133
+ count: fieldValue.length
134
+ });
135
+ }
136
+ }, [fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.length]);
110
137
  (0, _react.useEffect)(function () {
111
138
  var dependencies = props.dependencies,
112
139
  asserts = props.asserts,
@@ -198,6 +225,23 @@ var AddableSection = function AddableSection(props) {
198
225
  return (0, _formUtils.calcAddableSectionAssertField)(namePath, path, index, children);
199
226
  });
200
227
  }
228
+ if (_child.copyValue) {
229
+ _child.copyValue = _objectSpread(_objectSpread({}, _child.copyValue), {}, {
230
+ assert: _objectSpread(_objectSpread({}, _child.copyValue.assert), {}, {
231
+ field: (0, _formUtils.calcAddableSectionAssertField)(namePath, _child.copyValue.assert.field, index, children)
232
+ }),
233
+ copyFrom: (0, _formUtils.calcAddableSectionAssertField)(namePath, _child.copyValue.copyFrom, index, children)
234
+ });
235
+ }
236
+ if (Array.isArray(_child.selectValue)) {
237
+ _child.selectValue = _child.selectValue.map(function (sv) {
238
+ return _objectSpread(_objectSpread({}, sv), {}, {
239
+ assert: _objectSpread(_objectSpread({}, sv.assert), {}, {
240
+ field: (0, _formUtils.calcAddableSectionAssertField)(namePath, sv.assert.field, index, children)
241
+ })
242
+ });
243
+ });
244
+ }
201
245
  if (['Igloo_Free_Form_Item', 'Igloo_Free_Form_Section', 'Igloo_Free_Form_AddableSection'].includes(c === null || c === void 0 || (_c$type = c.type) === null || _c$type === void 0 ? void 0 : _c$type.displayName)) {
202
246
  return /*#__PURE__*/(0, _react.cloneElement)(c, _objectSpread(_objectSpread({
203
247
  key: _index
@@ -243,6 +287,23 @@ var AddableSection = function AddableSection(props) {
243
287
  return (0, _formUtils.calcAddableSectionAssertField)(namePath, path, index, [children]);
244
288
  });
245
289
  }
290
+ if (_child.copyValue) {
291
+ _child.copyValue = _objectSpread(_objectSpread({}, _child.copyValue), {}, {
292
+ assert: _objectSpread(_objectSpread({}, _child.copyValue.assert), {}, {
293
+ field: (0, _formUtils.calcAddableSectionAssertField)(namePath, _child.copyValue.assert.field, index, [children])
294
+ }),
295
+ copyFrom: (0, _formUtils.calcAddableSectionAssertField)(namePath, _child.copyValue.copyFrom, index, [children])
296
+ });
297
+ }
298
+ if (Array.isArray(_child.selectValue)) {
299
+ _child.selectValue = _child.selectValue.map(function (sv) {
300
+ return _objectSpread(_objectSpread({}, sv), {}, {
301
+ assert: _objectSpread(_objectSpread({}, sv.assert), {}, {
302
+ field: (0, _formUtils.calcAddableSectionAssertField)(namePath, sv.assert.field, index, [children])
303
+ })
304
+ });
305
+ });
306
+ }
246
307
  return /*#__PURE__*/(0, _react.cloneElement)(children, _objectSpread(_objectSpread({}, _child), {}, {
247
308
  // @ts-ignore
248
309
  parentName: parentName,
@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _reactPdf = require("react-pdf");
9
+ var _entry = require("react-pdf/dist/esm/entry.webpack");
10
10
  var _antd = require("antd");
11
11
  var _locale = require("../locale");
12
12
  var _iglooicon = require("iglooicon");
13
- var _tools = require("../utils/tools");
14
13
  var _jsxRuntime = require("react/jsx-runtime");
15
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -20,7 +19,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
20
19
  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; }
21
20
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
22
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
- (0, _tools.addPdfjsWorker)();
24
22
  var Loading = function Loading() {
25
23
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
26
24
  style: {
@@ -96,7 +94,7 @@ var MediaItem = function MediaItem(_ref) {
96
94
  style: {
97
95
  opacity: loading ? 0 : 1
98
96
  },
99
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Document, {
97
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Document, {
100
98
  ref: documentRef,
101
99
  file: src,
102
100
  onPassword: needPassword,
@@ -109,7 +107,7 @@ var MediaItem = function MediaItem(_ref) {
109
107
  onLoadSuccess: function onLoadSuccess() {
110
108
  return setLoading(false);
111
109
  },
112
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Page, {
110
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Page, {
113
111
  pageNumber: 1,
114
112
  scale: 0.1
115
113
  })
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _reactPdf = require("react-pdf");
9
+ var _entry = require("react-pdf/dist/esm/entry.webpack");
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _iglooicon = require("iglooicon");
12
12
  var _antd = require("antd");
@@ -15,7 +15,6 @@ var _modal = _interopRequireDefault(require("../modal"));
15
15
  var _password = _interopRequireDefault(require("../input/password"));
16
16
  var _button = _interopRequireDefault(require("../button"));
17
17
  var _locale = require("../locale");
18
- var _tools = require("../utils/tools");
19
18
  var _jsxRuntime = require("react/jsx-runtime");
20
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -31,7 +30,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
31
30
  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; }
32
31
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
33
32
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
34
- (0, _tools.addPdfjsWorker)();
35
33
  var useBreakpoint = _antd.Grid.useBreakpoint;
36
34
  var PasswordResponses = {
37
35
  NEED_PASSWORD: 1,
@@ -150,7 +148,7 @@ var PdfViewer = function PdfViewer(_ref) {
150
148
  position: 'absolute',
151
149
  overflow: 'auto'
152
150
  },
153
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Document, {
151
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Document, {
154
152
  file: src,
155
153
  onLoadSuccess: handlePageInit,
156
154
  ref: documentRef,
@@ -158,7 +156,7 @@ var PdfViewer = function PdfViewer(_ref) {
158
156
  children: Array.from({
159
157
  length: pageSize
160
158
  }).map(function (_, index) {
161
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Page, {
159
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Page, {
162
160
  pageNumber: index + 1,
163
161
  scale: scale
164
162
  }, index);
@@ -175,12 +173,12 @@ var PdfViewer = function PdfViewer(_ref) {
175
173
  position: 'absolute',
176
174
  overflow: 'auto'
177
175
  },
178
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Document, {
176
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Document, {
179
177
  file: src,
180
178
  onLoadSuccess: handlePageInit,
181
179
  ref: documentRef,
182
180
  onPassword: onPassword,
183
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Page, {
181
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Page, {
184
182
  pageNumber: page,
185
183
  scale: scale
186
184
  })
@@ -177,19 +177,16 @@
177
177
  }
178
178
 
179
179
  .ant-modal-root .igloo-modal {
180
- @media screen and (width >= 1200px) {
180
+ @media screen and (min-width: 1200px) {
181
181
  width: 760px;
182
182
  }
183
-
184
- @media screen and (992px <= width < 1200px) {
183
+ @media screen and (min-width: 992px) and (max-width: 1200px) {
185
184
  width: 660px;
186
185
  }
187
-
188
- @media screen and (768px <= width < 992px) {
186
+ @media screen and (min-width: 768px) and (max-width: 992px) {
189
187
  width: 512px;
190
188
  }
191
-
192
- @media screen and (width < 768px) {
189
+ @media screen and (max-width: 768px) {
193
190
  width: calc(~'100%' - 32px);
194
191
  }
195
192
  }
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _reactPdf = require("react-pdf");
9
+ var _entry = require("react-pdf/dist/esm/entry.webpack");
10
10
  var _locale = require("../locale");
11
- var _tools = require("../utils/tools");
12
11
  var _jsxRuntime = require("react/jsx-runtime");
13
12
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
13
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -18,7 +17,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
18
17
  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; }
19
18
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
20
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
- (0, _tools.addPdfjsWorker)();
22
20
  var MediaItem = function MediaItem(_ref) {
23
21
  var type = _ref.type,
24
22
  src = _ref.src,
@@ -45,12 +43,12 @@ var MediaItem = function MediaItem(_ref) {
45
43
  className: className,
46
44
  children: needPassword ? formatMessage({
47
45
  id: 'Encrypted PDF'
48
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Document, {
46
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Document, {
49
47
  file: src,
50
48
  onPassword: function onPassword() {
51
49
  setNeedPassword(true);
52
50
  },
53
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Page, {
51
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Page, {
54
52
  pageNumber: 1,
55
53
  height: 96
56
54
  })
@@ -7,14 +7,13 @@ exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _antd = require("antd");
9
9
  var _typography = _interopRequireDefault(require("../typography"));
10
- var _reactPdf = require("react-pdf");
10
+ var _entry = require("react-pdf/dist/esm/entry.webpack");
11
11
  var _iglooicon = require("iglooicon");
12
12
  var _localeContext = _interopRequireDefault(require("../locale/locale-context"));
13
13
  var _modal = _interopRequireDefault(require("../modal"));
14
14
  var _password = _interopRequireDefault(require("../input/password"));
15
15
  var _button = _interopRequireDefault(require("../button"));
16
16
  var _classnames = _interopRequireDefault(require("classnames"));
17
- var _tools = require("../utils/tools");
18
17
  var _jsxRuntime = require("react/jsx-runtime");
19
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
19
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -23,7 +22,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
23
22
  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; }
24
23
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
25
24
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
- (0, _tools.addPdfjsWorker)();
27
25
  var useBreakpoint = _antd.Grid.useBreakpoint;
28
26
  var PasswordResponses = {
29
27
  NEED_PASSWORD: 1,
@@ -120,14 +118,14 @@ var PDF = function PDF(_ref) {
120
118
  }
121
119
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
122
120
  className: "igloo-upload-preview-pdf",
123
- children: [modalHolder, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Document, {
121
+ children: [modalHolder, /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Document, {
124
122
  file: src,
125
123
  onLoadSuccess: handlePageInit,
126
124
  onPassword: onPassword,
127
125
  children: Array.from({
128
126
  length: pageSize
129
127
  }).map(function (_, index) {
130
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPdf.Page, {
128
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Page, {
131
129
  pageNumber: index + 1,
132
130
  scale: md ? 1 : 0.5
133
131
  }, index);
@@ -3,4 +3,3 @@ export declare function classifyType(mimeType: string): string;
3
3
  export declare const downloadByUrl: (filename: string, url: string) => void;
4
4
  export declare const getFileNameByUrl: (fileUrl: string) => string;
5
5
  export declare const getResourceContentType: (resourceUrl: string) => Promise<string | undefined>;
6
- export declare const addPdfjsWorker: () => void;
@@ -4,11 +4,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.addPdfjsWorker = void 0;
8
7
  exports.classifyType = classifyType;
9
8
  exports.parseFileSize = exports.getResourceContentType = exports.getFileNameByUrl = exports.downloadByUrl = void 0;
10
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
11
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
9
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
13
10
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
14
11
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -97,12 +94,4 @@ var getResourceContentType = exports.getResourceContentType = /*#__PURE__*/funct
97
94
  return function getResourceContentType(_x) {
98
95
  return _ref.apply(this, arguments);
99
96
  };
100
- }();
101
- var addPdfjsWorker = exports.addPdfjsWorker = function addPdfjsWorker() {
102
- Promise.resolve().then(function () {
103
- return _interopRequireWildcard(require('react-pdf'));
104
- }).then(function (_ref2) {
105
- var pdfjs = _ref2.pdfjs;
106
- pdfjs.GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/legacy/build/pdf.worker.min.js', import.meta.url).toString();
107
- });
108
- };
97
+ }();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-alpha.2",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",
package/mako.config.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "optimization": {
3
- "skipModules": false,
4
- "concatenateModules": false
5
- },
6
- "codeSplitting": {
7
- "strategy": "auto"
8
- },
9
- "devtool": false
10
- }