@micromag/editor 0.4.49 → 0.4.50
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/es/index.js +943 -806
- package/package.json +7 -7
package/es/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
16
16
|
import { faCogs } from '@fortawesome/free-solid-svg-icons/faCogs';
|
|
17
17
|
import { faEllipsisV } from '@fortawesome/free-solid-svg-icons/faEllipsisV';
|
|
18
18
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
19
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
19
20
|
import { Fields, FieldsProvider } from '@micromag/fields';
|
|
20
21
|
import { v1 } from 'uuid';
|
|
21
22
|
import { getSizeWithinBounds } from '@folklore/size';
|
|
@@ -219,11 +220,11 @@ function SettingsButton(_ref) {
|
|
|
219
220
|
_ref$dots = _ref.dots,
|
|
220
221
|
dots = _ref$dots === void 0 ? false : _ref$dots,
|
|
221
222
|
props = _objectWithoutProperties(_ref, _excluded$a);
|
|
222
|
-
return /*#__PURE__*/
|
|
223
|
+
return /*#__PURE__*/jsx(Button, _objectSpread({
|
|
223
224
|
className: className,
|
|
224
225
|
theme: "secondary",
|
|
225
226
|
size: "sm",
|
|
226
|
-
icon: /*#__PURE__*/
|
|
227
|
+
icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
227
228
|
icon: dots ? faEllipsisV : faCogs
|
|
228
229
|
})
|
|
229
230
|
}, props));
|
|
@@ -265,18 +266,19 @@ function FieldWithContexts(_ref) {
|
|
|
265
266
|
finalNameParts = (repeatable || fieldName !== null) && nameParts.length <= (repeatable ? 2 : 1) ? [fieldName || stateId].concat(_toConsumableArray(nameParts.slice(1))) : nameParts.slice(1);
|
|
266
267
|
}
|
|
267
268
|
var formComponents = useFormsComponents();
|
|
268
|
-
return definition !== null ? /*#__PURE__*/
|
|
269
|
+
return definition !== null ? /*#__PURE__*/jsx("div", {
|
|
269
270
|
className: classNames({
|
|
270
271
|
'p-2': form === null
|
|
271
|
-
})
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
272
|
+
}),
|
|
273
|
+
children: finalNameParts.length > 0 ? /*#__PURE__*/jsx(FieldForm, _objectSpread({
|
|
274
|
+
fields: finalScreenFields,
|
|
275
|
+
formComponents: formComponents,
|
|
276
|
+
name: finalNameParts.join('.'),
|
|
277
|
+
form: form
|
|
278
|
+
}, props)) : /*#__PURE__*/jsx(Fields, _objectSpread({
|
|
279
|
+
fields: stateFields
|
|
280
|
+
}, props))
|
|
281
|
+
}) : null;
|
|
280
282
|
}
|
|
281
283
|
|
|
282
284
|
var styles$i = {"container":"micromag-editor-forms-screen-container","inner":"micromag-editor-forms-screen-inner"};
|
|
@@ -308,17 +310,19 @@ function ScreenForm(_ref) {
|
|
|
308
310
|
// onClickDelete(value);
|
|
309
311
|
// }
|
|
310
312
|
// }, [intl, onClickDelete, value]);
|
|
311
|
-
return /*#__PURE__*/
|
|
312
|
-
className: classNames([styles$i.container, className])
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
313
|
+
return /*#__PURE__*/jsx("div", {
|
|
314
|
+
className: classNames([styles$i.container, className]),
|
|
315
|
+
children: /*#__PURE__*/jsx("div", {
|
|
316
|
+
className: styles$i.inner,
|
|
317
|
+
children: fields !== null ? /*#__PURE__*/jsx(Fields, {
|
|
318
|
+
fields: fields,
|
|
319
|
+
value: value,
|
|
320
|
+
onChange: onChange,
|
|
321
|
+
gotoFieldForm: gotoFieldForm,
|
|
322
|
+
closeFieldForm: closeFieldForm
|
|
323
|
+
}) : null
|
|
324
|
+
})
|
|
325
|
+
});
|
|
322
326
|
}
|
|
323
327
|
|
|
324
328
|
var styles$h = {"container":"micromag-editor-menus-breadcrumb-container"};
|
|
@@ -495,7 +499,7 @@ function Breadcrumb(_ref) {
|
|
|
495
499
|
var _ref10 = metadata || {},
|
|
496
500
|
_ref10$title = _ref10.title,
|
|
497
501
|
title = _ref10$title === void 0 ? null : _ref10$title;
|
|
498
|
-
var typeTitle = screenTitle !== null ? /*#__PURE__*/
|
|
502
|
+
var typeTitle = screenTitle !== null ? /*#__PURE__*/jsx(FormattedMessage, _objectSpread({}, screenTitle)) : null;
|
|
499
503
|
var parametersMessage = intl.formatMessage({
|
|
500
504
|
id: "AHvHaY",
|
|
501
505
|
defaultMessage: [{
|
|
@@ -529,16 +533,18 @@ function Breadcrumb(_ref) {
|
|
|
529
533
|
setLocation(items[itemsLength - 2].url);
|
|
530
534
|
}, [items, setLocation, itemsLength]);
|
|
531
535
|
var withBack = itemsLength > 1;
|
|
532
|
-
return /*#__PURE__*/
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
536
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
537
|
+
children: [withBack ? /*#__PURE__*/jsx(BackButton, {
|
|
538
|
+
onClick: onClickBack,
|
|
539
|
+
className: "me-2 py-0"
|
|
540
|
+
}) : null, /*#__PURE__*/jsx(Breadcrumb$1, {
|
|
541
|
+
items: items,
|
|
542
|
+
theme: "secondary",
|
|
543
|
+
withoutBar: true,
|
|
544
|
+
noWrap: true,
|
|
545
|
+
className: classNames([styles$h.container, 'text-truncate', className])
|
|
546
|
+
})]
|
|
547
|
+
});
|
|
542
548
|
}
|
|
543
549
|
|
|
544
550
|
var styles$g = {"container":"micromag-editor-modals-delete-screen-container","description":"micromag-editor-modals-delete-screen-description","actions":"micromag-editor-modals-delete-screen-actions"};
|
|
@@ -551,46 +557,56 @@ function DeleteScreenModal(_ref) {
|
|
|
551
557
|
onConfirm = _ref$onConfirm === void 0 ? null : _ref$onConfirm,
|
|
552
558
|
_ref$onCancel = _ref.onCancel,
|
|
553
559
|
onCancel = _ref$onCancel === void 0 ? null : _ref$onCancel;
|
|
554
|
-
return /*#__PURE__*/
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
560
|
+
return /*#__PURE__*/jsx(Modal, {
|
|
561
|
+
children: /*#__PURE__*/jsxs(ModalDialog, {
|
|
562
|
+
title: /*#__PURE__*/jsx(FormattedMessage, {
|
|
563
|
+
id: "p6q/+/",
|
|
564
|
+
defaultMessage: [{
|
|
565
|
+
"type": 0,
|
|
566
|
+
"value": "Delete screen"
|
|
567
|
+
}]
|
|
568
|
+
}),
|
|
569
|
+
className: classNames([styles$g.container, className]),
|
|
570
|
+
onClose: onCancel,
|
|
571
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
572
|
+
className: styles$g.description,
|
|
573
|
+
children: /*#__PURE__*/jsx(Label, {
|
|
574
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
575
|
+
id: "q/tLk0",
|
|
576
|
+
defaultMessage: [{
|
|
577
|
+
"type": 0,
|
|
578
|
+
"value": "Are you sure you want to delete this screen?"
|
|
579
|
+
}]
|
|
580
|
+
})
|
|
581
|
+
})
|
|
582
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
583
|
+
className: styles$g.actions,
|
|
584
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
585
|
+
onClick: onCancel,
|
|
586
|
+
className: "btn-outline-secondary me-2",
|
|
587
|
+
children: /*#__PURE__*/jsx(Label, {
|
|
588
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
589
|
+
id: "0GT0SI",
|
|
590
|
+
defaultMessage: [{
|
|
591
|
+
"type": 0,
|
|
592
|
+
"value": "Cancel"
|
|
593
|
+
}]
|
|
594
|
+
})
|
|
595
|
+
})
|
|
596
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
597
|
+
onClick: onConfirm,
|
|
598
|
+
theme: "danger",
|
|
599
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
600
|
+
id: "gRxcTc",
|
|
601
|
+
defaultMessage: [{
|
|
602
|
+
"type": 0,
|
|
603
|
+
"value": "Delete screen"
|
|
604
|
+
}]
|
|
605
|
+
})
|
|
606
|
+
})]
|
|
607
|
+
})]
|
|
592
608
|
})
|
|
593
|
-
})
|
|
609
|
+
});
|
|
594
610
|
}
|
|
595
611
|
|
|
596
612
|
var styles$f = {"content":"micromag-editor-form-content","navbar":"micromag-editor-form-navbar","panel":"micromag-editor-form-panel"};
|
|
@@ -815,7 +831,7 @@ function EditForm(_ref) {
|
|
|
815
831
|
var dropdownItems = [!isTheme ? {
|
|
816
832
|
id: 'duplicate',
|
|
817
833
|
type: 'button',
|
|
818
|
-
label: /*#__PURE__*/
|
|
834
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
819
835
|
id: "IBjY5r",
|
|
820
836
|
defaultMessage: [{
|
|
821
837
|
"type": 0,
|
|
@@ -826,7 +842,7 @@ function EditForm(_ref) {
|
|
|
826
842
|
} : null, {
|
|
827
843
|
id: 'delete',
|
|
828
844
|
type: 'button',
|
|
829
|
-
label: /*#__PURE__*/
|
|
845
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
830
846
|
id: "hpiKce",
|
|
831
847
|
defaultMessage: [{
|
|
832
848
|
"type": 0,
|
|
@@ -837,83 +853,91 @@ function EditForm(_ref) {
|
|
|
837
853
|
}].filter(function (it) {
|
|
838
854
|
return it !== null;
|
|
839
855
|
});
|
|
840
|
-
return /*#__PURE__*/
|
|
841
|
-
className: classNames(['d-flex', 'flex-column', className])
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
856
|
+
return /*#__PURE__*/jsxs("div", {
|
|
857
|
+
className: classNames(['d-flex', 'flex-column', className]),
|
|
858
|
+
children: [screenId !== null ? /*#__PURE__*/jsxs(Navbar, {
|
|
859
|
+
compact: true,
|
|
860
|
+
noWrap: true,
|
|
861
|
+
withoutCollapse: true,
|
|
862
|
+
className: classNames(['sticky-top', 'border-bottom', 'border-dark', styles$f.navbar]),
|
|
863
|
+
children: [/*#__PURE__*/jsx(Breadcrumb, {
|
|
864
|
+
story: value,
|
|
865
|
+
url: url,
|
|
866
|
+
screenId: screenId,
|
|
867
|
+
field: fieldParams,
|
|
868
|
+
form: formParams,
|
|
869
|
+
className: "me-auto"
|
|
870
|
+
}), fieldParams === null ? /*#__PURE__*/jsxs("div", {
|
|
871
|
+
className: "dropdown",
|
|
872
|
+
children: [/*#__PURE__*/jsx(SettingsButton, {
|
|
873
|
+
onClick: onSettingsClick,
|
|
874
|
+
dots: true,
|
|
875
|
+
className: "py-0",
|
|
876
|
+
theme: "default"
|
|
877
|
+
}), /*#__PURE__*/jsx(DropdownMenu, {
|
|
878
|
+
align: "end",
|
|
879
|
+
items: dropdownItems,
|
|
880
|
+
visible: screenSettingsOpened,
|
|
881
|
+
onClickOutside: onDropdownClickOutside
|
|
882
|
+
})]
|
|
883
|
+
}) : null]
|
|
884
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
885
|
+
className: classNames(['flex-grow-1', 'd-flex', 'w-100', styles$f.content]),
|
|
886
|
+
children: screen !== null ? /*#__PURE__*/jsx("div", {
|
|
887
|
+
className: "w-100 flex-grow-1",
|
|
888
|
+
style: {
|
|
889
|
+
position: 'relative'
|
|
890
|
+
},
|
|
891
|
+
children: panelTransitions(function (springStyle, item) {
|
|
892
|
+
return item !== null ? /*#__PURE__*/jsx(animated.div, {
|
|
893
|
+
className: classNames(['w-100', styles$f.panel]),
|
|
894
|
+
style: _objectSpread(_objectSpread({}, springStyle), item.key !== (transitionItem === null || transitionItem === void 0 ? void 0 : transitionItem.key) ? {
|
|
895
|
+
position: 'absolute',
|
|
896
|
+
top: 0,
|
|
897
|
+
left: 0,
|
|
898
|
+
width: '100%',
|
|
899
|
+
zIndex: 0
|
|
900
|
+
} : {
|
|
901
|
+
position: 'relative',
|
|
902
|
+
zIndex: 1
|
|
903
|
+
}),
|
|
904
|
+
children: /*#__PURE__*/jsx(ScreenProvider, {
|
|
905
|
+
data: item.screen,
|
|
906
|
+
children: item.isField ? /*#__PURE__*/jsx(FieldWithContexts, {
|
|
907
|
+
name: item.fieldParams.replace(/\//g, '.'),
|
|
908
|
+
value: item.screen,
|
|
909
|
+
form: item.formParams,
|
|
910
|
+
className: styles$f.form,
|
|
911
|
+
gotoFieldForm: gotoFieldForm,
|
|
912
|
+
closeFieldForm: closeFieldForm,
|
|
913
|
+
fieldContext: fieldContext,
|
|
914
|
+
onChange: onScreenFormChange
|
|
915
|
+
}) : /*#__PURE__*/jsx(ScreenForm, {
|
|
916
|
+
value: item.screen,
|
|
917
|
+
className: styles$f.form,
|
|
918
|
+
onChange: onScreenFormChange,
|
|
919
|
+
gotoFieldForm: gotoFieldForm,
|
|
920
|
+
closeFieldForm: closeFieldForm
|
|
921
|
+
})
|
|
922
|
+
})
|
|
923
|
+
}) : null;
|
|
924
|
+
})
|
|
925
|
+
}) : /*#__PURE__*/jsx(Empty, {
|
|
926
|
+
className: "w-100 m-2",
|
|
927
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
928
|
+
id: "QfpTKK",
|
|
929
|
+
defaultMessage: [{
|
|
930
|
+
"type": 0,
|
|
931
|
+
"value": "Select a screen..."
|
|
932
|
+
}],
|
|
933
|
+
decription: "Indication to select a screen to view the form"
|
|
934
|
+
})
|
|
885
935
|
})
|
|
886
|
-
}, /*#__PURE__*/
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
form: item.formParams,
|
|
892
|
-
className: styles$f.form,
|
|
893
|
-
gotoFieldForm: gotoFieldForm,
|
|
894
|
-
closeFieldForm: closeFieldForm,
|
|
895
|
-
fieldContext: fieldContext,
|
|
896
|
-
onChange: onScreenFormChange
|
|
897
|
-
}) : /*#__PURE__*/React.createElement(ScreenForm, {
|
|
898
|
-
value: item.screen,
|
|
899
|
-
className: styles$f.form,
|
|
900
|
-
onChange: onScreenFormChange,
|
|
901
|
-
gotoFieldForm: gotoFieldForm,
|
|
902
|
-
closeFieldForm: closeFieldForm
|
|
903
|
-
}))) : null;
|
|
904
|
-
})) : /*#__PURE__*/React.createElement(Empty, {
|
|
905
|
-
className: "w-100 m-2"
|
|
906
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
907
|
-
id: "QfpTKK",
|
|
908
|
-
defaultMessage: [{
|
|
909
|
-
"type": 0,
|
|
910
|
-
"value": "Select a screen..."
|
|
911
|
-
}],
|
|
912
|
-
decription: "Indication to select a screen to view the form"
|
|
913
|
-
}))), deleteScreenModalOpened ? /*#__PURE__*/React.createElement(DeleteScreenModal, {
|
|
914
|
-
onConfirm: onDeleteScreenConfirm,
|
|
915
|
-
onCancel: onDeleteScreenCancel
|
|
916
|
-
}) : null);
|
|
936
|
+
}), deleteScreenModalOpened ? /*#__PURE__*/jsx(DeleteScreenModal, {
|
|
937
|
+
onConfirm: onDeleteScreenConfirm,
|
|
938
|
+
onCancel: onDeleteScreenCancel
|
|
939
|
+
}) : null]
|
|
940
|
+
});
|
|
917
941
|
}
|
|
918
942
|
|
|
919
943
|
function useScreenStates(screen) {
|
|
@@ -953,7 +977,7 @@ function DesktopIcon(_ref) {
|
|
|
953
977
|
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
954
978
|
_ref$className = _ref.className,
|
|
955
979
|
className = _ref$className === void 0 ? null : _ref$className;
|
|
956
|
-
return /*#__PURE__*/
|
|
980
|
+
return /*#__PURE__*/jsx("svg", {
|
|
957
981
|
xmlns: "http://www.w3.org/2000/svg",
|
|
958
982
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
959
983
|
version: "1.1",
|
|
@@ -963,11 +987,12 @@ function DesktopIcon(_ref) {
|
|
|
963
987
|
height: "100px",
|
|
964
988
|
viewBox: "0 0 100 100",
|
|
965
989
|
xmlSpace: "preserve",
|
|
966
|
-
className: className
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
990
|
+
className: className,
|
|
991
|
+
children: /*#__PURE__*/jsx("path", {
|
|
992
|
+
fill: color,
|
|
993
|
+
d: "M84 17H16c-3.3 0-6 2.7-6 6v42c0 3.3 2.7 6 6 6h22v4.2c-.1.4-.9 1.5-1.3 2-1.1 1.4-2.2 2.8-1.4 4.4.3.7 1.1 1.4 2.7 1.4h23c1 0 3.3 0 4.1-1.8.8-1.8-.6-3.2-1.8-4.5-.4-.5-1.1-1.2-1.3-1.6V71h22c3.3 0 6-2.7 6-6V23c0-3.3-2.7-6-6-6zM40.3 79c.9-1.1 1.7-2.4 1.7-3.8V71h16v4.2c0 1.4 1 2.7 2 3.8H40.3zM86 65c0 1.1-.9 2-2 2H16c-1.1 0-2-.9-2-2v-6h72v6zm0-10H14V23c0-1.1.9-2 2-2h68c1.1 0 2 .9 2 2v32z"
|
|
994
|
+
})
|
|
995
|
+
});
|
|
971
996
|
}
|
|
972
997
|
|
|
973
998
|
/* eslint-disable react/button-has-type, react/jsx-props-no-spreading */
|
|
@@ -976,7 +1001,7 @@ function MobileIcon(_ref) {
|
|
|
976
1001
|
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
977
1002
|
_ref$className = _ref.className,
|
|
978
1003
|
className = _ref$className === void 0 ? null : _ref$className;
|
|
979
|
-
return /*#__PURE__*/
|
|
1004
|
+
return /*#__PURE__*/jsx("svg", {
|
|
980
1005
|
xmlns: "http://www.w3.org/2000/svg",
|
|
981
1006
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
982
1007
|
version: "1.1",
|
|
@@ -986,11 +1011,12 @@ function MobileIcon(_ref) {
|
|
|
986
1011
|
height: "100px",
|
|
987
1012
|
viewBox: "0 0 100 100",
|
|
988
1013
|
xmlSpace: "preserve",
|
|
989
|
-
className: className
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1014
|
+
className: className,
|
|
1015
|
+
children: /*#__PURE__*/jsx("path", {
|
|
1016
|
+
fill: color,
|
|
1017
|
+
d: "M66 11H34c-3.3 0-6 2.7-6 6v66c0 3.3 2.7 6 6 6h32c3.3 0 6-2.7 6-6V17c0-3.3-2.7-6-6-6zm2 72c0 1.1-.9 2-2 2H34c-1.1 0-2-.9-2-2v-4h36v4zm0-8H32V25h36v50zm0-54H32v-4c0-1.1.9-2 2-2h32c1.1 0 2 .9 2 2v4z"
|
|
1018
|
+
})
|
|
1019
|
+
});
|
|
994
1020
|
}
|
|
995
1021
|
|
|
996
1022
|
var DeviceIcons = /*#__PURE__*/Object.freeze({
|
|
@@ -1010,10 +1036,12 @@ function DeviceButton(_ref) {
|
|
|
1010
1036
|
iconComponents = _ref$iconComponents === void 0 ? DeviceIcons : _ref$iconComponents,
|
|
1011
1037
|
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
1012
1038
|
var DeviceIcon = getComponentFromName(device, iconComponents, DesktopIcon);
|
|
1013
|
-
return /*#__PURE__*/
|
|
1039
|
+
return /*#__PURE__*/jsx(Button, _objectSpread(_objectSpread({
|
|
1014
1040
|
className: classNames([styles$e.container, className])
|
|
1015
|
-
}, props),
|
|
1016
|
-
|
|
1041
|
+
}, props), {}, {
|
|
1042
|
+
children: /*#__PURE__*/jsx(DeviceIcon, {
|
|
1043
|
+
className: styles$e.icon
|
|
1044
|
+
})
|
|
1017
1045
|
}));
|
|
1018
1046
|
}
|
|
1019
1047
|
|
|
@@ -1028,16 +1056,16 @@ function DevicesMenu(_ref) {
|
|
|
1028
1056
|
className = _ref$className === void 0 ? null : _ref$className,
|
|
1029
1057
|
_ref$onClickItem = _ref.onClickItem,
|
|
1030
1058
|
onClickItem = _ref$onClickItem === void 0 ? null : _ref$onClickItem;
|
|
1031
|
-
return /*#__PURE__*/
|
|
1059
|
+
return /*#__PURE__*/jsx(Tabs, {
|
|
1032
1060
|
items: items,
|
|
1033
1061
|
theme: "outline-secondary",
|
|
1034
1062
|
className: classNames([styles$d.container, className]),
|
|
1035
1063
|
renderItemButton: function renderItemButton(item, index, props) {
|
|
1036
1064
|
var id = item.id,
|
|
1037
1065
|
itemProps = _objectWithoutProperties(item, _excluded$6);
|
|
1038
|
-
return /*#__PURE__*/
|
|
1066
|
+
return /*#__PURE__*/jsx(DeviceButton, _objectSpread(_objectSpread(_objectSpread({
|
|
1039
1067
|
device: id
|
|
1040
|
-
}, props, itemProps, {
|
|
1068
|
+
}, props), itemProps), {}, {
|
|
1041
1069
|
className: styles$d.button,
|
|
1042
1070
|
onClick: function onClick(e) {
|
|
1043
1071
|
return onClickItem !== null ? onClickItem(e, item, index) : null;
|
|
@@ -1070,30 +1098,36 @@ function ScreenButton(_ref) {
|
|
|
1070
1098
|
onClick = _ref$onClick === void 0 ? null : _ref$onClick,
|
|
1071
1099
|
_ref$refButton = _ref.refButton,
|
|
1072
1100
|
refButton = _ref$refButton === void 0 ? null : _ref$refButton;
|
|
1073
|
-
return /*#__PURE__*/
|
|
1074
|
-
className: classNames([styles$c.container, 'rounded', className, _defineProperty({}, styles$c.active, active)])
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1101
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1102
|
+
className: classNames([styles$c.container, 'rounded', className, _defineProperty({}, styles$c.active, active)]),
|
|
1103
|
+
children: [children !== null ? children : /*#__PURE__*/jsx("div", {
|
|
1104
|
+
className: styles$c.screen,
|
|
1105
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
1106
|
+
className: styles$c.inner,
|
|
1107
|
+
children: [icon !== null ? /*#__PURE__*/jsx("div", {
|
|
1108
|
+
className: styles$c.icon,
|
|
1109
|
+
children: icon
|
|
1110
|
+
}) : null, label !== null ? /*#__PURE__*/jsx("div", {
|
|
1111
|
+
className: styles$c.label,
|
|
1112
|
+
children: label
|
|
1113
|
+
}) : null]
|
|
1114
|
+
})
|
|
1115
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
1116
|
+
className: styles$c.button,
|
|
1117
|
+
withoutStyle: true,
|
|
1118
|
+
id: id,
|
|
1119
|
+
href: href,
|
|
1120
|
+
title: title,
|
|
1121
|
+
onClick: onClick,
|
|
1122
|
+
refButton: refButton,
|
|
1123
|
+
children: /*#__PURE__*/jsx("span", {
|
|
1124
|
+
className: classNames([styles$c.border, 'rounded'])
|
|
1125
|
+
})
|
|
1126
|
+
})]
|
|
1127
|
+
});
|
|
1094
1128
|
}
|
|
1095
1129
|
var ScreenButton$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
1096
|
-
return /*#__PURE__*/
|
|
1130
|
+
return /*#__PURE__*/jsx(ScreenButton, _objectSpread(_objectSpread({}, props), {}, {
|
|
1097
1131
|
refButton: ref
|
|
1098
1132
|
}));
|
|
1099
1133
|
});
|
|
@@ -1136,37 +1170,42 @@ function ScreenWithPreview(_ref) {
|
|
|
1136
1170
|
visible = _useIsVisible.visible;
|
|
1137
1171
|
var ScreenComponent = withPlaceholder ? ScreenPlaceholder : ScreenPreview;
|
|
1138
1172
|
var finalTitle = isMessage(title) ? intl.formatMessage(title) : title || null;
|
|
1139
|
-
return /*#__PURE__*/
|
|
1140
|
-
ref: ref
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1173
|
+
return /*#__PURE__*/jsx("div", {
|
|
1174
|
+
ref: ref,
|
|
1175
|
+
children: /*#__PURE__*/jsxs(ScreenButton$1, {
|
|
1176
|
+
href: href,
|
|
1177
|
+
active: active,
|
|
1178
|
+
className: classNames([styles$b.button, className, _defineProperty({}, styles$b.withIndex, withIndexIndicator || withName)]),
|
|
1179
|
+
title: finalTitle,
|
|
1180
|
+
onClick: function onClick() {
|
|
1181
|
+
if (_onClick !== null) {
|
|
1182
|
+
_onClick(screen, index);
|
|
1183
|
+
}
|
|
1184
|
+
if (onClickItem !== null) {
|
|
1185
|
+
onClickItem(screen, index);
|
|
1186
|
+
}
|
|
1187
|
+
},
|
|
1188
|
+
children: [/*#__PURE__*/jsx(ScreenComponent, {
|
|
1189
|
+
screen: screen,
|
|
1190
|
+
screenState: screenState,
|
|
1191
|
+
className: styles$b.screen,
|
|
1192
|
+
hidden: !visible,
|
|
1193
|
+
withSize: true
|
|
1194
|
+
}), index !== null && withIndexIndicator ? /*#__PURE__*/jsx("div", {
|
|
1195
|
+
className: styles$b.index,
|
|
1196
|
+
children: index + 1
|
|
1197
|
+
}) : null, withName && !withIndexIndicator ? /*#__PURE__*/jsx("div", {
|
|
1198
|
+
className: styles$b.name,
|
|
1199
|
+
children: finalTitle || null
|
|
1200
|
+
}) : null, withDeleteButtonOnRepeatables ? /*#__PURE__*/jsx("div", {
|
|
1201
|
+
className: styles$b.deleteButton,
|
|
1202
|
+
onClick: onDeleteButtonClick,
|
|
1203
|
+
children: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
1204
|
+
icon: faTimesCircle
|
|
1205
|
+
})
|
|
1206
|
+
}) : null]
|
|
1207
|
+
})
|
|
1208
|
+
});
|
|
1170
1209
|
}
|
|
1171
1210
|
|
|
1172
1211
|
var styles$a = {"container":"micromag-editor-partials-screen-states-container","button":"micromag-editor-partials-screen-states-button","addButton":"micromag-editor-partials-screen-states-addButton","title":"micromag-editor-partials-screen-states-title","settings":"micromag-editor-partials-screen-states-settings"};
|
|
@@ -1198,131 +1237,140 @@ function ScreenStates(_ref) {
|
|
|
1198
1237
|
var id = _ref4.id;
|
|
1199
1238
|
return id === stateParam;
|
|
1200
1239
|
}) !== -1 ? stateParam : null;
|
|
1201
|
-
return /*#__PURE__*/
|
|
1202
|
-
className: classNames([styles$a.container, className])
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1240
|
+
return /*#__PURE__*/jsx("div", {
|
|
1241
|
+
className: classNames([styles$a.container, className]),
|
|
1242
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
1243
|
+
className: "d-flex align-items-end m-n1",
|
|
1244
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
1245
|
+
className: classNames(['p-1 align-self-stretch d-flex flex-column', styles$a.settings]),
|
|
1246
|
+
children: [/*#__PURE__*/jsx("h6", {
|
|
1247
|
+
className: classNames(['fw-normal', 'invisible', styles$a.title]),
|
|
1248
|
+
children: "Settings"
|
|
1249
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
1250
|
+
className: classNames([styles$a.button, 'p-0', 'flex-grow-1', 'justify-content-center']),
|
|
1251
|
+
theme: screenParam !== null && field === null ? 'primary' : 'secondary',
|
|
1252
|
+
outline: screenParam === null || field !== null,
|
|
1253
|
+
size: "lg",
|
|
1254
|
+
icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
1255
|
+
icon: faCogs
|
|
1256
|
+
}),
|
|
1257
|
+
href: url('screen', {
|
|
1258
|
+
screen: screen.id
|
|
1259
|
+
})
|
|
1260
|
+
})]
|
|
1261
|
+
}), states.map(function (state) {
|
|
1262
|
+
var id = state.id,
|
|
1263
|
+
_state$label = state.label,
|
|
1264
|
+
label = _state$label === void 0 ? null : _state$label,
|
|
1265
|
+
_state$repeatable = state.repeatable,
|
|
1266
|
+
repeatable = _state$repeatable === void 0 ? false : _state$repeatable,
|
|
1267
|
+
_state$withoutCreate = state.withoutCreate,
|
|
1268
|
+
withoutCreate = _state$withoutCreate === void 0 ? false : _state$withoutCreate,
|
|
1269
|
+
_state$fieldName = state.fieldName,
|
|
1270
|
+
fieldName = _state$fieldName === void 0 ? null : _state$fieldName;
|
|
1271
|
+
var repeatableItems = repeatable ? screen[fieldName || id] || [] : null;
|
|
1272
|
+
var onClickAdd = function onClickAdd() {
|
|
1273
|
+
var _ref5 = value || {},
|
|
1274
|
+
_ref5$components = _ref5.components,
|
|
1275
|
+
currentComponentsValue = _ref5$components === void 0 ? [] : _ref5$components;
|
|
1276
|
+
var currentScreenIndex = currentComponentsValue.findIndex(function (_ref6) {
|
|
1277
|
+
var screenId = _ref6.id;
|
|
1278
|
+
return screen.id === screenId;
|
|
1279
|
+
});
|
|
1280
|
+
var currentScreenValue = currentComponentsValue[currentScreenIndex] || {};
|
|
1281
|
+
var currentFieldValue = currentScreenValue[fieldName || id] || [];
|
|
1282
|
+
var newValue = _objectSpread(_objectSpread({}, value), {}, {
|
|
1283
|
+
components: [].concat(_toConsumableArray(currentComponentsValue.slice(0, currentScreenIndex)), [_objectSpread(_objectSpread({}, currentScreenValue), {}, _defineProperty({}, fieldName || id, [].concat(_toConsumableArray(currentFieldValue), [{}])))], _toConsumableArray(currentComponentsValue.slice(currentScreenIndex + 1)))
|
|
1284
|
+
});
|
|
1285
|
+
if (onChange !== null) {
|
|
1286
|
+
onChange(newValue);
|
|
1287
|
+
}
|
|
1288
|
+
push('screen.field', {
|
|
1289
|
+
screen: screen.id,
|
|
1290
|
+
field: [id, currentFieldValue.length]
|
|
1291
|
+
});
|
|
1292
|
+
};
|
|
1293
|
+
var onClickDelete = function onClickDelete(indexToDelete) {
|
|
1294
|
+
var _ref7 = value || {},
|
|
1295
|
+
_ref7$components = _ref7.components,
|
|
1296
|
+
currentComponentsValue = _ref7$components === void 0 ? [] : _ref7$components;
|
|
1297
|
+
var currentScreenIndex = currentComponentsValue.findIndex(function (_ref8) {
|
|
1298
|
+
var screenId = _ref8.id;
|
|
1299
|
+
return screen.id === screenId;
|
|
1300
|
+
});
|
|
1301
|
+
var currentScreenValue = currentComponentsValue[currentScreenIndex] || {};
|
|
1302
|
+
currentScreenValue[fieldName || id] || [];
|
|
1303
|
+
var newValue = _objectSpread(_objectSpread({}, value), {}, {
|
|
1304
|
+
components: [].concat(_toConsumableArray(currentComponentsValue.slice(0, currentScreenIndex)), [_objectSpread(_objectSpread({}, currentScreenValue), {}, _defineProperty({}, fieldName || id, (currentScreenValue[fieldName || id] || []).filter(function (_, index) {
|
|
1305
|
+
return index !== indexToDelete;
|
|
1306
|
+
})))], _toConsumableArray(currentComponentsValue.slice(currentScreenIndex + 1)))
|
|
1307
|
+
});
|
|
1308
|
+
if (onChange !== null) {
|
|
1309
|
+
onChange(newValue);
|
|
1310
|
+
}
|
|
1311
|
+
push('screen', {
|
|
1312
|
+
screen: screen.id
|
|
1313
|
+
});
|
|
1314
|
+
};
|
|
1315
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1316
|
+
className: "p-1 align-self-stretch d-flex flex-column",
|
|
1317
|
+
children: [/*#__PURE__*/jsx("h6", {
|
|
1318
|
+
className: classNames(['fw-normal', 'text-body-secondary', styles$a.title]),
|
|
1319
|
+
children: /*#__PURE__*/jsx(FormattedMessage, _objectSpread({}, label))
|
|
1320
|
+
}), repeatable ? /*#__PURE__*/jsxs("ul", {
|
|
1321
|
+
className: "d-flex list-unstyled m-n1 flex-grow-1",
|
|
1322
|
+
children: [repeatableItems.map(function (item, index) {
|
|
1323
|
+
return /*#__PURE__*/jsx("li", {
|
|
1324
|
+
className: "p-1",
|
|
1325
|
+
children: /*#__PURE__*/jsx(ScreenWithPreview, {
|
|
1326
|
+
index: index,
|
|
1327
|
+
withIndexIndicator: true,
|
|
1328
|
+
withDeleteButtonOnRepeatables: true,
|
|
1329
|
+
screen: screen,
|
|
1330
|
+
screenState: "".concat(id, ".").concat(index),
|
|
1331
|
+
className: styles$a.button,
|
|
1332
|
+
active: currentState !== null && id === currentState.split('.')[0] && stateIndex !== null && parseInt(stateIndex, 10) === index,
|
|
1333
|
+
href: url('screen.field', {
|
|
1334
|
+
screen: screen.id,
|
|
1335
|
+
field: [id, index]
|
|
1336
|
+
}),
|
|
1337
|
+
onDeleteButtonClick: function onDeleteButtonClick() {
|
|
1338
|
+
return onClickDelete(index);
|
|
1339
|
+
}
|
|
1340
|
+
})
|
|
1341
|
+
});
|
|
1342
|
+
}), !withoutCreate ? /*#__PURE__*/jsx("li", {
|
|
1343
|
+
className: "p-1",
|
|
1344
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
1345
|
+
className: classNames([styles$a.button, styles$a.addButton, 'h-100', 'p-0', 'justify-content-center']),
|
|
1346
|
+
theme: "secondary",
|
|
1347
|
+
outline: true,
|
|
1348
|
+
size: "lg",
|
|
1349
|
+
icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
1350
|
+
icon: faPlus
|
|
1351
|
+
}),
|
|
1352
|
+
onClick: onClickAdd
|
|
1353
|
+
})
|
|
1354
|
+
}) : null]
|
|
1355
|
+
}) : /*#__PURE__*/jsx(ScreenWithPreview, {
|
|
1356
|
+
screen: screen,
|
|
1357
|
+
screenState: id,
|
|
1358
|
+
className: styles$a.button,
|
|
1359
|
+
active: id === currentState,
|
|
1360
|
+
href: url('screen.field', {
|
|
1361
|
+
screen: screen.id,
|
|
1362
|
+
field: id
|
|
1363
|
+
})
|
|
1364
|
+
// onClick={() => {
|
|
1365
|
+
// if (onStateChange !== null) {
|
|
1366
|
+
// onStateChange(id);
|
|
1367
|
+
// }
|
|
1368
|
+
// }}
|
|
1369
|
+
})]
|
|
1370
|
+
});
|
|
1371
|
+
})]
|
|
1219
1372
|
})
|
|
1220
|
-
})
|
|
1221
|
-
var id = state.id,
|
|
1222
|
-
_state$label = state.label,
|
|
1223
|
-
label = _state$label === void 0 ? null : _state$label,
|
|
1224
|
-
_state$repeatable = state.repeatable,
|
|
1225
|
-
repeatable = _state$repeatable === void 0 ? false : _state$repeatable,
|
|
1226
|
-
_state$withoutCreate = state.withoutCreate,
|
|
1227
|
-
withoutCreate = _state$withoutCreate === void 0 ? false : _state$withoutCreate,
|
|
1228
|
-
_state$fieldName = state.fieldName,
|
|
1229
|
-
fieldName = _state$fieldName === void 0 ? null : _state$fieldName;
|
|
1230
|
-
var repeatableItems = repeatable ? screen[fieldName || id] || [] : null;
|
|
1231
|
-
var onClickAdd = function onClickAdd() {
|
|
1232
|
-
var _ref5 = value || {},
|
|
1233
|
-
_ref5$components = _ref5.components,
|
|
1234
|
-
currentComponentsValue = _ref5$components === void 0 ? [] : _ref5$components;
|
|
1235
|
-
var currentScreenIndex = currentComponentsValue.findIndex(function (_ref6) {
|
|
1236
|
-
var screenId = _ref6.id;
|
|
1237
|
-
return screen.id === screenId;
|
|
1238
|
-
});
|
|
1239
|
-
var currentScreenValue = currentComponentsValue[currentScreenIndex] || {};
|
|
1240
|
-
var currentFieldValue = currentScreenValue[fieldName || id] || [];
|
|
1241
|
-
var newValue = _objectSpread(_objectSpread({}, value), {}, {
|
|
1242
|
-
components: [].concat(_toConsumableArray(currentComponentsValue.slice(0, currentScreenIndex)), [_objectSpread(_objectSpread({}, currentScreenValue), {}, _defineProperty({}, fieldName || id, [].concat(_toConsumableArray(currentFieldValue), [{}])))], _toConsumableArray(currentComponentsValue.slice(currentScreenIndex + 1)))
|
|
1243
|
-
});
|
|
1244
|
-
if (onChange !== null) {
|
|
1245
|
-
onChange(newValue);
|
|
1246
|
-
}
|
|
1247
|
-
push('screen.field', {
|
|
1248
|
-
screen: screen.id,
|
|
1249
|
-
field: [id, currentFieldValue.length]
|
|
1250
|
-
});
|
|
1251
|
-
};
|
|
1252
|
-
var onClickDelete = function onClickDelete(indexToDelete) {
|
|
1253
|
-
var _ref7 = value || {},
|
|
1254
|
-
_ref7$components = _ref7.components,
|
|
1255
|
-
currentComponentsValue = _ref7$components === void 0 ? [] : _ref7$components;
|
|
1256
|
-
var currentScreenIndex = currentComponentsValue.findIndex(function (_ref8) {
|
|
1257
|
-
var screenId = _ref8.id;
|
|
1258
|
-
return screen.id === screenId;
|
|
1259
|
-
});
|
|
1260
|
-
var currentScreenValue = currentComponentsValue[currentScreenIndex] || {};
|
|
1261
|
-
currentScreenValue[fieldName || id] || [];
|
|
1262
|
-
var newValue = _objectSpread(_objectSpread({}, value), {}, {
|
|
1263
|
-
components: [].concat(_toConsumableArray(currentComponentsValue.slice(0, currentScreenIndex)), [_objectSpread(_objectSpread({}, currentScreenValue), {}, _defineProperty({}, fieldName || id, (currentScreenValue[fieldName || id] || []).filter(function (_, index) {
|
|
1264
|
-
return index !== indexToDelete;
|
|
1265
|
-
})))], _toConsumableArray(currentComponentsValue.slice(currentScreenIndex + 1)))
|
|
1266
|
-
});
|
|
1267
|
-
if (onChange !== null) {
|
|
1268
|
-
onChange(newValue);
|
|
1269
|
-
}
|
|
1270
|
-
push('screen', {
|
|
1271
|
-
screen: screen.id
|
|
1272
|
-
});
|
|
1273
|
-
};
|
|
1274
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1275
|
-
className: "p-1 align-self-stretch d-flex flex-column"
|
|
1276
|
-
}, /*#__PURE__*/React.createElement("h6", {
|
|
1277
|
-
className: classNames(['fw-normal', 'text-body-secondary', styles$a.title])
|
|
1278
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, label)), repeatable ? /*#__PURE__*/React.createElement("ul", {
|
|
1279
|
-
className: "d-flex list-unstyled m-n1 flex-grow-1"
|
|
1280
|
-
}, repeatableItems.map(function (item, index) {
|
|
1281
|
-
return /*#__PURE__*/React.createElement("li", {
|
|
1282
|
-
className: "p-1"
|
|
1283
|
-
}, /*#__PURE__*/React.createElement(ScreenWithPreview, {
|
|
1284
|
-
index: index,
|
|
1285
|
-
withIndexIndicator: true,
|
|
1286
|
-
withDeleteButtonOnRepeatables: true,
|
|
1287
|
-
screen: screen,
|
|
1288
|
-
screenState: "".concat(id, ".").concat(index),
|
|
1289
|
-
className: styles$a.button,
|
|
1290
|
-
active: currentState !== null && id === currentState.split('.')[0] && stateIndex !== null && parseInt(stateIndex, 10) === index,
|
|
1291
|
-
href: url('screen.field', {
|
|
1292
|
-
screen: screen.id,
|
|
1293
|
-
field: [id, index]
|
|
1294
|
-
}),
|
|
1295
|
-
onDeleteButtonClick: function onDeleteButtonClick() {
|
|
1296
|
-
return onClickDelete(index);
|
|
1297
|
-
}
|
|
1298
|
-
}));
|
|
1299
|
-
}), !withoutCreate ? /*#__PURE__*/React.createElement("li", {
|
|
1300
|
-
className: "p-1"
|
|
1301
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
1302
|
-
className: classNames([styles$a.button, styles$a.addButton, 'h-100', 'p-0', 'justify-content-center']),
|
|
1303
|
-
theme: "secondary",
|
|
1304
|
-
outline: true,
|
|
1305
|
-
size: "lg",
|
|
1306
|
-
icon: /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
1307
|
-
icon: faPlus
|
|
1308
|
-
}),
|
|
1309
|
-
onClick: onClickAdd
|
|
1310
|
-
})) : null) : /*#__PURE__*/React.createElement(ScreenWithPreview, {
|
|
1311
|
-
screen: screen,
|
|
1312
|
-
screenState: id,
|
|
1313
|
-
className: styles$a.button,
|
|
1314
|
-
active: id === currentState,
|
|
1315
|
-
href: url('screen.field', {
|
|
1316
|
-
screen: screen.id,
|
|
1317
|
-
field: id
|
|
1318
|
-
})
|
|
1319
|
-
// onClick={() => {
|
|
1320
|
-
// if (onStateChange !== null) {
|
|
1321
|
-
// onStateChange(id);
|
|
1322
|
-
// }
|
|
1323
|
-
// }}
|
|
1324
|
-
}));
|
|
1325
|
-
})));
|
|
1373
|
+
});
|
|
1326
1374
|
}
|
|
1327
1375
|
|
|
1328
1376
|
var styles$9 = {"container":"micromag-editor-preview-container","inner":"micromag-editor-preview-inner","top":"micromag-editor-preview-top","bottom":"micromag-editor-preview-bottom","preview":"micromag-editor-preview-preview","viewerContainer":"micromag-editor-preview-viewerContainer","deviceMenu":"micromag-editor-preview-deviceMenu","devices":"micromag-editor-preview-devices","noStory":"micromag-editor-preview-noStory","story":"micromag-editor-preview-story"};
|
|
@@ -1434,55 +1482,65 @@ function EditorPreview(_ref) {
|
|
|
1434
1482
|
var currentScreenStateId = currentScreenState !== null && repeatable ? "".concat(screenStateId, ".").concat(fieldParam.split('/').find(function (it) {
|
|
1435
1483
|
return it.match(/^[0-9]+$/) !== null;
|
|
1436
1484
|
}) || 0) : screenStateId;
|
|
1437
|
-
return /*#__PURE__*/
|
|
1485
|
+
return /*#__PURE__*/jsx("div", {
|
|
1438
1486
|
className: classNames([styles$9.container, screens.map(function (screenName) {
|
|
1439
1487
|
return styles$9["screen-".concat(screenName)];
|
|
1440
|
-
}), className, _defineProperty({}, styles$9.withoutDevicesSizes, withoutDevicesSizes)])
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1488
|
+
}), className, _defineProperty({}, styles$9.withoutDevicesSizes, withoutDevicesSizes)]),
|
|
1489
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
1490
|
+
className: styles$9.inner,
|
|
1491
|
+
children: [currentScreenStates !== null && currentScreen !== null ? /*#__PURE__*/jsx("div", {
|
|
1492
|
+
className: classNames([styles$9.top, 'px-1']),
|
|
1493
|
+
children: /*#__PURE__*/jsx(ScreenStates, {
|
|
1494
|
+
screen: currentScreen,
|
|
1495
|
+
screenState: currentScreenStateId,
|
|
1496
|
+
value: value,
|
|
1497
|
+
onChange: onChange
|
|
1498
|
+
})
|
|
1499
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
1500
|
+
className: styles$9.bottom,
|
|
1501
|
+
children: /*#__PURE__*/jsx("div", {
|
|
1502
|
+
className: styles$9.inner,
|
|
1503
|
+
ref: bottomRef,
|
|
1504
|
+
children: /*#__PURE__*/jsx("div", {
|
|
1505
|
+
className: styles$9.preview,
|
|
1506
|
+
style: previewStyle,
|
|
1507
|
+
children: /*#__PURE__*/jsx("div", {
|
|
1508
|
+
className: styles$9.viewerContainer,
|
|
1509
|
+
children: /*#__PURE__*/jsx(PlaybackProvider, {
|
|
1510
|
+
children: /*#__PURE__*/jsx(Viewer, {
|
|
1511
|
+
story: valueParsed,
|
|
1512
|
+
storyIsParsed: true,
|
|
1513
|
+
screen: screenId,
|
|
1514
|
+
screenState: currentScreenStateId,
|
|
1515
|
+
className: styles$9.story,
|
|
1516
|
+
theme: viewerTheme,
|
|
1517
|
+
interactions: null,
|
|
1518
|
+
renderContext: "edit",
|
|
1519
|
+
onScreenChange: onScreenChange,
|
|
1520
|
+
withNavigationHint: false,
|
|
1521
|
+
withoutNavigationArrow: true,
|
|
1522
|
+
withoutTransitions: true,
|
|
1523
|
+
withoutGestures: true,
|
|
1524
|
+
withoutMenu: true
|
|
1525
|
+
})
|
|
1526
|
+
})
|
|
1527
|
+
})
|
|
1528
|
+
})
|
|
1529
|
+
})
|
|
1530
|
+
}), !withoutDevicesSizes ? /*#__PURE__*/jsx("div", {
|
|
1531
|
+
className: styles$9.deviceMenu,
|
|
1532
|
+
children: /*#__PURE__*/jsx(DevicesMenu, {
|
|
1533
|
+
items: devices.map(function (it) {
|
|
1534
|
+
return _objectSpread(_objectSpread({}, it), {}, {
|
|
1535
|
+
active: it.id === deviceId
|
|
1536
|
+
});
|
|
1537
|
+
}),
|
|
1538
|
+
onClickItem: onClickDeviceItem,
|
|
1539
|
+
className: styles$9.devices
|
|
1540
|
+
})
|
|
1541
|
+
}) : null]
|
|
1542
|
+
})
|
|
1543
|
+
});
|
|
1486
1544
|
}
|
|
1487
1545
|
|
|
1488
1546
|
var iOS = /iPad|iPhone|iPod/.test(navigator.platform);
|
|
@@ -1875,44 +1933,54 @@ var SortableTreeItemActions = function SortableTreeItemActions(_ref) {
|
|
|
1875
1933
|
_ref$containerRef = _ref.containerRef,
|
|
1876
1934
|
containerRef = _ref$containerRef === void 0 ? null : _ref$containerRef,
|
|
1877
1935
|
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
1878
|
-
return /*#__PURE__*/
|
|
1936
|
+
return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
1879
1937
|
className: classNames([styles$8.wrapper, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles$8.clone, clone), styles$8.ghost, ghost), styles$8.indicator, indicator), styles$8.disableSelection, disableSelection), styles$8.disableInteraction, disableInteraction), styles$8.withChildren, onCollapse !== null)]),
|
|
1880
1938
|
ref: wrapperRef,
|
|
1881
1939
|
style: {
|
|
1882
1940
|
marginLeft: "".concat(indentationWidth * depth, "px"),
|
|
1883
1941
|
marginRight: "".concat(5 * depth, "px")
|
|
1884
1942
|
}
|
|
1885
|
-
}, props),
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1943
|
+
}, props), {}, {
|
|
1944
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
1945
|
+
className: styles$8.inner,
|
|
1946
|
+
ref: containerRef,
|
|
1947
|
+
style: style,
|
|
1948
|
+
children: [/*#__PURE__*/jsx("button", _objectSpread(_objectSpread({
|
|
1949
|
+
className: classNames([styles$8.button, styles$8.handle]),
|
|
1950
|
+
type: "button"
|
|
1951
|
+
}, handleProps), {}, {
|
|
1952
|
+
children: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
1953
|
+
className: styles$8.icon,
|
|
1954
|
+
icon: faGripLines
|
|
1955
|
+
})
|
|
1956
|
+
})), !clone && onRemove ? /*#__PURE__*/jsx("button", {
|
|
1957
|
+
type: "button",
|
|
1958
|
+
onClick: onRemove,
|
|
1959
|
+
children: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
1960
|
+
icon: faTimes
|
|
1961
|
+
})
|
|
1962
|
+
}) : null, clone && showCount && childCount && childCount > 1 ? /*#__PURE__*/jsx("span", {
|
|
1963
|
+
className: styles$8.count,
|
|
1964
|
+
children: childCount
|
|
1965
|
+
}) : null, showCollapsedCount && onCollapse && collapsed && childCount !== null && childCount > 0 ? /*#__PURE__*/jsx("span", {
|
|
1966
|
+
className: styles$8.collapsedCount,
|
|
1967
|
+
children: childCount
|
|
1968
|
+
}) : null, onCollapse && depth === 0 ? /*#__PURE__*/jsx("button", {
|
|
1969
|
+
type: "button",
|
|
1970
|
+
onClick: onCollapse,
|
|
1971
|
+
className: classNames(styles$8.button, styles$8.collapse, collapsed && styles$8.collapsed),
|
|
1972
|
+
children: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
1973
|
+
icon: faAngleDown
|
|
1974
|
+
})
|
|
1975
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
1976
|
+
className: styles$8.children,
|
|
1977
|
+
children: children
|
|
1978
|
+
})]
|
|
1979
|
+
})
|
|
1980
|
+
}));
|
|
1913
1981
|
};
|
|
1914
1982
|
var SortableTreeItemActions$1 = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
1915
|
-
return /*#__PURE__*/
|
|
1983
|
+
return /*#__PURE__*/jsx(SortableTreeItemActions, _objectSpread(_objectSpread({}, props), {}, {
|
|
1916
1984
|
containerRef: ref
|
|
1917
1985
|
}));
|
|
1918
1986
|
});
|
|
@@ -1989,27 +2057,32 @@ function SortableTreeItem(_ref2) {
|
|
|
1989
2057
|
onPointerUp(e);
|
|
1990
2058
|
}
|
|
1991
2059
|
}, [onPointerUp]);
|
|
1992
|
-
return /*#__PURE__*/
|
|
1993
|
-
className: classNames([styles$7.container])
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2060
|
+
return /*#__PURE__*/jsx("div", {
|
|
2061
|
+
className: classNames([styles$7.container]),
|
|
2062
|
+
children: /*#__PURE__*/jsxs(SortableTreeItemActions$1, _objectSpread(_objectSpread({
|
|
2063
|
+
ref: setDraggableNodeRef,
|
|
2064
|
+
wrapperRef: setDroppableNodeRef,
|
|
2065
|
+
style: actionsStyle,
|
|
2066
|
+
depth: depth,
|
|
2067
|
+
ghost: isDragging,
|
|
2068
|
+
disableSelection: iOS,
|
|
2069
|
+
disableInteraction: isSorting,
|
|
2070
|
+
handleProps: _objectSpread(_objectSpread(_objectSpread({}, attributes), listeners), {}, {
|
|
2071
|
+
onPointerDown: onClickAction,
|
|
2072
|
+
onPointerUp: cancellingPointerUp
|
|
2073
|
+
}),
|
|
2074
|
+
collapsed: collapsed,
|
|
2075
|
+
onCollapse: onCollapse
|
|
2076
|
+
}, props), {}, {
|
|
2077
|
+
children: [Component !== null ? /*#__PURE__*/jsx("div", {
|
|
2078
|
+
className: styles$7.parent,
|
|
2079
|
+
children: /*#__PURE__*/jsx(Component, _objectSpread({}, value))
|
|
2080
|
+
}) : null, childValue !== null ? /*#__PURE__*/jsx("div", {
|
|
2081
|
+
className: styles$7.child,
|
|
2082
|
+
children: /*#__PURE__*/jsx(Component, _objectSpread({}, childValue))
|
|
2083
|
+
}) : null]
|
|
2084
|
+
}))
|
|
2085
|
+
});
|
|
2013
2086
|
}
|
|
2014
2087
|
|
|
2015
2088
|
var styles$6 = {"item":"micromag-editor-sortable-sortable-tree-item","parent":"micromag-editor-sortable-sortable-tree-parent","group":"micromag-editor-sortable-sortable-tree-group","isLastChild":"micromag-editor-sortable-sortable-tree-isLastChild"};
|
|
@@ -2333,7 +2406,7 @@ function SortableTree(_ref2) {
|
|
|
2333
2406
|
});
|
|
2334
2407
|
});
|
|
2335
2408
|
}, [setItems, setProperty]);
|
|
2336
|
-
return /*#__PURE__*/
|
|
2409
|
+
return /*#__PURE__*/jsx(DndContext, {
|
|
2337
2410
|
accessibility: {
|
|
2338
2411
|
announcements: announcements
|
|
2339
2412
|
}
|
|
@@ -2346,75 +2419,77 @@ function SortableTree(_ref2) {
|
|
|
2346
2419
|
onDragMove: handleDragMove,
|
|
2347
2420
|
onDragOver: handleDragOver,
|
|
2348
2421
|
onDragEnd: handleDragEnd,
|
|
2349
|
-
onDragCancel: handleDragCancel
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2422
|
+
onDragCancel: handleDragCancel,
|
|
2423
|
+
children: /*#__PURE__*/jsxs(SortableContext, {
|
|
2424
|
+
items: sortedIds,
|
|
2425
|
+
strategy: verticalListSortingStrategy,
|
|
2426
|
+
children: [flattenedItems.map(function (_ref17, idx) {
|
|
2427
|
+
var _flattenedItems;
|
|
2428
|
+
var id = _ref17.id,
|
|
2429
|
+
_ref17$children = _ref17.children,
|
|
2430
|
+
children = _ref17$children === void 0 ? [] : _ref17$children,
|
|
2431
|
+
collapsed = _ref17.collapsed,
|
|
2432
|
+
depth = _ref17.depth;
|
|
2433
|
+
var screenValue = defaultItems.find(function (_ref18) {
|
|
2434
|
+
var _ref18$id = _ref18.id,
|
|
2435
|
+
defaultId = _ref18$id === void 0 ? null : _ref18$id;
|
|
2436
|
+
return defaultId === id;
|
|
2437
|
+
});
|
|
2438
|
+
var next = ((_flattenedItems = flattenedItems[idx + 1]) === null || _flattenedItems === void 0 ? void 0 : _flattenedItems.parentId) || null;
|
|
2439
|
+
var isCollapsed = collapsed && children.length > 0;
|
|
2440
|
+
var onCollapse = collapsible && children.length ? function () {
|
|
2441
|
+
return handleCollapse(id);
|
|
2442
|
+
} : null;
|
|
2443
|
+
var currentDepth = id === activeId && projected ? projected.depth : depth;
|
|
2444
|
+
var childCount = getChildCount(items, id);
|
|
2445
|
+
var childValue = childCount > 0 && collapsed ? defaultItems.slice().reverse().find(function (_ref19) {
|
|
2446
|
+
var _ref19$parentId = _ref19.parentId,
|
|
2447
|
+
parentId = _ref19$parentId === void 0 ? null : _ref19$parentId;
|
|
2448
|
+
return parentId === id;
|
|
2449
|
+
}) : null;
|
|
2450
|
+
return /*#__PURE__*/jsx("div", {
|
|
2451
|
+
className: classNames([styles$6.item, _defineProperty(_defineProperty(_defineProperty({}, styles$6.parent, onCollapse !== null && !collapsed), styles$6.group, depth === 1), styles$6.isLastChild, next === null)]),
|
|
2452
|
+
children: /*#__PURE__*/jsx(SortableTreeItem, {
|
|
2453
|
+
id: id,
|
|
2454
|
+
depth: currentDepth,
|
|
2455
|
+
indentationWidth: indentationWidth,
|
|
2456
|
+
indicator: indicator,
|
|
2457
|
+
collapsed: isCollapsed,
|
|
2458
|
+
onCollapse: onCollapse,
|
|
2459
|
+
onRemove: removable ? function () {
|
|
2460
|
+
return handleRemove(id);
|
|
2461
|
+
} : undefined,
|
|
2462
|
+
childCount: childCount,
|
|
2463
|
+
component: component,
|
|
2464
|
+
value: (screenValue === null || screenValue === void 0 ? void 0 : screenValue.value) || null,
|
|
2465
|
+
onClickItem: onClickItem,
|
|
2466
|
+
index: idx,
|
|
2467
|
+
childValue: (childValue === null || childValue === void 0 ? void 0 : childValue.value) || null
|
|
2468
|
+
}, id)
|
|
2469
|
+
}, id);
|
|
2470
|
+
}), /*#__PURE__*/createPortal(/*#__PURE__*/jsx(DragOverlay, {
|
|
2471
|
+
dropAnimation: dropAnimation,
|
|
2472
|
+
modifiers: indicator ? [adjustTranslate] : undefined,
|
|
2473
|
+
children: activeId && activeItem ? /*#__PURE__*/jsx("div", {
|
|
2474
|
+
className: styles$6.item,
|
|
2475
|
+
children: /*#__PURE__*/jsx(SortableTreeItem, {
|
|
2476
|
+
id: activeId,
|
|
2477
|
+
depth: activeItem.depth,
|
|
2478
|
+
clone: true,
|
|
2479
|
+
childCount: getChildCount(items, activeId) + 1,
|
|
2480
|
+
indentationWidth: indentationWidth,
|
|
2481
|
+
component: component,
|
|
2482
|
+
value: activeValue === null || activeValue === void 0 ? void 0 : activeValue.value,
|
|
2483
|
+
onClickItem: onClickItem,
|
|
2484
|
+
index: flattenedItems.findIndex(function (_ref21) {
|
|
2485
|
+
var id = _ref21.id;
|
|
2486
|
+
return activeId === id;
|
|
2487
|
+
})
|
|
2488
|
+
})
|
|
2489
|
+
}, activeId) : null
|
|
2490
|
+
}), document.body)]
|
|
2416
2491
|
})
|
|
2417
|
-
})
|
|
2492
|
+
});
|
|
2418
2493
|
}
|
|
2419
2494
|
|
|
2420
2495
|
var styles$5 = {"items":"micromag-editor-menus-screens-items","item":"micromag-editor-menus-screens-item","container":"micromag-editor-menus-screens-container","settings":"micromag-editor-menus-screens-settings","noWrap":"micromag-editor-menus-screens-noWrap","isVertical":"micromag-editor-menus-screens-isVertical","withPlaceholder":"micromag-editor-menus-screens-withPlaceholder"};
|
|
@@ -2464,27 +2539,28 @@ function ScreensMenu(_ref) {
|
|
|
2464
2539
|
active = _ref2.active,
|
|
2465
2540
|
href = _ref2.href,
|
|
2466
2541
|
item = _objectWithoutProperties(_ref2, _excluded$3);
|
|
2467
|
-
return /*#__PURE__*/
|
|
2468
|
-
key: item.id,
|
|
2542
|
+
return /*#__PURE__*/jsxs("li", {
|
|
2469
2543
|
className: classNames([styles$5.item, itemCustomClassName, itemClassName, {}]),
|
|
2470
|
-
"data-screen-id": item.id
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2544
|
+
"data-screen-id": item.id,
|
|
2545
|
+
children: [/*#__PURE__*/jsx(ScreenWithPreview, {
|
|
2546
|
+
index: index,
|
|
2547
|
+
screen: withPlaceholder ? _objectSpread(_objectSpread({}, screen), {}, {
|
|
2548
|
+
type: type
|
|
2549
|
+
}) : screen,
|
|
2550
|
+
href: href,
|
|
2551
|
+
className: buttonClassName,
|
|
2552
|
+
title: title,
|
|
2553
|
+
active: active,
|
|
2554
|
+
withPreview: withPreview,
|
|
2555
|
+
withPlaceholder: withPlaceholder,
|
|
2556
|
+
withName: withName,
|
|
2557
|
+
onClick: onClick,
|
|
2558
|
+
onClickItem: onClickItem
|
|
2559
|
+
}), settings !== null ? /*#__PURE__*/jsx("div", {
|
|
2560
|
+
className: classNames([settingsClassName, styles$5.settings, 'p-2']),
|
|
2561
|
+
children: isFunction(settings) ? settings(index) : settings
|
|
2562
|
+
}) : null]
|
|
2563
|
+
}, item.id);
|
|
2488
2564
|
}) : [];
|
|
2489
2565
|
var sortableItems = useMemo(function () {
|
|
2490
2566
|
return isTree ? items.map(function (_ref3) {
|
|
@@ -2517,24 +2593,27 @@ function ScreensMenu(_ref) {
|
|
|
2517
2593
|
};
|
|
2518
2594
|
});
|
|
2519
2595
|
}, [items, isTree, items.length]);
|
|
2520
|
-
return /*#__PURE__*/
|
|
2521
|
-
className: classNames([styles$5.container, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles$5.noWrap, noWrap), styles$5.isVertical, isVertical), styles$5.isTree, isTree), styles$5.withPlaceholder, withPlaceholder)])
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2596
|
+
return /*#__PURE__*/jsxs("div", {
|
|
2597
|
+
className: classNames([styles$5.container, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles$5.noWrap, noWrap), styles$5.isVertical, isVertical), styles$5.isTree, isTree), styles$5.withPlaceholder, withPlaceholder)]),
|
|
2598
|
+
children: [isTree && !sortable ? /*#__PURE__*/jsx(SortableTree, {
|
|
2599
|
+
items: sortableItems,
|
|
2600
|
+
component: ScreenWithPreview,
|
|
2601
|
+
onClickItem: onClickItem,
|
|
2602
|
+
onChange: onOrderChange
|
|
2603
|
+
}) : null, !isTree && sortable && items.length > 1 ? /*#__PURE__*/jsx(ReactSortable, {
|
|
2604
|
+
list: sortableItems,
|
|
2605
|
+
setList: onOrderChange,
|
|
2606
|
+
animation: 200,
|
|
2607
|
+
delayOnTouchStart: true,
|
|
2608
|
+
delay: 2,
|
|
2609
|
+
tag: "ul",
|
|
2610
|
+
className: styles$5.items,
|
|
2611
|
+
children: itemsElements
|
|
2612
|
+
}) : null, !isTree && (!sortable || items.length < 1) ? /*#__PURE__*/jsx("ul", {
|
|
2613
|
+
className: styles$5.items,
|
|
2614
|
+
children: itemsElements
|
|
2615
|
+
}) : null]
|
|
2616
|
+
});
|
|
2538
2617
|
}
|
|
2539
2618
|
|
|
2540
2619
|
var styles$4 = {"container":"micromag-editor-menus-screen-types-container","row":"micromag-editor-menus-screen-types-row","screen":"micromag-editor-menus-screen-types-screen","button":"micromag-editor-menus-screen-types-button"};
|
|
@@ -2614,33 +2693,38 @@ function ScreenTypes(_ref) {
|
|
|
2614
2693
|
}, []);
|
|
2615
2694
|
return orderBy(groupItems, ['order', 'name'], ['asc', 'asc']);
|
|
2616
2695
|
}, [finalDefinitions, selectedTypes]);
|
|
2617
|
-
return /*#__PURE__*/
|
|
2618
|
-
className: classNames([styles$4.container, className])
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2696
|
+
return /*#__PURE__*/jsx("div", {
|
|
2697
|
+
className: classNames([styles$4.container, className]),
|
|
2698
|
+
children: /*#__PURE__*/jsx("div", {
|
|
2699
|
+
className: styles$4.rows,
|
|
2700
|
+
children: groups.map(function (_ref6) {
|
|
2701
|
+
var id = _ref6.id,
|
|
2702
|
+
name = _ref6.name,
|
|
2703
|
+
items = _ref6.items;
|
|
2704
|
+
return /*#__PURE__*/jsxs("div", {
|
|
2705
|
+
className: styles$4.row,
|
|
2706
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
2707
|
+
children: name
|
|
2708
|
+
}), /*#__PURE__*/jsx("div", {
|
|
2709
|
+
className: styles$4.layouts,
|
|
2710
|
+
children: /*#__PURE__*/jsx(ScreensMenu, {
|
|
2711
|
+
items: items,
|
|
2712
|
+
withPlaceholder: true,
|
|
2713
|
+
withName: true,
|
|
2714
|
+
itemClassName: classNames([styles$4.screen, 'border', 'rounded', {
|
|
2715
|
+
'border-secondary': selectedTypes === null,
|
|
2716
|
+
'border-dark': selectedTypes !== null,
|
|
2717
|
+
'bg-secondary': selectedTypes === null,
|
|
2718
|
+
'text-secondary': selectedTypes !== null
|
|
2719
|
+
}]),
|
|
2720
|
+
buttonClassName: styles$4.button,
|
|
2721
|
+
onClickItem: onClickItem
|
|
2722
|
+
})
|
|
2723
|
+
})]
|
|
2724
|
+
}, "group-".concat(id));
|
|
2725
|
+
})
|
|
2726
|
+
})
|
|
2727
|
+
});
|
|
2644
2728
|
}
|
|
2645
2729
|
|
|
2646
2730
|
var styles$3 = {"container":"micromag-editor-modals-screen-types-container"};
|
|
@@ -2655,21 +2739,24 @@ function ScreenTypesModal(_ref) {
|
|
|
2655
2739
|
onRequestClose = _ref$onRequestClose === void 0 ? null : _ref$onRequestClose,
|
|
2656
2740
|
_ref$onClickScreenTyp = _ref.onClickScreenType,
|
|
2657
2741
|
onClickScreenType = _ref$onClickScreenTyp === void 0 ? null : _ref$onClickScreenTyp;
|
|
2658
|
-
return /*#__PURE__*/
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2742
|
+
return /*#__PURE__*/jsx(Modal, {
|
|
2743
|
+
children: /*#__PURE__*/jsx(ModalDialog, {
|
|
2744
|
+
title: /*#__PURE__*/jsx(FormattedMessage, {
|
|
2745
|
+
id: "QBaiO0",
|
|
2746
|
+
defaultMessage: [{
|
|
2747
|
+
"type": 0,
|
|
2748
|
+
"value": "Add a screen"
|
|
2749
|
+
}]
|
|
2750
|
+
}),
|
|
2751
|
+
className: classNames([styles$3.container, className]),
|
|
2752
|
+
onClose: onRequestClose,
|
|
2753
|
+
children: /*#__PURE__*/jsx(ScreenTypes, {
|
|
2754
|
+
selectedTypes: selectedTypes,
|
|
2755
|
+
className: styles$3.menu,
|
|
2756
|
+
onClickItem: onClickScreenType
|
|
2757
|
+
})
|
|
2758
|
+
})
|
|
2759
|
+
});
|
|
2673
2760
|
}
|
|
2674
2761
|
|
|
2675
2762
|
var styles$2 = {"container":"micromag-editor-screens-container","navbar":"micromag-editor-screens-navbar"};
|
|
@@ -2821,102 +2908,115 @@ function EditorScreens(_ref) {
|
|
|
2821
2908
|
var onCreateModalRequestClose = useCallback(function () {
|
|
2822
2909
|
return setCreateModalOpened(false);
|
|
2823
2910
|
}, [setCreateModalOpened]);
|
|
2824
|
-
return /*#__PURE__*/
|
|
2825
|
-
className: classNames(['d-flex', 'flex-column', styles$2.container, className])
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2911
|
+
return /*#__PURE__*/jsxs("div", {
|
|
2912
|
+
className: classNames(['d-flex', 'flex-column', styles$2.container, className]),
|
|
2913
|
+
children: [/*#__PURE__*/jsxs(Navbar, {
|
|
2914
|
+
compact: true,
|
|
2915
|
+
noWrap: true,
|
|
2916
|
+
withoutCollapse: true,
|
|
2917
|
+
className: classNames(['sticky-top', styles$2.navbar]),
|
|
2918
|
+
children: [/*#__PURE__*/jsx("strong", {
|
|
2919
|
+
className: "mb-0 me-auto",
|
|
2920
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
2921
|
+
id: "jf+4Hq",
|
|
2922
|
+
defaultMessage: [{
|
|
2923
|
+
"type": 0,
|
|
2924
|
+
"value": "Screens"
|
|
2925
|
+
}]
|
|
2926
|
+
})
|
|
2927
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
2928
|
+
theme: "primary",
|
|
2929
|
+
size: "sm",
|
|
2930
|
+
onClick: onClickAdd,
|
|
2931
|
+
icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
2932
|
+
icon: faPlus
|
|
2933
|
+
})
|
|
2934
|
+
})]
|
|
2935
|
+
}), /*#__PURE__*/jsx("div", {
|
|
2936
|
+
className: "flex-grow-1 d-flex w-100 p-2",
|
|
2937
|
+
children: /*#__PURE__*/jsxs(Switch, {
|
|
2938
|
+
children: [/*#__PURE__*/jsx(Route, {
|
|
2939
|
+
path: "".concat(routes.screen, "/(.*)?"),
|
|
2940
|
+
children: function children(_ref16) {
|
|
2941
|
+
var _ref16$screen = _ref16.screen,
|
|
2942
|
+
screenId = _ref16$screen === void 0 ? null : _ref16$screen;
|
|
2943
|
+
return screens.length > 0 ? /*#__PURE__*/jsx(ScreensMenu, {
|
|
2944
|
+
items: screens.map(function (it) {
|
|
2945
|
+
return {
|
|
2946
|
+
id: it.id,
|
|
2947
|
+
screen: it,
|
|
2948
|
+
href: url('screen', {
|
|
2949
|
+
screen: it.id
|
|
2950
|
+
}),
|
|
2951
|
+
active: it.id === screenId
|
|
2952
|
+
};
|
|
2953
|
+
}),
|
|
2954
|
+
isVertical: isVertical,
|
|
2955
|
+
withPreview: true,
|
|
2956
|
+
sortable: !isTree,
|
|
2957
|
+
className: "w-100",
|
|
2958
|
+
onClickItem: onClickScreen,
|
|
2959
|
+
onOrderChange: onOrderChange,
|
|
2960
|
+
isTree: isTree
|
|
2961
|
+
}) : /*#__PURE__*/jsx(Empty, {
|
|
2962
|
+
className: "flex-grow-1 p-2",
|
|
2963
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
2964
|
+
theme: "primary",
|
|
2965
|
+
onClick: onClickAdd,
|
|
2966
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
2967
|
+
id: "JoWKee",
|
|
2968
|
+
defaultMessage: [{
|
|
2969
|
+
"type": 0,
|
|
2970
|
+
"value": "Create your first screen"
|
|
2971
|
+
}]
|
|
2972
|
+
})
|
|
2973
|
+
})
|
|
2974
|
+
});
|
|
2975
|
+
}
|
|
2976
|
+
}), /*#__PURE__*/jsx(Route, {
|
|
2977
|
+
children: screens.length > 0 ? /*#__PURE__*/jsx(ScreensMenu, {
|
|
2978
|
+
items: screens.map(function (it) {
|
|
2979
|
+
return {
|
|
2980
|
+
id: it.id,
|
|
2981
|
+
screen: it,
|
|
2982
|
+
href: url('screen', {
|
|
2983
|
+
screen: it.id
|
|
2984
|
+
}),
|
|
2985
|
+
active: false
|
|
2986
|
+
};
|
|
2987
|
+
}),
|
|
2988
|
+
isVertical: isVertical,
|
|
2989
|
+
withPreview: true,
|
|
2990
|
+
sortable: !isTree,
|
|
2991
|
+
className: "w-100",
|
|
2992
|
+
onClickItem: onClickScreen,
|
|
2993
|
+
onOrderChange: onOrderChange,
|
|
2994
|
+
isTree: isTree
|
|
2995
|
+
}) : /*#__PURE__*/jsx(Empty, {
|
|
2996
|
+
className: "flex-grow-1 p-2",
|
|
2997
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
2998
|
+
theme: "primary",
|
|
2999
|
+
onClick: onClickAdd,
|
|
3000
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
3001
|
+
id: "JoWKee",
|
|
3002
|
+
defaultMessage: [{
|
|
3003
|
+
"type": 0,
|
|
3004
|
+
"value": "Create your first screen"
|
|
3005
|
+
}]
|
|
3006
|
+
})
|
|
3007
|
+
})
|
|
3008
|
+
})
|
|
3009
|
+
})]
|
|
3010
|
+
})
|
|
3011
|
+
}), createModalOpened ? /*#__PURE__*/jsx(ScreenTypesModal, {
|
|
3012
|
+
selectedTypes: isTheme ? screens.map(function (_ref17) {
|
|
3013
|
+
var type = _ref17.type;
|
|
3014
|
+
return type;
|
|
3015
|
+
}) : [],
|
|
3016
|
+
onClickScreenType: onClickScreenType,
|
|
3017
|
+
onRequestClose: onCreateModalRequestClose
|
|
3018
|
+
}) : null]
|
|
3019
|
+
});
|
|
2920
3020
|
}
|
|
2921
3021
|
|
|
2922
3022
|
var styles$1 = {"container":"micromag-editor-container","inner":"micromag-editor-inner","left":"micromag-editor-left","center":"micromag-editor-center","right":"micromag-editor-right","visible":"micromag-editor-visible","preview":"micromag-editor-preview","fullscreen":"micromag-editor-fullscreen","top":"micromag-editor-top"};
|
|
@@ -3031,83 +3131,96 @@ function Editor(_ref) {
|
|
|
3031
3131
|
screens.scrollTop = cnt.offsetTop + item.offsetTop + item.offsetHeight / 2 - screens.clientHeight / 2;
|
|
3032
3132
|
}
|
|
3033
3133
|
}, [screenId]);
|
|
3034
|
-
return /*#__PURE__*/
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3134
|
+
return /*#__PURE__*/jsx(ModalsProvider, {
|
|
3135
|
+
children: /*#__PURE__*/jsx(PanelsProvider, {
|
|
3136
|
+
children: /*#__PURE__*/jsx(ScreenSizeProvider, {
|
|
3137
|
+
size: screenSize,
|
|
3138
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
3139
|
+
className: classNames([styles$1.container, screenSize !== null ? screenSize.screens.map(function (screenName) {
|
|
3140
|
+
return styles$1["screen-".concat(screenName)];
|
|
3141
|
+
}) : null, className, _defineProperty({}, styles$1.fullscreen, fullscreen)]),
|
|
3142
|
+
ref: refContainer,
|
|
3143
|
+
children: [/*#__PURE__*/jsxs(Navbar, {
|
|
3144
|
+
theme: "light",
|
|
3145
|
+
compact: true,
|
|
3146
|
+
noWrap: true,
|
|
3147
|
+
withoutCollapse: true,
|
|
3148
|
+
className: styles$1.top,
|
|
3149
|
+
children: [mobileView !== 'screens' ? /*#__PURE__*/jsx(Button, {
|
|
3150
|
+
size: "sm",
|
|
3151
|
+
theme: "secondary",
|
|
3152
|
+
onClick: onClickScreens,
|
|
3153
|
+
className: "me-auto",
|
|
3154
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
3155
|
+
id: "wkysUu",
|
|
3156
|
+
defaultMessage: [{
|
|
3157
|
+
"type": 0,
|
|
3158
|
+
"value": "Screens"
|
|
3159
|
+
}]
|
|
3160
|
+
})
|
|
3161
|
+
}) : /*#__PURE__*/jsx("span", {}), mobileView !== 'form' ? /*#__PURE__*/jsx(Button, {
|
|
3162
|
+
size: "sm",
|
|
3163
|
+
theme: "primary",
|
|
3164
|
+
onClick: onClickEdit,
|
|
3165
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
3166
|
+
id: "HseFdk",
|
|
3167
|
+
defaultMessage: [{
|
|
3168
|
+
"type": 0,
|
|
3169
|
+
"value": "Edit"
|
|
3170
|
+
}]
|
|
3171
|
+
})
|
|
3172
|
+
}) : null, mobileView === 'form' ? /*#__PURE__*/jsx(Button, {
|
|
3173
|
+
size: "sm",
|
|
3174
|
+
theme: "primary",
|
|
3175
|
+
onClick: onClickViewScreen,
|
|
3176
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
3177
|
+
id: "4POR3B",
|
|
3178
|
+
defaultMessage: [{
|
|
3179
|
+
"type": 0,
|
|
3180
|
+
"value": "View screen"
|
|
3181
|
+
}]
|
|
3182
|
+
})
|
|
3183
|
+
}) : null]
|
|
3184
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
3185
|
+
className: styles$1.inner,
|
|
3186
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
3187
|
+
className: classNames([styles$1.left, _defineProperty({}, styles$1.visible, !isMobile || mobileView === 'screens')]),
|
|
3188
|
+
ref: refScreensContainer,
|
|
3189
|
+
children: /*#__PURE__*/jsx(EditorScreens, {
|
|
3190
|
+
value: story,
|
|
3191
|
+
isTheme: isTheme,
|
|
3192
|
+
isCreateOpened: isCreateOpened,
|
|
3193
|
+
isParsed: true,
|
|
3194
|
+
onChange: onStoryChange,
|
|
3195
|
+
onClickScreen: onClickScreen,
|
|
3196
|
+
isVertical: !isMobile,
|
|
3197
|
+
className: styles$1.inner,
|
|
3198
|
+
isTree: true
|
|
3199
|
+
})
|
|
3200
|
+
}), /*#__PURE__*/jsx("div", {
|
|
3201
|
+
className: classNames([styles$1.center, _defineProperty({}, styles$1.visible, !isMobile || mobileView === 'preview')]),
|
|
3202
|
+
children: /*#__PURE__*/jsx(EditorPreview, {
|
|
3203
|
+
value: story,
|
|
3204
|
+
isTheme: isTheme,
|
|
3205
|
+
viewerTheme: viewerTheme,
|
|
3206
|
+
className: styles$1.preview,
|
|
3207
|
+
onScreenChange: onPreviewScreenChange,
|
|
3208
|
+
onChange: onStoryChange
|
|
3209
|
+
})
|
|
3210
|
+
}), /*#__PURE__*/jsx("div", {
|
|
3211
|
+
className: classNames([styles$1.right, _defineProperty({}, styles$1.visible, !isMobile || mobileView === 'form')]),
|
|
3212
|
+
children: /*#__PURE__*/jsx(EditForm, {
|
|
3213
|
+
value: story,
|
|
3214
|
+
isTheme: isTheme,
|
|
3215
|
+
onChange: onStoryChange,
|
|
3216
|
+
className: styles$1.inner
|
|
3217
|
+
}, screenId)
|
|
3218
|
+
})]
|
|
3219
|
+
}), /*#__PURE__*/jsx(Modals, {})]
|
|
3220
|
+
})
|
|
3221
|
+
})
|
|
3222
|
+
})
|
|
3223
|
+
});
|
|
3111
3224
|
}
|
|
3112
3225
|
|
|
3113
3226
|
var styles = {"container":"micromag-editor-forms-settings-container","inner":"micromag-editor-forms-settings-inner"};
|
|
@@ -3145,20 +3258,22 @@ function SettingsForm(_ref) {
|
|
|
3145
3258
|
onChange(newValue);
|
|
3146
3259
|
}
|
|
3147
3260
|
}, [value, onChange]);
|
|
3148
|
-
return /*#__PURE__*/
|
|
3149
|
-
className: classNames([styles.container, className])
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3261
|
+
return /*#__PURE__*/jsx("div", {
|
|
3262
|
+
className: classNames([styles.container, className]),
|
|
3263
|
+
children: /*#__PURE__*/jsx("div", {
|
|
3264
|
+
className: styles.inner,
|
|
3265
|
+
children: /*#__PURE__*/jsx(SettingsComponent, {
|
|
3266
|
+
name: name,
|
|
3267
|
+
field: field,
|
|
3268
|
+
fields: settings,
|
|
3269
|
+
value: value,
|
|
3270
|
+
onChange: onSettingsChange,
|
|
3271
|
+
gotoFieldForm: gotoFieldForm,
|
|
3272
|
+
closeFieldForm: closeFieldForm,
|
|
3273
|
+
fieldsProps: fieldsProps
|
|
3274
|
+
})
|
|
3275
|
+
})
|
|
3276
|
+
});
|
|
3162
3277
|
}
|
|
3163
3278
|
|
|
3164
3279
|
// eslint-disable-next-line import/prefer-default-export
|
|
@@ -3173,10 +3288,12 @@ function FormsProvider(_ref) {
|
|
|
3173
3288
|
var _ref$children = _ref.children,
|
|
3174
3289
|
children = _ref$children === void 0 ? null : _ref$children,
|
|
3175
3290
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
3176
|
-
return /*#__PURE__*/
|
|
3291
|
+
return /*#__PURE__*/jsx(ComponentsProvider, _objectSpread(_objectSpread({
|
|
3177
3292
|
namespace: FORMS_NAMESPACE,
|
|
3178
3293
|
components: FormsComponents
|
|
3179
|
-
}, props),
|
|
3294
|
+
}, props), {}, {
|
|
3295
|
+
children: children
|
|
3296
|
+
}));
|
|
3180
3297
|
}
|
|
3181
3298
|
|
|
3182
3299
|
var home = "/";
|
|
@@ -3223,31 +3340,51 @@ function EditorContainer(_ref) {
|
|
|
3223
3340
|
base: !memoryRouter ? basePath : null
|
|
3224
3341
|
};
|
|
3225
3342
|
}, [basePath, memoryRouter]);
|
|
3226
|
-
return /*#__PURE__*/
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3343
|
+
return /*#__PURE__*/jsx(Router, _objectSpread(_objectSpread({}, routerProps), {}, {
|
|
3344
|
+
children: /*#__PURE__*/jsx(UppyProvider, _objectSpread(_objectSpread({}, uppy), {}, {
|
|
3345
|
+
children: /*#__PURE__*/jsx(StoryProvider, {
|
|
3346
|
+
story: value,
|
|
3347
|
+
children: /*#__PURE__*/jsx(ScreensProvider, {
|
|
3348
|
+
filterNamespaces: true,
|
|
3349
|
+
namespaces: screenNamespaces,
|
|
3350
|
+
children: /*#__PURE__*/jsx(GoogleKeysProvider, {
|
|
3351
|
+
apiKey: googleApiKey,
|
|
3352
|
+
children: /*#__PURE__*/jsx(GoogleMapsClientProvider, {
|
|
3353
|
+
locale: locale,
|
|
3354
|
+
libraries: googleMapsLibraries,
|
|
3355
|
+
children: /*#__PURE__*/jsx(FontsProvider, {
|
|
3356
|
+
children: /*#__PURE__*/jsx(FieldsProvider, {
|
|
3357
|
+
children: /*#__PURE__*/jsx(FormsProvider, {
|
|
3358
|
+
children: /*#__PURE__*/jsx(EditorProvider, {
|
|
3359
|
+
children: /*#__PURE__*/jsx(VisitorProvider, {
|
|
3360
|
+
visitor: "editor",
|
|
3361
|
+
children: /*#__PURE__*/jsx(ComponentsContext.Consumer, {
|
|
3362
|
+
children: function children(manager) {
|
|
3363
|
+
var formComponents = manager.getComponents(FORMS_NAMESPACE);
|
|
3364
|
+
var formRegEx = formComponents !== null ? Object.keys(formComponents).map(function (name) {
|
|
3365
|
+
return slug(name);
|
|
3366
|
+
}).join('|') : null;
|
|
3367
|
+
return /*#__PURE__*/jsx(RoutesProvider, {
|
|
3368
|
+
routes: _objectSpread(_objectSpread({}, routes), {}, {
|
|
3369
|
+
'screen.field.form': routes['screen.field.form'].replace(/:form$/, ":form(".concat(formRegEx, ")"))
|
|
3370
|
+
}),
|
|
3371
|
+
children: /*#__PURE__*/jsx(Editor, _objectSpread({
|
|
3372
|
+
value: value
|
|
3373
|
+
}, props))
|
|
3374
|
+
});
|
|
3375
|
+
}
|
|
3376
|
+
})
|
|
3377
|
+
})
|
|
3378
|
+
})
|
|
3379
|
+
})
|
|
3380
|
+
})
|
|
3381
|
+
})
|
|
3382
|
+
})
|
|
3383
|
+
})
|
|
3384
|
+
})
|
|
3246
3385
|
})
|
|
3247
|
-
}
|
|
3248
|
-
|
|
3249
|
-
}, props)));
|
|
3250
|
-
}))))))))))));
|
|
3386
|
+
}))
|
|
3387
|
+
}));
|
|
3251
3388
|
}
|
|
3252
3389
|
|
|
3253
3390
|
export { Editor, ScreenTypes, ScreensMenu as Screens, createScreen, EditorContainer as default };
|