@douyinfe/semi-ui 2.40.0-alpha.0 → 2.40.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/dist/css/semi.css +6 -40
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +280 -537
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/_portal/index.d.ts +3 -2
- package/lib/cjs/_portal/index.js +33 -26
- package/lib/cjs/_utils/index.js +0 -3
- package/lib/cjs/autoComplete/index.js +0 -2
- package/lib/cjs/autoComplete/option.js +0 -2
- package/lib/cjs/avatar/avatarGroup.js +0 -1
- package/lib/cjs/avatar/index.js +0 -1
- package/lib/cjs/backtop/index.js +0 -1
- package/lib/cjs/badge/index.js +0 -1
- package/lib/cjs/banner/index.js +0 -3
- package/lib/cjs/breadcrumb/index.js +0 -3
- package/lib/cjs/button/Button.js +8 -14
- package/lib/cjs/calendar/dayCalendar.js +4 -9
- package/lib/cjs/calendar/dayCol.js +1 -1
- package/lib/cjs/calendar/monthCalendar.js +5 -12
- package/lib/cjs/calendar/rangeCalendar.js +0 -2
- package/lib/cjs/carousel/index.js +0 -2
- package/lib/cjs/checkbox/checkbox.js +0 -2
- package/lib/cjs/checkbox/checkboxGroup.js +0 -3
- package/lib/cjs/checkbox/checkboxInner.js +0 -2
- package/lib/cjs/collapse/index.js +0 -1
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/dateInput.js +0 -3
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.js +1 -3
- package/lib/cjs/datePicker/month.js +0 -4
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/datePicker/monthsGrid.js +1 -5
- package/lib/cjs/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/cjs/datePicker/yearAndMonth.js +0 -2
- package/lib/cjs/form/arrayField.js +0 -2
- package/lib/cjs/form/baseForm.d.ts +0 -1
- package/lib/cjs/form/baseForm.js +5 -7
- package/lib/cjs/form/context.js +0 -2
- package/lib/cjs/form/errorMessage.js +0 -2
- package/lib/cjs/form/field.d.ts +0 -1
- package/lib/cjs/form/field.js +0 -2
- package/lib/cjs/form/group.js +0 -2
- package/lib/cjs/form/hoc/withField.js +2 -6
- package/lib/cjs/form/interface.d.ts +4 -4
- package/lib/cjs/form/interface.js +0 -3
- package/lib/cjs/form/section.js +0 -2
- package/lib/cjs/form/slot.js +0 -3
- package/lib/cjs/iconButton/index.js +0 -2
- package/lib/cjs/image/image.js +29 -34
- package/lib/cjs/image/interface.d.ts +4 -1
- package/lib/cjs/image/preview.js +5 -3
- package/lib/cjs/image/previewContext.d.ts +1 -0
- package/lib/cjs/image/previewFooter.d.ts +5 -1
- package/lib/cjs/image/previewFooter.js +66 -38
- package/lib/cjs/image/previewInner.d.ts +2 -2
- package/lib/cjs/image/previewInner.js +4 -2
- package/lib/cjs/input/index.js +0 -2
- package/lib/cjs/input/inputGroup.js +0 -3
- package/lib/cjs/input/textarea.js +0 -2
- package/lib/cjs/inputNumber/index.js +1 -5
- package/lib/cjs/modal/ConfirmModal.js +0 -2
- package/lib/cjs/modal/Modal.js +0 -2
- package/lib/cjs/modal/ModalContent.js +0 -5
- package/lib/cjs/modal/confirm.d.ts +12 -12
- package/lib/cjs/modal/confirm.js +0 -1
- package/lib/cjs/modal/useModal/HookModal.js +0 -1
- package/lib/cjs/modal/useModal/index.js +0 -2
- package/lib/cjs/navigation/Item.js +0 -3
- package/lib/cjs/navigation/SubNav.js +0 -3
- package/lib/cjs/navigation/index.js +0 -2
- package/lib/cjs/notification/notice.js +29 -35
- package/lib/cjs/notification/useNotification/index.js +1 -1
- package/lib/cjs/overflowList/index.js +0 -2
- package/lib/cjs/pagination/index.d.ts +2 -0
- package/lib/cjs/pagination/index.js +29 -13
- package/lib/cjs/popconfirm/index.js +0 -2
- package/lib/cjs/progress/index.js +0 -1
- package/lib/cjs/radio/radio.js +0 -2
- package/lib/cjs/rating/index.js +0 -1
- package/lib/cjs/resizeObserver/index.js +0 -1
- package/lib/cjs/scrollList/scrollItem.js +0 -3
- package/lib/cjs/select/index.d.ts +0 -1
- package/lib/cjs/select/index.js +3 -12
- package/lib/cjs/select/option.js +0 -2
- package/lib/cjs/select/utils.js +0 -2
- package/lib/cjs/sideSheet/index.js +0 -2
- package/lib/cjs/slider/index.js +0 -3
- package/lib/cjs/spin/icon.js +0 -2
- package/lib/cjs/switch/index.js +0 -2
- package/lib/cjs/table/Body/BaseRow.js +0 -2
- package/lib/cjs/table/Body/ExpandedRow.js +0 -3
- package/lib/cjs/table/Body/SectionRow.js +0 -3
- package/lib/cjs/table/Body/index.js +0 -8
- package/lib/cjs/table/ColGroup.js +0 -1
- package/lib/cjs/table/ColumnFilter.js +0 -3
- package/lib/cjs/table/ColumnSelection.js +0 -2
- package/lib/cjs/table/HeadTable.js +0 -2
- package/lib/cjs/table/ResizableTable.js +1 -4
- package/lib/cjs/table/Table.js +1 -10
- package/lib/cjs/table/TableCell.js +0 -4
- package/lib/cjs/table/TableHeader.js +0 -4
- package/lib/cjs/table/TableHeaderRow.js +0 -2
- package/lib/cjs/table/TablePagination.js +0 -2
- package/lib/cjs/table/table-context.js +0 -2
- package/lib/cjs/tabs/TabBar.js +0 -2
- package/lib/cjs/tag/index.js +1 -3
- package/lib/cjs/tagInput/index.js +0 -2
- package/lib/cjs/timePicker/Combobox.js +0 -4
- package/lib/cjs/timePicker/TimeInput.js +0 -2
- package/lib/cjs/timePicker/TimePicker.js +0 -2
- package/lib/cjs/toast/index.js +0 -2
- package/lib/cjs/toast/toast.js +0 -2
- package/lib/cjs/toast/useToast/index.js +0 -1
- package/lib/cjs/tooltip/index.js +0 -6
- package/lib/cjs/transfer/index.js +0 -3
- package/lib/cjs/tree/index.d.ts +2 -1
- package/lib/cjs/tree/index.js +11 -14
- package/lib/cjs/tree/treeNode.js +0 -3
- package/lib/cjs/treeSelect/index.js +0 -7
- package/lib/cjs/trigger/index.js +0 -2
- package/lib/cjs/typography/util.js +1 -3
- package/lib/cjs/upload/index.js +1 -6
- package/lib/es/_portal/index.d.ts +3 -2
- package/lib/es/_portal/index.js +33 -26
- package/lib/es/_utils/index.js +0 -2
- package/lib/es/autoComplete/index.js +0 -1
- package/lib/es/autoComplete/option.js +0 -1
- package/lib/es/avatar/avatarGroup.js +0 -1
- package/lib/es/avatar/index.js +0 -1
- package/lib/es/backtop/index.js +0 -1
- package/lib/es/badge/index.js +0 -1
- package/lib/es/banner/index.js +0 -2
- package/lib/es/breadcrumb/index.js +0 -2
- package/lib/es/button/Button.js +8 -13
- package/lib/es/calendar/dayCalendar.js +4 -9
- package/lib/es/calendar/dayCol.js +1 -1
- package/lib/es/calendar/monthCalendar.js +5 -11
- package/lib/es/calendar/rangeCalendar.js +0 -1
- package/lib/es/carousel/index.js +0 -1
- package/lib/es/checkbox/checkbox.js +0 -1
- package/lib/es/checkbox/checkboxGroup.js +0 -2
- package/lib/es/checkbox/checkboxInner.js +0 -1
- package/lib/es/collapse/index.js +0 -1
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/dateInput.js +0 -3
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/datePicker.js +0 -3
- package/lib/es/datePicker/month.js +0 -4
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.js +1 -5
- package/lib/es/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.js +0 -1
- package/lib/es/form/arrayField.js +0 -1
- package/lib/es/form/baseForm.d.ts +0 -1
- package/lib/es/form/baseForm.js +5 -6
- package/lib/es/form/context.js +0 -1
- package/lib/es/form/errorMessage.js +0 -1
- package/lib/es/form/field.d.ts +0 -1
- package/lib/es/form/field.js +0 -1
- package/lib/es/form/group.js +0 -1
- package/lib/es/form/hoc/withField.js +2 -6
- package/lib/es/form/interface.d.ts +4 -4
- package/lib/es/form/interface.js +0 -2
- package/lib/es/form/section.js +0 -1
- package/lib/es/form/slot.js +0 -2
- package/lib/es/iconButton/index.js +0 -1
- package/lib/es/image/image.js +29 -34
- package/lib/es/image/interface.d.ts +4 -1
- package/lib/es/image/preview.js +5 -3
- package/lib/es/image/previewContext.d.ts +1 -0
- package/lib/es/image/previewFooter.d.ts +5 -1
- package/lib/es/image/previewFooter.js +66 -38
- package/lib/es/image/previewInner.d.ts +2 -2
- package/lib/es/image/previewInner.js +4 -1
- package/lib/es/input/index.js +0 -1
- package/lib/es/input/inputGroup.js +0 -2
- package/lib/es/input/textarea.js +0 -1
- package/lib/es/inputNumber/index.js +0 -5
- package/lib/es/modal/ConfirmModal.js +0 -2
- package/lib/es/modal/Modal.js +0 -1
- package/lib/es/modal/ModalContent.js +0 -3
- package/lib/es/modal/confirm.d.ts +12 -12
- package/lib/es/modal/confirm.js +0 -1
- package/lib/es/modal/useModal/HookModal.js +0 -1
- package/lib/es/modal/useModal/index.js +0 -2
- package/lib/es/navigation/Item.js +0 -2
- package/lib/es/navigation/SubNav.js +0 -2
- package/lib/es/navigation/index.js +0 -1
- package/lib/es/notification/notice.js +29 -34
- package/lib/es/notification/useNotification/index.js +1 -1
- package/lib/es/overflowList/index.js +0 -1
- package/lib/es/pagination/index.d.ts +2 -0
- package/lib/es/pagination/index.js +28 -13
- package/lib/es/popconfirm/index.js +0 -1
- package/lib/es/progress/index.js +0 -1
- package/lib/es/radio/radio.js +0 -1
- package/lib/es/rating/index.js +0 -1
- package/lib/es/resizeObserver/index.js +0 -1
- package/lib/es/scrollList/scrollItem.js +0 -3
- package/lib/es/select/index.d.ts +0 -1
- package/lib/es/select/index.js +3 -12
- package/lib/es/select/option.js +0 -1
- package/lib/es/select/utils.js +0 -2
- package/lib/es/sideSheet/index.js +0 -1
- package/lib/es/slider/index.js +0 -3
- package/lib/es/spin/icon.js +0 -1
- package/lib/es/switch/index.js +0 -1
- package/lib/es/table/Body/BaseRow.js +0 -2
- package/lib/es/table/Body/ExpandedRow.js +0 -2
- package/lib/es/table/Body/SectionRow.js +0 -3
- package/lib/es/table/Body/index.js +0 -8
- package/lib/es/table/ColGroup.js +0 -1
- package/lib/es/table/ColumnFilter.js +0 -2
- package/lib/es/table/ColumnSelection.js +0 -1
- package/lib/es/table/HeadTable.js +0 -1
- package/lib/es/table/ResizableTable.js +0 -4
- package/lib/es/table/Table.js +0 -10
- package/lib/es/table/TableCell.js +0 -3
- package/lib/es/table/TableHeader.js +0 -3
- package/lib/es/table/TableHeaderRow.js +0 -1
- package/lib/es/table/TablePagination.js +0 -1
- package/lib/es/table/table-context.js +0 -1
- package/lib/es/tabs/TabBar.js +0 -2
- package/lib/es/tag/index.js +1 -2
- package/lib/es/tagInput/index.js +0 -2
- package/lib/es/timePicker/Combobox.js +0 -3
- package/lib/es/timePicker/TimeInput.js +0 -1
- package/lib/es/timePicker/TimePicker.js +0 -1
- package/lib/es/toast/index.js +0 -1
- package/lib/es/toast/toast.js +0 -1
- package/lib/es/toast/useToast/index.js +0 -1
- package/lib/es/tooltip/index.js +0 -5
- package/lib/es/transfer/index.js +0 -3
- package/lib/es/tree/index.d.ts +2 -1
- package/lib/es/tree/index.js +11 -13
- package/lib/es/tree/treeNode.js +0 -3
- package/lib/es/treeSelect/index.js +0 -7
- package/lib/es/trigger/index.js +0 -2
- package/lib/es/typography/util.js +1 -3
- package/lib/es/upload/index.js +1 -5
- package/package.json +8 -8
|
@@ -19,7 +19,7 @@ var _grid = require("../../grid");
|
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
|
-
/* eslint-disable
|
|
22
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
23
23
|
|
|
24
24
|
const prefix = _constants.cssClasses.PREFIX;
|
|
25
25
|
// To avoid useLayoutEffect warning when ssr, refer: https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
@@ -161,9 +161,7 @@ function withField(Component, opts) {
|
|
|
161
161
|
const rootPromise = new Promise((resolve, reject) => {
|
|
162
162
|
validator.validate(model, {
|
|
163
163
|
first: stopValidateWithError
|
|
164
|
-
},
|
|
165
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
166
|
-
(errors, fields) => {}).then(res => {
|
|
164
|
+
}, (errors, fields) => {}).then(res => {
|
|
167
165
|
if (validatePromise.current !== rootPromise) {
|
|
168
166
|
return;
|
|
169
167
|
}
|
|
@@ -182,7 +180,6 @@ function withField(Component, opts) {
|
|
|
182
180
|
if (errors && fields) {
|
|
183
181
|
let messages = errors.map(e => e.message);
|
|
184
182
|
if (messages.length === 1) {
|
|
185
|
-
// eslint-disable-next-line prefer-destructuring
|
|
186
183
|
messages = messages[0];
|
|
187
184
|
}
|
|
188
185
|
updateError(messages, callOpts);
|
|
@@ -359,7 +356,6 @@ function withField(Component, opts) {
|
|
|
359
356
|
useIsomorphicEffect(() => {
|
|
360
357
|
// register
|
|
361
358
|
if (typeof field === 'undefined') {
|
|
362
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
363
359
|
return () => {};
|
|
364
360
|
}
|
|
365
361
|
// log('register: ' + field);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Subtract } from 'utility-types';
|
|
3
3
|
import type { RuleItem } from 'async-validator';
|
|
4
|
-
import type { Options as
|
|
4
|
+
import type { Options as ScrollIntoViewOptions } from 'scroll-into-view-if-needed';
|
|
5
5
|
import type { BaseFormApi as FormApi, FormState, WithFieldOption, AllErrors } from '@douyinfe/semi-foundation/lib/cjs/form/interface';
|
|
6
6
|
import type { SelectProps } from '../select/index';
|
|
7
7
|
import Option from '../select/option';
|
|
@@ -83,8 +83,8 @@ export interface FormFCChild<K extends Record<string, any> = any> {
|
|
|
83
83
|
}
|
|
84
84
|
export interface BaseFormProps<Values extends Record<string, any> = any> extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'children' | 'onChange' | 'onSubmit' | 'onReset'> {
|
|
85
85
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
86
|
-
onSubmit?: (values: Values) => void;
|
|
87
|
-
onSubmitFail?: (errors: Record<keyof Values, FieldError>, values: Partial<Values>) => void;
|
|
86
|
+
onSubmit?: (values: Values, e?: React.FormEvent<HTMLFormElement>) => void;
|
|
87
|
+
onSubmitFail?: (errors: Record<keyof Values, FieldError>, values: Partial<Values>, e?: React.FormEvent<HTMLFormElement>) => void;
|
|
88
88
|
onReset?: () => void;
|
|
89
89
|
onValueChange?: (values: Values, changedValue: Partial<Values>) => void;
|
|
90
90
|
onChange?: (formState: FormState<Values>) => void;
|
|
@@ -106,7 +106,7 @@ export interface BaseFormProps<Values extends Record<string, any> = any> extends
|
|
|
106
106
|
render?: (internalProps: FormFCChild) => React.ReactNode;
|
|
107
107
|
component?: React.FC<any> | React.ComponentClass<any>;
|
|
108
108
|
children?: React.ReactNode | ((internalProps: FormFCChild) => React.ReactNode);
|
|
109
|
-
autoScrollToError?: boolean |
|
|
109
|
+
autoScrollToError?: boolean | ScrollIntoViewOptions;
|
|
110
110
|
disabled?: boolean;
|
|
111
111
|
showValidateIcon?: boolean;
|
|
112
112
|
extraTextPosition?: 'middle' | 'bottom';
|
|
@@ -7,9 +7,6 @@ exports.FormSelectType = exports.FormSelect = exports.FormRadioType = exports.Fo
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
9
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
-
/* eslint-disable one-var */
|
|
11
|
-
/* eslint-disable react/prefer-stateless-function, max-len */
|
|
12
|
-
|
|
13
10
|
class FormSelect extends React.Component {}
|
|
14
11
|
exports.FormSelect = FormSelect;
|
|
15
12
|
class Field extends React.Component {}
|
package/lib/cjs/form/section.js
CHANGED
|
@@ -11,8 +11,6 @@ var _constants = require("@douyinfe/semi-foundation/lib/cjs/form/constants");
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
/* eslint-disable prefer-template */
|
|
15
|
-
|
|
16
14
|
const prefix = _constants.cssClasses.PREFIX;
|
|
17
15
|
class Section extends _react.PureComponent {
|
|
18
16
|
render() {
|
package/lib/cjs/form/slot.js
CHANGED
|
@@ -25,8 +25,6 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
25
25
|
}
|
|
26
26
|
return t;
|
|
27
27
|
};
|
|
28
|
-
/* eslint-disable max-lines-per-function, prefer-destructuring, prefer-const, @typescript-eslint/no-unused-vars */
|
|
29
|
-
|
|
30
28
|
const prefix = _constants.cssClasses.PREFIX;
|
|
31
29
|
const FormSlot = props => {
|
|
32
30
|
let labelCol, wrapperCol, labelWidth, labelAlign, content;
|
|
@@ -40,7 +38,6 @@ const FormSlot = props => {
|
|
|
40
38
|
labelAlign = formProps.labelAlign;
|
|
41
39
|
labelPosition = formProps.labelPosition ? formProps.labelPosition : labelPosition;
|
|
42
40
|
} catch (error) {}
|
|
43
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
44
41
|
props.labelPosition ? labelPosition = props.labelPosition : null;
|
|
45
42
|
let {
|
|
46
43
|
children,
|
package/lib/cjs/image/image.js
CHANGED
|
@@ -28,8 +28,6 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
28
28
|
}
|
|
29
29
|
return t;
|
|
30
30
|
};
|
|
31
|
-
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
32
|
-
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
33
31
|
const prefixCls = _constants.cssClasses.PREFIX;
|
|
34
32
|
class Image extends _baseComponent.default {
|
|
35
33
|
get adapter() {
|
|
@@ -169,9 +167,10 @@ class Image extends _baseComponent.default {
|
|
|
169
167
|
preview,
|
|
170
168
|
fallback,
|
|
171
169
|
placeholder,
|
|
172
|
-
imageID
|
|
170
|
+
imageID,
|
|
171
|
+
setDownloadName
|
|
173
172
|
} = _b,
|
|
174
|
-
restProps = __rest(_b, ["src", "width", "height", "alt", "style", "className", "crossOrigin", "preview", "fallback", "placeholder", "imageID"]);
|
|
173
|
+
restProps = __rest(_b, ["src", "width", "height", "alt", "style", "className", "crossOrigin", "preview", "fallback", "placeholder", "imageID", "setDownloadName"]);
|
|
175
174
|
const outerStyle = Object.assign({
|
|
176
175
|
width,
|
|
177
176
|
height
|
|
@@ -181,36 +180,32 @@ class Image extends _baseComponent.default {
|
|
|
181
180
|
const showPreviewCursor = preview && loadStatus === "success";
|
|
182
181
|
const previewSrc = (0, _isObject2.default)(preview) ? (_a = preview.src) !== null && _a !== void 0 ? _a : src : src;
|
|
183
182
|
const previewProps = (0, _isObject2.default)(preview) ? preview : {};
|
|
184
|
-
return (
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
onVisibleChange: this.handlePreviewVisibleChange,
|
|
211
|
-
crossOrigin: !(0, _isUndefined2.default)(crossOrigin) ? crossOrigin : previewProps === null || previewProps === void 0 ? void 0 : previewProps.crossOrigin
|
|
212
|
-
})))
|
|
213
|
-
);
|
|
183
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
184
|
+
style: outerStyle,
|
|
185
|
+
className: outerCls,
|
|
186
|
+
onClick: this.handleClick
|
|
187
|
+
}, /*#__PURE__*/_react.default.createElement("img", Object.assign({
|
|
188
|
+
ref: this.imgRef
|
|
189
|
+
}, restProps, {
|
|
190
|
+
src: this.isInGroup() && this.isLazyLoad() ? undefined : src,
|
|
191
|
+
"data-src": src,
|
|
192
|
+
alt: alt,
|
|
193
|
+
className: (0, _classnames.default)(`${prefixCls}-img`, {
|
|
194
|
+
[`${prefixCls}-img-preview`]: showPreviewCursor,
|
|
195
|
+
[`${prefixCls}-img-error`]: loadStatus === "error"
|
|
196
|
+
}),
|
|
197
|
+
width: width,
|
|
198
|
+
height: height,
|
|
199
|
+
crossOrigin: crossOrigin,
|
|
200
|
+
onError: this.handleError,
|
|
201
|
+
onLoad: this.handleLoaded
|
|
202
|
+
})), loadStatus !== "success" && this.renderExtra(), canPreview && /*#__PURE__*/_react.default.createElement(_previewInner.default, Object.assign({}, previewProps, {
|
|
203
|
+
src: previewSrc,
|
|
204
|
+
visible: previewVisible,
|
|
205
|
+
onVisibleChange: this.handlePreviewVisibleChange,
|
|
206
|
+
crossOrigin: !(0, _isUndefined2.default)(crossOrigin) ? crossOrigin : previewProps === null || previewProps === void 0 ? void 0 : previewProps.crossOrigin,
|
|
207
|
+
setDownloadName: setDownloadName
|
|
208
|
+
})));
|
|
214
209
|
}
|
|
215
210
|
}
|
|
216
211
|
exports.default = Image;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { BaseProps } from "_base/baseComponent";
|
|
3
|
+
import { RatioType } from '@douyinfe/semi-foundation/lib/cjs/image/previewInnerFoundation';
|
|
3
4
|
import React from "react";
|
|
5
|
+
export type { RatioType };
|
|
4
6
|
export interface ImageStates {
|
|
5
7
|
src: string;
|
|
6
8
|
loadStatus: "loading" | "success" | "error";
|
|
@@ -19,6 +21,7 @@ export interface ImageProps extends BaseProps {
|
|
|
19
21
|
crossOrigin?: "anonymous" | "use-credentials";
|
|
20
22
|
children?: ReactNode;
|
|
21
23
|
imageID?: number;
|
|
24
|
+
setDownloadName?: (src: string) => string;
|
|
22
25
|
}
|
|
23
26
|
export interface PreviewProps extends BaseProps {
|
|
24
27
|
visible?: boolean;
|
|
@@ -63,6 +66,7 @@ export interface PreviewProps extends BaseProps {
|
|
|
63
66
|
onRatioChange?: (type: RatioType) => void;
|
|
64
67
|
onRotateLeft?: (angle: number) => void;
|
|
65
68
|
onDownload?: (src: string, index: number) => void;
|
|
69
|
+
setDownloadName?: (src: string) => string;
|
|
66
70
|
}
|
|
67
71
|
export interface MenuProps {
|
|
68
72
|
min?: number;
|
|
@@ -84,7 +88,6 @@ export interface MenuProps {
|
|
|
84
88
|
onRotateLeft?: () => void;
|
|
85
89
|
onRotateRight?: () => void;
|
|
86
90
|
}
|
|
87
|
-
export type RatioType = "adaptation" | "realSize";
|
|
88
91
|
export interface PreviewInnerStates {
|
|
89
92
|
imgSrc?: string[];
|
|
90
93
|
imgLoadStatus?: Map<string, boolean>;
|
package/lib/cjs/image/preview.js
CHANGED
|
@@ -150,9 +150,10 @@ class Preview extends _baseComponent.default {
|
|
|
150
150
|
src,
|
|
151
151
|
className,
|
|
152
152
|
style,
|
|
153
|
-
lazyLoad
|
|
153
|
+
lazyLoad,
|
|
154
|
+
setDownloadName
|
|
154
155
|
} = _a,
|
|
155
|
-
restProps = __rest(_a, ["src", "className", "style", "lazyLoad"]);
|
|
156
|
+
restProps = __rest(_a, ["src", "className", "style", "lazyLoad", "setDownloadName"]);
|
|
156
157
|
const {
|
|
157
158
|
currentIndex,
|
|
158
159
|
visible
|
|
@@ -174,7 +175,8 @@ class Preview extends _baseComponent.default {
|
|
|
174
175
|
lazyLoad,
|
|
175
176
|
previewObserver: this.previewObserver,
|
|
176
177
|
setCurrentIndex: this.handleCurrentIndexChange,
|
|
177
|
-
handleVisibleChange: this.handleVisibleChange
|
|
178
|
+
handleVisibleChange: this.handleVisibleChange,
|
|
179
|
+
setDownloadName: setDownloadName
|
|
178
180
|
}
|
|
179
181
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
180
182
|
id: this.previewGroupId,
|
|
@@ -9,5 +9,6 @@ export interface PreviewContextProps {
|
|
|
9
9
|
previewObserver: IntersectionObserver;
|
|
10
10
|
setCurrentIndex: (current: number) => void;
|
|
11
11
|
handleVisibleChange: (visible: boolean, preVisible?: boolean) => void;
|
|
12
|
+
setDownloadName: (src: string) => string;
|
|
12
13
|
}
|
|
13
14
|
export declare const PreviewContext: import("react").Context<PreviewContextProps>;
|
|
@@ -49,7 +49,7 @@ export default class Footer extends BaseComponent<FooterProps> {
|
|
|
49
49
|
handleSlideChange: import("lodash").DebouncedFunc<(value: any) => void>;
|
|
50
50
|
handleRatioClick: () => void;
|
|
51
51
|
customRenderViewMenu: () => ReactNode;
|
|
52
|
-
getFinalIconElement: (element: ReactNode, content: ReactNode) => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
52
|
+
getFinalIconElement: (element: ReactNode, content: ReactNode, key: string) => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
53
53
|
getLocalTextByKey: (key: string) => JSX.Element;
|
|
54
54
|
getIconChevronLeft: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
55
55
|
getIconChevronRight: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
@@ -58,5 +58,9 @@ export default class Footer extends BaseComponent<FooterProps> {
|
|
|
58
58
|
getIconRatio: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
59
59
|
getIconRotate: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
60
60
|
getIconDownload: () => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
61
|
+
getNumberInfo: () => JSX.Element;
|
|
62
|
+
getSlider: () => JSX.Element;
|
|
63
|
+
getMenu: () => (string | number | boolean | React.ReactFragment | JSX.Element)[];
|
|
64
|
+
getFooterMenu: () => (string | number | boolean | React.ReactFragment | JSX.Element)[];
|
|
61
65
|
render(): JSX.Element;
|
|
62
66
|
}
|
|
@@ -88,18 +88,20 @@ class Footer extends _baseComponent.default {
|
|
|
88
88
|
disabledZoomOut: zoom === min,
|
|
89
89
|
onRatioClick: this.handleRatioClick,
|
|
90
90
|
onZoomIn: this.handlePlusClick,
|
|
91
|
-
onZoomOut: this.handleMinusClick
|
|
91
|
+
onZoomOut: this.handleMinusClick,
|
|
92
|
+
menuItems: this.getMenu()
|
|
92
93
|
};
|
|
93
94
|
return renderPreviewMenu(props);
|
|
94
95
|
};
|
|
95
96
|
// According to showTooltip in props, decide whether to use Tooltip to pack a layer
|
|
96
97
|
// 根据 props 中的 showTooltip 决定是否使用 Tooltip 包一层
|
|
97
|
-
this.getFinalIconElement = (element, content) => {
|
|
98
|
+
this.getFinalIconElement = (element, content, key) => {
|
|
98
99
|
const {
|
|
99
100
|
showTooltip
|
|
100
101
|
} = this.props;
|
|
101
102
|
return showTooltip ? /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
102
|
-
content: content
|
|
103
|
+
content: content,
|
|
104
|
+
key: `tooltip-${key}`
|
|
103
105
|
}, element) : element;
|
|
104
106
|
};
|
|
105
107
|
this.getLocalTextByKey = key => /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
|
|
@@ -112,12 +114,13 @@ class Footer extends _baseComponent.default {
|
|
|
112
114
|
prevTip
|
|
113
115
|
} = this.props;
|
|
114
116
|
const icon = /*#__PURE__*/_react.default.createElement(_semiIcons.IconChevronLeft, {
|
|
117
|
+
key: "chevron-left",
|
|
115
118
|
size: "large",
|
|
116
119
|
className: disabledPrev ? `${footerPrefixCls}-disabled` : "",
|
|
117
120
|
onClick: !disabledPrev ? onPrev : undefined
|
|
118
121
|
});
|
|
119
122
|
const content = prevTip !== null && prevTip !== void 0 ? prevTip : this.getLocalTextByKey("prevTip");
|
|
120
|
-
return this.getFinalIconElement(icon, content);
|
|
123
|
+
return this.getFinalIconElement(icon, content, 'chevron-left');
|
|
121
124
|
};
|
|
122
125
|
this.getIconChevronRight = () => {
|
|
123
126
|
const {
|
|
@@ -126,12 +129,13 @@ class Footer extends _baseComponent.default {
|
|
|
126
129
|
nextTip
|
|
127
130
|
} = this.props;
|
|
128
131
|
const icon = /*#__PURE__*/_react.default.createElement(_semiIcons.IconChevronRight, {
|
|
132
|
+
key: "chevron-right",
|
|
129
133
|
size: "large",
|
|
130
134
|
className: disabledNext ? `${footerPrefixCls}-disabled` : "",
|
|
131
135
|
onClick: !disabledNext ? onNext : undefined
|
|
132
136
|
});
|
|
133
137
|
const content = nextTip !== null && nextTip !== void 0 ? nextTip : this.getLocalTextByKey("nextTip");
|
|
134
|
-
return this.getFinalIconElement(icon, content);
|
|
138
|
+
return this.getFinalIconElement(icon, content, 'chevron-right');
|
|
135
139
|
};
|
|
136
140
|
this.getIconMinus = () => {
|
|
137
141
|
const {
|
|
@@ -141,12 +145,13 @@ class Footer extends _baseComponent.default {
|
|
|
141
145
|
} = this.props;
|
|
142
146
|
const disabledZoomOut = zoom === min;
|
|
143
147
|
const icon = /*#__PURE__*/_react.default.createElement(_semiIcons.IconMinus, {
|
|
148
|
+
key: "minus",
|
|
144
149
|
size: "large",
|
|
145
150
|
onClick: !disabledZoomOut ? this.handleMinusClick : undefined,
|
|
146
151
|
className: disabledZoomOut ? `${footerPrefixCls}-disabled` : ""
|
|
147
152
|
});
|
|
148
153
|
const content = zoomOutTip !== null && zoomOutTip !== void 0 ? zoomOutTip : this.getLocalTextByKey("zoomOutTip");
|
|
149
|
-
return this.getFinalIconElement(icon, content);
|
|
154
|
+
return this.getFinalIconElement(icon, content, 'minus');
|
|
150
155
|
};
|
|
151
156
|
this.getIconPlus = () => {
|
|
152
157
|
const {
|
|
@@ -156,12 +161,13 @@ class Footer extends _baseComponent.default {
|
|
|
156
161
|
} = this.props;
|
|
157
162
|
const disabledZoomIn = zoom === max;
|
|
158
163
|
const icon = /*#__PURE__*/_react.default.createElement(_semiIcons.IconPlus, {
|
|
164
|
+
key: "plus",
|
|
159
165
|
size: "large",
|
|
160
166
|
onClick: !disabledZoomIn ? this.handlePlusClick : undefined,
|
|
161
167
|
className: disabledZoomIn ? `${footerPrefixCls}-disabled` : ""
|
|
162
168
|
});
|
|
163
169
|
const content = zoomInTip !== null && zoomInTip !== void 0 ? zoomInTip : this.getLocalTextByKey("zoomInTip");
|
|
164
|
-
return this.getFinalIconElement(icon, content);
|
|
170
|
+
return this.getFinalIconElement(icon, content, 'plus');
|
|
165
171
|
};
|
|
166
172
|
this.getIconRatio = () => {
|
|
167
173
|
const {
|
|
@@ -170,6 +176,7 @@ class Footer extends _baseComponent.default {
|
|
|
170
176
|
adaptiveTip
|
|
171
177
|
} = this.props;
|
|
172
178
|
const props = {
|
|
179
|
+
key: "ratio",
|
|
173
180
|
size: "large",
|
|
174
181
|
className: (0, _classnames.default)(`${footerPrefixCls}-gap`),
|
|
175
182
|
onClick: this.handleRatioClick
|
|
@@ -181,18 +188,19 @@ class Footer extends _baseComponent.default {
|
|
|
181
188
|
} else {
|
|
182
189
|
content = adaptiveTip !== null && adaptiveTip !== void 0 ? adaptiveTip : this.getLocalTextByKey("adaptiveTip");
|
|
183
190
|
}
|
|
184
|
-
return this.getFinalIconElement(icon, content);
|
|
191
|
+
return this.getFinalIconElement(icon, content, 'ratio');
|
|
185
192
|
};
|
|
186
193
|
this.getIconRotate = () => {
|
|
187
194
|
const {
|
|
188
195
|
rotateTip
|
|
189
196
|
} = this.props;
|
|
190
197
|
const icon = /*#__PURE__*/_react.default.createElement(_semiIcons.IconRotate, {
|
|
198
|
+
key: "rotate",
|
|
191
199
|
size: "large",
|
|
192
200
|
onClick: this.handleRotateLeft
|
|
193
201
|
});
|
|
194
202
|
const content = rotateTip !== null && rotateTip !== void 0 ? rotateTip : this.getLocalTextByKey("rotateTip");
|
|
195
|
-
return this.getFinalIconElement(icon, content);
|
|
203
|
+
return this.getFinalIconElement(icon, content, 'rotate');
|
|
196
204
|
};
|
|
197
205
|
this.getIconDownload = () => {
|
|
198
206
|
const {
|
|
@@ -201,6 +209,7 @@ class Footer extends _baseComponent.default {
|
|
|
201
209
|
disableDownload
|
|
202
210
|
} = this.props;
|
|
203
211
|
const icon = /*#__PURE__*/_react.default.createElement(_semiIcons.IconDownload, {
|
|
212
|
+
key: 'download',
|
|
204
213
|
size: "large",
|
|
205
214
|
onClick: !disableDownload ? onDownload : undefined,
|
|
206
215
|
className: (0, _classnames.default)(`${footerPrefixCls}-gap`, {
|
|
@@ -208,44 +217,63 @@ class Footer extends _baseComponent.default {
|
|
|
208
217
|
})
|
|
209
218
|
});
|
|
210
219
|
const content = downloadTip !== null && downloadTip !== void 0 ? downloadTip : this.getLocalTextByKey("downloadTip");
|
|
211
|
-
return this.getFinalIconElement(icon, content);
|
|
220
|
+
return this.getFinalIconElement(icon, content, 'download');
|
|
221
|
+
};
|
|
222
|
+
this.getNumberInfo = () => {
|
|
223
|
+
const {
|
|
224
|
+
curPage,
|
|
225
|
+
totalNum
|
|
226
|
+
} = this.props;
|
|
227
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
228
|
+
className: `${footerPrefixCls}-page`,
|
|
229
|
+
key: 'info'
|
|
230
|
+
}, curPage, "/", totalNum);
|
|
231
|
+
};
|
|
232
|
+
this.getSlider = () => {
|
|
233
|
+
const {
|
|
234
|
+
zoom,
|
|
235
|
+
min,
|
|
236
|
+
max,
|
|
237
|
+
step,
|
|
238
|
+
showTooltip
|
|
239
|
+
} = this.props;
|
|
240
|
+
return /*#__PURE__*/_react.default.createElement(_slider.default, {
|
|
241
|
+
key: 'slider',
|
|
242
|
+
value: zoom,
|
|
243
|
+
min: min,
|
|
244
|
+
max: max,
|
|
245
|
+
step: step,
|
|
246
|
+
tipFormatter: v => `${v}%`,
|
|
247
|
+
tooltipVisible: showTooltip ? undefined : false,
|
|
248
|
+
onChange: this.handleSlideChange
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
this.getMenu = () => [this.getIconChevronLeft(), this.getNumberInfo(), this.getIconChevronRight(), this.getIconMinus(), this.getSlider(), this.getIconPlus(), this.getIconRatio(), this.getIconRotate(), this.getIconDownload()];
|
|
252
|
+
this.getFooterMenu = () => {
|
|
253
|
+
const menuItems = this.getMenu();
|
|
254
|
+
menuItems.splice(3, 0, /*#__PURE__*/_react.default.createElement(_divider.default, {
|
|
255
|
+
layout: "vertical",
|
|
256
|
+
key: "divider-first"
|
|
257
|
+
}));
|
|
258
|
+
menuItems.splice(8, 0, /*#__PURE__*/_react.default.createElement(_divider.default, {
|
|
259
|
+
layout: "vertical",
|
|
260
|
+
key: "divider-second"
|
|
261
|
+
}));
|
|
262
|
+
return menuItems;
|
|
212
263
|
};
|
|
213
264
|
this.foundation = new _previewFooterFoundation.default(this.adapter);
|
|
214
265
|
}
|
|
215
266
|
render() {
|
|
216
267
|
const {
|
|
217
|
-
min,
|
|
218
|
-
max,
|
|
219
|
-
step,
|
|
220
|
-
curPage,
|
|
221
|
-
totalNum,
|
|
222
|
-
zoom,
|
|
223
|
-
showTooltip,
|
|
224
268
|
className,
|
|
225
269
|
renderPreviewMenu
|
|
226
270
|
} = this.props;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}, this.customRenderViewMenu());
|
|
231
|
-
}
|
|
271
|
+
const menuCls = (0, _classnames.default)(footerPrefixCls, `${footerPrefixCls}-wrapper`, className, {
|
|
272
|
+
[`${footerPrefixCls}-content`]: !Boolean(renderPreviewMenu)
|
|
273
|
+
});
|
|
232
274
|
return /*#__PURE__*/_react.default.createElement("section", {
|
|
233
|
-
className:
|
|
234
|
-
}, this.
|
|
235
|
-
className: `${footerPrefixCls}-page`
|
|
236
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, curPage), /*#__PURE__*/_react.default.createElement("span", null, "/"), /*#__PURE__*/_react.default.createElement("span", null, totalNum)), this.getIconChevronRight(), /*#__PURE__*/_react.default.createElement(_divider.default, {
|
|
237
|
-
layout: "vertical"
|
|
238
|
-
}), this.getIconMinus(), /*#__PURE__*/_react.default.createElement(_slider.default, {
|
|
239
|
-
value: zoom,
|
|
240
|
-
min: min,
|
|
241
|
-
max: max,
|
|
242
|
-
step: step,
|
|
243
|
-
tipFormatter: v => `${v}%`,
|
|
244
|
-
tooltipVisible: showTooltip ? undefined : false,
|
|
245
|
-
onChange: this.handleSlideChange
|
|
246
|
-
}), this.getIconPlus(), this.getIconRatio(), /*#__PURE__*/_react.default.createElement(_divider.default, {
|
|
247
|
-
layout: "vertical"
|
|
248
|
-
}), this.getIconRotate(), this.getIconDownload());
|
|
275
|
+
className: menuCls
|
|
276
|
+
}, renderPreviewMenu ? this.customRenderViewMenu() : this.getFooterMenu());
|
|
249
277
|
}
|
|
250
278
|
}
|
|
251
279
|
exports.default = Footer;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import BaseComponent from "../_base/baseComponent";
|
|
3
3
|
import { PreviewProps as PreviewInnerProps, PreviewInnerStates } from "./interface";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import PreviewInnerFoundation, { PreviewInnerAdapter } from '@douyinfe/semi-foundation/lib/cjs/image/previewInnerFoundation';
|
|
5
|
+
import PreviewInnerFoundation, { PreviewInnerAdapter, RatioType } from '@douyinfe/semi-foundation/lib/cjs/image/previewInnerFoundation';
|
|
6
6
|
import { PreviewContextProps } from "./previewContext";
|
|
7
7
|
export default class PreviewInner extends BaseComponent<PreviewInnerProps, PreviewInnerStates> {
|
|
8
8
|
static contextType: React.Context<PreviewContextProps>;
|
|
@@ -77,7 +77,7 @@ export default class PreviewInner extends BaseComponent<PreviewInnerProps, Previ
|
|
|
77
77
|
handleSwitchImage: (direction: string) => void;
|
|
78
78
|
handleDownload: () => void;
|
|
79
79
|
handlePreviewClose: () => void;
|
|
80
|
-
handleAdjustRatio: (type:
|
|
80
|
+
handleAdjustRatio: (type: RatioType) => void;
|
|
81
81
|
handleRotateImage: (direction: any) => void;
|
|
82
82
|
handleZoomImage: (newZoom: number) => void;
|
|
83
83
|
handleMouseUp: (e: any) => void;
|
|
@@ -19,8 +19,6 @@ var _previewImage = _interopRequireDefault(require("./previewImage"));
|
|
|
19
19
|
var _previewInnerFoundation = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/image/previewInnerFoundation"));
|
|
20
20
|
var _previewContext = require("./previewContext");
|
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
23
|
-
|
|
24
22
|
const prefixCls = _constants.cssClasses.PREFIX;
|
|
25
23
|
let startMouseDown = {
|
|
26
24
|
x: 0,
|
|
@@ -133,6 +131,10 @@ class PreviewInner extends _baseComponent.default {
|
|
|
133
131
|
},
|
|
134
132
|
setMouseActiveTime: time => {
|
|
135
133
|
mouseActiveTime = time;
|
|
134
|
+
},
|
|
135
|
+
getSetDownloadFunc: () => {
|
|
136
|
+
var _a, _b;
|
|
137
|
+
return (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.setDownloadName) !== null && _b !== void 0 ? _b : this.props.setDownloadName;
|
|
136
138
|
}
|
|
137
139
|
});
|
|
138
140
|
}
|
package/lib/cjs/input/index.js
CHANGED
|
@@ -26,8 +26,6 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
26
26
|
}
|
|
27
27
|
return t;
|
|
28
28
|
};
|
|
29
|
-
/* eslint-disable no-unused-vars, max-len, @typescript-eslint/no-unused-vars */
|
|
30
|
-
|
|
31
29
|
const prefixCls = _constants.cssClasses.PREFIX;
|
|
32
30
|
const sizeSet = _constants.strings.SIZE;
|
|
33
31
|
const statusSet = _constants.strings.STATUS;
|
|
@@ -22,13 +22,10 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
22
22
|
}
|
|
23
23
|
return t;
|
|
24
24
|
};
|
|
25
|
-
/* eslint-disable max-len */
|
|
26
|
-
|
|
27
25
|
const prefixCls = _constants.cssClasses.PREFIX;
|
|
28
26
|
const sizeSet = _constants.strings.SIZE;
|
|
29
27
|
class inputGroup extends _baseComponent.default {
|
|
30
28
|
renderGroupWithLabel(inner) {
|
|
31
|
-
// eslint-disable-next-line no-unused-vars
|
|
32
29
|
const _a = this.props,
|
|
33
30
|
{
|
|
34
31
|
size,
|
|
@@ -29,11 +29,7 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
29
29
|
return t;
|
|
30
30
|
};
|
|
31
31
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
32
|
-
|
|
33
|
-
/* eslint-disable no-unused-vars */
|
|
34
|
-
/* eslint-disable max-depth */
|
|
35
|
-
/* eslint-disable react/no-did-update-set-state */
|
|
36
|
-
/* eslint-disable max-len */
|
|
32
|
+
|
|
37
33
|
class InputNumber extends _baseComponent.default {
|
|
38
34
|
get adapter() {
|
|
39
35
|
var _this = this;
|
|
@@ -21,8 +21,6 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
21
21
|
}
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
|
-
/* eslint-disable react/destructuring-assignment */
|
|
25
|
-
/* eslint-disable eqeqeq */
|
|
26
24
|
const ConfirmModal = props => {
|
|
27
25
|
const [visible, setVisible] = (0, _react.useState)(true);
|
|
28
26
|
const [confirmLoading, setConfirmLoading] = (0, _react.useState)();
|
package/lib/cjs/modal/Modal.js
CHANGED
|
@@ -30,8 +30,6 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
30
30
|
}
|
|
31
31
|
return t;
|
|
32
32
|
};
|
|
33
|
-
/* eslint-disable react/destructuring-assignment, prefer-const, @typescript-eslint/no-unused-vars */
|
|
34
|
-
|
|
35
33
|
const destroyFns = [];
|
|
36
34
|
exports.destroyFns = destroyFns;
|
|
37
35
|
class Modal extends _baseComponent.default {
|
|
@@ -27,10 +27,6 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
27
27
|
}
|
|
28
28
|
return t;
|
|
29
29
|
};
|
|
30
|
-
/* eslint-disable eqeqeq */
|
|
31
|
-
|
|
32
|
-
// eslint-disable-next-line max-len
|
|
33
|
-
|
|
34
30
|
let uuid = 0;
|
|
35
31
|
class ModalContent extends _baseComponent.default {
|
|
36
32
|
constructor(props) {
|
|
@@ -317,7 +313,6 @@ class ModalContent extends _baseComponent.default {
|
|
|
317
313
|
onClick: maskClosable ? this.onMaskClick : null,
|
|
318
314
|
onMouseUp: maskClosable ? this.onMaskMouseUp : null
|
|
319
315
|
}, this.props.contentExtraProps), this.getDialogElement()));
|
|
320
|
-
// eslint-disable-next-line max-len
|
|
321
316
|
return containerContext && containerContext.Provider ? /*#__PURE__*/_react.default.createElement(containerContext.Provider, {
|
|
322
317
|
value: containerContext.value
|
|
323
318
|
}, elem) : elem;
|