fmihel-windeco-components 2.0.0-beta.6 → 2.0.0-beta.60
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 +40 -14
- 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/TableFixed/TD.jsx
CHANGED
|
@@ -7,7 +7,10 @@ function TD({
|
|
|
7
7
|
style = {},
|
|
8
8
|
name = '',
|
|
9
9
|
onClick = undefined,
|
|
10
|
+
onDoubleClick = undefined,
|
|
11
|
+
onDraw = undefined,
|
|
10
12
|
data = [],
|
|
13
|
+
attrs,
|
|
11
14
|
}) {
|
|
12
15
|
const click = () => {
|
|
13
16
|
if (onClick) {
|
|
@@ -16,8 +19,31 @@ function TD({
|
|
|
16
19
|
});
|
|
17
20
|
}
|
|
18
21
|
};
|
|
22
|
+
const doubleClick = () => {
|
|
23
|
+
if (onDoubleClick) {
|
|
24
|
+
onDoubleClick({
|
|
25
|
+
col: name, value, row: rowData, aliasId, data,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
19
29
|
return (
|
|
20
|
-
<td
|
|
30
|
+
<td
|
|
31
|
+
style={style}
|
|
32
|
+
onClick={click}
|
|
33
|
+
onDoubleClick={doubleClick}
|
|
34
|
+
id={name}
|
|
35
|
+
{...(attrs ? { ...attrs } : {})}
|
|
36
|
+
>
|
|
37
|
+
{onDraw ? onDraw({
|
|
38
|
+
sender: 'td',
|
|
39
|
+
col: name,
|
|
40
|
+
value,
|
|
41
|
+
row: rowData,
|
|
42
|
+
data,
|
|
43
|
+
aliasId,
|
|
44
|
+
}) : value}
|
|
45
|
+
|
|
46
|
+
</td>
|
|
21
47
|
);
|
|
22
48
|
}
|
|
23
49
|
|
package/jsx/TableFixed/TR.jsx
CHANGED
|
@@ -6,11 +6,19 @@ function TR({
|
|
|
6
6
|
data = [],
|
|
7
7
|
fields = [], // []
|
|
8
8
|
aliasId = 'ID',
|
|
9
|
+
aliasAttr = '-attr-',
|
|
9
10
|
select = false,
|
|
10
11
|
onClick = undefined,
|
|
12
|
+
onDoubleClick = undefined,
|
|
13
|
+
onDraw = undefined,
|
|
14
|
+
|
|
11
15
|
}) {
|
|
12
16
|
return (
|
|
13
|
-
<tr
|
|
17
|
+
<tr
|
|
18
|
+
id={row[aliasId]}
|
|
19
|
+
{...(select ? { select: 'true' } : {})}
|
|
20
|
+
{...row[aliasAttr]}
|
|
21
|
+
>
|
|
14
22
|
{fields.map((field) => (
|
|
15
23
|
<TD
|
|
16
24
|
key = {field.name}
|
|
@@ -24,7 +32,9 @@ function TR({
|
|
|
24
32
|
...('width' in field ? { width: field.width } : {}),
|
|
25
33
|
}}
|
|
26
34
|
onClick={onClick}
|
|
27
|
-
|
|
35
|
+
onDoubleClick={onDoubleClick}
|
|
36
|
+
onDraw={onDraw}
|
|
37
|
+
attrs={{ ...(field[aliasAttr] ? { ...field[aliasAttr] } : {}) }}
|
|
28
38
|
/>))}
|
|
29
39
|
</tr>
|
|
30
40
|
);
|
package/jsx/TableFixed/utils.js
CHANGED
package/jsx/TableFixed.jsx
CHANGED
|
@@ -4,22 +4,28 @@ import React, { useEffect, useState, useRef } from 'react';
|
|
|
4
4
|
import Header from './TableFixed/Header.jsx';
|
|
5
5
|
import Data from './TableFixed/Data.jsx';
|
|
6
6
|
import { culcWidths, haveScrollBar, isWidthsEmpty } from './TableFixed/utils.js';
|
|
7
|
-
import DOM from '
|
|
8
|
-
import getSize from '
|
|
7
|
+
import DOM from '../utils/DOM.js';
|
|
8
|
+
import getSize from '../utils/size.js';
|
|
9
9
|
import Error from './Error/Error.jsx';
|
|
10
10
|
|
|
11
|
+
const definingCssClass = 'wd-table-fixed';
|
|
12
|
+
|
|
11
13
|
function TableFixed({
|
|
12
14
|
id = undefined,
|
|
13
15
|
className = TableFixed.global.className,
|
|
14
16
|
|
|
15
17
|
aliasId = TableFixed.global.aliasId,
|
|
18
|
+
aliasAttr = TableFixed.global.aliasAttr,
|
|
16
19
|
data = [],
|
|
17
20
|
fields = [],
|
|
18
21
|
header = true, /// / string true false
|
|
19
22
|
noData = TableFixed.global.noData,
|
|
20
23
|
footer = TableFixed.global.footer,
|
|
21
|
-
select =
|
|
24
|
+
select = false,
|
|
22
25
|
onClick = undefined,
|
|
26
|
+
onDoubleClick = undefined,
|
|
27
|
+
onDraw = undefined,
|
|
28
|
+
attr = {},
|
|
23
29
|
|
|
24
30
|
}) {
|
|
25
31
|
if (id === undefined) {
|
|
@@ -28,13 +34,17 @@ function TableFixed({
|
|
|
28
34
|
const [size, setSize] = useState({ width: 0, height: 0 });
|
|
29
35
|
const [widths, setWidths] = useState([]);
|
|
30
36
|
const [border, setBorder] = useState('');
|
|
37
|
+
|
|
31
38
|
const ref = useRef(null);
|
|
39
|
+
const refTable = useRef(null);
|
|
32
40
|
|
|
33
41
|
useEffect(() => {
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
if (refTable.current) {
|
|
43
|
+
const tableDOM = refTable.current;
|
|
44
|
+
|
|
36
45
|
if (header === true) {
|
|
37
46
|
const newWidths = culcWidths(tableDOM, size);
|
|
47
|
+
|
|
38
48
|
if (!isWidthsEmpty(newWidths)) {
|
|
39
49
|
setWidths(newWidths);
|
|
40
50
|
}
|
|
@@ -44,52 +54,53 @@ function TableFixed({
|
|
|
44
54
|
} else if (typeof header === 'string') {
|
|
45
55
|
setWidths([size.width]);
|
|
46
56
|
} else {
|
|
47
|
-
const
|
|
57
|
+
const midWidth = size.width / fields.length;
|
|
58
|
+
const newWidths = fields.map(() => midWidth);
|
|
48
59
|
setWidths(newWidths);
|
|
49
60
|
}
|
|
50
|
-
}, [
|
|
61
|
+
}, [refTable, size, header, data, fields, select]);
|
|
51
62
|
|
|
52
63
|
useEffect(() => {
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
if (refTable.current) {
|
|
65
|
+
const tableDOM = refTable.current;
|
|
55
66
|
setBorder((data.length && haveScrollBar(tableDOM, tableDOM.parentNode)) ? 'right bottom' : '');
|
|
56
67
|
} else if (data.length === 0) {
|
|
57
68
|
setBorder('right bottom left');
|
|
58
69
|
} else {
|
|
59
70
|
setBorder('');
|
|
60
71
|
}
|
|
61
|
-
}, [size, data]);
|
|
72
|
+
}, [size, data, refTable]);
|
|
62
73
|
|
|
63
74
|
useEffect(() => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
throttle = true;
|
|
68
|
-
setTimeout(() => {
|
|
69
|
-
if (ref && ref.current) {
|
|
70
|
-
setSize(getSize(ref.current));
|
|
71
|
-
}
|
|
72
|
-
throttle = false;
|
|
73
|
-
}, 50);
|
|
75
|
+
const observ = new ResizeObserver(() => {
|
|
76
|
+
if (ref && ref.current) {
|
|
77
|
+
setSize(getSize(ref.current));
|
|
74
78
|
}
|
|
75
|
-
};
|
|
76
|
-
const newObserv = new ResizeObserver(() => {
|
|
77
|
-
resize();
|
|
78
|
-
resize();
|
|
79
79
|
});
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
observ.observe(ref.current);
|
|
81
|
+
|
|
82
82
|
return () => {
|
|
83
|
-
|
|
83
|
+
observ.disconnect();
|
|
84
84
|
};
|
|
85
85
|
}, [ref, header, data]);
|
|
86
|
+
|
|
87
|
+
const click = (o) => {
|
|
88
|
+
if (onClick) {
|
|
89
|
+
onClick(o);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const dblclick = (o) => {
|
|
93
|
+
if (onDoubleClick) {
|
|
94
|
+
onDoubleClick(o);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
86
97
|
return (
|
|
87
98
|
<div
|
|
88
99
|
id = {id}
|
|
89
|
-
type='table-fixed'
|
|
90
100
|
container = 'horiz'
|
|
91
|
-
{
|
|
101
|
+
className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
|
|
92
102
|
ref = {ref}
|
|
103
|
+
{...attr}
|
|
93
104
|
>
|
|
94
105
|
{(header)
|
|
95
106
|
&& <Header
|
|
@@ -98,6 +109,7 @@ function TableFixed({
|
|
|
98
109
|
caption={header}
|
|
99
110
|
fields = {fields}
|
|
100
111
|
widths = {widths}
|
|
112
|
+
aliasAttr={aliasAttr}
|
|
101
113
|
/>
|
|
102
114
|
}
|
|
103
115
|
<div
|
|
@@ -108,11 +120,15 @@ function TableFixed({
|
|
|
108
120
|
&& <Data
|
|
109
121
|
id={id}
|
|
110
122
|
aliasId={aliasId}
|
|
123
|
+
aliasAttr={aliasAttr}
|
|
111
124
|
data={data}
|
|
112
125
|
fields={fields}
|
|
113
126
|
footer={footer}
|
|
114
|
-
select={select}
|
|
115
|
-
onClick={
|
|
127
|
+
select={select || []}
|
|
128
|
+
onClick={click}
|
|
129
|
+
onDoubleClick={dblclick}
|
|
130
|
+
onDraw={onDraw}
|
|
131
|
+
ref = {refTable}
|
|
116
132
|
/>
|
|
117
133
|
}
|
|
118
134
|
{(data.length === 0 && noData)
|
|
@@ -127,8 +143,9 @@ function TableFixed({
|
|
|
127
143
|
}
|
|
128
144
|
|
|
129
145
|
TableFixed.global = {
|
|
130
|
-
className: '
|
|
146
|
+
className: '',
|
|
131
147
|
aliasId: 'ID',
|
|
148
|
+
aliasAttr: '-attr-',
|
|
132
149
|
header: true, // string true false
|
|
133
150
|
noData: 'no data', // string or false
|
|
134
151
|
footer: 'end', // string ot false
|
package/jsx/Text.jsx
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
const definingCssClass = 'wd-text';
|
|
4
|
+
|
|
3
5
|
function Text({
|
|
4
6
|
id,
|
|
5
|
-
value =
|
|
7
|
+
value = undefined,
|
|
6
8
|
className = Text.global.className,
|
|
7
|
-
|
|
9
|
+
attr = {},
|
|
8
10
|
style = Text.global.style,
|
|
9
11
|
placeholder = Text.global.placeholder,
|
|
10
12
|
disabled = false,
|
|
@@ -16,12 +18,7 @@ function Text({
|
|
|
16
18
|
rows = 0,
|
|
17
19
|
cols = 0,
|
|
18
20
|
onChange = undefined,
|
|
19
|
-
|
|
20
21
|
}) {
|
|
21
|
-
if (addClass!=='')
|
|
22
|
-
console.warn(`Text.addClass is deprecated, use className = ${addClass}`);
|
|
23
|
-
|
|
24
|
-
|
|
25
22
|
const prepare = (aText, dom) => {
|
|
26
23
|
if (rows > 0 && aText.length > 0 && cols > 0) {
|
|
27
24
|
// console.log('at', { selectionStart: dom.selectionStart });
|
|
@@ -58,15 +55,16 @@ function Text({
|
|
|
58
55
|
const change = ({ currentTarget }) => {
|
|
59
56
|
if (onChange) {
|
|
60
57
|
onChange({ id, value: prepare(currentTarget.value, currentTarget) });
|
|
61
|
-
}else{
|
|
58
|
+
} else {
|
|
62
59
|
console.warn('Text.onChange not set, define it.');
|
|
63
60
|
}
|
|
64
61
|
};
|
|
62
|
+
|
|
65
63
|
return (
|
|
66
64
|
<textarea
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
|
|
65
|
+
{...(id ? { id } : {})}
|
|
66
|
+
className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
|
|
67
|
+
|
|
70
68
|
style={{
|
|
71
69
|
...Text.global.style,
|
|
72
70
|
...(resize ? {} : { resize: 'none' }),
|
|
@@ -75,10 +73,11 @@ function Text({
|
|
|
75
73
|
value={value}
|
|
76
74
|
{...(disabled ? { disabled: true } : { })}
|
|
77
75
|
{...(readonly ? { readOnly: true } : { })}
|
|
78
|
-
{...((required &&
|
|
76
|
+
{...((required && `${value}`.trim().length === 0) ? { required: true } : { })}
|
|
79
77
|
{...(title ? { title } : { })}
|
|
80
78
|
{...(maxLength > 0 ? { maxLength } : { })}
|
|
81
79
|
{...(placeholder ? { placeholder } : {})}
|
|
80
|
+
{...attr}
|
|
82
81
|
onChange={change}
|
|
83
82
|
/>
|
|
84
83
|
);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export function isNavItem(o) {
|
|
4
|
+
return typeof o === 'function' && (o.name === 'NavItem' || o._originalClass === 'NavItem');
|
|
5
|
+
}
|
|
6
|
+
function NavItem({
|
|
7
|
+
caption = undefined,
|
|
8
|
+
link,
|
|
9
|
+
className = NavItem.global.className,
|
|
10
|
+
addClass = NavItem.global.addClass,
|
|
11
|
+
style = NavItem.global.style,
|
|
12
|
+
onClick = undefined,
|
|
13
|
+
children,
|
|
14
|
+
|
|
15
|
+
}) {
|
|
16
|
+
const click = () => {
|
|
17
|
+
if (onClick) onClick({ link });
|
|
18
|
+
};
|
|
19
|
+
const text = () => {
|
|
20
|
+
if (caption) {
|
|
21
|
+
return typeof caption === 'string' ? <span it="cap">{caption}</span> : caption;
|
|
22
|
+
} if (children) {
|
|
23
|
+
return typeof children === 'string' ? <span it="cap">{children}</span> : children;
|
|
24
|
+
}
|
|
25
|
+
return '';
|
|
26
|
+
};
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className={ `${className} ${addClass}`}
|
|
30
|
+
style={{ ...NavItem.global.style, ...style }}
|
|
31
|
+
onClick={click}
|
|
32
|
+
>
|
|
33
|
+
{text()}
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
NavItem._originalClass = 'NavItem';
|
|
38
|
+
|
|
39
|
+
NavItem.global = {
|
|
40
|
+
className: 'wd-nav-item',
|
|
41
|
+
addClass: '',
|
|
42
|
+
style: {},
|
|
43
|
+
|
|
44
|
+
};
|
|
45
|
+
export default NavItem;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
function NavLogo({
|
|
4
|
+
className = NavLogo.global.className,
|
|
5
|
+
addClass = NavLogo.global.addClass,
|
|
6
|
+
style = NavLogo.global.style,
|
|
7
|
+
children,
|
|
8
|
+
}) {
|
|
9
|
+
return (
|
|
10
|
+
<div className={ `${className} ${addClass}`}
|
|
11
|
+
style={{ ...NavLogo.global.style, ...style }}
|
|
12
|
+
>
|
|
13
|
+
{children}
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
NavLogo.global = {
|
|
19
|
+
className: 'wd-nav-logo',
|
|
20
|
+
style: {},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default NavLogo;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import ModalDialog from '../ModalDialog.jsx';
|
|
3
|
-
import onResizeScreen from '
|
|
3
|
+
import onResizeScreen from '../../utils/onResizeScreen.js';
|
|
4
4
|
import NavItem, { isNavItem } from './NavItem.jsx';
|
|
5
5
|
import Collapse from '../Collapse.jsx';
|
|
6
|
-
import size from '
|
|
7
|
-
import isCompact from '
|
|
6
|
+
import size from '../../utils/size';
|
|
7
|
+
import isCompact from '../../utils/isCompact';
|
|
8
8
|
import global from '../global';
|
|
9
9
|
|
|
10
10
|
let menuCloseRoutines = [];
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import NavItem, { isNavItem } from './NavBar/NavItem.jsx';
|
|
3
|
+
import { isNavMenu } from './NavBar/NavMenu.jsx';
|
|
4
|
+
import onResizeScreen from '../utils/onResizeScreen.js';
|
|
5
|
+
import isCompact from '../utils/isCompact.js';
|
|
6
|
+
|
|
7
|
+
let _collapse = [];
|
|
8
|
+
export const collapse = (p = undefined) => {
|
|
9
|
+
if (p === undefined) {
|
|
10
|
+
_collapse.map((close) => close());
|
|
11
|
+
} else if (p.add) {
|
|
12
|
+
_collapse.push(p.add);
|
|
13
|
+
} else if (p.remove) {
|
|
14
|
+
_collapse = _collapse.filter((it) => it === p.remove);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function NavBar({
|
|
19
|
+
Logo = undefined,
|
|
20
|
+
className = NavBar.global.className,
|
|
21
|
+
addClass = NavBar.global.addClass,
|
|
22
|
+
style = NavBar.global.style,
|
|
23
|
+
children,
|
|
24
|
+
}) {
|
|
25
|
+
const [compact, setCompact] = useState(isCompact());
|
|
26
|
+
const [itemsState, setItemsState] = useState('close');
|
|
27
|
+
const toggleMenu = () => {
|
|
28
|
+
setItemsState(itemsState === 'close' ? 'open' : 'close');
|
|
29
|
+
};
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const close = () => {
|
|
32
|
+
setItemsState('close');
|
|
33
|
+
};
|
|
34
|
+
collapse({ add: close });
|
|
35
|
+
|
|
36
|
+
return () => {
|
|
37
|
+
collapse({ remove: close });
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const resize = () => {
|
|
43
|
+
const current = isCompact();
|
|
44
|
+
if (current !== compact) {
|
|
45
|
+
setCompact(current);
|
|
46
|
+
setItemsState('close');
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const removeResizeScreen = onResizeScreen(resize);
|
|
50
|
+
resize();
|
|
51
|
+
return () => {
|
|
52
|
+
removeResizeScreen();
|
|
53
|
+
};
|
|
54
|
+
}, [compact]);
|
|
55
|
+
// console.log('children',children,Array.isArray(children));
|
|
56
|
+
const childs = Array.isArray(children) ? children : [children];
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
it='navbar'
|
|
60
|
+
state={`${itemsState}`}
|
|
61
|
+
className={ `${className} ${addClass}`}
|
|
62
|
+
style={{ ...NavBar.global.style, ...style }}
|
|
63
|
+
>
|
|
64
|
+
<div it='nav-panel'>
|
|
65
|
+
<div it="nav-logo">{Logo && <Logo/>}</div>
|
|
66
|
+
<div it="nav-btn-close" className="wd-nav-btn" onClick={toggleMenu}>≡</div>
|
|
67
|
+
</div>
|
|
68
|
+
<div it={'nav-items'} className="wd-scrollbar">
|
|
69
|
+
{childs.map((it, key) => ((isNavItem(it.type) || isNavMenu(it.type)) ? it : <NavItem key={key}>{it}</NavItem>))}
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
NavBar.global = {
|
|
76
|
+
className: 'wd-navbar',
|
|
77
|
+
addClass: '',
|
|
78
|
+
style: {},
|
|
79
|
+
|
|
80
|
+
};
|
|
81
|
+
export default NavBar;
|
package/jsx/index.js
CHANGED
|
@@ -1,43 +1,52 @@
|
|
|
1
1
|
import REdit from './Edit.jsx';
|
|
2
2
|
import RBtn from './Btn.jsx';
|
|
3
|
+
import RBtnIcon from './BtnIcon.jsx';
|
|
3
4
|
import RCheckBox from './CheckBox.jsx';
|
|
4
5
|
import RLabel from './Label.jsx';
|
|
5
|
-
import RModalDialog from './ModalDialog.jsx';
|
|
6
|
-
import RTableFixed from './TableFixed.jsx';
|
|
7
|
-
import RModal from './Modal.jsx';
|
|
8
|
-
import RComboBox from './ComboBox.jsx';
|
|
9
|
-
import RBtnIcon from './BtnIcon.jsx';
|
|
10
6
|
import RText from './Text.jsx';
|
|
7
|
+
import RComboBox from './ComboBox.jsx';
|
|
8
|
+
import RModal from './Modal.jsx';
|
|
9
|
+
import RModalDialog from './ModalDialog.jsx';
|
|
11
10
|
import RIcon from './Icon.jsx';
|
|
12
|
-
import
|
|
11
|
+
import RTable from './Table.jsx';
|
|
13
12
|
import RGroup from './Group.jsx';
|
|
13
|
+
import RStaticText from './StaticText.jsx';
|
|
14
|
+
import ROnResize from './OnResize.jsx';
|
|
15
|
+
import RList from './List.jsx';
|
|
16
|
+
import RContainer from './Container.jsx';
|
|
14
17
|
|
|
15
18
|
export default {
|
|
16
19
|
Edit: REdit,
|
|
17
20
|
Btn: RBtn,
|
|
21
|
+
BtnIcon: RBtnIcon,
|
|
18
22
|
CheckBox: RCheckBox,
|
|
19
23
|
Label: RLabel,
|
|
24
|
+
Text: RText,
|
|
20
25
|
ComboBox: RComboBox,
|
|
21
|
-
ModalDialog: RModalDialog,
|
|
22
26
|
Modal: RModal,
|
|
23
|
-
|
|
24
|
-
BtnIcon: RBtnIcon,
|
|
25
|
-
Text: RText,
|
|
27
|
+
ModalDialog: RModalDialog,
|
|
26
28
|
Icon: RIcon,
|
|
27
|
-
|
|
29
|
+
Table: RTable,
|
|
28
30
|
Group: RGroup,
|
|
31
|
+
StaticText: RStaticText,
|
|
32
|
+
OnResize: ROnResize,
|
|
33
|
+
List: RList,
|
|
34
|
+
Container: RContainer,
|
|
29
35
|
};
|
|
30
36
|
|
|
31
|
-
export const
|
|
37
|
+
export const Edit = REdit;
|
|
32
38
|
export const Btn = RBtn;
|
|
39
|
+
export const BtnIcon = RBtnIcon;
|
|
33
40
|
export const CheckBox = RCheckBox;
|
|
34
|
-
export const Edit = REdit;
|
|
35
41
|
export const Label = RLabel;
|
|
36
|
-
export const ModalDialog = RModalDialog;
|
|
37
|
-
export const Modal = RModal;
|
|
38
|
-
export const TableFixed = RTableFixed;
|
|
39
|
-
export const BtnIcon = RBtnIcon;
|
|
40
42
|
export const Text = RText;
|
|
43
|
+
export const ComboBox = RComboBox;
|
|
44
|
+
export const Modal = RModal;
|
|
45
|
+
export const ModalDialog = RModalDialog;
|
|
41
46
|
export const Icon = RIcon;
|
|
42
|
-
export const
|
|
47
|
+
export const Table = RTable;
|
|
43
48
|
export const Group = RGroup;
|
|
49
|
+
export const StaticText = RStaticText;
|
|
50
|
+
export const OnResize = ROnResize;
|
|
51
|
+
export const List = RList;
|
|
52
|
+
export const Container = RContainer;
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fmihel-windeco-components",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.60",
|
|
4
4
|
"description": "components for orders windeco",
|
|
5
5
|
"main": "dist/windeco-components.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"run-dev-server": "webpack-dev-server --config webpack.config.dev.js",
|
|
8
8
|
"run-bs-server": "webpack-dev-server --config webpack.config.bs.js",
|
|
9
9
|
"build-dist": "webpack --config webpack.config.dist.js",
|
|
10
|
-
"build": "rm -rf dist && webpack
|
|
10
|
+
"build": "rm -rf dist && webpack",
|
|
11
|
+
"copy-to": "npm run build && bash copy-to",
|
|
11
12
|
"git-push-main": "git checkout main && git push origin main && git push origin main --tag",
|
|
12
13
|
"npm-publish-patch": "npm run build && npm version patch && npm publish",
|
|
13
14
|
"npm-publish-minor": "npm run build && npm version minor && npm publish",
|
|
@@ -78,11 +79,11 @@
|
|
|
78
79
|
"redux": "^4.2.0",
|
|
79
80
|
"redux-thunk": "^2.4.2",
|
|
80
81
|
"replace-in-file-webpack-plugin": "^1.0.6",
|
|
81
|
-
"sass": "^1.
|
|
82
|
-
"sass-loader": "^
|
|
82
|
+
"sass": "^1.89.1",
|
|
83
|
+
"sass-loader": "^16.0.5",
|
|
83
84
|
"style-loader": "^1.2.1",
|
|
84
|
-
"webpack": "^
|
|
85
|
-
"webpack-cli": "^
|
|
86
|
-
"webpack-dev-server": "^
|
|
85
|
+
"webpack": "^5.99.9",
|
|
86
|
+
"webpack-cli": "^6.0.1",
|
|
87
|
+
"webpack-dev-server": "^5.2.1"
|
|
87
88
|
}
|
|
88
89
|
}
|
package/style/Btn.scss
CHANGED
|
@@ -1,33 +1,26 @@
|
|
|
1
1
|
@use "sass:meta";
|
|
2
|
-
@
|
|
2
|
+
@use './utils/transition.scss' as *;
|
|
3
3
|
|
|
4
4
|
@mixin define(){
|
|
5
|
-
|
|
6
|
-
$hovers:$wd-high;
|
|
7
|
-
$hovers-color:$wd-color;
|
|
8
|
-
|
|
9
|
-
@each $theme in $themes{
|
|
10
|
-
#{getThemingRootClass($theme)}{
|
|
11
|
-
--btn-bg-hover:#{meta.inspect(blendColors($colors:$hovers,$theme:$theme,$level:-5%))};
|
|
12
|
-
--btn-color-hover:#{meta.inspect(blendColors($colors:$hovers-color,$theme:$theme,$level:-20%))};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
5
|
+
|
|
16
6
|
|
|
17
|
-
$size:var(--wd-size);
|
|
18
|
-
$bg:var(--wd-high);
|
|
19
|
-
$color:var(--wd-color);
|
|
20
|
-
|
|
21
|
-
$
|
|
22
|
-
$
|
|
23
|
-
$
|
|
24
|
-
$
|
|
25
|
-
$
|
|
7
|
+
$size:var(--v2-wd-size);
|
|
8
|
+
$bg:var(--v2-wd-high);
|
|
9
|
+
$color:var(--v2-wd-color);
|
|
10
|
+
|
|
11
|
+
$border:var(--v2-wd-border);
|
|
12
|
+
$outline:var(--v2-wd-outline);
|
|
13
|
+
$margin:var(--v2-wd-margin);
|
|
14
|
+
$font-size:var(--v2-wd-font-size);
|
|
15
|
+
$margin:var(--v2-wd-margin);
|
|
16
|
+
$radius:var(--v2-wd-radius);
|
|
26
17
|
|
|
27
|
-
[type=
|
|
18
|
+
//input[type=button]{
|
|
19
|
+
.wd-btn{
|
|
28
20
|
min-height: $size;
|
|
29
21
|
height:$size;
|
|
30
22
|
cursor: pointer;
|
|
23
|
+
|
|
31
24
|
background-color: $bg;
|
|
32
25
|
color: $color;
|
|
33
26
|
border:1px solid $border;
|
|
@@ -48,12 +41,31 @@
|
|
|
48
41
|
outline: 2px solid $outline;
|
|
49
42
|
}
|
|
50
43
|
&:hover{
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
filter: brightness(var(--v2-wd-hovering));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.wd-flat{
|
|
48
|
+
background: rgba(0,0,0,0) ;
|
|
49
|
+
&:hover{
|
|
50
|
+
background-color: $bg ;
|
|
51
|
+
filter: brightness(var(--v2-wd-hovering));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
&.only-text{
|
|
55
|
+
background-color: $bg;
|
|
56
|
+
}
|
|
57
|
+
&[disabled]{
|
|
58
|
+
opacity: 0.6;
|
|
59
|
+
&:hover{
|
|
60
|
+
filter: none;
|
|
61
|
+
}
|
|
53
62
|
}
|
|
54
63
|
|
|
64
|
+
|
|
65
|
+
|
|
55
66
|
}
|
|
56
67
|
|
|
68
|
+
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
@include define();
|