@rebasepro/admin 0.6.1 → 0.8.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/dist/{CollectionEditorDialog-HNXGxXdO.js → CollectionEditorDialog-BO_aQ-Z4.js} +236 -155
- package/dist/CollectionEditorDialog-BO_aQ-Z4.js.map +1 -0
- package/dist/{PropertyEditView-C2wp8kQ9.js → PropertyEditView-DKzOpMjR.js} +190 -50
- package/dist/PropertyEditView-DKzOpMjR.js.map +1 -0
- package/dist/{CollectionsStudioView-B1mN33GB.js → RouterCollectionsStudioView-BQTIExjA.js} +61 -39
- package/dist/RouterCollectionsStudioView-BQTIExjA.js.map +1 -0
- package/dist/collection_editor/_cms_internals.d.ts +1 -1
- package/dist/collection_editor/api/generateCollectionApi.d.ts +3 -2
- package/dist/collection_editor/extensibility_types.d.ts +135 -0
- package/dist/collection_editor/index.d.ts +6 -0
- package/dist/collection_editor/serializable_types.d.ts +370 -0
- package/dist/collection_editor/serializable_utils.d.ts +50 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +3 -3
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +12 -1
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.d.ts +13 -1
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.d.ts +24 -2
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.d.ts +2 -1
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.d.ts +4 -1
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +12 -1
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.d.ts +15 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.d.ts +14 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +37 -0
- package/dist/collection_editor/useSafeSnackbarController.d.ts +2 -0
- package/dist/collection_editor_ui.d.ts +4 -0
- package/dist/collection_editor_ui.js +33 -4
- package/dist/collection_editor_ui.js.map +1 -0
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/index.d.ts +1 -1
- package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +3 -3
- package/dist/components/EntityCollectionView/hooks/useKanbanDragAndDrop.d.ts +3 -3
- package/dist/components/EntityEditView.d.ts +3 -2
- package/dist/components/RebaseCMS.d.ts +1 -1
- package/dist/components/SelectableTable/SelectionStore.d.ts +12 -21
- package/dist/components/field_configs.d.ts +1 -1
- package/dist/editor/editor.d.ts +0 -6
- package/dist/editor.js +1 -3
- package/dist/editor.js.map +1 -1
- package/dist/form/EntityForm.d.ts +10 -9
- package/dist/form/EntityFormBinding.d.ts +27 -0
- package/dist/form/components/StorageUploadProgress.d.ts +6 -1
- package/dist/form/form_utils.d.ts +8 -0
- package/dist/form/index.d.ts +5 -2
- package/dist/{history-BO6VT85a.js → history-B3cqBzEV.js} +2 -2
- package/dist/{history-BO6VT85a.js.map → history-B3cqBzEV.js.map} +1 -1
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +1 -1
- package/dist/hooks/navigation/useAsyncResolver.d.ts +26 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +2 -0
- package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -1
- package/dist/hooks/navigation/utils.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -2
- package/dist/preview/components/StorageThumbnail.d.ts +3 -1
- package/dist/routes/CustomViewRoute.d.ts +2 -1
- package/dist/{src-BYniefVu.js → src-cxV1ODRG.js} +1731 -1710
- package/dist/src-cxV1ODRG.js.map +1 -0
- package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
- package/dist/types/components/EntityFormProps.d.ts +59 -0
- package/dist/types/components/PropertyPreviewProps.d.ts +2 -1
- package/dist/types/fields.d.ts +10 -7
- package/dist/util/dataControllerAdapter.d.ts +30 -0
- package/dist/util/navigation_utils.d.ts +1 -1
- package/dist/util/propertyConfigMapper.d.ts +17 -0
- package/package.json +8 -8
- package/src/collection_editor/_cms_internals.ts +1 -1
- package/src/collection_editor/api/generateCollectionApi.ts +3 -2
- package/src/collection_editor/extensibility_types.ts +168 -0
- package/src/collection_editor/index.ts +46 -0
- package/src/collection_editor/pgColumnToProperty.ts +2 -2
- package/src/collection_editor/serializable_types.ts +474 -0
- package/src/collection_editor/serializable_utils.ts +576 -0
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +6 -6
- package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +170 -89
- package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +95 -78
- package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +23 -20
- package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +79 -27
- package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +9 -7
- package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +22 -5
- package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +154 -18
- package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +6 -6
- package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +1 -0
- package/src/collection_editor/ui/collection_editor/RouterCollectionStudioView.tsx +44 -0
- package/src/collection_editor/ui/collection_editor/RouterCollectionsStudioView.tsx +41 -0
- package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +4 -3
- package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +35 -1
- package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +1 -1
- package/src/collection_editor/ui/collection_editor/utils/supported_fields.tsx +0 -1
- package/src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts +7 -29
- package/src/collection_editor/useJsonCollectionsConfigController.tsx +286 -0
- package/src/collection_editor/useSafeSnackbarController.ts +9 -0
- package/src/collection_editor_ui.ts +6 -0
- package/src/components/DefaultDrawer.tsx +14 -4
- package/src/components/DrawerNavigationGroup.tsx +2 -2
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +11 -9
- package/src/components/EntityCollectionTable/fields/TableMultipleRelationField.tsx +2 -1
- package/src/components/EntityCollectionTable/fields/TableRelationField.tsx +2 -1
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +23 -20
- package/src/components/EntityCollectionTable/index.tsx +1 -1
- package/src/components/EntityCollectionTable/table_bindings.tsx +24 -44
- package/src/components/EntityCollectionView/EntityBoardCard.tsx +6 -6
- package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +13 -12
- package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +40 -190
- package/src/components/EntityCollectionView/EntityCollectionListView.tsx +66 -184
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +8 -25
- package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +1 -1
- package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +6 -6
- package/src/components/EntityCollectionView/useBoardDataController.tsx +12 -40
- package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +3 -3
- package/src/components/EntityDetailView.tsx +2 -2
- package/src/components/EntityEditView.tsx +7 -6
- package/src/components/EntityEditViewFormActions.tsx +35 -29
- package/src/components/HomePage/ContentHomePage.tsx +14 -5
- package/src/components/RebaseCMS.tsx +3 -3
- package/src/components/RebaseNavigation.tsx +74 -9
- package/src/components/RelationSelector.tsx +2 -2
- package/src/components/SelectableTable/SelectableTable.tsx +13 -5
- package/src/components/SelectableTable/SelectionStore.ts +18 -48
- package/src/components/SideDialogs.tsx +0 -7
- package/src/components/common/default_entity_actions.tsx +22 -11
- package/src/components/field_configs.tsx +0 -14
- package/src/contexts/BreacrumbsContext.tsx +15 -6
- package/src/editor/editor.tsx +4 -7
- package/src/editor/selectors/ai-selector.tsx +0 -1
- package/src/form/EntityForm.tsx +191 -428
- package/src/form/EntityFormActions.tsx +35 -49
- package/src/form/EntityFormBinding.tsx +323 -0
- package/src/form/components/FormLayout.tsx +1 -1
- package/src/form/components/StorageUploadProgress.tsx +9 -2
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +12 -1
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +4 -4
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +7 -2
- package/src/form/field_bindings/RelationFieldBinding.tsx +5 -7
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +19 -15
- package/src/form/form_utils.ts +163 -0
- package/src/form/index.tsx +14 -6
- package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +2 -2
- package/src/hooks/navigation/contexts/NavigationStateContext.tsx +2 -2
- package/src/hooks/navigation/contexts/UrlContext.tsx +1 -2
- package/src/hooks/navigation/useAsyncResolver.ts +100 -0
- package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +15 -8
- package/src/hooks/navigation/useBuildNavigationStateController.tsx +12 -8
- package/src/hooks/navigation/useNavigationResolution.ts +33 -0
- package/src/hooks/navigation/useResolvedCollections.ts +29 -71
- package/src/hooks/navigation/useResolvedViews.tsx +40 -70
- package/src/hooks/navigation/useTopLevelNavigation.ts +20 -16
- package/src/hooks/navigation/utils.ts +7 -4
- package/src/index.ts +6 -1
- package/src/preview/PropertyPreview.tsx +1 -16
- package/src/preview/components/StorageThumbnail.tsx +24 -7
- package/src/routes/CustomViewRoute.tsx +14 -6
- package/src/types/components/EntityFormActionsProps.tsx +1 -1
- package/src/types/components/EntityFormProps.tsx +68 -0
- package/src/types/components/PropertyPreviewProps.tsx +1 -1
- package/src/types/fields.tsx +9 -8
- package/src/util/dataControllerAdapter.ts +93 -0
- package/src/util/navigation_utils.ts +1 -1
- package/src/util/previews.ts +20 -0
- package/src/util/propertyConfigMapper.ts +134 -0
- package/src/util/property_utils.tsx +1 -2
- package/dist/CollectionEditorDialog-HNXGxXdO.js.map +0 -1
- package/dist/CollectionsStudioView-B1mN33GB.js.map +0 -1
- package/dist/PropertyEditView-C2wp8kQ9.js.map +0 -1
- package/dist/components/EntityCollectionTable/fields/VirtualTableDateField.d.ts +0 -12
- package/dist/components/EntityCollectionTable/fields/VirtualTableInput.d.ts +0 -10
- package/dist/components/EntityCollectionTable/fields/VirtualTableNumberInput.d.ts +0 -9
- package/dist/components/EntityCollectionTable/fields/VirtualTableSwitch.d.ts +0 -8
- package/dist/components/EntityCollectionView/Board.d.ts +0 -3
- package/dist/components/EntityCollectionView/BoardColumn.d.ts +0 -42
- package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +0 -9
- package/dist/components/EntityCollectionView/BoardSortableList.d.ts +0 -14
- package/dist/components/EntityCollectionView/board_types.d.ts +0 -105
- package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +0 -11
- package/dist/hooks/navigation/useNavigationRegistry.d.ts +0 -12
- package/dist/hooks/navigation/useNavigationURLs.d.ts +0 -11
- package/dist/src-BYniefVu.js.map +0 -1
- package/src/components/EntityCollectionTable/fields/VirtualTableDateField.tsx +0 -39
- package/src/components/EntityCollectionTable/fields/VirtualTableInput.tsx +0 -90
- package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +0 -83
- package/src/components/EntityCollectionTable/fields/VirtualTableSwitch.tsx +0 -32
- package/src/components/EntityCollectionView/Board.tsx +0 -475
- package/src/components/EntityCollectionView/BoardColumn.tsx +0 -165
- package/src/components/EntityCollectionView/BoardColumnTitle.tsx +0 -46
- package/src/components/EntityCollectionView/BoardSortableList.tsx +0 -177
- package/src/components/EntityCollectionView/board_types.ts +0 -113
- package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +0 -141
- package/src/hooks/navigation/useNavigationRegistry.ts +0 -164
- package/src/hooks/navigation/useNavigationURLs.ts +0 -56
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { cls, DateTimeField, focusedDisabled } from "@rebasepro/ui";
|
|
3
|
-
import { useCustomizationController } from "@rebasepro/core";
|
|
4
|
-
|
|
5
|
-
export function VirtualTableDateField(props: {
|
|
6
|
-
name: string;
|
|
7
|
-
error: Error | undefined;
|
|
8
|
-
mode?: "date" | "date_time";
|
|
9
|
-
timezone?: string;
|
|
10
|
-
internalValue: Date | undefined | null;
|
|
11
|
-
updateValue: (newValue: (Date | null)) => void;
|
|
12
|
-
focused: boolean;
|
|
13
|
-
disabled: boolean;
|
|
14
|
-
onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
15
|
-
}) {
|
|
16
|
-
|
|
17
|
-
const { locale } = useCustomizationController();
|
|
18
|
-
const {
|
|
19
|
-
disabled,
|
|
20
|
-
error,
|
|
21
|
-
mode,
|
|
22
|
-
timezone,
|
|
23
|
-
internalValue,
|
|
24
|
-
updateValue
|
|
25
|
-
} = props;
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<DateTimeField
|
|
29
|
-
value={internalValue ?? undefined}
|
|
30
|
-
onChange={(dateValue) => updateValue(dateValue ?? null)}
|
|
31
|
-
invisible={true}
|
|
32
|
-
inputClassName={cls("w-full h-full", focusedDisabled)}
|
|
33
|
-
className={cls("w-full h-full", focusedDisabled)}
|
|
34
|
-
mode={mode}
|
|
35
|
-
timezone={timezone}
|
|
36
|
-
locale={locale}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { useDebouncedCallback, focusedDisabled, TextareaAutosize } from "@rebasepro/ui";
|
|
4
|
-
|
|
5
|
-
export function VirtualTableInput(props: {
|
|
6
|
-
error: Error | undefined;
|
|
7
|
-
value: string;
|
|
8
|
-
multiline: boolean;
|
|
9
|
-
focused: boolean;
|
|
10
|
-
disabled: boolean;
|
|
11
|
-
updateValue: (newValue: (string | null)) => void;
|
|
12
|
-
onBlur?: () => void;
|
|
13
|
-
}) {
|
|
14
|
-
|
|
15
|
-
const ref = React.useRef<HTMLTextAreaElement>(null);
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
disabled,
|
|
19
|
-
value,
|
|
20
|
-
multiline,
|
|
21
|
-
updateValue,
|
|
22
|
-
focused
|
|
23
|
-
} = props;
|
|
24
|
-
|
|
25
|
-
const prevValue = useRef<string | null>(value);
|
|
26
|
-
|
|
27
|
-
const [internalValue, setInternalValue] = useState<typeof value>(value);
|
|
28
|
-
const focusedState = useRef<boolean>(false);
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (prevValue.current !== value && value !== internalValue)
|
|
32
|
-
setInternalValue(value);
|
|
33
|
-
prevValue.current = value;
|
|
34
|
-
}, [value]);
|
|
35
|
-
|
|
36
|
-
const doUpdate = React.useCallback(() => {
|
|
37
|
-
const emptyInitialValue = !value;
|
|
38
|
-
if (emptyInitialValue && !internalValue)
|
|
39
|
-
return;
|
|
40
|
-
if (internalValue !== value && internalValue !== prevValue.current) {
|
|
41
|
-
prevValue.current = internalValue;
|
|
42
|
-
updateValue(internalValue);
|
|
43
|
-
}
|
|
44
|
-
}, [internalValue, updateValue, value]);
|
|
45
|
-
useDebouncedCallback(internalValue, doUpdate, !focused, 400);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (ref.current && focused && !focusedState.current) {
|
|
48
|
-
focusedState.current = true;
|
|
49
|
-
ref.current.focus({ preventScroll: true });
|
|
50
|
-
ref.current.selectionStart = ref.current.value.length;
|
|
51
|
-
ref.current.selectionEnd = ref.current.value.length;
|
|
52
|
-
} else {
|
|
53
|
-
focusedState.current = focused;
|
|
54
|
-
}
|
|
55
|
-
}, [focused, ref]);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<TextareaAutosize
|
|
59
|
-
className={focusedDisabled}
|
|
60
|
-
ref={ref}
|
|
61
|
-
style={{
|
|
62
|
-
padding: 0,
|
|
63
|
-
margin: 0,
|
|
64
|
-
width: "100%",
|
|
65
|
-
color: "unset",
|
|
66
|
-
fontWeight: "unset",
|
|
67
|
-
fontSize: "unset",
|
|
68
|
-
fontFamily: "unset",
|
|
69
|
-
background: "unset",
|
|
70
|
-
border: "unset",
|
|
71
|
-
resize: "none",
|
|
72
|
-
outline: "none"
|
|
73
|
-
}}
|
|
74
|
-
value={internalValue ?? ""}
|
|
75
|
-
onChange={(evt) => {
|
|
76
|
-
const newValue = evt.target.value as string;
|
|
77
|
-
if (multiline || !newValue.endsWith("\n"))
|
|
78
|
-
setInternalValue(newValue);
|
|
79
|
-
}}
|
|
80
|
-
onFocus={() => {
|
|
81
|
-
focusedState.current = true;
|
|
82
|
-
}}
|
|
83
|
-
onBlur={() => {
|
|
84
|
-
focusedState.current = false;
|
|
85
|
-
doUpdate();
|
|
86
|
-
if (props.onBlur) props.onBlur();
|
|
87
|
-
}}
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
-
import { useDebouncedCallback, cls, focusedDisabled, TextField } from "@rebasepro/ui";
|
|
3
|
-
|
|
4
|
-
export function VirtualTableNumberInput(props: {
|
|
5
|
-
error: Error | undefined;
|
|
6
|
-
value: number;
|
|
7
|
-
align: "right" | "left" | "center";
|
|
8
|
-
updateValue: (newValue: (number | null)) => void;
|
|
9
|
-
focused: boolean;
|
|
10
|
-
disabled: boolean;
|
|
11
|
-
}) {
|
|
12
|
-
|
|
13
|
-
const {
|
|
14
|
-
align,
|
|
15
|
-
value,
|
|
16
|
-
updateValue,
|
|
17
|
-
focused
|
|
18
|
-
} = props;
|
|
19
|
-
const propStringValue = (value && typeof value === "number") ? value.toString() : "";
|
|
20
|
-
const [internalValue, setInternalValue] = useState<string | null>(propStringValue);
|
|
21
|
-
|
|
22
|
-
const prevValue = useRef<number | null>(value);
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (prevValue.current !== value && String(value) !== internalValue)
|
|
26
|
-
setInternalValue(value ? value.toString() : null);
|
|
27
|
-
prevValue.current = value;
|
|
28
|
-
}, [value]);
|
|
29
|
-
|
|
30
|
-
const doUpdate = React.useCallback(() => {
|
|
31
|
-
if (internalValue !== propStringValue) {
|
|
32
|
-
if (internalValue !== undefined && internalValue !== null) {
|
|
33
|
-
const numberValue = parseFloat(internalValue);
|
|
34
|
-
if (isNaN(numberValue))
|
|
35
|
-
return;
|
|
36
|
-
if (numberValue !== undefined && numberValue !== null)
|
|
37
|
-
updateValue(numberValue);
|
|
38
|
-
} else {
|
|
39
|
-
updateValue(null);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}, [internalValue, value]);
|
|
44
|
-
useDebouncedCallback(internalValue, doUpdate, !focused, 400);
|
|
45
|
-
useEffect(
|
|
46
|
-
() => {
|
|
47
|
-
if (!focused && propStringValue !== internalValue)
|
|
48
|
-
setInternalValue(value !== undefined && value !== null ? value.toString() : null);
|
|
49
|
-
},
|
|
50
|
-
[value, focused]
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
54
|
-
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (inputRef.current && focused) {
|
|
57
|
-
inputRef.current.focus({ preventScroll: true });
|
|
58
|
-
}
|
|
59
|
-
}, [focused, inputRef]);
|
|
60
|
-
|
|
61
|
-
const regexp = /^-?[0-9]+[,.]?[0-9]*$/;
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<TextField
|
|
65
|
-
inputRef={inputRef}
|
|
66
|
-
invisible={true}
|
|
67
|
-
size="small"
|
|
68
|
-
className="w-full"
|
|
69
|
-
inputClassName={cls("p-0 m-0 bg-transparent border-none outline-hidden font-normal leading-normal text-unset", focusedDisabled)}
|
|
70
|
-
inputStyle={{
|
|
71
|
-
textAlign: align
|
|
72
|
-
}}
|
|
73
|
-
value={internalValue ?? ""}
|
|
74
|
-
onChange={(evt) => {
|
|
75
|
-
const newValue = evt.target.value.replace(",", ".");
|
|
76
|
-
if (newValue.length === 0)
|
|
77
|
-
setInternalValue(null);
|
|
78
|
-
if (regexp.test(newValue) || newValue.startsWith("-"))
|
|
79
|
-
setInternalValue(newValue);
|
|
80
|
-
}}
|
|
81
|
-
/>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from "react";
|
|
2
|
-
import { BooleanSwitch } from "@rebasepro/ui";
|
|
3
|
-
|
|
4
|
-
export function VirtualTableSwitch(props: {
|
|
5
|
-
error: Error | undefined;
|
|
6
|
-
internalValue?: boolean;
|
|
7
|
-
focused: boolean;
|
|
8
|
-
disabled: boolean;
|
|
9
|
-
updateValue: (newValue: (boolean | null)) => void;
|
|
10
|
-
}) {
|
|
11
|
-
const {
|
|
12
|
-
internalValue,
|
|
13
|
-
updateValue,
|
|
14
|
-
focused
|
|
15
|
-
} = props;
|
|
16
|
-
const ref = React.useRef<HTMLButtonElement>(null);
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (ref.current && focused) {
|
|
20
|
-
ref.current.focus({ preventScroll: true });
|
|
21
|
-
}
|
|
22
|
-
}, [focused, ref]);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<BooleanSwitch
|
|
26
|
-
ref={ref}
|
|
27
|
-
size={"small"}
|
|
28
|
-
value={Boolean(internalValue)}
|
|
29
|
-
onValueChange={updateValue}
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
}
|