iglooform 3.6.0 → 3.7.0
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/.dumi/tmp/dumi/theme/ContextWrapper.tsx +1 -1
- package/es/media/preview.d.ts +0 -1
- package/es/media/preview.js +34 -75
- package/es/select/select.d.ts +8 -2
- package/es/select/select.js +4 -3
- package/lib/media/preview.d.ts +0 -1
- package/lib/media/preview.js +33 -74
- package/lib/select/select.d.ts +8 -2
- package/lib/select/select.js +4 -3
- package/package.json +1 -1
- package/es/date-picker/index.d.ts +0 -13
- package/lib/date-picker/index.d.ts +0 -13
|
@@ -30,7 +30,7 @@ export default function DumiContextWrapper() {
|
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
32
|
<SiteContext.Provider value={{
|
|
33
|
-
pkg: {"name":"iglooform","version":"3.
|
|
33
|
+
pkg: {"name":"iglooform","version":"3.5.0","license":"MIT"},
|
|
34
34
|
historyType: "browser",
|
|
35
35
|
entryExports,
|
|
36
36
|
demos,
|
package/es/media/preview.d.ts
CHANGED
package/es/media/preview.js
CHANGED
|
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import React, { useState, useRef, useContext, useReducer
|
|
13
|
+
import React, { useState, useRef, useContext, useReducer } from 'react';
|
|
14
14
|
import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
|
|
15
15
|
import classnames from 'classnames';
|
|
16
16
|
import { ArrowLeftOutlined, ArrowRightOutlined } from 'iglooicon';
|
|
@@ -29,31 +29,6 @@ var PasswordResponses = {
|
|
|
29
29
|
NEED_PASSWORD: 1,
|
|
30
30
|
INCORRECT_PASSWORD: 2
|
|
31
31
|
};
|
|
32
|
-
var useContainerWidth = function useContainerWidth() {
|
|
33
|
-
var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
34
|
-
var containerRef = useRef(null);
|
|
35
|
-
var _useState = useState(undefined),
|
|
36
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
-
containerWidth = _useState2[0],
|
|
38
|
-
setContainerWidth = _useState2[1];
|
|
39
|
-
useEffect(function () {
|
|
40
|
-
if (!enabled) return;
|
|
41
|
-
var updateWidth = function updateWidth() {
|
|
42
|
-
if (containerRef.current) {
|
|
43
|
-
setContainerWidth(containerRef.current.offsetWidth);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
updateWidth();
|
|
47
|
-
var resizeObserver = new ResizeObserver(updateWidth);
|
|
48
|
-
if (containerRef.current) {
|
|
49
|
-
resizeObserver.observe(containerRef.current);
|
|
50
|
-
}
|
|
51
|
-
return function () {
|
|
52
|
-
resizeObserver.disconnect();
|
|
53
|
-
};
|
|
54
|
-
}, [enabled]);
|
|
55
|
-
return [containerRef, containerWidth];
|
|
56
|
-
};
|
|
57
32
|
var PdfViewer = function PdfViewer(_ref) {
|
|
58
33
|
var src = _ref.src,
|
|
59
34
|
left = _ref.left,
|
|
@@ -61,24 +36,22 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
61
36
|
scale = _ref.scale,
|
|
62
37
|
isCurrent = _ref.isCurrent,
|
|
63
38
|
_ref$showAllPages = _ref.showAllPages,
|
|
64
|
-
showAllPages = _ref$showAllPages === void 0 ? true : _ref$showAllPages
|
|
65
|
-
_ref$autoWidth = _ref.autoWidth,
|
|
66
|
-
autoWidth = _ref$autoWidth === void 0 ? false : _ref$autoWidth;
|
|
39
|
+
showAllPages = _ref$showAllPages === void 0 ? true : _ref$showAllPages;
|
|
67
40
|
var _useContext = useContext(LocaleContext),
|
|
68
41
|
formatMessage = _useContext.formatMessage;
|
|
42
|
+
var _useState = useState(1),
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
pageSize = _useState2[0],
|
|
45
|
+
setPageSize = _useState2[1];
|
|
69
46
|
var _useState3 = useState(1),
|
|
70
47
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var _useState5 = useState(1),
|
|
74
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
75
|
-
page = _useState6[0],
|
|
76
|
-
setPage = _useState6[1];
|
|
48
|
+
page = _useState4[0],
|
|
49
|
+
setPage = _useState4[1];
|
|
77
50
|
var documentRef = useRef(null);
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
needPassword =
|
|
81
|
-
setNeedPassword =
|
|
51
|
+
var _useState5 = useState(false),
|
|
52
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
53
|
+
needPassword = _useState6[0],
|
|
54
|
+
setNeedPassword = _useState6[1];
|
|
82
55
|
var _useBreakpoint = useBreakpoint(),
|
|
83
56
|
md = _useBreakpoint.md;
|
|
84
57
|
var _useReducer = useReducer(function (a) {
|
|
@@ -91,10 +64,6 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
91
64
|
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
92
65
|
modal = _Modal$useModal2[0],
|
|
93
66
|
modalHolder = _Modal$useModal2[1];
|
|
94
|
-
var _useContainerWidth = useContainerWidth(autoWidth),
|
|
95
|
-
_useContainerWidth2 = _slicedToArray(_useContainerWidth, 2),
|
|
96
|
-
containerRef = _useContainerWidth2[0],
|
|
97
|
-
containerWidth = _useContainerWidth2[1];
|
|
98
67
|
var handlePageInit = function handlePageInit(document) {
|
|
99
68
|
var _ref2 = document || {},
|
|
100
69
|
numPages = _ref2.numPages;
|
|
@@ -164,12 +133,10 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
164
133
|
}
|
|
165
134
|
if (showAllPages) {
|
|
166
135
|
return /*#__PURE__*/_jsx("div", {
|
|
167
|
-
ref: autoWidth ? containerRef : undefined,
|
|
168
136
|
style: {
|
|
169
137
|
display: 'flex',
|
|
170
138
|
flexDirection: 'column',
|
|
171
139
|
maxWidth: "calc(100vw - ".concat(md ? 64 : 32, "px)"),
|
|
172
|
-
width: autoWidth ? '100%' : undefined,
|
|
173
140
|
maxHeight: '100%',
|
|
174
141
|
transform: "translate(".concat(left, "px, ").concat(top, "px)"),
|
|
175
142
|
position: 'absolute',
|
|
@@ -185,8 +152,7 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
185
152
|
}).map(function (_, index) {
|
|
186
153
|
return /*#__PURE__*/_jsx(Page, {
|
|
187
154
|
pageNumber: index + 1,
|
|
188
|
-
|
|
189
|
-
scale: !autoWidth ? scale : undefined
|
|
155
|
+
scale: scale
|
|
190
156
|
}, index);
|
|
191
157
|
})
|
|
192
158
|
})
|
|
@@ -194,7 +160,6 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
194
160
|
}
|
|
195
161
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
196
162
|
children: [modalHolder, /*#__PURE__*/_jsx("div", {
|
|
197
|
-
ref: autoWidth ? containerRef : undefined,
|
|
198
163
|
style: {
|
|
199
164
|
maxWidth: "calc(100vw - ".concat(md ? 64 : 32, "px)"),
|
|
200
165
|
maxHeight: '100%',
|
|
@@ -209,8 +174,7 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
209
174
|
onPassword: onPassword,
|
|
210
175
|
children: /*#__PURE__*/_jsx(Page, {
|
|
211
176
|
pageNumber: page,
|
|
212
|
-
|
|
213
|
-
scale: !autoWidth ? scale : undefined
|
|
177
|
+
scale: scale
|
|
214
178
|
})
|
|
215
179
|
})
|
|
216
180
|
}, index), isCurrent && Boolean(pageSize > 1) && /*#__PURE__*/_jsxs("div", {
|
|
@@ -249,8 +213,7 @@ var MediaItem = function MediaItem(_ref3) {
|
|
|
249
213
|
scale = _ref3.scale,
|
|
250
214
|
offset = _ref3.offset,
|
|
251
215
|
isCurrent = _ref3.isCurrent,
|
|
252
|
-
showAllPages = _ref3.showAllPages
|
|
253
|
-
autoWidth = _ref3.autoWidth;
|
|
216
|
+
showAllPages = _ref3.showAllPages;
|
|
254
217
|
var top = offset.top,
|
|
255
218
|
left = offset.left;
|
|
256
219
|
var _useContext2 = useContext(LocaleContext),
|
|
@@ -272,8 +235,7 @@ var MediaItem = function MediaItem(_ref3) {
|
|
|
272
235
|
left: left,
|
|
273
236
|
scale: scale,
|
|
274
237
|
isCurrent: isCurrent,
|
|
275
|
-
showAllPages: showAllPages
|
|
276
|
-
autoWidth: autoWidth
|
|
238
|
+
showAllPages: showAllPages
|
|
277
239
|
});
|
|
278
240
|
case 'image':
|
|
279
241
|
return /*#__PURE__*/_jsx("img", {
|
|
@@ -310,34 +272,32 @@ var Media = function Media(_ref4) {
|
|
|
310
272
|
_ref4$isCurrent = _ref4.isCurrent,
|
|
311
273
|
isCurrent = _ref4$isCurrent === void 0 ? false : _ref4$isCurrent,
|
|
312
274
|
_ref4$showAllPages = _ref4.showAllPages,
|
|
313
|
-
showAllPages = _ref4$showAllPages === void 0 ? true : _ref4$showAllPages
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
setIsDrag = _useState10[1];
|
|
320
|
-
var _useState11 = useState({
|
|
275
|
+
showAllPages = _ref4$showAllPages === void 0 ? true : _ref4$showAllPages;
|
|
276
|
+
var _useState7 = useState(false),
|
|
277
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
278
|
+
isDrag = _useState8[0],
|
|
279
|
+
setIsDrag = _useState8[1];
|
|
280
|
+
var _useState9 = useState({
|
|
321
281
|
startX: 0,
|
|
322
282
|
startY: 0
|
|
323
283
|
}),
|
|
324
|
-
|
|
325
|
-
startPos =
|
|
326
|
-
setStartPos =
|
|
327
|
-
var
|
|
284
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
285
|
+
startPos = _useState10[0],
|
|
286
|
+
setStartPos = _useState10[1];
|
|
287
|
+
var _useState11 = useState({
|
|
328
288
|
top: 0,
|
|
329
289
|
left: 0
|
|
330
290
|
}),
|
|
331
|
-
|
|
332
|
-
offset =
|
|
333
|
-
setOffset =
|
|
334
|
-
var
|
|
291
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
292
|
+
offset = _useState12[0],
|
|
293
|
+
setOffset = _useState12[1];
|
|
294
|
+
var _useState13 = useState({
|
|
335
295
|
top: 0,
|
|
336
296
|
left: 0
|
|
337
297
|
}),
|
|
338
|
-
|
|
339
|
-
lastOffset =
|
|
340
|
-
setLastOffset =
|
|
298
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
299
|
+
lastOffset = _useState14[0],
|
|
300
|
+
setLastOffset = _useState14[1];
|
|
341
301
|
var handleMouseUp = function handleMouseUp(e) {
|
|
342
302
|
e.preventDefault();
|
|
343
303
|
var button = e.button;
|
|
@@ -398,8 +358,7 @@ var Media = function Media(_ref4) {
|
|
|
398
358
|
scale: scale,
|
|
399
359
|
offset: offset,
|
|
400
360
|
isCurrent: isCurrent,
|
|
401
|
-
showAllPages: showAllPages
|
|
402
|
-
autoWidth: autoWidth
|
|
361
|
+
showAllPages: showAllPages
|
|
403
362
|
})
|
|
404
363
|
});
|
|
405
364
|
};
|
package/es/select/select.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { Select } from 'antd';
|
|
2
|
-
import { SelectProps, SelectValue } from 'antd/es/select';
|
|
2
|
+
import { SelectProps as AntdSelectProps, SelectValue, DefaultOptionType } from 'antd/es/select';
|
|
3
3
|
import { FC, IglooComponentProps } from '../types';
|
|
4
4
|
import './style';
|
|
5
|
-
type
|
|
5
|
+
type FilterOption = (inputValue: string, option?: DefaultOptionType) => boolean;
|
|
6
|
+
interface SelectProps extends Omit<AntdSelectProps<SelectValue>, 'showSearch'> {
|
|
7
|
+
showSearch?: boolean | {
|
|
8
|
+
filterOption: FilterOption;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
type Props = SelectProps & IglooComponentProps;
|
|
6
12
|
type OptionType = typeof Select.Option;
|
|
7
13
|
type OptGroupType = typeof Select.OptGroup;
|
|
8
14
|
interface IglooSelectType extends FC<Props> {
|
package/es/select/select.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
1
|
var _excluded = ["options", "value", "className", "placeholder", "children", "onDropdownVisibleChange", "showSearch", "filterOption", "optionFilterProp"];
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
9
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
10
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -32,7 +32,7 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
32
32
|
children = _ref.children,
|
|
33
33
|
_onDropdownVisibleChange = _ref.onDropdownVisibleChange,
|
|
34
34
|
showSearch = _ref.showSearch,
|
|
35
|
-
|
|
35
|
+
filterOptionProp = _ref.filterOption,
|
|
36
36
|
optionFilterProp = _ref.optionFilterProp,
|
|
37
37
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
38
|
var _useState = useState(false),
|
|
@@ -41,6 +41,7 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
41
41
|
setOpen = _useState2[1];
|
|
42
42
|
var _useContext = useContext(LocaleContext),
|
|
43
43
|
formatMessage = _useContext.formatMessage;
|
|
44
|
+
var filterOption = _typeof(showSearch) === 'object' ? showSearch.filterOption : filterOptionProp;
|
|
44
45
|
return /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({
|
|
45
46
|
placeholder: placeholder || formatMessage({
|
|
46
47
|
id: 'Please select'
|
|
@@ -75,7 +76,7 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
75
76
|
setOpen(open);
|
|
76
77
|
_onDropdownVisibleChange && _onDropdownVisibleChange(open);
|
|
77
78
|
},
|
|
78
|
-
showSearch: showSearch,
|
|
79
|
+
showSearch: typeof showSearch === 'boolean' ? showSearch : !!showSearch,
|
|
79
80
|
filterOption: filterOption || (showSearch ? function (value, option) {
|
|
80
81
|
var _option$label, _option$label$toStrin;
|
|
81
82
|
return Boolean(option === null || option === void 0 ? void 0 : (_option$label = option.label) === null || _option$label === void 0 ? void 0 : (_option$label$toStrin = _option$label.toString()) === null || _option$label$toStrin === void 0 ? void 0 : _option$label$toStrin.includes(value));
|
package/lib/media/preview.d.ts
CHANGED
package/lib/media/preview.js
CHANGED
|
@@ -35,31 +35,6 @@ var PasswordResponses = {
|
|
|
35
35
|
NEED_PASSWORD: 1,
|
|
36
36
|
INCORRECT_PASSWORD: 2
|
|
37
37
|
};
|
|
38
|
-
var useContainerWidth = function useContainerWidth() {
|
|
39
|
-
var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
40
|
-
var containerRef = (0, _react.useRef)(null);
|
|
41
|
-
var _useState = (0, _react.useState)(undefined),
|
|
42
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
-
containerWidth = _useState2[0],
|
|
44
|
-
setContainerWidth = _useState2[1];
|
|
45
|
-
(0, _react.useEffect)(function () {
|
|
46
|
-
if (!enabled) return;
|
|
47
|
-
var updateWidth = function updateWidth() {
|
|
48
|
-
if (containerRef.current) {
|
|
49
|
-
setContainerWidth(containerRef.current.offsetWidth);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
updateWidth();
|
|
53
|
-
var resizeObserver = new ResizeObserver(updateWidth);
|
|
54
|
-
if (containerRef.current) {
|
|
55
|
-
resizeObserver.observe(containerRef.current);
|
|
56
|
-
}
|
|
57
|
-
return function () {
|
|
58
|
-
resizeObserver.disconnect();
|
|
59
|
-
};
|
|
60
|
-
}, [enabled]);
|
|
61
|
-
return [containerRef, containerWidth];
|
|
62
|
-
};
|
|
63
38
|
var PdfViewer = function PdfViewer(_ref) {
|
|
64
39
|
var src = _ref.src,
|
|
65
40
|
left = _ref.left,
|
|
@@ -67,24 +42,22 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
67
42
|
scale = _ref.scale,
|
|
68
43
|
isCurrent = _ref.isCurrent,
|
|
69
44
|
_ref$showAllPages = _ref.showAllPages,
|
|
70
|
-
showAllPages = _ref$showAllPages === void 0 ? true : _ref$showAllPages
|
|
71
|
-
_ref$autoWidth = _ref.autoWidth,
|
|
72
|
-
autoWidth = _ref$autoWidth === void 0 ? false : _ref$autoWidth;
|
|
45
|
+
showAllPages = _ref$showAllPages === void 0 ? true : _ref$showAllPages;
|
|
73
46
|
var _useContext = (0, _react.useContext)(_locale.LocaleContext),
|
|
74
47
|
formatMessage = _useContext.formatMessage;
|
|
48
|
+
var _useState = (0, _react.useState)(1),
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
pageSize = _useState2[0],
|
|
51
|
+
setPageSize = _useState2[1];
|
|
75
52
|
var _useState3 = (0, _react.useState)(1),
|
|
76
53
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var _useState5 = (0, _react.useState)(1),
|
|
80
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
81
|
-
page = _useState6[0],
|
|
82
|
-
setPage = _useState6[1];
|
|
54
|
+
page = _useState4[0],
|
|
55
|
+
setPage = _useState4[1];
|
|
83
56
|
var documentRef = (0, _react.useRef)(null);
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
needPassword =
|
|
87
|
-
setNeedPassword =
|
|
57
|
+
var _useState5 = (0, _react.useState)(false),
|
|
58
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
59
|
+
needPassword = _useState6[0],
|
|
60
|
+
setNeedPassword = _useState6[1];
|
|
88
61
|
var _useBreakpoint = useBreakpoint(),
|
|
89
62
|
md = _useBreakpoint.md;
|
|
90
63
|
var _useReducer = (0, _react.useReducer)(function (a) {
|
|
@@ -97,10 +70,6 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
97
70
|
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
98
71
|
modal = _Modal$useModal2[0],
|
|
99
72
|
modalHolder = _Modal$useModal2[1];
|
|
100
|
-
var _useContainerWidth = useContainerWidth(autoWidth),
|
|
101
|
-
_useContainerWidth2 = _slicedToArray(_useContainerWidth, 2),
|
|
102
|
-
containerRef = _useContainerWidth2[0],
|
|
103
|
-
containerWidth = _useContainerWidth2[1];
|
|
104
73
|
var handlePageInit = function handlePageInit(document) {
|
|
105
74
|
var _ref2 = document || {},
|
|
106
75
|
numPages = _ref2.numPages;
|
|
@@ -170,12 +139,10 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
170
139
|
}
|
|
171
140
|
if (showAllPages) {
|
|
172
141
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
173
|
-
ref: autoWidth ? containerRef : undefined,
|
|
174
142
|
style: {
|
|
175
143
|
display: 'flex',
|
|
176
144
|
flexDirection: 'column',
|
|
177
145
|
maxWidth: "calc(100vw - ".concat(md ? 64 : 32, "px)"),
|
|
178
|
-
width: autoWidth ? '100%' : undefined,
|
|
179
146
|
maxHeight: '100%',
|
|
180
147
|
transform: "translate(".concat(left, "px, ").concat(top, "px)"),
|
|
181
148
|
position: 'absolute',
|
|
@@ -191,8 +158,7 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
191
158
|
}).map(function (_, index) {
|
|
192
159
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Page, {
|
|
193
160
|
pageNumber: index + 1,
|
|
194
|
-
|
|
195
|
-
scale: !autoWidth ? scale : undefined
|
|
161
|
+
scale: scale
|
|
196
162
|
}, index);
|
|
197
163
|
})
|
|
198
164
|
})
|
|
@@ -200,7 +166,6 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
200
166
|
}
|
|
201
167
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
202
168
|
children: [modalHolder, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
203
|
-
ref: autoWidth ? containerRef : undefined,
|
|
204
169
|
style: {
|
|
205
170
|
maxWidth: "calc(100vw - ".concat(md ? 64 : 32, "px)"),
|
|
206
171
|
maxHeight: '100%',
|
|
@@ -215,8 +180,7 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
215
180
|
onPassword: onPassword,
|
|
216
181
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_entry.Page, {
|
|
217
182
|
pageNumber: page,
|
|
218
|
-
|
|
219
|
-
scale: !autoWidth ? scale : undefined
|
|
183
|
+
scale: scale
|
|
220
184
|
})
|
|
221
185
|
})
|
|
222
186
|
}, index), isCurrent && Boolean(pageSize > 1) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -255,8 +219,7 @@ var MediaItem = function MediaItem(_ref3) {
|
|
|
255
219
|
scale = _ref3.scale,
|
|
256
220
|
offset = _ref3.offset,
|
|
257
221
|
isCurrent = _ref3.isCurrent,
|
|
258
|
-
showAllPages = _ref3.showAllPages
|
|
259
|
-
autoWidth = _ref3.autoWidth;
|
|
222
|
+
showAllPages = _ref3.showAllPages;
|
|
260
223
|
var top = offset.top,
|
|
261
224
|
left = offset.left;
|
|
262
225
|
var _useContext2 = (0, _react.useContext)(_locale.LocaleContext),
|
|
@@ -278,8 +241,7 @@ var MediaItem = function MediaItem(_ref3) {
|
|
|
278
241
|
left: left,
|
|
279
242
|
scale: scale,
|
|
280
243
|
isCurrent: isCurrent,
|
|
281
|
-
showAllPages: showAllPages
|
|
282
|
-
autoWidth: autoWidth
|
|
244
|
+
showAllPages: showAllPages
|
|
283
245
|
});
|
|
284
246
|
case 'image':
|
|
285
247
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
@@ -316,34 +278,32 @@ var Media = function Media(_ref4) {
|
|
|
316
278
|
_ref4$isCurrent = _ref4.isCurrent,
|
|
317
279
|
isCurrent = _ref4$isCurrent === void 0 ? false : _ref4$isCurrent,
|
|
318
280
|
_ref4$showAllPages = _ref4.showAllPages,
|
|
319
|
-
showAllPages = _ref4$showAllPages === void 0 ? true : _ref4$showAllPages
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
setIsDrag = _useState10[1];
|
|
326
|
-
var _useState11 = (0, _react.useState)({
|
|
281
|
+
showAllPages = _ref4$showAllPages === void 0 ? true : _ref4$showAllPages;
|
|
282
|
+
var _useState7 = (0, _react.useState)(false),
|
|
283
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
284
|
+
isDrag = _useState8[0],
|
|
285
|
+
setIsDrag = _useState8[1];
|
|
286
|
+
var _useState9 = (0, _react.useState)({
|
|
327
287
|
startX: 0,
|
|
328
288
|
startY: 0
|
|
329
289
|
}),
|
|
330
|
-
|
|
331
|
-
startPos =
|
|
332
|
-
setStartPos =
|
|
333
|
-
var
|
|
290
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
291
|
+
startPos = _useState10[0],
|
|
292
|
+
setStartPos = _useState10[1];
|
|
293
|
+
var _useState11 = (0, _react.useState)({
|
|
334
294
|
top: 0,
|
|
335
295
|
left: 0
|
|
336
296
|
}),
|
|
337
|
-
|
|
338
|
-
offset =
|
|
339
|
-
setOffset =
|
|
340
|
-
var
|
|
297
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
298
|
+
offset = _useState12[0],
|
|
299
|
+
setOffset = _useState12[1];
|
|
300
|
+
var _useState13 = (0, _react.useState)({
|
|
341
301
|
top: 0,
|
|
342
302
|
left: 0
|
|
343
303
|
}),
|
|
344
|
-
|
|
345
|
-
lastOffset =
|
|
346
|
-
setLastOffset =
|
|
304
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
305
|
+
lastOffset = _useState14[0],
|
|
306
|
+
setLastOffset = _useState14[1];
|
|
347
307
|
var handleMouseUp = function handleMouseUp(e) {
|
|
348
308
|
e.preventDefault();
|
|
349
309
|
var button = e.button;
|
|
@@ -404,8 +364,7 @@ var Media = function Media(_ref4) {
|
|
|
404
364
|
scale: scale,
|
|
405
365
|
offset: offset,
|
|
406
366
|
isCurrent: isCurrent,
|
|
407
|
-
showAllPages: showAllPages
|
|
408
|
-
autoWidth: autoWidth
|
|
367
|
+
showAllPages: showAllPages
|
|
409
368
|
})
|
|
410
369
|
});
|
|
411
370
|
};
|
package/lib/select/select.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { Select } from 'antd';
|
|
2
|
-
import { SelectProps, SelectValue } from 'antd/es/select';
|
|
2
|
+
import { SelectProps as AntdSelectProps, SelectValue, DefaultOptionType } from 'antd/es/select';
|
|
3
3
|
import { FC, IglooComponentProps } from '../types';
|
|
4
4
|
import './style';
|
|
5
|
-
type
|
|
5
|
+
type FilterOption = (inputValue: string, option?: DefaultOptionType) => boolean;
|
|
6
|
+
interface SelectProps extends Omit<AntdSelectProps<SelectValue>, 'showSearch'> {
|
|
7
|
+
showSearch?: boolean | {
|
|
8
|
+
filterOption: FilterOption;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
type Props = SelectProps & IglooComponentProps;
|
|
6
12
|
type OptionType = typeof Select.Option;
|
|
7
13
|
type OptGroupType = typeof Select.OptGroup;
|
|
8
14
|
interface IglooSelectType extends FC<Props> {
|
package/lib/select/select.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -21,6 +20,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
21
20
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
21
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
22
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
23
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
24
24
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
25
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
26
26
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -37,7 +37,7 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
37
37
|
children = _ref.children,
|
|
38
38
|
_onDropdownVisibleChange = _ref.onDropdownVisibleChange,
|
|
39
39
|
showSearch = _ref.showSearch,
|
|
40
|
-
|
|
40
|
+
filterOptionProp = _ref.filterOption,
|
|
41
41
|
optionFilterProp = _ref.optionFilterProp,
|
|
42
42
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
43
|
var _useState = (0, _react.useState)(false),
|
|
@@ -46,6 +46,7 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
46
46
|
setOpen = _useState2[1];
|
|
47
47
|
var _useContext = (0, _react.useContext)(_localeContext.default),
|
|
48
48
|
formatMessage = _useContext.formatMessage;
|
|
49
|
+
var filterOption = _typeof(showSearch) === 'object' ? showSearch.filterOption : filterOptionProp;
|
|
49
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Select, _objectSpread(_objectSpread({
|
|
50
51
|
placeholder: placeholder || formatMessage({
|
|
51
52
|
id: 'Please select'
|
|
@@ -80,7 +81,7 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
80
81
|
setOpen(open);
|
|
81
82
|
_onDropdownVisibleChange && _onDropdownVisibleChange(open);
|
|
82
83
|
},
|
|
83
|
-
showSearch: showSearch,
|
|
84
|
+
showSearch: typeof showSearch === 'boolean' ? showSearch : !!showSearch,
|
|
84
85
|
filterOption: filterOption || (showSearch ? function (value, option) {
|
|
85
86
|
var _option$label, _option$label$toStrin;
|
|
86
87
|
return Boolean(option === null || option === void 0 ? void 0 : (_option$label = option.label) === null || _option$label === void 0 ? void 0 : (_option$label$toStrin = _option$label.toString()) === null || _option$label$toStrin === void 0 ? void 0 : _option$label$toStrin.includes(value));
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DatePickerProps, RangePickerProps, MonthPickerProps, WeekPickerProps } from 'antd/es/date-picker';
|
|
2
|
-
import { FC, IglooComponentProps } from '../types';
|
|
3
|
-
import { Dayjs } from 'dayjs';
|
|
4
|
-
import './style';
|
|
5
|
-
export { default as IglooBuddhistDatePicker } from './buddhist';
|
|
6
|
-
type Props = Omit<DatePickerProps, 'value'> & IglooComponentProps & {
|
|
7
|
-
value?: Dayjs | null | 0;
|
|
8
|
-
};
|
|
9
|
-
declare const IglooDatePicker: FC<Props>;
|
|
10
|
-
export default IglooDatePicker;
|
|
11
|
-
export declare const IglooRangePicker: FC<RangePickerProps & IglooComponentProps>;
|
|
12
|
-
export declare const IglooWeekPicker: FC<WeekPickerProps & IglooComponentProps>;
|
|
13
|
-
export declare const IglooMonthPicker: FC<MonthPickerProps & IglooComponentProps>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DatePickerProps, RangePickerProps, MonthPickerProps, WeekPickerProps } from 'antd/es/date-picker';
|
|
2
|
-
import { FC, IglooComponentProps } from '../types';
|
|
3
|
-
import { Dayjs } from 'dayjs';
|
|
4
|
-
import './style';
|
|
5
|
-
export { default as IglooBuddhistDatePicker } from './buddhist';
|
|
6
|
-
type Props = Omit<DatePickerProps, 'value'> & IglooComponentProps & {
|
|
7
|
-
value?: Dayjs | null | 0;
|
|
8
|
-
};
|
|
9
|
-
declare const IglooDatePicker: FC<Props>;
|
|
10
|
-
export default IglooDatePicker;
|
|
11
|
-
export declare const IglooRangePicker: FC<RangePickerProps & IglooComponentProps>;
|
|
12
|
-
export declare const IglooWeekPicker: FC<WeekPickerProps & IglooComponentProps>;
|
|
13
|
-
export declare const IglooMonthPicker: FC<MonthPickerProps & IglooComponentProps>;
|