@micromag/editor 0.3.70 → 0.3.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.js +26 -18
- package/lib/index.js +26 -18
- package/package.json +7 -7
package/es/index.js
CHANGED
|
@@ -309,7 +309,7 @@ var FieldWithContexts = function FieldWithContexts(_ref) {
|
|
|
309
309
|
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
310
310
|
|
|
311
311
|
// Get definitions
|
|
312
|
-
var definition = useScreenDefinition();
|
|
312
|
+
var definition = useScreenDefinition() || null;
|
|
313
313
|
var _definition$states = definition.states,
|
|
314
314
|
states = _definition$states === void 0 ? null : _definition$states;
|
|
315
315
|
var screenFields = getScreenFieldsWithStates(definition); // const [stateId = null] = name.split('.');
|
|
@@ -358,7 +358,8 @@ var FieldWithContexts = function FieldWithContexts(_ref) {
|
|
|
358
358
|
// }]
|
|
359
359
|
// : fields;
|
|
360
360
|
|
|
361
|
-
|
|
361
|
+
console.log('def', definition);
|
|
362
|
+
return definition !== null ? /*#__PURE__*/React.createElement("div", {
|
|
362
363
|
className: classNames({
|
|
363
364
|
'p-2': form === null
|
|
364
365
|
})
|
|
@@ -369,7 +370,7 @@ var FieldWithContexts = function FieldWithContexts(_ref) {
|
|
|
369
370
|
form: form
|
|
370
371
|
}, props)) : /*#__PURE__*/React.createElement(Fields, Object.assign({
|
|
371
372
|
fields: stateFields
|
|
372
|
-
}, props)));
|
|
373
|
+
}, props))) : null;
|
|
373
374
|
};
|
|
374
375
|
|
|
375
376
|
FieldWithContexts.propTypes = propTypes$n;
|
|
@@ -421,13 +422,13 @@ var ScreenForm = function ScreenForm(_ref) {
|
|
|
421
422
|
className: classNames([styles$g.container, _defineProperty({}, className, className)])
|
|
422
423
|
}, /*#__PURE__*/React.createElement("div", {
|
|
423
424
|
className: styles$g.inner
|
|
424
|
-
}, /*#__PURE__*/React.createElement(Fields, {
|
|
425
|
+
}, fields !== null ? /*#__PURE__*/React.createElement(Fields, {
|
|
425
426
|
fields: fields,
|
|
426
427
|
value: value,
|
|
427
428
|
onChange: onChange,
|
|
428
429
|
gotoFieldForm: gotoFieldForm,
|
|
429
430
|
closeFieldForm: closeFieldForm
|
|
430
|
-
})));
|
|
431
|
+
}) : null));
|
|
431
432
|
};
|
|
432
433
|
|
|
433
434
|
ScreenForm.propTypes = propTypes$m;
|
|
@@ -480,9 +481,13 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
480
481
|
|
|
481
482
|
var type = screens[screenIndex].type;
|
|
482
483
|
var definition = screensManager.getDefinition(type);
|
|
483
|
-
|
|
484
|
+
|
|
485
|
+
var _ref3 = definition || {},
|
|
486
|
+
_ref3$states = _ref3.states,
|
|
487
|
+
states = _ref3$states === void 0 ? null : _ref3$states;
|
|
488
|
+
|
|
484
489
|
return {
|
|
485
|
-
fields: [].concat(_toConsumableArray(getScreenFieldsWithStates(definition)), [getScreenExtraField(intl)]),
|
|
490
|
+
fields: definition !== null ? [].concat(_toConsumableArray(getScreenFieldsWithStates(definition)), [getScreenExtraField(intl)]) : null,
|
|
486
491
|
states: states
|
|
487
492
|
};
|
|
488
493
|
}, [screens, screenId, screensManager, intl]),
|
|
@@ -502,18 +507,18 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
502
507
|
_fieldPath$ = _fieldPath[0],
|
|
503
508
|
stateId = _fieldPath$ === void 0 ? null : _fieldPath$;
|
|
504
509
|
|
|
505
|
-
currentState = screenStates !== null ? screenStates.find(function (
|
|
506
|
-
var id =
|
|
510
|
+
currentState = screenStates !== null ? screenStates.find(function (_ref4) {
|
|
511
|
+
var id = _ref4.id;
|
|
507
512
|
return id === stateId;
|
|
508
513
|
}) || null : null;
|
|
509
514
|
var finalFieldPath = fieldPath;
|
|
510
515
|
|
|
511
516
|
if (currentState !== null) {
|
|
512
|
-
var
|
|
513
|
-
|
|
514
|
-
repeatable =
|
|
515
|
-
|
|
516
|
-
fieldName =
|
|
517
|
+
var _ref5 = currentState || {},
|
|
518
|
+
_ref5$repeatable = _ref5.repeatable,
|
|
519
|
+
repeatable = _ref5$repeatable === void 0 ? false : _ref5$repeatable,
|
|
520
|
+
_ref5$fieldName = _ref5.fieldName,
|
|
521
|
+
fieldName = _ref5$fieldName === void 0 ? null : _ref5$fieldName;
|
|
517
522
|
|
|
518
523
|
finalFieldPath = (repeatable || fieldName !== null) && fieldPath.length <= (repeatable ? 2 : 1) ? [fieldName || stateId].concat(_toConsumableArray(fieldPath.slice(1))) : fieldPath.slice(1);
|
|
519
524
|
}
|
|
@@ -576,9 +581,9 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
576
581
|
var fieldLabel = nextFields ? nextFields.breadcrumbLabel || nextFields.label : null;
|
|
577
582
|
var itemLabel = isMessage(fieldLabel) ? intl.formatMessage(fieldLabel) : fieldLabel;
|
|
578
583
|
|
|
579
|
-
var
|
|
580
|
-
|
|
581
|
-
parentItemLabel =
|
|
584
|
+
var _ref6 = parentItem || {},
|
|
585
|
+
_ref6$label = _ref6.label,
|
|
586
|
+
parentItemLabel = _ref6$label === void 0 ? null : _ref6$label;
|
|
582
587
|
|
|
583
588
|
var finalItemLabel = isListItems ? "".concat(itemLabel, " #").concat(parseInt(key, 10) + 1) : itemLabel || parentItemLabel;
|
|
584
589
|
var item = {
|
|
@@ -2901,7 +2906,10 @@ var ScreenTypes = function ScreenTypes(_ref) {
|
|
|
2901
2906
|
onClickItem = _ref.onClickItem;
|
|
2902
2907
|
var intl = useIntl();
|
|
2903
2908
|
var screensManager = useScreensManager();
|
|
2904
|
-
var
|
|
2909
|
+
var screenDefinitions = screens || screensManager.getDefinitions();
|
|
2910
|
+
var finalDefinitions = (screenDefinitions || []).filter(function (s) {
|
|
2911
|
+
return s !== null;
|
|
2912
|
+
});
|
|
2905
2913
|
var groups = useMemo(function () {
|
|
2906
2914
|
var groupItems = finalDefinitions.reduce(function (allGroups, definition) {
|
|
2907
2915
|
var id = definition.id,
|
package/lib/index.js
CHANGED
|
@@ -329,7 +329,7 @@ var FieldWithContexts = function FieldWithContexts(_ref) {
|
|
|
329
329
|
props = _objectWithoutProperties__default["default"](_ref, _excluded$8);
|
|
330
330
|
|
|
331
331
|
// Get definitions
|
|
332
|
-
var definition = contexts.useScreenDefinition();
|
|
332
|
+
var definition = contexts.useScreenDefinition() || null;
|
|
333
333
|
var _definition$states = definition.states,
|
|
334
334
|
states = _definition$states === void 0 ? null : _definition$states;
|
|
335
335
|
var screenFields = getScreenFieldsWithStates(definition); // const [stateId = null] = name.split('.');
|
|
@@ -378,7 +378,8 @@ var FieldWithContexts = function FieldWithContexts(_ref) {
|
|
|
378
378
|
// }]
|
|
379
379
|
// : fields;
|
|
380
380
|
|
|
381
|
-
|
|
381
|
+
console.log('def', definition);
|
|
382
|
+
return definition !== null ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
382
383
|
className: classNames__default["default"]({
|
|
383
384
|
'p-2': form === null
|
|
384
385
|
})
|
|
@@ -389,7 +390,7 @@ var FieldWithContexts = function FieldWithContexts(_ref) {
|
|
|
389
390
|
form: form
|
|
390
391
|
}, props)) : /*#__PURE__*/React__default["default"].createElement(fields.Fields, Object.assign({
|
|
391
392
|
fields: stateFields
|
|
392
|
-
}, props)));
|
|
393
|
+
}, props))) : null;
|
|
393
394
|
};
|
|
394
395
|
|
|
395
396
|
FieldWithContexts.propTypes = propTypes$n;
|
|
@@ -441,13 +442,13 @@ var ScreenForm = function ScreenForm(_ref) {
|
|
|
441
442
|
className: classNames__default["default"]([styles$g.container, _defineProperty__default["default"]({}, className, className)])
|
|
442
443
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
443
444
|
className: styles$g.inner
|
|
444
|
-
}, /*#__PURE__*/React__default["default"].createElement(fields.Fields, {
|
|
445
|
+
}, fields$1 !== null ? /*#__PURE__*/React__default["default"].createElement(fields.Fields, {
|
|
445
446
|
fields: fields$1,
|
|
446
447
|
value: value,
|
|
447
448
|
onChange: onChange,
|
|
448
449
|
gotoFieldForm: gotoFieldForm,
|
|
449
450
|
closeFieldForm: closeFieldForm
|
|
450
|
-
})));
|
|
451
|
+
}) : null));
|
|
451
452
|
};
|
|
452
453
|
|
|
453
454
|
ScreenForm.propTypes = propTypes$m;
|
|
@@ -500,9 +501,13 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
500
501
|
|
|
501
502
|
var type = screens[screenIndex].type;
|
|
502
503
|
var definition = screensManager.getDefinition(type);
|
|
503
|
-
|
|
504
|
+
|
|
505
|
+
var _ref3 = definition || {},
|
|
506
|
+
_ref3$states = _ref3.states,
|
|
507
|
+
states = _ref3$states === void 0 ? null : _ref3$states;
|
|
508
|
+
|
|
504
509
|
return {
|
|
505
|
-
fields: [].concat(_toConsumableArray__default["default"](getScreenFieldsWithStates(definition)), [utils.getScreenExtraField(intl)]),
|
|
510
|
+
fields: definition !== null ? [].concat(_toConsumableArray__default["default"](getScreenFieldsWithStates(definition)), [utils.getScreenExtraField(intl)]) : null,
|
|
506
511
|
states: states
|
|
507
512
|
};
|
|
508
513
|
}, [screens, screenId, screensManager, intl]),
|
|
@@ -522,18 +527,18 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
522
527
|
_fieldPath$ = _fieldPath[0],
|
|
523
528
|
stateId = _fieldPath$ === void 0 ? null : _fieldPath$;
|
|
524
529
|
|
|
525
|
-
currentState = screenStates !== null ? screenStates.find(function (
|
|
526
|
-
var id =
|
|
530
|
+
currentState = screenStates !== null ? screenStates.find(function (_ref4) {
|
|
531
|
+
var id = _ref4.id;
|
|
527
532
|
return id === stateId;
|
|
528
533
|
}) || null : null;
|
|
529
534
|
var finalFieldPath = fieldPath;
|
|
530
535
|
|
|
531
536
|
if (currentState !== null) {
|
|
532
|
-
var
|
|
533
|
-
|
|
534
|
-
repeatable =
|
|
535
|
-
|
|
536
|
-
fieldName =
|
|
537
|
+
var _ref5 = currentState || {},
|
|
538
|
+
_ref5$repeatable = _ref5.repeatable,
|
|
539
|
+
repeatable = _ref5$repeatable === void 0 ? false : _ref5$repeatable,
|
|
540
|
+
_ref5$fieldName = _ref5.fieldName,
|
|
541
|
+
fieldName = _ref5$fieldName === void 0 ? null : _ref5$fieldName;
|
|
537
542
|
|
|
538
543
|
finalFieldPath = (repeatable || fieldName !== null) && fieldPath.length <= (repeatable ? 2 : 1) ? [fieldName || stateId].concat(_toConsumableArray__default["default"](fieldPath.slice(1))) : fieldPath.slice(1);
|
|
539
544
|
}
|
|
@@ -596,9 +601,9 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
596
601
|
var fieldLabel = nextFields ? nextFields.breadcrumbLabel || nextFields.label : null;
|
|
597
602
|
var itemLabel = utils.isMessage(fieldLabel) ? intl.formatMessage(fieldLabel) : fieldLabel;
|
|
598
603
|
|
|
599
|
-
var
|
|
600
|
-
|
|
601
|
-
parentItemLabel =
|
|
604
|
+
var _ref6 = parentItem || {},
|
|
605
|
+
_ref6$label = _ref6.label,
|
|
606
|
+
parentItemLabel = _ref6$label === void 0 ? null : _ref6$label;
|
|
602
607
|
|
|
603
608
|
var finalItemLabel = isListItems ? "".concat(itemLabel, " #").concat(parseInt(key, 10) + 1) : itemLabel || parentItemLabel;
|
|
604
609
|
var item = {
|
|
@@ -2921,7 +2926,10 @@ var ScreenTypes = function ScreenTypes(_ref) {
|
|
|
2921
2926
|
onClickItem = _ref.onClickItem;
|
|
2922
2927
|
var intl = reactIntl.useIntl();
|
|
2923
2928
|
var screensManager = contexts.useScreensManager();
|
|
2924
|
-
var
|
|
2929
|
+
var screenDefinitions = screens || screensManager.getDefinitions();
|
|
2930
|
+
var finalDefinitions = (screenDefinitions || []).filter(function (s) {
|
|
2931
|
+
return s !== null;
|
|
2932
|
+
});
|
|
2925
2933
|
var groups = React.useMemo(function () {
|
|
2926
2934
|
var groupItems = finalDefinitions.reduce(function (allGroups, definition) {
|
|
2927
2935
|
var id = definition.id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/editor",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.71",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
63
63
|
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
64
64
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
65
|
-
"@micromag/core": "^0.3.
|
|
66
|
-
"@micromag/elements": "^0.3.
|
|
67
|
-
"@micromag/fields": "^0.3.
|
|
68
|
-
"@micromag/screens": "^0.3.
|
|
69
|
-
"@micromag/viewer": "^0.3.
|
|
65
|
+
"@micromag/core": "^0.3.71",
|
|
66
|
+
"@micromag/elements": "^0.3.71",
|
|
67
|
+
"@micromag/fields": "^0.3.71",
|
|
68
|
+
"@micromag/screens": "^0.3.71",
|
|
69
|
+
"@micromag/viewer": "^0.3.71",
|
|
70
70
|
"classnames": "^2.2.6",
|
|
71
71
|
"lodash": "^4.17.21",
|
|
72
72
|
"prop-types": "^15.7.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "50093d0adc731dfb58656015179c4ac0b1c6765f"
|
|
85
85
|
}
|