@headless-adminapp/fluent 1.3.1 → 1.4.0
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/GridListContainer.js +2 -5
- package/DataGrid/GridTableContainer.js +2 -5
- package/DataGrid/useTableColumns.js +6 -14
- package/PageEntityForm/CommandContainer.d.ts +5 -1
- package/PageEntityForm/CommandContainer.js +33 -4
- package/PageEntityForm/FormTabRelated.d.ts +1 -1
- package/PageEntityForm/FormTabRelated.js +7 -5
- package/PageEntityForm/PageEntityForm.js +9 -7
- package/PageEntityForm/PageEntityFormDesktopContainer.js +24 -41
- package/PageEntityForm/ProcessFlow.d.ts +2 -1
- package/PageEntityForm/ProcessFlow.js +27 -12
- package/PageEntityForm/RecordAvatar.js +14 -0
- package/PageEntityForm/RelatedViewSelector.d.ts +1 -8
- package/PageEntityForm/SectionContainer.d.ts +2 -1
- package/PageEntityForm/SectionContainer.js +11 -9
- package/PageEntityForm/StandardControl.js +17 -36
- package/PageEntityView/PageEntityView.js +2 -1
- package/Skeleton/TextSkeleton.d.ts +10 -0
- package/Skeleton/TextSkeleton.js +21 -0
- package/form/controls/AttachmentControl.js +10 -3
- package/form/controls/AttachmentsControl.js +5 -1
- package/form/controls/CurrencyControl.d.ts +1 -1
- package/form/controls/CurrencyControl.js +5 -1
- package/form/controls/DateControl.d.ts +1 -1
- package/form/controls/DateControl.js +5 -1
- package/form/controls/DateRangeControl/DateRangeControl.d.ts +1 -1
- package/form/controls/DateRangeControl/DateRangeControl.js +5 -1
- package/form/controls/DateTimeControl.d.ts +1 -1
- package/form/controls/DateTimeControl.js +9 -1
- package/form/controls/DecimalControl.d.ts +1 -1
- package/form/controls/DecimalControl.js +5 -1
- package/form/controls/DurationControl.js +5 -1
- package/form/controls/EmailControl.d.ts +1 -1
- package/form/controls/EmailControl.js +5 -1
- package/form/controls/IdControl.d.ts +1 -1
- package/form/controls/IdControl.js +5 -1
- package/form/controls/IntegerControl.d.ts +1 -1
- package/form/controls/IntegerControl.js +5 -1
- package/form/controls/LookupControl.js +5 -1
- package/form/controls/MultiSelectControl.d.ts +1 -1
- package/form/controls/MultiSelectControl.js +5 -1
- package/form/controls/MultiSelectLookupControl.js +5 -1
- package/form/controls/RegardingControl.js +5 -1
- package/form/controls/RichTextControl.js +5 -1
- package/form/controls/SelectControl.d.ts +1 -1
- package/form/controls/SelectControl.js +5 -1
- package/form/controls/SkeletonControl.d.ts +7 -0
- package/form/controls/SkeletonControl.js +18 -0
- package/form/controls/SwitchControl.d.ts +1 -1
- package/form/controls/SwitchControl.js +5 -1
- package/form/controls/TelephoneControl.d.ts +1 -1
- package/form/controls/TelephoneControl.js +5 -1
- package/form/controls/TextAreaControl.d.ts +1 -1
- package/form/controls/TextAreaControl.js +5 -1
- package/form/controls/TextControl.d.ts +1 -1
- package/form/controls/TextControl.js +5 -1
- package/form/controls/TimeControl/TimeControl.d.ts +1 -1
- package/form/controls/TimeControl/TimeControl.js +5 -1
- package/form/controls/UrlControl.d.ts +1 -1
- package/form/controls/UrlControl.js +5 -1
- package/form/controls/types.d.ts +1 -0
- package/package.json +2 -2
- package/PageCalendar/EventDialog/AttributeController.d.ts +0 -11
- package/PageCalendar/EventDialog/AttributeController.js +0 -17
- package/form/controls/DateRangeControl.d.ts +0 -12
- package/form/controls/DateRangeControl.js +0 -293
- package/form/controls/TimeControl.d.ts +0 -4
- package/form/controls/TimeControl.js +0 -87
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TimeControl = TimeControl;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
9
|
-
const react_timepicker_compat_1 = require("@fluentui/react-timepicker-compat");
|
|
10
|
-
const locale_1 = require("@headless-adminapp/app/locale");
|
|
11
|
-
const icons_1 = require("@headless-adminapp/icons");
|
|
12
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
13
|
-
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
14
|
-
const react_1 = require("react");
|
|
15
|
-
dayjs_1.default.extend(customParseFormat_1.default);
|
|
16
|
-
function TimeControl({ value, onChange, id, name, onBlur, placeholder, disabled, readOnly, }) {
|
|
17
|
-
const { timeFormats: { short: timeFormat }, timezone, } = (0, locale_1.useLocale)();
|
|
18
|
-
const [internalTimeValue, setInternalTimeValue] = (0, react_1.useState)(value ? (0, dayjs_1.default)().startOf('day').add(value, 'minutes').format(timeFormat) : '');
|
|
19
|
-
const internalTimeValueRef = (0, react_1.useRef)(internalTimeValue);
|
|
20
|
-
internalTimeValueRef.current = internalTimeValue;
|
|
21
|
-
(0, react_1.useEffect)(() => {
|
|
22
|
-
const updatedValue = typeof value === 'number'
|
|
23
|
-
? (0, dayjs_1.default)().startOf('day').add(value, 'minutes').format(timeFormat)
|
|
24
|
-
: '';
|
|
25
|
-
if (internalTimeValueRef.current !== updatedValue) {
|
|
26
|
-
setInternalTimeValue(updatedValue);
|
|
27
|
-
}
|
|
28
|
-
}, [value, timezone, timeFormat]);
|
|
29
|
-
const isReadonly = readOnly || disabled;
|
|
30
|
-
const selectedTime = (0, react_1.useMemo)(() => {
|
|
31
|
-
if (typeof value !== 'number') {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
return (0, dayjs_1.default)().startOf('day').add(value, 'minutes').toDate();
|
|
35
|
-
}, [value]);
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
37
|
-
display: 'flex',
|
|
38
|
-
alignItems: 'center',
|
|
39
|
-
gap: react_components_1.tokens.spacingHorizontalS,
|
|
40
|
-
}, children: (0, jsx_runtime_1.jsx)(react_timepicker_compat_1.TimePicker, { appearance: "filled-darker", style: {
|
|
41
|
-
flex: 1,
|
|
42
|
-
minWidth: 0,
|
|
43
|
-
pointerEvents: isReadonly ? 'none' : 'auto',
|
|
44
|
-
}, placeholder: placeholder, id: id, name: name, input: {
|
|
45
|
-
style: { minWidth: 0 },
|
|
46
|
-
}, readOnly: isReadonly, selectedTime: selectedTime, freeform: true, value: internalTimeValue, onTimeChange: (_, data) => {
|
|
47
|
-
if (data.selectedTime) {
|
|
48
|
-
onChange?.((0, dayjs_1.default)(data.selectedTime).diff((0, dayjs_1.default)().startOf('day'), 'minutes'));
|
|
49
|
-
}
|
|
50
|
-
else if (data.selectedTimeText) {
|
|
51
|
-
let resolvedTime = resolveTimeValue(data.selectedTimeText, timeFormat);
|
|
52
|
-
if (!resolvedTime) {
|
|
53
|
-
setInternalTimeValue(value ? (0, dayjs_1.default)(value).format(timeFormat) : '');
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const newValue = (0, dayjs_1.default)(resolvedTime).diff((0, dayjs_1.default)().startOf('day'), 'minutes');
|
|
57
|
-
if (newValue !== value) {
|
|
58
|
-
onChange?.(newValue);
|
|
59
|
-
}
|
|
60
|
-
setInternalTimeValue((0, dayjs_1.default)(resolvedTime).format(timeFormat));
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
setInternalTimeValue('');
|
|
64
|
-
onChange?.(null);
|
|
65
|
-
}
|
|
66
|
-
}, onInput: (e) => {
|
|
67
|
-
setInternalTimeValue(e.currentTarget.value);
|
|
68
|
-
}, onBlur: () => {
|
|
69
|
-
onBlur?.();
|
|
70
|
-
}, expandIcon: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
71
|
-
display: 'flex',
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
justifyContent: 'center',
|
|
74
|
-
marginRight: -4,
|
|
75
|
-
color: react_components_1.tokens.colorNeutralForeground2,
|
|
76
|
-
}, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Clock, { size: 20 }) }) }) }));
|
|
77
|
-
}
|
|
78
|
-
function resolveTimeValue(value, timeFormat) {
|
|
79
|
-
if (!value) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const time = (0, dayjs_1.default)(value, timeFormat);
|
|
83
|
-
if (!time.isValid()) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
return time.toDate();
|
|
87
|
-
}
|