@imposium-hub/components 1.23.0 → 1.24.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/components/assets/AssetField.tsx +2 -1
- package/components/assets/AssetsTableNameCell.tsx +1 -0
- package/components/button-menu/ButtonMenu.tsx +11 -8
- package/components/color-field/ColorField.tsx +11 -8
- package/components/portal/Portal.tsx +3 -1
- package/components/story-previewer/StoryPreviewer.tsx +6 -5
- package/dist/components.js +2 -2
- package/dist/components.js.map +1 -1
- package/package.json +13 -11
- package/services/API.ts +25 -10
|
@@ -73,9 +73,10 @@ class AssetField extends React.PureComponent<IAssetFieldProps, IAssetFieldState>
|
|
|
73
73
|
this.props.updateFilters({type: (accepts) ? accepts : '', page: 1});
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
private onFileDrop = (i : any, monitor :
|
|
76
|
+
private onFileDrop = (i : any, monitor : any) : void => {
|
|
77
77
|
const {accepts, storyId, api} = this.props;
|
|
78
78
|
if (monitor) {
|
|
79
|
+
|
|
79
80
|
const {files} = monitor.getItem();
|
|
80
81
|
|
|
81
82
|
if (mimetypeConformsToOverlay(accepts, files[0])) {
|
|
@@ -20,6 +20,7 @@ const AssetsTableNameCell : React.FC<IAssetsTableNameCell> = (props : IAssetsTab
|
|
|
20
20
|
const {cell: {row, row: {original: {name, id}}}} = props;
|
|
21
21
|
|
|
22
22
|
const [_, drag] = useDrag({
|
|
23
|
+
type: ASSET_DND_TYPES.ASSET_NAME,
|
|
23
24
|
item: {
|
|
24
25
|
name: DRAGGER_NAME,
|
|
25
26
|
assetData: row.original,
|
|
@@ -24,11 +24,11 @@ class ButtonMenu extends React.PureComponent<IButtonMenuProps, IButtonMenuState>
|
|
|
24
24
|
|
|
25
25
|
this.evtHandlers = {
|
|
26
26
|
toggleMenu: (e) => this.toggleMenu(e),
|
|
27
|
-
clickOutside: (e) => this.handleClickOutside()
|
|
27
|
+
clickOutside: (e) => this.handleClickOutside(e)
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
private handleClickOutside() {
|
|
31
|
+
private handleClickOutside(e) {
|
|
32
32
|
|
|
33
33
|
document.removeEventListener('click', this.evtHandlers.clickOutside);
|
|
34
34
|
|
|
@@ -44,16 +44,19 @@ class ButtonMenu extends React.PureComponent<IButtonMenuProps, IButtonMenuState>
|
|
|
44
44
|
|
|
45
45
|
public toggleMenu(e) {
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
e.stopPropagation();
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
document.addEventListener('click', this.evtHandlers.clickOutside);
|
|
51
|
-
} else {
|
|
52
|
-
document.removeEventListener('click', this.evtHandlers.clickOutside);
|
|
53
|
-
}
|
|
50
|
+
const newState = !this.state.open;
|
|
54
51
|
|
|
55
52
|
this.setState({
|
|
56
53
|
open : newState
|
|
54
|
+
}, () => {
|
|
55
|
+
if (this.state.open) {
|
|
56
|
+
document.addEventListener('click', this.evtHandlers.clickOutside);
|
|
57
|
+
} else {
|
|
58
|
+
document.removeEventListener('click', this.evtHandlers.clickOutside);
|
|
59
|
+
}
|
|
57
60
|
});
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -42,18 +42,21 @@ class ColorField extends React.PureComponent<IColorFieldProps, IColorFieldState>
|
|
|
42
42
|
this.clickOutsideHandler = (e) => this.handleClickOutside(e);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
private togglePicker() {
|
|
45
|
+
private togglePicker(e) {
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
e.stopPropagation();
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
document.addEventListener('click', this.clickOutsideHandler);
|
|
51
|
-
} else {
|
|
52
|
-
document.removeEventListener('click', this.clickOutsideHandler);
|
|
53
|
-
}
|
|
50
|
+
const newState = !this.state.pickerOpen;
|
|
54
51
|
|
|
55
52
|
this.setState({
|
|
56
53
|
pickerOpen: newState
|
|
54
|
+
}, () => {
|
|
55
|
+
if (this.state.pickerOpen) {
|
|
56
|
+
document.addEventListener('click', this.clickOutsideHandler);
|
|
57
|
+
} else {
|
|
58
|
+
document.removeEventListener('click', this.clickOutsideHandler);
|
|
59
|
+
}
|
|
57
60
|
});
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -118,7 +121,7 @@ class ColorField extends React.PureComponent<IColorFieldProps, IColorFieldState>
|
|
|
118
121
|
info = {info}
|
|
119
122
|
labelPosition = {labelPosition}
|
|
120
123
|
width = {width}>
|
|
121
|
-
<div className = 'swatch' style = {swatchStyle} onClick = {() => this.togglePicker()}/>
|
|
124
|
+
<div className = 'swatch' style = {swatchStyle} onClick = {(e) => this.togglePicker(e)}/>
|
|
122
125
|
<div className = {`picker picker-${pickerPos}`} ref = {this.picker}>
|
|
123
126
|
{picker}
|
|
124
127
|
</div>
|
|
@@ -17,7 +17,9 @@ const Portal : React.FC<IPortalProps> = ({ children, id }) : ReactPortal => {
|
|
|
17
17
|
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
mount.appendChild(el);
|
|
20
|
-
return () =>
|
|
20
|
+
return () => {
|
|
21
|
+
mount.removeChild(el);
|
|
22
|
+
};
|
|
21
23
|
}, [el, mount]);
|
|
22
24
|
|
|
23
25
|
return createPortal(children, el);
|
|
@@ -25,6 +25,7 @@ import LogViewer from '../log-viewer/LogViewer';
|
|
|
25
25
|
interface IStoryPreviewerProps {
|
|
26
26
|
api : IImposiumAPI;
|
|
27
27
|
storyId : string;
|
|
28
|
+
compositionId ? : string;
|
|
28
29
|
variables : any;
|
|
29
30
|
experienceId? : string;
|
|
30
31
|
jobId? : string;
|
|
@@ -353,7 +354,7 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
353
354
|
}
|
|
354
355
|
}
|
|
355
356
|
|
|
356
|
-
private getExperience(experienceId, triggerJob = false) {
|
|
357
|
+
private getExperience(experienceId, triggerJob = false, compositionId ? : string) {
|
|
357
358
|
|
|
358
359
|
if (!this.timer.running) {
|
|
359
360
|
this.timer.start();
|
|
@@ -369,7 +370,7 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
369
370
|
}, () => {
|
|
370
371
|
|
|
371
372
|
if (triggerJob) {
|
|
372
|
-
api.triggerEvent(experienceId).then((resTrigger) => {
|
|
373
|
+
api.triggerEvent(experienceId, compositionId).then((resTrigger) => {
|
|
373
374
|
|
|
374
375
|
this.setState({
|
|
375
376
|
jobId: resTrigger.job_id
|
|
@@ -448,7 +449,7 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
448
449
|
|
|
449
450
|
private createExperience() {
|
|
450
451
|
|
|
451
|
-
const {storyId, onNotification, onError, api, onExperienceCreated} = this.props;
|
|
452
|
+
const {storyId, onNotification, onError, api, onExperienceCreated, compositionId} = this.props;
|
|
452
453
|
|
|
453
454
|
this.resetState(() => {
|
|
454
455
|
this.setState({
|
|
@@ -459,7 +460,7 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
459
460
|
if (onNotification) {
|
|
460
461
|
onNotification(copy.runExpStart);
|
|
461
462
|
}
|
|
462
|
-
api.createExperience(storyId, this.state.inventory).then((resExp) => {
|
|
463
|
+
api.createExperience(storyId, this.state.inventory, compositionId).then((resExp) => {
|
|
463
464
|
|
|
464
465
|
if (onNotification) {
|
|
465
466
|
onNotification(copy.expId.replace('[expId]', resExp.id));
|
|
@@ -469,7 +470,7 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
469
470
|
onExperienceCreated(resExp);
|
|
470
471
|
}
|
|
471
472
|
|
|
472
|
-
this.getExperience(resExp.id, true);
|
|
473
|
+
this.getExperience(resExp.id, true, compositionId);
|
|
473
474
|
|
|
474
475
|
}).catch((e) => {
|
|
475
476
|
this.resetState();
|