@micromag/media-gallery 0.3.525 → 0.3.532

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 CHANGED
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
4
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
4
5
  import classNames from 'classnames';
5
6
  import isArray from 'lodash/isArray';
@@ -180,8 +181,9 @@ var defaultFields = [{
180
181
  component: 'select',
181
182
  requestUrl: '/api/medias/tags',
182
183
  optionLabelPath: 'name',
183
- optionValuePath: 'name',
184
- // Uses taggable
184
+ optionValuePath: 'id',
185
+ // Uses taggable so change the logic here
186
+ valueIsOption: true,
185
187
  multiple: true,
186
188
  paginated: false
187
189
  }]
@@ -377,7 +379,7 @@ function filters() {
377
379
  paginated: false
378
380
  }, {
379
381
  id: 'source',
380
- component: 'toggle',
382
+ component: 'radios',
381
383
  label: /*#__PURE__*/React.createElement(FormattedMessage, {
382
384
  id: "AX9qes",
383
385
  defaultMessage: [{
@@ -385,12 +387,32 @@ function filters() {
385
387
  "value": "This micromag"
386
388
  }]
387
389
  }),
388
- name: 'source'
390
+ name: 'source',
391
+ options: [{
392
+ label: /*#__PURE__*/React.createElement(FormattedMessage, {
393
+ id: "JCex1R",
394
+ defaultMessage: [{
395
+ "type": 0,
396
+ "value": "Tous les micromags"
397
+ }]
398
+ }),
399
+ value: 'all'
400
+ }, {
401
+ label: /*#__PURE__*/React.createElement(FormattedMessage, {
402
+ id: "hjgnYW",
403
+ defaultMessage: [{
404
+ "type": 0,
405
+ "value": "Ce micromag"
406
+ }]
407
+ }),
408
+ value: 'document-'
409
+ }]
389
410
  }];
390
411
  }
391
412
 
392
413
  var styles = {"container":"micromag-media-gallery-new-media-gallery-container","browser":"micromag-media-gallery-new-media-gallery-browser"};
393
414
 
415
+ var _excluded = ["value"];
394
416
  var propTypes = {
395
417
  value: PropTypes.shape({
396
418
  id: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
@@ -518,13 +540,25 @@ function MediaGallery(_ref) {
518
540
  return partialFilters.map(function (filter) {
519
541
  var _ref3 = filter || {},
520
542
  _ref3$id = _ref3.id,
521
- id = _ref3$id === void 0 ? null : _ref3$id;
543
+ id = _ref3$id === void 0 ? null : _ref3$id,
544
+ _ref3$options = _ref3.options,
545
+ options = _ref3$options === void 0 ? [] : _ref3$options;
522
546
  if (id === 'source') {
523
547
  if (storyId === null) {
524
548
  return null;
525
549
  }
526
550
  return _objectSpread(_objectSpread({}, filter), {}, {
527
- queryValue: "document-".concat(storyId)
551
+ options: (options || []).map(function () {
552
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
553
+ _ref4$value = _ref4.value,
554
+ optionValue = _ref4$value === void 0 ? null : _ref4$value,
555
+ props = _objectWithoutProperties(_ref4, _excluded);
556
+ return optionValue === 'document-' ? _objectSpread({
557
+ value: "document-".concat(storyId)
558
+ }, props) : _objectSpread({
559
+ value: optionValue
560
+ }, props);
561
+ })
528
562
  });
529
563
  }
530
564
  return filter;
package/lib/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
4
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
5
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
5
6
  var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
6
7
  var classNames = require('classnames');
7
8
  var isArray = require('lodash/isArray');
@@ -182,8 +183,9 @@ var defaultFields = [{
182
183
  component: 'select',
183
184
  requestUrl: '/api/medias/tags',
184
185
  optionLabelPath: 'name',
185
- optionValuePath: 'name',
186
- // Uses taggable
186
+ optionValuePath: 'id',
187
+ // Uses taggable so change the logic here
188
+ valueIsOption: true,
187
189
  multiple: true,
188
190
  paginated: false
189
191
  }]
@@ -417,7 +419,7 @@ function filters() {
417
419
  paginated: false
418
420
  }, {
419
421
  id: 'source',
420
- component: 'toggle',
422
+ component: 'radios',
421
423
  label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
422
424
  id: "AX9qes",
423
425
  defaultMessage: [{
@@ -425,12 +427,32 @@ function filters() {
425
427
  "value": "This micromag"
426
428
  }]
427
429
  }),
428
- name: 'source'
430
+ name: 'source',
431
+ options: [{
432
+ label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
433
+ id: "JCex1R",
434
+ defaultMessage: [{
435
+ "type": 0,
436
+ "value": "Tous les micromags"
437
+ }]
438
+ }),
439
+ value: 'all'
440
+ }, {
441
+ label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
442
+ id: "hjgnYW",
443
+ defaultMessage: [{
444
+ "type": 0,
445
+ "value": "Ce micromag"
446
+ }]
447
+ }),
448
+ value: 'document-'
449
+ }]
429
450
  }];
