@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
|
@@ -3,6 +3,7 @@ import { useDrag, useDrop, useDragLayer } from 'react-dnd'; // https://react-dnd
|
|
|
3
3
|
import {
|
|
4
4
|
Box,
|
|
5
5
|
} from '@project-components/Gluestack';
|
|
6
|
+
import clsx from 'clsx';
|
|
6
7
|
import {
|
|
7
8
|
UI_MODE_WEB,
|
|
8
9
|
UI_MODE_NATIVE,
|
|
@@ -17,8 +18,8 @@ import {
|
|
|
17
18
|
|
|
18
19
|
export function withDragSource(WrappedComponent) {
|
|
19
20
|
return forwardRef((props, ref) => {
|
|
20
|
-
|
|
21
|
-
if (!props.isDragSource) {
|
|
21
|
+
|
|
22
|
+
if (!props.isDragSource || props.alreadyHasDragSource) {
|
|
22
23
|
return <WrappedComponent {...props} ref={ref} />;
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -36,6 +37,7 @@ export function withDragSource(WrappedComponent) {
|
|
|
36
37
|
dragOptions = null,
|
|
37
38
|
dropEffect = null,
|
|
38
39
|
// onDrag,
|
|
40
|
+
onDragStart = null,
|
|
39
41
|
onDragEnd = null,
|
|
40
42
|
canDrag = null,
|
|
41
43
|
isDragging = null,
|
|
@@ -62,10 +64,15 @@ export function withDragSource(WrappedComponent) {
|
|
|
62
64
|
|
|
63
65
|
return {
|
|
64
66
|
type: dragSourceType, // Required. This must be either a string or a symbol. Only the drop targets registered for the same type will react to this item.
|
|
65
|
-
item: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
item: () => { // Required (object or function). If a function, it runs only once at the start of a drag.
|
|
68
|
+
if (dragSourceItem.onDragStart) {
|
|
69
|
+
dragSourceItem.onDragStart();
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
...dragSourceItem,
|
|
73
|
+
getDragProxy,
|
|
74
|
+
};
|
|
75
|
+
},
|
|
69
76
|
// When an object, it is a plain JavaScript object describing the data being dragged. This is the only information available to the drop targets about the drag source so it's important to pick the minimal data they need to know. You may be tempted to put a complex reference here, but you should try very hard to avoid doing this because it couples the drag sources and drop targets. It's a good idea to use something like { id }.
|
|
70
77
|
// When a function, it is fired at the beginning of the drag operation and returns an object representing the drag operation (see first bullet). If null is returned, the drag operation is cancelled.
|
|
71
78
|
previewOptions: dragPreviewOptions, // Optional. A plain JavaScript object describing drag preview options.
|
|
@@ -118,6 +125,7 @@ export function withDragSource(WrappedComponent) {
|
|
|
118
125
|
|
|
119
126
|
return <WrappedComponent
|
|
120
127
|
{...props}
|
|
128
|
+
alreadyHasDragSource={true}
|
|
121
129
|
ref={ref}
|
|
122
130
|
canDrag={stateCanDrag}
|
|
123
131
|
isDragging={stateIsDragging}
|
|
@@ -132,7 +140,7 @@ export function withDragSource(WrappedComponent) {
|
|
|
132
140
|
export function withDropTarget(WrappedComponent) {
|
|
133
141
|
return forwardRef((props, ref) => {
|
|
134
142
|
|
|
135
|
-
if (!props.isDropTarget) {
|
|
143
|
+
if (!props.isDropTarget || props.alreadyHasDropTarget) {
|
|
136
144
|
return <WrappedComponent {...props} ref={ref} />;
|
|
137
145
|
}
|
|
138
146
|
|
|
@@ -196,8 +204,9 @@ export function withDropTarget(WrappedComponent) {
|
|
|
196
204
|
dropTargetRef(localTargetRef); // register DOM node with react-dnd
|
|
197
205
|
|
|
198
206
|
return <WrappedComponent
|
|
199
|
-
|
|
207
|
+
alreadyHasDropTarget={true}
|
|
200
208
|
ref={ref}
|
|
209
|
+
canDrop={stateCanDrop}
|
|
201
210
|
isOver={isOver}
|
|
202
211
|
dropTargetRef={localTargetRef}
|
|
203
212
|
draggedItem={draggedItem} // Pass the dragged item
|
|
@@ -23,7 +23,7 @@ import getComponentFromType from '../../Functions/getComponentFromType.js';
|
|
|
23
23
|
export default function withDraggable(WrappedComponent) {
|
|
24
24
|
return forwardRef((props, ref) => {
|
|
25
25
|
|
|
26
|
-
if (!props.isDraggable) {
|
|
26
|
+
if (!props.isDraggable || props.alreadyHasDraggable) {
|
|
27
27
|
return <WrappedComponent {...props} ref={ref} />;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -237,7 +237,11 @@ export default function withDraggable(WrappedComponent) {
|
|
|
237
237
|
{...draggableProps}
|
|
238
238
|
>
|
|
239
239
|
<div ref={nodeRef} className="nsResize">
|
|
240
|
-
<WrappedComponent
|
|
240
|
+
<WrappedComponent
|
|
241
|
+
{...propsToPass}
|
|
242
|
+
alreadyHasDraggable={true}
|
|
243
|
+
ref={ref}
|
|
244
|
+
/>
|
|
241
245
|
</div>
|
|
242
246
|
</Draggable>;
|
|
243
247
|
} else if (mode === HORIZONTAL) {
|
|
@@ -252,7 +256,11 @@ export default function withDraggable(WrappedComponent) {
|
|
|
252
256
|
{...draggableProps}
|
|
253
257
|
>
|
|
254
258
|
<div ref={nodeRef} className="ewResize" style={{ height: '100%', }}>
|
|
255
|
-
<WrappedComponent
|
|
259
|
+
<WrappedComponent
|
|
260
|
+
{...propsToPass}
|
|
261
|
+
alreadyHasDraggable={true}
|
|
262
|
+
ref={ref}
|
|
263
|
+
/>
|
|
256
264
|
</div>
|
|
257
265
|
</Draggable>;
|
|
258
266
|
}
|
|
@@ -268,14 +276,22 @@ export default function withDraggable(WrappedComponent) {
|
|
|
268
276
|
nodeRef={nodeRef}
|
|
269
277
|
{...draggableProps}
|
|
270
278
|
>
|
|
271
|
-
<WrappedComponent
|
|
279
|
+
<WrappedComponent
|
|
280
|
+
{...propsToPass}
|
|
281
|
+
alreadyHasDraggable={true}
|
|
282
|
+
ref={nodeRef}
|
|
283
|
+
/>
|
|
272
284
|
</Draggable>;
|
|
273
285
|
} else if (CURRENT_MODE === UI_MODE_NATIVE) {
|
|
274
286
|
|
|
275
287
|
// NOT YET IMPLEMENTED
|
|
276
288
|
// Really need to replace most of this, as much of it is web-centric.
|
|
277
289
|
|
|
278
|
-
return <WrappedComponent
|
|
290
|
+
return <WrappedComponent
|
|
291
|
+
{...propsToPass}
|
|
292
|
+
alreadyHasDraggable={true}
|
|
293
|
+
ref={ref}
|
|
294
|
+
/>;
|
|
279
295
|
|
|
280
296
|
}
|
|
281
297
|
});
|
|
@@ -21,7 +21,7 @@ import _ from 'lodash';
|
|
|
21
21
|
export default function withEditor(WrappedComponent, isTree = false) {
|
|
22
22
|
return forwardRef((props, ref) => {
|
|
23
23
|
|
|
24
|
-
if (props.disableWithEditor) {
|
|
24
|
+
if (props.disableWithEditor || props.alreadyHasWithEditor) {
|
|
25
25
|
return <WrappedComponent {...props} ref={ref} isTree={isTree} />;
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -179,7 +179,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
|
|
|
179
179
|
if (defaultValues) {
|
|
180
180
|
_.merge(defaultValuesToUse, defaultValues);
|
|
181
181
|
}
|
|
182
|
-
addValues =
|
|
182
|
+
addValues = {...defaultValuesToUse};
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
if (selectorId && !_.isEmpty(selectorSelected)) {
|
|
@@ -702,6 +702,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
|
|
|
702
702
|
{...props}
|
|
703
703
|
ref={ref}
|
|
704
704
|
disableWithEditor={false}
|
|
705
|
+
alreadyHasWithEditor={true}
|
|
705
706
|
currentRecord={currentRecord}
|
|
706
707
|
setCurrentRecord={setCurrentRecord}
|
|
707
708
|
isEditorShown={isEditorShown}
|
|
@@ -2,9 +2,19 @@ import { forwardRef } from 'react';
|
|
|
2
2
|
|
|
3
3
|
export default function withEvents(WrappedComponent) {
|
|
4
4
|
return forwardRef((props, ref) => {
|
|
5
|
+
|
|
6
|
+
if (props.alreadyHasWithEvents) {
|
|
7
|
+
return <WrappedComponent {...props} ref={ref} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
const {
|
|
6
11
|
onEvent,
|
|
7
12
|
} = props;
|
|
8
|
-
return <WrappedComponent
|
|
13
|
+
return <WrappedComponent
|
|
14
|
+
{...props}
|
|
15
|
+
alreadyHasWithEvents={true}
|
|
16
|
+
ref={ref}
|
|
17
|
+
fireEvent={onEvent}
|
|
18
|
+
/>;
|
|
9
19
|
});
|
|
10
20
|
}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
// ScrollView,
|
|
5
5
|
Text,
|
|
6
6
|
} from '@project-components/Gluestack';
|
|
7
|
+
import clsx from 'clsx';
|
|
7
8
|
import {
|
|
8
9
|
ScrollView,
|
|
9
10
|
Platform,
|
|
@@ -41,7 +42,7 @@ const isWindows = Platform.OS === 'windows';
|
|
|
41
42
|
export default function withFilters(WrappedComponent) {
|
|
42
43
|
return forwardRef((props, ref) => {
|
|
43
44
|
|
|
44
|
-
if (!props.useFilters) {
|
|
45
|
+
if (!props.useFilters || props.alreadyHasWithFilters) {
|
|
45
46
|
return <WrappedComponent {...props} ref={ref} />;
|
|
46
47
|
}
|
|
47
48
|
|
|
@@ -327,17 +328,17 @@ export default function withFilters(WrappedComponent) {
|
|
|
327
328
|
// add a container for each filter
|
|
328
329
|
filterElement = <HStack
|
|
329
330
|
key={'filter-' + ix}
|
|
330
|
-
className={
|
|
331
|
-
Filter-container-HStack
|
|
332
|
-
h-full
|
|
333
|
-
px-1
|
|
334
|
-
mx-1
|
|
335
|
-
bg-grey-100
|
|
336
|
-
rounded-[6px]
|
|
337
|
-
border
|
|
338
|
-
border-l-white
|
|
339
|
-
items-center
|
|
340
|
-
|
|
331
|
+
className={clsx(
|
|
332
|
+
'Filter-container-HStack',
|
|
333
|
+
'h-full',
|
|
334
|
+
'px-1',
|
|
335
|
+
'mx-1',
|
|
336
|
+
'bg-grey-100',
|
|
337
|
+
'rounded-[6px]',
|
|
338
|
+
'border',
|
|
339
|
+
'border-l-white',
|
|
340
|
+
'items-center',
|
|
341
|
+
)}
|
|
341
342
|
>
|
|
342
343
|
{filterElement}
|
|
343
344
|
</HStack>;
|
|
@@ -660,13 +661,13 @@ export default function withFilters(WrappedComponent) {
|
|
|
660
661
|
onContentSizeChange={onContentSizeChange}
|
|
661
662
|
>
|
|
662
663
|
<Text
|
|
663
|
-
className={
|
|
664
|
-
withFilters-filtersLabel
|
|
665
|
-
italic-italic
|
|
666
|
-
pr-2
|
|
667
|
-
select-none
|
|
668
|
-
|
|
669
|
-
|
|
664
|
+
className={clsx(
|
|
665
|
+
'withFilters-filtersLabel',
|
|
666
|
+
'italic-italic',
|
|
667
|
+
'pr-2',
|
|
668
|
+
'select-none',
|
|
669
|
+
hasFilters ? 'flex-1' : 'italic',
|
|
670
|
+
)}>{hasFilters ? 'Filters:' : 'No Filters'}</Text>
|
|
670
671
|
{renderedFilters}
|
|
671
672
|
</ScrollView>
|
|
672
673
|
</HStack>
|
|
@@ -694,7 +695,12 @@ export default function withFilters(WrappedComponent) {
|
|
|
694
695
|
</HStack>}
|
|
695
696
|
</Toolbar>;
|
|
696
697
|
|
|
697
|
-
return <WrappedComponent
|
|
698
|
+
return <WrappedComponent
|
|
699
|
+
{...props}
|
|
700
|
+
ref={ref}
|
|
701
|
+
alreadyHasWithFilters={true}
|
|
702
|
+
topToolbar={toolbar}
|
|
703
|
+
/>;
|
|
698
704
|
|
|
699
705
|
});
|
|
700
706
|
}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
Modal, ModalBackdrop, ModalHeader, ModalContent, ModalCloseButton, ModalBody, ModalFooter,
|
|
6
6
|
Text,
|
|
7
7
|
} from '@project-components/Gluestack';
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
import Button from '../Buttons/Button.js';
|
|
9
10
|
import Panel from '../Panel/Panel.js';
|
|
10
11
|
import Footer from '../Layout/Footer.js';
|
|
@@ -18,7 +19,7 @@ import _ from 'lodash';
|
|
|
18
19
|
export default function withModal(WrappedComponent) {
|
|
19
20
|
return forwardRef((props, ref) => {
|
|
20
21
|
|
|
21
|
-
if (props.disableWithModal || props.
|
|
22
|
+
if (props.disableWithModal || props.alreadyHasWithModal) {
|
|
22
23
|
return <WrappedComponent {...props} ref={ref} />;
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -151,12 +152,12 @@ export default function withModal(WrappedComponent) {
|
|
|
151
152
|
let footer = null;
|
|
152
153
|
if (buttons && buttons.length > 0) {
|
|
153
154
|
footer = <Footer
|
|
154
|
-
className={
|
|
155
|
-
justify-end
|
|
156
|
-
py-2
|
|
157
|
-
pr-4
|
|
158
|
-
bg-grey-100
|
|
159
|
-
|
|
155
|
+
className={clsx(
|
|
156
|
+
'justify-end',
|
|
157
|
+
'py-2',
|
|
158
|
+
'pr-4',
|
|
159
|
+
'bg-grey-100',
|
|
160
|
+
)}
|
|
160
161
|
>{buttons}</Footer>;
|
|
161
162
|
}
|
|
162
163
|
modalBody =
|
|
@@ -179,12 +180,13 @@ export default function withModal(WrappedComponent) {
|
|
|
179
180
|
<WrappedComponent
|
|
180
181
|
{...props}
|
|
181
182
|
disableWithModal={false}
|
|
183
|
+
alreadyHasWithModal={true}
|
|
184
|
+
ref={ref}
|
|
182
185
|
showModal={showModal}
|
|
183
186
|
hideModal={onCancel || hideModal}
|
|
184
187
|
updateModalBody={updateModalBody}
|
|
185
188
|
isModalShown={isModalShown}
|
|
186
189
|
whichModal={whichModal}
|
|
187
|
-
ref={ref}
|
|
188
190
|
/>
|
|
189
191
|
{isModalShown &&
|
|
190
192
|
<Modal
|
|
@@ -22,7 +22,7 @@ export default function withPdfButtons(WrappedComponent) {
|
|
|
22
22
|
if (props.canUser && !props.canUser(VIEW)) { // permissions
|
|
23
23
|
showButtons = false;
|
|
24
24
|
}
|
|
25
|
-
if (!showButtons) {
|
|
25
|
+
if (!showButtons || props.alreadyHasWithPdfButtons) {
|
|
26
26
|
// bypass everything.
|
|
27
27
|
// If we don't do this, we get an infinite recursion with Form
|
|
28
28
|
// because this HOC wraps Form and uses Form itself.
|
|
@@ -384,9 +384,10 @@ export default function withPdfButtons(WrappedComponent) {
|
|
|
384
384
|
|
|
385
385
|
return <WrappedComponent
|
|
386
386
|
{...props}
|
|
387
|
+
ref={ref}
|
|
388
|
+
alreadyHasWithPdfButtons={true}
|
|
387
389
|
additionalEditButtons={additionalEditButtons}
|
|
388
390
|
additionalViewButtons={additionalViewButtons}
|
|
389
|
-
ref={ref}
|
|
390
391
|
/>;
|
|
391
392
|
}));
|
|
392
393
|
}
|
|
@@ -97,7 +97,7 @@ export function canUser(permission, modelToCheck = null) {
|
|
|
97
97
|
export default function withPermissions(WrappedComponent, forceUsePermissions = false) {
|
|
98
98
|
return forwardRef((props, ref) => {
|
|
99
99
|
|
|
100
|
-
if (!props.usePermissions && !forceUsePermissions) {
|
|
100
|
+
if ((!props.usePermissions && !forceUsePermissions) || props.alreadyHasWithPermissions) {
|
|
101
101
|
return <WrappedComponent {...props} ref={ref} />;
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -126,9 +126,10 @@ export default function withPermissions(WrappedComponent, forceUsePermissions =
|
|
|
126
126
|
|
|
127
127
|
return <WrappedComponent
|
|
128
128
|
{...props}
|
|
129
|
+
alreadyHasWithPermissions={true}
|
|
130
|
+
ref={ref}
|
|
129
131
|
canUser={canUserDecorator}
|
|
130
132
|
showPermissionsError={showPermissionsError}
|
|
131
|
-
ref={ref}
|
|
132
133
|
/>;
|
|
133
134
|
});
|
|
134
135
|
}
|
|
@@ -41,7 +41,7 @@ const presetButtons = [
|
|
|
41
41
|
export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
42
42
|
return forwardRef((props, ref) => {
|
|
43
43
|
|
|
44
|
-
if (props.disablePresetButtons) {
|
|
44
|
+
if (props.disablePresetButtons || props.alreadyHasWithPresetButtons) {
|
|
45
45
|
// bypass everything
|
|
46
46
|
return <WrappedComponent {...props} ref={ref} />;
|
|
47
47
|
}
|
|
@@ -433,8 +433,9 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
433
433
|
|
|
434
434
|
return <WrappedComponent
|
|
435
435
|
{...propsToPass}
|
|
436
|
-
ref={ref}
|
|
437
436
|
disablePresetButtons={false}
|
|
437
|
+
alreadyHasWithPresetButtons={true}
|
|
438
|
+
ref={ref}
|
|
438
439
|
contextMenuItems={[
|
|
439
440
|
...localContextMenuItems,
|
|
440
441
|
...contextMenuItems,
|
|
@@ -12,14 +12,7 @@ import _ from 'lodash';
|
|
|
12
12
|
export default function withSelection(WrappedComponent) {
|
|
13
13
|
return forwardRef((props, ref) => {
|
|
14
14
|
|
|
15
|
-
if (props.disableWithSelection) {
|
|
16
|
-
return <WrappedComponent {...props} ref={ref} />;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (props.setSelection) {
|
|
20
|
-
// bypass everything, since we're already using withSelection() in hierarchy.
|
|
21
|
-
// For example, Combo has withSelection(), and intenally it uses Grid which also has withSelection(),
|
|
22
|
-
// but we only need it defined once for the whole thing.
|
|
15
|
+
if (props.disableWithSelection || props.alreadyHasWithSelection) {
|
|
23
16
|
return <WrappedComponent {...props} ref={ref} />;
|
|
24
17
|
}
|
|
25
18
|
|
|
@@ -427,6 +420,7 @@ export default function withSelection(WrappedComponent) {
|
|
|
427
420
|
{...props}
|
|
428
421
|
ref={ref}
|
|
429
422
|
disableWithSelection={false}
|
|
423
|
+
alreadyHasWithSelection={true}
|
|
430
424
|
selection={getSelection()}
|
|
431
425
|
getSelection={getSelection}
|
|
432
426
|
setSelection={setSelection}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
ToastDescription,
|
|
6
6
|
useToast,
|
|
7
7
|
} from '@project-components/Gluestack';
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
import _ from 'lodash';
|
|
9
10
|
|
|
10
11
|
// This HOC enables showing a toast in the wrapped component.
|
|
@@ -12,7 +13,7 @@ import _ from 'lodash';
|
|
|
12
13
|
export default function withToast(WrappedComponent) {
|
|
13
14
|
return forwardRef((props, ref) => {
|
|
14
15
|
|
|
15
|
-
if (props.disableWithToast || props.
|
|
16
|
+
if (props.disableWithToast || props.alreadyHasWithToast) {
|
|
16
17
|
return <WrappedComponent {...props} ref={ref} />;
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -79,8 +80,10 @@ export default function withToast(WrappedComponent) {
|
|
|
79
80
|
|
|
80
81
|
return <WrappedComponent
|
|
81
82
|
{...props}
|
|
82
|
-
|
|
83
|
+
alreadyHasWithToast={true}
|
|
84
|
+
disableWithToast={false}
|
|
83
85
|
ref={ref}
|
|
86
|
+
showToast={showToast}
|
|
84
87
|
/>;
|
|
85
88
|
});
|
|
86
89
|
}
|
|
@@ -7,6 +7,11 @@ import _ from 'lodash';
|
|
|
7
7
|
|
|
8
8
|
export default function withTooltip(WrappedComponent) {
|
|
9
9
|
return forwardRef((props, ref) => {
|
|
10
|
+
|
|
11
|
+
if (props.alreadyHasWithTooltip) {
|
|
12
|
+
return <WrappedComponent {...props} ref={ref} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
const {
|
|
11
16
|
tooltip,
|
|
12
17
|
tooltipPlacement = 'bottom',
|
|
@@ -16,7 +21,11 @@ export default function withTooltip(WrappedComponent) {
|
|
|
16
21
|
...propsToPass
|
|
17
22
|
} = props;
|
|
18
23
|
|
|
19
|
-
let component = <WrappedComponent
|
|
24
|
+
let component = <WrappedComponent
|
|
25
|
+
{...propsToPass}
|
|
26
|
+
alreadyHasWithTooltip={true}
|
|
27
|
+
ref={ref}
|
|
28
|
+
/>;
|
|
20
29
|
|
|
21
30
|
if (tooltip || !_.isEmpty(_tooltip)) {
|
|
22
31
|
component = <Tooltip
|
|
@@ -9,14 +9,7 @@ import _ from 'lodash';
|
|
|
9
9
|
export default function withValue(WrappedComponent) {
|
|
10
10
|
return forwardRef((props, ref) => {
|
|
11
11
|
|
|
12
|
-
if (props.disableWithValue) {
|
|
13
|
-
return <WrappedComponent {...props} ref={ref} />;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (props.setValue) {
|
|
17
|
-
// bypass everything, since we're already using withValue() in hierarchy.
|
|
18
|
-
// For example, Combo has withValue(), and intenally it uses Input which also has withValue(),
|
|
19
|
-
// but we only need it defined once for the whole thing.
|
|
12
|
+
if (props.disableWithValue || props.alreadyHasWithValue) {
|
|
20
13
|
return <WrappedComponent {...props} ref={ref} />;
|
|
21
14
|
}
|
|
22
15
|
|
|
@@ -143,8 +136,9 @@ export default function withValue(WrappedComponent) {
|
|
|
143
136
|
|
|
144
137
|
return <WrappedComponent
|
|
145
138
|
{...props}
|
|
146
|
-
ref={ref}
|
|
147
139
|
disableWithValue={false}
|
|
140
|
+
alreadyHasWithValue={true}
|
|
141
|
+
ref={ref}
|
|
148
142
|
value={convertedValue}
|
|
149
143
|
setValue={setValueRef.current}
|
|
150
144
|
onChangeSelection={onChangeSelection}
|
|
@@ -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';
|
|
@@ -83,11 +84,11 @@ export default function withWindowedEditor(WrappedComponent, isTree = false) {
|
|
|
83
84
|
{..._editor}
|
|
84
85
|
parent={self}
|
|
85
86
|
reference="editor"
|
|
86
|
-
className={
|
|
87
|
-
bg-white
|
|
88
|
-
shadow-lg
|
|
89
|
-
rounded-lg
|
|
90
|
-
|
|
87
|
+
className={clsx(
|
|
88
|
+
'bg-white',
|
|
89
|
+
'shadow-lg',
|
|
90
|
+
'rounded-lg',
|
|
91
|
+
)}
|
|
91
92
|
/>
|
|
92
93
|
</Modal>}
|
|
93
94
|
</>;
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
Text,
|
|
6
6
|
VStack,
|
|
7
7
|
} from '@project-components/Gluestack';
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
import { useSelector, useDispatch, } from 'react-redux';
|
|
9
10
|
import { PROGRESS_COMPLETED } from '../../Constants/Progress.js';
|
|
10
11
|
import useForceUpdate from '../../Hooks/useForceUpdate.js';
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Box
|
|
3
3
|
} from '@project-components/Gluestack';
|
|
4
|
+
import clsx from 'clsx';
|
|
4
5
|
|
|
5
6
|
export default function CenterBox(props) {
|
|
6
|
-
let className =
|
|
7
|
-
CenterBox
|
|
8
|
-
w-full
|
|
9
|
-
flex-1
|
|
10
|
-
items-center
|
|
11
|
-
justify-center
|
|
12
|
-
p-2
|
|
13
|
-
|
|
7
|
+
let className = clsx(
|
|
8
|
+
'CenterBox',
|
|
9
|
+
'w-full',
|
|
10
|
+
'flex-1',
|
|
11
|
+
'items-center',
|
|
12
|
+
'justify-center',
|
|
13
|
+
'p-2',
|
|
14
|
+
);
|
|
14
15
|
if (props.className) {
|
|
15
16
|
className += props.className;
|
|
16
17
|
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HStack,
|
|
3
3
|
} from '@project-components/Gluestack';
|
|
4
|
+
import clsx from 'clsx';
|
|
4
5
|
import UiGlobals from '../../UiGlobals.js';
|
|
5
6
|
|
|
6
7
|
export default function Footer(props) {
|
|
7
8
|
const styles = UiGlobals.styles;
|
|
8
|
-
let className =
|
|
9
|
-
Footer
|
|
10
|
-
w-full
|
|
11
|
-
items-center
|
|
12
|
-
justify-center
|
|
13
|
-
self-end
|
|
14
|
-
p-2
|
|
15
|
-
border-t-2
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
let className = clsx(
|
|
10
|
+
'Footer',
|
|
11
|
+
'w-full',
|
|
12
|
+
'items-center',
|
|
13
|
+
'justify-center',
|
|
14
|
+
'self-end',
|
|
15
|
+
'p-2',
|
|
16
|
+
'border-t-2',
|
|
17
|
+
styles.PANEL_FOOTER_CLASSNAME,
|
|
18
|
+
);
|
|
18
19
|
if (props.className) {
|
|
19
20
|
className += ' ' + props.className
|
|
20
21
|
}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
Text,
|
|
5
5
|
VStack,
|
|
6
6
|
} from '@project-components/Gluestack';
|
|
7
|
+
import clsx from 'clsx';
|
|
7
8
|
import {
|
|
8
9
|
SCREEN_MODES__FULL,
|
|
9
10
|
SCREEN_MODES__SIDE,
|
|
@@ -36,10 +37,10 @@ export default function ScreenHeader(props) {
|
|
|
36
37
|
{icon &&
|
|
37
38
|
<Icon
|
|
38
39
|
as={icon}
|
|
39
|
-
className={
|
|
40
|
-
ml-5
|
|
41
|
-
text-black
|
|
42
|
-
|
|
40
|
+
className={clsx(
|
|
41
|
+
'ml-5',
|
|
42
|
+
'text-black',
|
|
43
|
+
)}
|
|
43
44
|
size="xl"
|
|
44
45
|
/>}
|
|
45
46
|
<Text {...textProps} className="ScreenHeader-Text pl-4 text-[26px] font-[700]">{title}</Text>
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
Modal, ModalBackdrop, ModalHeader, ModalContent, ModalCloseButton, ModalBody, ModalFooter,
|
|
3
3
|
Text,
|
|
4
4
|
} from '@project-components/Gluestack';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import Button from '../Buttons/Button';
|
|
6
7
|
import emptyFn from '../../Functions/emptyFn.js';
|
|
7
8
|
|
|
@@ -17,11 +18,11 @@ export default function ConfirmationMessage(props) {
|
|
|
17
18
|
<ModalContent maxWidth="400px">
|
|
18
19
|
<ModalHeader>Confirm</ModalHeader>
|
|
19
20
|
<ModalBody
|
|
20
|
-
className={
|
|
21
|
-
p-5
|
|
22
|
-
pb-0
|
|
23
|
-
border-t-0
|
|
24
|
-
|
|
21
|
+
className={clsx(
|
|
22
|
+
'p-5',
|
|
23
|
+
'pb-0',
|
|
24
|
+
'border-t-0',
|
|
25
|
+
)}
|
|
25
26
|
>
|
|
26
27
|
<Text className="text-black">{textMessage}</Text>
|
|
27
28
|
</ModalBody>
|