@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
|
@@ -14,6 +14,7 @@ const react_1 = require("react");
|
|
|
14
14
|
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
15
15
|
const RecordCard_1 = require("../../PageEntityForm/RecordCard");
|
|
16
16
|
const avatar_1 = require("../../utils/avatar");
|
|
17
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
17
18
|
const useLookupData_1 = require("./useLookupData");
|
|
18
19
|
function RegardingControl(props) {
|
|
19
20
|
const Control = LookupControlMd;
|
|
@@ -34,7 +35,7 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
34
35
|
},
|
|
35
36
|
},
|
|
36
37
|
});
|
|
37
|
-
const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, dataService, entities, schemaStore, allowNavigation, }) => {
|
|
38
|
+
const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, dataService, entities, schemaStore, allowNavigation, skeleton, }) => {
|
|
38
39
|
const [lookupEnabled, setLookupEnabled] = (0, react_1.useState)(false);
|
|
39
40
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
40
41
|
const [searchText, setSearchText] = (0, react_1.useState)('');
|
|
@@ -119,6 +120,9 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
119
120
|
}
|
|
120
121
|
return schemaStore.getSchema(value?.logicalName);
|
|
121
122
|
}, [schemaStore, value]);
|
|
123
|
+
if (skeleton) {
|
|
124
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
125
|
+
}
|
|
122
126
|
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%', minWidth: 'unset' }, autoComplete: "off", readOnly: readOnly || disabled,
|
|
123
127
|
// disabled={disabled}
|
|
124
128
|
open: open && !value && !readOnly && !disabled, value: !value ? searchText : '', onOpenChange: (e, data) => setOpen(data.open), onChange: (e) => {
|
|
@@ -26,8 +26,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.RichTextControl = void 0;
|
|
27
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
const react_1 = require("react");
|
|
29
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
29
30
|
const ReactQuill = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('react-quill'))));
|
|
30
|
-
const RichTextControl = ({ value, onChange, id, onBlur, onFocus, disabled, readOnly, }) => {
|
|
31
|
+
const RichTextControl = ({ value, onChange, id, onBlur, onFocus, disabled, readOnly, skeleton, }) => {
|
|
32
|
+
if (skeleton) {
|
|
33
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, { height: 200 });
|
|
34
|
+
}
|
|
31
35
|
return ((0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(ReactQuill, { value: value ?? '', onChange: onChange, className: "hdlapp_rte", readOnly: disabled || readOnly, style: { maxHeight: '400px', minHeight: '200px' }, onFocus: onFocus, onBlur: onBlur, id: id }) }));
|
|
32
36
|
};
|
|
33
37
|
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, onBlur, onFocus, placeholder, }: Readonly<SelectControlProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default function SelectControl<T extends string | number>({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, skeleton, }: Readonly<SelectControlProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,8 @@ 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
|
-
|
|
7
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
8
|
+
function SelectControl({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, skeleton, }) {
|
|
8
9
|
const transformedOptions = (0, react_1.useMemo)(() => options.map((x) => ({ label: x.label, value: String(x.value) })), [options]);
|
|
9
10
|
const handleChange = (value) => {
|
|
10
11
|
const option = options.find((x) => String(x.value) === value);
|
|
@@ -16,6 +17,9 @@ function SelectControl({ value, onChange, options, id, name, disabled, onBlur, o
|
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
const selectedOption = (0, react_1.useMemo)(() => options.find((x) => x.value === value), [options, value]);
|
|
20
|
+
if (skeleton) {
|
|
21
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
22
|
+
}
|
|
19
23
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Dropdown, { placeholder: placeholder, id: id, name: name, appearance: "filled-darker",
|
|
20
24
|
// data={transformedOptions}
|
|
21
25
|
value: selectedOption?.label ?? '',
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkeletonControl = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
7
|
+
skeleton: {
|
|
8
|
+
backgroundColor: 'var(--colorNeutralBackground3)',
|
|
9
|
+
'&:after': {
|
|
10
|
+
backgroundImage: 'linear-gradient(to right, var(--colorNeutralBackground3) 0%, var(--colorNeutralBackground6) 50%, var(--colorNeutralBackground3) 100%)',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
const SkeletonControl = ({ height = 32, width, }) => {
|
|
15
|
+
const styles = useStyles();
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { paddingBlock: 2 }, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { style: { height: height - 4, width }, className: styles.skeleton }) }));
|
|
17
|
+
};
|
|
18
|
+
exports.SkeletonControl = SkeletonControl;
|
|
@@ -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, disabled, readOnly, onBlur, onFocus, }: SwitchControlProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function SwitchControl({ value, onChange, id, name, disabled, readOnly, onBlur, onFocus, skeleton, }: SwitchControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SwitchControl = SwitchControl;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
|
|
6
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
7
|
+
function SwitchControl({ value, onChange, id, name, disabled, readOnly, onBlur, onFocus, skeleton, }) {
|
|
8
|
+
if (skeleton) {
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, { width: 80 });
|
|
10
|
+
}
|
|
7
11
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Switch, { checked: value ?? false, onChange: (e) => onChange?.(e.currentTarget.checked), id: id, name: name, disabled: disabled, readOnly: readOnly, onBlur: onBlur, onFocus: onFocus }));
|
|
8
12
|
}
|
|
@@ -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, placeholder, disabled, readOnly, autoComplete, }: Readonly<TelephoneControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, autoComplete, skeleton, }: Readonly<TelephoneControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,7 +7,8 @@ const locale_1 = require("@headless-adminapp/app/locale");
|
|
|
7
7
|
const phone_1 = require("@headless-adminapp/app/utils/phone");
|
|
8
8
|
const icons_1 = require("@headless-adminapp/icons");
|
|
9
9
|
const react_1 = require("react");
|
|
10
|
-
|
|
10
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
11
|
+
function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, autoComplete, skeleton, }) {
|
|
11
12
|
const [internalValue, setInternalValue] = (0, react_1.useState)('');
|
|
12
13
|
const { region } = (0, locale_1.useLocale)();
|
|
13
14
|
const number = (0, react_1.useMemo)(() => {
|
|
@@ -24,6 +25,9 @@ function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placehol
|
|
|
24
25
|
setInternalValue(parsedPhoneNumber.formattedInternationalValue);
|
|
25
26
|
onChange?.(parsedPhoneNumber.rawValue);
|
|
26
27
|
};
|
|
28
|
+
if (skeleton) {
|
|
29
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
30
|
+
}
|
|
27
31
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "tel", placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: internalValue, onChange: (e) => setInternalValue?.(e.target.value), onBlur: () => {
|
|
28
32
|
handleChange();
|
|
29
33
|
onBlur?.();
|
|
@@ -5,4 +5,4 @@ export interface TextAreaControlProps extends ControlProps<string> {
|
|
|
5
5
|
autoHeight?: boolean;
|
|
6
6
|
maxHeight?: number;
|
|
7
7
|
}
|
|
8
|
-
export declare function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, readOnly, rows, textTransform, autoHeight, maxHeight, }: TextAreaControlProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, readOnly, rows, textTransform, autoHeight, maxHeight, skeleton, }: TextAreaControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,8 +4,9 @@ exports.TextAreaControl = TextAreaControl;
|
|
|
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
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
7
8
|
const DEFAULT_MAX_HEIGHT = 260;
|
|
8
|
-
function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, readOnly, rows = 5, textTransform, autoHeight, maxHeight, }) {
|
|
9
|
+
function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, readOnly, rows = 5, textTransform, autoHeight, maxHeight, skeleton, }) {
|
|
9
10
|
const textAreaRef = (0, react_1.useRef)(null);
|
|
10
11
|
(0, react_1.useEffect)(() => {
|
|
11
12
|
const textarea = textAreaRef.current;
|
|
@@ -35,6 +36,9 @@ function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFoc
|
|
|
35
36
|
}
|
|
36
37
|
onChange?.(newValue);
|
|
37
38
|
};
|
|
39
|
+
if (skeleton) {
|
|
40
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, { height: 116 });
|
|
41
|
+
}
|
|
38
42
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Textarea, { ref: textAreaRef, placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value ?? '', onChange: handleInput, onBlur: () => onBlur?.(), onFocus: () => onFocus?.(),
|
|
39
43
|
// error={error}
|
|
40
44
|
readOnly: disabled || readOnly, rows: rows, style: {
|
|
@@ -8,4 +8,4 @@ export interface TextControlProps extends ControlProps<string> {
|
|
|
8
8
|
appearance?: InputProps['appearance'];
|
|
9
9
|
maxLength?: number;
|
|
10
10
|
}
|
|
11
|
-
export declare function TextControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, autoFocus, autoCapitalize, autoCorrect, textTransform, readOnly, appearance, maxLength, }: TextControlProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function TextControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, autoFocus, autoCapitalize, autoCorrect, textTransform, readOnly, appearance, maxLength, skeleton, }: TextControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,12 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TextControl = TextControl;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
6
7
|
function TextControl({ value, onChange, id, name, onBlur, onFocus,
|
|
7
8
|
// error,
|
|
8
9
|
placeholder, disabled, autoComplete, autoFocus, autoCapitalize, autoCorrect, textTransform,
|
|
9
10
|
// borderOnFocusOnly,
|
|
10
|
-
readOnly, appearance = 'filled-darker', maxLength, }) {
|
|
11
|
+
readOnly, appearance = 'filled-darker', maxLength, skeleton, }) {
|
|
11
12
|
const readonly = disabled || readOnly;
|
|
13
|
+
if (skeleton) {
|
|
14
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
15
|
+
}
|
|
12
16
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { placeholder: placeholder, id: id, name: name, autoFocus: autoFocus, appearance: appearance, value: value || '', onChange: (e) => {
|
|
13
17
|
textTransform === 'uppercase'
|
|
14
18
|
? onChange?.(e.target.value.toUpperCase())
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ControlProps } from '../types';
|
|
2
2
|
export interface TimeControlProps extends ControlProps<number> {
|
|
3
3
|
}
|
|
4
|
-
export declare function TimeControl({ value, onChange, id, name, onBlur, placeholder, disabled, readOnly, }: Readonly<TimeControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function TimeControl({ value, onChange, id, name, onBlur, placeholder, disabled, readOnly, skeleton, }: Readonly<TimeControlProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,9 +12,10 @@ const icons_1 = require("@headless-adminapp/icons");
|
|
|
12
12
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
13
13
|
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
14
14
|
const react_1 = require("react");
|
|
15
|
+
const SkeletonControl_1 = require("../SkeletonControl");
|
|
15
16
|
const utils_1 = require("./utils");
|
|
16
17
|
dayjs_1.default.extend(customParseFormat_1.default);
|
|
17
|
-
function TimeControl({ value, onChange, id, name, onBlur, placeholder, disabled, readOnly, }) {
|
|
18
|
+
function TimeControl({ value, onChange, id, name, onBlur, placeholder, disabled, readOnly, skeleton, }) {
|
|
18
19
|
const { timeFormats: { short: timeFormat }, timezone, } = (0, locale_1.useLocale)();
|
|
19
20
|
const [internalTimeValue, setInternalTimeValue] = (0, react_1.useState)(value ? (0, dayjs_1.default)().startOf('day').add(value, 'minutes').format(timeFormat) : '');
|
|
20
21
|
const internalTimeValueRef = (0, react_1.useRef)(internalTimeValue);
|
|
@@ -34,6 +35,9 @@ function TimeControl({ value, onChange, id, name, onBlur, placeholder, disabled,
|
|
|
34
35
|
}
|
|
35
36
|
return (0, dayjs_1.default)().startOf('day').add(value, 'minutes').toDate();
|
|
36
37
|
}, [value]);
|
|
38
|
+
if (skeleton) {
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
40
|
+
}
|
|
37
41
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
38
42
|
display: 'flex',
|
|
39
43
|
alignItems: 'center',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ControlProps } from './types';
|
|
2
2
|
export interface UrlControlProps extends ControlProps<string> {
|
|
3
3
|
}
|
|
4
|
-
export declare function UrlControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }: UrlControlProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function UrlControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, skeleton, }: UrlControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,11 @@ exports.UrlControl = UrlControl;
|
|
|
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
|
-
|
|
7
|
+
const SkeletonControl_1 = require("./SkeletonControl");
|
|
8
|
+
function UrlControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, skeleton, }) {
|
|
9
|
+
if (skeleton) {
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(SkeletonControl_1.SkeletonControl, {});
|
|
11
|
+
}
|
|
8
12
|
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?.(e.target.value), onBlur: () => onBlur?.(), onFocus: () => onFocus?.(),
|
|
9
13
|
// invalid={error}
|
|
10
14
|
readOnly: disabled || readOnly, autoComplete: "off", style: {
|
package/form/controls/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"uuid": "11.0.3",
|
|
53
53
|
"yup": "^1.4.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "a064c301b98e340b142e8daeac078b4cdf5ad99a"
|
|
56
56
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Attribute } from '@headless-adminapp/core';
|
|
2
|
-
import { Path, UseFormReturn } from 'react-hook-form';
|
|
3
|
-
import { BaseFieldValues } from './types';
|
|
4
|
-
interface AttributeControllerProps {
|
|
5
|
-
attribute: Attribute;
|
|
6
|
-
attributeName: Path<BaseFieldValues>;
|
|
7
|
-
form: UseFormReturn<BaseFieldValues>;
|
|
8
|
-
readOnly?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function AttributeController({ attribute, attributeName, form, readOnly, }: Readonly<AttributeControllerProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AttributeController = AttributeController;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
6
|
-
const SectionControl_1 = require("../../DataForm/SectionControl");
|
|
7
|
-
const StandardControl_1 = require("../../PageEntityForm/StandardControl");
|
|
8
|
-
function AttributeController({ attribute, attributeName, form, readOnly, }) {
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: form.control, name: attributeName, render: ({ field, fieldState, formState }) => {
|
|
10
|
-
const isError = (fieldState.isTouched || formState.isSubmitted) &&
|
|
11
|
-
!!fieldState.error?.message;
|
|
12
|
-
const errorMessage = fieldState.isTouched || formState.isSubmitted
|
|
13
|
-
? fieldState.error?.message
|
|
14
|
-
: '';
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: attribute.label, labelPosition: "left", required: attribute.required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(StandardControl_1.StandardControl, { attribute: attribute, name: attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur, errorMessage: errorMessage, isError: isError, readOnly: readOnly || attribute.readonly }) }));
|
|
16
|
-
} }));
|
|
17
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ControlProps } from './types';
|
|
2
|
-
export interface DateRangeControlProps extends ControlProps<[string, string]> {
|
|
3
|
-
maxDate?: Date;
|
|
4
|
-
minDate?: Date;
|
|
5
|
-
}
|
|
6
|
-
export declare function DateRangeControl({ value, onChange, id, name, onBlur, onFocus, disabled, maxDate, minDate, readOnly, }: DateRangeControlProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export declare const cornersClassNames: {
|
|
8
|
-
topRightCornerDate: string;
|
|
9
|
-
topLeftCornerDate: string;
|
|
10
|
-
bottomRightCornerDate: string;
|
|
11
|
-
bottomLeftCornerDate: string;
|
|
12
|
-
};
|
|
@@ -1,293 +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.cornersClassNames = void 0;
|
|
7
|
-
exports.DateRangeControl = DateRangeControl;
|
|
8
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
-
const react_calendar_compat_1 = require("@fluentui/react-calendar-compat");
|
|
10
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
11
|
-
const locale_1 = require("@headless-adminapp/app/locale");
|
|
12
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
13
|
-
const react_1 = require("react");
|
|
14
|
-
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
15
|
-
function formatDateRange(value, dateRangeFormat) {
|
|
16
|
-
if (!value || value.length !== 2) {
|
|
17
|
-
return '';
|
|
18
|
-
}
|
|
19
|
-
const [start, end] = value.map((date) => (0, dayjs_1.default)(date)); //.tz(timezone));
|
|
20
|
-
if (start.isSame(end, 'year')) {
|
|
21
|
-
if (start.isSame(end, 'month')) {
|
|
22
|
-
if (start.isSame(end, 'day')) {
|
|
23
|
-
return start.format(dateRangeFormat.date);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
return (start.format(dateRangeFormat.sameMonth[0]) +
|
|
27
|
-
dateRangeFormat.separator +
|
|
28
|
-
end.format(dateRangeFormat.sameMonth[1]));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return (start.format(dateRangeFormat.sameYear[0]) +
|
|
33
|
-
dateRangeFormat.separator +
|
|
34
|
-
end.format(dateRangeFormat.sameYear[1]));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
return (start.format(dateRangeFormat.date) +
|
|
39
|
-
dateRangeFormat.separator +
|
|
40
|
-
end.format(dateRangeFormat.date));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function DateRangeControl({ value, onChange, id, name, onBlur, onFocus, disabled, maxDate, minDate, readOnly, }) {
|
|
44
|
-
const [open, setOpen] = (0, react_1.useState)(false);
|
|
45
|
-
const { dateRangeFormats } = (0, locale_1.useLocale)();
|
|
46
|
-
const formattedValue = (0, react_1.useMemo)(() => {
|
|
47
|
-
return formatDateRange(value, dateRangeFormats.short);
|
|
48
|
-
}, [value, dateRangeFormats]);
|
|
49
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column' }, children: (0, jsx_runtime_1.jsxs)(react_components_1.Popover, { open: open, onOpenChange: (_, data) => {
|
|
50
|
-
if (readOnly || disabled) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
onFocus?.();
|
|
54
|
-
setOpen(data.open);
|
|
55
|
-
}, positioning: "below-start", children: [(0, jsx_runtime_1.jsx)(react_components_1.PopoverTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.Input, { appearance: "filled-darker", readOnly: true, style: { cursor: 'pointer' }, value: formattedValue, onChange: () => { } }) }), (0, jsx_runtime_1.jsx)(react_components_1.PopoverSurface, { style: { padding: 0 }, children: (0, jsx_runtime_1.jsx)(PopoverContent, { value: value, minDate: minDate, maxDate: maxDate, onChange: (value) => {
|
|
56
|
-
setOpen(false);
|
|
57
|
-
onChange?.(value);
|
|
58
|
-
onBlur?.();
|
|
59
|
-
} }) })] }) }));
|
|
60
|
-
}
|
|
61
|
-
const PopoverContent = ({ value, minDate, maxDate, onChange, required, }) => {
|
|
62
|
-
const [internalValue, setInternalValue] = (0, react_1.useState)([value ? new Date(value[0]) : null, value ? new Date(value[1]) : null]);
|
|
63
|
-
// const [date1, setDate1] = useState<string | null>(null);
|
|
64
|
-
// const [date2, setDate2] = useState<string | null>(null);
|
|
65
|
-
const [navigationDate1, setNavigationDate1] = (0, react_1.useState)(internalValue[0] ?? (0, dayjs_1.default)().toDate());
|
|
66
|
-
const [navigationDate2, setNavigationDate2] = (0, react_1.useState)(internalValue[1] ?? (0, dayjs_1.default)().add(1, 'month').toDate());
|
|
67
|
-
const [date1, date2] = internalValue;
|
|
68
|
-
// useEffect(() => {
|
|
69
|
-
// if (value) {
|
|
70
|
-
// let d1 = new Date(value[0]);
|
|
71
|
-
// let d2 = new Date(value[1]);
|
|
72
|
-
// if (d1 > d2) {
|
|
73
|
-
// const temp = d1;
|
|
74
|
-
// d1 = d2;
|
|
75
|
-
// d2 = temp;
|
|
76
|
-
// }
|
|
77
|
-
// setDate1(d1.toISOString());
|
|
78
|
-
// setDate2(d2.toISOString());
|
|
79
|
-
// }
|
|
80
|
-
// }, [value]);
|
|
81
|
-
const leftMaxDate = !date1 && date2
|
|
82
|
-
? (0, dayjs_1.default)(date2).subtract(1, 'month').endOf('month').toDate()
|
|
83
|
-
: undefined;
|
|
84
|
-
const rightMinDate = !date2 && date1
|
|
85
|
-
? (0, dayjs_1.default)(date1).add(1, 'month').startOf('month').toDate()
|
|
86
|
-
: undefined;
|
|
87
|
-
const _minDate = minDate
|
|
88
|
-
? new Date(minDate)
|
|
89
|
-
: date1
|
|
90
|
-
? new Date(date1)
|
|
91
|
-
: undefined;
|
|
92
|
-
const _maxDate = maxDate
|
|
93
|
-
? new Date(maxDate)
|
|
94
|
-
: date2
|
|
95
|
-
? new Date(date2)
|
|
96
|
-
: undefined;
|
|
97
|
-
// const date1Ref = useRef<string | null>(date1);
|
|
98
|
-
// const date2Ref = useRef<string | null>(date2);
|
|
99
|
-
// date1Ref.current = date1;
|
|
100
|
-
// date2Ref.current = date2;
|
|
101
|
-
const handleCalendarChange = (date, isLeftCalendar) => {
|
|
102
|
-
if ((date1 && date2) || (!date1 && !date2)) {
|
|
103
|
-
if (isLeftCalendar) {
|
|
104
|
-
setInternalValue([date, null]);
|
|
105
|
-
// setDate1(date.toISOString());
|
|
106
|
-
// setDate2(null);
|
|
107
|
-
setNavigationDate2((0, dayjs_1.default)(date).add(1, 'month').toDate());
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
setInternalValue([null, date]);
|
|
111
|
-
// setDate2(date.toISOString());
|
|
112
|
-
// setDate1(null);
|
|
113
|
-
setNavigationDate1((0, dayjs_1.default)(date).subtract(1, 'month').toDate());
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
let d1 = date1;
|
|
118
|
-
let d2 = date2;
|
|
119
|
-
const v = [date1, date2].filter(Boolean);
|
|
120
|
-
v.push(date);
|
|
121
|
-
v.sort((a, b) => a.getTime() - b.getTime());
|
|
122
|
-
// setDate1(v[0]);
|
|
123
|
-
// setDate2(v[1]);
|
|
124
|
-
console.log('v', v);
|
|
125
|
-
setInternalValue(v.map((d) => new Date(d)));
|
|
126
|
-
}
|
|
127
|
-
// const newValues = [...__values] as [string | null, string | null];
|
|
128
|
-
// if (newValues[0] && newValues[1]) {
|
|
129
|
-
// newValues[0] = null;
|
|
130
|
-
// newValues[1] = null;
|
|
131
|
-
// }
|
|
132
|
-
// if (!newValues[0]) {
|
|
133
|
-
// newValues[0] = date.toISOString();
|
|
134
|
-
// } else {
|
|
135
|
-
// newValues[1] = date.toISOString();
|
|
136
|
-
// }
|
|
137
|
-
// // Swap values if the first date is after the second date
|
|
138
|
-
// if (
|
|
139
|
-
// newValues[0] &&
|
|
140
|
-
// newValues[1] &&
|
|
141
|
-
// new Date(newValues[0]) > new Date(newValues[1])
|
|
142
|
-
// ) {
|
|
143
|
-
// const temp = newValues[0];
|
|
144
|
-
// newValues[0] = newValues[1];
|
|
145
|
-
// newValues[1] = temp;
|
|
146
|
-
// }
|
|
147
|
-
// __setValues(newValues);
|
|
148
|
-
};
|
|
149
|
-
// date1, date2
|
|
150
|
-
// [from, to]
|
|
151
|
-
// navigate date1
|
|
152
|
-
// navigate date2
|
|
153
|
-
// First selection in left calendar is start date
|
|
154
|
-
// First selection in right calendar is end date
|
|
155
|
-
// Second selection is conditional
|
|
156
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [JSON.stringify(internalValue), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)(CalendarItem, { date1: date1, date2: date2, navigatedDate: navigationDate1, maxDate: leftMaxDate ?? maxDate, minDate: minDate, onSelectDate: (date) => {
|
|
157
|
-
handleCalendarChange(date, true);
|
|
158
|
-
}, onNavigateDate: (date) => {
|
|
159
|
-
setNavigationDate1(date);
|
|
160
|
-
} }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: true, style: { opacity: 0.2 } }), (0, jsx_runtime_1.jsx)(CalendarItem, { date1: date1, date2: date2, navigatedDate: navigationDate2, minDate: rightMinDate ?? minDate, maxDate: maxDate, onSelectDate: (date) => {
|
|
161
|
-
handleCalendarChange(date, false);
|
|
162
|
-
}, onNavigateDate: (date) => {
|
|
163
|
-
setNavigationDate2(date);
|
|
164
|
-
} })] }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.5 } }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
165
|
-
display: 'flex',
|
|
166
|
-
gap: react_components_1.tokens.spacingHorizontalS,
|
|
167
|
-
padding: react_components_1.tokens.spacingVerticalS,
|
|
168
|
-
justifyContent: 'flex-end',
|
|
169
|
-
}, children: [!required && ((0, jsx_runtime_1.jsx)(react_components_1.Button, { size: "small", appearance: "secondary", onClick: () => {
|
|
170
|
-
onChange?.(null);
|
|
171
|
-
setInternalValue([null, null]);
|
|
172
|
-
}, children: "Clear" })), (0, jsx_runtime_1.jsx)(react_components_1.Button, { size: "small", appearance: "primary", disabled: !internalValue[0] || !internalValue[1], onClick: () => {
|
|
173
|
-
if (!internalValue[0] || !internalValue[1]) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
onChange?.([
|
|
177
|
-
(0, dayjs_1.default)(internalValue[0]).format('YYYY-MM-DD'),
|
|
178
|
-
(0, dayjs_1.default)(internalValue[1]).format('YYYY-MM-DD'),
|
|
179
|
-
]);
|
|
180
|
-
}, children: "Apply" })] })] })] }));
|
|
181
|
-
};
|
|
182
|
-
exports.cornersClassNames = {
|
|
183
|
-
topRightCornerDate: 'fui-CalendarDayGrid__topRightCornerDate',
|
|
184
|
-
topLeftCornerDate: 'fui-CalendarDayGrid__topLeftCornerDate',
|
|
185
|
-
bottomRightCornerDate: 'fui-CalendarDayGrid__bottomRightCornerDate',
|
|
186
|
-
bottomLeftCornerDate: 'fui-CalendarDayGrid__bottomLeftCornerDate',
|
|
187
|
-
};
|
|
188
|
-
function checkIsSameMonth(date1, date2) {
|
|
189
|
-
return date1.isSame(date2, 'month');
|
|
190
|
-
}
|
|
191
|
-
function applyRoundedStyles({ element, date, navigatedDate, selectedDate1, selectedDate2, classNames, }) {
|
|
192
|
-
if (!classNames.daySelected) {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
const _date = (0, dayjs_1.default)(date); //.tz(timezone);
|
|
196
|
-
const _navigatedDate = (0, dayjs_1.default)(navigatedDate); //.tz(timezone);
|
|
197
|
-
const _selectedDate1 = (0, dayjs_1.default)(selectedDate1); //.tz(timezone);
|
|
198
|
-
const _selectedDate2 = (0, dayjs_1.default)(selectedDate2); //.tz(timezone);
|
|
199
|
-
const isSameMonth = checkIsSameMonth(_navigatedDate, _date);
|
|
200
|
-
const isSelected = isSameMonth &&
|
|
201
|
-
selectedDate1 &&
|
|
202
|
-
selectedDate2 &&
|
|
203
|
-
date >= selectedDate1 &&
|
|
204
|
-
date <= selectedDate2;
|
|
205
|
-
if (!isSelected) {
|
|
206
|
-
element.classList.remove(...classNames.daySelected.split(' '));
|
|
207
|
-
element.classList.add(exports.cornersClassNames.topLeftCornerDate);
|
|
208
|
-
element.classList.add(exports.cornersClassNames.topRightCornerDate);
|
|
209
|
-
element.classList.add(exports.cornersClassNames.bottomLeftCornerDate);
|
|
210
|
-
element.classList.add(exports.cornersClassNames.bottomRightCornerDate);
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
const aboveDate = _date.subtract(7, 'day');
|
|
214
|
-
const belowDate = _date.add(7, 'day');
|
|
215
|
-
const leftDate = _date.subtract(1, 'day');
|
|
216
|
-
const rightDate = _date.add(1, 'day');
|
|
217
|
-
const isFirstDay = _date.day() === 1; // Monday
|
|
218
|
-
const isLastDay = _date.day() === 0; // Sunday
|
|
219
|
-
const isAboveDateInRange = !aboveDate.isBefore(_selectedDate1);
|
|
220
|
-
const isBelowDateInRange = !belowDate.isAfter(_selectedDate2);
|
|
221
|
-
const isLeftDateInRange = !leftDate.isBefore(_selectedDate1);
|
|
222
|
-
const isRightDateInRange = !rightDate.isAfter(_selectedDate2);
|
|
223
|
-
const isAboveDateInSameMonth = checkIsSameMonth(aboveDate, _navigatedDate);
|
|
224
|
-
const isBelowDateInSameMonth = checkIsSameMonth(belowDate, _navigatedDate);
|
|
225
|
-
const isLeftDateInSameMonth = checkIsSameMonth(leftDate, _navigatedDate);
|
|
226
|
-
const isRightDateInSameMonth = checkIsSameMonth(rightDate, _navigatedDate);
|
|
227
|
-
const nothingOnLeft = !isLeftDateInRange || isFirstDay || !isLeftDateInSameMonth;
|
|
228
|
-
const nothingOnRight = !isRightDateInRange || isLastDay || !isRightDateInSameMonth;
|
|
229
|
-
const nothingAbove = !isAboveDateInRange || !isAboveDateInSameMonth;
|
|
230
|
-
const nothingBelow = !isBelowDateInRange || !isBelowDateInSameMonth;
|
|
231
|
-
const hasTopLeftRadius = nothingOnLeft && nothingAbove;
|
|
232
|
-
const hasTopRightRadius = nothingOnRight && nothingAbove;
|
|
233
|
-
const hasBottomLeftRadius = nothingOnLeft && nothingBelow;
|
|
234
|
-
const hasBottomRightRadius = nothingOnRight && nothingBelow;
|
|
235
|
-
const classToAdd = classNames.daySelected.split(' ');
|
|
236
|
-
const classToRemove = [];
|
|
237
|
-
if (hasTopLeftRadius) {
|
|
238
|
-
classToAdd.push(exports.cornersClassNames.topLeftCornerDate);
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
classToRemove.push(exports.cornersClassNames.topLeftCornerDate);
|
|
242
|
-
}
|
|
243
|
-
if (hasTopRightRadius) {
|
|
244
|
-
classToAdd.push(exports.cornersClassNames.topRightCornerDate);
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
classToRemove.push(exports.cornersClassNames.topRightCornerDate);
|
|
248
|
-
}
|
|
249
|
-
if (hasBottomLeftRadius) {
|
|
250
|
-
classToAdd.push(exports.cornersClassNames.bottomLeftCornerDate);
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
classToRemove.push(exports.cornersClassNames.bottomLeftCornerDate);
|
|
254
|
-
}
|
|
255
|
-
if (hasBottomRightRadius) {
|
|
256
|
-
classToAdd.push(exports.cornersClassNames.bottomRightCornerDate);
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
classToRemove.push(exports.cornersClassNames.bottomRightCornerDate);
|
|
260
|
-
}
|
|
261
|
-
element.classList.add(...classToAdd);
|
|
262
|
-
element.classList.remove(...classToRemove);
|
|
263
|
-
}
|
|
264
|
-
const CalendarItem = ({ date1, date2, navigatedDate, maxDate, minDate, onNavigateDate, onSelectDate, }) => {
|
|
265
|
-
const { datePickerStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
266
|
-
const date1Ref = (0, react_1.useRef)(date1);
|
|
267
|
-
const date2Ref = (0, react_1.useRef)(date2);
|
|
268
|
-
const navigatedDateRef = (0, react_1.useRef)(navigatedDate);
|
|
269
|
-
date1Ref.current = date1;
|
|
270
|
-
date2Ref.current = date2;
|
|
271
|
-
navigatedDateRef.current = navigatedDate;
|
|
272
|
-
const customDayCellRef = (0, react_1.useCallback)((element, date, classNames) => {
|
|
273
|
-
if (!element) {
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
applyRoundedStyles({
|
|
277
|
-
element,
|
|
278
|
-
navigatedDate: navigatedDateRef.current,
|
|
279
|
-
date,
|
|
280
|
-
selectedDate1: date1Ref.current,
|
|
281
|
-
selectedDate2: date2Ref.current,
|
|
282
|
-
classNames,
|
|
283
|
-
});
|
|
284
|
-
}, []);
|
|
285
|
-
return ((0, jsx_runtime_1.jsx)(react_calendar_compat_1.Calendar, { showMonthPickerAsOverlay: true, showGoToToday: false, highlightSelectedMonth: false, highlightCurrentMonth: false, firstDayOfWeek: react_calendar_compat_1.DayOfWeek.Monday, strings: datePickerStrings, calendarDayProps: {
|
|
286
|
-
customDayCellRef: customDayCellRef,
|
|
287
|
-
onNavigateDate: onNavigateDate,
|
|
288
|
-
navigatedDate: navigatedDate,
|
|
289
|
-
}, calendarMonthProps: {
|
|
290
|
-
navigatedDate: navigatedDate,
|
|
291
|
-
onNavigateDate: onNavigateDate,
|
|
292
|
-
}, maxDate: maxDate, minDate: minDate, onSelectDate: onSelectDate }));
|
|
293
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ControlProps } from './types';
|
|
2
|
-
export interface TimeControlProps extends ControlProps<number> {
|
|
3
|
-
}
|
|
4
|
-
export declare function TimeControl({ value, onChange, id, name, onBlur, placeholder, disabled, readOnly, }: Readonly<TimeControlProps>): import("react/jsx-runtime").JSX.Element;
|