@headless-adminapp/fluent 0.0.17-alpha.3 → 0.0.17-alpha.30
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/App/AppHeaderContianer.js +1 -1
- package/App/NavigationContainer.js +2 -2
- package/App/QuickActionItem.js +1 -1
- package/CommandBar/Button.d.ts +2 -1
- package/CommandBar/Button.js +2 -2
- package/CommandBar/Divider.d.ts +2 -1
- package/CommandBar/Divider.js +2 -2
- package/CommandBar/IconButton.d.ts +2 -1
- package/CommandBar/IconButton.js +2 -2
- package/CommandBar/Label.d.ts +2 -1
- package/CommandBar/Label.js +2 -2
- package/CommandBar/MenuButton.d.ts +2 -1
- package/CommandBar/MenuButton.js +3 -3
- package/CommandBar/MenuItem.js +6 -5
- package/CommandBar/MenuItems.js +3 -3
- package/CommandBar/MenuList.js +4 -3
- package/CommandBar/Wrapper.d.ts +2 -2
- package/CommandBar/Wrapper.js +2 -2
- package/CommandBar/index.d.ts +6 -6
- package/DataGrid/ActionCell.d.ts +1 -1
- package/DataGrid/ActionCell.js +8 -4
- package/DataGrid/CustomizeColumns/AddColumns.js +4 -5
- package/DataGrid/CustomizeColumns/ColumnItem.js +3 -1
- package/DataGrid/GridColumnHeader/FilterForm.js +3 -1
- package/DataGrid/GridColumnHeader/OperatorSelect.js +9 -2
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +8 -8
- package/DataGrid/GridHeaderDesktop.js +0 -1
- package/DataGrid/GridTableContainer.js +22 -23
- package/DataGrid/TableCell/TableCellCheckbox.js +4 -3
- package/DataGrid/TableCell/TableCellLink.js +4 -3
- package/DataGrid/TableCell/TableCellText.js +9 -4
- package/DataGrid/useTableColumns.d.ts +4 -1
- package/DataGrid/useTableColumns.js +184 -167
- package/DialogContainer/PromptDialog.d.ts +3 -2
- package/DialogContainer/PromptDialog.js +10 -6
- package/PageEntityForm/CommandContainer.js +9 -1
- package/PageEntityForm/FormTabRelated.js +1 -2
- package/PageEntityForm/PageEntityFormDesktopContainer.js +6 -6
- package/PageEntityForm/RecordSetNavigatorContainer.js +4 -7
- package/PageEntityForm/RelatedViewSelector.js +4 -2
- package/PageEntityForm/SectionContainer.js +18 -4
- package/PageEntityForm/StandardControl.d.ts +2 -2
- package/PageEntityForm/StandardControl.js +75 -112
- package/PageEntityForm/SubgridControl.js +1 -1
- package/componentStore.d.ts +2 -0
- package/componentStore.js +5 -0
- package/components/PageLogin.js +0 -1
- package/form/FormControl.js +1 -1
- package/form/controls/AttachmentControl.d.ts +17 -0
- package/form/controls/AttachmentControl.js +225 -0
- package/form/controls/AttachmentsControl.d.ts +6 -0
- package/form/controls/AttachmentsControl.js +45 -0
- package/form/controls/CurrencyControl.js +38 -6
- package/form/controls/DateControl.d.ts +1 -1
- package/form/controls/DateControl.js +7 -3
- package/form/controls/DateTimeControl.d.ts +1 -1
- package/form/controls/DateTimeControl.js +1 -1
- package/form/controls/EmailControl.d.ts +1 -1
- package/form/controls/EmailControl.js +1 -1
- package/form/controls/LookupControl.js +2 -2
- package/form/controls/MultiSelectControl.d.ts +1 -1
- package/form/controls/MultiSelectControl.js +1 -1
- package/form/controls/MultiSelectLookupControl.js +1 -1
- package/form/controls/NumberControl.js +1 -0
- package/form/controls/PasswordControl.d.ts +1 -1
- package/form/controls/PasswordControl.js +1 -1
- package/form/controls/RichTextControl.d.ts +5 -0
- package/form/controls/RichTextControl.js +33 -0
- package/form/controls/SelectControl.d.ts +1 -1
- package/form/controls/SelectControl.js +1 -1
- package/form/controls/SwitchControl.d.ts +1 -1
- package/form/controls/SwitchControl.js +4 -2
- package/form/controls/TelephoneControl.d.ts +1 -1
- package/form/controls/TelephoneControl.js +1 -1
- package/form/controls/TextAreaControl.d.ts +1 -1
- package/form/controls/TextAreaControl.js +1 -1
- package/form/controls/utils.d.ts +4 -0
- package/form/controls/utils.js +42 -0
- package/form/layout/FormSection/FormSection.js +1 -1
- package/form/layout/FormSection/FormSectionColumn.js +1 -1
- package/form/layout/FormSection/FormSectionLoading.js +1 -1
- package/form/layout/FormTab/FormTab.js +1 -0
- package/package.json +24 -3
- package/styles.css +100 -0
- package/types/index.d.ts +12 -0
- package/App/AppProvider.d.ts +0 -9
- package/App/AppProvider.js +0 -50
- package/DataGrid/getAttributeFormattedValue.d.ts +0 -16
- package/DataGrid/getAttributeFormattedValue.js +0 -92
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AttachmentControl = void 0;
|
|
13
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
15
|
+
const hooks_1 = require("@headless-adminapp/app/dialog/hooks");
|
|
16
|
+
const utils_1 = require("@headless-adminapp/core/utils");
|
|
17
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
18
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
function useAttachmentSelector({ fileService, fileServiceContext, location, onChange, }) {
|
|
21
|
+
const openErrorDialog = (0, hooks_1.useOpenErrorDialog)();
|
|
22
|
+
const { isPending, mutate: handleFile } = (0, react_query_1.useMutation)({
|
|
23
|
+
mutationFn: (file) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
if (location === 'local') {
|
|
25
|
+
return (0, utils_1.fileToObject)(file);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const url = yield fileService.uploadFile(file, {
|
|
29
|
+
context: fileServiceContext,
|
|
30
|
+
});
|
|
31
|
+
return (0, utils_1.urlToFileObject)(url);
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
onSuccess: (fileObject) => {
|
|
35
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(fileObject);
|
|
36
|
+
},
|
|
37
|
+
onError: (error) => {
|
|
38
|
+
console.error(error);
|
|
39
|
+
openErrorDialog({
|
|
40
|
+
title: 'Failed to upload file',
|
|
41
|
+
text: error.message,
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
const selectFile = (accept) => {
|
|
46
|
+
const input = document.createElement('input');
|
|
47
|
+
input.type = 'file';
|
|
48
|
+
if (accept) {
|
|
49
|
+
input.accept = accept;
|
|
50
|
+
}
|
|
51
|
+
input.onchange = (event) => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const files = event.target.files;
|
|
53
|
+
if (!(files === null || files === void 0 ? void 0 : files.length)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const file = files[0];
|
|
57
|
+
handleFile(file);
|
|
58
|
+
});
|
|
59
|
+
input.click();
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
isProcessing: isPending,
|
|
63
|
+
selectFile,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const AttachmentImageControl = ({ value, disabled, readOnly, onChange, fileService, fileServiceContext, location, }) => {
|
|
67
|
+
const { isProcessing, selectFile } = useAttachmentSelector({
|
|
68
|
+
fileService,
|
|
69
|
+
fileServiceContext,
|
|
70
|
+
location,
|
|
71
|
+
onChange,
|
|
72
|
+
});
|
|
73
|
+
if (!value) {
|
|
74
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', display: 'flex' }, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
75
|
+
width: 100,
|
|
76
|
+
height: 100,
|
|
77
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground2,
|
|
78
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
79
|
+
display: 'flex',
|
|
80
|
+
justifyContent: 'center',
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
color: react_components_1.tokens.colorNeutralForeground4,
|
|
83
|
+
cursor: 'pointer',
|
|
84
|
+
pointerEvents: disabled || readOnly || isProcessing ? 'none' : 'auto',
|
|
85
|
+
}, onClick: () => selectFile('image/*'), children: isProcessing ? (0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "small" }) : (0, jsx_runtime_1.jsx)(icons_1.Icons.Image, {}) }) }));
|
|
86
|
+
}
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', display: 'flex' }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
88
|
+
maxWidth: '100%',
|
|
89
|
+
height: 100,
|
|
90
|
+
position: 'relative',
|
|
91
|
+
}, children: [(0, jsx_runtime_1.jsx)("img", { src: value.url, style: {
|
|
92
|
+
maxHeight: '100%',
|
|
93
|
+
maxWidth: '100%',
|
|
94
|
+
objectFit: 'contain',
|
|
95
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
96
|
+
} }), (0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', top: 0, right: 0 }, children: (0, jsx_runtime_1.jsx)(ActionMenu, { format: 'image', value: value, disabled: disabled, readOnly: readOnly, onChange: onChange, onChangeClick: () => selectFile('image/*') }) }), isProcessing && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
97
|
+
position: 'absolute',
|
|
98
|
+
inset: 0,
|
|
99
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground1,
|
|
100
|
+
opacity: 0.7,
|
|
101
|
+
} }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
102
|
+
position: 'absolute',
|
|
103
|
+
inset: 0,
|
|
104
|
+
display: 'flex',
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
justifyContent: 'center',
|
|
107
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "small" }) })] }))] }) }));
|
|
108
|
+
};
|
|
109
|
+
const AttachmentControl = ({ value, disabled, readOnly, id, name, onBlur, onChange, placeholder, fileService, fileServiceContext, location, format, }) => {
|
|
110
|
+
const { isProcessing, selectFile } = useAttachmentSelector({
|
|
111
|
+
fileService,
|
|
112
|
+
fileServiceContext,
|
|
113
|
+
location,
|
|
114
|
+
onChange,
|
|
115
|
+
});
|
|
116
|
+
const accept = (0, react_1.useMemo)(() => {
|
|
117
|
+
switch (format) {
|
|
118
|
+
case 'image':
|
|
119
|
+
return 'image/*';
|
|
120
|
+
case 'video':
|
|
121
|
+
return 'video/*';
|
|
122
|
+
case 'audio':
|
|
123
|
+
return 'audio/*';
|
|
124
|
+
case 'document':
|
|
125
|
+
return '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv';
|
|
126
|
+
default:
|
|
127
|
+
return '';
|
|
128
|
+
}
|
|
129
|
+
}, [format]);
|
|
130
|
+
const FormatIcon = (0, react_1.useMemo)(() => {
|
|
131
|
+
switch (format) {
|
|
132
|
+
case 'video':
|
|
133
|
+
return icons_1.Icons.Video;
|
|
134
|
+
case 'audio':
|
|
135
|
+
return icons_1.Icons.Audio;
|
|
136
|
+
default:
|
|
137
|
+
return icons_1.Icons.Document;
|
|
138
|
+
}
|
|
139
|
+
}, [format]);
|
|
140
|
+
if (format === 'image') {
|
|
141
|
+
return ((0, jsx_runtime_1.jsx)(AttachmentImageControl, { value: value, disabled: disabled, readOnly: readOnly, id: id, name: name, onBlur: onBlur, onChange: onChange, placeholder: placeholder, fileService: fileService, fileServiceContext: fileServiceContext, location: location }));
|
|
142
|
+
}
|
|
143
|
+
if (!value) {
|
|
144
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', overflow: 'hidden' }, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
145
|
+
width: '100%',
|
|
146
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
147
|
+
width: '100%',
|
|
148
|
+
height: 30,
|
|
149
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
150
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground2,
|
|
151
|
+
display: 'flex',
|
|
152
|
+
paddingLeft: react_components_1.tokens.spacingHorizontalS,
|
|
153
|
+
gap: react_components_1.tokens.spacingHorizontalS,
|
|
154
|
+
alignItems: 'center',
|
|
155
|
+
overflow: 'hidden',
|
|
156
|
+
color: react_components_1.tokens.colorNeutralForeground4,
|
|
157
|
+
cursor: 'pointer',
|
|
158
|
+
pointerEvents: disabled || readOnly || isProcessing ? 'none' : 'auto',
|
|
159
|
+
}, onClick: () => selectFile(accept), children: [(0, jsx_runtime_1.jsx)(FormatIcon, { size: 16 }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: {
|
|
160
|
+
overflow: 'hidden',
|
|
161
|
+
textOverflow: 'ellipsis',
|
|
162
|
+
whiteSpace: 'nowrap',
|
|
163
|
+
flex: 1,
|
|
164
|
+
}, children: placeholder || 'Select a file' }), isProcessing && ((0, jsx_runtime_1.jsx)("div", { style: { paddingRight: react_components_1.tokens.spacingHorizontalS }, children: (0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny" }) }))] }) }) }));
|
|
165
|
+
}
|
|
166
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', overflow: 'hidden' }, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
167
|
+
width: '100%',
|
|
168
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
169
|
+
width: '100%',
|
|
170
|
+
height: 30,
|
|
171
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
172
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground2,
|
|
173
|
+
display: 'flex',
|
|
174
|
+
paddingLeft: react_components_1.tokens.spacingHorizontalS,
|
|
175
|
+
gap: react_components_1.tokens.spacingHorizontalS,
|
|
176
|
+
alignItems: 'center',
|
|
177
|
+
overflow: 'hidden',
|
|
178
|
+
}, children: [(0, jsx_runtime_1.jsx)(FormatIcon, { size: 16 }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: {
|
|
179
|
+
overflow: 'hidden',
|
|
180
|
+
textOverflow: 'ellipsis',
|
|
181
|
+
whiteSpace: 'nowrap',
|
|
182
|
+
flex: 1,
|
|
183
|
+
}, children: value.name || value.url }), isProcessing && ((0, jsx_runtime_1.jsx)("div", { style: { paddingRight: react_components_1.tokens.spacingHorizontalS }, children: (0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny" }) })), !isProcessing && ((0, jsx_runtime_1.jsx)(ActionMenu, { format: format, value: value, disabled: disabled, readOnly: readOnly, onChange: onChange, onChangeClick: () => selectFile(accept) }))] }) }) }));
|
|
184
|
+
};
|
|
185
|
+
exports.AttachmentControl = AttachmentControl;
|
|
186
|
+
const ActionMenu = ({ format, value, disabled, readOnly, onChange, onChangeClick, }) => {
|
|
187
|
+
const openConfirmDialog = (0, hooks_1.useOpenConfirmDialog)();
|
|
188
|
+
const FileOpenIcon = (0, react_1.useMemo)(() => {
|
|
189
|
+
switch (format) {
|
|
190
|
+
case 'video':
|
|
191
|
+
case 'audio':
|
|
192
|
+
return icons_1.Icons.Play;
|
|
193
|
+
default:
|
|
194
|
+
return icons_1.Icons.OpenInNew;
|
|
195
|
+
}
|
|
196
|
+
}, [format]);
|
|
197
|
+
const OpenText = (0, react_1.useMemo)(() => {
|
|
198
|
+
switch (format) {
|
|
199
|
+
case 'video':
|
|
200
|
+
return 'Play';
|
|
201
|
+
case 'audio':
|
|
202
|
+
return 'Play';
|
|
203
|
+
default:
|
|
204
|
+
return 'Open';
|
|
205
|
+
}
|
|
206
|
+
}, [format]);
|
|
207
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "before-top", hasIcons: true, children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.MoreVertical, {}) }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsxs)(react_components_1.MenuList, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(FileOpenIcon, {}), onClick: () => {
|
|
208
|
+
window.open(value.url, '_blank');
|
|
209
|
+
}, children: OpenText }), (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Copy, {}), onClick: () => {
|
|
210
|
+
navigator.clipboard.writeText(value.url).catch(() => { });
|
|
211
|
+
}, children: "Copy Url" }), !(disabled || readOnly) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Edit, {}), onClick: () => {
|
|
212
|
+
onChangeClick === null || onChangeClick === void 0 ? void 0 : onChangeClick();
|
|
213
|
+
}, children: "Change" }), (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, {}), (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Delete, {}), onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
214
|
+
const result = yield openConfirmDialog({
|
|
215
|
+
title: 'Remove file',
|
|
216
|
+
text: 'Are you sure you want to remove this file?',
|
|
217
|
+
confirmButtonLabel: 'Remove',
|
|
218
|
+
cancelButtonLabel: 'Cancel',
|
|
219
|
+
});
|
|
220
|
+
if (!(result === null || result === void 0 ? void 0 : result.confirmed)) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
224
|
+
}), children: "Remove" })] }))] }) })] }));
|
|
225
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FileObject } from '@headless-adminapp/core/attributes/AttachmentAttribute';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import { ControlProps } from './types';
|
|
4
|
+
export interface AttachmentsControlProps extends ControlProps<FileObject[]> {
|
|
5
|
+
}
|
|
6
|
+
export declare const AttachmentsControl: FC<AttachmentsControlProps>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AttachmentsControl = void 0;
|
|
13
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
15
|
+
const utils_1 = require("@headless-adminapp/core/utils");
|
|
16
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
17
|
+
const react_1 = require("react");
|
|
18
|
+
const AttachmentsControl = ({ onChange, id, onBlur, onFocus, disabled, readOnly, value, }) => {
|
|
19
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.TagPicker, { appearance: "filled-darker", disabled: disabled, open: false, children: [(0, jsx_runtime_1.jsx)(react_components_1.TagPickerControl, { onFocus: onFocus, onBlur: onBlur, id: id, style: { paddingBlock: react_components_1.tokens.spacingVerticalXXS }, expandIcon: null, children: (0, jsx_runtime_1.jsxs)(react_components_1.TagGroup, { style: {
|
|
21
|
+
flexWrap: 'wrap',
|
|
22
|
+
columnGap: react_components_1.tokens.spacingHorizontalXS,
|
|
23
|
+
gap: react_components_1.tokens.spacingHorizontalXS,
|
|
24
|
+
}, children: [value === null || value === void 0 ? void 0 : value.map((file, index) => ((0, jsx_runtime_1.jsx)(react_components_1.Tag, { as: "span", appearance: "brand", size: "small", shape: "rounded", dismissible: !disabled && !readOnly, dismissIcon: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', cursor: 'pointer' }, onClick: () => {
|
|
25
|
+
if (disabled || readOnly)
|
|
26
|
+
return;
|
|
27
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value === null || value === void 0 ? void 0 : value.filter((_, i) => i !== index));
|
|
28
|
+
}, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Close, { size: 16 }) }), children: (0, jsx_runtime_1.jsx)(react_components_1.Link, { href: file.url, target: "_blank", onClick: (event) => {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
event.stopPropagation();
|
|
31
|
+
window.open(file.url, '_blank');
|
|
32
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { overflow: 'hidden', textOverflow: 'ellipsis' }, children: file.name }) }) }, index))), !readOnly && !disabled && ((0, jsx_runtime_1.jsx)(react_components_1.Button, { size: "small", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, { size: 16 }), appearance: "outline", onClick: () => {
|
|
33
|
+
var _a;
|
|
34
|
+
if (readOnly)
|
|
35
|
+
return;
|
|
36
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
37
|
+
}, children: "Add" }))] }) }), (0, jsx_runtime_1.jsx)(react_components_1.TagPickerList, {})] }), (0, jsx_runtime_1.jsx)("input", { ref: inputRef, type: "file", multiple: true, style: { display: 'none' }, onChange: (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
const files = event.target.files;
|
|
39
|
+
if (files === null || files === void 0 ? void 0 : files.length) {
|
|
40
|
+
const fileObjects = yield Promise.all(Array.from(files).map((file) => (0, utils_1.fileToObject)(file)));
|
|
41
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([...(value !== null && value !== void 0 ? value : []), ...fileObjects]);
|
|
42
|
+
}
|
|
43
|
+
}) })] }));
|
|
44
|
+
};
|
|
45
|
+
exports.AttachmentsControl = AttachmentsControl;
|
|
@@ -3,17 +3,49 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CurrencyControl = CurrencyControl;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
7
|
+
const react_1 = require("react");
|
|
6
8
|
function CurrencyControl({ value, onChange, id, name, onBlur, onFocus,
|
|
7
9
|
// error,
|
|
8
10
|
disabled, placeholder, autoFocus,
|
|
9
11
|
// borderOnFocusOnly,
|
|
10
12
|
readOnly, }) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const symbol = (0, locale_1.useCurrencySymbol)();
|
|
14
|
+
const [internalValue, setInternalValue] = (0, react_1.useState)(value ? value.toString() : '');
|
|
15
|
+
const internalValueRef = (0, react_1.useRef)(internalValue);
|
|
16
|
+
internalValueRef.current = internalValue;
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
let _value = '';
|
|
19
|
+
if (typeof value === 'number') {
|
|
20
|
+
_value = value.toString();
|
|
21
|
+
}
|
|
22
|
+
if (!_value && internalValueRef.current === '-') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (internalValueRef.current !== _value) {
|
|
26
|
+
setInternalValue(_value);
|
|
27
|
+
}
|
|
28
|
+
}, [value]);
|
|
29
|
+
const handleChange = (e) => {
|
|
30
|
+
let value = e.target.value;
|
|
31
|
+
if (!value) {
|
|
32
|
+
setInternalValue('');
|
|
33
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
value = value.replace(',', '');
|
|
37
|
+
if (value === '-') {
|
|
38
|
+
setInternalValue('-');
|
|
39
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (isNaN(Number(value))) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
setInternalValue(value);
|
|
46
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(Number(value));
|
|
47
|
+
};
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { placeholder: placeholder, id: id, autoFocus: autoFocus, name: name, value: internalValue, onChange: handleChange, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), appearance: "filled-darker", onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), contentBefore: (0, jsx_runtime_1.jsx)("div", { children: symbol }), disabled: disabled, readOnly: readOnly, style: {
|
|
17
49
|
width: '100%',
|
|
18
50
|
} }));
|
|
19
51
|
}
|
|
@@ -3,4 +3,4 @@ export interface DateControlProps extends ControlProps<string> {
|
|
|
3
3
|
maxDate?: Date;
|
|
4
4
|
minDate?: Date;
|
|
5
5
|
}
|
|
6
|
-
export declare function DateControl({ value, onChange, id, name, onBlur, onFocus,
|
|
6
|
+
export declare function DateControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }: DateControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,14 +8,18 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const react_datepicker_compat_1 = require("@fluentui/react-datepicker-compat");
|
|
9
9
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
10
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
11
|
+
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
12
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
11
13
|
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
dayjs_1.default.extend(utc_1.default);
|
|
15
|
+
dayjs_1.default.extend(timezone_1.default);
|
|
16
|
+
function DateControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
|
|
17
|
+
const { dateFormats, timezone } = (0, locale_1.useLocale)();
|
|
14
18
|
const { datePickerStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
15
19
|
return ((0, jsx_runtime_1.jsx)(react_datepicker_compat_1.DatePicker, { id: id, name: name, onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), placeholder: placeholder, appearance: "filled-darker",
|
|
16
20
|
// size="sm"
|
|
17
21
|
// error={error}
|
|
18
22
|
// maxDate={maxDate}
|
|
19
23
|
// minDate={minDate}
|
|
20
|
-
disabled: disabled, readOnly: readOnly, formatDate: (date) =>
|
|
24
|
+
disabled: disabled, readOnly: readOnly, formatDate: (date) => date ? (0, dayjs_1.default)(date).tz(timezone).format(dateFormats.short) : '', value: value ? new Date(value) : null, onSelectDate: (date) => onChange === null || onChange === void 0 ? void 0 : onChange(date ? (0, dayjs_1.default)(date).tz(timezone).startOf('day').toISOString() : null), strings: datePickerStrings }));
|
|
21
25
|
}
|
|
@@ -3,4 +3,4 @@ export interface DateTimeControlProps extends ControlProps<string> {
|
|
|
3
3
|
maxDate?: Date;
|
|
4
4
|
minDate?: Date;
|
|
5
5
|
}
|
|
6
|
-
export declare function DateTimeControl({ value, onChange, id, name, onBlur, onFocus,
|
|
6
|
+
export declare function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }: DateTimeControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,7 +7,7 @@ exports.DateTimeControl = DateTimeControl;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_datepicker_compat_1 = require("@fluentui/react-datepicker-compat");
|
|
9
9
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
10
|
-
function DateTimeControl({ value, onChange, id, name, onBlur, onFocus,
|
|
10
|
+
function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
|
|
11
11
|
// const { shortDate: dateFormat } = useLocale();
|
|
12
12
|
// return (
|
|
13
13
|
// <TimePicker
|
|
@@ -3,4 +3,4 @@ export interface EmailControlProps extends ControlProps<string> {
|
|
|
3
3
|
autoComplete?: string;
|
|
4
4
|
textTransform?: 'capitalize' | 'uppercase' | 'lowercase' | 'none';
|
|
5
5
|
}
|
|
6
|
-
export declare function EmailControl({ value, onChange, id, name, onBlur, onFocus,
|
|
6
|
+
export declare function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, textTransform, readOnly, }: EmailControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ exports.EmailControl = EmailControl;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const icons_1 = require("@headless-adminapp/icons");
|
|
7
|
-
function EmailControl({ value, onChange, id, name, onBlur, onFocus,
|
|
7
|
+
function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, textTransform, readOnly, }) {
|
|
8
8
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "email", placeholder: placeholder, id: id, appearance: "filled-darker", name: name,
|
|
9
9
|
// size="sm"
|
|
10
10
|
value: value || '', onChange: (e) => {
|
|
@@ -111,12 +111,12 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: '100%' }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.Combobox, { name: name, appearance: "filled-darker", expandIcon: readOnly || disabled ? null : isLoading ? ((0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny" })) : ((0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 18 })), placeholder: placeholder, inputMode: "search", style: { width: '100%' }, autoComplete: "off", readOnly: readOnly || disabled,
|
|
114
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: '100%' }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.Combobox, { name: name, appearance: "filled-darker", expandIcon: readOnly || disabled ? null : isLoading ? ((0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny" })) : ((0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 18 })), placeholder: !value ? placeholder : '', inputMode: "search", style: { width: '100%' }, autoComplete: "off", readOnly: readOnly || disabled,
|
|
115
115
|
// disabled={disabled}
|
|
116
116
|
open: open && !value && !readOnly && !disabled, value: !value ? searchText : '', onOpenChange: (e, data) => setOpen(data.open), onChange: (e) => {
|
|
117
117
|
setSearchText(e.target.value);
|
|
118
118
|
}, onOptionSelect: (e, item) => {
|
|
119
|
-
const _item = data === null || data === void 0 ? void 0 : data.records.find((x) => String(x[schema.idAttribute]) === item.optionValue);
|
|
119
|
+
const _item = data === null || data === void 0 ? void 0 : data.records.find((x) => String(x[schema.idAttribute]) === String(item.optionValue));
|
|
120
120
|
handleChange(_item !== null && _item !== void 0 ? _item : null);
|
|
121
121
|
}, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [data === null || data === void 0 ? void 0 : data.records.map((item) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: item[schema.idAttribute], className: (0, react_components_1.mergeClasses)(styles.option), text: item[schema.primaryAttribute], children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view === null || view === void 0 ? void 0 : view.experience.card, record: item, schema: schema }) }, item[schema.idAttribute]))), !isLoading && !(data === null || data === void 0 ? void 0 : data.records.length) && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
122
122
|
paddingInline: react_components_1.tokens.spacingHorizontalL,
|
|
@@ -3,4 +3,4 @@ import { ControlProps } from './types';
|
|
|
3
3
|
export interface MultiSelectControlProps<T> extends ControlProps<T[]> {
|
|
4
4
|
options: Lookup<T>[];
|
|
5
5
|
}
|
|
6
|
-
export default function MultiSelectControl<T extends string | number>({ value, onChange, options, id, name, disabled,
|
|
6
|
+
export default function MultiSelectControl<T extends string | number>({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, }: MultiSelectControlProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ exports.default = MultiSelectControl;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
-
function MultiSelectControl({ value, onChange, options, id, name, disabled,
|
|
7
|
+
function MultiSelectControl({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, }) {
|
|
8
8
|
const transformedOptions = (0, react_1.useMemo)(() => options.map((x) => ({ label: x.label, value: String(x.value) })), [options]);
|
|
9
9
|
const handleChange = (value) => {
|
|
10
10
|
const selectedOptions = options.filter((x) => value.includes(String(x.value)));
|
|
@@ -135,7 +135,7 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
135
135
|
}, onChange: (e) => {
|
|
136
136
|
setSearchText(e.target.value);
|
|
137
137
|
}, onOptionSelect: (e, item) => {
|
|
138
|
-
const _item = data === null || data === void 0 ? void 0 : data.records.find((x) => String(x[schema.idAttribute]) === item.optionValue);
|
|
138
|
+
const _item = data === null || data === void 0 ? void 0 : data.records.find((x) => String(x[schema.idAttribute]) === String(item.optionValue));
|
|
139
139
|
if (!_item)
|
|
140
140
|
return;
|
|
141
141
|
handleAdd(_item);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NumberControl = NumberControl;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/* eslint-disable unused-imports/no-unused-vars */
|
|
5
6
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
7
|
function NumberControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }) {
|
|
7
8
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "number", placeholder: placeholder, id: id, appearance: "filled-darker", name: name,
|
|
@@ -3,4 +3,4 @@ import { ControlProps } from './types';
|
|
|
3
3
|
export interface PasswordControlProps extends ControlProps<string> {
|
|
4
4
|
appearance?: InputProps['appearance'];
|
|
5
5
|
}
|
|
6
|
-
export declare function PasswordControl({ value, onChange, id, name, onBlur, onFocus,
|
|
6
|
+
export declare function PasswordControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, appearance, }: PasswordControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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 icons_1 = require("@headless-adminapp/icons");
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
function PasswordControl({ value, onChange, id, name, onBlur, onFocus,
|
|
8
|
+
function PasswordControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, appearance = 'filled-darker', }) {
|
|
9
9
|
const [showPassword, setShowPassword] = (0, react_1.useState)(false);
|
|
10
10
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { placeholder: placeholder, id: id, name: name, appearance: appearance, type: showPassword ? 'text' : 'password', autoFocus: autoFocus, 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(),
|
|
11
11
|
// invalid={error}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.RichTextControl = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const react_1 = require("react");
|
|
29
|
+
const ReactQuill = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('react-quill'))));
|
|
30
|
+
const RichTextControl = ({ value, onChange, id, onBlur, onFocus, disabled, readOnly, }) => {
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(ReactQuill, { value: value !== null && value !== void 0 ? value : '', onChange: onChange, className: "hdlapp_rte", readOnly: disabled || readOnly, style: { maxHeight: '400px', minHeight: '200px' }, onFocus: onFocus, onBlur: onBlur, id: id }));
|
|
32
|
+
};
|
|
33
|
+
exports.RichTextControl = RichTextControl;
|
|
@@ -6,4 +6,4 @@ export interface Lookup<T = string> {
|
|
|
6
6
|
export interface SelectControlProps<T> extends ControlProps<T> {
|
|
7
7
|
options: Lookup<T>[];
|
|
8
8
|
}
|
|
9
|
-
export default function SelectControl<T extends string | number>({ value, onChange, options, id, name, disabled,
|
|
9
|
+
export default function SelectControl<T extends string | number>({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, }: SelectControlProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ exports.default = SelectControl;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
-
function SelectControl({ value, onChange, options, id, name, disabled,
|
|
7
|
+
function SelectControl({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, }) {
|
|
8
8
|
var _a;
|
|
9
9
|
const transformedOptions = (0, react_1.useMemo)(() => options.map((x) => ({ label: x.label, value: String(x.value) })), [options]);
|
|
10
10
|
const handleChange = (value) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ControlProps } from './types';
|
|
2
2
|
export interface SwitchControlProps extends ControlProps<boolean> {
|
|
3
3
|
}
|
|
4
|
-
export declare function SwitchControl({ value, onChange, id, name,
|
|
4
|
+
export declare function SwitchControl({ value, onChange, id, name, disabled, readOnly, onBlur, onFocus, }: SwitchControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SwitchControl = SwitchControl;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
function SwitchControl({ value, onChange, id, name, disabled, readOnly, onBlur, onFocus, }) {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Switch, { checked: value !== null && value !== void 0 ? value : false, onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.currentTarget.checked), id: id, name: name, disabled: disabled, readOnly: readOnly, onBlur: onBlur, onFocus: onFocus }));
|
|
6
8
|
}
|
|
@@ -2,4 +2,4 @@ import { ControlProps } from './types';
|
|
|
2
2
|
export interface TelephoneControlProps extends ControlProps<string> {
|
|
3
3
|
autoComplete?: string;
|
|
4
4
|
}
|
|
5
|
-
export declare function TelephoneControl({ value, onChange, id, name, onBlur, onFocus,
|
|
5
|
+
export declare function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, }: TelephoneControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ exports.TelephoneControl = TelephoneControl;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const icons_1 = require("@headless-adminapp/icons");
|
|
7
|
-
function TelephoneControl({ value, onChange, id, name, onBlur, onFocus,
|
|
7
|
+
function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, }) {
|
|
8
8
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "tel", 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
9
|
// invalid={error}
|
|
10
10
|
disabled: disabled, autoComplete: autoComplete, style: {
|
|
@@ -3,4 +3,4 @@ export interface TextAreaControlProps extends ControlProps<string> {
|
|
|
3
3
|
rows?: number;
|
|
4
4
|
textTransform?: 'capitalize' | 'uppercase' | 'lowercase' | 'none';
|
|
5
5
|
}
|
|
6
|
-
export declare function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus,
|
|
6
|
+
export declare function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, rows, textTransform, }: TextAreaControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TextAreaControl = TextAreaControl;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus,
|
|
6
|
+
function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, rows = 5, textTransform, }) {
|
|
7
7
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Textarea, { placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value || '', onChange: (e) => {
|
|
8
8
|
textTransform === 'uppercase'
|
|
9
9
|
? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toUpperCase())
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FileObject } from '@headless-adminapp/core/attributes/AttachmentAttribute';
|
|
2
|
+
export declare function fileToObject(file: File): Promise<FileObject>;
|
|
3
|
+
export declare function dataUrlToFile(dataUrl: string, name: string): File;
|
|
4
|
+
export declare function urlToFileObject(url: string, name?: string): FileObject;
|