@selfcommunity/react-ui 0.8.1-alpha.4 → 0.9.0-alpha.1
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/lib/cjs/components/CreateEventButton/CreateEventButton.d.ts +2 -2
- package/lib/cjs/components/CreateEventButton/CreateEventButton.js +4 -4
- package/lib/cjs/components/EditEventButton/EditEventButton.js +1 -1
- package/lib/cjs/components/EventForm/EventForm.d.ts +7 -12
- package/lib/cjs/components/EventForm/EventForm.js +55 -55
- package/lib/cjs/components/EventFormDialog/EventFormDialog.d.ts +48 -0
- package/lib/cjs/components/EventFormDialog/EventFormDialog.js +56 -0
- package/lib/cjs/components/EventFormDialog/constants.d.ts +1 -0
- package/lib/cjs/components/EventFormDialog/constants.js +4 -0
- package/lib/cjs/components/EventFormDialog/index.d.ts +3 -0
- package/lib/cjs/components/EventFormDialog/index.js +5 -0
- package/lib/cjs/components/EventMediaWidget/EventMediaWidget.d.ts +37 -0
- package/lib/cjs/components/EventMediaWidget/EventMediaWidget.js +242 -0
- package/lib/cjs/components/EventMediaWidget/Skeleton.d.ts +2 -0
- package/lib/cjs/components/EventMediaWidget/Skeleton.js +28 -0
- package/lib/cjs/components/EventMediaWidget/TriggerButton.d.ts +17 -0
- package/lib/cjs/components/EventMediaWidget/TriggerButton.js +66 -0
- package/lib/cjs/components/EventMediaWidget/asUploadButton.d.ts +7 -0
- package/lib/cjs/components/EventMediaWidget/asUploadButton.js +25 -0
- package/lib/cjs/components/EventMediaWidget/constants.d.ts +1 -0
- package/lib/cjs/components/EventMediaWidget/constants.js +4 -0
- package/lib/cjs/components/EventMediaWidget/index.d.ts +4 -0
- package/lib/cjs/components/EventMediaWidget/index.js +8 -0
- package/lib/cjs/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +1 -3
- package/lib/cjs/index.d.ts +8 -5
- package/lib/cjs/index.js +18 -13
- package/lib/cjs/shared/Lightbox/BaseLightbox.d.ts +19 -0
- package/lib/cjs/shared/Lightbox/BaseLightbox.js +35 -0
- package/lib/cjs/shared/Lightbox/Lightbox.d.ts +31 -17
- package/lib/cjs/shared/Lightbox/Lightbox.js +16 -19
- package/lib/cjs/shared/Lightbox/constants.d.ts +1 -0
- package/lib/cjs/shared/Lightbox/constants.js +4 -0
- package/lib/cjs/shared/Lightbox/index.d.ts +4 -2
- package/lib/cjs/shared/Lightbox/index.js +4 -1
- package/lib/cjs/shared/Media/File/DisplayComponent.js +23 -6
- package/lib/cjs/shared/MediaChunkUploader/index.js +13 -11
- package/lib/cjs/utils/hash.d.ts +2 -1
- package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +2 -2
- package/lib/esm/components/CreateEventButton/CreateEventButton.js +4 -4
- package/lib/esm/components/EditEventButton/EditEventButton.js +1 -1
- package/lib/esm/components/EventForm/EventForm.d.ts +7 -12
- package/lib/esm/components/EventForm/EventForm.js +56 -56
- package/lib/esm/components/EventFormDialog/EventFormDialog.d.ts +48 -0
- package/lib/esm/components/EventFormDialog/EventFormDialog.js +53 -0
- package/lib/esm/components/EventFormDialog/constants.d.ts +1 -0
- package/lib/esm/components/EventFormDialog/constants.js +1 -0
- package/lib/esm/components/EventFormDialog/index.d.ts +3 -0
- package/lib/esm/components/EventFormDialog/index.js +2 -0
- package/lib/esm/components/EventMediaWidget/EventMediaWidget.d.ts +37 -0
- package/lib/esm/components/EventMediaWidget/EventMediaWidget.js +239 -0
- package/lib/esm/components/EventMediaWidget/Skeleton.d.ts +2 -0
- package/lib/esm/components/EventMediaWidget/Skeleton.js +22 -0
- package/lib/esm/components/EventMediaWidget/TriggerButton.d.ts +17 -0
- package/lib/esm/components/EventMediaWidget/TriggerButton.js +64 -0
- package/lib/esm/components/EventMediaWidget/asUploadButton.d.ts +7 -0
- package/lib/esm/components/EventMediaWidget/asUploadButton.js +23 -0
- package/lib/esm/components/EventMediaWidget/constants.d.ts +1 -0
- package/lib/esm/components/EventMediaWidget/constants.js +1 -0
- package/lib/esm/components/EventMediaWidget/index.d.ts +4 -0
- package/lib/esm/components/EventMediaWidget/index.js +4 -0
- package/lib/esm/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +1 -3
- package/lib/esm/index.d.ts +8 -5
- package/lib/esm/index.js +10 -8
- package/lib/esm/shared/Lightbox/BaseLightbox.d.ts +19 -0
- package/lib/esm/shared/Lightbox/BaseLightbox.js +33 -0
- package/lib/esm/shared/Lightbox/Lightbox.d.ts +31 -17
- package/lib/esm/shared/Lightbox/Lightbox.js +15 -19
- package/lib/esm/shared/Lightbox/constants.d.ts +1 -0
- package/lib/esm/shared/Lightbox/constants.js +1 -0
- package/lib/esm/shared/Lightbox/index.d.ts +4 -2
- package/lib/esm/shared/Lightbox/index.js +3 -1
- package/lib/esm/shared/Media/File/DisplayComponent.js +23 -6
- package/lib/esm/shared/MediaChunkUploader/index.js +14 -12
- package/lib/esm/utils/hash.d.ts +2 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
- package/lib/cjs/shared/Media/File/Lightbox/index.d.ts +0 -28
- package/lib/cjs/shared/Media/File/Lightbox/index.js +0 -37
- package/lib/esm/shared/Media/File/Lightbox/index.d.ts +0 -28
- package/lib/esm/shared/Media/File/Lightbox/index.js +0 -34
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
-
import { useChunkFinishListener, useChunkStartListener, useItemErrorListener, useItemFinishListener, useRequestPreSend
|
|
2
|
+
import { useChunkFinishListener, useChunkStartListener, useItemErrorListener, useItemFinishListener, useRequestPreSend } from '@rpldy/chunked-uploady';
|
|
3
|
+
import { useItemProgressListener, useItemStartListener } from '@rpldy/uploady';
|
|
3
4
|
import { Endpoints, http } from '@selfcommunity/api-services';
|
|
4
5
|
import { useSCContext, useSCUser } from '@selfcommunity/react-core';
|
|
5
|
-
import {
|
|
6
|
-
import { md5 } from '../../utils/hash';
|
|
6
|
+
import { Logger, resizeImage } from '@selfcommunity/utils';
|
|
7
7
|
import React, { useEffect, useRef, useState } from 'react';
|
|
8
8
|
import { useIntl } from 'react-intl';
|
|
9
|
-
import messages from '../../messages/common';
|
|
10
|
-
import { Logger, resizeImage } from '@selfcommunity/utils';
|
|
11
9
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
10
|
+
import messages from '../../messages/common';
|
|
11
|
+
import { md5 } from '../../utils/hash';
|
|
12
12
|
export default (props) => {
|
|
13
13
|
// PROPS
|
|
14
14
|
const { type = null, onSuccess = null, onProgress = null, onError = null } = props;
|
|
@@ -53,7 +53,7 @@ export default (props) => {
|
|
|
53
53
|
// @ts-ignore
|
|
54
54
|
reader.readAsDataURL(item.file);
|
|
55
55
|
}
|
|
56
|
-
chunkStateRef.current.setChunk({ id: item.id, [
|
|
56
|
+
chunkStateRef.current.setChunk({ id: item.id, ['upload_id']: null, completed: 0, name: item.file.name });
|
|
57
57
|
});
|
|
58
58
|
useItemProgressListener((item) => {
|
|
59
59
|
chunkStateRef.current.setChunk({ id: item.id, completed: item.completed });
|
|
@@ -100,7 +100,7 @@ export default (props) => {
|
|
|
100
100
|
sendOptions: {
|
|
101
101
|
paramName: 'image',
|
|
102
102
|
method: Endpoints.ComposerChunkUploadMedia.method,
|
|
103
|
-
formatServerResponse: (response, status,
|
|
103
|
+
formatServerResponse: (response, status, _headers) => __awaiter(void 0, void 0, void 0, function* () {
|
|
104
104
|
if (status === 401) {
|
|
105
105
|
yield refreshSession();
|
|
106
106
|
}
|
|
@@ -109,7 +109,7 @@ export default (props) => {
|
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
if (chunkStateRef.current.chunks[data.item.id].upload_id) {
|
|
112
|
-
res.sendOptions.params = { [
|
|
112
|
+
res.sendOptions.params = { ['upload_id']: chunkStateRef.current.chunks[data.item.id].upload_id };
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
115
|
chunkStateRef.current.setChunk({ id: data.item.id, type: type || data.sendOptions.paramName });
|
|
@@ -118,12 +118,14 @@ export default (props) => {
|
|
|
118
118
|
});
|
|
119
119
|
useChunkFinishListener((data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
120
|
const _data = yield data.uploadData.response.data;
|
|
121
|
-
chunkStateRef.current.setChunk({ id: data.item.id, [
|
|
121
|
+
chunkStateRef.current.setChunk({ id: data.item.id, ['upload_id']: _data.upload_id });
|
|
122
122
|
}));
|
|
123
123
|
useRequestPreSend(({ items, options }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
|
-
const destination = ['JWT', 'OAuth'].includes(scContext.settings.session.type)
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
const destination = ['JWT', 'OAuth'].includes(scContext.settings.session.type)
|
|
125
|
+
? {
|
|
126
|
+
headers: { Authorization: `Bearer ${scContext.settings.session.authToken.accessToken}` }
|
|
127
|
+
}
|
|
128
|
+
: {};
|
|
127
129
|
if (items.length == 0) {
|
|
128
130
|
return Promise.resolve({ options, destination });
|
|
129
131
|
}
|
package/lib/esm/utils/hash.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { BatchFile } from '@rpldy/shared';
|
|
2
|
+
export declare const md5: (file: BatchFile['file'], chunkSize: number, callback: (arg: any) => void) => void;
|