@onehat/ui 0.2.21 → 0.2.22
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
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Tooltip,
|
|
8
8
|
} from 'native-base';
|
|
9
9
|
import {
|
|
10
|
+
CURRENT_MODE,
|
|
10
11
|
UI_MODE_WEB,
|
|
11
12
|
UI_MODE_REACT_NATIVE,
|
|
12
13
|
} from '../../../Constants/UiModes.js';
|
|
@@ -157,7 +158,7 @@ function FileElement(props) {
|
|
|
157
158
|
setLocalFilename(localFilename);
|
|
158
159
|
}, []);
|
|
159
160
|
|
|
160
|
-
if (
|
|
161
|
+
if (CURRENT_MODE === UI_MODE_REACT_NATIVE) {
|
|
161
162
|
throw new Error('Not yet implemented for RN.');
|
|
162
163
|
}
|
|
163
164
|
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
VERTICAL,
|
|
11
11
|
} from '../../Constants/Directions.js';
|
|
12
12
|
import {
|
|
13
|
+
CURRENT_MODE,
|
|
13
14
|
UI_MODE_WEB,
|
|
14
15
|
UI_MODE_REACT_NATIVE,
|
|
15
16
|
} from '../../Constants/UiModes.js';
|
|
@@ -21,10 +22,6 @@ import emptyFn from '../../Functions/emptyFn.js';
|
|
|
21
22
|
import IconButton from '../Buttons/IconButton.js';
|
|
22
23
|
|
|
23
24
|
export default function Header(props) {
|
|
24
|
-
|
|
25
|
-
if (UiGlobals.mode === UI_MODE_REACT_NATIVE) {
|
|
26
|
-
throw new Error('Not yet implemented for RN.');
|
|
27
|
-
}
|
|
28
25
|
|
|
29
26
|
const {
|
|
30
27
|
testID = 'Header',
|
|
@@ -66,41 +63,52 @@ export default function Header(props) {
|
|
|
66
63
|
doubleClickStyle.cursor = 'pointer';
|
|
67
64
|
}
|
|
68
65
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
66
|
+
|
|
67
|
+
if (CURRENT_MODE === UI_MODE_WEB) {
|
|
68
|
+
|
|
69
|
+
if (isCollapsed) {
|
|
70
|
+
if (collapseDirection === HORIZONTAL) {
|
|
71
|
+
collapseBtn = React.cloneElement(collapseBtn, { my: 2, mr: 1, });
|
|
72
|
+
return <div
|
|
73
|
+
className="header"
|
|
74
|
+
style={{ flex: 1, width: '100%', userSelect: 'none', ...doubleClickStyle, }}
|
|
75
|
+
onClick={(e) => {
|
|
76
|
+
if (isCollapsible && e.detail === 2) { // double-click
|
|
77
|
+
onToggleCollapse(e);
|
|
78
|
+
}
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<Column alignItems="center" justifyContent="flex-start" h="100%" w="100%" bg={styles.PANEL_HEADER_BG_VERTICAL} style={{ userSelect: 'none', }} testID={testID}>
|
|
82
|
+
{collapseBtn}
|
|
83
|
+
<div style={{ textOrientation: 'mixed', writingMode: 'vertical-rl', }}>
|
|
84
|
+
<Text flex={1} fontSize={styles.PANEL_HEADER_TEXT_FONTSIZE} color={styles.PANEL_HEADER_TEXT_COLOR} numberOfLines={1} ellipsizeMode="head" testID="text">{title}</Text>
|
|
85
|
+
</div>
|
|
86
|
+
</Column>
|
|
87
|
+
</div>;
|
|
88
|
+
}
|
|
88
89
|
}
|
|
90
|
+
|
|
91
|
+
return <div
|
|
92
|
+
className="header"
|
|
93
|
+
style={{ width: '100%', userSelect: 'none', ...doubleClickStyle, }}
|
|
94
|
+
onClick={(e) => {
|
|
95
|
+
if (isCollapsible && e.detail === 2) { // double-click
|
|
96
|
+
onToggleCollapse(e);
|
|
97
|
+
}
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
<Row alignItems="center" justifyContent="flex-start" px={styles.PANEL_HEADER_PX} py={styles.PANEL_HEADER_PY} bg={styles.PANEL_HEADER_BG} style={{ userSelect: 'none', }} testID={testID}>
|
|
101
|
+
{closeBtn}
|
|
102
|
+
<Text flex={1} fontSize={styles.PANEL_HEADER_TEXT_FONTSIZE} color={styles.PANEL_HEADER_TEXT_COLOR} numberOfLines={1} ellipsizeMode="head" testID="text">{title}</Text>
|
|
103
|
+
{collapseBtn}
|
|
104
|
+
</Row>
|
|
105
|
+
</div>;
|
|
106
|
+
|
|
107
|
+
} else if (CURRENT_MODE === UI_MODE_REACT_NATIVE) {
|
|
108
|
+
|
|
109
|
+
return null;
|
|
110
|
+
|
|
89
111
|
}
|
|
90
112
|
|
|
91
|
-
|
|
92
|
-
className="header"
|
|
93
|
-
style={{ width: '100%', userSelect: 'none', ...doubleClickStyle, }}
|
|
94
|
-
onClick={(e) => {
|
|
95
|
-
if (isCollapsible && e.detail === 2) { // double-click
|
|
96
|
-
onToggleCollapse(e);
|
|
97
|
-
}
|
|
98
|
-
}}
|
|
99
|
-
>
|
|
100
|
-
<Row alignItems="center" justifyContent="flex-start" px={styles.PANEL_HEADER_PX} py={styles.PANEL_HEADER_PY} bg={styles.PANEL_HEADER_BG} style={{ userSelect: 'none', }} testID={testID}>
|
|
101
|
-
{closeBtn}
|
|
102
|
-
<Text flex={1} fontSize={styles.PANEL_HEADER_TEXT_FONTSIZE} color={styles.PANEL_HEADER_TEXT_COLOR} numberOfLines={1} ellipsizeMode="head" testID="text">{title}</Text>
|
|
103
|
-
{collapseBtn}
|
|
104
|
-
</Row>
|
|
105
|
-
</div>;
|
|
113
|
+
|
|
106
114
|
}
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
VERTICAL,
|
|
11
11
|
} from '../../Constants/Directions.js';
|
|
12
12
|
import {
|
|
13
|
+
CURRENT_MODE,
|
|
13
14
|
UI_MODE_WEB,
|
|
14
15
|
UI_MODE_REACT_NATIVE,
|
|
15
16
|
} from '../../Constants/UiModes.js';
|
|
16
|
-
import UiGlobals from '../../UiGlobals.js';
|
|
17
17
|
import Header from './Header.js';
|
|
18
18
|
import withCollapsible from '../Hoc/withCollapsible.js';
|
|
19
19
|
import emptyFn from '../../Functions/emptyFn.js';
|
|
@@ -25,9 +25,6 @@ import _ from 'lodash';
|
|
|
25
25
|
|
|
26
26
|
function Panel(props) {
|
|
27
27
|
|
|
28
|
-
if (UiGlobals.mode === UI_MODE_REACT_NATIVE) {
|
|
29
|
-
throw new Error('Not yet implemented for RN.');
|
|
30
|
-
}
|
|
31
28
|
const {
|
|
32
29
|
isDisabled = false,
|
|
33
30
|
frame = false,
|
|
@@ -125,28 +122,37 @@ function Panel(props) {
|
|
|
125
122
|
if (frame) {
|
|
126
123
|
framePropsToUse = frameProps;
|
|
127
124
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
|
|
126
|
+
if (CURRENT_MODE === UI_MODE_WEB) {
|
|
127
|
+
|
|
128
|
+
if (isCollapsed) {
|
|
129
|
+
if (collapseDirection !== VERTICAL) {
|
|
130
|
+
return <Column overflow="hidden" {...framePropsToUse} w="33px" height="100%">
|
|
131
|
+
{isDisabled && <div className="mask"></div>}
|
|
132
|
+
{headerComponent}
|
|
133
|
+
</Column>;
|
|
134
|
+
}
|
|
135
|
+
return <Column overflow="hidden" {...framePropsToUse}>
|
|
131
136
|
{isDisabled && <div className="mask"></div>}
|
|
132
137
|
{headerComponent}
|
|
133
138
|
</Column>;
|
|
134
139
|
}
|
|
135
|
-
return <Column overflow="hidden" {...framePropsToUse}>
|
|
140
|
+
return <Column overflow="hidden" onLayout={onLayout} {...framePropsToUse} {...sizeProps}>
|
|
136
141
|
{isDisabled && <div className="mask"></div>}
|
|
137
142
|
{headerComponent}
|
|
143
|
+
{topToolbar}
|
|
144
|
+
<Column flex={1} w="100%" overflow="hidden" {...propsToPass}>
|
|
145
|
+
{isScrollable ? <ScrollView>{children}</ScrollView> : children}
|
|
146
|
+
</Column>
|
|
147
|
+
{bottomToolbar}
|
|
148
|
+
{footer}
|
|
138
149
|
</Column>;
|
|
150
|
+
|
|
151
|
+
} else if (CURRENT_MODE === UI_MODE_REACT_NATIVE) {
|
|
152
|
+
|
|
153
|
+
return null;
|
|
154
|
+
|
|
139
155
|
}
|
|
140
|
-
return <Column overflow="hidden" onLayout={onLayout} {...framePropsToUse} {...sizeProps}>
|
|
141
|
-
{isDisabled && <div className="mask"></div>}
|
|
142
|
-
{headerComponent}
|
|
143
|
-
{topToolbar}
|
|
144
|
-
<Column flex={1} w="100%" overflow="hidden" {...propsToPass}>
|
|
145
|
-
{isScrollable ? <ScrollView>{children}</ScrollView> : children}
|
|
146
|
-
</Column>
|
|
147
|
-
{bottomToolbar}
|
|
148
|
-
{footer}
|
|
149
|
-
</Column>;
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
export default withCollapsible(Panel);
|
package/src/Components/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import Date from './Form/Field/Date.js';
|
|
|
20
20
|
import DateRange from './Filter/DateRange.js';
|
|
21
21
|
import DisplayField from './Form/Field/DisplayField.js';
|
|
22
22
|
import FieldSet from './Form/FieldSet.js';
|
|
23
|
-
import File from './Form/Field/File.js';
|
|
23
|
+
// import File from './Form/Field/File.js'; // web only
|
|
24
24
|
import FiltersForm from './Form/FiltersForm.js';
|
|
25
25
|
// import FiltersToolbar from '../Components/Toolbar/FiltersToolbar.js';
|
|
26
26
|
import Form from './Form/Form.js';
|
|
@@ -67,7 +67,7 @@ const components = {
|
|
|
67
67
|
DateRange,
|
|
68
68
|
DisplayField,
|
|
69
69
|
FieldSet,
|
|
70
|
-
File,
|
|
70
|
+
// File,
|
|
71
71
|
FiltersForm,
|
|
72
72
|
// FiltersToolbar,
|
|
73
73
|
Form,
|
|
@@ -2,6 +2,7 @@ import UiGlobals from '../UiGlobals.js';
|
|
|
2
2
|
import CKEditor from '../Components/Form/Field/CKEditor/CKEditor.js';
|
|
3
3
|
import Datetime from '../PlatformImports/Web/Datetime.js';
|
|
4
4
|
import Draggable from '../PlatformImports/Web/Draggable.js';
|
|
5
|
+
import File from './Form/Field/File.js';
|
|
5
6
|
import _ from 'lodash';
|
|
6
7
|
|
|
7
8
|
export default function registerWebComponents() {
|
|
@@ -9,5 +10,6 @@ export default function registerWebComponents() {
|
|
|
9
10
|
CKEditor,
|
|
10
11
|
Datetime,
|
|
11
12
|
Draggable,
|
|
13
|
+
File,
|
|
12
14
|
});
|
|
13
15
|
}
|