@headless-adminapp/fluent 0.0.17-alpha.37 → 0.0.17-alpha.38
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/DataGrid/TableCell/TableCellLink.d.ts +1 -0
- package/DataGrid/TableCell/TableCellLink.js +5 -2
- package/DataGrid/useTableColumns.js +6 -0
- package/PageEntityForm/StandardControl.js +2 -1
- package/form/controls/UrlControl.d.ts +4 -0
- package/form/controls/UrlControl.js +16 -0
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const hooks_1 = require("@headless-adminapp/app/route/hooks");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
exports.TableCellLink = (0, react_1.memo)(({ value, href, onClick, width }) => {
|
|
8
|
+
exports.TableCellLink = (0, react_1.memo)(({ value, href, onClick, width, target }) => {
|
|
9
9
|
const router = (0, hooks_1.useRouter)();
|
|
10
10
|
return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { style: {
|
|
11
11
|
textOverflow: 'ellipsis',
|
|
@@ -16,7 +16,10 @@ exports.TableCellLink = (0, react_1.memo)(({ value, href, onClick, width }) => {
|
|
|
16
16
|
maxWidth: width,
|
|
17
17
|
display: 'flex',
|
|
18
18
|
alignItems: 'center',
|
|
19
|
-
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Link, { as: "a", href: href, onClick: (event) => {
|
|
19
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Link, { as: "a", href: href, target: target, onClick: (event) => {
|
|
20
|
+
if (target === '_blank') {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
20
23
|
if (event.metaKey || event.ctrlKey) {
|
|
21
24
|
return;
|
|
22
25
|
}
|
|
@@ -241,6 +241,12 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
|
|
|
241
241
|
recordSetSetter('', []);
|
|
242
242
|
router.push(path);
|
|
243
243
|
} }, column.id));
|
|
244
|
+
case 'attachment':
|
|
245
|
+
const url = value === null || value === void 0 ? void 0 : value.url;
|
|
246
|
+
if (!url) {
|
|
247
|
+
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: "", width: info.column.getSize() }, column.id));
|
|
248
|
+
}
|
|
249
|
+
return ((0, jsx_runtime_1.jsx)(TableCellLink_1.TableCellLink, { value: formattedValue, width: info.column.getSize(), href: url, target: "_blank" }, column.id));
|
|
244
250
|
}
|
|
245
251
|
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: formattedValue, width: info.column.getSize() }, column.id));
|
|
246
252
|
},
|
|
@@ -26,6 +26,7 @@ const SwitchControl_1 = require("../form/controls/SwitchControl");
|
|
|
26
26
|
const TelephoneControl_1 = require("../form/controls/TelephoneControl");
|
|
27
27
|
const TextAreaControl_1 = require("../form/controls/TextAreaControl");
|
|
28
28
|
const TextControl_1 = require("../form/controls/TextControl");
|
|
29
|
+
const UrlControl_1 = require("../form/controls/UrlControl");
|
|
29
30
|
const StandardControl = (props) => {
|
|
30
31
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
31
32
|
const { attribute, label: _label, isError,
|
|
@@ -74,7 +75,7 @@ const StandardControl = (props) => {
|
|
|
74
75
|
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
75
76
|
}
|
|
76
77
|
case 'url': {
|
|
77
|
-
const Control = (_e = componentStore_1.componentStore.getComponent('Form.UrlControl')) !== null && _e !== void 0 ? _e :
|
|
78
|
+
const Control = (_e = componentStore_1.componentStore.getComponent('Form.UrlControl')) !== null && _e !== void 0 ? _e : UrlControl_1.UrlControl;
|
|
78
79
|
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
79
80
|
}
|
|
80
81
|
case 'textarea': {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ControlProps } from './types';
|
|
2
|
+
export interface UrlControlProps extends ControlProps<string> {
|
|
3
|
+
}
|
|
4
|
+
export declare function UrlControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, }: UrlControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UrlControl = UrlControl;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
7
|
+
function UrlControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "url", placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value || '', onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
|
|
9
|
+
// invalid={error}
|
|
10
|
+
disabled: disabled, autoComplete: "off", style: {
|
|
11
|
+
width: '100%',
|
|
12
|
+
paddingRight: react_components_1.tokens.spacingHorizontalXS,
|
|
13
|
+
},
|
|
14
|
+
// size="sm"
|
|
15
|
+
contentAfter: !!value ? ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", size: "small", onClick: () => window.open(value, '_blank'), icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.OpenInNew, {}) })) : undefined }));
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "0.0.17-alpha.
|
|
3
|
+
"version": "0.0.17-alpha.38",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"uuid": "11.0.3",
|
|
49
49
|
"yup": "^1.4.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "cf5abc4c56618fcc873bd31e3a26a84a9509edfa"
|
|
52
52
|
}
|