@onehat/ui 0.4.70 → 0.4.72
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/package.json +2 -1
- package/src/Components/Accordion/Accordion.js +1 -0
- package/src/Components/Blank.js +1 -0
- package/src/Components/Buttons/BackButton.js +1 -0
- package/src/Components/Buttons/Button.js +18 -10
- package/src/Components/Buttons/CartButtonWithBadge.js +1 -0
- package/src/Components/Buttons/IconButton.js +9 -8
- package/src/Components/Buttons/PlusMinusButton.js +5 -4
- package/src/Components/Buttons/SquareButton.js +19 -18
- package/src/Components/Container/Container.js +1 -0
- package/src/Components/Container/ContainerColumn.js +4 -3
- package/src/Components/Container/ScreenContainer.js +14 -13
- package/src/Components/Container/Splitter.js +33 -28
- package/src/Components/Editor/InlineEditor.js +32 -30
- package/src/Components/Fab/DynamicFab.js +14 -13
- package/src/Components/Fab/FabWithTooltip.js +1 -0
- package/src/Components/Filter/DateRange.js +8 -7
- package/src/Components/Filter/NumberRange.js +8 -7
- package/src/Components/Form/Field/CKEditor/CKEditor.js +1 -0
- package/src/Components/Form/Field/Checkbox/CheckboxGroup.js +1 -0
- package/src/Components/Form/Field/Color.js +41 -40
- package/src/Components/Form/Field/Combo/Combo.js +173 -172
- package/src/Components/Form/Field/Combo/MeterTypesCombo.js +4 -2
- package/src/Components/Form/Field/Combo/PageSizeCombo.js +1 -0
- package/src/Components/Form/Field/Date.js +117 -116
- package/src/Components/Form/Field/DisplayField.js +6 -5
- package/src/Components/Form/Field/File.js +1 -0
- package/src/Components/Form/Field/FormikForm.js +1 -0
- package/src/Components/Form/Field/Input.js +20 -18
- package/src/Components/Form/Field/Json.js +7 -6
- package/src/Components/Form/Field/Number.js +31 -30
- package/src/Components/Form/Field/RadioGroup/RadioGroup.js +1 -0
- package/src/Components/Form/Field/Select/PageSizeSelect.js +1 -0
- package/src/Components/Form/Field/Select/Select.js +9 -8
- package/src/Components/Form/Field/Slider.js +15 -14
- package/src/Components/Form/Field/Tag/Tag.js +25 -24
- package/src/Components/Form/Field/Tag/ValueBox.js +32 -31
- package/src/Components/Form/Field/Text.js +9 -8
- package/src/Components/Form/Field/TextArea.js +9 -8
- package/src/Components/Form/Field/Toggle.js +16 -15
- package/src/Components/Form/FieldSet.js +27 -26
- package/src/Components/Form/Form.js +104 -103
- package/src/Components/Form/Label.js +15 -14
- package/src/Components/Grid/Grid.js +62 -52
- package/src/Components/Grid/GridHeaderRow.js +42 -40
- package/src/Components/Grid/GridRow.js +92 -90
- package/src/Components/Grid/HeaderColumnSelectorHandle.js +9 -8
- package/src/Components/Grid/HeaderReorderHandle.js +9 -8
- package/src/Components/Grid/HeaderResizeHandle.js +9 -8
- package/src/Components/Grid/NoRecordsFound.js +4 -3
- package/src/Components/Grid/RowDragHandle.js +26 -10
- package/src/Components/Grid/RowHandle.js +55 -0
- package/src/Components/Grid/RowSelectHandle.js +1 -0
- package/src/{Hooks → Components/Grid}/useAsyncRenderers.js +1 -1
- package/src/Components/Hoc/Secondary/withSecondaryData.js +2 -1
- package/src/Components/Hoc/Secondary/withSecondaryEditor.js +4 -3
- package/src/Components/Hoc/Secondary/withSecondarySelection.js +3 -2
- package/src/Components/Hoc/Secondary/withSecondaryValue.js +2 -1
- package/src/Components/Hoc/Secondary/withSecondaryWindowedEditor.js +6 -5
- package/src/Components/Hoc/withAlert.js +38 -35
- package/src/Components/Hoc/withCollapsible.js +9 -4
- package/src/Components/Hoc/withComponent.js +6 -0
- package/src/Components/Hoc/withContextMenu.js +33 -26
- package/src/Components/Hoc/withData.js +3 -2
- package/src/Components/Hoc/withDnd.js +17 -8
- package/src/Components/Hoc/withDraggable.js +21 -5
- package/src/Components/Hoc/withEditor.js +3 -2
- package/src/Components/Hoc/withEvents.js +11 -1
- package/src/Components/Hoc/withFilters.js +26 -20
- package/src/Components/Hoc/withModal.js +10 -8
- package/src/Components/Hoc/withPdfButtons.js +3 -2
- package/src/Components/Hoc/withPermissions.js +3 -2
- package/src/Components/Hoc/withPresetButtons.js +3 -2
- package/src/Components/Hoc/withSelection.js +2 -8
- package/src/Components/Hoc/withToast.js +5 -2
- package/src/Components/Hoc/withTooltip.js +10 -1
- package/src/Components/Hoc/withValue.js +3 -9
- package/src/Components/Hoc/withWindowedEditor.js +6 -5
- package/src/Components/Layout/AsyncOperation.js +1 -0
- package/src/Components/Layout/CenterBox.js +9 -8
- package/src/Components/Layout/Footer.js +11 -10
- package/src/Components/Layout/ScreenHeader.js +5 -4
- package/src/Components/Layout/TextWithTooltip.js +1 -0
- package/src/Components/Messages/ConfirmationMessage.js +6 -5
- package/src/Components/Messages/ErrorMessage.js +40 -39
- package/src/Components/Messages/GlobalModals.js +47 -0
- package/src/Components/Messages/Loading.js +1 -0
- package/src/Components/Messages/OkMessage.js +11 -10
- package/src/Components/Messages/Unauthorized.js +1 -0
- package/src/Components/Messages/WaitMessage.js +16 -15
- package/src/Components/Panel/AccordionGridPanel.js +1 -0
- package/src/Components/Panel/FormPanel.js +1 -0
- package/src/Components/Panel/Header.js +59 -58
- package/src/Components/Panel/Mask.js +1 -0
- package/src/Components/Panel/Panel.js +7 -6
- package/src/Components/Picker/Picker.js +1 -0
- package/src/Components/Report/Report.js +35 -34
- package/src/Components/Screens/Manager.js +1 -0
- package/src/Components/Screens/ReportsManager.js +1 -0
- package/src/Components/Tab/Tab.js +1 -0
- package/src/Components/Tab/TabBar.js +67 -66
- package/src/Components/Toolbar/FilterToolbar.js +14 -11
- package/src/Components/Toolbar/Pagination.js +26 -25
- package/src/Components/Toolbar/PaginationToolbar.js +13 -12
- package/src/Components/Toolbar/Toolbar.js +13 -12
- package/src/Components/Tooltip/Tooltip.js +1 -0
- package/src/Components/Tree/Tree.js +34 -17
- package/src/Components/Tree/TreeNode.js +30 -29
- package/src/Components/Tree/TreeNodeDragHandle.js +18 -13
- package/src/Components/Viewer/MeterTypeText.js +29 -8
- package/src/Components/Viewer/TextWithLinks.js +16 -15
- package/src/Components/Viewer/Viewer.js +23 -22
- package/src/Components/Window/UploadsDownloadsWindow.js +6 -5
- package/src/Components/index.js +1 -0
- package/src/Constants/MeterTypes.js +2 -0
- package/src/Functions/addIconProps.js +46 -0
- package/src/Functions/testProps.js +1 -1
- package/src/Hooks/useWhyDidYouUpdate.js +33 -0
- package/src/PlatformImports/Web/Attachments.js +1 -1
- package/src/Components/Hoc/withBlank.js +0 -10
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
Icon,
|
|
3
3
|
Pressable,
|
|
4
4
|
} from '@project-components/Gluestack';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import Gear from '../Icons/Gear.js';
|
|
6
7
|
import _ from 'lodash';
|
|
7
8
|
|
|
@@ -13,14 +14,14 @@ export default function HeaderColumnSelectorHandle(props) {
|
|
|
13
14
|
_hover={{ bg: 'grey-200' }}
|
|
14
15
|
_pressed={{ bg: 'grey-300' }}
|
|
15
16
|
onPress={showColumnsSelector}
|
|
16
|
-
className={
|
|
17
|
-
HeaderColumnSelectorHandle
|
|
18
|
-
bg-grey-100
|
|
19
|
-
h-full
|
|
20
|
-
w-3
|
|
21
|
-
items-center
|
|
22
|
-
justify-center
|
|
23
|
-
|
|
17
|
+
className={clsx(
|
|
18
|
+
'HeaderColumnSelectorHandle',
|
|
19
|
+
'bg-grey-100',
|
|
20
|
+
'h-full',
|
|
21
|
+
'w-3',
|
|
22
|
+
'items-center',
|
|
23
|
+
'justify-center',
|
|
24
|
+
)}
|
|
24
25
|
>
|
|
25
26
|
<Icon
|
|
26
27
|
as={Gear}
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
Icon,
|
|
3
3
|
VStack,
|
|
4
4
|
} from '@project-components/Gluestack';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import styles from '../../Styles/StyleSheets.js';
|
|
6
7
|
import withDraggable from '../Hoc/withDraggable.js';
|
|
7
8
|
import GripVertical from '../Icons/GripVertical.js';
|
|
@@ -13,14 +14,14 @@ function HeaderReorderHandle(props) {
|
|
|
13
14
|
|
|
14
15
|
return <VStack
|
|
15
16
|
style={styles.ewResize}
|
|
16
|
-
className={
|
|
17
|
-
HeaderReorderHandle
|
|
18
|
-
h-full
|
|
19
|
-
w-3
|
|
20
|
-
items-center
|
|
21
|
-
justify-center
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
className={clsx(
|
|
18
|
+
'HeaderReorderHandle',
|
|
19
|
+
'h-full',
|
|
20
|
+
'w-3',
|
|
21
|
+
'items-center',
|
|
22
|
+
'justify-center',
|
|
23
|
+
isDragging ? 'bg-grey-300' : 'bg-grey-100',
|
|
24
|
+
)}
|
|
24
25
|
>
|
|
25
26
|
<Icon
|
|
26
27
|
as={GripVertical}
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
Icon,
|
|
3
3
|
VStack,
|
|
4
4
|
} from '@project-components/Gluestack';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import styles from '../../Styles/StyleSheets.js';
|
|
6
7
|
import withDraggable from '../Hoc/withDraggable.js';
|
|
7
8
|
import GripLinesVertical from '../Icons/GripLinesVertical.js';
|
|
@@ -13,14 +14,14 @@ function HeaderResizeHandle(props) {
|
|
|
13
14
|
|
|
14
15
|
return <VStack
|
|
15
16
|
style={styles.ewResize}
|
|
16
|
-
className={
|
|
17
|
-
HeaderResizeHandle
|
|
18
|
-
h-full
|
|
19
|
-
w-3
|
|
20
|
-
items-center
|
|
21
|
-
justify-center
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
className={clsx(
|
|
18
|
+
'HeaderResizeHandle',
|
|
19
|
+
'h-full',
|
|
20
|
+
'w-3',
|
|
21
|
+
'items-center',
|
|
22
|
+
'justify-center',
|
|
23
|
+
isDragging ? 'bg-grey-300' : 'bg-grey-100',
|
|
24
|
+
)}
|
|
24
25
|
>
|
|
25
26
|
<Icon
|
|
26
27
|
as={GripLinesVertical}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
Text,
|
|
4
4
|
VStack,
|
|
5
5
|
} from '@project-components/Gluestack';
|
|
6
|
+
import clsx from 'clsx';
|
|
6
7
|
import IconButton from '../Buttons/IconButton.js';
|
|
7
8
|
import Rotate from '../Icons/Rotate.js';
|
|
8
9
|
|
|
@@ -23,9 +24,9 @@ export default function NoRecordsFound(props) {
|
|
|
23
24
|
icon={Rotate}
|
|
24
25
|
_icon={{
|
|
25
26
|
size: 'md',
|
|
26
|
-
className:
|
|
27
|
-
text-grey-400
|
|
28
|
-
|
|
27
|
+
className: clsx(
|
|
28
|
+
'text-grey-400',
|
|
29
|
+
),
|
|
29
30
|
}}
|
|
30
31
|
onPress={onRefresh}
|
|
31
32
|
variant="outline"
|
|
@@ -1,19 +1,35 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
1
2
|
import {
|
|
2
3
|
Icon,
|
|
3
4
|
VStack,
|
|
4
5
|
} from '@project-components/Gluestack';
|
|
6
|
+
import clsx from 'clsx';
|
|
5
7
|
import styles from '../../Styles/StyleSheets.js';
|
|
6
8
|
import GripVertical from '../Icons/GripVertical.js';
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const RowDragHandle = forwardRef(function(props, ref) {
|
|
11
|
+
let className = clsx(
|
|
12
|
+
'RowDragHandle',
|
|
13
|
+
'bg-grey-100',
|
|
14
|
+
'w-[17px]',
|
|
15
|
+
'items-center',
|
|
16
|
+
'justify-center',
|
|
17
|
+
'select-none',
|
|
18
|
+
);
|
|
19
|
+
if (props.className) {
|
|
20
|
+
className += ' ' + props.className;
|
|
21
|
+
}
|
|
22
|
+
return <VStack
|
|
23
|
+
{...props}
|
|
24
|
+
ref={ref}
|
|
25
|
+
style={styles.ewResize}
|
|
26
|
+
className={className}
|
|
27
|
+
>
|
|
28
|
+
<Icon
|
|
29
|
+
as={GripVertical}
|
|
30
|
+
size="xs"
|
|
31
|
+
className="handle w-full h-full text-[#ccc]" />
|
|
32
|
+
</VStack>;
|
|
33
|
+
});
|
|
18
34
|
|
|
19
35
|
export default RowDragHandle;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Icon,
|
|
4
|
+
VStack,
|
|
5
|
+
} from '@project-components/Gluestack';
|
|
6
|
+
import withTooltip from '@onehat/ui/src/Components/Hoc/withTooltip';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import Arcs from '../Icons/Arcs.js';
|
|
9
|
+
|
|
10
|
+
const RowHandle = forwardRef(function RowHandle(props, ref) {
|
|
11
|
+
const {
|
|
12
|
+
isDragSource,
|
|
13
|
+
isDraggable
|
|
14
|
+
} = props;
|
|
15
|
+
let className = clsx(
|
|
16
|
+
'RowHandle',
|
|
17
|
+
'h-full',
|
|
18
|
+
'w-[40px]',
|
|
19
|
+
'px-2',
|
|
20
|
+
'items-center',
|
|
21
|
+
'justify-center',
|
|
22
|
+
'select-none',
|
|
23
|
+
'cursor-pointer'
|
|
24
|
+
);
|
|
25
|
+
return <VStack
|
|
26
|
+
ref={isDragSource || isDraggable ? ref : undefined}
|
|
27
|
+
className={className}
|
|
28
|
+
>
|
|
29
|
+
<Icon as={Arcs} size="xs" className="w-full h-full text-[#ddd]" />
|
|
30
|
+
</VStack>;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
function withAdditionalProps(WrappedComponent) {
|
|
34
|
+
return (props) => {
|
|
35
|
+
const {
|
|
36
|
+
showSelectHandle,
|
|
37
|
+
isDragSource,
|
|
38
|
+
isDraggable
|
|
39
|
+
} = props;
|
|
40
|
+
let tooltipParts = [];
|
|
41
|
+
if (showSelectHandle) {
|
|
42
|
+
tooltipParts.push('Select');
|
|
43
|
+
}
|
|
44
|
+
if (isDragSource || isDraggable) {
|
|
45
|
+
tooltipParts.push('Drag');
|
|
46
|
+
}
|
|
47
|
+
const tooltip = tooltipParts.length === 2 ? tooltipParts.join(' or ') : tooltipParts[0];
|
|
48
|
+
return <WrappedComponent
|
|
49
|
+
tooltip={tooltip}
|
|
50
|
+
{...props}
|
|
51
|
+
/>;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default withAdditionalProps(withTooltip(RowHandle));
|
|
@@ -7,7 +7,7 @@ export default function useAsyncRenderers(columnsConfig, item) {
|
|
|
7
7
|
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
const asyncConfigs = columnsConfig.filter(config =>
|
|
10
|
-
config.renderer && typeof config.renderer === 'function'
|
|
10
|
+
config.isAsync && config.renderer && typeof config.renderer === 'function'
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
if (asyncConfigs.length === 0) {
|
|
@@ -8,7 +8,7 @@ import _ from 'lodash';
|
|
|
8
8
|
export default function withSecondaryData(WrappedComponent) {
|
|
9
9
|
return (props) => {
|
|
10
10
|
|
|
11
|
-
if (props.secondaryDisableWithData) {
|
|
11
|
+
if (props.secondaryDisableWithData || props.secondaryAlreadyHasWithData) {
|
|
12
12
|
return <WrappedComponent {...props} />;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -104,6 +104,7 @@ export default function withSecondaryData(WrappedComponent) {
|
|
|
104
104
|
return <WrappedComponent
|
|
105
105
|
{...propsToPass}
|
|
106
106
|
secondaryDisableWithData={false}
|
|
107
|
+
secondaryAlreadyHasWithData={true}
|
|
107
108
|
SecondaryRepository={LocalSecondaryRepository}
|
|
108
109
|
secondaryModel={secondaryModel}
|
|
109
110
|
secondaryData={secondaryData}
|
|
@@ -24,7 +24,7 @@ import _ from 'lodash';
|
|
|
24
24
|
export default function withSecondaryEditor(WrappedComponent, isTree = false) {
|
|
25
25
|
return forwardRef((props, ref) => {
|
|
26
26
|
|
|
27
|
-
if (props.secondaryDisableWithEditor) {
|
|
27
|
+
if (props.secondaryDisableWithEditor || props.secondaryAlreadyHasWithEditor) {
|
|
28
28
|
return <WrappedComponent {...props} ref={ref} isTree={isTree} />;
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -169,7 +169,7 @@ export default function withSecondaryEditor(WrappedComponent, isTree = false) {
|
|
|
169
169
|
if (secondaryDefaultValues) {
|
|
170
170
|
_.merge(defaultValuesToUse, secondaryDefaultValues);
|
|
171
171
|
}
|
|
172
|
-
addValues =
|
|
172
|
+
addValues = {...defaultValuesToUse};
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
if (secondarySelectorId && !_.isEmpty(secondarySelectorSelected)) {
|
|
@@ -643,8 +643,9 @@ export default function withSecondaryEditor(WrappedComponent, isTree = false) {
|
|
|
643
643
|
|
|
644
644
|
return <WrappedComponent
|
|
645
645
|
{...props}
|
|
646
|
-
ref={ref}
|
|
647
646
|
secondaryDisableWithEditor={false}
|
|
647
|
+
secondaryAlreadyHasWithEditor={true}
|
|
648
|
+
ref={ref}
|
|
648
649
|
secondaryCurrentRecord={secondaryCurrentRecord}
|
|
649
650
|
secondarySetCurrentRecord={secondarySetCurrentRecord}
|
|
650
651
|
secondaryIsEditorShown={secondaryIsEditorShown}
|
|
@@ -14,7 +14,7 @@ import _ from 'lodash';
|
|
|
14
14
|
export default function withSelection(WrappedComponent) {
|
|
15
15
|
return forwardRef((props, ref) => {
|
|
16
16
|
|
|
17
|
-
if (props.secondaryDisableWithSelection) {
|
|
17
|
+
if (props.secondaryDisableWithSelection || props.secondaryAlreadyHasWithSelection) {
|
|
18
18
|
return <WrappedComponent {...props} />;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -414,8 +414,9 @@ export default function withSelection(WrappedComponent) {
|
|
|
414
414
|
|
|
415
415
|
return <WrappedComponent
|
|
416
416
|
{...props}
|
|
417
|
-
ref={ref}
|
|
418
417
|
secondaryDisableWithSelection={false}
|
|
418
|
+
secondaryAlreadyHasWithSelection={true}
|
|
419
|
+
ref={ref}
|
|
419
420
|
secondarySelection={secondaryGetSelection()}
|
|
420
421
|
secondaryGetSelection={secondaryGetSelection}
|
|
421
422
|
secondarySetSelection={secondarySetSelection}
|
|
@@ -10,7 +10,7 @@ import _ from 'lodash';
|
|
|
10
10
|
export default function withSecondaryValue(WrappedComponent) {
|
|
11
11
|
return (props) => {
|
|
12
12
|
|
|
13
|
-
if (props.secondaryDisableWithValue) {
|
|
13
|
+
if (props.secondaryDisableWithValue || props.secondaryAlreadyHasWithValue) {
|
|
14
14
|
return <WrappedComponent {...props} />;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -146,6 +146,7 @@ export default function withSecondaryValue(WrappedComponent) {
|
|
|
146
146
|
return <WrappedComponent
|
|
147
147
|
{...props}
|
|
148
148
|
secondaryDisableWithValue={false}
|
|
149
|
+
secondaryAlreadyHasWithValue={true}
|
|
149
150
|
secondaryValue={convertedValue}
|
|
150
151
|
secondarySetValue={secondarySetValue}
|
|
151
152
|
secondaryOnChangeSelection={secondaryOnChangeSelection}
|
|
@@ -2,6 +2,7 @@ import { forwardRef } from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
Modal, ModalBackdrop, ModalHeader, ModalContent, ModalCloseButton, ModalBody, ModalFooter,
|
|
4
4
|
} from '@project-components/Gluestack';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import {
|
|
6
7
|
EDITOR_TYPE__WINDOWED,
|
|
7
8
|
} from '../../../Constants/Editor.js';
|
|
@@ -82,11 +83,11 @@ export default function withSecondaryWindowedEditor(WrappedComponent, isTree = f
|
|
|
82
83
|
{...secondaryEditorProps}
|
|
83
84
|
parent={self}
|
|
84
85
|
reference="secondaryEditor"
|
|
85
|
-
className={
|
|
86
|
-
bg-white
|
|
87
|
-
shadow-lg
|
|
88
|
-
rounded-lg
|
|
89
|
-
|
|
86
|
+
className={clsx(
|
|
87
|
+
'bg-white',
|
|
88
|
+
'shadow-lg',
|
|
89
|
+
'rounded-lg',
|
|
90
|
+
)}
|
|
90
91
|
/>
|
|
91
92
|
</Modal>}
|
|
92
93
|
</>;
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
Icon,
|
|
6
6
|
Text,
|
|
7
7
|
} from '@project-components/Gluestack';
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
import withModal from './withModal.js';
|
|
9
10
|
import CircleInfo from '../Icons/CircleInfo.js';
|
|
10
11
|
import CircleQuestion from '../Icons/CircleQuestion.js';
|
|
@@ -18,7 +19,7 @@ import _ from 'lodash';
|
|
|
18
19
|
function withAlert(WrappedComponent) {
|
|
19
20
|
return forwardRef((props, ref) => {
|
|
20
21
|
|
|
21
|
-
if (props.disableWithAlert || props.
|
|
22
|
+
if (props.disableWithAlert || props.alreadyHasWithAlert) {
|
|
22
23
|
return <WrappedComponent {...props} ref={ref} />;
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -33,41 +34,41 @@ function withAlert(WrappedComponent) {
|
|
|
33
34
|
color = 'black',
|
|
34
35
|
} = args;
|
|
35
36
|
return <HStack className="withAlert-HStack flex-1 w-full">
|
|
36
|
-
<Box className={
|
|
37
|
-
withAlert-Box1
|
|
38
|
-
h-full
|
|
39
|
-
w-[100px]
|
|
40
|
-
flex
|
|
41
|
-
items-end
|
|
42
|
-
justify-center
|
|
43
|
-
pr-3
|
|
44
|
-
|
|
45
|
-
<Icon as={icon} className={
|
|
46
|
-
withAlert-Icon
|
|
47
|
-
h-[40px]
|
|
48
|
-
w-[40px]
|
|
49
|
-
text-${color}
|
|
50
|
-
|
|
37
|
+
<Box className={clsx(
|
|
38
|
+
'withAlert-Box1',
|
|
39
|
+
'h-full',
|
|
40
|
+
'w-[100px]',
|
|
41
|
+
'flex',
|
|
42
|
+
'items-end',
|
|
43
|
+
'justify-center',
|
|
44
|
+
'pr-3',
|
|
45
|
+
)}>
|
|
46
|
+
<Icon as={icon} className={clsx(
|
|
47
|
+
'withAlert-Icon',
|
|
48
|
+
'h-[40px]',
|
|
49
|
+
'w-[40px]',
|
|
50
|
+
`text-${color}`,
|
|
51
|
+
)} />
|
|
51
52
|
</Box>
|
|
52
|
-
<Box className={
|
|
53
|
-
withAlert-Box2
|
|
54
|
-
h-full
|
|
55
|
-
flex
|
|
56
|
-
flex-1
|
|
57
|
-
items-start
|
|
58
|
-
justify-center
|
|
59
|
-
|
|
60
|
-
<Text className={
|
|
61
|
-
withAlert-Text
|
|
62
|
-
text-${color}
|
|
63
|
-
text-[18px]
|
|
64
|
-
flex-none
|
|
65
|
-
mr-2
|
|
66
|
-
w-full
|
|
67
|
-
break-words
|
|
68
|
-
whitespace-normal
|
|
69
|
-
overflow-wrap-anywhere
|
|
70
|
-
|
|
53
|
+
<Box className={clsx(
|
|
54
|
+
'withAlert-Box2',
|
|
55
|
+
'h-full',
|
|
56
|
+
'flex',
|
|
57
|
+
'flex-1',
|
|
58
|
+
'items-start',
|
|
59
|
+
'justify-center',
|
|
60
|
+
)}>
|
|
61
|
+
<Text className={clsx(
|
|
62
|
+
'withAlert-Text',
|
|
63
|
+
`text-${color}`,
|
|
64
|
+
'text-[18px]',
|
|
65
|
+
'flex-none',
|
|
66
|
+
'mr-2',
|
|
67
|
+
'w-full',
|
|
68
|
+
'break-words',
|
|
69
|
+
'whitespace-normal',
|
|
70
|
+
'overflow-wrap-anywhere',
|
|
71
|
+
)}>{message}</Text>
|
|
71
72
|
</Box>
|
|
72
73
|
</HStack>;
|
|
73
74
|
},
|
|
@@ -169,6 +170,8 @@ function withAlert(WrappedComponent) {
|
|
|
169
170
|
return <WrappedComponent
|
|
170
171
|
{...props}
|
|
171
172
|
ref={ref}
|
|
173
|
+
disableWithAlert={false}
|
|
174
|
+
alreadyHasWithAlert={true}
|
|
172
175
|
alert={onAlert}
|
|
173
176
|
confirm={onConfirm}
|
|
174
177
|
hideAlert={hideModal}
|
|
@@ -2,8 +2,12 @@ import { forwardRef, useState } from 'react';
|
|
|
2
2
|
|
|
3
3
|
export default function withCollapsible(WrappedComponent) {
|
|
4
4
|
return forwardRef((props, ref) => {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
if (props.alreadyHasWithCollapsible) {
|
|
7
|
+
return <WrappedComponent {...props} ref={ref} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const {
|
|
7
11
|
isCollapsed = false,
|
|
8
12
|
startsCollapsed = false,
|
|
9
13
|
setIsCollapsed,
|
|
@@ -12,10 +16,11 @@ export default function withCollapsible(WrappedComponent) {
|
|
|
12
16
|
[localIsCollapsed, setLocalIsCollapsed] = useState(startsCollapsed);
|
|
13
17
|
|
|
14
18
|
return <WrappedComponent
|
|
15
|
-
isCollapsed={bypass ? isCollapsed : localIsCollapsed}
|
|
16
|
-
setIsCollapsed={bypass ? setIsCollapsed : setLocalIsCollapsed}
|
|
17
19
|
{...props}
|
|
20
|
+
alreadyHasWithCollapsible={true}
|
|
18
21
|
ref={ref}
|
|
22
|
+
isCollapsed={bypass ? isCollapsed : localIsCollapsed}
|
|
23
|
+
setIsCollapsed={bypass ? setIsCollapsed : setLocalIsCollapsed}
|
|
19
24
|
/>;
|
|
20
25
|
});
|
|
21
26
|
}
|
|
@@ -14,6 +14,10 @@ import _ from 'lodash';
|
|
|
14
14
|
export default function withComponent(WrappedComponent) {
|
|
15
15
|
return forwardRef((props, ref) => {
|
|
16
16
|
|
|
17
|
+
// if (props.disableWithComponent || props.alreadyHasWithComponent) {
|
|
18
|
+
// return <WrappedComponent {...props} ref={ref} />;
|
|
19
|
+
// }
|
|
20
|
+
|
|
17
21
|
props = _.clone(props); // without cloning, I couldn't write to props
|
|
18
22
|
|
|
19
23
|
// translate h, w, and flex tokens to styles
|
|
@@ -90,6 +94,8 @@ export default function withComponent(WrappedComponent) {
|
|
|
90
94
|
self={selfRef.current}
|
|
91
95
|
{...propsToPass}
|
|
92
96
|
ref={ref}
|
|
97
|
+
disableWithComponent={false}
|
|
98
|
+
// alreadyHasWithComponent={true}
|
|
93
99
|
/>;
|
|
94
100
|
});
|
|
95
101
|
}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
Text,
|
|
4
4
|
VStack,
|
|
5
5
|
} from '@project-components/Gluestack';
|
|
6
|
+
import clsx from 'clsx';
|
|
6
7
|
import UiGlobals from '../../UiGlobals.js';
|
|
7
8
|
import Button from '../Buttons/Button.js';
|
|
8
9
|
import testProps from '../../Functions/testProps.js';
|
|
@@ -10,6 +11,11 @@ import _ from 'lodash';
|
|
|
10
11
|
|
|
11
12
|
export default function withContextMenu(WrappedComponent) {
|
|
12
13
|
return forwardRef((props, ref) => {
|
|
14
|
+
|
|
15
|
+
if (props.alreadyHasWithContextMenu) {
|
|
16
|
+
return <WrappedComponent {...props} ref={ref} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
const {
|
|
14
20
|
// extract and pass
|
|
15
21
|
disableContextMenu = false,
|
|
@@ -63,28 +69,28 @@ export default function withContextMenu(WrappedComponent) {
|
|
|
63
69
|
isDisabled={isDisabled}
|
|
64
70
|
icon={icon}
|
|
65
71
|
_icon={{
|
|
66
|
-
className:
|
|
67
|
-
ml-2
|
|
68
|
-
self-center
|
|
69
|
-
|
|
72
|
+
className: clsx(
|
|
73
|
+
'ml-2',
|
|
74
|
+
'self-center',
|
|
75
|
+
),
|
|
70
76
|
}}
|
|
71
77
|
text={text}
|
|
72
78
|
_text={{
|
|
73
|
-
className:
|
|
74
|
-
flex-1
|
|
75
|
-
select-none
|
|
76
|
-
text-black
|
|
77
|
-
|
|
79
|
+
className: clsx(
|
|
80
|
+
'flex-1',
|
|
81
|
+
'select-none',
|
|
82
|
+
'text-black',
|
|
83
|
+
),
|
|
78
84
|
}}
|
|
79
|
-
className={
|
|
80
|
-
flex-row
|
|
81
|
-
border-b-2
|
|
82
|
-
border-b-grey-200
|
|
83
|
-
py-2
|
|
84
|
-
px-4
|
|
85
|
-
select-none
|
|
86
|
-
rounded-none
|
|
87
|
-
|
|
85
|
+
className={clsx(
|
|
86
|
+
'flex-row',
|
|
87
|
+
'border-b-2',
|
|
88
|
+
'border-b-grey-200',
|
|
89
|
+
'py-2',
|
|
90
|
+
'px-4',
|
|
91
|
+
'select-none',
|
|
92
|
+
'rounded-none',
|
|
93
|
+
)}
|
|
88
94
|
variant="outline"
|
|
89
95
|
action="secondary"
|
|
90
96
|
/>;
|
|
@@ -119,14 +125,14 @@ export default function withContextMenu(WrappedComponent) {
|
|
|
119
125
|
// show context menu
|
|
120
126
|
const
|
|
121
127
|
contextMenuItemComponents = createContextMenuItemComponents(),
|
|
122
|
-
className =
|
|
123
|
-
context-menu-container
|
|
124
|
-
absolute
|
|
125
|
-
border
|
|
126
|
-
border-grey-400
|
|
127
|
-
shadow-lg
|
|
128
|
-
bg-white
|
|
129
|
-
|
|
128
|
+
className = clsx(
|
|
129
|
+
'context-menu-container',
|
|
130
|
+
'absolute',
|
|
131
|
+
'border',
|
|
132
|
+
'border-grey-400',
|
|
133
|
+
'shadow-lg',
|
|
134
|
+
'bg-white',
|
|
135
|
+
),
|
|
130
136
|
screenWidth = window.innerWidth,
|
|
131
137
|
screenHeight = window.innerHeight;
|
|
132
138
|
let l = left,
|
|
@@ -160,6 +166,7 @@ export default function withContextMenu(WrappedComponent) {
|
|
|
160
166
|
|
|
161
167
|
return <WrappedComponent
|
|
162
168
|
{...propsToPass}
|
|
169
|
+
alreadyHasWithContextMenu={true}
|
|
163
170
|
ref={ref}
|
|
164
171
|
onContextMenu={onContextMenu}
|
|
165
172
|
/>;
|
|
@@ -12,7 +12,7 @@ import _ from 'lodash';
|
|
|
12
12
|
export default function withData(WrappedComponent) {
|
|
13
13
|
return forwardRef((props, ref) => {
|
|
14
14
|
|
|
15
|
-
if (props.disableWithData) {
|
|
15
|
+
if (props.disableWithData || props.alreadyHasWithData) {
|
|
16
16
|
return <WrappedComponent {...props} ref={ref} />;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -121,8 +121,9 @@ export default function withData(WrappedComponent) {
|
|
|
121
121
|
|
|
122
122
|
return <WrappedComponent
|
|
123
123
|
{...props}
|
|
124
|
-
ref={ref}
|
|
125
124
|
disableWithData={false}
|
|
125
|
+
alreadyHasWithData={true}
|
|
126
|
+
ref={ref}
|
|
126
127
|
Repository={LocalRepository}
|
|
127
128
|
fields={fields}
|
|
128
129
|
idField={idField}
|