fmihel-windeco-components 2.0.0-beta.6 → 2.0.0-beta.61
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/copy-to +19 -3
- package/dev-bs/App.jsx +1 -1
- package/dev-bs/style/custom.scss +1 -1
- package/dist/windeco-components.js +2 -4
- package/dist/windeco-components.js.LICENSE.txt +3 -0
- package/jsx/Btn.jsx +9 -7
- package/jsx/BtnIcon.jsx +36 -15
- package/jsx/CheckBox.jsx +9 -8
- package/jsx/Collapse.jsx +2 -7
- package/jsx/ComboBox/ComboItem.jsx +5 -2
- package/jsx/ComboBox/ComboList.jsx +18 -12
- package/jsx/ComboBox.jsx +42 -15
- package/jsx/Container/Cols.jsx +11 -0
- package/jsx/Container/Row.jsx +18 -0
- package/jsx/Container.jsx +25 -5
- package/jsx/Edit.jsx +32 -29
- package/jsx/Gap/Gap.jsx +4 -6
- package/jsx/Group.jsx +8 -9
- package/jsx/Icon.jsx +6 -7
- package/jsx/Label.jsx +13 -11
- package/jsx/List/ListItem.jsx +5 -9
- package/jsx/List/ListNode.jsx +3 -25
- package/jsx/{List/List.jsx → List.jsx} +8 -22
- package/jsx/Modal.jsx +10 -5
- package/jsx/ModalDialog/Header.jsx +0 -0
- package/jsx/ModalDialog/ModalDialogAPI.js +15 -6
- package/jsx/ModalDialog.jsx +47 -28
- package/jsx/NavBar/NavItem.jsx +36 -25
- package/jsx/NavBar/NavLogo.jsx +5 -3
- package/jsx/NavBar.jsx +36 -60
- package/jsx/OnResize.jsx +126 -0
- package/jsx/StaticText.jsx +30 -0
- package/jsx/Table/TBody.jsx +13 -1
- package/jsx/Table/TD.jsx +41 -2
- package/jsx/Table/TH.jsx +12 -1
- package/jsx/Table/THead.jsx +4 -0
- package/jsx/Table/TR.jsx +40 -13
- package/jsx/Table.jsx +48 -27
- package/jsx/TableFixed/Data.jsx +35 -29
- package/jsx/TableFixed/Header.jsx +4 -0
- package/jsx/TableFixed/TD.jsx +27 -1
- package/jsx/TableFixed/TR.jsx +12 -2
- package/jsx/TableFixed/utils.js +1 -1
- package/jsx/TableFixed.jsx +49 -32
- package/jsx/Text.jsx +11 -12
- package/jsx/arch/NavBar/NavItem.jsx +45 -0
- package/jsx/arch/NavBar/NavLogo.jsx +23 -0
- package/jsx/{NavBar → arch/NavBar}/NavMenu.jsx +3 -3
- package/jsx/arch/NavBar.jsx +81 -0
- package/jsx/index.js +27 -18
- package/package.json +8 -7
- package/style/Btn.scss +36 -24
- package/style/BtnIcon.scss +51 -30
- package/style/CheckBox.scss +26 -33
- package/style/ComboBox.scss +70 -56
- package/style/Container.scss +3 -44
- package/style/Edit.scss +48 -33
- package/style/Gap.scss +10 -5
- package/style/Group.scss +51 -75
- package/style/Icon.scss +2 -3
- package/style/Label.scss +31 -14
- package/style/List.scss +22 -35
- package/style/Modal.scss +8 -4
- package/style/ModalDialog.scss +28 -30
- package/style/NavBar.scss +186 -194
- package/style/ScrollBar.scss +28 -42
- package/style/Table.scss +31 -33
- package/style/TableFixed.scss +21 -26
- package/style/Text.scss +1 -51
- package/style/arch/ComboBox.scss +1 -1
- package/style/arch/NavBar.scss +236 -0
- package/style/{utils.scss → arch/utils.scss} +27 -1
- package/style/{vars.scss → arch/vars.scss} +71 -87
- package/style/ctrls.scss +18 -18
- package/style/define/defineThemeVars.scss +3 -0
- package/style/define/get-var.scss +13 -0
- package/style/index.scss +3 -0
- package/style/readme.txt +1 -1
- package/style/theme-dark.scss +38 -0
- package/style/theme-default.scss +191 -0
- package/style/utils/font-family.scss +37 -0
- package/style/utils/getThemingRootClass.scss +3 -0
- package/style/utils/h.scss +34 -0
- package/style/utils/margin.scss +33 -0
- package/style/utils/no-border.scss +10 -0
- package/style/utils/padding.scss +33 -0
- package/style/utils/panel.scss +36 -0
- package/style/utils/screen.scss +139 -0
- package/style/utils/stretch.scss +3 -0
- package/style/utils/text-style.scss +32 -0
- package/style/utils/transition.scss +9 -0
- package/{jsx/Utils → utils}/abs.js +2 -2
- package/{jsx/Collapse → utils}/collapse.js +2 -2
- package/utils/css.js +56 -0
- package/utils/display.js +2 -0
- package/utils/get.js +24 -0
- package/{jsx/Utils → utils}/isCompact.js +1 -1
- package/utils/navbar.js +28 -0
- package/utils/parentDOM.js +21 -0
- package/utils/style.js +15 -0
- package/{jsx/Utils → utils}/theme.js +1 -1
- package/{jsx/Utils → utils}/timer.js +15 -10
- package/jsx/Container/Col.jsx +0 -24
- /package/style/{all.scss → arch/all.scss} +0 -0
- /package/{jsx/Utils → utils}/DOM.js +0 -0
- /package/{jsx/Utils → utils}/areaDOM.js +0 -0
- /package/{jsx/Utils → utils}/childDOM.js +0 -0
- /package/{jsx/Utils → utils}/filter.js +0 -0
- /package/{jsx/Utils → utils}/getId.js +0 -0
- /package/{jsx/Utils → utils}/isMobile.js +0 -0
- /package/{jsx/Utils → utils}/map.js +0 -0
- /package/{jsx/Utils → utils}/mouse.js +0 -0
- /package/{jsx/Utils → utils}/onResizeScreen.js +0 -0
- /package/{jsx/Utils → utils}/screen.js +0 -0
- /package/{jsx/Utils → utils}/size.js +0 -0
- /package/{jsx/Utils → utils}/throttle.js +0 -0
- /package/{jsx/Utils → utils}/translate.js +0 -0
package/jsx/Icon.jsx
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
+
const definingCssClass = 'wd-icon';
|
|
5
|
+
|
|
4
6
|
export default function Icon({
|
|
5
7
|
src, icon, path,
|
|
6
8
|
className = Icon.global.className,
|
|
7
|
-
addClass = '',
|
|
8
9
|
onClick = undefined,
|
|
9
10
|
style = Icon.global.style,
|
|
10
11
|
icons = Icon.global.icons,
|
|
12
|
+
attr = {},
|
|
11
13
|
}) {
|
|
12
|
-
if (addClass!=='')
|
|
13
|
-
console.warn(`Icon.addClass is deprecated, use className = ${addClass}`);
|
|
14
|
-
|
|
15
14
|
return (
|
|
16
15
|
<img
|
|
17
|
-
type="icon"
|
|
18
16
|
src={src || path || ((icons[icon] && icons[icon].src) ? icons[icon].src : false) || (icons[icon] && icons[icon].path ? icons[icon].path : false) || ''}
|
|
19
|
-
className={
|
|
17
|
+
className={definingCssClass + (className ? ` ${className}` : '') + ((icons[icon] && icons[icon].className) ? ` ${icons[icon].className}` : '')}
|
|
20
18
|
onClick={onClick}
|
|
21
19
|
style={ { ...style } }
|
|
20
|
+
{...attr}
|
|
22
21
|
/>
|
|
23
22
|
);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
Icon.global = {
|
|
27
26
|
icons: {}, // {name1:{src,addClass?},name2:{src,addClass?}...}
|
|
28
|
-
className: '
|
|
27
|
+
className: '',
|
|
29
28
|
style: {},
|
|
30
29
|
};
|
package/jsx/Label.jsx
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
const definingCssClass = 'wd-label';
|
|
4
|
+
|
|
3
5
|
function Label({
|
|
4
6
|
id,
|
|
5
|
-
labelName,
|
|
6
7
|
caption = 'label',
|
|
7
8
|
className = Label.global.className,
|
|
8
|
-
addClass = '',
|
|
9
9
|
style = Label.global.style,
|
|
10
|
+
attr = {},
|
|
10
11
|
children,
|
|
11
|
-
|
|
12
12
|
}) {
|
|
13
|
-
if (addClass!=='')
|
|
14
|
-
console.warn(`Label.addClass is deprecated, use className = ${addClass}`);
|
|
15
|
-
|
|
16
13
|
return (
|
|
17
14
|
<div
|
|
18
|
-
|
|
19
|
-
{...
|
|
15
|
+
label=''
|
|
16
|
+
style={{ ...Label.global.style, ...style }}
|
|
17
|
+
className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
|
|
18
|
+
{...id ? { id: `label-${id}` } : {}}
|
|
19
|
+
|
|
20
20
|
>
|
|
21
21
|
<label
|
|
22
|
-
htmlFor={id
|
|
23
|
-
|
|
22
|
+
htmlFor={id}
|
|
23
|
+
{...attr}
|
|
24
24
|
>
|
|
25
25
|
{caption}
|
|
26
26
|
</label>
|
|
27
|
-
|
|
27
|
+
<div labeled=''>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
28
30
|
</div>
|
|
29
31
|
);
|
|
30
32
|
}
|
package/jsx/List/ListItem.jsx
CHANGED
|
@@ -2,13 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import Gap from '../Gap/Gap.jsx';
|
|
3
3
|
|
|
4
4
|
export default function ListItem({
|
|
5
|
-
id,
|
|
6
5
|
caption,
|
|
7
|
-
data,
|
|
8
6
|
level,
|
|
9
7
|
childs,
|
|
10
8
|
className = ListItem.global.className,
|
|
11
|
-
addClass = ListItem.global.addClass,
|
|
12
9
|
active = false,
|
|
13
10
|
expand = false,
|
|
14
11
|
onClick = undefined,
|
|
@@ -18,23 +15,22 @@ export default function ListItem({
|
|
|
18
15
|
return (
|
|
19
16
|
<Gap
|
|
20
17
|
count ={level}
|
|
21
|
-
|
|
18
|
+
className={`${className} `}
|
|
22
19
|
attr={{
|
|
23
|
-
...(active ? { active: '
|
|
24
|
-
...(expand ? { expand: '
|
|
20
|
+
...(active ? { active: '' } : {}),
|
|
21
|
+
...(expand ? { expand: '' } : {}),
|
|
25
22
|
}}
|
|
26
23
|
onClick={onClick}
|
|
27
24
|
onDoubleClick={onDoubleClick}
|
|
28
25
|
>
|
|
29
|
-
<div
|
|
26
|
+
<div caption=''>
|
|
30
27
|
{caption}
|
|
31
28
|
</div>
|
|
32
|
-
{(childs && childs.length > 0) && <div
|
|
29
|
+
{(childs && childs.length > 0) && <div icon=''></div>}
|
|
33
30
|
</Gap>
|
|
34
31
|
);
|
|
35
32
|
}
|
|
36
33
|
|
|
37
34
|
ListItem.global = {
|
|
38
35
|
className: 'wd-list-item',
|
|
39
|
-
addClass: '',
|
|
40
36
|
};
|
package/jsx/List/ListNode.jsx
CHANGED
|
@@ -2,13 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import Collapse from '../Collapse.jsx';
|
|
3
3
|
|
|
4
4
|
export default function ListNode({
|
|
5
|
-
className = ListNode.global.className,
|
|
6
|
-
addClass = ListNode.global.addClass,
|
|
7
|
-
style = ListNode.global.style,
|
|
8
|
-
|
|
9
|
-
classNameList,
|
|
10
|
-
addClassList,
|
|
11
|
-
styleList,
|
|
12
5
|
|
|
13
6
|
list,
|
|
14
7
|
aliasChilds,
|
|
@@ -31,13 +24,9 @@ export default function ListNode({
|
|
|
31
24
|
|
|
32
25
|
return (
|
|
33
26
|
<div
|
|
27
|
+
list-node = {''}
|
|
34
28
|
key={aid}
|
|
35
29
|
id={aid}
|
|
36
|
-
className={`${className} ${addClass}`}
|
|
37
|
-
style={{
|
|
38
|
-
...ListNode.global.style,
|
|
39
|
-
...style,
|
|
40
|
-
}}
|
|
41
30
|
>
|
|
42
31
|
<ItemComponent
|
|
43
32
|
id={aid}
|
|
@@ -53,20 +42,12 @@ export default function ListNode({
|
|
|
53
42
|
{(childs.length > 0)
|
|
54
43
|
&& <Collapse
|
|
55
44
|
expand = {expand}
|
|
56
|
-
|
|
57
|
-
addClass = {addClassList}
|
|
58
|
-
style={styleList}
|
|
45
|
+
attr = {{ list: '' }}
|
|
59
46
|
|
|
60
47
|
>
|
|
61
48
|
<ListNode
|
|
49
|
+
list-node = {''}
|
|
62
50
|
level={level + 1}
|
|
63
|
-
className = {className}
|
|
64
|
-
addClass = {addClass}
|
|
65
|
-
style={style}
|
|
66
|
-
|
|
67
|
-
classNameList = {classNameList}
|
|
68
|
-
addClassList = {addClassList}
|
|
69
|
-
styleList={styleList}
|
|
70
51
|
|
|
71
52
|
list = {childs}
|
|
72
53
|
ItemComponent ={ItemComponent}
|
|
@@ -89,7 +70,4 @@ export default function ListNode({
|
|
|
89
70
|
}
|
|
90
71
|
|
|
91
72
|
ListNode.global = {
|
|
92
|
-
className: 'wd-node',
|
|
93
|
-
addClass: '',
|
|
94
|
-
style: {},
|
|
95
73
|
};
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import ListItem from './ListItem.jsx';
|
|
3
|
-
import ListNode from './ListNode.jsx';
|
|
2
|
+
import ListItem from './List/ListItem.jsx';
|
|
3
|
+
import ListNode from './List/ListNode.jsx';
|
|
4
|
+
|
|
5
|
+
const definingCssClass = 'wd-list';
|
|
4
6
|
|
|
5
7
|
function List({
|
|
6
8
|
id = undefined,
|
|
7
9
|
className = List.global.className,
|
|
8
|
-
addClass = List.global.addClass,
|
|
9
10
|
style = List.global.style,
|
|
10
11
|
|
|
11
|
-
classNameNode = ListNode.global.className,
|
|
12
|
-
addClassNode = ListNode.global.addClass,
|
|
13
|
-
styleNode = ListNode.global.style,
|
|
14
|
-
|
|
15
12
|
list = [],
|
|
16
13
|
ItemComponent = List.global.ItemComponent,
|
|
17
14
|
|
|
18
15
|
aliasId = List.global.aliasId,
|
|
19
16
|
aliasCaption = List.global.aliasCaption,
|
|
20
17
|
aliasChilds = List.global.aliasChilds,
|
|
21
|
-
|
|
18
|
+
attr = {},
|
|
22
19
|
setup = {},
|
|
23
20
|
onClick = undefined,
|
|
24
21
|
onDoubleClick = undefined,
|
|
@@ -26,24 +23,14 @@ function List({
|
|
|
26
23
|
return (
|
|
27
24
|
<div
|
|
28
25
|
{...(id ? { id } : {})}
|
|
29
|
-
className={`${className
|
|
26
|
+
className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
|
|
30
27
|
style={{
|
|
31
28
|
...List.global.style,
|
|
32
29
|
...style,
|
|
33
30
|
}}
|
|
31
|
+
{...attr}
|
|
34
32
|
>
|
|
35
33
|
<ListNode
|
|
36
|
-
className = {classNameNode}
|
|
37
|
-
addClass = {addClassNode}
|
|
38
|
-
style = {styleNode}
|
|
39
|
-
|
|
40
|
-
classNameList = {className}
|
|
41
|
-
addClassList = {addClass}
|
|
42
|
-
styleList={{
|
|
43
|
-
...List.global.style,
|
|
44
|
-
...style,
|
|
45
|
-
}}
|
|
46
|
-
|
|
47
34
|
list = {list}
|
|
48
35
|
aliasChilds = {aliasChilds}
|
|
49
36
|
aliasId = {aliasId}
|
|
@@ -58,8 +45,7 @@ function List({
|
|
|
58
45
|
);
|
|
59
46
|
}
|
|
60
47
|
List.global = {
|
|
61
|
-
className: '
|
|
62
|
-
addClass: '',
|
|
48
|
+
className: '',
|
|
63
49
|
style: {},
|
|
64
50
|
|
|
65
51
|
ItemComponent: ListItem,
|
package/jsx/Modal.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
|
-
import scr from '
|
|
3
|
+
import scr from '../utils/screen';
|
|
4
4
|
|
|
5
5
|
let _root;
|
|
6
6
|
function getRoot() {
|
|
@@ -16,7 +16,6 @@ function Modal({
|
|
|
16
16
|
enableShadow = true,
|
|
17
17
|
classShadow = Modal.global.classShadow,
|
|
18
18
|
onClickShadow = undefined,
|
|
19
|
-
opacityShadow = Modal.global.opacityShadow,
|
|
20
19
|
attr = {},
|
|
21
20
|
children,
|
|
22
21
|
}) {
|
|
@@ -50,6 +49,11 @@ function Modal({
|
|
|
50
49
|
};
|
|
51
50
|
}, [visible]);
|
|
52
51
|
|
|
52
|
+
const hideContextMenu = (e) => {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
return false;
|
|
55
|
+
};
|
|
56
|
+
|
|
53
57
|
return ReactDOM.createPortal(
|
|
54
58
|
<div
|
|
55
59
|
id = {id}
|
|
@@ -63,6 +67,7 @@ function Modal({
|
|
|
63
67
|
|
|
64
68
|
}}
|
|
65
69
|
{...attr}
|
|
70
|
+
onContextMenu={ hideContextMenu }
|
|
66
71
|
>
|
|
67
72
|
{enableShadow
|
|
68
73
|
&& <div
|
|
@@ -72,9 +77,10 @@ function Modal({
|
|
|
72
77
|
left: -1,
|
|
73
78
|
top: -1,
|
|
74
79
|
...screen,
|
|
75
|
-
...(opacityShadow === false ? {} : { opacity: opacityShadow }),
|
|
80
|
+
// ...(opacityShadow === false ? {} : { opacity: opacityShadow }),
|
|
76
81
|
}}
|
|
77
|
-
|
|
82
|
+
onMouseUp={onClickShadow}
|
|
83
|
+
onContextMenu={ hideContextMenu }
|
|
78
84
|
/>}
|
|
79
85
|
{children}
|
|
80
86
|
</div>,
|
|
@@ -86,7 +92,6 @@ Modal.global = {
|
|
|
86
92
|
idRoot: 'wd-modal',
|
|
87
93
|
className: 'wd-modal',
|
|
88
94
|
classShadow: 'wd-shadow',
|
|
89
|
-
opacityShadow: 0.4,
|
|
90
95
|
};
|
|
91
96
|
|
|
92
97
|
export default Modal;
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import absPos from '
|
|
2
|
-
import screen from '
|
|
3
|
-
import DOM from '
|
|
4
|
-
import isMobile from '
|
|
1
|
+
import absPos from '../../utils/abs';
|
|
2
|
+
import screen from '../../utils/screen';
|
|
3
|
+
import DOM from '../../utils/DOM';
|
|
4
|
+
import isMobile from '../../utils/isMobile';
|
|
5
5
|
import global from '../global';
|
|
6
6
|
|
|
7
7
|
class ModalDialogAPI {
|
|
@@ -97,6 +97,13 @@ class ModalDialogAPI {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
return out;
|
|
100
|
+
} if (align === 'center') {
|
|
101
|
+
return {
|
|
102
|
+
left: (scr.width - width) / 2,
|
|
103
|
+
top: (scr.height - height) / 2,
|
|
104
|
+
width,
|
|
105
|
+
height,
|
|
106
|
+
};
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
return {
|
|
@@ -110,13 +117,15 @@ class ModalDialogAPI {
|
|
|
110
117
|
* @returns { {pos,size,width} }
|
|
111
118
|
*/
|
|
112
119
|
static mobileToObject(mobile) {
|
|
120
|
+
const scr = screen();
|
|
113
121
|
if (mobile === 'large') {
|
|
114
122
|
return { pos: 'center', size: 100, width: 100 };
|
|
115
123
|
} if (mobile === 'middle') {
|
|
116
124
|
return { pos: 'center', size: 60, width: 100 };
|
|
117
125
|
} if (mobile === 'small') {
|
|
118
|
-
return { pos: 'center', size:
|
|
119
|
-
}
|
|
126
|
+
return { pos: 'center', size: 40, width: 80 };
|
|
127
|
+
}
|
|
128
|
+
if (mobile === false) {
|
|
120
129
|
return { pos: false, size: false, width: false };
|
|
121
130
|
}
|
|
122
131
|
const pos = Object.keys(mobile).find((it) => ['center', 'top', 'bottom'].indexOf(it) !== -1);
|
package/jsx/ModalDialog.jsx
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import Modal from './Modal.jsx';
|
|
4
4
|
import api from './ModalDialog/ModalDialogAPI.js';
|
|
5
5
|
import Btn from './Btn.jsx';
|
|
6
|
-
import mousePos from '
|
|
7
|
-
import onResizeScreen from '
|
|
8
|
-
import isCompact from '
|
|
6
|
+
import mousePos from '../utils/mouse.js';
|
|
7
|
+
import onResizeScreen from '../utils/onResizeScreen.js';
|
|
8
|
+
import isCompact from '../utils/isCompact.js';
|
|
9
|
+
import abs from '../utils/abs.js';
|
|
10
|
+
|
|
11
|
+
const definingCssClass = 'wd-modal-dialog';
|
|
9
12
|
|
|
10
13
|
function ModalDialog({
|
|
11
14
|
id,
|
|
@@ -15,7 +18,7 @@ function ModalDialog({
|
|
|
15
18
|
onClickFooterBtn = undefined,
|
|
16
19
|
header = false,
|
|
17
20
|
footer = undefined,
|
|
18
|
-
align = 'stretch', // stretch, custom,stickTo
|
|
21
|
+
align = 'stretch', // stretch, custom,stickTo,center
|
|
19
22
|
stickTo = undefined, // DOM | string
|
|
20
23
|
stickAlign = 'bottom', // bottom | left | screen-right-all
|
|
21
24
|
stickOffX = 0,
|
|
@@ -25,20 +28,17 @@ function ModalDialog({
|
|
|
25
28
|
top = ModalDialog.global.top, // for align = custom
|
|
26
29
|
width = ModalDialog.global.width, // for align = custom,stickTo
|
|
27
30
|
height = ModalDialog.global.height, // for align = custom,stickTo
|
|
28
|
-
mobile =
|
|
31
|
+
mobile = 'small', // false,large,middle,small,{center||top||bottom:<percent size>}
|
|
29
32
|
classShadow = Modal.global.classShadow,
|
|
30
|
-
opacityShadow = Modal.global.opacityShadow,
|
|
31
33
|
enableShadow = true,
|
|
32
34
|
draggable = true, // work with align = custom || stickTo
|
|
33
35
|
resizable = false,
|
|
34
36
|
className = ModalDialog.global.className,
|
|
35
|
-
addClass = '',
|
|
36
37
|
style = { ...ModalDialog.global.style },
|
|
38
|
+
attr = {},
|
|
37
39
|
children,
|
|
38
40
|
|
|
39
41
|
}) {
|
|
40
|
-
if (addClass !== '') console.warn(`ModalDialog.addClass is deprecated, use className = ${addClass}`);
|
|
41
|
-
|
|
42
42
|
const [pos, setPos] = useState({
|
|
43
43
|
left, top,
|
|
44
44
|
});
|
|
@@ -50,13 +50,16 @@ function ModalDialog({
|
|
|
50
50
|
const [off, setOff] = useState({ x: 0, y: 0 });
|
|
51
51
|
const [userModif, setUserModif] = useState(false);
|
|
52
52
|
const [compact, setCompact] = useState(isCompact());
|
|
53
|
-
|
|
53
|
+
const [visibility, setVisibility] = useState('hidden');
|
|
54
|
+
// onst [visibility, setVisibility] = useState('visible');
|
|
55
|
+
const refHeader = useRef();
|
|
54
56
|
let footers = [];
|
|
55
57
|
if (Array.isArray(footer)) {
|
|
56
58
|
footers = footer;
|
|
57
59
|
} else if (typeof footer === 'object') {
|
|
58
60
|
footers = Object.keys(footer);
|
|
59
61
|
}
|
|
62
|
+
|
|
60
63
|
useEffect(() => {
|
|
61
64
|
const resize = (first = false) => {
|
|
62
65
|
const iscompact = isCompact();
|
|
@@ -126,13 +129,30 @@ function ModalDialog({
|
|
|
126
129
|
};
|
|
127
130
|
}, [visible, mouseState, off]);
|
|
128
131
|
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
if (visible) {
|
|
134
|
+
if (visibility === 'hidden') {
|
|
135
|
+
setVisibility('visible');
|
|
136
|
+
}
|
|
137
|
+
} else if (visibility === 'visible') { setVisibility('hidden'); }
|
|
138
|
+
}, [visible, pos]);
|
|
129
139
|
const mouseDown = ({ button }) => {
|
|
130
140
|
if ((align === 'custom' || align === 'stickTo')
|
|
131
141
|
&& draggable && button === 0) {
|
|
132
142
|
const mouse = mousePos();
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
143
|
+
let need = true;
|
|
144
|
+
if (draggable === 'header') {
|
|
145
|
+
if (refHeader.current) {
|
|
146
|
+
const areaHeader = abs(refHeader.current);
|
|
147
|
+
need = ((mouse.x >= areaHeader.x && mouse.x <= areaHeader.x + areaHeader.w)
|
|
148
|
+
&& (mouse.y >= areaHeader.y && mouse.y <= areaHeader.y + areaHeader.h));
|
|
149
|
+
} else need = false;
|
|
150
|
+
}
|
|
151
|
+
if (need) {
|
|
152
|
+
setOff({ x: mouse.x - pos.left, y: mouse.y - pos.top });
|
|
153
|
+
setMouseState('move');
|
|
154
|
+
if (!userModif) setUserModif(true);
|
|
155
|
+
}
|
|
136
156
|
}
|
|
137
157
|
};
|
|
138
158
|
const mouseDownResize = () => {
|
|
@@ -155,36 +175,36 @@ function ModalDialog({
|
|
|
155
175
|
id={id}
|
|
156
176
|
visible={visible}
|
|
157
177
|
classShadow= {classShadow}
|
|
158
|
-
opacityShadow={opacityShadow}
|
|
159
178
|
enableShadow={enableShadow}
|
|
160
179
|
onClickShadow={onClickShadow}
|
|
161
180
|
|
|
162
181
|
><>
|
|
163
182
|
<div
|
|
164
|
-
|
|
183
|
+
|
|
165
184
|
style={{
|
|
166
|
-
...ModalDialog.global.style, ...style, ...pos, ...size,
|
|
185
|
+
...ModalDialog.global.style, ...style, ...pos, ...size, visibility,
|
|
167
186
|
}}
|
|
168
|
-
{
|
|
187
|
+
className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
|
|
169
188
|
onMouseDown={mouseDown}
|
|
189
|
+
{...attr}
|
|
170
190
|
>
|
|
171
191
|
{(header)
|
|
172
|
-
&& <div
|
|
173
|
-
<div
|
|
192
|
+
&& <div dialog-header='' ref= {refHeader}>
|
|
193
|
+
<div dialog-caption=''>
|
|
174
194
|
{header}
|
|
175
195
|
</div>
|
|
176
196
|
{(onClickHeaderClose)
|
|
177
|
-
&& <div
|
|
197
|
+
&& <div dialog-close-btn='' onClick={onClickHeaderClose}>
|
|
178
198
|
✖
|
|
179
199
|
</div>}
|
|
180
200
|
|
|
181
201
|
</div>
|
|
182
202
|
}
|
|
183
|
-
<div
|
|
203
|
+
<div dialog-content=''>
|
|
184
204
|
{children}
|
|
185
205
|
</div>
|
|
186
206
|
{(footers.length > 0)
|
|
187
|
-
&& <div
|
|
207
|
+
&& <div dialog-footer=''>
|
|
188
208
|
{footers.map((key) => <Btn
|
|
189
209
|
id={api.getFooterParam(key, 'id', footer)}
|
|
190
210
|
key={key} onClick={() => clickFooterBtn(key)}
|
|
@@ -197,7 +217,7 @@ function ModalDialog({
|
|
|
197
217
|
}
|
|
198
218
|
</div>
|
|
199
219
|
{resizable && !compact
|
|
200
|
-
&& <div
|
|
220
|
+
&& <div dialog-resize=''
|
|
201
221
|
style={{
|
|
202
222
|
left: pos.left + size.width,
|
|
203
223
|
top: pos.top + size.height,
|
|
@@ -214,14 +234,13 @@ function ModalDialog({
|
|
|
214
234
|
}
|
|
215
235
|
|
|
216
236
|
ModalDialog.global = {
|
|
217
|
-
className: 'wd-dialog-
|
|
237
|
+
className: 'wd-dialog-slide-from-top',
|
|
238
|
+
classShadow: 'wd-shadow',
|
|
218
239
|
style: {},
|
|
219
240
|
left: 0,
|
|
220
241
|
top: 0,
|
|
221
|
-
width:
|
|
242
|
+
width: 400,
|
|
222
243
|
height: 100,
|
|
223
|
-
classShadow: 'wd-shadow',
|
|
224
|
-
opacityShadow: false,
|
|
225
244
|
|
|
226
245
|
};
|
|
227
246
|
export default ModalDialog;
|
package/jsx/NavBar/NavItem.jsx
CHANGED
|
@@ -1,44 +1,55 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import Collapse from '../Collapse.jsx';
|
|
2
3
|
|
|
3
|
-
export function isNavItem(o) {
|
|
4
|
-
return typeof o === 'function' && (o.name === 'NavItem' || o._originalClass === 'NavItem');
|
|
5
|
-
}
|
|
6
4
|
function NavItem({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
className = NavItem.global.className,
|
|
10
|
-
addClass = NavItem.global.addClass,
|
|
11
|
-
style = NavItem.global.style,
|
|
12
|
-
onClick = undefined,
|
|
5
|
+
id,
|
|
6
|
+
caption,
|
|
13
7
|
children,
|
|
8
|
+
active = false,
|
|
9
|
+
open = false,
|
|
10
|
+
style = { ...NavItem.global.style },
|
|
11
|
+
className = NavItem.global.className,
|
|
12
|
+
onClick = NavItem.global.onClick,
|
|
14
13
|
|
|
15
14
|
}) {
|
|
15
|
+
const [opened, setOpened] = useState(open);
|
|
16
16
|
const click = () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
let current = opened;
|
|
18
|
+
if (children) {
|
|
19
|
+
current = !opened;
|
|
20
|
+
setOpened(current);
|
|
21
|
+
}
|
|
22
|
+
if (onClick) {
|
|
23
|
+
onClick({
|
|
24
|
+
id, open: current, caption, active,
|
|
25
|
+
});
|
|
24
26
|
}
|
|
25
|
-
return '';
|
|
26
27
|
};
|
|
28
|
+
|
|
27
29
|
return (
|
|
28
30
|
<div
|
|
29
|
-
className
|
|
30
|
-
style={{ ...NavItem.global.style, ...style }}
|
|
31
|
-
|
|
31
|
+
{...className ? { className } : {}}
|
|
32
|
+
style = {{ ...NavItem.global.style, ...style }}
|
|
33
|
+
nav-item=""
|
|
34
|
+
{...(opened ? { opened: '' } : {})}
|
|
35
|
+
{...(active ? { active: '' } : {})}
|
|
32
36
|
>
|
|
33
|
-
{
|
|
37
|
+
<div caption="" onClick={click}>
|
|
38
|
+
<div text="" >{caption || 'item'}</div>
|
|
39
|
+
{(children) && <div img=""/>}
|
|
40
|
+
</div>
|
|
41
|
+
{(children) && <Collapse expand={opened} attr={{ childs: '' }}>
|
|
42
|
+
{children}
|
|
43
|
+
</Collapse>
|
|
44
|
+
}
|
|
34
45
|
</div>
|
|
35
46
|
);
|
|
36
47
|
}
|
|
37
|
-
NavItem._originalClass = 'NavItem';
|
|
38
48
|
|
|
49
|
+
// NavItem._className='NavItem';
|
|
39
50
|
NavItem.global = {
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
onClick: undefined,
|
|
52
|
+
className: '',
|
|
42
53
|
style: {},
|
|
43
54
|
|
|
44
55
|
};
|
package/jsx/NavBar/NavLogo.jsx
CHANGED
|
@@ -2,15 +2,16 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
function NavLogo({
|
|
4
4
|
className = NavLogo.global.className,
|
|
5
|
-
addClass = NavLogo.global.addClass,
|
|
6
5
|
style = NavLogo.global.style,
|
|
7
|
-
|
|
6
|
+
caption = NavLogo.global.caption,
|
|
8
7
|
children,
|
|
9
8
|
}) {
|
|
10
9
|
return (
|
|
11
|
-
<div
|
|
10
|
+
<div
|
|
11
|
+
{...className ? { className } : {}}
|
|
12
12
|
style={{ ...NavLogo.global.style, ...style }}
|
|
13
13
|
>
|
|
14
|
+
{(caption) && caption }
|
|
14
15
|
{children}
|
|
15
16
|
</div>
|
|
16
17
|
);
|
|
@@ -20,6 +21,7 @@ NavLogo.global = {
|
|
|
20
21
|
className: 'wd-nav-logo',
|
|
21
22
|
addClass: '',
|
|
22
23
|
style: {},
|
|
24
|
+
caption: 'logo',
|
|
23
25
|
|
|
24
26
|
};
|
|
25
27
|
|