@panneau/field-resource-item 4.0.8 → 4.0.14
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/dist/index.d.ts +50 -0
- package/{es → dist}/index.js +6 -4
- package/package.json +25 -23
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { FormError, Message } from '@panneau/core';
|
|
3
|
+
|
|
4
|
+
interface Item {
|
|
5
|
+
id?: string | number | null;
|
|
6
|
+
type?: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
interface ResourceItemFieldProps {
|
|
10
|
+
name?: string | null;
|
|
11
|
+
value?: Item | null;
|
|
12
|
+
errors?: FormError[] | null;
|
|
13
|
+
resource?: string | null;
|
|
14
|
+
resourceType?: string | null;
|
|
15
|
+
paginated?: boolean;
|
|
16
|
+
query?: Record<string, unknown> | null;
|
|
17
|
+
requestQuery?: Record<string, unknown> | null;
|
|
18
|
+
page?: number | string | null;
|
|
19
|
+
count?: number | string | null;
|
|
20
|
+
options?: Record<string, unknown> | null;
|
|
21
|
+
searchParamName?: string;
|
|
22
|
+
getItemLabel?: ((item: Item, path: string | null) => string) | null;
|
|
23
|
+
getItemDescription?: ((item: Item, path: string | null) => string | null) | null;
|
|
24
|
+
getItemImage?: ((item: Item, path: string | null) => string | null) | null;
|
|
25
|
+
itemLabelPath?: string;
|
|
26
|
+
itemDescriptionPath?: string | null;
|
|
27
|
+
itemImagePath?: string;
|
|
28
|
+
itemLabelWithId?: boolean;
|
|
29
|
+
placeholder?: Message | string | null;
|
|
30
|
+
canCreate?: boolean;
|
|
31
|
+
canEdit?: boolean;
|
|
32
|
+
canFind?: boolean;
|
|
33
|
+
withoutModal?: boolean;
|
|
34
|
+
createButtonLabel?: Message | null;
|
|
35
|
+
editButtonLabel?: Message | null;
|
|
36
|
+
findButtonLabel?: Message | null;
|
|
37
|
+
multiple?: boolean;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
className?: string | null;
|
|
40
|
+
inputClassName?: string | null;
|
|
41
|
+
onChange?: ((value: Item | Item[] | null) => void) | null;
|
|
42
|
+
}
|
|
43
|
+
declare function ResourceItemField({ name, value, errors, resource: resourceId, resourceType, paginated, query: initialQuery, requestQuery: initialRequestQuery, page: initialPage, count: initialCount, options: initialOptions, searchParamName, getItemLabel: initialGetItemLabel, getItemDescription, getItemImage, itemLabelPath, itemDescriptionPath, itemImagePath, itemLabelWithId, placeholder, canCreate, canEdit, canFind, withoutModal, createButtonLabel, editButtonLabel, findButtonLabel, multiple, disabled, className, inputClassName, onChange, }: ResourceItemFieldProps): react_jsx_runtime.JSX.Element;
|
|
44
|
+
|
|
45
|
+
declare namespace _default {
|
|
46
|
+
let id: string;
|
|
47
|
+
let component: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { ResourceItemField as default, _default as definition };
|
package/{es → dist}/index.js
RENAMED
|
@@ -3,9 +3,9 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
3
3
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import isArray from 'lodash
|
|
7
|
-
import isEmpty from 'lodash
|
|
8
|
-
import uniqBy from 'lodash
|
|
6
|
+
import isArray from 'lodash/isArray';
|
|
7
|
+
import isEmpty from 'lodash/isEmpty';
|
|
8
|
+
import uniqBy from 'lodash/uniqBy';
|
|
9
9
|
import { useMemo, useState, useCallback, useEffect } from 'react';
|
|
10
10
|
import { useIntl, FormattedMessage } from 'react-intl';
|
|
11
11
|
import { usePanneauResource } from '@panneau/core/contexts';
|
|
@@ -35,6 +35,8 @@ function ResourceItemField(_ref) {
|
|
|
35
35
|
paginated = _ref$paginated === void 0 ? true : _ref$paginated,
|
|
36
36
|
_ref$query = _ref.query,
|
|
37
37
|
initialQuery = _ref$query === void 0 ? null : _ref$query,
|
|
38
|
+
_ref$requestQuery = _ref.requestQuery,
|
|
39
|
+
initialRequestQuery = _ref$requestQuery === void 0 ? null : _ref$requestQuery,
|
|
38
40
|
_ref$page = _ref.page,
|
|
39
41
|
initialPage = _ref$page === void 0 ? null : _ref$page,
|
|
40
42
|
_ref$count = _ref.count,
|
|
@@ -106,7 +108,7 @@ function ResourceItemField(_ref) {
|
|
|
106
108
|
setListOpen = _useState4[1];
|
|
107
109
|
|
|
108
110
|
// TODO: list state controls?
|
|
109
|
-
var _useState5 = useState(initialQuery),
|
|
111
|
+
var _useState5 = useState(initialQuery || initialRequestQuery || {}),
|
|
110
112
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
111
113
|
query = _useState6[0];
|
|
112
114
|
_useState6[1];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/field-resource-item",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.14",
|
|
4
4
|
"description": "An item mapping a resource",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -26,46 +26,48 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"type": "module",
|
|
29
|
-
"module": "
|
|
29
|
+
"module": "dist/index.js",
|
|
30
|
+
"types": "dist/index.d.ts",
|
|
30
31
|
"exports": {
|
|
31
|
-
".":
|
|
32
|
+
".": {
|
|
33
|
+
"default": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts"
|
|
35
|
+
}
|
|
32
36
|
},
|
|
33
37
|
"files": [
|
|
34
|
-
"
|
|
35
|
-
"es",
|
|
38
|
+
"dist",
|
|
36
39
|
"assets"
|
|
37
40
|
],
|
|
38
41
|
"scripts": {
|
|
39
42
|
"prepublishOnly": "npm run build",
|
|
40
|
-
"build": "../../scripts/prepare-package.sh"
|
|
43
|
+
"build": "../../scripts/prepare-package.sh --types"
|
|
41
44
|
},
|
|
42
45
|
"devDependencies": {
|
|
43
|
-
"react": "^
|
|
44
|
-
"react-dom": "^
|
|
46
|
+
"react": "^19.0.0",
|
|
47
|
+
"react-dom": "^19.0.0"
|
|
45
48
|
},
|
|
46
49
|
"peerDependencies": {
|
|
47
|
-
"react": "^
|
|
48
|
-
"react-dom": "^
|
|
50
|
+
"react": "^19.0.0",
|
|
51
|
+
"react-dom": "^19.0.0"
|
|
49
52
|
},
|
|
50
53
|
"dependencies": {
|
|
51
54
|
"@babel/runtime": "^7.12.5",
|
|
52
|
-
"@panneau/core": "^4.0.
|
|
53
|
-
"@panneau/data": "^4.0.
|
|
54
|
-
"@panneau/element-button": "^4.0.
|
|
55
|
-
"@panneau/element-resource-card": "^4.0.
|
|
56
|
-
"@panneau/element-select": "^4.0.
|
|
57
|
-
"@panneau/form-resource": "^4.0.
|
|
58
|
-
"@panneau/intl": "^4.0.
|
|
59
|
-
"@panneau/modal-dialog": "^4.0.
|
|
60
|
-
"@panneau/modal-resource-form": "^4.0.
|
|
61
|
-
"@panneau/modal-resource-items": "^4.0.
|
|
55
|
+
"@panneau/core": "^4.0.14",
|
|
56
|
+
"@panneau/data": "^4.0.14",
|
|
57
|
+
"@panneau/element-button": "^4.0.14",
|
|
58
|
+
"@panneau/element-resource-card": "^4.0.14",
|
|
59
|
+
"@panneau/element-select": "^4.0.14",
|
|
60
|
+
"@panneau/form-resource": "^4.0.14",
|
|
61
|
+
"@panneau/intl": "^4.0.14",
|
|
62
|
+
"@panneau/modal-dialog": "^4.0.14",
|
|
63
|
+
"@panneau/modal-resource-form": "^4.0.14",
|
|
64
|
+
"@panneau/modal-resource-items": "^4.0.14",
|
|
62
65
|
"classnames": "^2.5.1",
|
|
63
|
-
"lodash
|
|
64
|
-
"prop-types": "^15.7.2",
|
|
66
|
+
"lodash": "^4.17.21",
|
|
65
67
|
"react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0"
|
|
66
68
|
},
|
|
67
69
|
"publishConfig": {
|
|
68
70
|
"access": "public"
|
|
69
71
|
},
|
|
70
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "ce35c2ddb30a7be2efe951882d9826dca577f5d4"
|
|
71
73
|
}
|