@imposium-hub/components 2.5.10-8 → 2.5.10
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/cjs/components/app-wrapper/AppWrapper.js +5 -2
- package/dist/cjs/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.d.ts +27 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.js +243 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.js.map +1 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.d.ts +28 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.js +255 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.js.map +1 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.d.ts +27 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.js +243 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.js.map +1 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.d.ts +28 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.js +251 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.js.map +1 -0
- package/dist/cjs/components/assets/AssetsTableNameCell.js +2 -2
- package/dist/cjs/components/assets/AssetsTableNameCell.js.map +1 -1
- package/dist/cjs/components/assets/AssetsTypeIcon.js +2 -0
- package/dist/cjs/components/assets/AssetsTypeIcon.js.map +1 -1
- package/dist/cjs/components/card/Card.d.ts +0 -1
- package/dist/cjs/components/card/Card.js +4 -17
- package/dist/cjs/components/card/Card.js.map +1 -1
- package/dist/cjs/components/confirm-modal/ConfirmModal.d.ts +9 -9
- package/dist/cjs/components/confirm-modal/ConfirmModal.js +108 -12
- package/dist/cjs/components/confirm-modal/ConfirmModal.js.map +1 -1
- package/dist/cjs/components/data-table/Paginator.js +7 -51
- package/dist/cjs/components/data-table/Paginator.js.map +1 -1
- package/dist/cjs/components/error-message-preview/ErrorMessagePreview.d.ts +15 -0
- package/dist/cjs/components/error-message-preview/ErrorMessagePreview.js +91 -0
- package/dist/cjs/components/error-message-preview/ErrorMessagePreview.js.map +1 -0
- package/dist/cjs/components/header/Header_BACKUP_73021.d.ts +33 -0
- package/dist/cjs/components/header/Header_BACKUP_73021.js +393 -0
- package/dist/cjs/components/header/Header_BACKUP_73021.js.map +1 -0
- package/dist/cjs/components/header/Header_BASE_73021.d.ts +29 -0
- package/dist/cjs/components/header/Header_BASE_73021.js +376 -0
- package/dist/cjs/components/header/Header_BASE_73021.js.map +1 -0
- package/dist/cjs/components/header/Header_LOCAL_73021.d.ts +33 -0
- package/dist/cjs/components/header/Header_LOCAL_73021.js +382 -0
- package/dist/cjs/components/header/Header_LOCAL_73021.js.map +1 -0
- package/dist/cjs/components/header/Header_REMOTE_73021.d.ts +30 -0
- package/dist/cjs/components/header/Header_REMOTE_73021.js +386 -0
- package/dist/cjs/components/header/Header_REMOTE_73021.js.map +1 -0
- package/dist/cjs/components/story-previewer/StoryPreviewer.js +11 -1
- package/dist/cjs/components/story-previewer/StoryPreviewer.js.map +1 -1
- package/dist/cjs/constants/copy.js +2 -2
- package/dist/cjs/constants/copy.js.map +1 -1
- package/dist/cjs/constants/icons.d.ts +1 -0
- package/dist/cjs/constants/icons.js +3 -1
- package/dist/cjs/constants/icons.js.map +1 -1
- package/dist/cjs/constants/variables.d.ts +3 -0
- package/dist/cjs/constants/variables.js +27 -2
- package/dist/cjs/constants/variables.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/redux/actions/asset-list.js +0 -1
- package/dist/cjs/redux/actions/asset-list.js.map +1 -1
- package/dist/cjs/redux/actions/asset-uploads.js +33 -1
- package/dist/cjs/redux/actions/asset-uploads.js.map +1 -1
- package/dist/cjs/redux/reducers/asset-uploads.js +8 -0
- package/dist/cjs/redux/reducers/asset-uploads.js.map +1 -1
- package/dist/cjs/services/API.d.ts +3 -0
- package/dist/cjs/services/API.js +9 -0
- package/dist/cjs/services/API.js.map +1 -1
- package/dist/esm/components/app-wrapper/AppWrapper.js +5 -2
- package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.d.ts +27 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.js +194 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.d.ts +28 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.js +208 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.d.ts +27 -0
- package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.js +194 -0
- package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.d.ts +28 -0
- package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.js +204 -0
- package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.js.map +1 -0
- package/dist/esm/components/assets/AssetsTableNameCell.js +2 -2
- package/dist/esm/components/assets/AssetsTableNameCell.js.map +1 -1
- package/dist/esm/components/assets/AssetsTypeIcon.js +3 -1
- package/dist/esm/components/assets/AssetsTypeIcon.js.map +1 -1
- package/dist/esm/components/card/Card.d.ts +0 -1
- package/dist/esm/components/card/Card.js +4 -16
- package/dist/esm/components/card/Card.js.map +1 -1
- package/dist/esm/components/confirm-modal/ConfirmModal.d.ts +9 -9
- package/dist/esm/components/confirm-modal/ConfirmModal.js +60 -11
- package/dist/esm/components/confirm-modal/ConfirmModal.js.map +1 -1
- package/dist/esm/components/data-table/Paginator.js +44 -74
- package/dist/esm/components/data-table/Paginator.js.map +1 -1
- package/dist/esm/components/error-message-preview/ErrorMessagePreview.d.ts +15 -0
- package/dist/esm/components/error-message-preview/ErrorMessagePreview.js +35 -0
- package/dist/esm/components/error-message-preview/ErrorMessagePreview.js.map +1 -0
- package/dist/esm/components/header/Header_BACKUP_73021.d.ts +33 -0
- package/dist/esm/components/header/Header_BACKUP_73021.js +336 -0
- package/dist/esm/components/header/Header_BACKUP_73021.js.map +1 -0
- package/dist/esm/components/header/Header_BASE_73021.d.ts +29 -0
- package/dist/esm/components/header/Header_BASE_73021.js +322 -0
- package/dist/esm/components/header/Header_BASE_73021.js.map +1 -0
- package/dist/esm/components/header/Header_LOCAL_73021.d.ts +33 -0
- package/dist/esm/components/header/Header_LOCAL_73021.js +328 -0
- package/dist/esm/components/header/Header_LOCAL_73021.js.map +1 -0
- package/dist/esm/components/header/Header_REMOTE_73021.d.ts +30 -0
- package/dist/esm/components/header/Header_REMOTE_73021.js +329 -0
- package/dist/esm/components/header/Header_REMOTE_73021.js.map +1 -0
- package/dist/esm/components/story-previewer/StoryPreviewer.js +12 -2
- package/dist/esm/components/story-previewer/StoryPreviewer.js.map +1 -1
- package/dist/esm/constants/copy.js +2 -2
- package/dist/esm/constants/copy.js.map +1 -1
- package/dist/esm/constants/icons.d.ts +1 -0
- package/dist/esm/constants/icons.js +2 -0
- package/dist/esm/constants/icons.js.map +1 -1
- package/dist/esm/constants/variables.d.ts +3 -0
- package/dist/esm/constants/variables.js +25 -1
- package/dist/esm/constants/variables.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/redux/actions/asset-list.js +0 -1
- package/dist/esm/redux/actions/asset-list.js.map +1 -1
- package/dist/esm/redux/actions/asset-uploads.js +22 -1
- package/dist/esm/redux/actions/asset-uploads.js.map +1 -1
- package/dist/esm/redux/reducers/asset-uploads.js +11 -0
- package/dist/esm/redux/reducers/asset-uploads.js.map +1 -1
- package/dist/esm/services/API.d.ts +3 -0
- package/dist/esm/services/API.js +9 -0
- package/dist/esm/services/API.js.map +1 -1
- package/package.json +1 -1
- package/src/components/app-wrapper/AppWrapper.tsx +3 -4
- package/src/components/assets/AssetsTableNameCell.tsx +2 -2
- package/src/components/assets/AssetsTypeIcon.tsx +4 -1
- package/src/components/card/Card.tsx +13 -27
- package/src/components/confirm-modal/ConfirmModal.tsx +80 -19
- package/src/components/data-table/Paginator.tsx +93 -140
- package/src/components/story-previewer/StoryPreviewer.tsx +28 -4
- package/src/constants/copy.ts +2 -2
- package/src/constants/icons.tsx +3 -0
- package/src/constants/variables.ts +27 -1
- package/src/index.ts +3 -2
- package/src/redux/actions/asset-list.ts +0 -1
- package/src/redux/actions/asset-uploads.ts +20 -1
- package/src/redux/reducers/asset-uploads.ts +11 -0
- package/src/services/API.ts +15 -0
|
@@ -1,24 +1,85 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
|
-
import { useHotkeys } from 'react-hotkeys-hook';
|
|
4
3
|
import Modal from '../modal/Modal';
|
|
5
4
|
import Button from '../button/Button';
|
|
6
5
|
import { confirm as copy } from '../../constants/copy';
|
|
7
6
|
import Section from '../section/Section';
|
|
8
7
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}) => {
|
|
18
|
-
useHotkeys('enter', onYes, { enableOnFormTags: true });
|
|
19
|
-
const { cancel } = copy;
|
|
8
|
+
export interface IConfirmModalProps {
|
|
9
|
+
onYes: () => void;
|
|
10
|
+
onNo?: () => void;
|
|
11
|
+
title: string;
|
|
12
|
+
yesLabel?: string;
|
|
13
|
+
noLabel?: string;
|
|
14
|
+
showCancel?: boolean;
|
|
15
|
+
}
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
export const ConfirmModal = () => {
|
|
18
|
+
const [props, setProps] = useState<IConfirmModalProps>(null);
|
|
19
|
+
const [isOpen, setIsOpen] = useState<boolean>(false);
|
|
20
|
+
|
|
21
|
+
const onOpen = (event) => {
|
|
22
|
+
setProps({
|
|
23
|
+
...event.detail
|
|
24
|
+
});
|
|
25
|
+
setIsOpen(true);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const onClose = () => setIsOpen(false);
|
|
29
|
+
|
|
30
|
+
const onYesHandler = () => {
|
|
31
|
+
props.onYes();
|
|
32
|
+
setIsOpen(false);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const onNoHandler = () => {
|
|
36
|
+
props.onNo();
|
|
37
|
+
setIsOpen(false);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const onYes = useCallback(() => onYesHandler(), [isOpen]);
|
|
41
|
+
|
|
42
|
+
const onNo = useCallback(() => {
|
|
43
|
+
if (props.onNo) {
|
|
44
|
+
onNoHandler();
|
|
45
|
+
} else {
|
|
46
|
+
onClose();
|
|
47
|
+
}
|
|
48
|
+
}, [isOpen]);
|
|
49
|
+
|
|
50
|
+
const onKeyDown = useCallback(
|
|
51
|
+
(e) => {
|
|
52
|
+
if (e.key === 'Enter') {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
onYesHandler();
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
[isOpen]
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
window.addEventListener('openconfirmmodal', onOpen);
|
|
62
|
+
return () => {
|
|
63
|
+
window.removeEventListener('openconfirmmodal', onOpen);
|
|
64
|
+
};
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (isOpen) {
|
|
69
|
+
document.addEventListener('keypress', onKeyDown);
|
|
70
|
+
} else {
|
|
71
|
+
document.removeEventListener('keypress', onKeyDown);
|
|
72
|
+
}
|
|
73
|
+
return () => {
|
|
74
|
+
document.removeEventListener('keypress', onKeyDown);
|
|
75
|
+
};
|
|
76
|
+
}, [isOpen, onKeyDown]);
|
|
77
|
+
|
|
78
|
+
const { cancel, yes, no } = copy;
|
|
79
|
+
const noLabel = props?.noLabel ? props.noLabel : no;
|
|
80
|
+
const yesLabel = props?.yesLabel ? props.yesLabel : yes;
|
|
81
|
+
|
|
82
|
+
const modal = isOpen && (
|
|
22
83
|
<Modal
|
|
23
84
|
onRequestClose={onClose}
|
|
24
85
|
wrapperStyle={{
|
|
@@ -27,16 +88,16 @@ export const ConfirmModal = ({
|
|
|
27
88
|
}}
|
|
28
89
|
style={{
|
|
29
90
|
width: '400px',
|
|
30
|
-
height: '
|
|
91
|
+
height: '14%',
|
|
31
92
|
top: 'calc(50% - 150px)',
|
|
32
93
|
left: 'calc((100% - 400px) / 2)'
|
|
33
94
|
}}
|
|
34
95
|
isOpen={true}>
|
|
35
96
|
<Section>
|
|
36
97
|
<div className='confirm-modal'>
|
|
37
|
-
<p>{title}</p>
|
|
98
|
+
<p>{props.title}</p>
|
|
38
99
|
<div className='confirm-buttons'>
|
|
39
|
-
{showCancel ? (
|
|
100
|
+
{props.showCancel ? (
|
|
40
101
|
<Button
|
|
41
102
|
onClick={onClose}
|
|
42
103
|
size='large'
|
|
@@ -48,14 +109,14 @@ export const ConfirmModal = ({
|
|
|
48
109
|
onClick={onNo}
|
|
49
110
|
size='large'
|
|
50
111
|
color='default'>
|
|
51
|
-
{
|
|
112
|
+
{noLabel}
|
|
52
113
|
</Button>
|
|
53
114
|
<Button
|
|
54
115
|
onClick={onYes}
|
|
55
116
|
size='large'
|
|
56
117
|
style='bold'
|
|
57
118
|
color='primary'>
|
|
58
|
-
{
|
|
119
|
+
{yesLabel}
|
|
59
120
|
</Button>
|
|
60
121
|
</div>
|
|
61
122
|
</div>
|
|
@@ -26,149 +26,102 @@ const Paginator: React.FC<any> = ({
|
|
|
26
26
|
setPageSize,
|
|
27
27
|
itemsPerPage,
|
|
28
28
|
onItemsPerPage
|
|
29
|
-
}) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
29
|
+
}) => (
|
|
30
|
+
<section className='ip-table-pagination'>
|
|
31
|
+
<span>
|
|
32
|
+
<Button
|
|
33
|
+
style='subtle'
|
|
34
|
+
size='small'
|
|
35
|
+
tooltip='Go to first page'
|
|
36
|
+
disabled={!canPreviousPage}
|
|
37
|
+
onClick={() => gotoPage(1, pageSize)}>
|
|
38
|
+
{ICON_ANGLE_DOUBLE_LEFT}
|
|
39
|
+
</Button>
|
|
40
|
+
<Button
|
|
41
|
+
style='subtle'
|
|
42
|
+
size='small'
|
|
43
|
+
tooltip='Go to previous page'
|
|
44
|
+
disabled={!canPreviousPage}
|
|
45
|
+
onClick={() => previousPage()}>
|
|
46
|
+
{ICON_ANGLE_LEFT}
|
|
47
|
+
</Button>
|
|
48
|
+
<Button
|
|
49
|
+
style='subtle'
|
|
50
|
+
size='small'
|
|
51
|
+
tooltip='Go to next page'
|
|
52
|
+
disabled={!canNextPage}
|
|
53
|
+
onClick={() => nextPage()}>
|
|
54
|
+
{ICON_ANGLE_RIGHT}
|
|
55
|
+
</Button>
|
|
56
|
+
<Button
|
|
57
|
+
style='subtle'
|
|
58
|
+
size='small'
|
|
59
|
+
tooltip='Go to last page'
|
|
60
|
+
disabled={!canNextPage}
|
|
61
|
+
onClick={() => gotoPage(pageCount, pageSize)}>
|
|
62
|
+
{ICON_ANGLE_DOUBLE_RIGHT}
|
|
63
|
+
</Button>
|
|
64
|
+
|
|
65
65
|
<span>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
disabled={!canPreviousPage}
|
|
71
|
-
onClick={() => gotoPage(1, pageSize)}>
|
|
72
|
-
{ICON_ANGLE_DOUBLE_LEFT}
|
|
73
|
-
</Button>
|
|
74
|
-
<Button
|
|
75
|
-
style='subtle'
|
|
76
|
-
size='small'
|
|
77
|
-
tooltip='Go to previous page'
|
|
78
|
-
disabled={!canPreviousPage}
|
|
79
|
-
onClick={() => previousPage()}>
|
|
80
|
-
{ICON_ANGLE_LEFT}
|
|
81
|
-
</Button>
|
|
82
|
-
<Button
|
|
83
|
-
style='subtle'
|
|
84
|
-
size='small'
|
|
85
|
-
tooltip='Go to next page'
|
|
86
|
-
disabled={!canNextPage}
|
|
87
|
-
onClick={() => nextPage()}>
|
|
88
|
-
{ICON_ANGLE_RIGHT}
|
|
89
|
-
</Button>
|
|
90
|
-
<Button
|
|
91
|
-
style='subtle'
|
|
92
|
-
size='small'
|
|
93
|
-
tooltip='Go to last page'
|
|
94
|
-
disabled={!canNextPage}
|
|
95
|
-
onClick={() => gotoPage(pageCount, pageSize)}>
|
|
96
|
-
{ICON_ANGLE_DOUBLE_RIGHT}
|
|
97
|
-
</Button>
|
|
98
|
-
|
|
99
|
-
<span>
|
|
100
|
-
{copy.table.page}
|
|
101
|
-
<strong>
|
|
102
|
-
{getPageIndex} of {pageCount}
|
|
103
|
-
</strong>
|
|
104
|
-
|
|
105
|
-
</span>
|
|
106
|
-
<span>
|
|
107
|
-
{copy.table.goToPage}
|
|
108
|
-
<input
|
|
109
|
-
className='paginator-input'
|
|
110
|
-
type='number'
|
|
111
|
-
placeholder={getPageIndex.toString()}
|
|
112
|
-
onChange={(e) => {
|
|
113
|
-
const input = e.target.value;
|
|
114
|
-
const inputNum = Number(input);
|
|
115
|
-
let next: number;
|
|
116
|
-
|
|
117
|
-
clearTimeout(textInputTimeout);
|
|
118
|
-
|
|
119
|
-
if (!input || inputNum < 1 || inputNum > pageCount) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (inputNum >= 1 && inputNum <= pageCount) {
|
|
124
|
-
next = inputNum;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
textInputTimeout = window.setTimeout(
|
|
128
|
-
() => gotoPage(next, pageSize),
|
|
129
|
-
1000
|
|
130
|
-
);
|
|
131
|
-
}}
|
|
132
|
-
onBlur={() => onGoToPageBlur()}
|
|
133
|
-
onKeyDown={(e) => onGoToPageKeyDown(e)}
|
|
134
|
-
/>
|
|
135
|
-
</span>
|
|
66
|
+
{copy.table.page}
|
|
67
|
+
<strong>
|
|
68
|
+
{pageIndex} of {pageCount}
|
|
69
|
+
</strong>
|
|
136
70
|
|
|
137
|
-
<span>
|
|
138
|
-
{copy.table.itemsPerPage}
|
|
139
|
-
<input
|
|
140
|
-
className='paginator-input'
|
|
141
|
-
type='number'
|
|
142
|
-
placeholder={getItemsPerPage.toString()}
|
|
143
|
-
min={1}
|
|
144
|
-
onChange={(e) => {
|
|
145
|
-
const input = e.target.value;
|
|
146
|
-
const inputNum = Number(input);
|
|
147
|
-
|
|
148
|
-
clearTimeout(textInputTimeout);
|
|
149
|
-
|
|
150
|
-
if (!input || inputNum < 1) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
setItemsPerPage(inputNum);
|
|
155
|
-
|
|
156
|
-
textInputTimeout = window.setTimeout(
|
|
157
|
-
() => onItemsPerPage(inputNum),
|
|
158
|
-
1000
|
|
159
|
-
);
|
|
160
|
-
}}
|
|
161
|
-
onBlur={() => onItemsPerPageBlur()}
|
|
162
|
-
onKeyDown={(e) => onItemsPerPageKeyDown(e)}
|
|
163
|
-
/>
|
|
164
|
-
</span>
|
|
165
71
|
</span>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
72
|
+
<span>
|
|
73
|
+
{copy.table.goToPage}
|
|
74
|
+
<input
|
|
75
|
+
className='paginator-input'
|
|
76
|
+
type='number'
|
|
77
|
+
placeholder={pageIndex}
|
|
78
|
+
onChange={(e) => {
|
|
79
|
+
const input = e.target.value;
|
|
80
|
+
const inputNum = Number(input);
|
|
81
|
+
let next: number;
|
|
82
|
+
|
|
83
|
+
clearTimeout(textInputTimeout);
|
|
84
|
+
|
|
85
|
+
if (!input || inputNum < 1 || inputNum > pageCount) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (inputNum >= 1 && inputNum <= pageCount) {
|
|
90
|
+
next = inputNum;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
textInputTimeout = window.setTimeout(() => gotoPage(next, pageSize), 300);
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
169
96
|
</span>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
};
|
|
97
|
+
|
|
98
|
+
<span>
|
|
99
|
+
{copy.table.itemsPerPage}
|
|
100
|
+
<input
|
|
101
|
+
className='paginator-input'
|
|
102
|
+
type='number'
|
|
103
|
+
placeholder={itemsPerPage}
|
|
104
|
+
min={1}
|
|
105
|
+
onChange={(e) => {
|
|
106
|
+
const input = e.target.value;
|
|
107
|
+
const inputNum = Number(input);
|
|
108
|
+
|
|
109
|
+
clearTimeout(textInputTimeout);
|
|
110
|
+
|
|
111
|
+
if (!input || inputNum < 1) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
textInputTimeout = window.setTimeout(() => onItemsPerPage(inputNum), 300);
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
</span>
|
|
119
|
+
</span>
|
|
120
|
+
|
|
121
|
+
<span className='total-assets'>
|
|
122
|
+
{copy.table.total} <strong>{totalItems || 0}</strong>
|
|
123
|
+
</span>
|
|
124
|
+
</section>
|
|
125
|
+
);
|
|
173
126
|
|
|
174
127
|
export default Paginator;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IImposiumAPI } from '../../services/API';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
VARIABLE_TYPES,
|
|
5
|
+
BOOLEAN_DEFAULT_OPTIONS,
|
|
6
|
+
colorPresets,
|
|
7
|
+
formatColor
|
|
8
|
+
} from '../../constants/variables';
|
|
4
9
|
import { OUTPUT_TYPES } from '../../constants/previewer';
|
|
5
10
|
import TextField from '../text-field/TextField';
|
|
6
11
|
import Button from '../button/Button';
|
|
@@ -23,6 +28,7 @@ import LogViewer from '../log-viewer/LogViewer';
|
|
|
23
28
|
import { connect } from 'react-redux';
|
|
24
29
|
import { ICON_DOWNLOAD, ICON_CLIPBOARD } from '../../constants/icons';
|
|
25
30
|
import AudioPlayer from '../players/AudioPlayer';
|
|
31
|
+
import ColorField from '../color-field/ColorField';
|
|
26
32
|
|
|
27
33
|
interface IStoryPreviewerProps {
|
|
28
34
|
api: IImposiumAPI;
|
|
@@ -137,15 +143,14 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
137
143
|
const { variables } = this.props;
|
|
138
144
|
const inventoryOverrides = this.props.editor?.inventoryOverrides;
|
|
139
145
|
const newInv = {};
|
|
140
|
-
|
|
141
146
|
for (const i in variables) {
|
|
142
147
|
if (variables.hasOwnProperty(i)) {
|
|
143
148
|
const override = inventoryOverrides ? inventoryOverrides[i] : null;
|
|
144
149
|
const inv = variables[i];
|
|
145
|
-
newInv[inv.id] =
|
|
150
|
+
newInv[inv.id] =
|
|
151
|
+
override !== null ? override : this.getVariableValue(inv.previewItem);
|
|
146
152
|
}
|
|
147
153
|
}
|
|
148
|
-
|
|
149
154
|
return newInv;
|
|
150
155
|
}
|
|
151
156
|
|
|
@@ -230,6 +235,11 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
230
235
|
}
|
|
231
236
|
}
|
|
232
237
|
|
|
238
|
+
private colorInputChanged(key, value) {
|
|
239
|
+
const color = formatColor(value);
|
|
240
|
+
this.variableInputChanged(key, color);
|
|
241
|
+
}
|
|
242
|
+
|
|
233
243
|
private variableInputChanged(key, value) {
|
|
234
244
|
const inventory = { ...this.state.inventory };
|
|
235
245
|
inventory[key] = value;
|
|
@@ -397,6 +407,20 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
397
407
|
</FieldWrapper>
|
|
398
408
|
);
|
|
399
409
|
break;
|
|
410
|
+
case VARIABLE_TYPES.COLOR:
|
|
411
|
+
const value = inventory[inv.id] ? inventory[inv.id] : 'rgba(0,0,0,1)';
|
|
412
|
+
fields.push(
|
|
413
|
+
<ColorField
|
|
414
|
+
label={inv.name}
|
|
415
|
+
labelPosition='top'
|
|
416
|
+
enableAlpha={true}
|
|
417
|
+
presetColors={colorPresets}
|
|
418
|
+
value={value}
|
|
419
|
+
pickerPosition='bottom'
|
|
420
|
+
onChange={(v) => this.colorInputChanged(inv.id, v)}
|
|
421
|
+
/>
|
|
422
|
+
);
|
|
423
|
+
break;
|
|
400
424
|
}
|
|
401
425
|
}
|
|
402
426
|
}
|
package/src/constants/copy.ts
CHANGED
package/src/constants/icons.tsx
CHANGED
|
@@ -74,6 +74,7 @@ import {
|
|
|
74
74
|
import { faCircleSmall } from '@fortawesome/pro-solid-svg-icons/faCircleSmall';
|
|
75
75
|
import { faClapperboardPlay } from '@fortawesome/pro-solid-svg-icons/faClapperboardPlay';
|
|
76
76
|
import { faCloudArrowUp, faFilters } from '@fortawesome/pro-solid-svg-icons';
|
|
77
|
+
import { faCircleExclamation } from '@fortawesome/free-solid-svg-icons';
|
|
77
78
|
|
|
78
79
|
export const ICON_VIDEO = <FontAwesomeIcon icon={faVideo} />;
|
|
79
80
|
|
|
@@ -220,3 +221,5 @@ export const ICON_CODE = <FontAwesomeIcon icon={faCode} />;
|
|
|
220
221
|
export const ICON_UP_RIGHT_FROM_SQUARE = <FontAwesomeIcon icon={faUpRightFromSquare} />;
|
|
221
222
|
|
|
222
223
|
export const ICON_FILE_UPLOAD = <FontAwesomeIcon icon={faCloudArrowUp} />;
|
|
224
|
+
|
|
225
|
+
export const ICON_FILE_ERROR = <FontAwesomeIcon icon={faCircleExclamation} />;
|
|
@@ -5,7 +5,8 @@ export const VARIABLE_TYPES = {
|
|
|
5
5
|
ENUM: 'enum',
|
|
6
6
|
IMAGE: 'image',
|
|
7
7
|
VIDEO: 'video',
|
|
8
|
-
AUDIO: 'audio'
|
|
8
|
+
AUDIO: 'audio',
|
|
9
|
+
COLOR: 'color'
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export const BOOLEAN_DEFAULT_OPTIONS = [
|
|
@@ -18,3 +19,28 @@ export const BOOLEAN_DEFAULT_OPTIONS = [
|
|
|
18
19
|
label: 'False'
|
|
19
20
|
}
|
|
20
21
|
];
|
|
22
|
+
|
|
23
|
+
export const colorPresets = [
|
|
24
|
+
'#D0021B',
|
|
25
|
+
'#F5A623',
|
|
26
|
+
'#F8E71C',
|
|
27
|
+
'#8B572A',
|
|
28
|
+
'#7ED321',
|
|
29
|
+
'#417505',
|
|
30
|
+
'#BD10E0',
|
|
31
|
+
'#9013FE',
|
|
32
|
+
'#4A90E2',
|
|
33
|
+
'#50E3C2',
|
|
34
|
+
'#B8E986',
|
|
35
|
+
'#000000',
|
|
36
|
+
'#4A4A4A',
|
|
37
|
+
'#9B9B9B',
|
|
38
|
+
'#FFFFFF',
|
|
39
|
+
'transparent'
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
export const formatColor = (color) => {
|
|
43
|
+
const { r, g, b, a } = color.rgb;
|
|
44
|
+
const alpha = color.source === 'hsv' ? 1 : a;
|
|
45
|
+
return `rgba(${r},${g},${b},${alpha})`;
|
|
46
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -158,7 +158,7 @@ import ContextMenuItem from './components/context-menu/ContextMenuItem';
|
|
|
158
158
|
import ContextMenuTrigger from './components/context-menu/ContextMenuTrigger';
|
|
159
159
|
import CopyPropIdButton from './components/copy-prop-id-button/CopyPropIdButton';
|
|
160
160
|
import Submenu from './components/context-menu/SubMenu';
|
|
161
|
-
import { ConfirmModal } from './components/confirm-modal/ConfirmModal';
|
|
161
|
+
import { ConfirmModal, IConfirmModalProps } from './components/confirm-modal/ConfirmModal';
|
|
162
162
|
|
|
163
163
|
export {
|
|
164
164
|
AppWrapper,
|
|
@@ -313,5 +313,6 @@ export {
|
|
|
313
313
|
ContextMenuTrigger,
|
|
314
314
|
Submenu,
|
|
315
315
|
CopyPropIdButton,
|
|
316
|
-
ConfirmModal
|
|
316
|
+
ConfirmModal,
|
|
317
|
+
IConfirmModalProps
|
|
317
318
|
};
|
|
@@ -7,7 +7,8 @@ const assetUploadsActions: any = {
|
|
|
7
7
|
UPDATE_UPLOAD: 'assetUploads/UPDATE_UPLOAD',
|
|
8
8
|
UPDATE_PERCENT_UPLOADED: 'assetUploads/UPDATE_PERCENT_UPLOADED',
|
|
9
9
|
ADD_UPLOAD_ASSET_ID: 'assetUploads/ADD_UPLOAD_ASSET_ID',
|
|
10
|
-
REMOVE_UPLOAD: 'assetUploads/REMOVE_UPLOAD'
|
|
10
|
+
REMOVE_UPLOAD: 'assetUploads/REMOVE_UPLOAD',
|
|
11
|
+
ERROR: 'assetUploads/ERROR'
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
const POLL_INTERVAL: number = 5000;
|
|
@@ -241,6 +242,15 @@ const uploadAssetHandler = (api: IImposiumAPI, dispatch, getStore) => {
|
|
|
241
242
|
if (axios.isCancel(e) && currentQueue !== queueLength - 1) {
|
|
242
243
|
currentQueue = currentQueue + 1;
|
|
243
244
|
createPromise(currentQueue);
|
|
245
|
+
} else {
|
|
246
|
+
const error: any = { ...e };
|
|
247
|
+
const errorMsg = error.response.data.error.split(':')[0];
|
|
248
|
+
dispatch({
|
|
249
|
+
type: assetUploadsActions.ERROR,
|
|
250
|
+
filename: uploadBlobs[activeIndex].filename,
|
|
251
|
+
errorMsg
|
|
252
|
+
});
|
|
253
|
+
doAssetTableHydration(api, storyId);
|
|
244
254
|
}
|
|
245
255
|
});
|
|
246
256
|
}
|
|
@@ -354,6 +364,15 @@ export const replaceAsset = (
|
|
|
354
364
|
if (axios.isCancel(e) && currentQueue !== queueLength - 1) {
|
|
355
365
|
currentQueue = currentQueue + 1;
|
|
356
366
|
createPromise(currentQueue);
|
|
367
|
+
} else {
|
|
368
|
+
const error: any = { ...e };
|
|
369
|
+
const errorMsg = error.response.data.error.split(':')[0];
|
|
370
|
+
dispatch({
|
|
371
|
+
type: assetUploadsActions.ERROR,
|
|
372
|
+
filename: replacedFileBlobs[activeIndex].filename,
|
|
373
|
+
errorMsg
|
|
374
|
+
});
|
|
375
|
+
doAssetTableHydration(api, storyId);
|
|
357
376
|
}
|
|
358
377
|
});
|
|
359
378
|
};
|
|
@@ -47,6 +47,17 @@ const assetUploads = (state = initialState, action): any => {
|
|
|
47
47
|
...state,
|
|
48
48
|
uploads: state.uploads.filter((u: any) => u.filename !== action.filename)
|
|
49
49
|
};
|
|
50
|
+
case assetUploadsActions.ERROR:
|
|
51
|
+
const newError = state.uploads.map((u: any) => {
|
|
52
|
+
if (u.filename === action.filename) {
|
|
53
|
+
return { ...u, error: action.errorMsg };
|
|
54
|
+
}
|
|
55
|
+
return u;
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
...state,
|
|
59
|
+
uploads: newError
|
|
60
|
+
};
|
|
50
61
|
default:
|
|
51
62
|
return state;
|
|
52
63
|
}
|
package/src/services/API.ts
CHANGED
|
@@ -153,6 +153,9 @@ interface ITTSOptions {
|
|
|
153
153
|
voice: string;
|
|
154
154
|
service: string;
|
|
155
155
|
model?: string;
|
|
156
|
+
speed?: string;
|
|
157
|
+
pause_silences?: boolean;
|
|
158
|
+
minimum_silence_length?: number;
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
interface ICancelTokenCache {
|
|
@@ -1607,6 +1610,18 @@ export default class API {
|
|
|
1607
1610
|
url += `&model=${options.model}`;
|
|
1608
1611
|
}
|
|
1609
1612
|
|
|
1613
|
+
if (options.speed) {
|
|
1614
|
+
url += `&speed=${options.speed}`;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
if (options.pause_silences) {
|
|
1618
|
+
url += `&pause_silences=${options.pause_silences}`;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
if (options.minimum_silence_length) {
|
|
1622
|
+
url += `&minimum_silence_length=${options.minimum_silence_length}`;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1610
1625
|
return this.doRequest({
|
|
1611
1626
|
url,
|
|
1612
1627
|
method: 'GET',
|