@panneau/display-link 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 +16 -0
- package/{es → dist}/index.js +11 -9
- package/package.json +17 -15
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface LinkProps {
|
|
4
|
+
item?: {
|
|
5
|
+
id: string | number;
|
|
6
|
+
} | null;
|
|
7
|
+
value?: string | null;
|
|
8
|
+
label?: string | null;
|
|
9
|
+
labelPath?: string | null;
|
|
10
|
+
external?: boolean;
|
|
11
|
+
target?: string | null;
|
|
12
|
+
placeholder?: ReactNode | null;
|
|
13
|
+
}
|
|
14
|
+
declare function Link({ item, label, labelPath, value, external, target, placeholder, }: LinkProps): any;
|
|
15
|
+
|
|
16
|
+
export { Link as default };
|
package/{es → dist}/index.js
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import get from 'lodash
|
|
2
|
-
import isString from 'lodash
|
|
1
|
+
import get from 'lodash/get';
|
|
2
|
+
import isString from 'lodash/isString';
|
|
3
3
|
import { FormattedMessage } from 'react-intl';
|
|
4
4
|
import { Link as Link$1 } from 'wouter';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -20,7 +20,7 @@ function Link(_ref) {
|
|
|
20
20
|
_ref$placeholder = _ref.placeholder,
|
|
21
21
|
placeholder = _ref$placeholder === void 0 ? null : _ref$placeholder;
|
|
22
22
|
var itemLabel = get(item, labelPath);
|
|
23
|
-
var
|
|
23
|
+
var finalLabel = itemLabel || label || placeholder || /*#__PURE__*/jsx(FormattedMessage, {
|
|
24
24
|
id: "e0xuLo",
|
|
25
25
|
defaultMessage: [{
|
|
26
26
|
"type": 0,
|
|
@@ -28,15 +28,17 @@ function Link(_ref) {
|
|
|
28
28
|
}]
|
|
29
29
|
});
|
|
30
30
|
var isExternal = value !== null && isString(value) ? value.indexOf('http') === 0 : false;
|
|
31
|
-
|
|
31
|
+
var link = value !== null ? /*#__PURE__*/jsx(Link$1, {
|
|
32
|
+
href: value,
|
|
33
|
+
children: finalLabel
|
|
34
|
+
}) : finalLabel;
|
|
35
|
+
var element = value !== null && (external || isExternal) ? /*#__PURE__*/jsx("a", {
|
|
32
36
|
href: value,
|
|
33
37
|
target: target || '_blank',
|
|
34
38
|
rel: "noopener noreferrer",
|
|
35
|
-
children:
|
|
36
|
-
}) :
|
|
37
|
-
|
|
38
|
-
children: finalValue
|
|
39
|
-
});
|
|
39
|
+
children: finalLabel
|
|
40
|
+
}) : link;
|
|
41
|
+
return value !== null ? element : null;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export { Link as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/display-link",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.14",
|
|
4
4
|
"description": "Link item value in list",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -26,38 +26,40 @@
|
|
|
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/themes": "^4.0.
|
|
54
|
-
"lodash
|
|
55
|
-
"prop-types": "^15.7.2",
|
|
55
|
+
"@panneau/core": "^4.0.14",
|
|
56
|
+
"@panneau/themes": "^4.0.14",
|
|
57
|
+
"lodash": "^4.17.21",
|
|
56
58
|
"react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0",
|
|
57
59
|
"wouter": "^3.1.2"
|
|
58
60
|
},
|
|
59
61
|
"publishConfig": {
|
|
60
62
|
"access": "public"
|
|
61
63
|
},
|
|
62
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "ce35c2ddb30a7be2efe951882d9826dca577f5d4"
|
|
63
65
|
}
|