@panneau/modal-resource-items 3.0.226 → 3.0.238

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.
Files changed (2) hide show
  1. package/es/index.js +10 -3
  2. package/package.json +7 -7
package/es/index.js CHANGED
@@ -1,20 +1,23 @@
1
1
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
+ import isObject from 'lodash/isObject';
3
4
  import PropTypes from 'prop-types';
4
5
  import React, { useMemo } from 'react';
5
6
  import { FormattedMessage } from 'react-intl';
7
+ import { usePanneauResource } from '@panneau/core/contexts';
6
8
  import { useQuery } from '@panneau/core/hooks';
7
9
  import { useResourceValues } from '@panneau/intl';
8
10
  import ResourceItemsList from '@panneau/list-resource-items';
9
11
  import Dialog from '@panneau/modal-dialog';
10
12
 
11
- var _excluded = ["id", "resource", "title", "query", "paginated", "onClose", "listProps", "className", "children"];
13
+ var _excluded = ["id", "resource", "title", "query", "paginated", "size", "onClose", "listProps", "className", "children"];
12
14
  var propTypes = {
13
15
  id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
14
16
  resource: PropTypes.string,
15
17
  title: PropTypes.string,
16
18
  query: PropTypes.shape(),
17
19
  paginated: PropTypes.bool,
20
+ size: PropTypes.string,
18
21
  onQueryChange: PropTypes.func,
19
22
  onQueryReset: PropTypes.func,
20
23
  onPageChange: PropTypes.func,
@@ -29,6 +32,7 @@ var defaultProps = {
29
32
  title: null,
30
33
  query: null,
31
34
  paginated: true,
35
+ size: 'xl',
32
36
  onQueryChange: PropTypes.func,
33
37
  onQueryReset: PropTypes.func,
34
38
  onPageChange: PropTypes.func,
@@ -39,15 +43,18 @@ var defaultProps = {
39
43
  };
40
44
  var ModalResourceItems = function ModalResourceItems(_ref) {
41
45
  var id = _ref.id,
42
- resource = _ref.resource,
46
+ providedResource = _ref.resource,
43
47
  title = _ref.title,
44
48
  initialQuery = _ref.query,
45
49
  paginated = _ref.paginated,
50
+ size = _ref.size,
46
51
  onClose = _ref.onClose,
47
52
  listProps = _ref.listProps,
48
53
  className = _ref.className,
49
54
  children = _ref.children,
50
55
  props = _objectWithoutProperties(_ref, _excluded);
56
+ var panneauResource = usePanneauResource(providedResource);
57
+ var resource = isObject(providedResource) ? providedResource : panneauResource;
51
58
  var resourceValues = useResourceValues(resource);
52
59
  var finalQuery = useMemo(function () {
53
60
  return _objectSpread({}, initialQuery);
@@ -73,7 +80,7 @@ var ModalResourceItems = function ModalResourceItems(_ref) {
73
80
  "value": "a_singular"
74
81
  }]
75
82
  }),
76
- size: "lg",
83
+ size: size,
77
84
  onClose: onClose,
78
85
  className: className
79
86
  }, /*#__PURE__*/React.createElement(ResourceItemsList, Object.assign({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/modal-resource-items",
3
- "version": "3.0.226",
3
+ "version": "3.0.238",
4
4
  "description": "Resource items modal",
5
5
  "keywords": [
6
6
  "javascript"
@@ -49,11 +49,11 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@babel/runtime": "^7.12.5",
52
- "@panneau/core": "^3.0.224",
53
- "@panneau/intl": "^3.0.225",
54
- "@panneau/list-resource-items": "^3.0.226",
55
- "@panneau/modal-dialog": "^3.0.226",
56
- "@panneau/themes": "^3.0.224",
52
+ "@panneau/core": "^3.0.228",
53
+ "@panneau/intl": "^3.0.228",
54
+ "@panneau/list-resource-items": "^3.0.238",
55
+ "@panneau/modal-dialog": "^3.0.228",
56
+ "@panneau/themes": "^3.0.228",
57
57
  "classnames": "^2.5.1",
58
58
  "lodash": "^4.17.21",
59
59
  "prop-types": "^15.7.2",
@@ -62,5 +62,5 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "9615a4d3021e9ad9b15be01e998dd6f366f8f705"
65
+ "gitHead": "ca3f04e57ed301659af58e6c178eea93852074a6"
66
66
  }