@onehat/ui 0.3.80 → 0.3.81
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
CHANGED
|
@@ -74,7 +74,7 @@ function TagComponent(props) {
|
|
|
74
74
|
},
|
|
75
75
|
clearComboValue = () => {
|
|
76
76
|
setIgnoreNextComboValueChange(true); // we're clearing out the value of the underlying Combo, so ignore it when this combo submits the new value change
|
|
77
|
-
self.children.combo.
|
|
77
|
+
self.children.combo.setValue(null);
|
|
78
78
|
},
|
|
79
79
|
onChangeComboValue = (comboValue) => {
|
|
80
80
|
if (getIgnoreNextComboValueChange()) {
|
|
@@ -17,6 +17,7 @@ import Minimize from '../Icons/Minimize.js';
|
|
|
17
17
|
import Maximize from '../Icons/Maximize.js';
|
|
18
18
|
import getSaved from '../../Functions/getSaved.js';
|
|
19
19
|
import setSaved from '../../Functions/setSaved.js';
|
|
20
|
+
import Xmark from '../Icons/Xmark.js';
|
|
20
21
|
import _ from 'lodash';
|
|
21
22
|
|
|
22
23
|
|
|
@@ -30,9 +31,11 @@ function TabBar(props) {
|
|
|
30
31
|
additionalButtons,
|
|
31
32
|
initialTabIx = 0,
|
|
32
33
|
currentTabIx,
|
|
34
|
+
disableCollapse = false,
|
|
33
35
|
startsCollapsed = true,
|
|
34
36
|
onChangeCurrentTab,
|
|
35
37
|
onChangeIsCollapsed,
|
|
38
|
+
onTabClose,
|
|
36
39
|
...propsToPass
|
|
37
40
|
} = props,
|
|
38
41
|
styles = UiGlobals.styles,
|
|
@@ -177,7 +180,11 @@ function TabBar(props) {
|
|
|
177
180
|
const
|
|
178
181
|
isCurrentTab = ix === getCurrentTab(),
|
|
179
182
|
thisButtonProps = {};
|
|
180
|
-
|
|
183
|
+
let useIconButton = false;
|
|
184
|
+
if (isCollapsed || !tab.title) {
|
|
185
|
+
useIconButton = true;
|
|
186
|
+
}
|
|
187
|
+
if (useIconButton) {
|
|
181
188
|
button = <IconButton
|
|
182
189
|
key={'tab' + ix}
|
|
183
190
|
onPress={() => setCurrentTab(ix)}
|
|
@@ -219,6 +226,19 @@ function TabBar(props) {
|
|
|
219
226
|
>{tab.title}</Text>
|
|
220
227
|
</Button>;
|
|
221
228
|
}
|
|
229
|
+
if (onTabClose) {
|
|
230
|
+
button = <Row
|
|
231
|
+
key={'tab' + ix}
|
|
232
|
+
>
|
|
233
|
+
{button}
|
|
234
|
+
<IconButton
|
|
235
|
+
key={'tab' + ix}
|
|
236
|
+
onPress={() => onTabClose(ix)}
|
|
237
|
+
icon={Xmark}
|
|
238
|
+
tooltip="Close Tab"
|
|
239
|
+
/>
|
|
240
|
+
</Row>;
|
|
241
|
+
}
|
|
222
242
|
buttons.push(button);
|
|
223
243
|
});
|
|
224
244
|
|
|
@@ -241,7 +261,11 @@ function TabBar(props) {
|
|
|
241
261
|
default:
|
|
242
262
|
}
|
|
243
263
|
}
|
|
244
|
-
|
|
264
|
+
let useIconButton = false;
|
|
265
|
+
if (isCollapsed || !additionalButton.text) {
|
|
266
|
+
useIconButton = true;
|
|
267
|
+
}
|
|
268
|
+
if (useIconButton) {
|
|
245
269
|
button = <IconButton
|
|
246
270
|
key={'additionalBtn' + ix}
|
|
247
271
|
onPress={additionalButton.onPress}
|
|
@@ -293,6 +317,12 @@ function TabBar(props) {
|
|
|
293
317
|
}
|
|
294
318
|
|
|
295
319
|
const currentTabIx = getCurrentTab();
|
|
320
|
+
if (!tabs[currentTabIx]) {
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
if (!tabs[currentTabIx].content && !tabs[currentTabIx].items) {
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
296
326
|
if (tabs[currentTabIx].content) {
|
|
297
327
|
return tabs[currentTabIx].content;
|
|
298
328
|
}
|
|
@@ -332,7 +362,7 @@ function TabBar(props) {
|
|
|
332
362
|
const
|
|
333
363
|
renderedTabs = renderTabs(),
|
|
334
364
|
renderedCurrentTabContent = renderCurrentTabContent(),
|
|
335
|
-
renderedToggleButton = renderToggleButton();
|
|
365
|
+
renderedToggleButton = !disableCollapse ? renderToggleButton() : null;
|
|
336
366
|
|
|
337
367
|
|
|
338
368
|
if (direction === VERTICAL) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default function delayUntil(fn, maxAttempts = 100, interval = 100) {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
let currentAttempt = 0;
|
|
4
|
+
const checkCondition = async () => {
|
|
5
|
+
currentAttempt++;
|
|
6
|
+
|
|
7
|
+
if (fn()) {
|
|
8
|
+
resolve();
|
|
9
|
+
} else if (currentAttempt < maxAttempts) {
|
|
10
|
+
setTimeout(checkCondition, interval);
|
|
11
|
+
} else {
|
|
12
|
+
reject(new Error('maxAttempts reached. Condition not met.'));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
checkCondition();
|
|
17
|
+
});
|
|
18
|
+
}
|