430
451
  }
431
452
 
432
453
  var styles = {"container":"micromag-media-gallery-new-media-gallery-container","browser":"micromag-media-gallery-new-media-gallery-browser"};
433
454
 
455
+ var _excluded = ["value"];
434
456
  var propTypes = {
435
457
  value: PropTypes.shape({
436
458
  id: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
@@ -558,13 +580,25 @@ function MediaGallery(_ref) {
558
580
  return partialFilters.map(function (filter) {
559
581
  var _ref3 = filter || {},
560
582
  _ref3$id = _ref3.id,
561
- id = _ref3$id === void 0 ? null : _ref3$id;
583
+ id = _ref3$id === void 0 ? null : _ref3$id,
584
+ _ref3$options = _ref3.options,
585
+ options = _ref3$options === void 0 ? [] : _ref3$options;
562
586
  if (id === 'source') {
563
587
  if (storyId === null) {
564
588
  return null;
565
589
  }
566
590
  return _objectSpread(_objectSpread({}, filter), {}, {
567
- queryValue: "document-".concat(storyId)
591
+ options: (options || []).map(function () {
592
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
593
+ _ref4$value = _ref4.value,
594
+ optionValue = _ref4$value === void 0 ? null : _ref4$value,
595
+ props = _objectWithoutProperties(_ref4, _excluded);
596
+ return optionValue === 'document-' ? _objectSpread({
597
+ value: "document-".concat(storyId)
598
+ }, props) : _objectSpread({
599
+ value: optionValue
600
+ }, props);
601
+ })
568
602
  });
569
603
  }
570
604
  return filter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/media-gallery",
3
- "version": "0.3.525",
3
+ "version": "0.3.532",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -72,8 +72,8 @@
72
72
  "@fortawesome/fontawesome-svg-core": "^6.5.2",
73
73
  "@fortawesome/free-solid-svg-icons": "^6.5.2",
74
74
  "@fortawesome/react-fontawesome": "^0.2.0",
75
- "@micromag/core": "^0.3.523",
76
- "@micromag/data": "^0.3.523",
75
+ "@micromag/core": "^0.3.531",
76
+ "@micromag/data": "^0.3.531",
77
77
  "@panneau/medias": "^3.0.163",
78
78
  "bootstrap": "^5.3.1",
79
79
  "classnames": "^2.2.6",
@@ -87,5 +87,5 @@
87
87
  "access": "public",
88
88
  "registry": "https://registry.npmjs.org/"
89
89
  },
90
- "gitHead": "dc256382137519b9be05b9c281c09b4b6a3972c5"
90
+ "gitHead": "5c4722607cb4d35b72568ceaa7988c1a03ecfa17"
91
91
  }