@dreamcommerce/aurora 2.6.0-6 → 2.6.0-8
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/build/cjs/packages/aurora/src/components/xhr_image_picker/index.js +2 -2
- package/build/esm/packages/aurora/src/components/controls/types.d.ts +1 -1
- package/build/esm/packages/aurora/src/components/image_picker/types.d.ts +1 -1
- package/build/esm/packages/aurora/src/components/xhr_image_picker/index.js +2 -2
- package/build/esm/packages/aurora/src/components/xhr_image_picker/types.d.ts +2 -2
- package/build/esm/packages/aurora/src/components/xhr_image_picker/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,14 +14,14 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
14
14
|
|
|
15
15
|
const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, allowedExtensions = [constants.FILES_EXTENSIONS.WEBP, constants.FILES_EXTENSIONS.JPG, constants.FILES_EXTENSIONS.PNG, constants.FILES_EXTENSIONS.GIF, constants.FILES_EXTENSIONS.SVG] }) => {
|
|
16
16
|
const httpApi = use_http_api.useHttpApi();
|
|
17
|
-
const onChange = async (fileList) => {
|
|
17
|
+
const onChange = async (fileList, size) => {
|
|
18
18
|
const { response } = httpApi.fetch({
|
|
19
19
|
url,
|
|
20
20
|
method: http_requester_contants.REQUEST_TYPES.post,
|
|
21
21
|
data: fileList[0]
|
|
22
22
|
});
|
|
23
23
|
const data = await response;
|
|
24
|
-
onUploaded === null || onUploaded === void 0 ? void 0 : onUploaded(data, fileList[0]);
|
|
24
|
+
onUploaded === null || onUploaded === void 0 ? void 0 : onUploaded(data, fileList[0], size);
|
|
25
25
|
};
|
|
26
26
|
return (React__default['default'].createElement(index['default'], { id: id, name: name, onChange: onChange, errors: errors, allowedExtensions: allowedExtensions, initialFile: initialFile }));
|
|
27
27
|
};
|
|
@@ -177,7 +177,7 @@ export interface IControlXhrImagePicker extends IFilePicker, IControlCommonProps
|
|
|
177
177
|
isRequired?: boolean;
|
|
178
178
|
onChange?: (fileList: FileList | null, size?: TImageSize) => void;
|
|
179
179
|
labelAdditionalInfo?: string | ReactNode;
|
|
180
|
-
onUploaded?: (resp: IRequestResponse<any>, file: File) => void;
|
|
180
|
+
onUploaded?: (resp: IRequestResponse<any>, file: File, size: TImageSize) => void;
|
|
181
181
|
}
|
|
182
182
|
export interface ICellSelector {
|
|
183
183
|
rows?: number;
|
|
@@ -4,7 +4,7 @@ export declare type TImagePickerFile = {
|
|
|
4
4
|
fileUrl: string;
|
|
5
5
|
fileName: string;
|
|
6
6
|
};
|
|
7
|
-
export interface IImagePicker extends IFilePicker {
|
|
7
|
+
export interface IImagePicker extends Omit<IFilePicker, 'onChange'> {
|
|
8
8
|
onChange?: (fileList: FileList | null, size?: TImageSize) => void;
|
|
9
9
|
}
|
|
10
10
|
export interface ISelectedImagePreview {
|
|
@@ -6,14 +6,14 @@ import { useHttpApi } from '../../hooks/use_http_api.js';
|
|
|
6
6
|
|
|
7
7
|
const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, allowedExtensions = [FILES_EXTENSIONS.WEBP, FILES_EXTENSIONS.JPG, FILES_EXTENSIONS.PNG, FILES_EXTENSIONS.GIF, FILES_EXTENSIONS.SVG] }) => {
|
|
8
8
|
const httpApi = useHttpApi();
|
|
9
|
-
const onChange = async (fileList) => {
|
|
9
|
+
const onChange = async (fileList, size) => {
|
|
10
10
|
const { response } = httpApi.fetch({
|
|
11
11
|
url,
|
|
12
12
|
method: REQUEST_TYPES.post,
|
|
13
13
|
data: fileList[0]
|
|
14
14
|
});
|
|
15
15
|
const data = await response;
|
|
16
|
-
onUploaded === null || onUploaded === void 0 ? void 0 : onUploaded(data, fileList[0]);
|
|
16
|
+
onUploaded === null || onUploaded === void 0 ? void 0 : onUploaded(data, fileList[0], size);
|
|
17
17
|
};
|
|
18
18
|
return (React.createElement(ImagePicker, { id: id, name: name, onChange: onChange, errors: errors, allowedExtensions: allowedExtensions, initialFile: initialFile }));
|
|
19
19
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IImagePicker } from "../image_picker/types";
|
|
1
|
+
import { IImagePicker, TImageSize } from "../image_picker/types";
|
|
2
2
|
import { IRequestResponse } from '@dreamcommerce/star_core';
|
|
3
3
|
export interface IXhrImagePickerProps extends IImagePicker {
|
|
4
4
|
url: string;
|
|
5
|
-
onUploaded?: (resp: IRequestResponse<any>, file: File) => void;
|
|
5
|
+
onUploaded?: (resp: IRequestResponse<any>, file: File, size: TImageSize) => void;
|
|
6
6
|
onUploadError?: Function;
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/components/xhr_image_picker/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/components/xhr_image_picker/types.ts"],"names":[],"mappings":"AAAA,OAAyC,sCAAsC,CAAC;AAChF,OAAiC,0BAA0B,CAAC"}
|