@micromag/editor 0.3.427 → 0.3.430
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/assets/css/styles.css +11 -11
- package/es/index.js +12 -20
- package/lib/index.js +480 -504
- package/package.json +11 -8
package/lib/index.js
CHANGED
|
@@ -45,22 +45,6 @@ var orderBy = require('lodash/orderBy');
|
|
|
45
45
|
var reactRouterDom = require('react-router-dom');
|
|
46
46
|
var screens = require('@micromag/screens');
|
|
47
47
|
|
|
48
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
49
|
-
|
|
50
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
51
|
-
var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
|
|
52
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
53
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
54
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
55
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
56
|
-
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
57
|
-
var isString__default = /*#__PURE__*/_interopDefaultLegacy(isString);
|
|
58
|
-
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
59
|
-
var _toArray__default = /*#__PURE__*/_interopDefaultLegacy(_toArray);
|
|
60
|
-
var isFunction__default = /*#__PURE__*/_interopDefaultLegacy(isFunction);
|
|
61
|
-
var _createForOfIteratorHelper__default = /*#__PURE__*/_interopDefaultLegacy(_createForOfIteratorHelper);
|
|
62
|
-
var orderBy__default = /*#__PURE__*/_interopDefaultLegacy(orderBy);
|
|
63
|
-
|
|
64
48
|
var useRouteParams = function useRouteParams() {
|
|
65
49
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
66
50
|
_ref$screenOnly = _ref.screenOnly,
|
|
@@ -120,12 +104,11 @@ var useFormTransition = function useFormTransition(url, screenIndex, styles) {
|
|
|
120
104
|
return currentPartsCount >= previousPartsCount ? 'right' : 'left';
|
|
121
105
|
}, [url, screenIndex]);
|
|
122
106
|
var transitionClassNames = React.useMemo(function () {
|
|
123
|
-
var _classNames, _classNames2, _classNames3;
|
|
124
107
|
return {
|
|
125
|
-
enter:
|
|
126
|
-
enterActive:
|
|
108
|
+
enter: classNames(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.enterRight, direction === 'right'), styles.enterLeft, direction === 'left'), styles.enterTop, direction === 'top'), styles.enterBottom, direction === 'bottom')) || 'none',
|
|
109
|
+
enterActive: classNames(_defineProperty(_defineProperty({}, styles.enterActiveHorizontal, direction === 'left' || direction === 'right'), styles.enterActiveVertical, direction === 'top' || direction === 'bottom')) || 'none',
|
|
127
110
|
exit: styles.exit || 'none',
|
|
128
|
-
exitActive:
|
|
111
|
+
exitActive: classNames(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.exitActiveRight, direction === 'right'), styles.exitActiveLeft, direction === 'left'), styles.exitActiveTop, direction === 'top'), styles.exitActiveBottom, direction === 'bottom')) || 'none'
|
|
129
112
|
};
|
|
130
113
|
}, [direction, screenIndex]);
|
|
131
114
|
return {
|
|
@@ -156,7 +139,7 @@ function getScreenFieldsWithStates(definition) {
|
|
|
156
139
|
label = _ref2.label,
|
|
157
140
|
_ref2$defaultValue = _ref2.defaultValue,
|
|
158
141
|
defaultValue = _ref2$defaultValue === void 0 ? null : _ref2$defaultValue;
|
|
159
|
-
return [].concat(
|
|
142
|
+
return [].concat(_toConsumableArray(statesFields), _toConsumableArray(repeatable ? [{
|
|
160
143
|
type: 'items',
|
|
161
144
|
name: fieldName || id,
|
|
162
145
|
label: label,
|
|
@@ -167,23 +150,23 @@ function getScreenFieldsWithStates(definition) {
|
|
|
167
150
|
type: 'fields',
|
|
168
151
|
fields: fields
|
|
169
152
|
}
|
|
170
|
-
}] : []),
|
|
153
|
+
}] : []), _toConsumableArray(!repeatable && fieldName !== null ? [{
|
|
171
154
|
type: 'fields',
|
|
172
155
|
name: fieldName,
|
|
173
156
|
stateId: id,
|
|
174
157
|
fields: fields
|
|
175
|
-
}] : []),
|
|
176
|
-
return
|
|
158
|
+
}] : []), _toConsumableArray(!repeatable && fieldName === null ? fields.map(function (it) {
|
|
159
|
+
return _objectSpread(_objectSpread({}, it), {}, {
|
|
177
160
|
stateId: id
|
|
178
161
|
});
|
|
179
162
|
}) : []));
|
|
180
163
|
}, []);
|
|
181
|
-
return [].concat(
|
|
164
|
+
return [].concat(_toConsumableArray(extraFields), _toConsumableArray(screenFields));
|
|
182
165
|
}
|
|
183
166
|
|
|
184
167
|
var createScreen = function createScreen(definition) {
|
|
185
168
|
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
186
|
-
var finalDefinition =
|
|
169
|
+
var finalDefinition = isString(definition) ? {
|
|
187
170
|
id: definition
|
|
188
171
|
} : definition;
|
|
189
172
|
var id = finalDefinition.id;
|
|
@@ -194,13 +177,13 @@ var createScreen = function createScreen(definition) {
|
|
|
194
177
|
name = _ref$name === void 0 ? null : _ref$name,
|
|
195
178
|
_ref$defaultValue = _ref.defaultValue,
|
|
196
179
|
defaultValue = _ref$defaultValue === void 0 ? null : _ref$defaultValue;
|
|
197
|
-
var newAll =
|
|
180
|
+
var newAll = _objectSpread({}, all);
|
|
198
181
|
if (name !== null && defaultValue !== null) {
|
|
199
182
|
newAll[name] = defaultValue;
|
|
200
183
|
}
|
|
201
184
|
return newAll;
|
|
202
185
|
}, {});
|
|
203
|
-
return
|
|
186
|
+
return _objectSpread(_objectSpread(_objectSpread({
|
|
204
187
|
type: id
|
|
205
188
|
}, defaultValueFields), data), {}, {
|
|
206
189
|
id: uuid.v1()
|
|
@@ -212,8 +195,8 @@ var deleteScreen = function deleteScreen(story, screenId) {
|
|
|
212
195
|
var _ref = story || {},
|
|
213
196
|
_ref$components = _ref.components,
|
|
214
197
|
components = _ref$components === void 0 ? [] : _ref$components,
|
|
215
|
-
currentValue =
|
|
216
|
-
return
|
|
198
|
+
currentValue = _objectWithoutProperties(_ref, _excluded$c);
|
|
199
|
+
return _objectSpread(_objectSpread({}, currentValue), {}, {
|
|
217
200
|
components: components.filter(function (_ref2) {
|
|
218
201
|
var id = _ref2.id;
|
|
219
202
|
return id !== screenId;
|
|
@@ -226,12 +209,12 @@ var duplicateScreen = function duplicateScreen(story, screenId) {
|
|
|
226
209
|
var _ref = story || {},
|
|
227
210
|
_ref$components = _ref.components,
|
|
228
211
|
components = _ref$components === void 0 ? [] : _ref$components,
|
|
229
|
-
currentValue =
|
|
212
|
+
currentValue = _objectWithoutProperties(_ref, _excluded$b);
|
|
230
213
|
var screen = components.find(function (it) {
|
|
231
214
|
return it.id === screenId;
|
|
232
215
|
}) || null;
|
|
233
|
-
return
|
|
234
|
-
components: screen !== null ? [].concat(
|
|
216
|
+
return _objectSpread(_objectSpread({}, currentValue), {}, {
|
|
217
|
+
components: screen !== null ? [].concat(_toConsumableArray(components), [_objectSpread(_objectSpread({}, screen), {}, {
|
|
235
218
|
id: uuid.v1()
|
|
236
219
|
})]) : components
|
|
237
220
|
});
|
|
@@ -243,12 +226,12 @@ var updateScreen = function updateScreen(story, newScreenValue) {
|
|
|
243
226
|
var _ref = story || {},
|
|
244
227
|
_ref$components = _ref.components,
|
|
245
228
|
components = _ref$components === void 0 ? [] : _ref$components,
|
|
246
|
-
currentValue =
|
|
229
|
+
currentValue = _objectWithoutProperties(_ref, _excluded$a);
|
|
247
230
|
var index = components.findIndex(function (it) {
|
|
248
231
|
return it.id === newScreenId;
|
|
249
232
|
});
|
|
250
|
-
return
|
|
251
|
-
components: [].concat(
|
|
233
|
+
return _objectSpread(_objectSpread({}, currentValue), {}, {
|
|
234
|
+
components: [].concat(_toConsumableArray(components.slice(0, index)), [_objectSpread(_objectSpread({}, components[index]), newScreenValue)], _toConsumableArray(components.slice(index + 1)))
|
|
252
235
|
});
|
|
253
236
|
};
|
|
254
237
|
|
|
@@ -270,8 +253,8 @@ var getFieldByName = function getFieldByName(fields, name) {
|
|
|
270
253
|
|
|
271
254
|
var _excluded$9 = ["className", "dots"];
|
|
272
255
|
var propTypes$o = {
|
|
273
|
-
dots:
|
|
274
|
-
className:
|
|
256
|
+
dots: PropTypes.bool,
|
|
257
|
+
className: PropTypes.string
|
|
275
258
|
};
|
|
276
259
|
var defaultProps$o = {
|
|
277
260
|
dots: false,
|
|
@@ -280,12 +263,12 @@ var defaultProps$o = {
|
|
|
280
263
|
var SettingsButton = function SettingsButton(_ref) {
|
|
281
264
|
var className = _ref.className,
|
|
282
265
|
dots = _ref.dots,
|
|
283
|
-
props =
|
|
284
|
-
return /*#__PURE__*/
|
|
266
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
267
|
+
return /*#__PURE__*/React.createElement(components.Button, Object.assign({
|
|
285
268
|
className: className,
|
|
286
269
|
theme: "secondary",
|
|
287
270
|
size: "sm",
|
|
288
|
-
icon: /*#__PURE__*/
|
|
271
|
+
icon: /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
289
272
|
icon: dots ? faEllipsisV.faEllipsisV : faCogs.faCogs
|
|
290
273
|
})
|
|
291
274
|
}, props));
|
|
@@ -295,9 +278,9 @@ SettingsButton.defaultProps = defaultProps$o;
|
|
|
295
278
|
|
|
296
279
|
var _excluded$8 = ["name", "form"];
|
|
297
280
|
var propTypes$n = {
|
|
298
|
-
name:
|
|
299
|
-
form:
|
|
300
|
-
children:
|
|
281
|
+
name: PropTypes.string,
|
|
282
|
+
form: PropTypes.string,
|
|
283
|
+
children: PropTypes.node
|
|
301
284
|
};
|
|
302
285
|
var defaultProps$n = {
|
|
303
286
|
name: null,
|
|
@@ -307,13 +290,13 @@ var defaultProps$n = {
|
|
|
307
290
|
var FieldWithContexts = function FieldWithContexts(_ref) {
|
|
308
291
|
var name = _ref.name,
|
|
309
292
|
form = _ref.form,
|
|
310
|
-
props =
|
|
293
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
311
294
|
var definition = contexts.useScreenDefinition() || null;
|
|
312
295
|
var _definition$states = definition.states,
|
|
313
296
|
states = _definition$states === void 0 ? null : _definition$states;
|
|
314
297
|
var screenFields = getScreenFieldsWithStates(definition);
|
|
315
298
|
var nameParts = name.split('.');
|
|
316
|
-
var _nameParts =
|
|
299
|
+
var _nameParts = _slicedToArray(nameParts, 1),
|
|
317
300
|
_nameParts$ = _nameParts[0],
|
|
318
301
|
stateId = _nameParts$ === void 0 ? null : _nameParts$;
|
|
319
302
|
var currentState = states !== null ? states.find(function (_ref2) {
|
|
@@ -334,19 +317,19 @@ var FieldWithContexts = function FieldWithContexts(_ref) {
|
|
|
334
317
|
return fieldName !== itemName || stateId === fieldStateId || fieldStateId === null;
|
|
335
318
|
}) : screenFields;
|
|
336
319
|
if (currentState !== null) {
|
|
337
|
-
finalNameParts = (repeatable || fieldName !== null) && nameParts.length <= (repeatable ? 2 : 1) ? [fieldName || stateId].concat(
|
|
320
|
+
finalNameParts = (repeatable || fieldName !== null) && nameParts.length <= (repeatable ? 2 : 1) ? [fieldName || stateId].concat(_toConsumableArray(nameParts.slice(1))) : nameParts.slice(1);
|
|
338
321
|
}
|
|
339
322
|
var formComponents = contexts.useFormsComponents();
|
|
340
|
-
return definition !== null ? /*#__PURE__*/
|
|
341
|
-
className:
|
|
323
|
+
return definition !== null ? /*#__PURE__*/React.createElement("div", {
|
|
324
|
+
className: classNames({
|
|
342
325
|
'p-2': form === null
|
|
343
326
|
})
|
|
344
|
-
}, finalNameParts.length > 0 ? /*#__PURE__*/
|
|
327
|
+
}, finalNameParts.length > 0 ? /*#__PURE__*/React.createElement(components.FieldForm, Object.assign({
|
|
345
328
|
fields: finalScreenFields,
|
|
346
329
|
formComponents: formComponents,
|
|
347
330
|
name: finalNameParts.join('.'),
|
|
348
331
|
form: form
|
|
349
|
-
}, props)) : /*#__PURE__*/
|
|
332
|
+
}, props)) : /*#__PURE__*/React.createElement(fields.Fields, Object.assign({
|
|
350
333
|
fields: stateFields
|
|
351
334
|
}, props))) : null;
|
|
352
335
|
};
|
|
@@ -357,10 +340,10 @@ var styles$i = {"container":"micromag-editor-forms-screen-container","inner":"mi
|
|
|
357
340
|
|
|
358
341
|
var propTypes$m = {
|
|
359
342
|
value: core.PropTypes.component,
|
|
360
|
-
className:
|
|
361
|
-
gotoFieldForm:
|
|
362
|
-
closeFieldForm:
|
|
363
|
-
onChange:
|
|
343
|
+
className: PropTypes.string,
|
|
344
|
+
gotoFieldForm: PropTypes.func.isRequired,
|
|
345
|
+
closeFieldForm: PropTypes.func.isRequired,
|
|
346
|
+
onChange: PropTypes.func
|
|
364
347
|
// onClickDelete: PropTypes.func,
|
|
365
348
|
};
|
|
366
349
|
|
|
@@ -394,11 +377,11 @@ var ScreenForm = function ScreenForm(_ref) {
|
|
|
394
377
|
// onClickDelete(value);
|
|
395
378
|
// }
|
|
396
379
|
// }, [intl, onClickDelete, value]);
|
|
397
|
-
return /*#__PURE__*/
|
|
398
|
-
className:
|
|
399
|
-
}, /*#__PURE__*/
|
|
380
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
381
|
+
className: classNames([styles$i.container, _defineProperty({}, className, className)])
|
|
382
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
400
383
|
className: styles$i.inner
|
|
401
|
-
}, fields$1 !== null ? /*#__PURE__*/
|
|
384
|
+
}, fields$1 !== null ? /*#__PURE__*/React.createElement(fields.Fields, {
|
|
402
385
|
fields: fields$1,
|
|
403
386
|
value: value,
|
|
404
387
|
onChange: onChange,
|
|
@@ -413,11 +396,11 @@ var styles$h = {"container":"micromag-editor-menus-breadcrumb-container"};
|
|
|
413
396
|
|
|
414
397
|
var propTypes$l = {
|
|
415
398
|
story: core.PropTypes.story,
|
|
416
|
-
screenId:
|
|
417
|
-
field:
|
|
418
|
-
form:
|
|
419
|
-
url:
|
|
420
|
-
className:
|
|
399
|
+
screenId: PropTypes.string,
|
|
400
|
+
field: PropTypes.string,
|
|
401
|
+
form: PropTypes.string,
|
|
402
|
+
url: PropTypes.string.isRequired,
|
|
403
|
+
className: PropTypes.string
|
|
421
404
|
};
|
|
422
405
|
var defaultProps$l = {
|
|
423
406
|
story: null,
|
|
@@ -461,7 +444,7 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
461
444
|
definitionTitle = _ref3$title === void 0 ? null : _ref3$title;
|
|
462
445
|
return {
|
|
463
446
|
title: definitionTitle,
|
|
464
|
-
fields: definition !== null ? [].concat(
|
|
447
|
+
fields: definition !== null ? [].concat(_toConsumableArray(getScreenFieldsWithStates(definition)), [utils.getScreenExtraField(intl)]) : null,
|
|
465
448
|
states: states,
|
|
466
449
|
parameters: parameters
|
|
467
450
|
};
|
|
@@ -481,7 +464,7 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
481
464
|
var fieldPath = field.split('/');
|
|
482
465
|
|
|
483
466
|
// Get state and remove it from path. Replace it with field name if necessary (repeatable or fieldName present)
|
|
484
|
-
var _fieldPath =
|
|
467
|
+
var _fieldPath = _slicedToArray(fieldPath, 1),
|
|
485
468
|
_fieldPath$ = _fieldPath[0],
|
|
486
469
|
stateId = _fieldPath$ === void 0 ? null : _fieldPath$;
|
|
487
470
|
currentState = screenStates !== null ? screenStates.find(function (_ref4) {
|
|
@@ -495,7 +478,7 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
495
478
|
repeatable = _ref5$repeatable === void 0 ? false : _ref5$repeatable,
|
|
496
479
|
_ref5$fieldName = _ref5.fieldName,
|
|
497
480
|
fieldName = _ref5$fieldName === void 0 ? null : _ref5$fieldName;
|
|
498
|
-
finalFieldPath = (repeatable || fieldName !== null) && fieldPath.length <= (repeatable ? 2 : 1) ? [fieldName || stateId].concat(
|
|
481
|
+
finalFieldPath = (repeatable || fieldName !== null) && fieldPath.length <= (repeatable ? 2 : 1) ? [fieldName || stateId].concat(_toConsumableArray(fieldPath.slice(1))) : fieldPath.slice(1);
|
|
499
482
|
}
|
|
500
483
|
var lastKeyIndex = finalFieldPath.length - 1;
|
|
501
484
|
var parentItem = null;
|
|
@@ -530,7 +513,7 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
530
513
|
var isLastIndex = keyIndex === lastKeyIndex;
|
|
531
514
|
var pathPrefix = route('screen.field', {
|
|
532
515
|
screen: screenId,
|
|
533
|
-
field: [currentState !== null ? currentState.id : null].concat(
|
|
516
|
+
field: [currentState !== null ? currentState.id : null].concat(_toConsumableArray(finalFieldPath.slice(0, keyIndex + 1))).filter(function (it) {
|
|
534
517
|
return it !== null;
|
|
535
518
|
})
|
|
536
519
|
});
|
|
@@ -538,16 +521,16 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
538
521
|
var addNewItem = isLastIndex || isListItems;
|
|
539
522
|
var itemPath = "".concat(pathPrefix).concat(pathSuffix);
|
|
540
523
|
if (parentItem !== null && (withForm || isCurrentSettingsField)) {
|
|
541
|
-
fieldItems.push(
|
|
524
|
+
fieldItems.push(_objectSpread(_objectSpread({}, parentItem), {}, {
|
|
542
525
|
url: isCurrentSettingsField ? route('screen.field.form', {
|
|
543
526
|
screen: screenId,
|
|
544
|
-
field: [currentState !== null ? currentState.id : null].concat(
|
|
527
|
+
field: [currentState !== null ? currentState.id : null].concat(_toConsumableArray(finalFieldPath.slice(0, keyIndex))).filter(function (it) {
|
|
545
528
|
return it !== null;
|
|
546
529
|
}),
|
|
547
530
|
form: 'settings'
|
|
548
531
|
}) : route('screen.field', {
|
|
549
532
|
screen: screenId,
|
|
550
|
-
field: [currentState !== null ? currentState.id : null].concat(
|
|
533
|
+
field: [currentState !== null ? currentState.id : null].concat(_toConsumableArray(finalFieldPath.slice(0, keyIndex))).filter(function (it) {
|
|
551
534
|
return it !== null;
|
|
552
535
|
})
|
|
553
536
|
})
|
|
@@ -591,7 +574,7 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
591
574
|
var _ref12 = metadata || {},
|
|
592
575
|
_ref12$title = _ref12.title,
|
|
593
576
|
title = _ref12$title === void 0 ? null : _ref12$title;
|
|
594
|
-
var typeTitle = screenTitle !== null ? /*#__PURE__*/
|
|
577
|
+
var typeTitle = screenTitle !== null ? /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, screenTitle) : null;
|
|
595
578
|
var parametersMessage = intl.formatMessage({
|
|
596
579
|
id: "AHvHaY",
|
|
597
580
|
defaultMessage: [{
|
|
@@ -614,7 +597,7 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
614
597
|
});
|
|
615
598
|
var lastItemsIndex = finalItems.length - 1;
|
|
616
599
|
return finalItems.map(function (it, index) {
|
|
617
|
-
return index === lastItemsIndex ?
|
|
600
|
+
return index === lastItemsIndex ? _objectSpread(_objectSpread({}, it), {}, {
|
|
618
601
|
url: url,
|
|
619
602
|
active: true
|
|
620
603
|
}) : it;
|
|
@@ -625,15 +608,15 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
625
608
|
history.push(items[itemsLength - 2].url);
|
|
626
609
|
}, [items]);
|
|
627
610
|
var withBack = itemsLength > 1;
|
|
628
|
-
return /*#__PURE__*/
|
|
611
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, withBack ? /*#__PURE__*/React.createElement(components.BackButton, {
|
|
629
612
|
onClick: onClickBack,
|
|
630
613
|
className: "me-2 py-0"
|
|
631
|
-
}) : null, /*#__PURE__*/
|
|
614
|
+
}) : null, /*#__PURE__*/React.createElement(components.Breadcrumb, {
|
|
632
615
|
items: items,
|
|
633
616
|
theme: "secondary",
|
|
634
617
|
withoutBar: true,
|
|
635
618
|
noWrap: true,
|
|
636
|
-
className:
|
|
619
|
+
className: classNames([styles$h.container, 'text-truncate', _defineProperty({}, className, className !== null)])
|
|
637
620
|
}));
|
|
638
621
|
};
|
|
639
622
|
Breadcrumb.propTypes = propTypes$l;
|
|
@@ -642,9 +625,9 @@ Breadcrumb.defaultProps = defaultProps$l;
|
|
|
642
625
|
var styles$g = {"container":"micromag-editor-modals-delete-screen-container","description":"micromag-editor-modals-delete-screen-description","actions":"micromag-editor-modals-delete-screen-actions"};
|
|
643
626
|
|
|
644
627
|
var propTypes$k = {
|
|
645
|
-
className:
|
|
646
|
-
onConfirm:
|
|
647
|
-
onCancel:
|
|
628
|
+
className: PropTypes.string,
|
|
629
|
+
onConfirm: PropTypes.func,
|
|
630
|
+
onCancel: PropTypes.func
|
|
648
631
|
};
|
|
649
632
|
var defaultProps$k = {
|
|
650
633
|
className: null,
|
|
@@ -655,39 +638,39 @@ var DeleteScreenModal = function DeleteScreenModal(_ref) {
|
|
|
655
638
|
var className = _ref.className,
|
|
656
639
|
onConfirm = _ref.onConfirm,
|
|
657
640
|
onCancel = _ref.onCancel;
|
|
658
|
-
return /*#__PURE__*/
|
|
659
|
-
title: /*#__PURE__*/
|
|
641
|
+
return /*#__PURE__*/React.createElement(components.Modal, null, /*#__PURE__*/React.createElement(components.ModalDialog, {
|
|
642
|
+
title: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
660
643
|
id: "p6q/+/",
|
|
661
644
|
defaultMessage: [{
|
|
662
645
|
"type": 0,
|
|
663
646
|
"value": "Delete screen"
|
|
664
647
|
}]
|
|
665
648
|
}),
|
|
666
|
-
className:
|
|
649
|
+
className: classNames([styles$g.container, _defineProperty({}, className, className)]),
|
|
667
650
|
onClickClose: onCancel
|
|
668
|
-
}, /*#__PURE__*/
|
|
651
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
669
652
|
className: styles$g.description
|
|
670
|
-
}, /*#__PURE__*/
|
|
653
|
+
}, /*#__PURE__*/React.createElement(components.Label, null, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
671
654
|
id: "q/tLk0",
|
|
672
655
|
defaultMessage: [{
|
|
673
656
|
"type": 0,
|
|
674
657
|
"value": "Are you sure you want to delete this screen?"
|
|
675
658
|
}]
|
|
676
|
-
}))), /*#__PURE__*/
|
|
659
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
677
660
|
className: styles$g.actions
|
|
678
|
-
}, /*#__PURE__*/
|
|
661
|
+
}, /*#__PURE__*/React.createElement(components.Button, {
|
|
679
662
|
onClick: onCancel,
|
|
680
663
|
className: "btn-outline-secondary me-2"
|
|
681
|
-
}, /*#__PURE__*/
|
|
664
|
+
}, /*#__PURE__*/React.createElement(components.Label, null, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
682
665
|
id: "0GT0SI",
|
|
683
666
|
defaultMessage: [{
|
|
684
667
|
"type": 0,
|
|
685
668
|
"value": "Cancel"
|
|
686
669
|
}]
|
|
687
|
-
}))), /*#__PURE__*/
|
|
670
|
+
}))), /*#__PURE__*/React.createElement(components.Button, {
|
|
688
671
|
onClick: onConfirm,
|
|
689
672
|
theme: "danger",
|
|
690
|
-
label: /*#__PURE__*/
|
|
673
|
+
label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
691
674
|
id: "gRxcTc",
|
|
692
675
|
defaultMessage: [{
|
|
693
676
|
"type": 0,
|
|
@@ -702,10 +685,10 @@ DeleteScreenModal.defaultProps = defaultProps$k;
|
|
|
702
685
|
var styles$f = {"panel":"micromag-editor-form-panel","exit":"micromag-editor-form-exit","content":"micromag-editor-form-content","navbar":"micromag-editor-form-navbar","enterRight":"micromag-editor-form-enterRight","enterLeft":"micromag-editor-form-enterLeft","enterTop":"micromag-editor-form-enterTop","enterBottom":"micromag-editor-form-enterBottom","enterActiveHorizontal":"micromag-editor-form-enterActiveHorizontal","enterActiveVertical":"micromag-editor-form-enterActiveVertical","exitActiveRight":"micromag-editor-form-exitActiveRight","exitActiveLeft":"micromag-editor-form-exitActiveLeft","exitActiveTop":"micromag-editor-form-exitActiveTop","exitActiveBottom":"micromag-editor-form-exitActiveBottom"};
|
|
703
686
|
|
|
704
687
|
var propTypes$j = {
|
|
705
|
-
value:
|
|
706
|
-
isTheme:
|
|
707
|
-
className:
|
|
708
|
-
onChange:
|
|
688
|
+
value: PropTypes.oneOfType([core.PropTypes.story, core.PropTypes.theme]),
|
|
689
|
+
isTheme: PropTypes.bool,
|
|
690
|
+
className: PropTypes.string,
|
|
691
|
+
onChange: PropTypes.func
|
|
709
692
|
};
|
|
710
693
|
var defaultProps$j = {
|
|
711
694
|
value: null,
|
|
@@ -751,19 +734,19 @@ var EditForm = function EditForm(_ref) {
|
|
|
751
734
|
transitionClassNames = _useFormTransition.classNames,
|
|
752
735
|
transitionTimeout = _useFormTransition.timeout;
|
|
753
736
|
var _useState = React.useState(false),
|
|
754
|
-
_useState2 =
|
|
737
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
755
738
|
screenSettingsOpened = _useState2[0],
|
|
756
739
|
setScreenSettingsOpened = _useState2[1];
|
|
757
740
|
var _useState3 = React.useState(false),
|
|
758
|
-
_useState4 =
|
|
741
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
759
742
|
deleteScreenModalOpened = _useState4[0],
|
|
760
743
|
setDeleteScreenModalOpened = _useState4[1];
|
|
761
744
|
var _useState5 = React.useState({}),
|
|
762
|
-
_useState6 =
|
|
745
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
763
746
|
fieldForms = _useState6[0],
|
|
764
747
|
setFieldForms = _useState6[1];
|
|
765
748
|
var _useState7 = React.useState(null),
|
|
766
|
-
_useState8 =
|
|
749
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
767
750
|
fieldContext = _useState8[0],
|
|
768
751
|
setFieldContext = _useState8[1];
|
|
769
752
|
|
|
@@ -775,11 +758,11 @@ var EditForm = function EditForm(_ref) {
|
|
|
775
758
|
var hasField = field !== null;
|
|
776
759
|
var fieldRoute = formName !== null ? 'screen.field.form' : 'screen.field';
|
|
777
760
|
var _ref4 = field !== null ? field.split('.') : [],
|
|
778
|
-
_ref5 =
|
|
761
|
+
_ref5 = _slicedToArray(_ref4, 1),
|
|
779
762
|
_ref5$ = _ref5[0],
|
|
780
763
|
rootFieldName = _ref5$ === void 0 ? null : _ref5$;
|
|
781
764
|
var _ref6 = fieldParams !== null ? fieldParams.split('/') : [],
|
|
782
|
-
_ref7 =
|
|
765
|
+
_ref7 = _slicedToArray(_ref6, 1),
|
|
783
766
|
_ref7$ = _ref7[0],
|
|
784
767
|
currentStateId = _ref7$ === void 0 ? null : _ref7$;
|
|
785
768
|
var _ref8 = (rootFieldName !== null ? screenFields.find(function (_ref9) {
|
|
@@ -791,12 +774,12 @@ var EditForm = function EditForm(_ref) {
|
|
|
791
774
|
stateId = _ref8$stateId === void 0 ? null : _ref8$stateId;
|
|
792
775
|
routePush(hasField ? fieldRoute : 'screen', {
|
|
793
776
|
screen: screenId,
|
|
794
|
-
field: field !== null ? [stateId].concat(
|
|
777
|
+
field: field !== null ? [stateId].concat(_toConsumableArray(field.split('.'))).filter(function (it) {
|
|
795
778
|
return it !== null;
|
|
796
779
|
}) : null,
|
|
797
780
|
form: formName !== null ? utils.slug(formName) : null
|
|
798
781
|
});
|
|
799
|
-
setFieldForms(
|
|
782
|
+
setFieldForms(_objectSpread(_objectSpread({}, fieldForms), {}, _defineProperty({}, "".concat(field).concat(formName !== null ? ":".concat(formName) : ''), url)));
|
|
800
783
|
setFieldContext(context);
|
|
801
784
|
}, [routePush, screenId, screenFields, fieldParams, url, fieldForms, setFieldForms, fieldContext, setFieldContext]);
|
|
802
785
|
var closeFieldForm = React.useCallback(function (field) {
|
|
@@ -807,7 +790,7 @@ var EditForm = function EditForm(_ref) {
|
|
|
807
790
|
history.push(pastUrl);
|
|
808
791
|
}
|
|
809
792
|
setFieldForms(Object.keys(fieldForms).reduce(function (map, key) {
|
|
810
|
-
return key !== fieldKey ?
|
|
793
|
+
return key !== fieldKey ? _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, key, fieldForms[key])) : map;
|
|
811
794
|
}, {}));
|
|
812
795
|
}, [history, screenId, fieldForms, setFieldForms]);
|
|
813
796
|
var triggerOnChange = React.useCallback(function (newValue) {
|
|
@@ -860,7 +843,7 @@ var EditForm = function EditForm(_ref) {
|
|
|
860
843
|
var dropdownItems = [!isTheme ? {
|
|
861
844
|
id: 'duplicate',
|
|
862
845
|
type: 'button',
|
|
863
|
-
label: /*#__PURE__*/
|
|
846
|
+
label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
864
847
|
id: "IBjY5r",
|
|
865
848
|
defaultMessage: [{
|
|
866
849
|
"type": 0,
|
|
@@ -871,7 +854,7 @@ var EditForm = function EditForm(_ref) {
|
|
|
871
854
|
} : null, {
|
|
872
855
|
id: 'delete',
|
|
873
856
|
type: 'button',
|
|
874
|
-
label: /*#__PURE__*/
|
|
857
|
+
label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
875
858
|
id: "hpiKce",
|
|
876
859
|
defaultMessage: [{
|
|
877
860
|
"type": 0,
|
|
@@ -882,49 +865,49 @@ var EditForm = function EditForm(_ref) {
|
|
|
882
865
|
}].filter(function (it) {
|
|
883
866
|
return it !== null;
|
|
884
867
|
});
|
|
885
|
-
return /*#__PURE__*/
|
|
886
|
-
className:
|
|
887
|
-
}, screenId !== null ? /*#__PURE__*/
|
|
868
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
869
|
+
className: classNames(['d-flex', 'flex-column', className])
|
|
870
|
+
}, screenId !== null ? /*#__PURE__*/React.createElement(components.Navbar, {
|
|
888
871
|
compact: true,
|
|
889
872
|
noWrap: true,
|
|
890
873
|
withoutCollapse: true,
|
|
891
|
-
className:
|
|
892
|
-
}, /*#__PURE__*/
|
|
874
|
+
className: classNames(['sticky-top', 'border-bottom', 'border-dark', styles$f.navbar])
|
|
875
|
+
}, /*#__PURE__*/React.createElement(Breadcrumb, {
|
|
893
876
|
story: value,
|
|
894
877
|
url: url,
|
|
895
878
|
screenId: screenId,
|
|
896
879
|
field: fieldParams,
|
|
897
880
|
form: formParams,
|
|
898
881
|
className: "me-auto"
|
|
899
|
-
}), fieldParams === null ? /*#__PURE__*/
|
|
882
|
+
}), fieldParams === null ? /*#__PURE__*/React.createElement("div", {
|
|
900
883
|
className: "dropdown"
|
|
901
|
-
}, /*#__PURE__*/
|
|
884
|
+
}, /*#__PURE__*/React.createElement(SettingsButton, {
|
|
902
885
|
onClick: onSettingsClick,
|
|
903
886
|
dots: true,
|
|
904
887
|
className: "py-0",
|
|
905
888
|
theme: "default"
|
|
906
|
-
}), /*#__PURE__*/
|
|
889
|
+
}), /*#__PURE__*/React.createElement(components.DropdownMenu, {
|
|
907
890
|
align: "end",
|
|
908
891
|
items: dropdownItems,
|
|
909
892
|
visible: screenSettingsOpened,
|
|
910
893
|
onClickOutside: onDropdownClickOutside
|
|
911
|
-
})) : null) : null, /*#__PURE__*/
|
|
912
|
-
className:
|
|
913
|
-
}, screen !== null ? /*#__PURE__*/
|
|
894
|
+
})) : null) : null, /*#__PURE__*/React.createElement("div", {
|
|
895
|
+
className: classNames(['flex-grow-1', 'd-flex', 'w-100', styles$f.content])
|
|
896
|
+
}, screen !== null ? /*#__PURE__*/React.createElement(reactTransitionGroup.TransitionGroup, {
|
|
914
897
|
className: "w-100 flex-grow-1",
|
|
915
898
|
childFactory: function childFactory(child) {
|
|
916
|
-
return /*#__PURE__*/
|
|
899
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
917
900
|
classNames: transitionClassNames
|
|
918
901
|
});
|
|
919
902
|
}
|
|
920
|
-
}, fieldParams !== null ? /*#__PURE__*/
|
|
903
|
+
}, fieldParams !== null ? /*#__PURE__*/React.createElement(reactTransitionGroup.CSSTransition, {
|
|
921
904
|
timeout: transitionTimeout,
|
|
922
905
|
key: "field-".concat(fieldParams, "-").concat(formParams)
|
|
923
|
-
}, /*#__PURE__*/
|
|
924
|
-
className:
|
|
925
|
-
}, /*#__PURE__*/
|
|
906
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
907
|
+
className: classNames(['w-100', styles$f.panel])
|
|
908
|
+
}, /*#__PURE__*/React.createElement(contexts.ScreenProvider, {
|
|
926
909
|
data: screen
|
|
927
|
-
}, /*#__PURE__*/
|
|
910
|
+
}, /*#__PURE__*/React.createElement(FieldWithContexts, {
|
|
928
911
|
name: fieldParams.replace(/\//g, '.'),
|
|
929
912
|
value: screen,
|
|
930
913
|
form: formParams,
|
|
@@ -933,31 +916,31 @@ var EditForm = function EditForm(_ref) {
|
|
|
933
916
|
closeFieldForm: closeFieldForm,
|
|
934
917
|
fieldContext: fieldContext,
|
|
935
918
|
onChange: onScreenFormChange
|
|
936
|
-
})))) : /*#__PURE__*/
|
|
919
|
+
})))) : /*#__PURE__*/React.createElement(reactTransitionGroup.CSSTransition, {
|
|
937
920
|
classNames: transitionClassNames,
|
|
938
921
|
timeout: transitionTimeout,
|
|
939
922
|
key: "screen-".concat(screen.id)
|
|
940
|
-
}, /*#__PURE__*/
|
|
941
|
-
className:
|
|
923
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
924
|
+
className: classNames(['w-100', styles$f.panel]),
|
|
942
925
|
key: "screen-".concat(screen.id)
|
|
943
|
-
}, /*#__PURE__*/
|
|
926
|
+
}, /*#__PURE__*/React.createElement(contexts.ScreenProvider, {
|
|
944
927
|
data: screen
|
|
945
|
-
}, /*#__PURE__*/
|
|
928
|
+
}, /*#__PURE__*/React.createElement(ScreenForm, {
|
|
946
929
|
value: screen,
|
|
947
930
|
className: styles$f.form,
|
|
948
931
|
onChange: onScreenFormChange,
|
|
949
932
|
gotoFieldForm: gotoFieldForm,
|
|
950
933
|
closeFieldForm: closeFieldForm
|
|
951
|
-
}))))) : /*#__PURE__*/
|
|
934
|
+
}))))) : /*#__PURE__*/React.createElement(components.Empty, {
|
|
952
935
|
className: "w-100 m-2"
|
|
953
|
-
}, /*#__PURE__*/
|
|
936
|
+
}, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
954
937
|
id: "QfpTKK",
|
|
955
938
|
defaultMessage: [{
|
|
956
939
|
"type": 0,
|
|
957
940
|
"value": "Select a screen..."
|
|
958
941
|
}],
|
|
959
942
|
decription: "Indication to select a screen to view the form"
|
|
960
|
-
}))), deleteScreenModalOpened ? /*#__PURE__*/
|
|
943
|
+
}))), deleteScreenModalOpened ? /*#__PURE__*/React.createElement(DeleteScreenModal, {
|
|
961
944
|
onConfirm: onDeleteScreenConfirm,
|
|
962
945
|
onCancel: onDeleteScreenCancel
|
|
963
946
|
}) : null);
|
|
@@ -988,8 +971,8 @@ var useThemeValue = function useThemeValue(value) {
|
|
|
988
971
|
}
|
|
989
972
|
var _ref = value || {};
|
|
990
973
|
_ref.components;
|
|
991
|
-
var themeValue =
|
|
992
|
-
return value !== null ?
|
|
974
|
+
var themeValue = _objectWithoutProperties(_ref, _excluded$7);
|
|
975
|
+
return value !== null ? _objectSpread({
|
|
993
976
|
theme: themeValue
|
|
994
977
|
}, value) : value;
|
|
995
978
|
}, [value, isTheme]);
|
|
@@ -1000,8 +983,8 @@ var styles$e = {"container":"micromag-editor-menus-devices-container","button":"
|
|
|
1000
983
|
|
|
1001
984
|
/* eslint-disable react/button-has-type, react/jsx-props-no-spreading */
|
|
1002
985
|
var propTypes$i = {
|
|
1003
|
-
color:
|
|
1004
|
-
className:
|
|
986
|
+
color: PropTypes.string,
|
|
987
|
+
className: PropTypes.string
|
|
1005
988
|
};
|
|
1006
989
|
var defaultProps$i = {
|
|
1007
990
|
color: 'currentColor',
|
|
@@ -1010,7 +993,7 @@ var defaultProps$i = {
|
|
|
1010
993
|
var DesktopIcon = function DesktopIcon(_ref) {
|
|
1011
994
|
var color = _ref.color,
|
|
1012
995
|
className = _ref.className;
|
|
1013
|
-
return /*#__PURE__*/
|
|
996
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
1014
997
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1015
998
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
1016
999
|
version: "1.1",
|
|
@@ -1021,7 +1004,7 @@ var DesktopIcon = function DesktopIcon(_ref) {
|
|
|
1021
1004
|
viewBox: "0 0 100 100",
|
|
1022
1005
|
xmlSpace: "preserve",
|
|
1023
1006
|
className: className
|
|
1024
|
-
}, /*#__PURE__*/
|
|
1007
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1025
1008
|
fill: color,
|
|
1026
1009
|
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"
|
|
1027
1010
|
}));
|
|
@@ -1031,8 +1014,8 @@ DesktopIcon.defaultProps = defaultProps$i;
|
|
|
1031
1014
|
|
|
1032
1015
|
/* eslint-disable react/button-has-type, react/jsx-props-no-spreading */
|
|
1033
1016
|
var propTypes$h = {
|
|
1034
|
-
color:
|
|
1035
|
-
className:
|
|
1017
|
+
color: PropTypes.string,
|
|
1018
|
+
className: PropTypes.string
|
|
1036
1019
|
};
|
|
1037
1020
|
var defaultProps$h = {
|
|
1038
1021
|
color: 'currentColor',
|
|
@@ -1041,7 +1024,7 @@ var defaultProps$h = {
|
|
|
1041
1024
|
var MobileIcon = function MobileIcon(_ref) {
|
|
1042
1025
|
var color = _ref.color,
|
|
1043
1026
|
className = _ref.className;
|
|
1044
|
-
return /*#__PURE__*/
|
|
1027
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
1045
1028
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1046
1029
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
1047
1030
|
version: "1.1",
|
|
@@ -1052,7 +1035,7 @@ var MobileIcon = function MobileIcon(_ref) {
|
|
|
1052
1035
|
viewBox: "0 0 100 100",
|
|
1053
1036
|
xmlSpace: "preserve",
|
|
1054
1037
|
className: className
|
|
1055
|
-
}, /*#__PURE__*/
|
|
1038
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1056
1039
|
fill: color,
|
|
1057
1040
|
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"
|
|
1058
1041
|
}));
|
|
@@ -1070,9 +1053,9 @@ var styles$d = {"container":"micromag-editor-buttons-device-container","icon":"m
|
|
|
1070
1053
|
|
|
1071
1054
|
var _excluded$6 = ["device", "className", "iconComponents"];
|
|
1072
1055
|
var propTypes$g = {
|
|
1073
|
-
device:
|
|
1056
|
+
device: PropTypes.string.isRequired,
|
|
1074
1057
|
iconComponents: core.PropTypes.components,
|
|
1075
|
-
className:
|
|
1058
|
+
className: PropTypes.string
|
|
1076
1059
|
};
|
|
1077
1060
|
var defaultProps$g = {
|
|
1078
1061
|
iconComponents: DeviceIcons,
|
|
@@ -1082,11 +1065,11 @@ var DeviceButton = function DeviceButton(_ref) {
|
|
|
1082
1065
|
var device = _ref.device,
|
|
1083
1066
|
className = _ref.className,
|
|
1084
1067
|
iconComponents = _ref.iconComponents,
|
|
1085
|
-
props =
|
|
1068
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
1086
1069
|
var DeviceIcon = utils.getComponentFromName(device, iconComponents, DesktopIcon);
|
|
1087
|
-
return /*#__PURE__*/
|
|
1088
|
-
className:
|
|
1089
|
-
}, props), /*#__PURE__*/
|
|
1070
|
+
return /*#__PURE__*/React.createElement(components.Button, Object.assign({
|
|
1071
|
+
className: classNames([styles$d.container, _defineProperty({}, className, className !== null)])
|
|
1072
|
+
}, props), /*#__PURE__*/React.createElement(DeviceIcon, {
|
|
1090
1073
|
className: styles$d.icon
|
|
1091
1074
|
}));
|
|
1092
1075
|
};
|
|
@@ -1096,8 +1079,8 @@ DeviceButton.defaultProps = defaultProps$g;
|
|
|
1096
1079
|
var _excluded$5 = ["id"];
|
|
1097
1080
|
var propTypes$f = {
|
|
1098
1081
|
items: core.PropTypes.menuItems,
|
|
1099
|
-
className:
|
|
1100
|
-
onClickItem:
|
|
1082
|
+
className: PropTypes.string,
|
|
1083
|
+
onClickItem: PropTypes.func
|
|
1101
1084
|
};
|
|
1102
1085
|
var defaultProps$f = {
|
|
1103
1086
|
items: [],
|
|
@@ -1108,14 +1091,14 @@ var DevicesMenu = function DevicesMenu(_ref) {
|
|
|
1108
1091
|
var items = _ref.items,
|
|
1109
1092
|
className = _ref.className,
|
|
1110
1093
|
onClickItem = _ref.onClickItem;
|
|
1111
|
-
return /*#__PURE__*/
|
|
1094
|
+
return /*#__PURE__*/React.createElement(components.Tabs, {
|
|
1112
1095
|
items: items,
|
|
1113
1096
|
theme: "outline-secondary",
|
|
1114
|
-
className:
|
|
1097
|
+
className: classNames([styles$e.container, _defineProperty({}, className, className !== null)]),
|
|
1115
1098
|
renderItemButton: function renderItemButton(item, index, props) {
|
|
1116
1099
|
var id = item.id,
|
|
1117
|
-
itemProps =
|
|
1118
|
-
return /*#__PURE__*/
|
|
1100
|
+
itemProps = _objectWithoutProperties(item, _excluded$5);
|
|
1101
|
+
return /*#__PURE__*/React.createElement(DeviceButton, Object.assign({
|
|
1119
1102
|
device: id
|
|
1120
1103
|
}, props, itemProps, {
|
|
1121
1104
|
className: styles$e.button,
|
|
@@ -1132,19 +1115,19 @@ DevicesMenu.defaultProps = defaultProps$f;
|
|
|
1132
1115
|
var styles$c = {"container":"micromag-editor-buttons-screen-container","button":"micromag-editor-buttons-screen-button","screen":"micromag-editor-buttons-screen-screen","inner":"micromag-editor-buttons-screen-inner","border":"micromag-editor-buttons-screen-border","icon":"micromag-editor-buttons-screen-icon","label":"micromag-editor-buttons-screen-label","active":"micromag-editor-buttons-screen-active"};
|
|
1133
1116
|
|
|
1134
1117
|
var propTypes$e = {
|
|
1135
|
-
active:
|
|
1136
|
-
id:
|
|
1137
|
-
href:
|
|
1118
|
+
active: PropTypes.bool,
|
|
1119
|
+
id: PropTypes.string,
|
|
1120
|
+
href: PropTypes.string,
|
|
1138
1121
|
label: core.PropTypes.label,
|
|
1139
|
-
icon:
|
|
1140
|
-
title:
|
|
1141
|
-
onClick:
|
|
1142
|
-
children:
|
|
1143
|
-
refButton:
|
|
1144
|
-
current:
|
|
1122
|
+
icon: PropTypes.node,
|
|
1123
|
+
title: PropTypes.string,
|
|
1124
|
+
onClick: PropTypes.func,
|
|
1125
|
+
children: PropTypes.node,
|
|
1126
|
+
refButton: PropTypes.shape({
|
|
1127
|
+
current: PropTypes.any // eslint-disable-line
|
|
1145
1128
|
}),
|
|
1146
1129
|
|
|
1147
|
-
className:
|
|
1130
|
+
className: PropTypes.string
|
|
1148
1131
|
};
|
|
1149
1132
|
var defaultProps$e = {
|
|
1150
1133
|
active: false,
|
|
@@ -1159,7 +1142,6 @@ var defaultProps$e = {
|
|
|
1159
1142
|
className: null
|
|
1160
1143
|
};
|
|
1161
1144
|
var ScreenButton = function ScreenButton(_ref) {
|
|
1162
|
-
var _ref2;
|
|
1163
1145
|
var active = _ref.active,
|
|
1164
1146
|
id = _ref.id,
|
|
1165
1147
|
href = _ref.href,
|
|
@@ -1170,17 +1152,17 @@ var ScreenButton = function ScreenButton(_ref) {
|
|
|
1170
1152
|
title = _ref.title,
|
|
1171
1153
|
onClick = _ref.onClick,
|
|
1172
1154
|
refButton = _ref.refButton;
|
|
1173
|
-
return /*#__PURE__*/
|
|
1174
|
-
className:
|
|
1175
|
-
}, children !== null ? children : /*#__PURE__*/
|
|
1155
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1156
|
+
className: classNames([styles$c.container, 'rounded', _defineProperty(_defineProperty({}, styles$c.active, active), className, className !== null)])
|
|
1157
|
+
}, children !== null ? children : /*#__PURE__*/React.createElement("div", {
|
|
1176
1158
|
className: styles$c.screen
|
|
1177
|
-
}, /*#__PURE__*/
|
|
1159
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1178
1160
|
className: styles$c.inner
|
|
1179
|
-
}, icon !== null ? /*#__PURE__*/
|
|
1161
|
+
}, icon !== null ? /*#__PURE__*/React.createElement("div", {
|
|
1180
1162
|
className: styles$c.icon
|
|
1181
|
-
}, icon) : null, label !== null ? /*#__PURE__*/
|
|
1163
|
+
}, icon) : null, label !== null ? /*#__PURE__*/React.createElement("div", {
|
|
1182
1164
|
className: styles$c.label
|
|
1183
|
-
}, label) : null)), /*#__PURE__*/
|
|
1165
|
+
}, label) : null)), /*#__PURE__*/React.createElement(components.Button, {
|
|
1184
1166
|
className: styles$c.button,
|
|
1185
1167
|
withoutStyle: true,
|
|
1186
1168
|
id: id,
|
|
@@ -1188,14 +1170,14 @@ var ScreenButton = function ScreenButton(_ref) {
|
|
|
1188
1170
|
title: title,
|
|
1189
1171
|
onClick: onClick,
|
|
1190
1172
|
refButton: refButton
|
|
1191
|
-
}, /*#__PURE__*/
|
|
1192
|
-
className:
|
|
1173
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
1174
|
+
className: classNames([styles$c.border, 'rounded'])
|
|
1193
1175
|
})));
|
|
1194
1176
|
};
|
|
1195
1177
|
ScreenButton.propTypes = propTypes$e;
|
|
1196
1178
|
ScreenButton.defaultProps = defaultProps$e;
|
|
1197
|
-
var ScreenButton$1 = /*#__PURE__*/
|
|
1198
|
-
return /*#__PURE__*/
|
|
1179
|
+
var ScreenButton$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
1180
|
+
return /*#__PURE__*/React.createElement(ScreenButton, Object.assign({}, props, {
|
|
1199
1181
|
refButton: ref
|
|
1200
1182
|
}));
|
|
1201
1183
|
});
|
|
@@ -1204,17 +1186,17 @@ var styles$b = {"button":"micromag-editor-buttons-screen-with-preview-button","n
|
|
|
1204
1186
|
|
|
1205
1187
|
var propTypes$d = {
|
|
1206
1188
|
screen: core.PropTypes.screenComponent,
|
|
1207
|
-
screenState:
|
|
1208
|
-
index:
|
|
1209
|
-
href:
|
|
1210
|
-
title:
|
|
1211
|
-
active:
|
|
1212
|
-
withPlaceholder:
|
|
1213
|
-
withIndexIndicator:
|
|
1214
|
-
withName:
|
|
1215
|
-
onClick:
|
|
1216
|
-
onClickItem:
|
|
1217
|
-
className:
|
|
1189
|
+
screenState: PropTypes.string,
|
|
1190
|
+
index: PropTypes.number.isRequired,
|
|
1191
|
+
href: PropTypes.string,
|
|
1192
|
+
title: PropTypes.string,
|
|
1193
|
+
active: PropTypes.bool,
|
|
1194
|
+
withPlaceholder: PropTypes.bool,
|
|
1195
|
+
withIndexIndicator: PropTypes.bool,
|
|
1196
|
+
withName: PropTypes.bool,
|
|
1197
|
+
onClick: PropTypes.func,
|
|
1198
|
+
onClickItem: PropTypes.func,
|
|
1199
|
+
className: PropTypes.string
|
|
1218
1200
|
};
|
|
1219
1201
|
var defaultProps$d = {
|
|
1220
1202
|
screen: null,
|
|
@@ -1230,7 +1212,6 @@ var defaultProps$d = {
|
|
|
1230
1212
|
className: null
|
|
1231
1213
|
};
|
|
1232
1214
|
var ScreenWithPreview = function ScreenWithPreview(_ref) {
|
|
1233
|
-
var _ref2;
|
|
1234
1215
|
var screen = _ref.screen,
|
|
1235
1216
|
screenState = _ref.screenState,
|
|
1236
1217
|
index = _ref.index,
|
|
@@ -1251,12 +1232,12 @@ var ScreenWithPreview = function ScreenWithPreview(_ref) {
|
|
|
1251
1232
|
visible = _useIsVisible.visible;
|
|
1252
1233
|
var ScreenComponent = withPlaceholder ? components.ScreenPlaceholder : components.ScreenPreview;
|
|
1253
1234
|
var finalTitle = utils.isMessage(title) ? intl.formatMessage(title) : title || null;
|
|
1254
|
-
return /*#__PURE__*/
|
|
1235
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1255
1236
|
ref: ref
|
|
1256
|
-
}, /*#__PURE__*/
|
|
1237
|
+
}, /*#__PURE__*/React.createElement(ScreenButton$1, {
|
|
1257
1238
|
href: href,
|
|
1258
1239
|
active: active,
|
|
1259
|
-
className:
|
|
1240
|
+
className: classNames([styles$b.button, _defineProperty(_defineProperty({}, className, className !== null), styles$b.withIndex, withIndexIndicator || withName)]),
|
|
1260
1241
|
title: finalTitle,
|
|
1261
1242
|
onClick: function onClick() {
|
|
1262
1243
|
if (_onClick !== null) {
|
|
@@ -1266,15 +1247,15 @@ var ScreenWithPreview = function ScreenWithPreview(_ref) {
|
|
|
1266
1247
|
onClickItem(screen, index);
|
|
1267
1248
|
}
|
|
1268
1249
|
}
|
|
1269
|
-
}, /*#__PURE__*/
|
|
1250
|
+
}, /*#__PURE__*/React.createElement(ScreenComponent, {
|
|
1270
1251
|
screen: screen,
|
|
1271
1252
|
screenState: screenState,
|
|
1272
1253
|
className: styles$b.screen,
|
|
1273
1254
|
hidden: !visible,
|
|
1274
1255
|
withSize: true
|
|
1275
|
-
}), index !== null && withIndexIndicator ? /*#__PURE__*/
|
|
1256
|
+
}), index !== null && withIndexIndicator ? /*#__PURE__*/React.createElement("div", {
|
|
1276
1257
|
className: styles$b.index
|
|
1277
|
-
}, index + 1) : null, withName && !withIndexIndicator ? /*#__PURE__*/
|
|
1258
|
+
}, index + 1) : null, withName && !withIndexIndicator ? /*#__PURE__*/React.createElement("div", {
|
|
1278
1259
|
className: styles$b.name
|
|
1279
1260
|
}, finalTitle || null) : null));
|
|
1280
1261
|
};
|
|
@@ -1285,10 +1266,10 @@ var styles$a = {"container":"micromag-editor-partials-screen-states-container","
|
|
|
1285
1266
|
|
|
1286
1267
|
var propTypes$c = {
|
|
1287
1268
|
screen: core.PropTypes.screen.isRequired,
|
|
1288
|
-
screenState:
|
|
1269
|
+
screenState: PropTypes.string,
|
|
1289
1270
|
value: core.PropTypes.story.isRequired,
|
|
1290
|
-
className:
|
|
1291
|
-
onChange:
|
|
1271
|
+
className: PropTypes.string,
|
|
1272
|
+
onChange: PropTypes.func
|
|
1292
1273
|
};
|
|
1293
1274
|
var defaultProps$c = {
|
|
1294
1275
|
screenState: null,
|
|
@@ -1309,7 +1290,7 @@ function ScreenStates(_ref) {
|
|
|
1309
1290
|
field = _useRouteParams$field === void 0 ? null : _useRouteParams$field;
|
|
1310
1291
|
var states = useScreenStates(screen);
|
|
1311
1292
|
var _ref2 = field !== null ? field.split('/') : [],
|
|
1312
|
-
_ref3 =
|
|
1293
|
+
_ref3 = _toArray(_ref2),
|
|
1313
1294
|
_ref3$ = _ref3[0],
|
|
1314
1295
|
stateParam = _ref3$ === void 0 ? null : _ref3$,
|
|
1315
1296
|
stateIndexes = _ref3.slice(1);
|
|
@@ -1320,20 +1301,20 @@ function ScreenStates(_ref) {
|
|
|
1320
1301
|
var id = _ref4.id;
|
|
1321
1302
|
return id === stateParam;
|
|
1322
1303
|
}) !== -1 ? stateParam : null;
|
|
1323
|
-
return /*#__PURE__*/
|
|
1324
|
-
className:
|
|
1325
|
-
}, /*#__PURE__*/
|
|
1304
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1305
|
+
className: classNames([styles$a.container, _defineProperty({}, className, className !== null)])
|
|
1306
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1326
1307
|
className: "d-flex align-items-end m-n1"
|
|
1327
|
-
}, /*#__PURE__*/
|
|
1308
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1328
1309
|
className: "p-1 align-self-stretch d-flex flex-column"
|
|
1329
|
-
}, /*#__PURE__*/
|
|
1330
|
-
className:
|
|
1331
|
-
}, "Settings"), /*#__PURE__*/
|
|
1332
|
-
className:
|
|
1310
|
+
}, /*#__PURE__*/React.createElement("h6", {
|
|
1311
|
+
className: classNames(['fw-normal', 'invisible', styles$a.title])
|
|
1312
|
+
}, "Settings"), /*#__PURE__*/React.createElement(components.Button, {
|
|
1313
|
+
className: classNames([styles$a.button, 'p-0', 'flex-grow-1', 'justify-content-center']),
|
|
1333
1314
|
theme: screenParam !== null && field === null ? 'primary' : 'secondary',
|
|
1334
1315
|
outline: screenParam === null || field !== null,
|
|
1335
1316
|
size: "lg",
|
|
1336
|
-
icon: /*#__PURE__*/
|
|
1317
|
+
icon: /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
1337
1318
|
icon: faCogs.faCogs
|
|
1338
1319
|
}),
|
|
1339
1320
|
href: url('screen', {
|
|
@@ -1360,8 +1341,8 @@ function ScreenStates(_ref) {
|
|
|
1360
1341
|
});
|
|
1361
1342
|
var currentScreenValue = currentComponentsValue[currentScreenIndex] || {};
|
|
1362
1343
|
var currentFieldValue = currentScreenValue[fieldName || id] || [];
|
|
1363
|
-
var newValue =
|
|
1364
|
-
components: [].concat(
|
|
1344
|
+
var newValue = _objectSpread(_objectSpread({}, value), {}, {
|
|
1345
|
+
components: [].concat(_toConsumableArray(currentComponentsValue.slice(0, currentScreenIndex)), [_objectSpread(_objectSpread({}, currentScreenValue), {}, _defineProperty({}, fieldName || id, [].concat(_toConsumableArray(currentFieldValue), [{}])))], _toConsumableArray(currentComponentsValue.slice(currentScreenIndex + 1)))
|
|
1365
1346
|
});
|
|
1366
1347
|
if (onChange !== null) {
|
|
1367
1348
|
onChange(newValue);
|
|
@@ -1371,16 +1352,16 @@ function ScreenStates(_ref) {
|
|
|
1371
1352
|
field: [id, currentFieldValue.length]
|
|
1372
1353
|
});
|
|
1373
1354
|
};
|
|
1374
|
-
return /*#__PURE__*/
|
|
1355
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1375
1356
|
className: "p-1 align-self-stretch d-flex flex-column"
|
|
1376
|
-
}, /*#__PURE__*/
|
|
1377
|
-
className:
|
|
1378
|
-
}, /*#__PURE__*/
|
|
1357
|
+
}, /*#__PURE__*/React.createElement("h6", {
|
|
1358
|
+
className: classNames(['fw-normal', 'text-muted', styles$a.title])
|
|
1359
|
+
}, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, label)), repeatable ? /*#__PURE__*/React.createElement("ul", {
|
|
1379
1360
|
className: "d-flex list-unstyled m-n1 flex-grow-1"
|
|
1380
1361
|
}, repeatableItems.map(function (item, index) {
|
|
1381
|
-
return /*#__PURE__*/
|
|
1362
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
1382
1363
|
className: "p-1"
|
|
1383
|
-
}, /*#__PURE__*/
|
|
1364
|
+
}, /*#__PURE__*/React.createElement(ScreenWithPreview, {
|
|
1384
1365
|
index: index,
|
|
1385
1366
|
withIndexIndicator: true,
|
|
1386
1367
|
screen: screen,
|
|
@@ -1392,18 +1373,18 @@ function ScreenStates(_ref) {
|
|
|
1392
1373
|
field: [id, index]
|
|
1393
1374
|
})
|
|
1394
1375
|
}));
|
|
1395
|
-
}), !withoutCreate ? /*#__PURE__*/
|
|
1376
|
+
}), !withoutCreate ? /*#__PURE__*/React.createElement("li", {
|
|
1396
1377
|
className: "p-1"
|
|
1397
|
-
}, /*#__PURE__*/
|
|
1398
|
-
className:
|
|
1378
|
+
}, /*#__PURE__*/React.createElement(components.Button, {
|
|
1379
|
+
className: classNames([styles$a.button, styles$a.addButton, 'h-100', 'p-0', 'justify-content-center']),
|
|
1399
1380
|
theme: "secondary",
|
|
1400
1381
|
outline: true,
|
|
1401
1382
|
size: "lg",
|
|
1402
|
-
icon: /*#__PURE__*/
|
|
1383
|
+
icon: /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
1403
1384
|
icon: faPlus.faPlus
|
|
1404
1385
|
}),
|
|
1405
1386
|
onClick: onClickAdd
|
|
1406
|
-
})) : null) : /*#__PURE__*/
|
|
1387
|
+
})) : null) : /*#__PURE__*/React.createElement(ScreenWithPreview, {
|
|
1407
1388
|
screen: screen,
|
|
1408
1389
|
screenState: id,
|
|
1409
1390
|
className: styles$a.button,
|
|
@@ -1427,15 +1408,15 @@ ScreenStates.defaultProps = defaultProps$c;
|
|
|
1427
1408
|
var styles$9 = {"container":"micromag-editor-preview-container","story":"micromag-editor-preview-story","noStory":"micromag-editor-preview-noStory","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","devices":"micromag-editor-preview-devices","screen-medium":"micromag-editor-preview-screen-medium"};
|
|
1428
1409
|
|
|
1429
1410
|
var propTypes$b = {
|
|
1430
|
-
value:
|
|
1411
|
+
value: PropTypes.oneOfType([core.PropTypes.story, core.PropTypes.theme]),
|
|
1431
1412
|
devices: core.PropTypes.devices,
|
|
1432
|
-
device:
|
|
1413
|
+
device: PropTypes.string,
|
|
1433
1414
|
viewerTheme: core.PropTypes.viewerTheme,
|
|
1434
|
-
isTheme:
|
|
1435
|
-
className:
|
|
1436
|
-
onScreenChange:
|
|
1437
|
-
onChange:
|
|
1438
|
-
withoutDevicesSizes:
|
|
1415
|
+
isTheme: PropTypes.bool,
|
|
1416
|
+
className: PropTypes.string,
|
|
1417
|
+
onScreenChange: PropTypes.func,
|
|
1418
|
+
onChange: PropTypes.func,
|
|
1419
|
+
withoutDevicesSizes: PropTypes.bool
|
|
1439
1420
|
};
|
|
1440
1421
|
var defaultProps$b = {
|
|
1441
1422
|
value: null,
|
|
@@ -1457,7 +1438,6 @@ var defaultProps$b = {
|
|
|
1457
1438
|
withoutDevicesSizes: true
|
|
1458
1439
|
};
|
|
1459
1440
|
var EditorPreview = function EditorPreview(_ref) {
|
|
1460
|
-
var _ref8;
|
|
1461
1441
|
var value = _ref.value,
|
|
1462
1442
|
viewerTheme = _ref.viewerTheme,
|
|
1463
1443
|
isTheme = _ref.isTheme,
|
|
@@ -1486,7 +1466,7 @@ var EditorPreview = function EditorPreview(_ref) {
|
|
|
1486
1466
|
|
|
1487
1467
|
// Get device
|
|
1488
1468
|
var _useState = React.useState(initialDevice || devices[0].id),
|
|
1489
|
-
_useState2 =
|
|
1469
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1490
1470
|
deviceId = _useState2[0],
|
|
1491
1471
|
setDeviceId = _useState2[1];
|
|
1492
1472
|
var onClickDeviceItem = React.useCallback(function (e, it) {
|
|
@@ -1532,7 +1512,7 @@ var EditorPreview = function EditorPreview(_ref) {
|
|
|
1532
1512
|
}, [valueParsed, screenId]);
|
|
1533
1513
|
var currentScreenStates = useScreenStates(currentScreen);
|
|
1534
1514
|
var _ref4 = fieldParam !== null && currentScreenStates !== null ? fieldParam.split('/') : [],
|
|
1535
|
-
_ref5 =
|
|
1515
|
+
_ref5 = _slicedToArray(_ref4, 1),
|
|
1536
1516
|
_ref5$ = _ref5[0],
|
|
1537
1517
|
screenStateParam = _ref5$ === void 0 ? null : _ref5$;
|
|
1538
1518
|
var currentScreenState = screenStateParam !== null ? currentScreenStates.find(function (_ref6) {
|
|
@@ -1547,30 +1527,30 @@ var EditorPreview = function EditorPreview(_ref) {
|
|
|
1547
1527
|
var currentScreenStateId = currentScreenState !== null && repeatable ? "".concat(screenStateId, ".").concat(fieldParam.split('/').find(function (it) {
|
|
1548
1528
|
return it.match(/^[0-9]+$/) !== null;
|
|
1549
1529
|
}) || 0) : screenStateId;
|
|
1550
|
-
return /*#__PURE__*/
|
|
1551
|
-
className:
|
|
1530
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1531
|
+
className: classNames([styles$9.container, screens.map(function (screenName) {
|
|
1552
1532
|
return styles$9["screen-".concat(screenName)];
|
|
1553
|
-
}), (
|
|
1554
|
-
}, /*#__PURE__*/
|
|
1533
|
+
}), _defineProperty(_defineProperty({}, className, className), styles$9.withoutDevicesSizes, withoutDevicesSizes)])
|
|
1534
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1555
1535
|
className: styles$9.inner
|
|
1556
|
-
}, currentScreenStates !== null && currentScreen !== null ? /*#__PURE__*/
|
|
1557
|
-
className:
|
|
1558
|
-
}, /*#__PURE__*/
|
|
1536
|
+
}, currentScreenStates !== null && currentScreen !== null ? /*#__PURE__*/React.createElement("div", {
|
|
1537
|
+
className: classNames([styles$9.top, 'px-1'])
|
|
1538
|
+
}, /*#__PURE__*/React.createElement(ScreenStates, {
|
|
1559
1539
|
screen: currentScreen,
|
|
1560
1540
|
screenState: currentScreenStateId,
|
|
1561
1541
|
value: value,
|
|
1562
1542
|
onChange: onChange
|
|
1563
|
-
})) : null, /*#__PURE__*/
|
|
1543
|
+
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
1564
1544
|
className: styles$9.bottom
|
|
1565
|
-
}, /*#__PURE__*/
|
|
1545
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1566
1546
|
className: styles$9.inner,
|
|
1567
1547
|
ref: bottomRef
|
|
1568
|
-
}, /*#__PURE__*/
|
|
1548
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1569
1549
|
className: styles$9.preview,
|
|
1570
1550
|
style: previewStyle
|
|
1571
|
-
}, /*#__PURE__*/
|
|
1551
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1572
1552
|
className: styles$9.viewerContainer
|
|
1573
|
-
}, /*#__PURE__*/
|
|
1553
|
+
}, /*#__PURE__*/React.createElement(contexts.PlaybackProvider, null, /*#__PURE__*/React.createElement(viewer.Viewer, {
|
|
1574
1554
|
story: valueParsed,
|
|
1575
1555
|
storyIsParsed: true,
|
|
1576
1556
|
screen: screenId,
|
|
@@ -1584,11 +1564,11 @@ var EditorPreview = function EditorPreview(_ref) {
|
|
|
1584
1564
|
withoutTransitions: true,
|
|
1585
1565
|
withoutGestures: true,
|
|
1586
1566
|
withoutMenu: true
|
|
1587
|
-
})))))), !withoutDevicesSizes ? /*#__PURE__*/
|
|
1567
|
+
})))))), !withoutDevicesSizes ? /*#__PURE__*/React.createElement("div", {
|
|
1588
1568
|
className: styles$9.deviceMenu
|
|
1589
|
-
}, /*#__PURE__*/
|
|
1569
|
+
}, /*#__PURE__*/React.createElement(DevicesMenu, {
|
|
1590
1570
|
items: devices.map(function (it) {
|
|
1591
|
-
return
|
|
1571
|
+
return _objectSpread(_objectSpread({}, it), {}, {
|
|
1592
1572
|
active: it.id === deviceId
|
|
1593
1573
|
});
|
|
1594
1574
|
}),
|
|
@@ -1673,11 +1653,11 @@ function flatten(items) {
|
|
|
1673
1653
|
var parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1674
1654
|
var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1675
1655
|
return items.reduce(function (acc, item, index) {
|
|
1676
|
-
return [].concat(
|
|
1656
|
+
return [].concat(_toConsumableArray(acc), [_objectSpread(_objectSpread({}, item), {}, {
|
|
1677
1657
|
parentId: item.parentId || parentId,
|
|
1678
1658
|
depth: item.parentId ? 1 : 0,
|
|
1679
1659
|
index: index // For some reason this aint enough
|
|
1680
|
-
})],
|
|
1660
|
+
})], _toConsumableArray(flatten(item.children || [], item.id, depth + 1)));
|
|
1681
1661
|
}, []);
|
|
1682
1662
|
}
|
|
1683
1663
|
function flattenTree(items) {
|
|
@@ -1694,16 +1674,16 @@ function buildTree(flattenedItems) {
|
|
|
1694
1674
|
id: 'root',
|
|
1695
1675
|
children: []
|
|
1696
1676
|
};
|
|
1697
|
-
var nodes =
|
|
1677
|
+
var nodes = _defineProperty({}, root.id, root);
|
|
1698
1678
|
var items = flattenedItems.map(function (item) {
|
|
1699
|
-
return
|
|
1679
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
1700
1680
|
children: []
|
|
1701
1681
|
});
|
|
1702
1682
|
});
|
|
1703
1683
|
// console.log('BUILD');
|
|
1704
1684
|
var indexes = {};
|
|
1705
1685
|
// eslint-disable-next-line no-restricted-syntax
|
|
1706
|
-
var _iterator =
|
|
1686
|
+
var _iterator = _createForOfIteratorHelper(items),
|
|
1707
1687
|
_step;
|
|
1708
1688
|
try {
|
|
1709
1689
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
@@ -1723,7 +1703,7 @@ function buildTree(flattenedItems) {
|
|
|
1723
1703
|
children: children,
|
|
1724
1704
|
index: indexes[parentId]
|
|
1725
1705
|
};
|
|
1726
|
-
parent.children.push(
|
|
1706
|
+
parent.children.push(_objectSpread(_objectSpread({}, item), {}, {
|
|
1727
1707
|
index: indexes[parentId]
|
|
1728
1708
|
}));
|
|
1729
1709
|
}
|
|
@@ -1756,7 +1736,7 @@ function removeItem(items, id) {
|
|
|
1756
1736
|
var newItems = [];
|
|
1757
1737
|
|
|
1758
1738
|
// eslint-disable-next-line no-restricted-syntax
|
|
1759
|
-
var _iterator2 =
|
|
1739
|
+
var _iterator2 = _createForOfIteratorHelper(items),
|
|
1760
1740
|
_step2;
|
|
1761
1741
|
try {
|
|
1762
1742
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
@@ -1779,7 +1759,7 @@ function removeItem(items, id) {
|
|
|
1779
1759
|
}
|
|
1780
1760
|
function setProperty(items, id, property, setter) {
|
|
1781
1761
|
// eslint-disable-next-line no-restricted-syntax
|
|
1782
|
-
var _iterator3 =
|
|
1762
|
+
var _iterator3 = _createForOfIteratorHelper(items),
|
|
1783
1763
|
_step3;
|
|
1784
1764
|
try {
|
|
1785
1765
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
@@ -1798,7 +1778,7 @@ function setProperty(items, id, property, setter) {
|
|
|
1798
1778
|
} finally {
|
|
1799
1779
|
_iterator3.f();
|
|
1800
1780
|
}
|
|
1801
|
-
return
|
|
1781
|
+
return _toConsumableArray(items);
|
|
1802
1782
|
}
|
|
1803
1783
|
function countChildren(items) {
|
|
1804
1784
|
var count = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -1819,7 +1799,7 @@ function getChildCount(items, id) {
|
|
|
1819
1799
|
return item ? countChildren(item.children || []) : 0;
|
|
1820
1800
|
}
|
|
1821
1801
|
function removeChildrenOf(items, ids) {
|
|
1822
|
-
var excludeParentIds =
|
|
1802
|
+
var excludeParentIds = _toConsumableArray(ids);
|
|
1823
1803
|
return items.filter(function (item) {
|
|
1824
1804
|
if (item.parentId && excludeParentIds.includes(item.parentId)) {
|
|
1825
1805
|
var _item$children2 = item.children,
|
|
@@ -1860,14 +1840,14 @@ var sortableTreeKeyboardCoordinates = function sortableTreeKeyboardCoordinates(c
|
|
|
1860
1840
|
switch (event.code) {
|
|
1861
1841
|
case core$1.KeyboardCode.Left:
|
|
1862
1842
|
if (depth > minDepth) {
|
|
1863
|
-
return
|
|
1843
|
+
return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
|
|
1864
1844
|
x: currentCoordinates.x - indentationWidth
|
|
1865
1845
|
});
|
|
1866
1846
|
}
|
|
1867
1847
|
break;
|
|
1868
1848
|
case core$1.KeyboardCode.Right:
|
|
1869
1849
|
if (depth < maxDepth) {
|
|
1870
|
-
return
|
|
1850
|
+
return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
|
|
1871
1851
|
x: currentCoordinates.x + indentationWidth
|
|
1872
1852
|
});
|
|
1873
1853
|
}
|
|
@@ -1948,32 +1928,32 @@ var styles$8 = {"wrapper":"micromag-editor-sortable-sortable-tree-item-actions-w
|
|
|
1948
1928
|
|
|
1949
1929
|
var _excluded$4 = ["childCount", "clone", "depth", "disableSelection", "disableInteraction", "ghost", "handleProps", "indentationWidth", "indicator", "collapsed", "onCollapse", "onRemove", "onClick", "style", "value", "wrapperRef", "showId", "showCount", "showCollapsedCount", "children"];
|
|
1950
1930
|
var propTypes$a = {
|
|
1951
|
-
childCount:
|
|
1952
|
-
clone:
|
|
1953
|
-
collapsed:
|
|
1954
|
-
depth:
|
|
1955
|
-
disableInteraction:
|
|
1956
|
-
disableSelection:
|
|
1957
|
-
ghost:
|
|
1931
|
+
childCount: PropTypes.number,
|
|
1932
|
+
clone: PropTypes.bool,
|
|
1933
|
+
collapsed: PropTypes.bool,
|
|
1934
|
+
depth: PropTypes.number.isRequired,
|
|
1935
|
+
disableInteraction: PropTypes.bool,
|
|
1936
|
+
disableSelection: PropTypes.bool,
|
|
1937
|
+
ghost: PropTypes.bool,
|
|
1958
1938
|
// eslint-disable-next-line react/forbid-prop-types
|
|
1959
|
-
handleProps:
|
|
1960
|
-
indicator:
|
|
1961
|
-
indentationWidth:
|
|
1962
|
-
value:
|
|
1963
|
-
onCollapse:
|
|
1964
|
-
onRemove:
|
|
1965
|
-
onClick:
|
|
1939
|
+
handleProps: PropTypes.any,
|
|
1940
|
+
indicator: PropTypes.bool,
|
|
1941
|
+
indentationWidth: PropTypes.number.isRequired,
|
|
1942
|
+
value: PropTypes.string,
|
|
1943
|
+
onCollapse: PropTypes.func,
|
|
1944
|
+
onRemove: PropTypes.func,
|
|
1945
|
+
onClick: PropTypes.func,
|
|
1966
1946
|
// eslint-disable-next-line react/forbid-prop-types
|
|
1967
|
-
wrapperRef:
|
|
1968
|
-
style:
|
|
1969
|
-
width:
|
|
1970
|
-
height:
|
|
1971
|
-
transform:
|
|
1947
|
+
wrapperRef: PropTypes.any,
|
|
1948
|
+
style: PropTypes.shape({
|
|
1949
|
+
width: PropTypes.number.isRequired,
|
|
1950
|
+
height: PropTypes.number.isRequired,
|
|
1951
|
+
transform: PropTypes.string.isRequired
|
|
1972
1952
|
}),
|
|
1973
|
-
showId:
|
|
1974
|
-
showCount:
|
|
1975
|
-
showCollapsedCount:
|
|
1976
|
-
children:
|
|
1953
|
+
showId: PropTypes.bool,
|
|
1954
|
+
showCount: PropTypes.bool,
|
|
1955
|
+
showCollapsedCount: PropTypes.bool,
|
|
1956
|
+
children: PropTypes.node
|
|
1977
1957
|
};
|
|
1978
1958
|
var defaultProps$a = {
|
|
1979
1959
|
childCount: null,
|
|
@@ -1996,7 +1976,6 @@ var defaultProps$a = {
|
|
|
1996
1976
|
children: null
|
|
1997
1977
|
};
|
|
1998
1978
|
var SortableTreeItemActions = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1999
|
-
var _ref2;
|
|
2000
1979
|
var childCount = _ref.childCount,
|
|
2001
1980
|
clone = _ref.clone,
|
|
2002
1981
|
depth = _ref.depth,
|
|
@@ -2017,40 +1996,40 @@ var SortableTreeItemActions = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
2017
1996
|
var showCount = _ref.showCount,
|
|
2018
1997
|
showCollapsedCount = _ref.showCollapsedCount,
|
|
2019
1998
|
children = _ref.children,
|
|
2020
|
-
props =
|
|
2021
|
-
return /*#__PURE__*/
|
|
2022
|
-
className:
|
|
1999
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
2000
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
2001
|
+
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)]),
|
|
2023
2002
|
ref: wrapperRef,
|
|
2024
2003
|
style: {
|
|
2025
2004
|
marginLeft: "".concat(indentationWidth * depth, "px"),
|
|
2026
2005
|
marginRight: "".concat(5 * depth, "px")
|
|
2027
2006
|
}
|
|
2028
|
-
}, props), /*#__PURE__*/
|
|
2007
|
+
}, props), /*#__PURE__*/React.createElement("div", {
|
|
2029
2008
|
className: styles$8.inner,
|
|
2030
2009
|
ref: ref,
|
|
2031
2010
|
style: style
|
|
2032
|
-
}, /*#__PURE__*/
|
|
2033
|
-
className:
|
|
2011
|
+
}, /*#__PURE__*/React.createElement("button", Object.assign({
|
|
2012
|
+
className: classNames([styles$8.button, styles$8.handle]),
|
|
2034
2013
|
type: "button"
|
|
2035
|
-
}, handleProps), /*#__PURE__*/
|
|
2014
|
+
}, handleProps), /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
2036
2015
|
className: styles$8.icon,
|
|
2037
2016
|
icon: faGripLines.faGripLines
|
|
2038
|
-
})), !clone && onRemove ? /*#__PURE__*/
|
|
2017
|
+
})), !clone && onRemove ? /*#__PURE__*/React.createElement("button", {
|
|
2039
2018
|
type: "button",
|
|
2040
2019
|
onClick: onRemove
|
|
2041
|
-
}, /*#__PURE__*/
|
|
2020
|
+
}, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
2042
2021
|
icon: faTimes.faTimes
|
|
2043
|
-
})) : null, clone && showCount && childCount && childCount > 1 ? /*#__PURE__*/
|
|
2022
|
+
})) : null, clone && showCount && childCount && childCount > 1 ? /*#__PURE__*/React.createElement("span", {
|
|
2044
2023
|
className: styles$8.count
|
|
2045
|
-
}, childCount) : null, showCollapsedCount && onCollapse && collapsed && childCount !== null && childCount > 0 ? /*#__PURE__*/
|
|
2024
|
+
}, childCount) : null, showCollapsedCount && onCollapse && collapsed && childCount !== null && childCount > 0 ? /*#__PURE__*/React.createElement("span", {
|
|
2046
2025
|
className: styles$8.collapsedCount
|
|
2047
|
-
}, childCount) : null, onCollapse && depth === 0 ? /*#__PURE__*/
|
|
2026
|
+
}, childCount) : null, onCollapse && depth === 0 ? /*#__PURE__*/React.createElement("button", {
|
|
2048
2027
|
type: "button",
|
|
2049
2028
|
onClick: onCollapse,
|
|
2050
|
-
className:
|
|
2051
|
-
}, /*#__PURE__*/
|
|
2029
|
+
className: classNames(styles$8.button, styles$8.collapse, collapsed && styles$8.collapsed)
|
|
2030
|
+
}, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
2052
2031
|
icon: faAngleDown.faAngleDown
|
|
2053
|
-
})) : null, /*#__PURE__*/
|
|
2032
|
+
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
2054
2033
|
className: styles$8.children
|
|
2055
2034
|
}, children)));
|
|
2056
2035
|
});
|
|
@@ -2061,27 +2040,27 @@ var styles$7 = {"container":"micromag-editor-sortable-sortable-tree-item-contain
|
|
|
2061
2040
|
|
|
2062
2041
|
var _excluded$3 = ["id", "index", "depth", "component", "value", "style", "smallScale", "collapsed", "onCollapse", "onClickItem", "childValue", "isLastChild"];
|
|
2063
2042
|
var propTypes$9 = {
|
|
2064
|
-
id:
|
|
2065
|
-
index:
|
|
2066
|
-
depth:
|
|
2067
|
-
component:
|
|
2043
|
+
id: PropTypes.string.isRequired,
|
|
2044
|
+
index: PropTypes.number.isRequired,
|
|
2045
|
+
depth: PropTypes.number.isRequired,
|
|
2046
|
+
component: PropTypes.func,
|
|
2068
2047
|
// eslint-disable-next-line react/forbid-prop-types
|
|
2069
|
-
value:
|
|
2070
|
-
style:
|
|
2071
|
-
width:
|
|
2072
|
-
height:
|
|
2073
|
-
scaledWidth:
|
|
2074
|
-
scaledHeight:
|
|
2075
|
-
transform:
|
|
2076
|
-
scale:
|
|
2048
|
+
value: PropTypes.object,
|
|
2049
|
+
style: PropTypes.shape({
|
|
2050
|
+
width: PropTypes.number.isRequired,
|
|
2051
|
+
height: PropTypes.number.isRequired,
|
|
2052
|
+
scaledWidth: PropTypes.number.isRequired,
|
|
2053
|
+
scaledHeight: PropTypes.number.isRequired,
|
|
2054
|
+
transform: PropTypes.string.isRequired,
|
|
2055
|
+
scale: PropTypes.number.isRequired
|
|
2077
2056
|
}),
|
|
2078
|
-
smallScale:
|
|
2079
|
-
collapsed:
|
|
2080
|
-
onCollapse:
|
|
2081
|
-
onClickItem:
|
|
2057
|
+
smallScale: PropTypes.number,
|
|
2058
|
+
collapsed: PropTypes.bool,
|
|
2059
|
+
onCollapse: PropTypes.func,
|
|
2060
|
+
onClickItem: PropTypes.func,
|
|
2082
2061
|
// eslint-disable-next-line react/forbid-prop-types
|
|
2083
|
-
childValue:
|
|
2084
|
-
isLastChild:
|
|
2062
|
+
childValue: PropTypes.object,
|
|
2063
|
+
isLastChild: PropTypes.bool
|
|
2085
2064
|
};
|
|
2086
2065
|
var defaultProps$9 = {
|
|
2087
2066
|
component: null,
|
|
@@ -2112,7 +2091,7 @@ var SortableTreeItem = function SortableTreeItem(_ref2) {
|
|
|
2112
2091
|
onClickItem = _ref2.onClickItem,
|
|
2113
2092
|
childValue = _ref2.childValue;
|
|
2114
2093
|
_ref2.isLastChild;
|
|
2115
|
-
var props =
|
|
2094
|
+
var props = _objectWithoutProperties(_ref2, _excluded$3);
|
|
2116
2095
|
var _useSortable = sortable.useSortable({
|
|
2117
2096
|
id: id,
|
|
2118
2097
|
animateLayoutChanges: animateLayoutChanges
|
|
@@ -2157,9 +2136,9 @@ var SortableTreeItem = function SortableTreeItem(_ref2) {
|
|
|
2157
2136
|
onPointerUp(e);
|
|
2158
2137
|
}
|
|
2159
2138
|
}, [onPointerUp]);
|
|
2160
|
-
return /*#__PURE__*/
|
|
2161
|
-
className:
|
|
2162
|
-
}, /*#__PURE__*/
|
|
2139
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2140
|
+
className: classNames([styles$7.container])
|
|
2141
|
+
}, /*#__PURE__*/React.createElement(SortableTreeItemActions, Object.assign({
|
|
2163
2142
|
ref: setDraggableNodeRef,
|
|
2164
2143
|
wrapperRef: setDroppableNodeRef,
|
|
2165
2144
|
style: actionsStyle,
|
|
@@ -2167,17 +2146,17 @@ var SortableTreeItem = function SortableTreeItem(_ref2) {
|
|
|
2167
2146
|
ghost: isDragging,
|
|
2168
2147
|
disableSelection: iOS,
|
|
2169
2148
|
disableInteraction: isSorting,
|
|
2170
|
-
handleProps:
|
|
2149
|
+
handleProps: _objectSpread(_objectSpread(_objectSpread({}, attributes), listeners), {}, {
|
|
2171
2150
|
onPointerDown: onClickAction,
|
|
2172
2151
|
onPointerUp: cancellingPointerUp
|
|
2173
2152
|
}),
|
|
2174
2153
|
collapsed: collapsed,
|
|
2175
2154
|
onCollapse: onCollapse
|
|
2176
|
-
}, props), Component !== null ? /*#__PURE__*/
|
|
2155
|
+
}, props), Component !== null ? /*#__PURE__*/React.createElement("div", {
|
|
2177
2156
|
className: styles$7.parent
|
|
2178
|
-
}, /*#__PURE__*/
|
|
2157
|
+
}, /*#__PURE__*/React.createElement(Component, value)) : null, childValue !== null ? /*#__PURE__*/React.createElement("div", {
|
|
2179
2158
|
className: styles$7.child
|
|
2180
|
-
}, /*#__PURE__*/
|
|
2159
|
+
}, /*#__PURE__*/React.createElement(Component, childValue)) : null));
|
|
2181
2160
|
};
|
|
2182
2161
|
SortableTreeItem.propTypes = propTypes$9;
|
|
2183
2162
|
SortableTreeItem.defaultProps = defaultProps$9;
|
|
@@ -2208,25 +2187,25 @@ var measuring = {
|
|
|
2208
2187
|
strategy: core$1.MeasuringStrategy.Always
|
|
2209
2188
|
}
|
|
2210
2189
|
};
|
|
2211
|
-
var dropAnimation =
|
|
2190
|
+
var dropAnimation = _objectSpread(_objectSpread({}, core$1.defaultDropAnimation), {}, {
|
|
2212
2191
|
dragSourceOpacity: 0.5
|
|
2213
2192
|
});
|
|
2214
2193
|
var adjustTranslate = function adjustTranslate(_ref) {
|
|
2215
2194
|
var transform = _ref.transform;
|
|
2216
|
-
return
|
|
2195
|
+
return _objectSpread(_objectSpread({}, transform), {}, {
|
|
2217
2196
|
y: transform.y - 25
|
|
2218
2197
|
});
|
|
2219
2198
|
};
|
|
2220
2199
|
var propTypes$8 = {
|
|
2221
|
-
collapsible:
|
|
2200
|
+
collapsible: PropTypes.bool,
|
|
2222
2201
|
// eslint-disable-next-line react/forbid-prop-types
|
|
2223
|
-
items:
|
|
2224
|
-
indentationWidth:
|
|
2225
|
-
indicator:
|
|
2226
|
-
removable:
|
|
2227
|
-
component:
|
|
2228
|
-
onClickItem:
|
|
2229
|
-
onChange:
|
|
2202
|
+
items: PropTypes.array,
|
|
2203
|
+
indentationWidth: PropTypes.number,
|
|
2204
|
+
indicator: PropTypes.bool,
|
|
2205
|
+
removable: PropTypes.bool,
|
|
2206
|
+
component: PropTypes.func,
|
|
2207
|
+
onClickItem: PropTypes.func,
|
|
2208
|
+
onChange: PropTypes.func
|
|
2230
2209
|
};
|
|
2231
2210
|
var defaultProps$8 = {
|
|
2232
2211
|
collapsible: true,
|
|
@@ -2250,23 +2229,23 @@ var SortableTree = function SortableTree(_ref2) {
|
|
|
2250
2229
|
var _useState = React.useState(function () {
|
|
2251
2230
|
return buildTree(defaultItems);
|
|
2252
2231
|
}),
|
|
2253
|
-
_useState2 =
|
|
2232
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2254
2233
|
items = _useState2[0],
|
|
2255
2234
|
setItems = _useState2[1];
|
|
2256
2235
|
var _useState3 = React.useState(null),
|
|
2257
|
-
_useState4 =
|
|
2236
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
2258
2237
|
activeId = _useState4[0],
|
|
2259
2238
|
setActiveId = _useState4[1];
|
|
2260
2239
|
var _useState5 = React.useState(null),
|
|
2261
|
-
_useState6 =
|
|
2240
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
2262
2241
|
overId = _useState6[0],
|
|
2263
2242
|
setOverId = _useState6[1];
|
|
2264
2243
|
var _useState7 = React.useState(0),
|
|
2265
|
-
_useState8 =
|
|
2244
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
2266
2245
|
offsetLeft = _useState8[0],
|
|
2267
2246
|
setOffsetLeft = _useState8[1];
|
|
2268
2247
|
var _useState9 = React.useState(null),
|
|
2269
|
-
_useState10 =
|
|
2248
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
2270
2249
|
currentPosition = _useState10[0],
|
|
2271
2250
|
setCurrentPosition = _useState10[1];
|
|
2272
2251
|
|
|
@@ -2274,7 +2253,7 @@ var SortableTree = function SortableTree(_ref2) {
|
|
|
2274
2253
|
React.useEffect(function () {
|
|
2275
2254
|
var flat = flattenTree(items);
|
|
2276
2255
|
var merged = defaultItems.map(function (t1) {
|
|
2277
|
-
return
|
|
2256
|
+
return _objectSpread(_objectSpread({}, flat.find(function (t2) {
|
|
2278
2257
|
return t2.id === t1.id;
|
|
2279
2258
|
})), t1);
|
|
2280
2259
|
});
|
|
@@ -2287,9 +2266,9 @@ var SortableTree = function SortableTree(_ref2) {
|
|
|
2287
2266
|
children = _ref3$children === void 0 ? [] : _ref3$children,
|
|
2288
2267
|
collapsed = _ref3.collapsed,
|
|
2289
2268
|
id = _ref3.id;
|
|
2290
|
-
return collapsed && children.length ? [].concat(
|
|
2269
|
+
return collapsed && children.length ? [].concat(_toConsumableArray(acc), [id]) : acc;
|
|
2291
2270
|
}, []) || null;
|
|
2292
|
-
return removeChildrenOf(flattenedTree, activeId ? [activeId].concat(
|
|
2271
|
+
return removeChildrenOf(flattenedTree, activeId ? [activeId].concat(_toConsumableArray(collapsedItems)) : collapsedItems);
|
|
2293
2272
|
}, [activeId, items, items.length]);
|
|
2294
2273
|
var projected = activeId && overId ? getProjection(flattenedItems, activeId, overId, offsetLeft, indentationWidth) : null;
|
|
2295
2274
|
var sensorContext = React.useRef({
|
|
@@ -2299,7 +2278,7 @@ var SortableTree = function SortableTree(_ref2) {
|
|
|
2299
2278
|
var _useState11 = React.useState(function () {
|
|
2300
2279
|
return sortableTreeKeyboardCoordinates(sensorContext, indentationWidth);
|
|
2301
2280
|
}),
|
|
2302
|
-
_useState12 =
|
|
2281
|
+
_useState12 = _slicedToArray(_useState11, 1),
|
|
2303
2282
|
coordinateGetter = _useState12[0];
|
|
2304
2283
|
var sensors = core$1.useSensors(core$1.useSensor(core$1.PointerSensor), core$1.useSensor(core$1.KeyboardSensor, {
|
|
2305
2284
|
coordinateGetter: coordinateGetter
|
|
@@ -2464,7 +2443,7 @@ var SortableTree = function SortableTree(_ref2) {
|
|
|
2464
2443
|
}
|
|
2465
2444
|
activeTreeItem.children = [];
|
|
2466
2445
|
}
|
|
2467
|
-
clonedItems[activeIndex] =
|
|
2446
|
+
clonedItems[activeIndex] = _objectSpread(_objectSpread({}, activeTreeItem), {}, {
|
|
2468
2447
|
depth: depth,
|
|
2469
2448
|
parentId: parentId
|
|
2470
2449
|
});
|
|
@@ -2484,7 +2463,7 @@ var SortableTree = function SortableTree(_ref2) {
|
|
|
2484
2463
|
collapsed = _ref18$collapsed === void 0 ? false : _ref18$collapsed;
|
|
2485
2464
|
return {
|
|
2486
2465
|
id: itemId,
|
|
2487
|
-
props:
|
|
2466
|
+
props: _objectSpread(_objectSpread({}, (children || []).length > 0 ? {
|
|
2488
2467
|
group: {
|
|
2489
2468
|
collapsed: collapsed,
|
|
2490
2469
|
mergeNavItems: true
|
|
@@ -2516,7 +2495,7 @@ var SortableTree = function SortableTree(_ref2) {
|
|
|
2516
2495
|
});
|
|
2517
2496
|
});
|
|
2518
2497
|
}, [setItems, setProperty]);
|
|
2519
|
-
return /*#__PURE__*/
|
|
2498
|
+
return /*#__PURE__*/React.createElement(core$1.DndContext, {
|
|
2520
2499
|
accessibility: {
|
|
2521
2500
|
announcements: announcements
|
|
2522
2501
|
}
|
|
@@ -2530,11 +2509,11 @@ var SortableTree = function SortableTree(_ref2) {
|
|
|
2530
2509
|
onDragOver: handleDragOver,
|
|
2531
2510
|
onDragEnd: handleDragEnd,
|
|
2532
2511
|
onDragCancel: handleDragCancel
|
|
2533
|
-
}, /*#__PURE__*/
|
|
2512
|
+
}, /*#__PURE__*/React.createElement(sortable.SortableContext, {
|
|
2534
2513
|
items: sortedIds,
|
|
2535
2514
|
strategy: sortable.verticalListSortingStrategy
|
|
2536
2515
|
}, flattenedItems.map(function (_ref19, idx) {
|
|
2537
|
-
var _flattenedItems
|
|
2516
|
+
var _flattenedItems;
|
|
2538
2517
|
var id = _ref19.id,
|
|
2539
2518
|
_ref19$children = _ref19.children,
|
|
2540
2519
|
children = _ref19$children === void 0 ? [] : _ref19$children,
|
|
@@ -2557,10 +2536,10 @@ var SortableTree = function SortableTree(_ref2) {
|
|
|
2557
2536
|
parentId = _ref21$parentId === void 0 ? null : _ref21$parentId;
|
|
2558
2537
|
return parentId === id;
|
|
2559
2538
|
}) : null;
|
|
2560
|
-
return /*#__PURE__*/
|
|
2561
|
-
className:
|
|
2539
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2540
|
+
className: classNames([styles$6.item, _defineProperty(_defineProperty(_defineProperty({}, styles$6.parent, onCollapse !== null && !collapsed), styles$6.group, depth === 1), styles$6.isLastChild, next === null)]),
|
|
2562
2541
|
key: id
|
|
2563
|
-
}, /*#__PURE__*/
|
|
2542
|
+
}, /*#__PURE__*/React.createElement(SortableTreeItem, {
|
|
2564
2543
|
key: id,
|
|
2565
2544
|
id: id,
|
|
2566
2545
|
depth: currentDepth,
|
|
@@ -2578,13 +2557,13 @@ var SortableTree = function SortableTree(_ref2) {
|
|
|
2578
2557
|
index: idx,
|
|
2579
2558
|
childValue: (childValue === null || childValue === void 0 ? void 0 : childValue.value) || null
|
|
2580
2559
|
}));
|
|
2581
|
-
}), /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/
|
|
2560
|
+
}), /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React.createElement(core$1.DragOverlay, {
|
|
2582
2561
|
dropAnimation: dropAnimation,
|
|
2583
2562
|
modifiers: indicator ? [adjustTranslate] : undefined
|
|
2584
|
-
}, activeId && activeItem ? /*#__PURE__*/
|
|
2563
|
+
}, activeId && activeItem ? /*#__PURE__*/React.createElement("div", {
|
|
2585
2564
|
className: styles$6.item,
|
|
2586
2565
|
key: activeId
|
|
2587
|
-
}, /*#__PURE__*/
|
|
2566
|
+
}, /*#__PURE__*/React.createElement(SortableTreeItem, {
|
|
2588
2567
|
id: activeId,
|
|
2589
2568
|
depth: activeItem.depth,
|
|
2590
2569
|
clone: true,
|
|
@@ -2608,20 +2587,20 @@ var _excluded$2 = ["className", "screen", "type", "title", "onClick", "active",
|
|
|
2608
2587
|
_excluded2 = ["id", "screen", "href"];
|
|
2609
2588
|
var propTypes$7 = {
|
|
2610
2589
|
items: core.PropTypes.menuItems,
|
|
2611
|
-
withPreview:
|
|
2612
|
-
withPlaceholder:
|
|
2613
|
-
withName:
|
|
2614
|
-
settings:
|
|
2615
|
-
sortable:
|
|
2616
|
-
isTree:
|
|
2617
|
-
isVertical:
|
|
2618
|
-
noWrap:
|
|
2619
|
-
className:
|
|
2620
|
-
itemClassName:
|
|
2621
|
-
buttonClassName:
|
|
2622
|
-
settingsClassName:
|
|
2623
|
-
onClickItem:
|
|
2624
|
-
onOrderChange:
|
|
2590
|
+
withPreview: PropTypes.bool,
|
|
2591
|
+
withPlaceholder: PropTypes.bool,
|
|
2592
|
+
withName: PropTypes.bool,
|
|
2593
|
+
settings: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
2594
|
+
sortable: PropTypes.bool,
|
|
2595
|
+
isTree: PropTypes.bool,
|
|
2596
|
+
isVertical: PropTypes.bool,
|
|
2597
|
+
noWrap: PropTypes.bool,
|
|
2598
|
+
className: PropTypes.string,
|
|
2599
|
+
itemClassName: PropTypes.string,
|
|
2600
|
+
buttonClassName: PropTypes.string,
|
|
2601
|
+
settingsClassName: PropTypes.string,
|
|
2602
|
+
onClickItem: PropTypes.func,
|
|
2603
|
+
onOrderChange: PropTypes.func
|
|
2625
2604
|
};
|
|
2626
2605
|
var defaultProps$7 = {
|
|
2627
2606
|
items: [],
|
|
@@ -2641,7 +2620,6 @@ var defaultProps$7 = {
|
|
|
2641
2620
|
onOrderChange: null
|
|
2642
2621
|
};
|
|
2643
2622
|
var ScreensMenu = function ScreensMenu(_ref) {
|
|
2644
|
-
var _ref8;
|
|
2645
2623
|
var items = _ref.items,
|
|
2646
2624
|
withPreview = _ref.withPreview,
|
|
2647
2625
|
withPlaceholder = _ref.withPlaceholder,
|
|
@@ -2658,7 +2636,6 @@ var ScreensMenu = function ScreensMenu(_ref) {
|
|
|
2658
2636
|
onClickItem = _ref.onClickItem,
|
|
2659
2637
|
onOrderChange = _ref.onOrderChange;
|
|
2660
2638
|
var itemsElements = !isTree ? items.map(function (_ref2, index) {
|
|
2661
|
-
var _ref3;
|
|
2662
2639
|
var _ref2$className = _ref2.className,
|
|
2663
2640
|
itemCustomClassName = _ref2$className === void 0 ? null : _ref2$className,
|
|
2664
2641
|
screen = _ref2.screen,
|
|
@@ -2668,14 +2645,14 @@ var ScreensMenu = function ScreensMenu(_ref) {
|
|
|
2668
2645
|
onClick = _ref2$onClick === void 0 ? null : _ref2$onClick,
|
|
2669
2646
|
active = _ref2.active,
|
|
2670
2647
|
href = _ref2.href,
|
|
2671
|
-
item =
|
|
2672
|
-
return /*#__PURE__*/
|
|
2648
|
+
item = _objectWithoutProperties(_ref2, _excluded$2);
|
|
2649
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
2673
2650
|
key: item.id,
|
|
2674
|
-
className:
|
|
2651
|
+
className: classNames([styles$5.item, _defineProperty(_defineProperty({}, itemClassName, itemClassName !== null), itemCustomClassName, itemCustomClassName !== null)]),
|
|
2675
2652
|
"data-screen-id": item.id
|
|
2676
|
-
}, /*#__PURE__*/
|
|
2653
|
+
}, /*#__PURE__*/React.createElement(ScreenWithPreview, {
|
|
2677
2654
|
index: index,
|
|
2678
|
-
screen: withPlaceholder ?
|
|
2655
|
+
screen: withPlaceholder ? _objectSpread(_objectSpread({}, screen), {}, {
|
|
2679
2656
|
type: type
|
|
2680
2657
|
}) : screen,
|
|
2681
2658
|
href: href,
|
|
@@ -2687,9 +2664,9 @@ var ScreensMenu = function ScreensMenu(_ref) {
|
|
|
2687
2664
|
withName: withName,
|
|
2688
2665
|
onClick: onClick,
|
|
2689
2666
|
onClickItem: onClickItem
|
|
2690
|
-
}), settings !== null ? /*#__PURE__*/
|
|
2691
|
-
className:
|
|
2692
|
-
},
|
|
2667
|
+
}), settings !== null ? /*#__PURE__*/React.createElement("div", {
|
|
2668
|
+
className: classNames([_defineProperty({}, settingsClassName, settingsClassName !== null), styles$5.settings, 'p-2'])
|
|
2669
|
+
}, isFunction(settings) ? settings(index) : settings) : null);
|
|
2693
2670
|
}) : [];
|
|
2694
2671
|
var sortableItems = React.useMemo(function () {
|
|
2695
2672
|
return isTree ? items.map(function (_ref5) {
|
|
@@ -2697,7 +2674,7 @@ var ScreensMenu = function ScreensMenu(_ref) {
|
|
|
2697
2674
|
_ref5$screen = _ref5.screen,
|
|
2698
2675
|
screen = _ref5$screen === void 0 ? {} : _ref5$screen,
|
|
2699
2676
|
href = _ref5.href,
|
|
2700
|
-
props =
|
|
2677
|
+
props = _objectWithoutProperties(_ref5, _excluded2);
|
|
2701
2678
|
var _screen$parentId = screen.parentId,
|
|
2702
2679
|
parentId = _screen$parentId === void 0 ? null : _screen$parentId,
|
|
2703
2680
|
_screen$group = screen.group,
|
|
@@ -2709,7 +2686,7 @@ var ScreensMenu = function ScreensMenu(_ref) {
|
|
|
2709
2686
|
id: id,
|
|
2710
2687
|
parentId: parentId,
|
|
2711
2688
|
collapsed: collapsed,
|
|
2712
|
-
value:
|
|
2689
|
+
value: _objectSpread({
|
|
2713
2690
|
id: id,
|
|
2714
2691
|
screen: screen,
|
|
2715
2692
|
href: href
|
|
@@ -2722,14 +2699,14 @@ var ScreensMenu = function ScreensMenu(_ref) {
|
|
|
2722
2699
|
};
|
|
2723
2700
|
});
|
|
2724
2701
|
}, [items, isTree, items.length]);
|
|
2725
|
-
return /*#__PURE__*/
|
|
2726
|
-
className:
|
|
2727
|
-
}, isTree && !sortable ? /*#__PURE__*/
|
|
2702
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2703
|
+
className: classNames([styles$5.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles$5.noWrap, noWrap), styles$5.isVertical, isVertical), styles$5.isTree, isTree), styles$5.withPlaceholder, withPlaceholder), className, className)])
|
|
2704
|
+
}, isTree && !sortable ? /*#__PURE__*/React.createElement(SortableTree, {
|
|
2728
2705
|
items: sortableItems,
|
|
2729
2706
|
component: ScreenWithPreview,
|
|
2730
2707
|
onClickItem: onClickItem,
|
|
2731
2708
|
onChange: onOrderChange
|
|
2732
|
-
}) : null, !isTree && sortable && items.length > 1 ? /*#__PURE__*/
|
|
2709
|
+
}) : null, !isTree && sortable && items.length > 1 ? /*#__PURE__*/React.createElement(reactSortablejs.ReactSortable, {
|
|
2733
2710
|
list: sortableItems,
|
|
2734
2711
|
setList: onOrderChange,
|
|
2735
2712
|
animation: 200,
|
|
@@ -2737,7 +2714,7 @@ var ScreensMenu = function ScreensMenu(_ref) {
|
|
|
2737
2714
|
delay: 2,
|
|
2738
2715
|
tag: "ul",
|
|
2739
2716
|
className: styles$5.items
|
|
2740
|
-
}, itemsElements) : null, !isTree && (!sortable || items.length < 1) ? /*#__PURE__*/
|
|
2717
|
+
}, itemsElements) : null, !isTree && (!sortable || items.length < 1) ? /*#__PURE__*/React.createElement("ul", {
|
|
2741
2718
|
className: styles$5.items
|
|
2742
2719
|
}, itemsElements) : null);
|
|
2743
2720
|
};
|
|
@@ -2748,9 +2725,9 @@ var styles$4 = {"container":"micromag-editor-menus-screen-types-container","row"
|
|
|
2748
2725
|
|
|
2749
2726
|
var propTypes$6 = {
|
|
2750
2727
|
screens: core.PropTypes.screenDefinitions,
|
|
2751
|
-
selectedTypes:
|
|
2752
|
-
className:
|
|
2753
|
-
onClickItem:
|
|
2728
|
+
selectedTypes: PropTypes.arrayOf(PropTypes.string),
|
|
2729
|
+
className: PropTypes.string,
|
|
2730
|
+
onClickItem: PropTypes.func
|
|
2754
2731
|
};
|
|
2755
2732
|
var defaultProps$6 = {
|
|
2756
2733
|
screens: null,
|
|
@@ -2806,40 +2783,40 @@ var ScreenTypes = function ScreenTypes(_ref) {
|
|
|
2806
2783
|
type: id,
|
|
2807
2784
|
screen: definition,
|
|
2808
2785
|
title: title,
|
|
2809
|
-
className:
|
|
2786
|
+
className: classNames(_defineProperty({
|
|
2810
2787
|
'bg-secondary': !selected,
|
|
2811
2788
|
'bg-primary': selected
|
|
2812
2789
|
}, styles$4.selected, selected))
|
|
2813
2790
|
};
|
|
2814
|
-
return groupIndex !== -1 ? [].concat(
|
|
2815
|
-
items: [].concat(
|
|
2816
|
-
})],
|
|
2791
|
+
return groupIndex !== -1 ? [].concat(_toConsumableArray(allGroups.slice(0, groupIndex)), [_objectSpread(_objectSpread({}, allGroups[groupIndex]), {}, {
|
|
2792
|
+
items: [].concat(_toConsumableArray(allGroups[groupIndex].items), [item])
|
|
2793
|
+
})], _toConsumableArray(allGroups.slice(groupIndex + 1))) : [].concat(_toConsumableArray(allGroups), [{
|
|
2817
2794
|
id: groupId,
|
|
2818
2795
|
name: utils.isMessage(label) ? intl.formatMessage(label) : groupName,
|
|
2819
2796
|
order: order,
|
|
2820
2797
|
items: [item]
|
|
2821
2798
|
}]);
|
|
2822
2799
|
}, []);
|
|
2823
|
-
return
|
|
2800
|
+
return orderBy(groupItems, ['order', 'name'], ['asc', 'asc']);
|
|
2824
2801
|
}, [finalDefinitions, selectedTypes]);
|
|
2825
|
-
return /*#__PURE__*/
|
|
2826
|
-
className:
|
|
2827
|
-
}, /*#__PURE__*/
|
|
2802
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2803
|
+
className: classNames([styles$4.container, _defineProperty({}, className, className)])
|
|
2804
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
2828
2805
|
className: styles$4.rows
|
|
2829
2806
|
}, groups.map(function (_ref6) {
|
|
2830
2807
|
var id = _ref6.id,
|
|
2831
2808
|
name = _ref6.name,
|
|
2832
2809
|
items = _ref6.items;
|
|
2833
|
-
return /*#__PURE__*/
|
|
2810
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2834
2811
|
key: "group-".concat(id),
|
|
2835
2812
|
className: styles$4.row
|
|
2836
|
-
}, /*#__PURE__*/
|
|
2813
|
+
}, /*#__PURE__*/React.createElement(components.Label, null, name), /*#__PURE__*/React.createElement("div", {
|
|
2837
2814
|
className: styles$4.layouts
|
|
2838
|
-
}, /*#__PURE__*/
|
|
2815
|
+
}, /*#__PURE__*/React.createElement(ScreensMenu, {
|
|
2839
2816
|
items: items,
|
|
2840
2817
|
withPlaceholder: true,
|
|
2841
2818
|
withName: true,
|
|
2842
|
-
itemClassName:
|
|
2819
|
+
itemClassName: classNames([styles$4.screen, 'border', 'rounded', {
|
|
2843
2820
|
'border-secondary': selectedTypes === null,
|
|
2844
2821
|
'border-dark': selectedTypes !== null,
|
|
2845
2822
|
'bg-secondary': selectedTypes === null,
|
|
@@ -2856,10 +2833,10 @@ ScreenTypes.defaultProps = defaultProps$6;
|
|
|
2856
2833
|
var styles$3 = {"container":"micromag-editor-modals-screen-types-container","selected":"micromag-editor-modals-screen-types-selected"};
|
|
2857
2834
|
|
|
2858
2835
|
var propTypes$5 = {
|
|
2859
|
-
selectedTypes:
|
|
2860
|
-
className:
|
|
2861
|
-
onRequestClose:
|
|
2862
|
-
onClickScreenType:
|
|
2836
|
+
selectedTypes: PropTypes.arrayOf(PropTypes.string),
|
|
2837
|
+
className: PropTypes.string,
|
|
2838
|
+
onRequestClose: PropTypes.func,
|
|
2839
|
+
onClickScreenType: PropTypes.func
|
|
2863
2840
|
};
|
|
2864
2841
|
var defaultProps$5 = {
|
|
2865
2842
|
selectedTypes: null,
|
|
@@ -2872,17 +2849,17 @@ var ScreenTypesModal = function ScreenTypesModal(_ref) {
|
|
|
2872
2849
|
className = _ref.className,
|
|
2873
2850
|
onRequestClose = _ref.onRequestClose,
|
|
2874
2851
|
onClickScreenType = _ref.onClickScreenType;
|
|
2875
|
-
return /*#__PURE__*/
|
|
2876
|
-
title: /*#__PURE__*/
|
|
2852
|
+
return /*#__PURE__*/React.createElement(components.Modal, null, /*#__PURE__*/React.createElement(components.ModalDialog, {
|
|
2853
|
+
title: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
2877
2854
|
id: "QBaiO0",
|
|
2878
2855
|
defaultMessage: [{
|
|
2879
2856
|
"type": 0,
|
|
2880
2857
|
"value": "Add a screen"
|
|
2881
2858
|
}]
|
|
2882
2859
|
}),
|
|
2883
|
-
className:
|
|
2860
|
+
className: classNames([styles$3.container, _defineProperty({}, className, className)]),
|
|
2884
2861
|
onClickClose: onRequestClose
|
|
2885
|
-
}, /*#__PURE__*/
|
|
2862
|
+
}, /*#__PURE__*/React.createElement(ScreenTypes, {
|
|
2886
2863
|
selectedTypes: selectedTypes,
|
|
2887
2864
|
className: styles$3.menu,
|
|
2888
2865
|
onClickItem: onClickScreenType
|
|
@@ -2895,15 +2872,15 @@ var styles$2 = {"container":"micromag-editor-screens-container","navbar":"microm
|
|
|
2895
2872
|
|
|
2896
2873
|
var _excluded$1 = ["id"];
|
|
2897
2874
|
var propTypes$4 = {
|
|
2898
|
-
value:
|
|
2899
|
-
isTheme:
|
|
2900
|
-
isVertical:
|
|
2901
|
-
isCreateOpened:
|
|
2902
|
-
isParsed:
|
|
2903
|
-
isTree:
|
|
2904
|
-
onClickScreen:
|
|
2905
|
-
onChange:
|
|
2906
|
-
className:
|
|
2875
|
+
value: PropTypes.oneOfType([core.PropTypes.story, core.PropTypes.theme]),
|
|
2876
|
+
isTheme: PropTypes.bool,
|
|
2877
|
+
isVertical: PropTypes.bool,
|
|
2878
|
+
isCreateOpened: PropTypes.bool,
|
|
2879
|
+
isParsed: PropTypes.bool,
|
|
2880
|
+
isTree: PropTypes.bool,
|
|
2881
|
+
onClickScreen: PropTypes.func,
|
|
2882
|
+
onChange: PropTypes.func,
|
|
2883
|
+
className: PropTypes.string
|
|
2907
2884
|
};
|
|
2908
2885
|
var defaultProps$4 = {
|
|
2909
2886
|
value: null,
|
|
@@ -2934,7 +2911,7 @@ var EditorScreens = function EditorScreens(_ref) {
|
|
|
2934
2911
|
_ref2$components = _ref2.components,
|
|
2935
2912
|
screens = _ref2$components === void 0 ? [] : _ref2$components;
|
|
2936
2913
|
var _useState = React.useState(isCreateOpened),
|
|
2937
|
-
_useState2 =
|
|
2914
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2938
2915
|
createModalOpened = _useState2[0],
|
|
2939
2916
|
setCreateModalOpened = _useState2[1];
|
|
2940
2917
|
var routes = contexts.useRoutes();
|
|
@@ -2951,7 +2928,7 @@ var EditorScreens = function EditorScreens(_ref) {
|
|
|
2951
2928
|
currentScreens = _ref3$components === void 0 ? [] : _ref3$components,
|
|
2952
2929
|
_ref3$theme = _ref3.theme,
|
|
2953
2930
|
theme = _ref3$theme === void 0 ? {} : _ref3$theme;
|
|
2954
|
-
var _ref4 =
|
|
2931
|
+
var _ref4 = isString(definition) ? {
|
|
2955
2932
|
id: definition
|
|
2956
2933
|
} : definition,
|
|
2957
2934
|
newScreenType = _ref4.id;
|
|
@@ -2967,8 +2944,8 @@ var EditorScreens = function EditorScreens(_ref) {
|
|
|
2967
2944
|
return id === currentScreenId;
|
|
2968
2945
|
});
|
|
2969
2946
|
var currentScreenIndex = !isTheme && foundIndex >= 0 ? foundIndex + 1 : null;
|
|
2970
|
-
var newValue =
|
|
2971
|
-
components: [].concat(
|
|
2947
|
+
var newValue = _objectSpread(_objectSpread({}, value), {}, {
|
|
2948
|
+
components: [].concat(_toConsumableArray(currentScreens.slice(0, currentScreenIndex)), [newScreen], _toConsumableArray(currentScreens.slice(currentScreenIndex)))
|
|
2972
2949
|
});
|
|
2973
2950
|
if (onChange !== null) {
|
|
2974
2951
|
onChange(newValue);
|
|
@@ -3005,8 +2982,8 @@ var EditorScreens = function EditorScreens(_ref) {
|
|
|
3005
2982
|
return same && id === currentIds[index];
|
|
3006
2983
|
}, true);
|
|
3007
2984
|
if (!sameOrder || hasScreenProps) {
|
|
3008
|
-
var newValue =
|
|
3009
|
-
components:
|
|
2985
|
+
var newValue = _objectSpread(_objectSpread({}, value), {}, {
|
|
2986
|
+
components: _toConsumableArray(currentScreens).sort(function (_ref13, _ref14) {
|
|
3010
2987
|
var idA = _ref13.id;
|
|
3011
2988
|
var idB = _ref14.id;
|
|
3012
2989
|
var indexA = ids.indexOf(idA);
|
|
@@ -3018,8 +2995,8 @@ var EditorScreens = function EditorScreens(_ref) {
|
|
|
3018
2995
|
}).map(function (_ref15) {
|
|
3019
2996
|
var _screenProps$find;
|
|
3020
2997
|
var id = _ref15.id,
|
|
3021
|
-
props =
|
|
3022
|
-
return
|
|
2998
|
+
props = _objectWithoutProperties(_ref15, _excluded$1);
|
|
2999
|
+
return _objectSpread(_objectSpread({
|
|
3023
3000
|
id: id
|
|
3024
3001
|
}, props), (_screenProps$find = screenProps.find(function (_ref16) {
|
|
3025
3002
|
var propsId = _ref16.id;
|
|
@@ -3053,36 +3030,36 @@ var EditorScreens = function EditorScreens(_ref) {
|
|
|
3053
3030
|
var onCreateModalRequestClose = React.useCallback(function () {
|
|
3054
3031
|
return setCreateModalOpened(false);
|
|
3055
3032
|
}, [setCreateModalOpened]);
|
|
3056
|
-
return /*#__PURE__*/
|
|
3057
|
-
className:
|
|
3058
|
-
}, /*#__PURE__*/
|
|
3033
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3034
|
+
className: classNames(['d-flex', 'flex-column', styles$2.container, className])
|
|
3035
|
+
}, /*#__PURE__*/React.createElement(components.Navbar, {
|
|
3059
3036
|
compact: true,
|
|
3060
3037
|
noWrap: true,
|
|
3061
3038
|
withoutCollapse: true,
|
|
3062
|
-
className:
|
|
3063
|
-
}, /*#__PURE__*/
|
|
3039
|
+
className: classNames(['sticky-top', styles$2.navbar])
|
|
3040
|
+
}, /*#__PURE__*/React.createElement("strong", {
|
|
3064
3041
|
className: "mb-0 me-auto"
|
|
3065
|
-
}, /*#__PURE__*/
|
|
3042
|
+
}, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
3066
3043
|
id: "jf+4Hq",
|
|
3067
3044
|
defaultMessage: [{
|
|
3068
3045
|
"type": 0,
|
|
3069
3046
|
"value": "Screens"
|
|
3070
3047
|
}]
|
|
3071
|
-
})), /*#__PURE__*/
|
|
3048
|
+
})), /*#__PURE__*/React.createElement(components.Button, {
|
|
3072
3049
|
theme: "primary",
|
|
3073
3050
|
size: "sm",
|
|
3074
3051
|
onClick: onClickAdd,
|
|
3075
|
-
icon: /*#__PURE__*/
|
|
3052
|
+
icon: /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
3076
3053
|
icon: faPlus.faPlus
|
|
3077
3054
|
})
|
|
3078
|
-
})), /*#__PURE__*/
|
|
3055
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3079
3056
|
className: "flex-grow-1 d-flex w-100 p-2"
|
|
3080
|
-
}, /*#__PURE__*/
|
|
3057
|
+
}, /*#__PURE__*/React.createElement(reactRouter.Route, {
|
|
3081
3058
|
path: [routes.screen, routes.home],
|
|
3082
3059
|
render: function render(_ref18) {
|
|
3083
3060
|
var _ref18$match$params$s = _ref18.match.params.screen,
|
|
3084
3061
|
screenId = _ref18$match$params$s === void 0 ? null : _ref18$match$params$s;
|
|
3085
|
-
return screens.length > 0 ? /*#__PURE__*/
|
|
3062
|
+
return screens.length > 0 ? /*#__PURE__*/React.createElement(ScreensMenu, {
|
|
3086
3063
|
items: screens.map(function (it) {
|
|
3087
3064
|
return {
|
|
3088
3065
|
id: it.id,
|
|
@@ -3100,12 +3077,12 @@ var EditorScreens = function EditorScreens(_ref) {
|
|
|
3100
3077
|
onClickItem: onClickScreen,
|
|
3101
3078
|
onOrderChange: onOrderChange,
|
|
3102
3079
|
isTree: isTree
|
|
3103
|
-
}) : /*#__PURE__*/
|
|
3080
|
+
}) : /*#__PURE__*/React.createElement(components.Empty, {
|
|
3104
3081
|
className: "flex-grow-1 p-2"
|
|
3105
|
-
}, /*#__PURE__*/
|
|
3082
|
+
}, /*#__PURE__*/React.createElement(components.Button, {
|
|
3106
3083
|
theme: "primary",
|
|
3107
3084
|
onClick: onClickAdd
|
|
3108
|
-
}, /*#__PURE__*/
|
|
3085
|
+
}, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
3109
3086
|
id: "JoWKee",
|
|
3110
3087
|
defaultMessage: [{
|
|
3111
3088
|
"type": 0,
|
|
@@ -3113,7 +3090,7 @@ var EditorScreens = function EditorScreens(_ref) {
|
|
|
3113
3090
|
}]
|
|
3114
3091
|
})));
|
|
3115
3092
|
}
|
|
3116
|
-
})), createModalOpened ? /*#__PURE__*/
|
|
3093
|
+
})), createModalOpened ? /*#__PURE__*/React.createElement(ScreenTypesModal, {
|
|
3117
3094
|
selectedTypes: isTheme ? screens.map(function (_ref19) {
|
|
3118
3095
|
var type = _ref19.type;
|
|
3119
3096
|
return type;
|
|
@@ -3128,15 +3105,15 @@ EditorScreens.defaultProps = defaultProps$4;
|
|
|
3128
3105
|
var styles$1 = {"container":"micromag-editor-container","left":"micromag-editor-left","right":"micromag-editor-right","fullscreen":"micromag-editor-fullscreen","preview":"micromag-editor-preview","center":"micromag-editor-center","inner":"micromag-editor-inner","visible":"micromag-editor-visible","screen-medium":"micromag-editor-screen-medium","top":"micromag-editor-top"};
|
|
3129
3106
|
|
|
3130
3107
|
var propTypes$3 = {
|
|
3131
|
-
value:
|
|
3108
|
+
value: PropTypes.oneOfType([core.PropTypes.story, core.PropTypes.theme]),
|
|
3132
3109
|
deviceScreens: core.PropTypes.deviceScreens,
|
|
3133
3110
|
viewerTheme: core.PropTypes.viewerTheme,
|
|
3134
|
-
mobileView:
|
|
3135
|
-
fullscreen:
|
|
3136
|
-
isTheme:
|
|
3137
|
-
isCreateOpened:
|
|
3138
|
-
onChange:
|
|
3139
|
-
className:
|
|
3111
|
+
mobileView: PropTypes.oneOf(['screens', 'preview', 'form']),
|
|
3112
|
+
fullscreen: PropTypes.bool,
|
|
3113
|
+
isTheme: PropTypes.bool,
|
|
3114
|
+
isCreateOpened: PropTypes.bool,
|
|
3115
|
+
onChange: PropTypes.func,
|
|
3116
|
+
className: PropTypes.string
|
|
3140
3117
|
};
|
|
3141
3118
|
var defaultProps$3 = {
|
|
3142
3119
|
value: null,
|
|
@@ -3150,7 +3127,6 @@ var defaultProps$3 = {
|
|
|
3150
3127
|
className: null
|
|
3151
3128
|
};
|
|
3152
3129
|
var Editor = function Editor(_ref) {
|
|
3153
|
-
var _ref5;
|
|
3154
3130
|
var value = _ref.value,
|
|
3155
3131
|
viewerTheme = _ref.viewerTheme,
|
|
3156
3132
|
isTheme = _ref.isTheme,
|
|
@@ -3179,7 +3155,7 @@ var Editor = function Editor(_ref) {
|
|
|
3179
3155
|
|
|
3180
3156
|
// Mobile view
|
|
3181
3157
|
var _useState = React.useState(initialMobileView),
|
|
3182
|
-
_useState2 =
|
|
3158
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
3183
3159
|
mobileView = _useState2[0],
|
|
3184
3160
|
setMobileView = _useState2[1];
|
|
3185
3161
|
var onClickScreens = React.useCallback(function () {
|
|
@@ -3202,7 +3178,7 @@ var Editor = function Editor(_ref) {
|
|
|
3202
3178
|
textStyles = _ref2$textStyles === void 0 ? null : _ref2$textStyles,
|
|
3203
3179
|
_ref2$boxStyles = _ref2.boxStyles,
|
|
3204
3180
|
boxStyles = _ref2$boxStyles === void 0 ? null : _ref2$boxStyles;
|
|
3205
|
-
var baseValue = isTheme ?
|
|
3181
|
+
var baseValue = isTheme ? _objectSpread(_objectSpread({}, value), {}, {
|
|
3206
3182
|
theme: {
|
|
3207
3183
|
background: background,
|
|
3208
3184
|
colors: colors,
|
|
@@ -3251,56 +3227,56 @@ var Editor = function Editor(_ref) {
|
|
|
3251
3227
|
screens.scrollTop = cnt.offsetTop + item.offsetTop + item.offsetHeight / 2 - screens.clientHeight / 2;
|
|
3252
3228
|
}
|
|
3253
3229
|
}, [screenId]);
|
|
3254
|
-
return /*#__PURE__*/
|
|
3230
|
+
return /*#__PURE__*/React.createElement(contexts.ModalsProvider, null, /*#__PURE__*/React.createElement(contexts.PanelsProvider, null, /*#__PURE__*/React.createElement(contexts.ScreenSizeProvider, {
|
|
3255
3231
|
size: screenSize
|
|
3256
|
-
}, /*#__PURE__*/
|
|
3257
|
-
className:
|
|
3232
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3233
|
+
className: classNames([styles$1.container, screenSize !== null ? screenSize.screens.map(function (screenName) {
|
|
3258
3234
|
return styles$1["screen-".concat(screenName)];
|
|
3259
|
-
}) : null, (
|
|
3235
|
+
}) : null, _defineProperty(_defineProperty({}, styles$1.fullscreen, fullscreen), className, className)]),
|
|
3260
3236
|
ref: refContainer
|
|
3261
|
-
}, /*#__PURE__*/
|
|
3237
|
+
}, /*#__PURE__*/React.createElement(components.Navbar, {
|
|
3262
3238
|
theme: "light",
|
|
3263
3239
|
compact: true,
|
|
3264
3240
|
noWrap: true,
|
|
3265
3241
|
withoutCollapse: true,
|
|
3266
3242
|
className: styles$1.top
|
|
3267
|
-
}, mobileView !== 'screens' ? /*#__PURE__*/
|
|
3243
|
+
}, mobileView !== 'screens' ? /*#__PURE__*/React.createElement(components.Button, {
|
|
3268
3244
|
size: "sm",
|
|
3269
3245
|
theme: "secondary",
|
|
3270
3246
|
onClick: onClickScreens,
|
|
3271
3247
|
className: "me-auto"
|
|
3272
|
-
}, /*#__PURE__*/
|
|
3248
|
+
}, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
3273
3249
|
id: "wkysUu",
|
|
3274
3250
|
defaultMessage: [{
|
|
3275
3251
|
"type": 0,
|
|
3276
3252
|
"value": "Screens"
|
|
3277
3253
|
}]
|
|
3278
|
-
})) : /*#__PURE__*/
|
|
3254
|
+
})) : /*#__PURE__*/React.createElement("span", null), mobileView !== 'form' ? /*#__PURE__*/React.createElement(components.Button, {
|
|
3279
3255
|
size: "sm",
|
|
3280
3256
|
theme: "primary",
|
|
3281
3257
|
onClick: onClickEdit
|
|
3282
|
-
}, /*#__PURE__*/
|
|
3258
|
+
}, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
3283
3259
|
id: "HseFdk",
|
|
3284
3260
|
defaultMessage: [{
|
|
3285
3261
|
"type": 0,
|
|
3286
3262
|
"value": "Edit"
|
|
3287
3263
|
}]
|
|
3288
|
-
})) : null, mobileView === 'form' ? /*#__PURE__*/
|
|
3264
|
+
})) : null, mobileView === 'form' ? /*#__PURE__*/React.createElement(components.Button, {
|
|
3289
3265
|
size: "sm",
|
|
3290
3266
|
theme: "primary",
|
|
3291
3267
|
onClick: onClickViewScreen
|
|
3292
|
-
}, /*#__PURE__*/
|
|
3268
|
+
}, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
3293
3269
|
id: "4POR3B",
|
|
3294
3270
|
defaultMessage: [{
|
|
3295
3271
|
"type": 0,
|
|
3296
3272
|
"value": "View screen"
|
|
3297
3273
|
}]
|
|
3298
|
-
})) : null), /*#__PURE__*/
|
|
3274
|
+
})) : null), /*#__PURE__*/React.createElement("div", {
|
|
3299
3275
|
className: styles$1.inner
|
|
3300
|
-
}, /*#__PURE__*/
|
|
3301
|
-
className:
|
|
3276
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3277
|
+
className: classNames([styles$1.left, _defineProperty({}, styles$1.visible, !isMobile || mobileView === 'screens')]),
|
|
3302
3278
|
ref: refScreensContainer
|
|
3303
|
-
}, /*#__PURE__*/
|
|
3279
|
+
}, /*#__PURE__*/React.createElement(EditorScreens, {
|
|
3304
3280
|
value: story,
|
|
3305
3281
|
isTheme: isTheme,
|
|
3306
3282
|
isCreateOpened: isCreateOpened,
|
|
@@ -3310,46 +3286,46 @@ var Editor = function Editor(_ref) {
|
|
|
3310
3286
|
isVertical: !isMobile,
|
|
3311
3287
|
className: styles$1.inner,
|
|
3312
3288
|
isTree: true
|
|
3313
|
-
})), /*#__PURE__*/
|
|
3314
|
-
className:
|
|
3315
|
-
}, /*#__PURE__*/
|
|
3289
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3290
|
+
className: classNames([styles$1.center, _defineProperty({}, styles$1.visible, !isMobile || mobileView === 'preview')])
|
|
3291
|
+
}, /*#__PURE__*/React.createElement(EditorPreview, {
|
|
3316
3292
|
value: story,
|
|
3317
3293
|
isTheme: isTheme,
|
|
3318
3294
|
viewerTheme: viewerTheme,
|
|
3319
3295
|
className: styles$1.preview,
|
|
3320
3296
|
onScreenChange: onPreviewScreenChange,
|
|
3321
3297
|
onChange: onStoryChange
|
|
3322
|
-
})), /*#__PURE__*/
|
|
3323
|
-
className:
|
|
3324
|
-
}, /*#__PURE__*/
|
|
3298
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3299
|
+
className: classNames([styles$1.right, _defineProperty({}, styles$1.visible, !isMobile || mobileView === 'form')])
|
|
3300
|
+
}, /*#__PURE__*/React.createElement(EditForm, {
|
|
3325
3301
|
key: screenId,
|
|
3326
3302
|
value: story,
|
|
3327
3303
|
isTheme: isTheme,
|
|
3328
3304
|
onChange: onStoryChange,
|
|
3329
3305
|
className: styles$1.inner
|
|
3330
|
-
}))), /*#__PURE__*/
|
|
3306
|
+
}))), /*#__PURE__*/React.createElement(components.Modals, null)))));
|
|
3331
3307
|
};
|
|
3332
3308
|
Editor.propTypes = propTypes$3;
|
|
3333
3309
|
Editor.defaultProps = defaultProps$3;
|
|
3334
3310
|
|
|
3335
3311
|
// eslint-disable-next-line import/prefer-default-export
|
|
3336
|
-
var routes =
|
|
3337
|
-
home:
|
|
3338
|
-
screen:
|
|
3339
|
-
'screen.field':
|
|
3340
|
-
'screen.field.form':
|
|
3312
|
+
var routes = PropTypes.shape({
|
|
3313
|
+
home: PropTypes.string.isRequired,
|
|
3314
|
+
screen: PropTypes.string.isRequired,
|
|
3315
|
+
'screen.field': PropTypes.string.isRequired,
|
|
3316
|
+
'screen.field.form': PropTypes.string.isRequired
|
|
3341
3317
|
});
|
|
3342
3318
|
|
|
3343
3319
|
var styles = {"container":"micromag-editor-forms-settings-container","inner":"micromag-editor-forms-settings-inner"};
|
|
3344
3320
|
|
|
3345
3321
|
var propTypes$2 = {
|
|
3346
|
-
name:
|
|
3322
|
+
name: PropTypes.string,
|
|
3347
3323
|
field: core.PropTypes.formField,
|
|
3348
3324
|
value: core.PropTypes.component,
|
|
3349
|
-
className:
|
|
3350
|
-
gotoFieldForm:
|
|
3351
|
-
closeFieldForm:
|
|
3352
|
-
onChange:
|
|
3325
|
+
className: PropTypes.string,
|
|
3326
|
+
gotoFieldForm: PropTypes.func.isRequired,
|
|
3327
|
+
closeFieldForm: PropTypes.func.isRequired,
|
|
3328
|
+
onChange: PropTypes.func
|
|
3353
3329
|
};
|
|
3354
3330
|
var defaultProps$2 = {
|
|
3355
3331
|
name: null,
|
|
@@ -3381,16 +3357,16 @@ var SettingsForm = function SettingsForm(_ref) {
|
|
|
3381
3357
|
var FieldsComponent = contexts.useFieldComponent('fields');
|
|
3382
3358
|
var SettingsComponent = FieldComponent !== null ? FieldComponent.settingsComponent || FieldsComponent : FieldsComponent;
|
|
3383
3359
|
var onSettingsChange = React.useCallback(function (newSettingsValue) {
|
|
3384
|
-
var newValue =
|
|
3360
|
+
var newValue = _objectSpread(_objectSpread({}, value), newSettingsValue);
|
|
3385
3361
|
if (onChange !== null) {
|
|
3386
3362
|
onChange(newValue);
|
|
3387
3363
|
}
|
|
3388
3364
|
}, [value, onChange]);
|
|
3389
|
-
return /*#__PURE__*/
|
|
3390
|
-
className:
|
|
3391
|
-
}, /*#__PURE__*/
|
|
3365
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3366
|
+
className: classNames([styles.container, _defineProperty({}, className, className)])
|
|
3367
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3392
3368
|
className: styles.inner
|
|
3393
|
-
}, /*#__PURE__*/
|
|
3369
|
+
}, /*#__PURE__*/React.createElement(SettingsComponent, {
|
|
3394
3370
|
name: name,
|
|
3395
3371
|
field: field,
|
|
3396
3372
|
fields: settings,
|
|
@@ -3413,13 +3389,13 @@ var FormsComponents = /*#__PURE__*/Object.freeze({
|
|
|
3413
3389
|
|
|
3414
3390
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
3415
3391
|
var propTypes$1 = {
|
|
3416
|
-
children:
|
|
3392
|
+
children: PropTypes.node
|
|
3417
3393
|
};
|
|
3418
3394
|
var defaultProps$1 = {
|
|
3419
3395
|
children: null
|
|
3420
3396
|
};
|
|
3421
3397
|
var FormsProvider = function FormsProvider(props) {
|
|
3422
|
-
return /*#__PURE__*/
|
|
3398
|
+
return /*#__PURE__*/React.createElement(contexts.ComponentsProvider, Object.assign({
|
|
3423
3399
|
namespace: contexts.FORMS_NAMESPACE,
|
|
3424
3400
|
components: FormsComponents
|
|
3425
3401
|
}, props));
|
|
@@ -3438,16 +3414,16 @@ var defaultRoutes = {
|
|
|
3438
3414
|
|
|
3439
3415
|
var _excluded = ["value", "memoryRouter", "routes", "basePath", "uppy", "googleApiKey", "googleMapsLibraries", "screenNamespaces"];
|
|
3440
3416
|
var propTypes = {
|
|
3441
|
-
value:
|
|
3417
|
+
value: PropTypes.oneOfType([core.PropTypes.story, core.PropTypes.theme]),
|
|
3442
3418
|
routes: routes,
|
|
3443
|
-
memoryRouter:
|
|
3444
|
-
basePath:
|
|
3445
|
-
uppy:
|
|
3446
|
-
transport:
|
|
3419
|
+
memoryRouter: PropTypes.bool,
|
|
3420
|
+
basePath: PropTypes.string,
|
|
3421
|
+
uppy: PropTypes.shape({
|
|
3422
|
+
transport: PropTypes.string
|
|
3447
3423
|
}),
|
|
3448
|
-
googleApiKey:
|
|
3449
|
-
googleMapsLibraries:
|
|
3450
|
-
screenNamespaces:
|
|
3424
|
+
googleApiKey: PropTypes.string,
|
|
3425
|
+
googleMapsLibraries: PropTypes.arrayOf(PropTypes.string),
|
|
3426
|
+
screenNamespaces: PropTypes.arrayOf(PropTypes.string)
|
|
3451
3427
|
};
|
|
3452
3428
|
var defaultProps = {
|
|
3453
3429
|
value: null,
|
|
@@ -3468,7 +3444,7 @@ var EditorContainer = function EditorContainer(_ref) {
|
|
|
3468
3444
|
googleApiKey = _ref.googleApiKey,
|
|
3469
3445
|
googleMapsLibraries = _ref.googleMapsLibraries,
|
|
3470
3446
|
screenNamespaces = _ref.screenNamespaces,
|
|
3471
|
-
props =
|
|
3447
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
3472
3448
|
var Router = memoryRouter ? reactRouter.MemoryRouter : reactRouterDom.BrowserRouter;
|
|
3473
3449
|
var _useIntl = reactIntl.useIntl(),
|
|
3474
3450
|
locale = _useIntl.locale;
|
|
@@ -3476,30 +3452,30 @@ var EditorContainer = function EditorContainer(_ref) {
|
|
|
3476
3452
|
// const { metadata } = value || {};
|
|
3477
3453
|
// const { language:finalLocale = locale } = metadata || {};
|
|
3478
3454
|
|
|
3479
|
-
return /*#__PURE__*/
|
|
3455
|
+
return /*#__PURE__*/React.createElement(Router, {
|
|
3480
3456
|
basename: !memoryRouter ? basePath : null
|
|
3481
|
-
}, /*#__PURE__*/
|
|
3457
|
+
}, /*#__PURE__*/React.createElement(contexts.UppyProvider, uppy, /*#__PURE__*/React.createElement(contexts.StoryProvider, {
|
|
3482
3458
|
story: value
|
|
3483
|
-
}, /*#__PURE__*/
|
|
3459
|
+
}, /*#__PURE__*/React.createElement(screens.ScreensProvider, {
|
|
3484
3460
|
filterNamespaces: true,
|
|
3485
3461
|
namespaces: screenNamespaces
|
|
3486
|
-
}, /*#__PURE__*/
|
|
3462
|
+
}, /*#__PURE__*/React.createElement(contexts.GoogleKeysProvider, {
|
|
3487
3463
|
apiKey: googleApiKey
|
|
3488
|
-
}, /*#__PURE__*/
|
|
3464
|
+
}, /*#__PURE__*/React.createElement(contexts.GoogleMapsClientProvider, {
|
|
3489
3465
|
locale: locale,
|
|
3490
3466
|
libraries: googleMapsLibraries
|
|
3491
|
-
}, /*#__PURE__*/
|
|
3467
|
+
}, /*#__PURE__*/React.createElement(contexts.FontsProvider, null, /*#__PURE__*/React.createElement(fields.FieldsProvider, null, /*#__PURE__*/React.createElement(FormsProvider, null, /*#__PURE__*/React.createElement(contexts.EditorProvider, null, /*#__PURE__*/React.createElement(contexts.VisitorProvider, {
|
|
3492
3468
|
visitor: "editor"
|
|
3493
|
-
}, /*#__PURE__*/
|
|
3469
|
+
}, /*#__PURE__*/React.createElement(contexts.ComponentsContext.Consumer, null, function (manager) {
|
|
3494
3470
|
var formComponents = manager.getComponents(contexts.FORMS_NAMESPACE);
|
|
3495
3471
|
var formRegEx = formComponents !== null ? Object.keys(formComponents).map(function (name) {
|
|
3496
3472
|
return utils.slug(name);
|
|
3497
3473
|
}).join('|') : null;
|
|
3498
|
-
return /*#__PURE__*/
|
|
3499
|
-
routes:
|
|
3474
|
+
return /*#__PURE__*/React.createElement(contexts.RoutesProvider, {
|
|
3475
|
+
routes: _objectSpread(_objectSpread({}, routes), {}, {
|
|
3500
3476
|
'screen.field.form': routes['screen.field.form'].replace(/:form$/, ":form(".concat(formRegEx, ")"))
|
|
3501
3477
|
})
|
|
3502
|
-
}, /*#__PURE__*/
|
|
3478
|
+
}, /*#__PURE__*/React.createElement(Editor, Object.assign({
|
|
3503
3479
|
value: value
|
|
3504
3480
|
}, props)));
|
|
3505
3481
|
}))))))))))));
|
|
@@ -3511,4 +3487,4 @@ exports.Editor = Editor;
|
|
|
3511
3487
|
exports.ScreenTypes = ScreenTypes;
|
|
3512
3488
|
exports.Screens = ScreensMenu;
|
|
3513
3489
|
exports.createScreen = createScreen;
|
|
3514
|
-
exports
|
|
3490
|
+
exports.default = EditorContainer;
|