@onehat/ui 0.4.8 → 0.4.10
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 +1 -1
- package/src/Components/Form/Field/Combo/Combo.js +22 -15
- package/src/Components/Form/Field/Date.js +4 -1
- package/src/Components/Form/Field/Input.js +4 -8
- package/src/Components/Form/Field/Slider.js +17 -13
- package/src/Components/Form/Field/Tag/Tag.js +13 -5
- package/src/Components/Form/Field/TextArea.js +2 -1
- package/src/Components/Form/FieldSet.js +2 -2
- package/src/Components/Form/Form.js +28 -22
- package/src/Components/Grid/Grid.js +48 -23
- package/src/Components/Grid/GridRow.js +6 -4
- package/src/Components/Hoc/withAlert.js +3 -1
- package/src/Components/Hoc/withPresetButtons.js +7 -6
- package/src/Components/Icons/Gauge.js +2 -2
- package/src/Components/Toolbar/Pagination.js +55 -28
package/package.json
CHANGED
|
@@ -55,6 +55,7 @@ export function ComboComponent(props) {
|
|
|
55
55
|
isEditor = false,
|
|
56
56
|
isDisabled = false,
|
|
57
57
|
isInTag = false,
|
|
58
|
+
minimizeForRow = false,
|
|
58
59
|
tooltipPlacement = 'bottom',
|
|
59
60
|
placeholder,
|
|
60
61
|
onRowPress,
|
|
@@ -542,28 +543,29 @@ export function ComboComponent(props) {
|
|
|
542
543
|
`}
|
|
543
544
|
/>;
|
|
544
545
|
}
|
|
546
|
+
const triggerClassName = `
|
|
547
|
+
Combo-trigger
|
|
548
|
+
h-full
|
|
549
|
+
border
|
|
550
|
+
border-l-0
|
|
551
|
+
border-gray-400
|
|
552
|
+
rounded-l-none
|
|
553
|
+
rounded-r-md
|
|
554
|
+
${styles.FORM_COMBO_TRIGGER_BG}
|
|
555
|
+
${styles.FORM_COMBO_TRIGGER_BG_HOVER}
|
|
556
|
+
`;
|
|
545
557
|
trigger = <IconButton
|
|
546
558
|
{...testProps('trigger')}
|
|
547
559
|
ref={triggerRef}
|
|
548
560
|
icon={CaretDown}
|
|
549
561
|
_icon={{
|
|
550
|
-
size: '
|
|
562
|
+
size: 'md',
|
|
551
563
|
className: 'text-grey-500',
|
|
552
564
|
}}
|
|
553
565
|
isDisabled={isDisabled}
|
|
554
566
|
onPress={onTriggerPress}
|
|
555
567
|
onBlur={onTriggerBlur}
|
|
556
|
-
className={
|
|
557
|
-
trigger
|
|
558
|
-
h-full
|
|
559
|
-
border
|
|
560
|
-
border-l-0
|
|
561
|
-
border-gray-400
|
|
562
|
-
rounded-l-none
|
|
563
|
-
rounded-r-md
|
|
564
|
-
${styles.FORM_COMBO_TRIGGER_BG}
|
|
565
|
-
${styles.FORM_COMBO_TRIGGER_BG_HOVER}
|
|
566
|
-
`}
|
|
568
|
+
className={triggerClassName}
|
|
567
569
|
/>;
|
|
568
570
|
|
|
569
571
|
if (UiGlobals.mode === UI_MODE_WEB) {
|
|
@@ -619,6 +621,7 @@ export function ComboComponent(props) {
|
|
|
619
621
|
grow
|
|
620
622
|
h-full
|
|
621
623
|
min-h-0
|
|
624
|
+
max-h-[40px]
|
|
622
625
|
flex-1
|
|
623
626
|
m-0
|
|
624
627
|
rounded-tr-none
|
|
@@ -1009,15 +1012,19 @@ export function ComboComponent(props) {
|
|
|
1009
1012
|
refProps.ref = tooltipRef;
|
|
1010
1013
|
}
|
|
1011
1014
|
|
|
1012
|
-
|
|
1015
|
+
let className = `
|
|
1013
1016
|
Combo-HStack
|
|
1014
1017
|
flex-1
|
|
1015
1018
|
h-[40px]
|
|
1019
|
+
min-h-[40px]
|
|
1016
1020
|
justify-center
|
|
1017
|
-
items-
|
|
1021
|
+
items-stretch
|
|
1018
1022
|
`;
|
|
1019
1023
|
if (props.className) {
|
|
1020
|
-
|
|
1024
|
+
className += ' ' + props.className;
|
|
1025
|
+
}
|
|
1026
|
+
if (minimizeForRow) {
|
|
1027
|
+
className += ' h-auto min-h-0 max-h-[40px]';
|
|
1021
1028
|
}
|
|
1022
1029
|
|
|
1023
1030
|
if (isRendered && additionalButtons?.length && containerWidth < 500) {
|
|
@@ -48,6 +48,7 @@ export const DateElement = forwardRef((props, ref) => {
|
|
|
48
48
|
_input = {},
|
|
49
49
|
isDisabled = false,
|
|
50
50
|
limitWidth = false,
|
|
51
|
+
minimizeForRow = false,
|
|
51
52
|
minValue,
|
|
52
53
|
maxValue,
|
|
53
54
|
testID,
|
|
@@ -219,7 +220,6 @@ export const DateElement = forwardRef((props, ref) => {
|
|
|
219
220
|
}
|
|
220
221
|
};
|
|
221
222
|
|
|
222
|
-
|
|
223
223
|
useEffect(() => {
|
|
224
224
|
|
|
225
225
|
// When value changes from outside, adjust text value
|
|
@@ -576,6 +576,9 @@ export const DateElement = forwardRef((props, ref) => {
|
|
|
576
576
|
if (props.className) {
|
|
577
577
|
className += props.className;
|
|
578
578
|
}
|
|
579
|
+
if (minimizeForRow) {
|
|
580
|
+
className += ' h-auto min-h-0 max-h-[50px]';
|
|
581
|
+
}
|
|
579
582
|
const style = props.style || {};
|
|
580
583
|
if (!_.isNil(height)) {
|
|
581
584
|
style.height = height;
|
|
@@ -30,6 +30,7 @@ const InputElement = forwardRef((props, ref) => {
|
|
|
30
30
|
rightIcon,
|
|
31
31
|
rightIconHandler,
|
|
32
32
|
placeholder,
|
|
33
|
+
className,
|
|
33
34
|
...propsToPass
|
|
34
35
|
} = props,
|
|
35
36
|
styles = UiGlobals.styles,
|
|
@@ -109,10 +110,6 @@ const InputElement = forwardRef((props, ref) => {
|
|
|
109
110
|
if (!disableAutoFlex && !hasWidth(props) && !hasFlex(props)) {
|
|
110
111
|
style.flex = 1;
|
|
111
112
|
}
|
|
112
|
-
// flex-1
|
|
113
|
-
// block
|
|
114
|
-
// h-auto
|
|
115
|
-
// h-[10px]
|
|
116
113
|
let inputClassName = `
|
|
117
114
|
Input
|
|
118
115
|
${styles.FORM_INPUT_BG}
|
|
@@ -125,15 +122,14 @@ const InputElement = forwardRef((props, ref) => {
|
|
|
125
122
|
h-auto
|
|
126
123
|
w-full
|
|
127
124
|
p-2
|
|
128
|
-
text-
|
|
125
|
+
text-center
|
|
129
126
|
${styles.FORM_INPUT_FONTSIZE}
|
|
130
127
|
${styles.FORM_INPUT_BG}
|
|
131
128
|
${styles.FORM_INPUT_BG_FOCUS}
|
|
132
129
|
${styles.FORM_INPUT_BG_HOVER}
|
|
133
130
|
`;
|
|
134
|
-
if (
|
|
135
|
-
inputClassName +=
|
|
136
|
-
inputFieldClassName += props.className;
|
|
131
|
+
if (className) {
|
|
132
|
+
inputClassName += className;
|
|
137
133
|
}
|
|
138
134
|
|
|
139
135
|
return <Input
|
|
@@ -30,6 +30,7 @@ const
|
|
|
30
30
|
maxValue = 100,
|
|
31
31
|
step = 10,
|
|
32
32
|
autoSubmitDelay = UiGlobals.autoSubmitDelay,
|
|
33
|
+
minimizeForRow = false,
|
|
33
34
|
tooltip = null,
|
|
34
35
|
isDisabled = false,
|
|
35
36
|
testID,
|
|
@@ -150,12 +151,24 @@ const
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
let className = `
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
w-full
|
|
155
|
+
items-center
|
|
156
|
+
`,
|
|
157
|
+
inputClassName = `
|
|
158
|
+
InputWithTooltip
|
|
159
|
+
h-full
|
|
160
|
+
w-[60px]
|
|
161
|
+
mr-4
|
|
162
|
+
text-center
|
|
163
|
+
rounded-md
|
|
164
|
+
${styles.SLIDER_READOUT_FONTSIZE}
|
|
165
|
+
`;
|
|
156
166
|
if (props.className) {
|
|
157
167
|
className += ' ' + props.className;
|
|
158
168
|
}
|
|
169
|
+
if (minimizeForRow) {
|
|
170
|
+
inputClassName += ' h-auto min-h-0 max-h-[50px] mr-1';
|
|
171
|
+
}
|
|
159
172
|
|
|
160
173
|
return <HStack
|
|
161
174
|
className={className}
|
|
@@ -168,16 +181,7 @@ const
|
|
|
168
181
|
onKeyPress={onInputKeyPress}
|
|
169
182
|
isDisabled={isDisabled}
|
|
170
183
|
disableAutoFlex={true}
|
|
171
|
-
className={
|
|
172
|
-
InputWithTooltip
|
|
173
|
-
h-full
|
|
174
|
-
w-[50px]
|
|
175
|
-
p-2
|
|
176
|
-
mr-4
|
|
177
|
-
text-center
|
|
178
|
-
rounded-md
|
|
179
|
-
${styles.SLIDER_READOUT_FONTSIZE}
|
|
180
|
-
`}
|
|
184
|
+
className={inputClassName}
|
|
181
185
|
{...props._input}
|
|
182
186
|
/>
|
|
183
187
|
<HStack className="flex-1">
|
|
@@ -22,7 +22,6 @@ function TagComponent(props) {
|
|
|
22
22
|
isViewOnly = false,
|
|
23
23
|
isValueAlwaysArray,
|
|
24
24
|
isValueAsStringifiedJson,
|
|
25
|
-
isFilter = false,
|
|
26
25
|
minimizeForRow = false,
|
|
27
26
|
Editor,
|
|
28
27
|
_combo = {},
|
|
@@ -274,8 +273,8 @@ function TagComponent(props) {
|
|
|
274
273
|
Tag-valueBoxes-container
|
|
275
274
|
w-full
|
|
276
275
|
min-h-[40px]
|
|
277
|
-
flex-wrap
|
|
278
276
|
max-h-[200px]
|
|
277
|
+
flex-wrap
|
|
279
278
|
overflow-auto
|
|
280
279
|
border
|
|
281
280
|
border-grey-300
|
|
@@ -286,12 +285,20 @@ function TagComponent(props) {
|
|
|
286
285
|
${styles.FORM_TAG_PADDING}
|
|
287
286
|
`,
|
|
288
287
|
comboClassName = '';
|
|
288
|
+
if (_combo.className) {
|
|
289
|
+
comboClassName = _combo.className;
|
|
290
|
+
}
|
|
289
291
|
if (minimizeForRow) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
+
if (isViewOnly) {
|
|
293
|
+
// combo is not shown, so allow valueBoxes to take up more space
|
|
294
|
+
valueBoxesClassName += ' h-auto min-h-[50px] max-h-[50px] overflow-auto flex-1';
|
|
295
|
+
} else {
|
|
296
|
+
// shrink both down
|
|
297
|
+
valueBoxesClassName += ' h-auto min-h-[25px] max-h-[25px] overflow-auto flex-1';
|
|
298
|
+
comboClassName += ' h-auto min-h-0 max-h-[25px] flex-1';
|
|
299
|
+
}
|
|
292
300
|
}
|
|
293
301
|
|
|
294
|
-
|
|
295
302
|
return <VStack
|
|
296
303
|
className={className}
|
|
297
304
|
style={style}
|
|
@@ -311,6 +318,7 @@ function TagComponent(props) {
|
|
|
311
318
|
tooltip={tooltip}
|
|
312
319
|
usePermissions={props.usePermissions}
|
|
313
320
|
{..._combo}
|
|
321
|
+
className={comboClassName}
|
|
314
322
|
/>}
|
|
315
323
|
</VStack>;
|
|
316
324
|
|
|
@@ -91,7 +91,8 @@ const
|
|
|
91
91
|
inputClassName += ' ' + props.className;
|
|
92
92
|
}
|
|
93
93
|
if (minimizeForRow) {
|
|
94
|
-
textareaClassName += ' max-h-[
|
|
94
|
+
textareaClassName += ' h-auto min-h-0 max-h-[40px] overflow-auto';
|
|
95
|
+
inputClassName += ' py-0';
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
return <Textarea className={textareaClassName}>
|
|
@@ -76,7 +76,7 @@ export default function FieldSet(props) {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
let className = `
|
|
80
80
|
FieldSet-Box
|
|
81
81
|
mb-4
|
|
82
82
|
mx-0
|
|
@@ -86,7 +86,7 @@ export default function FieldSet(props) {
|
|
|
86
86
|
${styles.FORM_FIELDSET_BG}
|
|
87
87
|
`;
|
|
88
88
|
if (props.className) {
|
|
89
|
-
|
|
89
|
+
className += props.className;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
|
|
@@ -315,6 +315,7 @@ function Form(props) {
|
|
|
315
315
|
let element = <Element
|
|
316
316
|
{...testProps('field-' + fieldName)}
|
|
317
317
|
value={value}
|
|
318
|
+
minimizeForRow={true}
|
|
318
319
|
parent={self}
|
|
319
320
|
reference={fieldName}
|
|
320
321
|
{...configPropsToPass}
|
|
@@ -378,7 +379,7 @@ function Form(props) {
|
|
|
378
379
|
dynamicProps = getDynamicProps({ fieldState, formSetValue, formGetValues, formState });
|
|
379
380
|
}
|
|
380
381
|
|
|
381
|
-
let elementClassName = 'Form-Element
|
|
382
|
+
let elementClassName = 'Form-Element';
|
|
382
383
|
if (type.match(/Tag/)) {
|
|
383
384
|
elementClassName += ' overflow-auto';
|
|
384
385
|
}
|
|
@@ -643,10 +644,10 @@ function Form(props) {
|
|
|
643
644
|
if (defaults?.labelWidth) {
|
|
644
645
|
style.width = defaults.labelWidth;
|
|
645
646
|
}
|
|
646
|
-
if (!style.width) {
|
|
647
|
-
style.width = '50px';
|
|
648
|
-
}
|
|
649
647
|
if (containerWidth > styles.FORM_STACK_ROW_THRESHOLD) {
|
|
648
|
+
if (!style.width) {
|
|
649
|
+
style.width = '100px';
|
|
650
|
+
}
|
|
650
651
|
element = <HStack className="Form-HStack1 w-full py-1">
|
|
651
652
|
<Label style={style}>{label}</Label>
|
|
652
653
|
{element}
|
|
@@ -724,7 +725,7 @@ function Form(props) {
|
|
|
724
725
|
dynamicProps = getDynamicProps({ fieldState, formSetValue, formGetValues, formState });
|
|
725
726
|
}
|
|
726
727
|
|
|
727
|
-
let elementClassName = 'Form-Element field-' + name + '
|
|
728
|
+
let elementClassName = 'Form-Element field-' + name + ' w-full';
|
|
728
729
|
const defaultsClassName = defaults.className;
|
|
729
730
|
if (defaultsClassName) {
|
|
730
731
|
elementClassName += ' ' + defaultsClassName;
|
|
@@ -774,7 +775,7 @@ function Form(props) {
|
|
|
774
775
|
if (message) {
|
|
775
776
|
message = <Text className="text-[#f00]">{message}</Text>;
|
|
776
777
|
}
|
|
777
|
-
element = <VStack className="Form-VStack4
|
|
778
|
+
element = <VStack className="Form-VStack4 w-full pt-1">
|
|
778
779
|
{element}
|
|
779
780
|
{message}
|
|
780
781
|
</VStack>;
|
|
@@ -782,14 +783,14 @@ function Form(props) {
|
|
|
782
783
|
if (item.additionalEditButtons) {
|
|
783
784
|
const buttons = buildAdditionalButtons(item.additionalEditButtons, self, { fieldState, formSetValue, formGetValues, formState });
|
|
784
785
|
if (containerWidth > styles.FORM_STACK_ROW_THRESHOLD) {
|
|
785
|
-
element = <HStack className="Form-HStack5
|
|
786
|
+
element = <HStack className="Form-HStack5 w-full flex-wrap">
|
|
786
787
|
{element}
|
|
787
788
|
{buttons}
|
|
788
789
|
</HStack>;
|
|
789
790
|
} else {
|
|
790
|
-
element = <VStack className="Form-VStack6
|
|
791
|
+
element = <VStack className="Form-VStack6 w-full">
|
|
791
792
|
{element}
|
|
792
|
-
<HStack className="Form-HStack7-VStack
|
|
793
|
+
<HStack className="Form-HStack7-VStack w-full mt-1 flex-wrap">
|
|
793
794
|
{buttons}
|
|
794
795
|
</HStack>
|
|
795
796
|
</VStack>;
|
|
@@ -819,22 +820,22 @@ function Form(props) {
|
|
|
819
820
|
if (defaults?.labelWidth) {
|
|
820
821
|
style.width = defaults.labelWidth;
|
|
821
822
|
}
|
|
822
|
-
if (!style.width) {
|
|
823
|
-
style.width = '50px';
|
|
824
|
-
}
|
|
825
823
|
if (containerWidth > styles.FORM_STACK_ROW_THRESHOLD) {
|
|
826
|
-
|
|
824
|
+
if (!style.width) {
|
|
825
|
+
style.width = '100px';
|
|
826
|
+
}
|
|
827
|
+
element = <HStack className="Form-HStack8 w-full">
|
|
827
828
|
<Label style={style}>{requiredIndicator}{label}</Label>
|
|
828
829
|
{element}
|
|
829
830
|
</HStack>;
|
|
830
831
|
} else {
|
|
831
|
-
element = <VStack className="Form-VStack9
|
|
832
|
+
element = <VStack className="Form-VStack9 w-full mt-3">
|
|
832
833
|
<Label style={style}>{requiredIndicator}{label}</Label>
|
|
833
834
|
{element}
|
|
834
835
|
</VStack>;
|
|
835
836
|
}
|
|
836
837
|
} else if (disableLabels && requiredIndicator) {
|
|
837
|
-
element = <HStack className="Form-HStack10
|
|
838
|
+
element = <HStack className="Form-HStack10 w-full">
|
|
838
839
|
{requiredIndicator}
|
|
839
840
|
{element}
|
|
840
841
|
</HStack>;
|
|
@@ -855,9 +856,10 @@ function Form(props) {
|
|
|
855
856
|
key={ix}
|
|
856
857
|
className={`
|
|
857
858
|
Form-HStack11
|
|
859
|
+
min-h-[50px]
|
|
860
|
+
w-full
|
|
858
861
|
flex-none
|
|
859
862
|
pb-2
|
|
860
|
-
h-[50px]
|
|
861
863
|
${error ? 'bg-[#fdd]' : ''}
|
|
862
864
|
`}
|
|
863
865
|
>
|
|
@@ -1149,16 +1151,15 @@ function Form(props) {
|
|
|
1149
1151
|
if (!isEditorViewOnly && !hideResetButton) {
|
|
1150
1152
|
showResetBtn = true;
|
|
1151
1153
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
+
// determine whether we should show the close or cancel button
|
|
1155
|
+
if (editorType !== EDITOR_TYPE__SIDE) {
|
|
1154
1156
|
if (isEditorViewOnly) {
|
|
1155
1157
|
showCloseBtn = true;
|
|
1156
1158
|
} else {
|
|
1157
|
-
const formIsDirty = formState.isDirty;
|
|
1158
1159
|
// if (editorType === EDITOR_TYPE__WINDOWED && onCancel) {
|
|
1159
1160
|
// showCancelBtn = true;
|
|
1160
1161
|
// }
|
|
1161
|
-
if (
|
|
1162
|
+
if (formState.isDirty || isPhantom) {
|
|
1162
1163
|
if (isSingle && onCancel) {
|
|
1163
1164
|
showCancelBtn = true;
|
|
1164
1165
|
}
|
|
@@ -1168,6 +1169,11 @@ function Form(props) {
|
|
|
1168
1169
|
}
|
|
1169
1170
|
}
|
|
1170
1171
|
}
|
|
1172
|
+
} else {
|
|
1173
|
+
// side editor only
|
|
1174
|
+
if (isPhantom && isSingle && onCancel) {
|
|
1175
|
+
showCancelBtn = true;
|
|
1176
|
+
}
|
|
1171
1177
|
}
|
|
1172
1178
|
if (!isEditorViewOnly && onSave) {
|
|
1173
1179
|
showSaveBtn = true;
|
|
@@ -1207,7 +1213,7 @@ function Form(props) {
|
|
|
1207
1213
|
<Button
|
|
1208
1214
|
{...testProps('cancelBtn')}
|
|
1209
1215
|
key="cancelBtn"
|
|
1210
|
-
variant=
|
|
1216
|
+
variant={editorType === EDITOR_TYPE__INLINE ? 'solid' : 'outline'}
|
|
1211
1217
|
onPress={onCancel}
|
|
1212
1218
|
className="text-white mr-2"
|
|
1213
1219
|
text="Cancel"
|
|
@@ -1217,7 +1223,7 @@ function Form(props) {
|
|
|
1217
1223
|
<Button
|
|
1218
1224
|
{...testProps('closeBtn')}
|
|
1219
1225
|
key="closeBtn"
|
|
1220
|
-
variant=
|
|
1226
|
+
variant={editorType === EDITOR_TYPE__INLINE ? 'solid' : 'outline'}
|
|
1221
1227
|
onPress={onClose}
|
|
1222
1228
|
className="text-white mr-2"
|
|
1223
1229
|
text="Close"
|
|
@@ -365,7 +365,7 @@ function GridComponent(props) {
|
|
|
365
365
|
onPress={() => setIsReorderMode(!isReorderMode)}
|
|
366
366
|
icon={isReorderMode ? NoReorderRows : ReorderRows}
|
|
367
367
|
_icon={{
|
|
368
|
-
className: styles.
|
|
368
|
+
className: styles.TOOLBAR_ITEMS_COLOR,
|
|
369
369
|
}}
|
|
370
370
|
tooltip="Reorder Rows"
|
|
371
371
|
/>);
|
|
@@ -466,28 +466,36 @@ function GridComponent(props) {
|
|
|
466
466
|
onContextMenu(item, e, selection);
|
|
467
467
|
}
|
|
468
468
|
}}
|
|
469
|
-
className="flex-row grow
|
|
469
|
+
className="flex-row grow">
|
|
470
470
|
{({
|
|
471
471
|
hovered,
|
|
472
472
|
focused,
|
|
473
473
|
pressed,
|
|
474
474
|
}) => {
|
|
475
475
|
if (isHeaderRow) {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
476
|
+
let headerRow = <GridHeaderRow
|
|
477
|
+
Repository={Repository}
|
|
478
|
+
columnsConfig={localColumnsConfig}
|
|
479
|
+
setColumnsConfig={setLocalColumnsConfig}
|
|
480
|
+
hideNavColumn={hideNavColumn}
|
|
481
|
+
canColumnsSort={canColumnsSort}
|
|
482
|
+
canColumnsReorder={canColumnsReorder}
|
|
483
|
+
canColumnsResize={canColumnsResize}
|
|
484
|
+
setSelection={setSelection}
|
|
485
|
+
gridRef={gridRef}
|
|
486
|
+
isHovered={hovered}
|
|
487
|
+
isInlineEditorShown={isInlineEditorShown}
|
|
488
|
+
areRowsDragSource={areRowsDragSource}
|
|
489
|
+
showColumnsSelector={showColumnsSelector}
|
|
490
|
+
/>;
|
|
491
|
+
if (showRowExpander) {
|
|
492
|
+
// align the header row to content rows
|
|
493
|
+
headerRow = <HStack className="">
|
|
494
|
+
<Box className="w-[40px]"></Box>
|
|
495
|
+
{headerRow}
|
|
496
|
+
</HStack>;
|
|
497
|
+
}
|
|
498
|
+
return headerRow;
|
|
491
499
|
}
|
|
492
500
|
|
|
493
501
|
const
|
|
@@ -572,15 +580,29 @@ function GridComponent(props) {
|
|
|
572
580
|
|
|
573
581
|
if (showRowExpander && !isHeaderRow) {
|
|
574
582
|
const isExpanded = getIsExpanded(index);
|
|
575
|
-
|
|
576
|
-
|
|
583
|
+
let className = `
|
|
584
|
+
Grid-rowExpander
|
|
585
|
+
w-full
|
|
586
|
+
flex-none
|
|
587
|
+
`;
|
|
588
|
+
if (rowProps?.className) {
|
|
589
|
+
className += ' ' + rowProps.className;
|
|
590
|
+
}
|
|
591
|
+
rowComponent = <VStack className={className}>
|
|
592
|
+
<HStack
|
|
593
|
+
className={`
|
|
594
|
+
Grid-rowExpander-HStack
|
|
595
|
+
w-full
|
|
596
|
+
grow
|
|
597
|
+
`}
|
|
598
|
+
>
|
|
577
599
|
<ExpandButton
|
|
578
600
|
isExpanded={isExpanded}
|
|
579
601
|
onToggle={() => setIsExpanded(index, !isExpanded)}
|
|
580
602
|
_icon={{
|
|
581
603
|
size: 'sm',
|
|
582
604
|
}}
|
|
583
|
-
className="py-0"
|
|
605
|
+
className="Grid-rowExpander-expandBtn py-0"
|
|
584
606
|
tooltip="Expand/Contract Row"
|
|
585
607
|
/>
|
|
586
608
|
{rowComponent}
|
|
@@ -1156,13 +1178,14 @@ function GridComponent(props) {
|
|
|
1156
1178
|
/>;
|
|
1157
1179
|
|
|
1158
1180
|
if (CURRENT_MODE === UI_MODE_WEB) {
|
|
1181
|
+
// fix scrolling bug on nested FlatLists (inner one would not scroll without this)
|
|
1159
1182
|
grid = <ScrollView
|
|
1160
1183
|
horizontal={false}
|
|
1161
|
-
className="ScrollView"
|
|
1184
|
+
className="ScrollView overflow-auto"
|
|
1162
1185
|
contentContainerStyle={{
|
|
1163
1186
|
height: '100%',
|
|
1164
1187
|
}}
|
|
1165
|
-
>{grid}</ScrollView>;
|
|
1188
|
+
>{grid}</ScrollView>;
|
|
1166
1189
|
} else
|
|
1167
1190
|
if (CURRENT_MODE === UI_MODE_NATIVE) {
|
|
1168
1191
|
grid = <ScrollView className="flex-1 w-full">{grid}</ScrollView>
|
|
@@ -1228,6 +1251,7 @@ function GridComponent(props) {
|
|
|
1228
1251
|
className={`
|
|
1229
1252
|
gridContainer
|
|
1230
1253
|
w-full
|
|
1254
|
+
h-full
|
|
1231
1255
|
flex-1
|
|
1232
1256
|
min-h-[40px]
|
|
1233
1257
|
${gridContainerBorderClassName}
|
|
@@ -1244,7 +1268,8 @@ function GridComponent(props) {
|
|
|
1244
1268
|
grid = <Box
|
|
1245
1269
|
ref={dropTargetRef}
|
|
1246
1270
|
className={`
|
|
1247
|
-
dropTarget
|
|
1271
|
+
Grid-dropTarget
|
|
1272
|
+
h-full
|
|
1248
1273
|
w-full
|
|
1249
1274
|
border-[#0ff]
|
|
1250
1275
|
${canDrop && isOver ? "border-[4px]" : "border-[0px]"}
|
|
@@ -250,8 +250,8 @@ function GridRow(props) {
|
|
|
250
250
|
className={`
|
|
251
251
|
GridRow-phantom
|
|
252
252
|
absolute
|
|
253
|
-
h-
|
|
254
|
-
w-
|
|
253
|
+
h-2
|
|
254
|
+
w-2
|
|
255
255
|
top-0
|
|
256
256
|
left-0
|
|
257
257
|
bg-[#f00]
|
|
@@ -310,10 +310,11 @@ function GridRow(props) {
|
|
|
310
310
|
if (isOnlyOneVisibleColumn) {
|
|
311
311
|
rowClassName += ' w-full';
|
|
312
312
|
}
|
|
313
|
+
if (rowProps?.className) {
|
|
314
|
+
rowClassName += ' ' + rowProps.className;
|
|
315
|
+
}
|
|
313
316
|
if (isOver) {
|
|
314
317
|
rowClassName += ' border-4 border-[#0ff]';
|
|
315
|
-
} else {
|
|
316
|
-
rowClassName += ' border-b border-b-grey-100';
|
|
317
318
|
}
|
|
318
319
|
return <HStackNative
|
|
319
320
|
{...testProps('row' + (isSelected ? '-selected' : ''))}
|
|
@@ -337,6 +338,7 @@ function GridRow(props) {
|
|
|
337
338
|
isInlineEditorShown,
|
|
338
339
|
isSelected,
|
|
339
340
|
isHovered,
|
|
341
|
+
isOver,
|
|
340
342
|
index,
|
|
341
343
|
dragSourceRef,
|
|
342
344
|
dropTargetRef,
|
|
@@ -188,7 +188,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
188
188
|
case ADD:
|
|
189
189
|
key = 'addBtn';
|
|
190
190
|
text = 'Add';
|
|
191
|
-
handler = onAdd;
|
|
191
|
+
handler = (parent, e) => onAdd();
|
|
192
192
|
icon = Plus;
|
|
193
193
|
if (selectorId && !selectorSelected) {
|
|
194
194
|
isDisabled = true;
|
|
@@ -200,7 +200,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
200
200
|
case EDIT:
|
|
201
201
|
key = 'editBtn';
|
|
202
202
|
text = 'Edit';
|
|
203
|
-
handler = onEdit;
|
|
203
|
+
handler = (parent, e) => onEdit();
|
|
204
204
|
icon = Edit;
|
|
205
205
|
if (selectorId && !selectorSelected) {
|
|
206
206
|
isDisabled = true;
|
|
@@ -216,6 +216,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
216
216
|
key = 'deleteBtn';
|
|
217
217
|
text = 'Delete';
|
|
218
218
|
handler = onDelete;
|
|
219
|
+
handler = (parent, e) => onDelete();
|
|
219
220
|
icon = Trash;
|
|
220
221
|
if (selectorId && !selectorSelected) {
|
|
221
222
|
isDisabled = true;
|
|
@@ -236,7 +237,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
236
237
|
case VIEW:
|
|
237
238
|
key = 'viewBtn';
|
|
238
239
|
text = 'View';
|
|
239
|
-
handler = onView;
|
|
240
|
+
handler = (parent, e) => onView();
|
|
240
241
|
icon = Eye;
|
|
241
242
|
isDisabled = !selection.length || selection.length !== 1;
|
|
242
243
|
if (selectorId && !selectorSelected) {
|
|
@@ -249,7 +250,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
249
250
|
case COPY:
|
|
250
251
|
key = 'copyBtn';
|
|
251
252
|
text = 'Copy to Clipboard';
|
|
252
|
-
handler = onCopyToClipboard;
|
|
253
|
+
handler = (parent, e) => onCopyToClipboard();
|
|
253
254
|
icon = Clipboard;
|
|
254
255
|
isDisabled = !selection.length;
|
|
255
256
|
if (selectorId && !selectorSelected) {
|
|
@@ -262,7 +263,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
262
263
|
case DUPLICATE:
|
|
263
264
|
key = 'duplicateBtn';
|
|
264
265
|
text = 'Duplicate';
|
|
265
|
-
handler = onDuplicate;
|
|
266
|
+
handler = (parent, e) => onDuplicate();
|
|
266
267
|
icon = Duplicate;
|
|
267
268
|
isDisabled = !selection.length || selection.length !== 1;
|
|
268
269
|
if (selectorId && !selectorSelected) {
|
|
@@ -283,7 +284,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
283
284
|
case UPLOAD_DOWNLOAD:
|
|
284
285
|
key = 'uploadDownloadBtn';
|
|
285
286
|
text = 'Upload/Download';
|
|
286
|
-
handler = onUploadDownload;
|
|
287
|
+
handler = (parent, e) => onUploadDownload();
|
|
287
288
|
icon = UploadDownload;
|
|
288
289
|
break;
|
|
289
290
|
default:
|
|
@@ -4,8 +4,8 @@ import { Path, Svg } from 'react-native-svg';
|
|
|
4
4
|
|
|
5
5
|
const SvgComponent = createIcon({
|
|
6
6
|
Root: Svg,
|
|
7
|
-
viewBox: '0 0
|
|
8
|
-
path: <Path d="M0
|
|
7
|
+
viewBox: '0 0 512 512',
|
|
8
|
+
path: <Path d="M0 256a256 256 0 11512 0 256 256 0 11-512 0zm320 96c0-26.9-16.5-49.9-40-59.3V88c0-13.3-10.7-24-24-24s-24 10.7-24 24v204.7c-23.5 9.5-40 32.5-40 59.3 0 35.3 28.7 64 64 64s64-28.7 64-64zM144 176a32 32 0 100-64 32 32 0 100 64zm-16 80a32 32 0 10-64 0 32 32 0 1064 0zm288 32a32 32 0 100-64 32 32 0 100 64zm-16-144a32 32 0 10-64 0 32 32 0 1064 0z" />,
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
export default SvgComponent
|
|
@@ -61,6 +61,7 @@ export default function Pagination(props) {
|
|
|
61
61
|
{...testProps('showMoreBtn')}
|
|
62
62
|
key="showMoreBtn"
|
|
63
63
|
reference="showMoreBtn"
|
|
64
|
+
className="Pagination-showMoreBtn"
|
|
64
65
|
parent={self}
|
|
65
66
|
onPress={() => Repository.showMore()}
|
|
66
67
|
isDisabled={isDisabled}
|
|
@@ -70,6 +71,7 @@ export default function Pagination(props) {
|
|
|
70
71
|
if (!Repository.isLocal) {
|
|
71
72
|
items.push(<ReloadButton
|
|
72
73
|
key="reloadPageBtn"
|
|
74
|
+
className="Pagination-reloadPageBtn"
|
|
73
75
|
_icon={iconProps}
|
|
74
76
|
Repository={Repository}
|
|
75
77
|
self={self}
|
|
@@ -82,6 +84,7 @@ export default function Pagination(props) {
|
|
|
82
84
|
{...testProps('firstPageBtn')}
|
|
83
85
|
key="firstPageBtn"
|
|
84
86
|
reference="firstPageBtn"
|
|
87
|
+
className="Pagination-firstPageBtn"
|
|
85
88
|
parent={self}
|
|
86
89
|
isDisabled={isDisabled}
|
|
87
90
|
icon={AnglesLeft}
|
|
@@ -93,6 +96,7 @@ export default function Pagination(props) {
|
|
|
93
96
|
{...testProps('prevPageBtn')}
|
|
94
97
|
key="prevPageBtn"
|
|
95
98
|
reference="prevPageBtn"
|
|
99
|
+
className="Pagination-prevPageBtn"
|
|
96
100
|
parent={self}
|
|
97
101
|
isDisabled={isDisabled}
|
|
98
102
|
icon={AngleLeft}
|
|
@@ -101,31 +105,38 @@ export default function Pagination(props) {
|
|
|
101
105
|
tooltip="Previous Page"
|
|
102
106
|
/>);
|
|
103
107
|
if (!minimize) {
|
|
104
|
-
items.push(<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
108
|
+
items.push(<Text
|
|
109
|
+
key="page"
|
|
110
|
+
className="Pagination-page mx-1"
|
|
111
|
+
>Page</Text>);
|
|
112
|
+
items.push(<Input
|
|
113
|
+
{...testProps('pageInput')}
|
|
114
|
+
key="pageInput"
|
|
115
|
+
reference="pageInput"
|
|
116
|
+
parent={self}
|
|
117
|
+
keyboardType="numeric"
|
|
118
|
+
value={page?.toString()}
|
|
119
|
+
onChangeValue={(value) => Repository.setPage(value)}
|
|
120
|
+
maxValue={totalPages}
|
|
121
|
+
isDisabled={totalPages === 1}
|
|
122
|
+
className={`
|
|
123
|
+
Pagination-pageInput
|
|
124
|
+
min-w-[40px]
|
|
125
|
+
w-[40px]
|
|
126
|
+
text-center
|
|
127
|
+
bg-grey-100
|
|
128
|
+
`}
|
|
129
|
+
tooltip="Set Page"
|
|
130
|
+
/>);
|
|
131
|
+
items.push(<Text
|
|
132
|
+
key="totalPages"
|
|
133
|
+
className={`
|
|
134
|
+
Pagination-totalPages
|
|
135
|
+
whitespace-nowrap
|
|
136
|
+
inline-flex
|
|
137
|
+
mx-1
|
|
138
|
+
`}
|
|
139
|
+
>{`of ${totalPages}`}</Text>);
|
|
129
140
|
}
|
|
130
141
|
|
|
131
142
|
isDisabled = page === totalPages || totalPages <= 1;
|
|
@@ -133,6 +144,7 @@ export default function Pagination(props) {
|
|
|
133
144
|
{...testProps('nextPageBtn')}
|
|
134
145
|
key="nextPageBtn"
|
|
135
146
|
reference="nextPageBtn"
|
|
147
|
+
className="Pagination-nextPageBtn"
|
|
136
148
|
parent={self}
|
|
137
149
|
isDisabled={isDisabled}
|
|
138
150
|
icon={AngleRight}
|
|
@@ -144,6 +156,7 @@ export default function Pagination(props) {
|
|
|
144
156
|
{...testProps('lastPageBtn')}
|
|
145
157
|
key="lastPageBtn"
|
|
146
158
|
reference="lastPageBtn"
|
|
159
|
+
className="Pagination-lastPageBtn"
|
|
147
160
|
parent={self}
|
|
148
161
|
isDisabled={isDisabled}
|
|
149
162
|
icon={AnglesRight}
|
|
@@ -156,6 +169,7 @@ export default function Pagination(props) {
|
|
|
156
169
|
if (!Repository.isLocal) {
|
|
157
170
|
items.push(<ReloadButton
|
|
158
171
|
key="reloadPageBtn"
|
|
172
|
+
className="Pagination-reloadPageBtn"
|
|
159
173
|
_icon={iconProps}
|
|
160
174
|
Repository={Repository}
|
|
161
175
|
self={self}
|
|
@@ -178,13 +192,26 @@ export default function Pagination(props) {
|
|
|
178
192
|
}
|
|
179
193
|
items.push(<Text
|
|
180
194
|
key="pageDisplay"
|
|
181
|
-
className=
|
|
182
|
-
|
|
195
|
+
className={`
|
|
196
|
+
Pagination-pageDisplay
|
|
197
|
+
whitespace-nowrap
|
|
198
|
+
inline-flex
|
|
199
|
+
mx-1
|
|
200
|
+
`}
|
|
201
|
+
>{`Displaying ${pageSpan} of ${total}`}</Text>);
|
|
183
202
|
}
|
|
184
203
|
}
|
|
185
204
|
return <HStack
|
|
186
205
|
style={{ userSelect: 'none', }}
|
|
187
|
-
className=
|
|
206
|
+
className={`
|
|
207
|
+
Pagination
|
|
208
|
+
flex-none
|
|
209
|
+
gap-1
|
|
210
|
+
justify-start
|
|
211
|
+
items-center
|
|
212
|
+
px-2
|
|
213
|
+
mr-3
|
|
214
|
+
`}
|
|
188
215
|
>
|
|
189
216
|
{items}
|
|
190
217
|
</HStack>;
|