@micromag/fields 0.3.797 → 0.3.798
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/all.js +1 -1
- package/es/index.js +12 -4
- package/package.json +2 -2
package/es/all.js
CHANGED
|
@@ -1244,7 +1244,7 @@ var entriesWithVisual = _objectSpread(_objectSpread({}, entries), {}, {
|
|
|
1244
1244
|
var entry = {
|
|
1245
1245
|
id: 'entry',
|
|
1246
1246
|
component: 'field-with-form',
|
|
1247
|
-
labelPath: 'title.body',
|
|
1247
|
+
labelPath: ['title.body', 'description.body'],
|
|
1248
1248
|
fields: [{
|
|
1249
1249
|
name: 'title',
|
|
1250
1250
|
type: 'heading-element',
|
package/es/index.js
CHANGED
|
@@ -30,10 +30,10 @@ import isFunction from 'lodash/isFunction';
|
|
|
30
30
|
import { ReactSortable } from 'react-sortablejs';
|
|
31
31
|
import get from 'lodash/get';
|
|
32
32
|
import MediaGallery from '@micromag/media-gallery';
|
|
33
|
+
import isArray from 'lodash/isArray';
|
|
34
|
+
import isEmpty from 'lodash/isEmpty';
|
|
33
35
|
import isString from 'lodash/isString';
|
|
34
36
|
import Fuse from 'fuse.js';
|
|
35
|
-
import isEmpty from 'lodash/isEmpty';
|
|
36
|
-
import isArray from 'lodash/isArray';
|
|
37
37
|
import Slider from 'rc-slider';
|
|
38
38
|
import tinycolor from 'tinycolor2';
|
|
39
39
|
import { SketchPicker } from 'react-color';
|
|
@@ -1301,7 +1301,7 @@ var entriesWithVisual = _objectSpread(_objectSpread({}, entries), {}, {
|
|
|
1301
1301
|
var entry = {
|
|
1302
1302
|
id: 'entry',
|
|
1303
1303
|
component: 'field-with-form',
|
|
1304
|
-
labelPath: 'title.body',
|
|
1304
|
+
labelPath: ['title.body', 'description.body'],
|
|
1305
1305
|
fields: [{
|
|
1306
1306
|
name: 'title',
|
|
1307
1307
|
type: 'heading-element',
|
|
@@ -4253,6 +4253,14 @@ AnswersField.defaultProps = defaultProps$1o;
|
|
|
4253
4253
|
var styles$A = {"thumbnail":"micromag-fields-field-with-form-thumbnail","label":"micromag-fields-field-with-form-label","clearButton":"micromag-fields-field-with-form-clearButton"};
|
|
4254
4254
|
|
|
4255
4255
|
var _excluded$y = ["value", "isForm", "canClear", "noValueLabel", "label", "labelPath", "withTitleLabel", "thumbnail", "thumbnailPath", "isHorizontal", "className", "onChange", "closeForm", "children", "field"];
|
|
4256
|
+
function getItemLabel(item, labelPath, defaultValue) {
|
|
4257
|
+
return (isArray(labelPath) ? labelPath : [labelPath]).reduce(function (acc, path) {
|
|
4258
|
+
if (!isEmpty(acc)) {
|
|
4259
|
+
return acc;
|
|
4260
|
+
}
|
|
4261
|
+
return path !== null ? get(item, path, defaultValue) : defaultValue;
|
|
4262
|
+
}, defaultValue);
|
|
4263
|
+
}
|
|
4256
4264
|
var propTypes$1n = {
|
|
4257
4265
|
value: PropTypes.any,
|
|
4258
4266
|
// eslint-disable-line
|
|
@@ -4324,7 +4332,7 @@ var FieldWithForm = function FieldWithForm(_ref) {
|
|
|
4324
4332
|
onChange: onChange
|
|
4325
4333
|
}));
|
|
4326
4334
|
}
|
|
4327
|
-
var labelValue = label !== null ? label :
|
|
4335
|
+
var labelValue = label !== null ? label : getItemLabel(value, labelPath, null);
|
|
4328
4336
|
var labelElement = null;
|
|
4329
4337
|
var labelString = null;
|
|
4330
4338
|
if (labelValue !== null && isMessage(labelValue)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/fields",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.798",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"access": "public",
|
|
106
106
|
"registry": "https://registry.npmjs.org/"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "b37160d47945ff6e86db5abb772ce77033225169"
|
|
109
109
|
}
|