@onehat/ui 0.4.82 → 0.4.84
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 +7 -6
- package/src/Components/Container/Container.js +336 -147
- package/src/Components/Form/Field/Combo/Combo.js +84 -15
- package/src/Components/Form/Field/Hidden.js +13 -0
- package/src/Components/Form/Field/Json.js +2 -1
- package/src/Components/Form/Field/Tag/Tag.js +93 -78
- package/src/Components/Form/Field/Tag/ValueBox.js +2 -2
- package/src/Components/Form/Form.js +3 -2
- package/src/Components/Grid/Grid.js +79 -42
- package/src/Components/Grid/GridRow.js +10 -0
- package/src/Components/Hoc/Secondary/withSecondaryEditor.js +137 -43
- package/src/Components/Hoc/Secondary/withSecondarySideEditor.js +6 -4
- package/src/Components/Hoc/withContextMenu.js +13 -4
- package/src/Components/Hoc/withDraggable.js +7 -3
- package/src/Components/Hoc/withSideEditor.js +7 -4
- package/src/Components/Layout/AsyncOperation.js +54 -25
- package/src/Components/Panel/Mask.js +1 -14
- package/src/Components/Screens/Manager.js +4 -5
- package/src/Components/Toolbar/Pagination.js +108 -106
- package/src/Components/Tree/Tree.js +24 -0
- package/src/Components/Tree/TreeNode.js +2 -1
- package/src/Components/Viewer/Viewer.js +2 -5
- package/src/Components/index.js +2 -0
- package/src/Constants/Progress.js +6 -1
- package/src/PlatformImports/Web/Attachments.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onehat/ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.84",
|
|
4
4
|
"description": "Base UI for OneHat apps",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -58,17 +58,18 @@
|
|
|
58
58
|
"@k-renwick/colour-mixer": "^1.2.1",
|
|
59
59
|
"@legendapp/motion": "^2.4.0",
|
|
60
60
|
"@onehat/data": "^1.22.0",
|
|
61
|
-
"clsx": "^2.1.1",
|
|
62
|
-
"nativewind": "4.1.23",
|
|
63
|
-
"normalize-css-color": "^1.0.2",
|
|
64
61
|
"@react-native-community/slider": "^4.5.2",
|
|
65
62
|
"@reduxjs/toolkit": "^2.6.1",
|
|
63
|
+
"clsx": "^2.1.1",
|
|
66
64
|
"decimal.js": "^10.5.0",
|
|
67
65
|
"inflector-js": "^1.0.1",
|
|
68
66
|
"js-cookie": "^3.0.5",
|
|
67
|
+
"nativewind": "4.1.23",
|
|
68
|
+
"normalize-css-color": "^1.0.2",
|
|
69
69
|
"react-hook-form": "^7.55.0",
|
|
70
70
|
"react-native-progress": "^5.0.1",
|
|
71
71
|
"react-redux": "^9.2.0",
|
|
72
|
+
"tailwind-scrollbar": "^3.1.0",
|
|
72
73
|
"tailwindcss": "^3.4.17",
|
|
73
74
|
"yup": "^1.6.1"
|
|
74
75
|
},
|
|
@@ -79,10 +80,10 @@
|
|
|
79
80
|
"react": "*",
|
|
80
81
|
"react-color": "^2.19.3",
|
|
81
82
|
"react-datetime": "^3.2.0",
|
|
82
|
-
"react-dom": "*",
|
|
83
83
|
"react-dnd": "^16.0.1",
|
|
84
84
|
"react-dnd-html5-backend": "^16.0.1",
|
|
85
|
-
"react-dnd-touch-backend":"16.0.1",
|
|
85
|
+
"react-dnd-touch-backend": "16.0.1",
|
|
86
|
+
"react-dom": "*",
|
|
86
87
|
"react-draggable": "^4.4.5",
|
|
87
88
|
"react-native": "*",
|
|
88
89
|
"react-native-draggable": "^3.3.0",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { cloneElement, useState, useEffect, } from 'react';
|
|
1
|
+
import { cloneElement, useState, useEffect, useRef, } from 'react';
|
|
2
2
|
import {
|
|
3
|
+
BoxNative,
|
|
3
4
|
HStack,
|
|
4
5
|
VStack,
|
|
5
6
|
} from '@project-components/Gluestack';
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
CURRENT_MODE,
|
|
15
16
|
} from '../../Constants/UiModes.js';
|
|
16
17
|
import withComponent from '../Hoc/withComponent.js';
|
|
18
|
+
import useForceUpdate from '../../Hooks/useForceUpdate.js';
|
|
17
19
|
import getSaved from '../../Functions/getSaved.js';
|
|
18
20
|
import setSaved from '../../Functions/setSaved.js';
|
|
19
21
|
import Splitter from './Splitter.js';
|
|
@@ -60,96 +62,225 @@ import _ from 'lodash';
|
|
|
60
62
|
|
|
61
63
|
function Container(props) {
|
|
62
64
|
const {
|
|
65
|
+
isDisabled = false,
|
|
66
|
+
|
|
67
|
+
// components
|
|
63
68
|
center,
|
|
64
69
|
north,
|
|
65
70
|
south,
|
|
66
71
|
east,
|
|
67
72
|
west,
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
// configuration
|
|
75
|
+
northIsResizable = false,
|
|
76
|
+
southIsResizable = false,
|
|
77
|
+
eastIsResizable = false,
|
|
78
|
+
westIsResizable = false,
|
|
79
|
+
|
|
80
|
+
// initial states
|
|
81
|
+
northInitialHeight = null,
|
|
82
|
+
southInitialHeight = null,
|
|
83
|
+
eastInitialWidth = null,
|
|
84
|
+
westInitialWidth = null,
|
|
85
|
+
|
|
86
|
+
northInitialFlex = null,
|
|
87
|
+
southInitialFlex = null,
|
|
88
|
+
eastInitialFlex = null,
|
|
89
|
+
westInitialFlex = null,
|
|
90
|
+
|
|
91
|
+
northInitialIsCollapsed = false,
|
|
92
|
+
southInitialIsCollapsed = false,
|
|
93
|
+
eastInitialIsCollapsed = false,
|
|
94
|
+
westInitialIsCollapsed = false,
|
|
95
|
+
|
|
96
|
+
// optional external control of collapse states
|
|
97
|
+
northIsCollapsed = false,
|
|
98
|
+
southIsCollapsed = false,
|
|
99
|
+
eastIsCollapsed = false,
|
|
100
|
+
westIsCollapsed = false,
|
|
101
|
+
|
|
102
|
+
setNorthIsCollapsed: setExternalNorthIsCollapsed,
|
|
103
|
+
setSouthIsCollapsed: setExternalSouthIsCollapsed,
|
|
104
|
+
setEastIsCollapsed: setExternalEastIsCollapsed,
|
|
105
|
+
setWestIsCollapsed: setExternalWestIsCollapsed,
|
|
77
106
|
} = props,
|
|
78
107
|
id = props.id || props.self?.path,
|
|
79
|
-
|
|
108
|
+
isWeb = CURRENT_MODE === UI_MODE_WEB,
|
|
109
|
+
forceUpdate = useForceUpdate(),
|
|
110
|
+
centerRef = useRef(null),
|
|
111
|
+
northRef = useRef(null),
|
|
112
|
+
southRef = useRef(null),
|
|
113
|
+
eastRef = useRef(null),
|
|
114
|
+
westRef = useRef(null),
|
|
115
|
+
northHeightRef = useRef(northInitialHeight),
|
|
116
|
+
southHeightRef = useRef(southInitialHeight),
|
|
117
|
+
eastWidthRef = useRef(eastInitialWidth),
|
|
118
|
+
westWidthRef = useRef(westInitialWidth),
|
|
80
119
|
[isReady, setIsReady] = useState(false),
|
|
81
|
-
[
|
|
82
|
-
[
|
|
83
|
-
[
|
|
84
|
-
[
|
|
85
|
-
[
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
120
|
+
[isComponentsDisabled, setIsComponentsDisabled] = useState(false),
|
|
121
|
+
[localNorthIsCollapsed, setLocalNorthIsCollapsed] = useState(northInitialIsCollapsed),
|
|
122
|
+
[localSouthIsCollapsed, setLocalSouthIsCollapsed] = useState(southInitialIsCollapsed),
|
|
123
|
+
[localEastIsCollapsed, setLocalEastIsCollapsed] = useState(eastInitialIsCollapsed),
|
|
124
|
+
[localWestIsCollapsed, setLocalWestIsCollapsed] = useState(westInitialIsCollapsed),
|
|
125
|
+
setNorthIsCollapsed = (bool) => {
|
|
126
|
+
if (setExternalNorthIsCollapsed) {
|
|
127
|
+
setExternalNorthIsCollapsed(bool);
|
|
128
|
+
} else {
|
|
129
|
+
setLocalNorthIsCollapsed(bool);
|
|
130
|
+
}
|
|
91
131
|
|
|
92
132
|
if (id) {
|
|
93
|
-
setSaved(id + '-
|
|
133
|
+
setSaved(id + '-northIsCollapsed', bool);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
getNorthIsCollapsed = () => {
|
|
137
|
+
if (setExternalNorthIsCollapsed) {
|
|
138
|
+
return northIsCollapsed;
|
|
94
139
|
}
|
|
140
|
+
return localNorthIsCollapsed;
|
|
95
141
|
},
|
|
96
|
-
|
|
97
|
-
|
|
142
|
+
setSouthIsCollapsed = (bool) => {
|
|
143
|
+
if (setExternalSouthIsCollapsed) {
|
|
144
|
+
setExternalSouthIsCollapsed(bool);
|
|
145
|
+
} else {
|
|
146
|
+
setLocalSouthIsCollapsed(bool);
|
|
147
|
+
}
|
|
148
|
+
|
|
98
149
|
if (id) {
|
|
99
|
-
setSaved(id + '-
|
|
150
|
+
setSaved(id + '-southIsCollapsed', bool);
|
|
100
151
|
}
|
|
101
152
|
},
|
|
102
|
-
|
|
103
|
-
|
|
153
|
+
getSouthIsCollapsed = () => {
|
|
154
|
+
if (setExternalSouthIsCollapsed) {
|
|
155
|
+
return southIsCollapsed;
|
|
156
|
+
}
|
|
157
|
+
return localSouthIsCollapsed;
|
|
158
|
+
},
|
|
159
|
+
setEastIsCollapsed = (bool) => {
|
|
160
|
+
if (setExternalEastIsCollapsed) {
|
|
161
|
+
setExternalEastIsCollapsed(bool);
|
|
162
|
+
} else {
|
|
163
|
+
setLocalEastIsCollapsed(bool);
|
|
164
|
+
}
|
|
165
|
+
|
|
104
166
|
if (id) {
|
|
105
|
-
setSaved(id + '-
|
|
167
|
+
setSaved(id + '-eastIsCollapsed', bool);
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
getEastIsCollapsed = () => {
|
|
171
|
+
if (setExternalEastIsCollapsed) {
|
|
172
|
+
return eastIsCollapsed;
|
|
106
173
|
}
|
|
174
|
+
return localEastIsCollapsed;
|
|
107
175
|
},
|
|
108
|
-
|
|
109
|
-
|
|
176
|
+
setWestIsCollapsed = (bool) => {
|
|
177
|
+
if (setExternalWestIsCollapsed) {
|
|
178
|
+
setExternalWestIsCollapsed(bool);
|
|
179
|
+
} else {
|
|
180
|
+
setLocalWestIsCollapsed(bool);
|
|
181
|
+
}
|
|
182
|
+
|
|
110
183
|
if (id) {
|
|
111
|
-
setSaved(id + '-
|
|
184
|
+
setSaved(id + '-westIsCollapsed', bool);
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
getWestIsCollapsed = () => {
|
|
188
|
+
if (setExternalWestIsCollapsed) {
|
|
189
|
+
return westIsCollapsed;
|
|
112
190
|
}
|
|
191
|
+
return localWestIsCollapsed;
|
|
113
192
|
},
|
|
114
193
|
setNorthHeight = (height) => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
194
|
+
if (!getNorthIsCollapsed()) {
|
|
195
|
+
northHeightRef.current = height;
|
|
196
|
+
if (id) {
|
|
197
|
+
setSaved(id + '-northHeight', height);
|
|
198
|
+
}
|
|
118
199
|
}
|
|
119
200
|
},
|
|
201
|
+
getNorthHeight = () => {
|
|
202
|
+
return northHeightRef.current;
|
|
203
|
+
},
|
|
120
204
|
setSouthHeight = (height) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
205
|
+
if (!getSouthIsCollapsed()) {
|
|
206
|
+
southHeightRef.current = height;
|
|
207
|
+
if (id) {
|
|
208
|
+
setSaved(id + '-southHeight', height);
|
|
209
|
+
}
|
|
124
210
|
}
|
|
125
211
|
},
|
|
212
|
+
getSouthHeight = () => {
|
|
213
|
+
return southHeightRef.current;
|
|
214
|
+
},
|
|
126
215
|
setEastWidth = (width) => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
216
|
+
if (!getEastIsCollapsed()) {
|
|
217
|
+
eastWidthRef.current = width;
|
|
218
|
+
if (id) {
|
|
219
|
+
setSaved(id + '-eastWidth', width);
|
|
220
|
+
}
|
|
130
221
|
}
|
|
131
222
|
},
|
|
223
|
+
getEastWidth = () => {
|
|
224
|
+
return eastWidthRef.current;
|
|
225
|
+
},
|
|
132
226
|
setWestWidth = (width) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
227
|
+
if (!getWestIsCollapsed()) {
|
|
228
|
+
westWidthRef.current = width;
|
|
229
|
+
if (id) {
|
|
230
|
+
setSaved(id + '-westWidth', width);
|
|
231
|
+
}
|
|
136
232
|
}
|
|
137
233
|
},
|
|
234
|
+
getWestWidth = () => {
|
|
235
|
+
return westWidthRef.current;
|
|
236
|
+
},
|
|
138
237
|
onNorthResize = (delta) => {
|
|
139
|
-
|
|
140
|
-
|
|
238
|
+
if (!getNorthIsCollapsed()) {
|
|
239
|
+
const newHeight = getNorthHeight() + delta;
|
|
240
|
+
setNorthHeight(newHeight);
|
|
241
|
+
forceUpdate();
|
|
242
|
+
}
|
|
141
243
|
},
|
|
142
244
|
onSouthResize = (delta) => {
|
|
143
|
-
|
|
144
|
-
|
|
245
|
+
if (!getSouthIsCollapsed()) {
|
|
246
|
+
const newHeight = getSouthHeight() - delta; // minus
|
|
247
|
+
setSouthHeight(newHeight);
|
|
248
|
+
forceUpdate();
|
|
249
|
+
}
|
|
145
250
|
},
|
|
146
251
|
onEastResize = (delta) => {
|
|
147
|
-
|
|
148
|
-
|
|
252
|
+
if (!getEastIsCollapsed()) {
|
|
253
|
+
const newWidth = getEastWidth() - delta; // minus
|
|
254
|
+
setEastWidth(newWidth);
|
|
255
|
+
forceUpdate();
|
|
256
|
+
}
|
|
149
257
|
},
|
|
150
258
|
onWestResize = (delta) => {
|
|
151
|
-
|
|
152
|
-
|
|
259
|
+
if (!getWestIsCollapsed()) {
|
|
260
|
+
const newWidth = getWestWidth() + delta;
|
|
261
|
+
setWestWidth(newWidth);
|
|
262
|
+
forceUpdate();
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
onSplitterDragStart = () => {
|
|
266
|
+
setIsComponentsDisabled(true);
|
|
267
|
+
},
|
|
268
|
+
onSplitterDragStop = (delta, which) => {
|
|
269
|
+
setIsComponentsDisabled(false);
|
|
270
|
+
switch(which) {
|
|
271
|
+
case 'north':
|
|
272
|
+
onNorthResize(delta);
|
|
273
|
+
break;
|
|
274
|
+
case 'south':
|
|
275
|
+
onSouthResize(delta);
|
|
276
|
+
break;
|
|
277
|
+
case 'east':
|
|
278
|
+
onEastResize(delta);
|
|
279
|
+
break;
|
|
280
|
+
case 'west':
|
|
281
|
+
onWestResize(delta);
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
153
284
|
};
|
|
154
285
|
|
|
155
286
|
useEffect(() => {
|
|
@@ -158,52 +289,52 @@ function Container(props) {
|
|
|
158
289
|
|
|
159
290
|
if (id) {
|
|
160
291
|
let key, val;
|
|
161
|
-
key = id + '-
|
|
292
|
+
key = id + '-northIsCollapsed';
|
|
162
293
|
val = await getSaved(key);
|
|
163
294
|
if (!_.isNil(val)) {
|
|
164
|
-
|
|
295
|
+
setNorthIsCollapsed(val);
|
|
165
296
|
}
|
|
166
297
|
|
|
167
|
-
key = id + '-
|
|
298
|
+
key = id + '-southIsCollapsed';
|
|
168
299
|
val = await getSaved(key);
|
|
169
300
|
if (!_.isNil(val)) {
|
|
170
|
-
|
|
301
|
+
setSouthIsCollapsed(val);
|
|
171
302
|
}
|
|
172
303
|
|
|
173
|
-
key = id + '-
|
|
304
|
+
key = id + '-eastIsCollapsed';
|
|
174
305
|
val = await getSaved(key);
|
|
175
306
|
if (!_.isNil(val)) {
|
|
176
|
-
|
|
307
|
+
setEastIsCollapsed(val);
|
|
177
308
|
}
|
|
178
309
|
|
|
179
|
-
key = id + '-
|
|
310
|
+
key = id + '-westIsCollapsed';
|
|
180
311
|
val = await getSaved(key);
|
|
181
312
|
if (!_.isNil(val)) {
|
|
182
|
-
|
|
313
|
+
setWestIsCollapsed(val);
|
|
183
314
|
}
|
|
184
315
|
|
|
185
316
|
key = id + '-northHeight';
|
|
186
317
|
val = await getSaved(key);
|
|
187
318
|
if (!_.isNil(val)) {
|
|
188
|
-
|
|
319
|
+
setNorthHeight(val);
|
|
189
320
|
}
|
|
190
321
|
|
|
191
322
|
key = id + '-southHeight';
|
|
192
323
|
val = await getSaved(key);
|
|
193
324
|
if (!_.isNil(val)) {
|
|
194
|
-
|
|
325
|
+
setSouthHeight(val);
|
|
195
326
|
}
|
|
196
327
|
|
|
197
328
|
key = id + '-eastWidth';
|
|
198
329
|
val = await getSaved(key);
|
|
199
330
|
if (!_.isNil(val)) {
|
|
200
|
-
|
|
331
|
+
setEastWidth(val);
|
|
201
332
|
}
|
|
202
333
|
|
|
203
334
|
key = id + '-westWidth';
|
|
204
335
|
val = await getSaved(key);
|
|
205
336
|
if (!_.isNil(val)) {
|
|
206
|
-
|
|
337
|
+
setWestWidth(val);
|
|
207
338
|
}
|
|
208
339
|
}
|
|
209
340
|
|
|
@@ -216,8 +347,9 @@ function Container(props) {
|
|
|
216
347
|
if (!isReady) {
|
|
217
348
|
return null;
|
|
218
349
|
}
|
|
219
|
-
|
|
350
|
+
|
|
220
351
|
let componentProps = {},
|
|
352
|
+
wrapperProps = null,
|
|
221
353
|
centerComponent = null,
|
|
222
354
|
northComponent = null,
|
|
223
355
|
northSplitter = null,
|
|
@@ -228,117 +360,174 @@ function Container(props) {
|
|
|
228
360
|
westComponent = null,
|
|
229
361
|
westSplitter = null;
|
|
230
362
|
|
|
231
|
-
|
|
363
|
+
componentProps.isCollapsible = false;
|
|
364
|
+
componentProps.isDisabled = isDisabled || isComponentsDisabled;
|
|
365
|
+
centerComponent = cloneElement(center, componentProps);
|
|
232
366
|
if (north) {
|
|
233
|
-
componentProps
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
367
|
+
componentProps = {};
|
|
368
|
+
wrapperProps = {};
|
|
369
|
+
|
|
370
|
+
componentProps.isDisabled = isDisabled || isComponentsDisabled;
|
|
371
|
+
componentProps.className = (north.props.className || '') + ' h-full w-full';
|
|
372
|
+
wrapperProps.onLayout = (e) => {
|
|
373
|
+
const height = parseFloat(e.nativeEvent.layout.height);
|
|
374
|
+
if (height && height !== northHeight) {
|
|
375
|
+
setNorthHeight(height);
|
|
241
376
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const height = parseFloat(e.nativeEvent.layout.height);
|
|
247
|
-
if (height && height !== northHeight) {
|
|
248
|
-
setNorthHeight(height);
|
|
249
|
-
}
|
|
377
|
+
};
|
|
378
|
+
if (getNorthIsCollapsed()) {
|
|
379
|
+
wrapperProps.style = {
|
|
380
|
+
height: 33,
|
|
250
381
|
};
|
|
251
|
-
|
|
382
|
+
} else {
|
|
383
|
+
const northHeight = getNorthHeight();
|
|
384
|
+
if (_.isNil(northHeight)) {
|
|
385
|
+
wrapperProps.style = { flex: northInitialFlex || 50, };
|
|
386
|
+
} else {
|
|
387
|
+
wrapperProps.style = { height: northHeight, };
|
|
388
|
+
}
|
|
252
389
|
}
|
|
253
|
-
northComponent = cloneElement(north, { ...componentProps, w: '100%', });
|
|
254
|
-
componentProps = {};
|
|
255
|
-
}
|
|
256
|
-
if (south) {
|
|
257
390
|
componentProps.collapseDirection = VERTICAL;
|
|
258
|
-
|
|
259
|
-
|
|
391
|
+
componentProps.isCollapsed = getNorthIsCollapsed();
|
|
392
|
+
componentProps.setIsCollapsed = setNorthIsCollapsed;
|
|
393
|
+
if (isWeb && northIsResizable) {
|
|
394
|
+
northSplitter = <Splitter
|
|
395
|
+
mode={VERTICAL}
|
|
396
|
+
onDragStart={onSplitterDragStart}
|
|
397
|
+
onDragStop={(delta) => onSplitterDragStop(delta, 'north')}
|
|
398
|
+
/>;
|
|
260
399
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
400
|
+
northComponent = <BoxNative className="northWrapper w-full" {...wrapperProps}>
|
|
401
|
+
{cloneElement(north, componentProps)}
|
|
402
|
+
</BoxNative>;
|
|
403
|
+
}
|
|
404
|
+
if (south) {
|
|
405
|
+
componentProps = {};
|
|
406
|
+
wrapperProps = {};
|
|
407
|
+
|
|
408
|
+
componentProps.isDisabled = isDisabled || isComponentsDisabled;
|
|
409
|
+
componentProps.className = (south.props.className || '') + ' h-full w-full';
|
|
410
|
+
wrapperProps.onLayout = (e) => {
|
|
411
|
+
const height = parseFloat(e.nativeEvent.layout.height);
|
|
412
|
+
if (height && height !== getSouthHeight()) {
|
|
413
|
+
setSouthHeight(height);
|
|
265
414
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
const height = parseFloat(e.nativeEvent.layout.height);
|
|
271
|
-
if (height && height !== southHeight) {
|
|
272
|
-
setSouthHeight(height);
|
|
273
|
-
}
|
|
415
|
+
};
|
|
416
|
+
if (getSouthIsCollapsed()) {
|
|
417
|
+
wrapperProps.style = {
|
|
418
|
+
height: 33,
|
|
274
419
|
};
|
|
275
|
-
|
|
420
|
+
} else {
|
|
421
|
+
const southHeight = getSouthHeight();
|
|
422
|
+
if (_.isNil(southHeight)) {
|
|
423
|
+
wrapperProps.style = { flex: southInitialFlex || 50, };
|
|
424
|
+
} else {
|
|
425
|
+
wrapperProps.style = { height: southHeight, };
|
|
426
|
+
}
|
|
276
427
|
}
|
|
277
|
-
|
|
278
|
-
componentProps =
|
|
428
|
+
componentProps.collapseDirection = VERTICAL;
|
|
429
|
+
componentProps.isCollapsed = getSouthIsCollapsed();
|
|
430
|
+
componentProps.setIsCollapsed = setSouthIsCollapsed;
|
|
431
|
+
if (isWeb && southIsResizable) {
|
|
432
|
+
southSplitter = <Splitter
|
|
433
|
+
mode={VERTICAL}
|
|
434
|
+
onDragStart={onSplitterDragStart}
|
|
435
|
+
onDragStop={(delta) => onSplitterDragStop(delta, 'south')}
|
|
436
|
+
/>;
|
|
437
|
+
}
|
|
438
|
+
southComponent = <BoxNative className="southWrapper w-full" {...wrapperProps}>
|
|
439
|
+
{cloneElement(south, componentProps)}
|
|
440
|
+
</BoxNative>;
|
|
279
441
|
}
|
|
280
442
|
if (east) {
|
|
281
|
-
componentProps
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
443
|
+
componentProps = {};
|
|
444
|
+
wrapperProps = {};
|
|
445
|
+
|
|
446
|
+
componentProps.isDisabled = isDisabled || isComponentsDisabled;
|
|
447
|
+
componentProps.className = (east.props.className || '') + ' h-full w-full';
|
|
448
|
+
wrapperProps.onLayout = (e) => {
|
|
449
|
+
const width = parseFloat(e.nativeEvent.layout.width);
|
|
450
|
+
if (width && width !== getEastWidth()) {
|
|
451
|
+
setEastWidth(width);
|
|
289
452
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
const width = parseFloat(e.nativeEvent.layout.width);
|
|
295
|
-
if (width && width !== eastWidth) {
|
|
296
|
-
setEastWidth(width);
|
|
297
|
-
}
|
|
453
|
+
};
|
|
454
|
+
if (getEastIsCollapsed()) {
|
|
455
|
+
wrapperProps.style = {
|
|
456
|
+
width: 33,
|
|
298
457
|
};
|
|
299
|
-
|
|
458
|
+
} else {
|
|
459
|
+
const eastWidth = getEastWidth();
|
|
460
|
+
if (_.isNil(eastWidth)) {
|
|
461
|
+
wrapperProps.style = { flex: eastInitialFlex || 50, };
|
|
462
|
+
} else {
|
|
463
|
+
wrapperProps.style = { width: eastWidth, };
|
|
464
|
+
}
|
|
300
465
|
}
|
|
301
|
-
eastComponent = cloneElement(east, { ...componentProps, h: '100%', });
|
|
302
|
-
componentProps = {};
|
|
303
|
-
}
|
|
304
|
-
if (west) {
|
|
305
466
|
componentProps.collapseDirection = HORIZONTAL;
|
|
306
|
-
|
|
307
|
-
|
|
467
|
+
componentProps.isCollapsed = getEastIsCollapsed();
|
|
468
|
+
componentProps.setIsCollapsed = setEastIsCollapsed;
|
|
469
|
+
if (isWeb && eastIsResizable) {
|
|
470
|
+
eastSplitter = <Splitter
|
|
471
|
+
mode={HORIZONTAL}
|
|
472
|
+
onDragStart={onSplitterDragStart}
|
|
473
|
+
onDragStop={(delta) => onSplitterDragStop(delta, 'east')}
|
|
474
|
+
/>;
|
|
308
475
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
476
|
+
eastComponent = <BoxNative className="eastWrapper h-full" {...wrapperProps}>
|
|
477
|
+
{cloneElement(east, componentProps)}
|
|
478
|
+
</BoxNative>;
|
|
479
|
+
}
|
|
480
|
+
if (west) {
|
|
481
|
+
componentProps = {};
|
|
482
|
+
wrapperProps = {};
|
|
483
|
+
|
|
484
|
+
componentProps.isDisabled = isDisabled || isComponentsDisabled;
|
|
485
|
+
componentProps.className = (west.props.className || '') + ' h-full w-full';
|
|
486
|
+
wrapperProps.onLayout = (e) => {
|
|
487
|
+
const width = parseFloat(e.nativeEvent.layout.width);
|
|
488
|
+
if (width && width !== getWestWidth()) {
|
|
489
|
+
setWestWidth(width);
|
|
313
490
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
const width = parseFloat(e.nativeEvent.layout.width);
|
|
319
|
-
if (width && width !== westWidth) {
|
|
320
|
-
setWestWidth(width);
|
|
321
|
-
}
|
|
491
|
+
};
|
|
492
|
+
if (getWestIsCollapsed()) {
|
|
493
|
+
wrapperProps.style = {
|
|
494
|
+
width: 33,
|
|
322
495
|
};
|
|
323
|
-
|
|
496
|
+
} else {
|
|
497
|
+
const westWidth = getWestWidth();
|
|
498
|
+
if (_.isNil(westWidth)) {
|
|
499
|
+
wrapperProps.style = { flex: westInitialFlex || 50, };
|
|
500
|
+
} else {
|
|
501
|
+
wrapperProps.style = { width: westWidth, };
|
|
502
|
+
}
|
|
324
503
|
}
|
|
325
|
-
|
|
326
|
-
componentProps =
|
|
504
|
+
componentProps.collapseDirection = HORIZONTAL;
|
|
505
|
+
componentProps.isCollapsed = getWestIsCollapsed();
|
|
506
|
+
componentProps.setIsCollapsed = setWestIsCollapsed;
|
|
507
|
+
if (isWeb && westIsResizable) {
|
|
508
|
+
westSplitter = <Splitter
|
|
509
|
+
mode={HORIZONTAL}
|
|
510
|
+
onDragStart={onSplitterDragStart}
|
|
511
|
+
onDragStop={(delta) => onSplitterDragStop(delta, 'west')}
|
|
512
|
+
/>;
|
|
513
|
+
}
|
|
514
|
+
westComponent = <BoxNative className="westWrapper h-full" {...wrapperProps}>
|
|
515
|
+
{cloneElement(west, componentProps)}
|
|
516
|
+
</BoxNative>;
|
|
327
517
|
}
|
|
328
|
-
|
|
329
518
|
return <VStack className="Container-all w-full flex-1">
|
|
330
519
|
{northComponent}
|
|
331
|
-
{
|
|
332
|
-
<HStack className="Container-mid w-full
|
|
520
|
+
{!northIsCollapsed && !localNorthIsCollapsed && northSplitter}
|
|
521
|
+
<HStack className="Container-mid w-full flex-[100]">
|
|
333
522
|
{westComponent}
|
|
334
|
-
{
|
|
335
|
-
<VStack className="Container-center h-full overflow-auto
|
|
523
|
+
{!westIsCollapsed && !localWestIsCollapsed && westSplitter}
|
|
524
|
+
<VStack className="Container-center h-full overflow-auto flex-[100]">
|
|
336
525
|
{centerComponent}
|
|
337
526
|
</VStack>
|
|
338
|
-
{
|
|
527
|
+
{!eastIsCollapsed && !localEastIsCollapsed && eastSplitter}
|
|
339
528
|
{eastComponent}
|
|
340
529
|
</HStack>
|
|
341
|
-
{
|
|
530
|
+
{!southIsCollapsed && !localSouthIsCollapsed && southSplitter}
|
|
342
531
|
{southComponent}
|
|
343
532
|
</VStack>;
|
|
344
533
|
}
|