@headless-adminapp/fluent 0.0.17-alpha.50 → 0.0.17-alpha.53
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/App.js +7 -11
- package/App/AppHeaderContianer.js +38 -41
- package/App/AppLogo.js +8 -12
- package/App/AppStringContext.js +9 -13
- package/App/AppUI.js +11 -15
- package/App/LayoutProvider.js +11 -15
- package/App/NavigationContainer.js +27 -28
- package/App/QuickActionItem.js +5 -9
- package/App/index.js +1 -5
- package/App/utils.js +1 -4
- package/CommandBar/Button.js +14 -17
- package/CommandBar/Divider.js +6 -9
- package/CommandBar/IconButton.js +13 -16
- package/CommandBar/Label.js +8 -11
- package/CommandBar/MenuButton.js +17 -20
- package/CommandBar/MenuItem.js +15 -18
- package/CommandBar/MenuItems.js +10 -10
- package/CommandBar/MenuList.js +9 -12
- package/CommandBar/Wrapper.js +7 -10
- package/CommandBar/index.js +13 -15
- package/DataForm/SectionControl.js +4 -7
- package/DataGrid/ActionCell.js +11 -14
- package/DataGrid/CommandContainer.js +6 -10
- package/DataGrid/CustomizeColumns/AddColumns.js +34 -37
- package/DataGrid/CustomizeColumns/ColumnItem.js +19 -23
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +36 -42
- package/DataGrid/CustomizeColumns/index.js +1 -5
- package/DataGrid/FormSubgridCommandContainer.js +13 -17
- package/DataGrid/FormSubgridViewSelector.js +18 -22
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +14 -20
- package/DataGrid/GridColumnHeader/FilterForm.js +24 -28
- package/DataGrid/GridColumnHeader/OperatorSelect.js +13 -19
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +44 -40
- package/DataGrid/GridColumnHeader/index.js +1 -5
- package/DataGrid/GridColumnHeader/utils.js +12 -13
- package/DataGrid/GridHeaderContainer.js +4 -8
- package/DataGrid/GridHeaderDesktop.js +26 -30
- package/DataGrid/GridHeaderMobile.js +17 -21
- package/DataGrid/GridListContainer.js +39 -43
- package/DataGrid/GridPaginationContainer.js +12 -16
- package/DataGrid/GridTableContainer.js +75 -79
- package/DataGrid/TableCell/TableCellAction.js +11 -15
- package/DataGrid/TableCell/TableCellBase.d.ts +2 -2
- package/DataGrid/TableCell/TableCellBase.js +4 -8
- package/DataGrid/TableCell/TableCellCheckbox.js +7 -10
- package/DataGrid/TableCell/TableCellChoice.js +11 -14
- package/DataGrid/TableCell/TableCellLink.d.ts +1 -1
- package/DataGrid/TableCell/TableCellLink.js +13 -12
- package/DataGrid/TableCell/TableCellText.js +7 -10
- package/DataGrid/TableCell/index.js +4 -20
- package/DataGrid/index.js +4 -11
- package/DataGrid/types.js +1 -2
- package/DataGrid/useTableColumns.js +139 -90
- package/DataGrid/utils.js +1 -5
- package/DialogContainer/AlertDialog.js +5 -8
- package/DialogContainer/ConfirmDialog.js +6 -9
- package/DialogContainer/DialogContainer.js +14 -18
- package/DialogContainer/ErrorDialog.js +9 -12
- package/DialogContainer/PromptDialog.js +30 -57
- package/DialogContainer/index.js +1 -5
- package/Insights/CommandBarContainer.js +11 -14
- package/Insights/FilterBarContainer.js +17 -20
- package/Insights/Grid.js +9 -13
- package/Insights/InsightsContainer.js +19 -22
- package/Insights/WidgetChartContainer.js +30 -34
- package/Insights/WidgetDataGridContainer.js +32 -35
- package/Insights/WidgetTableContainer.js +25 -29
- package/Insights/WidgetTileContainer.js +12 -16
- package/Insights/WidgetTitleBar.js +9 -15
- package/Insights/Widgets.d.ts +2 -2
- package/Insights/Widgets.js +25 -28
- package/Insights/charts/AreaChart.js +12 -15
- package/Insights/charts/BarChart.d.ts +2 -2
- package/Insights/charts/BarChart.js +12 -16
- package/Insights/charts/ComposedChart.js +12 -15
- package/Insights/charts/CustomTooltipContent.js +9 -13
- package/Insights/charts/GaugeChart.js +3 -6
- package/Insights/charts/LineChart.d.ts +2 -2
- package/Insights/charts/LineChart.js +12 -15
- package/Insights/charts/OhlcChart.d.ts +2 -2
- package/Insights/charts/OhlcChart.js +56 -57
- package/Insights/charts/PieChart.d.ts +2 -2
- package/Insights/charts/PieChart.js +36 -34
- package/Insights/charts/RadarChart.d.ts +2 -2
- package/Insights/charts/RadarChart.js +30 -27
- package/Insights/charts/ScatterChart.d.ts +2 -2
- package/Insights/charts/ScatterChart.js +25 -27
- package/Insights/charts/constants.js +1 -4
- package/Insights/charts/formatters.d.ts +1 -1
- package/Insights/charts/formatters.js +17 -29
- package/Insights/charts/index.js +1 -2
- package/Insights/charts/renderers.js +25 -36
- package/Insights/hooks/useQueriesData.js +19 -25
- package/Insights/hooks/useWidgetDetail.js +13 -16
- package/OverflowCommandBar/OverflowCommandBar.js +12 -19
- package/OverflowCommandBar/OverflowMenu.js +17 -21
- package/OverflowCommandBar/OverflowMenuDivider.js +6 -10
- package/OverflowCommandBar/index.js +3 -9
- package/OverflowCommandBar/render.js +9 -15
- package/OverflowCommandBar/utils.js +1 -4
- package/PageBoard/BoardColumn.js +5 -8
- package/PageBoard/BoardColumnCard.js +12 -15
- package/PageBoard/BoardColumnUI.js +34 -38
- package/PageBoard/BoardingColumnCardLoading.js +10 -13
- package/PageBoard/Header.js +16 -20
- package/PageBoard/PageBoard.d.ts +1 -1
- package/PageBoard/PageBoard.js +26 -29
- package/PageBoard/index.js +1 -5
- package/PageEntityForm/CommandContainer.js +21 -25
- package/PageEntityForm/FormTabRelated.js +17 -20
- package/PageEntityForm/PageEntityForm.js +16 -20
- package/PageEntityForm/PageEntityFormDesktopContainer.js +68 -72
- package/PageEntityForm/PageEntityFormStringContext.js +5 -9
- package/PageEntityForm/ProcessFlow.js +21 -24
- package/PageEntityForm/RecordCard.js +38 -45
- package/PageEntityForm/RecordCardLoading.js +10 -13
- package/PageEntityForm/RecordSetNavigatorContainer.js +30 -34
- package/PageEntityForm/RelatedViewSelector.js +28 -31
- package/PageEntityForm/SectionContainer.js +25 -28
- package/PageEntityForm/StandardControl.d.ts +3 -3
- package/PageEntityForm/StandardControl.js +74 -81
- package/PageEntityForm/SubgridControl.js +20 -23
- package/PageEntityForm/index.js +1 -5
- package/PageEntityView/FormSubgridContainer.js +22 -26
- package/PageEntityView/PageEntityView.js +15 -19
- package/PageEntityView/PageEntityViewDesktopContainer.js +9 -13
- package/PageEntityView/PageEntityViewDesktopFrame.js +17 -21
- package/PageEntityView/PageEntityViewMobileContainer.js +9 -13
- package/PageEntityView/PageEntityViewStringContext.js +5 -9
- package/PageEntityView/index.js +1 -5
- package/PageInsights/PageInsights.js +9 -13
- package/PageInsights/index.js +1 -6
- package/ProgressIndicatorContainer/index.js +10 -14
- package/ToastNotificationContainer/index.js +14 -18
- package/componentStore.js +2 -5
- package/components/BodyLoading.js +7 -11
- package/components/DialogLogin.js +5 -8
- package/components/LoginForm.js +21 -47
- package/components/PageBroken.js +5 -8
- package/components/PageLoading.js +5 -8
- package/components/PageLogin.js +14 -17
- package/form/FormControl.js +39 -55
- package/form/FormControlLoading.js +4 -8
- package/form/controls/AttachmentControl.js +56 -60
- package/form/controls/AttachmentsControl.js +15 -19
- package/form/controls/CurrencyControl.js +10 -13
- package/form/controls/DateControl.js +18 -24
- package/form/controls/DateRangeControl.js +14 -20
- package/form/controls/DateTimeControl.js +39 -45
- package/form/controls/DecimalControl.js +8 -11
- package/form/controls/DurationControl.js +11 -15
- package/form/controls/EmailControl.js +7 -10
- package/form/controls/IntegerControl.js +4 -7
- package/form/controls/LookupControl.d.ts +1 -0
- package/form/controls/LookupControl.js +75 -38
- package/form/controls/MultiSelectControl.js +8 -11
- package/form/controls/MultiSelectLookupControl.js +40 -43
- package/form/controls/PasswordControl.js +8 -11
- package/form/controls/RichTextControl.js +5 -32
- package/form/controls/SelectControl.js +8 -11
- package/form/controls/SwitchControl.js +4 -7
- package/form/controls/TelephoneControl.js +7 -10
- package/form/controls/TextAreaControl.js +4 -7
- package/form/controls/TextControl.js +5 -8
- package/form/controls/UrlControl.js +7 -10
- package/form/controls/types.js +1 -2
- package/form/controls/useLookupData.js +14 -18
- package/form/layout/FormBody/FormBody.js +6 -10
- package/form/layout/FormBody/index.js +1 -17
- package/form/layout/FormSection/FormSection.js +18 -22
- package/form/layout/FormSection/FormSectionColumn.js +3 -7
- package/form/layout/FormSection/FormSectionLoading.js +1 -5
- package/form/layout/FormSection/index.js +1 -5
- package/form/layout/FormTab/FormTab.js +16 -20
- package/form/layout/FormTab/FormTabColumn.js +5 -9
- package/form/layout/FormTab/index.js +1 -5
- package/form/layout/TabContext.js +2 -5
- package/form/layout/index.js +3 -9
- package/form/types.js +1 -2
- package/package.json +3 -2
- package/types/index.js +1 -2
- package/utils/avatar.d.ts +2 -0
- package/utils/avatar.js +42 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,27 +7,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const react_query_1 = require("@tanstack/react-query");
|
|
19
|
-
const react_1 = require("react");
|
|
10
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Body1, Button, Menu, MenuDivider, MenuItem, MenuList, MenuPopover, MenuTrigger, Spinner, tokens, } from '@fluentui/react-components';
|
|
12
|
+
import { useOpenConfirmDialog, useOpenErrorDialog, } from '@headless-adminapp/app/dialog/hooks';
|
|
13
|
+
import { fileToObject, urlToFileObject } from '@headless-adminapp/core/utils';
|
|
14
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
15
|
+
import { useMutation } from '@tanstack/react-query';
|
|
16
|
+
import { useMemo } from 'react';
|
|
20
17
|
function useAttachmentSelector({ fileService, fileServiceContext, location, onChange, }) {
|
|
21
|
-
const openErrorDialog =
|
|
22
|
-
const { isPending, mutate: handleFile } =
|
|
18
|
+
const openErrorDialog = useOpenErrorDialog();
|
|
19
|
+
const { isPending, mutate: handleFile } = useMutation({
|
|
23
20
|
mutationFn: (file) => __awaiter(this, void 0, void 0, function* () {
|
|
24
21
|
if (location === 'local') {
|
|
25
|
-
return
|
|
22
|
+
return fileToObject(file);
|
|
26
23
|
}
|
|
27
24
|
else {
|
|
28
25
|
const url = yield fileService.uploadFile(file, {
|
|
29
26
|
context: fileServiceContext,
|
|
30
27
|
});
|
|
31
|
-
return
|
|
28
|
+
return urlToFileObject(url);
|
|
32
29
|
}
|
|
33
30
|
}),
|
|
34
31
|
onSuccess: (fileObject) => {
|
|
@@ -71,49 +68,49 @@ const AttachmentImageControl = ({ value, disabled, readOnly, onChange, fileServi
|
|
|
71
68
|
onChange,
|
|
72
69
|
});
|
|
73
70
|
if (!value) {
|
|
74
|
-
return ((
|
|
71
|
+
return (_jsx("div", { style: { position: 'relative', display: 'flex' }, children: _jsx("div", { style: {
|
|
75
72
|
width: 100,
|
|
76
73
|
height: 100,
|
|
77
|
-
backgroundColor:
|
|
78
|
-
borderRadius:
|
|
74
|
+
backgroundColor: tokens.colorNeutralBackground2,
|
|
75
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
79
76
|
display: 'flex',
|
|
80
77
|
justifyContent: 'center',
|
|
81
78
|
alignItems: 'center',
|
|
82
|
-
color:
|
|
79
|
+
color: tokens.colorNeutralForeground4,
|
|
83
80
|
cursor: 'pointer',
|
|
84
81
|
pointerEvents: disabled || readOnly || isProcessing ? 'none' : 'auto',
|
|
85
|
-
}, onClick: () => selectFile('image/*'), children: isProcessing ? (
|
|
82
|
+
}, onClick: () => selectFile('image/*'), children: isProcessing ? _jsx(Spinner, { size: "small" }) : _jsx(Icons.Image, {}) }) }));
|
|
86
83
|
}
|
|
87
|
-
return ((
|
|
84
|
+
return (_jsx("div", { style: { position: 'relative', display: 'flex' }, children: _jsxs("div", { style: {
|
|
88
85
|
maxWidth: '100%',
|
|
89
86
|
height: 100,
|
|
90
87
|
position: 'relative',
|
|
91
|
-
}, children: [(
|
|
88
|
+
}, children: [_jsx("img", { src: value.url, style: {
|
|
92
89
|
maxHeight: '100%',
|
|
93
90
|
maxWidth: '100%',
|
|
94
91
|
objectFit: 'contain',
|
|
95
|
-
borderRadius:
|
|
96
|
-
} }), (
|
|
92
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
93
|
+
} }), _jsx("div", { style: { position: 'absolute', top: 0, right: 0 }, children: _jsx(ActionMenu, { format: 'image', value: value, disabled: disabled, readOnly: readOnly, onChange: onChange, onChangeClick: () => selectFile('image/*') }) }), isProcessing && (_jsxs(_Fragment, { children: [_jsx("div", { style: {
|
|
97
94
|
position: 'absolute',
|
|
98
95
|
inset: 0,
|
|
99
|
-
backgroundColor:
|
|
96
|
+
backgroundColor: tokens.colorNeutralBackground1,
|
|
100
97
|
opacity: 0.7,
|
|
101
|
-
} }), (
|
|
98
|
+
} }), _jsx("div", { style: {
|
|
102
99
|
position: 'absolute',
|
|
103
100
|
inset: 0,
|
|
104
101
|
display: 'flex',
|
|
105
102
|
alignItems: 'center',
|
|
106
103
|
justifyContent: 'center',
|
|
107
|
-
}, children: (
|
|
104
|
+
}, children: _jsx(Spinner, { size: "small" }) })] }))] }) }));
|
|
108
105
|
};
|
|
109
|
-
const AttachmentControl = ({ value, disabled, readOnly, id, name, onBlur, onChange, placeholder, fileService, fileServiceContext, location, format, }) => {
|
|
106
|
+
export const AttachmentControl = ({ value, disabled, readOnly, id, name, onBlur, onChange, placeholder, fileService, fileServiceContext, location, format, }) => {
|
|
110
107
|
const { isProcessing, selectFile } = useAttachmentSelector({
|
|
111
108
|
fileService,
|
|
112
109
|
fileServiceContext,
|
|
113
110
|
location,
|
|
114
111
|
onChange,
|
|
115
112
|
});
|
|
116
|
-
const accept =
|
|
113
|
+
const accept = useMemo(() => {
|
|
117
114
|
switch (format) {
|
|
118
115
|
case 'image':
|
|
119
116
|
return 'image/*';
|
|
@@ -127,74 +124,73 @@ const AttachmentControl = ({ value, disabled, readOnly, id, name, onBlur, onChan
|
|
|
127
124
|
return '';
|
|
128
125
|
}
|
|
129
126
|
}, [format]);
|
|
130
|
-
const FormatIcon =
|
|
127
|
+
const FormatIcon = useMemo(() => {
|
|
131
128
|
switch (format) {
|
|
132
129
|
case 'video':
|
|
133
|
-
return
|
|
130
|
+
return Icons.Video;
|
|
134
131
|
case 'audio':
|
|
135
|
-
return
|
|
132
|
+
return Icons.Audio;
|
|
136
133
|
default:
|
|
137
|
-
return
|
|
134
|
+
return Icons.Document;
|
|
138
135
|
}
|
|
139
136
|
}, [format]);
|
|
140
137
|
if (format === 'image') {
|
|
141
|
-
return ((
|
|
138
|
+
return (_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
139
|
}
|
|
143
140
|
if (!value) {
|
|
144
|
-
return ((
|
|
141
|
+
return (_jsx("div", { style: { position: 'relative', overflow: 'hidden' }, children: _jsx("div", { style: {
|
|
145
142
|
width: '100%',
|
|
146
|
-
}, children: (
|
|
143
|
+
}, children: _jsxs("div", { style: {
|
|
147
144
|
width: '100%',
|
|
148
145
|
height: 30,
|
|
149
|
-
borderRadius:
|
|
150
|
-
backgroundColor:
|
|
146
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
147
|
+
backgroundColor: tokens.colorNeutralBackground2,
|
|
151
148
|
display: 'flex',
|
|
152
|
-
paddingLeft:
|
|
153
|
-
gap:
|
|
149
|
+
paddingLeft: tokens.spacingHorizontalS,
|
|
150
|
+
gap: tokens.spacingHorizontalS,
|
|
154
151
|
alignItems: 'center',
|
|
155
152
|
overflow: 'hidden',
|
|
156
|
-
color:
|
|
153
|
+
color: tokens.colorNeutralForeground4,
|
|
157
154
|
cursor: 'pointer',
|
|
158
155
|
pointerEvents: disabled || readOnly || isProcessing ? 'none' : 'auto',
|
|
159
|
-
}, onClick: () => selectFile(accept), children: [(
|
|
156
|
+
}, onClick: () => selectFile(accept), children: [_jsx(FormatIcon, { size: 16 }), _jsx(Body1, { style: {
|
|
160
157
|
overflow: 'hidden',
|
|
161
158
|
textOverflow: 'ellipsis',
|
|
162
159
|
whiteSpace: 'nowrap',
|
|
163
160
|
flex: 1,
|
|
164
|
-
}, children: placeholder || 'Select a file' }), isProcessing && ((
|
|
161
|
+
}, children: placeholder || 'Select a file' }), isProcessing && (_jsx("div", { style: { paddingRight: tokens.spacingHorizontalS }, children: _jsx(Spinner, { size: "extra-tiny" }) }))] }) }) }));
|
|
165
162
|
}
|
|
166
|
-
return ((
|
|
163
|
+
return (_jsx("div", { style: { position: 'relative', overflow: 'hidden' }, children: _jsx("div", { style: {
|
|
167
164
|
width: '100%',
|
|
168
|
-
}, children: (
|
|
165
|
+
}, children: _jsxs("div", { style: {
|
|
169
166
|
width: '100%',
|
|
170
167
|
height: 30,
|
|
171
|
-
borderRadius:
|
|
172
|
-
backgroundColor:
|
|
168
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
169
|
+
backgroundColor: tokens.colorNeutralBackground2,
|
|
173
170
|
display: 'flex',
|
|
174
|
-
paddingLeft:
|
|
175
|
-
gap:
|
|
171
|
+
paddingLeft: tokens.spacingHorizontalS,
|
|
172
|
+
gap: tokens.spacingHorizontalS,
|
|
176
173
|
alignItems: 'center',
|
|
177
174
|
overflow: 'hidden',
|
|
178
|
-
}, children: [(
|
|
175
|
+
}, children: [_jsx(FormatIcon, { size: 16 }), _jsx(Body1, { style: {
|
|
179
176
|
overflow: 'hidden',
|
|
180
177
|
textOverflow: 'ellipsis',
|
|
181
178
|
whiteSpace: 'nowrap',
|
|
182
179
|
flex: 1,
|
|
183
|
-
}, children: value.name || value.url }), isProcessing && ((
|
|
180
|
+
}, children: value.name || value.url }), isProcessing && (_jsx("div", { style: { paddingRight: tokens.spacingHorizontalS }, children: _jsx(Spinner, { size: "extra-tiny" }) })), !isProcessing && (_jsx(ActionMenu, { format: format, value: value, disabled: disabled, readOnly: readOnly, onChange: onChange, onChangeClick: () => selectFile(accept) }))] }) }) }));
|
|
184
181
|
};
|
|
185
|
-
exports.AttachmentControl = AttachmentControl;
|
|
186
182
|
const ActionMenu = ({ format, value, disabled, readOnly, onChange, onChangeClick, }) => {
|
|
187
|
-
const openConfirmDialog =
|
|
188
|
-
const FileOpenIcon =
|
|
183
|
+
const openConfirmDialog = useOpenConfirmDialog();
|
|
184
|
+
const FileOpenIcon = useMemo(() => {
|
|
189
185
|
switch (format) {
|
|
190
186
|
case 'video':
|
|
191
187
|
case 'audio':
|
|
192
|
-
return
|
|
188
|
+
return Icons.Play;
|
|
193
189
|
default:
|
|
194
|
-
return
|
|
190
|
+
return Icons.OpenInNew;
|
|
195
191
|
}
|
|
196
192
|
}, [format]);
|
|
197
|
-
const OpenText =
|
|
193
|
+
const OpenText = useMemo(() => {
|
|
198
194
|
switch (format) {
|
|
199
195
|
case 'video':
|
|
200
196
|
return 'Play';
|
|
@@ -204,13 +200,13 @@ const ActionMenu = ({ format, value, disabled, readOnly, onChange, onChangeClick
|
|
|
204
200
|
return 'Open';
|
|
205
201
|
}
|
|
206
202
|
}, [format]);
|
|
207
|
-
return ((
|
|
203
|
+
return (_jsxs(Menu, { positioning: "before-top", hasIcons: true, children: [_jsx(MenuTrigger, { children: _jsx(Button, { appearance: "transparent", icon: _jsx(Icons.MoreVertical, {}) }) }), _jsx(MenuPopover, { children: _jsxs(MenuList, { children: [_jsx(MenuItem, { icon: _jsx(FileOpenIcon, {}), onClick: () => {
|
|
208
204
|
window.open(value.url, '_blank');
|
|
209
|
-
}, children: OpenText }), (
|
|
205
|
+
}, children: OpenText }), _jsx(MenuItem, { icon: _jsx(Icons.Copy, {}), onClick: () => {
|
|
210
206
|
navigator.clipboard.writeText(value.url).catch(() => { });
|
|
211
|
-
}, children: "Copy Url" }), !(disabled || readOnly) && ((
|
|
207
|
+
}, children: "Copy Url" }), !(disabled || readOnly) && (_jsxs(_Fragment, { children: [_jsx(MenuItem, { icon: _jsx(Icons.Edit, {}), onClick: () => {
|
|
212
208
|
onChangeClick === null || onChangeClick === void 0 ? void 0 : onChangeClick();
|
|
213
|
-
}, children: "Change" }), (
|
|
209
|
+
}, children: "Change" }), _jsx(MenuDivider, {}), _jsx(MenuItem, { icon: _jsx(Icons.Delete, {}), onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
214
210
|
const result = yield openConfirmDialog({
|
|
215
211
|
title: 'Remove file',
|
|
216
212
|
text: 'Are you sure you want to remove this file?',
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,38 +7,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
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: {
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Button, Caption1, Link, Tag, TagGroup, TagPicker, TagPickerControl, TagPickerList, tokens, } from '@fluentui/react-components';
|
|
12
|
+
import { fileToObject } from '@headless-adminapp/core/utils';
|
|
13
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
14
|
+
import { useRef } from 'react';
|
|
15
|
+
export const AttachmentsControl = ({ onChange, id, onBlur, onFocus, disabled, readOnly, value, }) => {
|
|
16
|
+
const inputRef = useRef(null);
|
|
17
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsxs(TagPicker, { appearance: "filled-darker", disabled: disabled, open: false, children: [_jsx(TagPickerControl, { onFocus: onFocus, onBlur: onBlur, id: id, style: { paddingBlock: tokens.spacingVerticalXXS }, expandIcon: null, children: _jsxs(TagGroup, { style: {
|
|
21
18
|
flexWrap: 'wrap',
|
|
22
|
-
columnGap:
|
|
23
|
-
gap:
|
|
24
|
-
}, children: [value === null || value === void 0 ? void 0 : value.map((file, index) => ((
|
|
19
|
+
columnGap: tokens.spacingHorizontalXS,
|
|
20
|
+
gap: tokens.spacingHorizontalXS,
|
|
21
|
+
}, children: [value === null || value === void 0 ? void 0 : value.map((file, index) => (_jsx(Tag, { as: "span", appearance: "brand", size: "small", shape: "rounded", dismissible: !disabled && !readOnly, dismissIcon: _jsx("div", { style: { display: 'flex', cursor: 'pointer' }, onClick: () => {
|
|
25
22
|
if (disabled || readOnly)
|
|
26
23
|
return;
|
|
27
24
|
onChange === null || onChange === void 0 ? void 0 : onChange(value === null || value === void 0 ? void 0 : value.filter((_, i) => i !== index));
|
|
28
|
-
}, children: (
|
|
25
|
+
}, children: _jsx(Icons.Close, { size: 16 }) }), children: _jsx(Link, { href: file.url, target: "_blank", onClick: (event) => {
|
|
29
26
|
event.preventDefault();
|
|
30
27
|
event.stopPropagation();
|
|
31
28
|
window.open(file.url, '_blank');
|
|
32
|
-
}, children: (
|
|
29
|
+
}, children: _jsx(Caption1, { style: { overflow: 'hidden', textOverflow: 'ellipsis' }, children: file.name }) }) }, index))), !readOnly && !disabled && (_jsx(Button, { size: "small", icon: _jsx(Icons.Add, { size: 16 }), appearance: "outline", onClick: () => {
|
|
33
30
|
var _a;
|
|
34
31
|
if (readOnly)
|
|
35
32
|
return;
|
|
36
33
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
37
|
-
}, children: "Add" }))] }) }), (
|
|
34
|
+
}, children: "Add" }))] }) }), _jsx(TagPickerList, {})] }), _jsx("input", { ref: inputRef, type: "file", multiple: true, style: { display: 'none' }, onChange: (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
35
|
const files = event.target.files;
|
|
39
36
|
if (files === null || files === void 0 ? void 0 : files.length) {
|
|
40
|
-
const fileObjects = yield Promise.all(Array.from(files).map((file) =>
|
|
37
|
+
const fileObjects = yield Promise.all(Array.from(files).map((file) => fileToObject(file)));
|
|
41
38
|
onChange === null || onChange === void 0 ? void 0 : onChange([...(value !== null && value !== void 0 ? value : []), ...fileObjects]);
|
|
42
39
|
}
|
|
43
40
|
}) })] }));
|
|
44
41
|
};
|
|
45
|
-
exports.AttachmentsControl = AttachmentsControl;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const locale_1 = require("@headless-adminapp/app/locale");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
function CurrencyControl({ value, onChange, id, name, onBlur, onFocus,
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Input } from '@fluentui/react-components';
|
|
3
|
+
import { useCurrencySymbol } from '@headless-adminapp/app/locale';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
export function CurrencyControl({ value, onChange, id, name, onBlur, onFocus,
|
|
9
6
|
// error,
|
|
10
7
|
disabled, placeholder, autoFocus,
|
|
11
8
|
// borderOnFocusOnly,
|
|
12
9
|
readOnly, }) {
|
|
13
|
-
const symbol =
|
|
14
|
-
const [internalValue, setInternalValue] =
|
|
15
|
-
const internalValueRef =
|
|
10
|
+
const symbol = useCurrencySymbol();
|
|
11
|
+
const [internalValue, setInternalValue] = useState(value ? value.toString() : '');
|
|
12
|
+
const internalValueRef = useRef(internalValue);
|
|
16
13
|
internalValueRef.current = internalValue;
|
|
17
|
-
|
|
14
|
+
useEffect(() => {
|
|
18
15
|
let _value = '';
|
|
19
16
|
if (typeof value === 'number') {
|
|
20
17
|
_value = value.toString();
|
|
@@ -45,7 +42,7 @@ readOnly, }) {
|
|
|
45
42
|
setInternalValue(value);
|
|
46
43
|
onChange === null || onChange === void 0 ? void 0 : onChange(Number(value));
|
|
47
44
|
};
|
|
48
|
-
return ((
|
|
45
|
+
return (_jsx(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: _jsx("div", { children: symbol }), disabled: disabled, readOnly: readOnly, style: {
|
|
49
46
|
width: '100%',
|
|
50
47
|
} }));
|
|
51
48
|
}
|
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
dayjs_1.default.extend(utc_1.default);
|
|
17
|
-
dayjs_1.default.extend(timezone_1.default);
|
|
18
|
-
function DateControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
|
|
19
|
-
const { dateFormats, timezone } = (0, locale_1.useLocale)();
|
|
20
|
-
const { datePickerStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
21
|
-
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",
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { tokens } from '@fluentui/react-components';
|
|
3
|
+
import { DatePicker } from '@fluentui/react-datepicker-compat';
|
|
4
|
+
import { useLocale } from '@headless-adminapp/app/locale';
|
|
5
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
8
|
+
import utc from 'dayjs/plugin/utc';
|
|
9
|
+
import { useAppStrings } from '../../App/AppStringContext';
|
|
10
|
+
dayjs.extend(utc);
|
|
11
|
+
dayjs.extend(timezone);
|
|
12
|
+
export function DateControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
|
|
13
|
+
const { dateFormats, timezone } = useLocale();
|
|
14
|
+
const { datePickerStrings } = useAppStrings();
|
|
15
|
+
return (_jsx(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",
|
|
22
16
|
// size="sm"
|
|
23
17
|
// error={error}
|
|
24
18
|
// maxDate={maxDate}
|
|
25
19
|
// minDate={minDate}
|
|
26
|
-
disabled: disabled, readOnly: readOnly, formatDate: (date) => date ? (
|
|
20
|
+
disabled: disabled, readOnly: readOnly, formatDate: (date) => date ? dayjs(date).tz(timezone).format(dateFormats.short) : '', value: value ? new Date(value) : null, onSelectDate: (date) => onChange === null || onChange === void 0 ? void 0 : onChange(date ? dayjs(date).tz(timezone).startOf('day').toISOString() : null), strings: datePickerStrings, contentAfter: _jsx("div", { style: {
|
|
27
21
|
display: 'flex',
|
|
28
22
|
alignItems: 'center',
|
|
29
23
|
justifyContent: 'center',
|
|
30
24
|
marginRight: -4,
|
|
31
|
-
color:
|
|
32
|
-
}, children: (
|
|
25
|
+
color: tokens.colorNeutralForeground2,
|
|
26
|
+
}, children: _jsx(Icons.Calendar, { size: 20 }) }) }));
|
|
33
27
|
}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
function DateRangeControl({ value, onChange, id, name, onBlur, onFocus, disabled, maxDate, minDate, readOnly, }) {
|
|
14
|
-
const [from, setFrom] = (0, react_1.useState)(value ? value[0] : null);
|
|
15
|
-
const [to, setTo] = (0, react_1.useState)(value ? value[1] : null);
|
|
16
|
-
const { datePickerStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
17
|
-
const { dateFormats } = (0, locale_1.useLocale)();
|
|
18
|
-
(0, react_1.useEffect)(() => {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DatePicker } from '@fluentui/react-datepicker-compat';
|
|
3
|
+
import { useLocale } from '@headless-adminapp/app/locale';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import { useAppStrings } from '../../App/AppStringContext';
|
|
7
|
+
export function DateRangeControl({ value, onChange, id, name, onBlur, onFocus, disabled, maxDate, minDate, readOnly, }) {
|
|
8
|
+
const [from, setFrom] = useState(value ? value[0] : null);
|
|
9
|
+
const [to, setTo] = useState(value ? value[1] : null);
|
|
10
|
+
const { datePickerStrings } = useAppStrings();
|
|
11
|
+
const { dateFormats } = useLocale();
|
|
12
|
+
useEffect(() => {
|
|
19
13
|
if (value) {
|
|
20
14
|
setFrom(value[0]);
|
|
21
15
|
setTo(value[1]);
|
|
@@ -41,9 +35,9 @@ function DateRangeControl({ value, onChange, id, name, onBlur, onFocus, disabled
|
|
|
41
35
|
onChange === null || onChange === void 0 ? void 0 : onChange([from, (_a = date === null || date === void 0 ? void 0 : date.toISOString()) !== null && _a !== void 0 ? _a : null]);
|
|
42
36
|
// }
|
|
43
37
|
};
|
|
44
|
-
return ((
|
|
38
|
+
return (_jsxs("div", { style: { display: 'flex', gap: 8 }, children: [_jsx(DatePicker, { id: id, name: name, onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), placeholder: "From", appearance: "filled-darker", disabled: disabled, readOnly: readOnly, formatDate: (date) => date ? dayjs(date).format(dateFormats.short) : '', value: from ? new Date(from) : null, onSelectDate: (date) => handleChangeFrom(date), strings: datePickerStrings, minDate: minDate, maxDate: _maxDate, style: { flex: 1 }, input: {
|
|
45
39
|
style: { width: '100%' },
|
|
46
|
-
} }), (
|
|
40
|
+
} }), _jsx(DatePicker, { id: id, name: name, onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), placeholder: "To", appearance: "filled-darker", disabled: disabled, readOnly: readOnly, formatDate: (date) => (date ? dayjs(date).format('YYYY-MM-DD') : ''), value: to ? new Date(to) : null, onSelectDate: (date) => handleChangeTo(date), strings: datePickerStrings, minDate: _minDate, maxDate: maxDate, style: { flex: 1 }, input: {
|
|
47
41
|
style: { width: '100%' },
|
|
48
42
|
} })] }));
|
|
49
43
|
}
|
|
@@ -1,70 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
dayjs_1.default.extend(utc_1.default);
|
|
20
|
-
dayjs_1.default.extend(timezone_1.default);
|
|
21
|
-
function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
|
|
22
|
-
const { dateFormats: { short: dateFormat }, timeFormats: { short: timeFormat }, timezone, } = (0, locale_1.useLocale)();
|
|
23
|
-
const [internalTimeValue, setInternalTimeValue] = (0, react_1.useState)(value ? (0, dayjs_1.default)(value).tz(timezone).format(timeFormat) : '');
|
|
24
|
-
const internalTimeValueRef = (0, react_1.useRef)(internalTimeValue);
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tokens } from '@fluentui/react-components';
|
|
3
|
+
import { DatePicker } from '@fluentui/react-datepicker-compat';
|
|
4
|
+
import { TimePicker } from '@fluentui/react-timepicker-compat';
|
|
5
|
+
import { useLocale } from '@headless-adminapp/app/locale';
|
|
6
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
9
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
10
|
+
import utc from 'dayjs/plugin/utc';
|
|
11
|
+
import { useEffect, useRef, useState } from 'react';
|
|
12
|
+
dayjs.extend(customParseFormat);
|
|
13
|
+
dayjs.extend(utc);
|
|
14
|
+
dayjs.extend(timezone);
|
|
15
|
+
export function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
|
|
16
|
+
const { dateFormats: { short: dateFormat }, timeFormats: { short: timeFormat }, timezone, } = useLocale();
|
|
17
|
+
const [internalTimeValue, setInternalTimeValue] = useState(value ? dayjs(value).tz(timezone).format(timeFormat) : '');
|
|
18
|
+
const internalTimeValueRef = useRef(internalTimeValue);
|
|
25
19
|
internalTimeValueRef.current = internalTimeValue;
|
|
26
|
-
|
|
20
|
+
useEffect(() => {
|
|
27
21
|
const updatedValue = value
|
|
28
|
-
? (
|
|
22
|
+
? dayjs(value).tz(timezone).format(timeFormat)
|
|
29
23
|
: '';
|
|
30
24
|
if (internalTimeValueRef.current !== updatedValue) {
|
|
31
25
|
setInternalTimeValue(updatedValue);
|
|
32
26
|
}
|
|
33
27
|
}, [value, timezone, timeFormat]);
|
|
34
|
-
return ((
|
|
28
|
+
return (_jsxs("div", { style: {
|
|
35
29
|
display: 'flex',
|
|
36
30
|
alignItems: 'center',
|
|
37
|
-
gap:
|
|
38
|
-
}, children: [(
|
|
31
|
+
gap: tokens.spacingHorizontalS,
|
|
32
|
+
}, children: [_jsx(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", formatDate: (date) => date ? dayjs(date).tz(timezone).format(dateFormat) : '', disabled: disabled, readOnly: readOnly, value: value ? new Date(value) : null, onSelectDate: (date) => {
|
|
39
33
|
if (!date) {
|
|
40
34
|
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
41
35
|
}
|
|
42
36
|
else if (!value) {
|
|
43
|
-
onChange === null || onChange === void 0 ? void 0 : onChange((
|
|
37
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(dayjs(date).tz(timezone, true).toISOString());
|
|
44
38
|
}
|
|
45
39
|
else {
|
|
46
|
-
onChange === null || onChange === void 0 ? void 0 : onChange((
|
|
40
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(dayjs(date)
|
|
47
41
|
.tz(timezone, true)
|
|
48
|
-
.set('hour', (
|
|
49
|
-
.set('minute', (
|
|
42
|
+
.set('hour', dayjs(value).tz(timezone).hour())
|
|
43
|
+
.set('minute', dayjs(value).tz(timezone).minute())
|
|
50
44
|
.toISOString());
|
|
51
45
|
}
|
|
52
46
|
},
|
|
53
47
|
// allowTextInput={true}
|
|
54
|
-
contentAfter: (
|
|
48
|
+
contentAfter: _jsx("div", { style: {
|
|
55
49
|
display: 'flex',
|
|
56
50
|
alignItems: 'center',
|
|
57
51
|
justifyContent: 'center',
|
|
58
52
|
marginRight: -4,
|
|
59
|
-
color:
|
|
60
|
-
}, children: (
|
|
53
|
+
color: tokens.colorNeutralForeground2,
|
|
54
|
+
}, children: _jsx(Icons.Calendar, { size: 20 }) }), style: { flex: 1 }, input: {
|
|
61
55
|
style: { minWidth: 0, width: '100%' },
|
|
62
|
-
} }), (
|
|
56
|
+
} }), _jsx(TimePicker, { appearance: "filled-darker", style: { flex: 1, minWidth: 0 }, input: {
|
|
63
57
|
style: { minWidth: 0 },
|
|
64
58
|
}, readOnly: readOnly || disabled || !value, selectedTime: value ? new Date(value) : null, freeform: true, value: internalTimeValue, onTimeChange: (_, data) => {
|
|
65
59
|
const dateValue = value
|
|
66
|
-
? (
|
|
67
|
-
: (
|
|
60
|
+
? dayjs(value).tz(timezone)
|
|
61
|
+
: dayjs().tz(timezone);
|
|
68
62
|
if (data.selectedTime) {
|
|
69
63
|
onChange === null || onChange === void 0 ? void 0 : onChange(dateValue
|
|
70
64
|
.set('hour', data.selectedTime.getHours())
|
|
@@ -74,7 +68,7 @@ function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
74
68
|
else if (data.selectedTimeText) {
|
|
75
69
|
let resolvedTime = resolveTimeValue(data.selectedTimeText, timeFormat);
|
|
76
70
|
if (!resolvedTime) {
|
|
77
|
-
setInternalTimeValue(value ? (
|
|
71
|
+
setInternalTimeValue(value ? dayjs(value).format(timeFormat) : '');
|
|
78
72
|
return;
|
|
79
73
|
}
|
|
80
74
|
const newValue = dateValue
|
|
@@ -84,25 +78,25 @@ function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
84
78
|
if (newValue !== value) {
|
|
85
79
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
86
80
|
}
|
|
87
|
-
setInternalTimeValue(newValue ? (
|
|
81
|
+
setInternalTimeValue(newValue ? dayjs(newValue).tz(timezone).format(timeFormat) : '');
|
|
88
82
|
}
|
|
89
83
|
}, onInput: (e) => {
|
|
90
84
|
setInternalTimeValue(e.currentTarget.value);
|
|
91
85
|
}, onBlur: () => {
|
|
92
86
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
93
|
-
}, expandIcon: (
|
|
87
|
+
}, expandIcon: _jsx("div", { style: {
|
|
94
88
|
display: 'flex',
|
|
95
89
|
alignItems: 'center',
|
|
96
90
|
justifyContent: 'center',
|
|
97
91
|
marginRight: -4,
|
|
98
|
-
color:
|
|
99
|
-
}, children: (
|
|
92
|
+
color: tokens.colorNeutralForeground2,
|
|
93
|
+
}, children: _jsx(Icons.Clock, { size: 20 }) }) })] }));
|
|
100
94
|
}
|
|
101
95
|
function resolveTimeValue(value, timeFormat) {
|
|
102
96
|
if (!value) {
|
|
103
97
|
return;
|
|
104
98
|
}
|
|
105
|
-
const time = (
|
|
99
|
+
const time = dayjs(value, timeFormat);
|
|
106
100
|
if (!time.isValid()) {
|
|
107
101
|
return;
|
|
108
102
|
}
|