@panneau/action-duplicate 3.0.190 → 3.0.192

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
@@ -3,6 +3,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
3
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
4
  import { postJSON, getCSRFHeaders } from '@folklore/fetch';
5
5
  import classNames from 'classnames';
6
+ import isArray from 'lodash/isArray';
6
7
  import PropTypes from 'prop-types';
7
8
  import React, { useState, useMemo, useCallback } from 'react';
8
9
  import { FormattedMessage } from 'react-intl';
@@ -77,14 +78,20 @@ var DuplicateAction = function DuplicateAction(_ref) {
77
78
  error = _useState2[0],
78
79
  setError = _useState2[1];
79
80
  var ids = useMemo(function () {
80
- return (value || []).map(function () {
81
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
82
- _ref2$id = _ref2.id,
83
- id = _ref2$id === void 0 ? null : _ref2$id;
84
- return id;
85
- }).filter(function (id) {
86
- return id !== null;
87
- });
81
+ if (value == null) {
82
+ return null;
83
+ }
84
+ if (isArray(value)) {
85
+ return value.map(function () {
86
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
87
+ _ref2$id = _ref2.id,
88
+ id = _ref2$id === void 0 ? null : _ref2$id;
89
+ return id;
90
+ }).filter(function (id) {
91
+ return id !== null;
92
+ });
93
+ }
94
+ return value !== null ? [value === null || value === void 0 ? void 0 : value.id] : null;
88
95
  }, [value]);
89
96
  var idKeys = useMemo(function () {
90
97
  return (ids || []).map(function (id) {
package/lib/index.js CHANGED
@@ -7,6 +7,7 @@ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
7
7
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
8
8
  var fetch = require('@folklore/fetch');
9
9
  var classNames = require('classnames');
10
+ var isArray = require('lodash/isArray');
10
11
  var PropTypes = require('prop-types');
11
12
  var React = require('react');
12
13
  var reactIntl = require('react-intl');
@@ -81,14 +82,20 @@ var DuplicateAction = function DuplicateAction(_ref) {
81
82
  error = _useState2[0],
82
83
  setError = _useState2[1];
83
84
  var ids = React.useMemo(function () {
84
- return (value || []).map(function () {
85
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
86
- _ref2$id = _ref2.id,
87
- id = _ref2$id === void 0 ? null : _ref2$id;
88
- return id;
89
- }).filter(function (id) {
90
- return id !== null;
91
- });
85
+ if (value == null) {
86
+ return null;
87
+ }
88
+ if (isArray(value)) {
89
+ return value.map(function () {
90
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
91
+ _ref2$id = _ref2.id,
92
+ id = _ref2$id === void 0 ? null : _ref2$id;
93
+ return id;
94
+ }).filter(function (id) {
95
+ return id !== null;
96
+ });
97
+ }
98
+ return value !== null ? [value === null || value === void 0 ? void 0 : value.id] : null;
92
99
  }, [value]);
93
100
  var idKeys = React.useMemo(function () {
94
101
  return (ids || []).map(function (id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/action-duplicate",
3
- "version": "3.0.190",
3
+ "version": "3.0.192",
4
4
  "description": "Duplicate action",
5
5
  "keywords": [
6
6
  "javascript"
@@ -47,10 +47,10 @@
47
47
  "dependencies": {
48
48
  "@babel/runtime": "^7.12.5",
49
49
  "@folklore/fetch": "^0.1.17",
50
- "@panneau/core": "^3.0.190",
51
- "@panneau/element-button": "^3.0.190",
52
- "@panneau/modal-confirm": "^3.0.190",
53
- "@panneau/themes": "^3.0.190",
50
+ "@panneau/core": "^3.0.192",
51
+ "@panneau/element-button": "^3.0.192",
52
+ "@panneau/modal-confirm": "^3.0.192",
53
+ "@panneau/themes": "^3.0.192",
54
54
  "classnames": "^2.5.1",
55
55
  "prop-types": "^15.7.2",
56
56
  "react-intl": "^5.15.8||^6.0.0"
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "ec38fa9c18606a8d5566183b8acf659a894eca0d"
61
+ "gitHead": "fdea2ce9766bf695810d652ddd7db8d768ea5332"
62
62
  }