@panneau/action-upload 3.0.191 → 3.0.193

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
@@ -2,6 +2,7 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
3
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
4
  import classNames from 'classnames';
5
+ import isArray from 'lodash/isArray';
5
6
  import PropTypes from 'prop-types';
6
7
  import React, { useState, useCallback, useMemo } from 'react';
7
8
  import { FormattedMessage } from 'react-intl';
@@ -84,14 +85,20 @@ var UploadAction = function UploadAction(_ref) {
84
85
  setShowModal(false);
85
86
  }, [setShowModal]);
86
87
  var ids = useMemo(function () {
87
- return (value || []).map(function () {
88
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
89
- _ref2$id = _ref2.id,
90
- id = _ref2$id === void 0 ? null : _ref2$id;
91
- return id;
92
- }).filter(function (id) {
93
- return id !== null;
94
- });
88
+ if (value == null) {
89
+ return null;
90
+ }
91
+ if (isArray(value)) {
92
+ return value.map(function () {
93
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
94
+ _ref2$id = _ref2.id,
95
+ id = _ref2$id === void 0 ? null : _ref2$id;
96
+ return id;
97
+ }).filter(function (id) {
98
+ return id !== null;
99
+ });
100
+ }
101
+ return value !== null ? [value === null || value === void 0 ? void 0 : value.id] : null;
95
102
  }, [value]);
96
103
  useMemo(function () {
97
104
  return (ids || []).map(function (id) {
package/lib/index.js CHANGED
@@ -6,6 +6,7 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
6
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
7
7
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
8
8
  var classNames = require('classnames');
9
+ var isArray = require('lodash/isArray');
9
10
  var PropTypes = require('prop-types');
10
11
  var React = require('react');
11
12
  var reactIntl = require('react-intl');
@@ -88,14 +89,20 @@ var UploadAction = function UploadAction(_ref) {
88
89
  setShowModal(false);
89
90
  }, [setShowModal]);
90
91
  var ids = React.useMemo(function () {
91
- return (value || []).map(function () {
92
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
93
- _ref2$id = _ref2.id,
94
- id = _ref2$id === void 0 ? null : _ref2$id;
95
- return id;
96
- }).filter(function (id) {
97
- return id !== null;
98
- });
92
+ if (value == null) {
93
+ return null;
94
+ }
95
+ if (isArray(value)) {
96
+ return value.map(function () {
97
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
98
+ _ref2$id = _ref2.id,
99
+ id = _ref2$id === void 0 ? null : _ref2$id;
100
+ return id;
101
+ }).filter(function (id) {
102
+ return id !== null;
103
+ });
104
+ }
105
+ return value !== null ? [value === null || value === void 0 ? void 0 : value.id] : null;
99
106
  }, [value]);
100
107
  React.useMemo(function () {
101
108
  return (ids || []).map(function (id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/action-upload",
3
- "version": "3.0.191",
3
+ "version": "3.0.193",
4
4
  "description": "Upload action",
5
5
  "keywords": [
6
6
  "javascript"
@@ -46,9 +46,9 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@babel/runtime": "^7.12.5",
49
- "@panneau/core": "^3.0.191",
50
- "@panneau/element-button": "^3.0.191",
51
- "@panneau/themes": "^3.0.191",
49
+ "@panneau/core": "^3.0.193",
50
+ "@panneau/element-button": "^3.0.193",
51
+ "@panneau/themes": "^3.0.193",
52
52
  "classnames": "^2.5.1",
53
53
  "prop-types": "^15.7.2",
54
54
  "react-intl": "^5.15.8||^6.0.0"
@@ -56,5 +56,5 @@
56
56
  "publishConfig": {
57
57
  "access": "public"
58
58
  },
59
- "gitHead": "5d7d1b6a0130502185ab1b079b18bb7bdda1e447"
59
+ "gitHead": "cd6f69216ddbee75b352f3bd1d39352ff3332848"
60
60
  }