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/Btn.jsx
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
+
const definingCssClass = 'wd-btn';
|
|
5
|
+
|
|
4
6
|
export default function Btn({
|
|
5
7
|
id = undefined,
|
|
6
8
|
value,
|
|
7
9
|
onClick = undefined,
|
|
8
10
|
className = Btn.global.className,
|
|
9
|
-
addClass = '',// deprecated
|
|
10
11
|
style = { ...Btn.global.style },
|
|
11
12
|
hint = false,
|
|
12
13
|
title = false,
|
|
14
|
+
disabled = false,
|
|
15
|
+
attr = {},
|
|
13
16
|
children,
|
|
14
17
|
}) {
|
|
15
|
-
if (addClass!=='')
|
|
16
|
-
console.warn(`Btn.addClass is deprecated, use className = ${addClass}`);
|
|
17
18
|
return (
|
|
18
19
|
<input
|
|
19
20
|
type="button"
|
|
20
|
-
{...(id ? {id}:{})}
|
|
21
|
-
{
|
|
21
|
+
{...(id ? { id } : {})}
|
|
22
|
+
className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
|
|
22
23
|
value={value || children || ''}
|
|
23
24
|
onClick={onClick}
|
|
24
|
-
{...(title || hint ? {title:title || hint}:{})}
|
|
25
|
+
{...(title || hint ? { title: title || hint } : {})}
|
|
25
26
|
style={{ ...Btn.global.style, ...style }}
|
|
26
|
-
|
|
27
|
+
disabled = {disabled}
|
|
28
|
+
{...attr}
|
|
27
29
|
/>
|
|
28
30
|
);
|
|
29
31
|
}
|
package/jsx/BtnIcon.jsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
const definingCssClass = 'wd-btn-icon';
|
|
3
4
|
function BtnIcon({
|
|
4
5
|
id,
|
|
5
6
|
value,
|
|
6
7
|
onClick = undefined,
|
|
7
|
-
addClass = '',
|
|
8
8
|
className = BtnIcon.global.className,
|
|
9
9
|
iconClass = BtnIcon.global.iconClass,
|
|
10
10
|
IconComponent = BtnIcon.global.IconComponent,
|
|
@@ -12,27 +12,47 @@ function BtnIcon({
|
|
|
12
12
|
hint = '',
|
|
13
13
|
title = '',
|
|
14
14
|
style = {},
|
|
15
|
+
disabled = false,
|
|
16
|
+
between = true,
|
|
17
|
+
attr = {},
|
|
18
|
+
|
|
15
19
|
children,
|
|
16
|
-
}) {
|
|
17
|
-
if (addClass!=='')
|
|
18
|
-
console.warn(`BtnIcon.addClass is deprecated, use className = "${addClass}"`);
|
|
19
20
|
|
|
21
|
+
}) {
|
|
22
|
+
const doClick = (o) => {
|
|
23
|
+
if (!disabled && !attr.disabled && onClick) {
|
|
24
|
+
onClick(o);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const doKeyDown = (o) => {
|
|
28
|
+
if (o.key === 'Enter') {
|
|
29
|
+
doClick(o);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const showIcon = (iconClass || (IconComponent && icon));
|
|
33
|
+
const showText = (value || children);
|
|
20
34
|
return (
|
|
21
35
|
<div
|
|
22
36
|
type="btn-icon"
|
|
23
|
-
{...(id ? {id}:{})}
|
|
24
|
-
{
|
|
25
|
-
onClick={
|
|
26
|
-
|
|
27
|
-
{...(
|
|
37
|
+
{...(id ? { id } : {})}
|
|
38
|
+
className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
|
|
39
|
+
onClick={doClick}
|
|
40
|
+
onKeyDown={doKeyDown}
|
|
41
|
+
{...(!disabled && !attr.disabled ? { tabIndex: 0 } : {})}
|
|
42
|
+
{...(title || hint ? { title: title || hint } : {})}
|
|
28
43
|
style={{ ...BtnIcon.global.style, ...style }}
|
|
44
|
+
disabled = {disabled}
|
|
45
|
+
{...attr}
|
|
29
46
|
>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
{(showIcon)
|
|
48
|
+
&& <div icon='' {...(iconClass ? { className: iconClass } : {})}>
|
|
49
|
+
{IconComponent && icon && <IconComponent icon={icon}/>}
|
|
50
|
+
</div>
|
|
51
|
+
}
|
|
52
|
+
{(between && showIcon && showText) && <div between=''></div>}
|
|
53
|
+
{(showText)
|
|
54
|
+
&& <div value=''>{value || children}</div>
|
|
55
|
+
}
|
|
36
56
|
</div>
|
|
37
57
|
);
|
|
38
58
|
}
|
|
@@ -41,6 +61,7 @@ BtnIcon.global = {
|
|
|
41
61
|
IconComponent: undefined,
|
|
42
62
|
style: {},
|
|
43
63
|
className: '',
|
|
64
|
+
iconClass: '',
|
|
44
65
|
|
|
45
66
|
};
|
|
46
67
|
|
package/jsx/CheckBox.jsx
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
const definingCssClass = 'wd-checkbox';
|
|
4
|
+
|
|
3
5
|
function CheckBox({
|
|
4
6
|
id,
|
|
5
7
|
checked = false,
|
|
6
8
|
className = CheckBox.global.className,
|
|
7
|
-
addClass = '',//! deprecated
|
|
8
9
|
onChange = undefined,
|
|
9
10
|
style = CheckBox.global.style,
|
|
10
11
|
hint = false,
|
|
11
12
|
title = false,
|
|
12
13
|
disabled = false,
|
|
14
|
+
attr = {},
|
|
13
15
|
visible = true,
|
|
14
16
|
}) {
|
|
15
|
-
if (addClass!=='')
|
|
16
|
-
console.warn(`CheckBox.addClass is deprecated, use className = ${addClass}`);
|
|
17
17
|
const change = ({ target }) => {
|
|
18
18
|
if (!disabled) {
|
|
19
19
|
if (onChange) {
|
|
@@ -23,10 +23,10 @@ function CheckBox({
|
|
|
23
23
|
};
|
|
24
24
|
return (
|
|
25
25
|
<input
|
|
26
|
-
type="checkbox"
|
|
27
|
-
{...(id ? {id}:{})}
|
|
28
|
-
{
|
|
29
|
-
|
|
26
|
+
type="checkbox"
|
|
27
|
+
{...(id ? { id } : {})}
|
|
28
|
+
className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
|
|
29
|
+
|
|
30
30
|
onChange = {change}
|
|
31
31
|
checked = {checked}
|
|
32
32
|
style={{
|
|
@@ -34,7 +34,8 @@ function CheckBox({
|
|
|
34
34
|
...style,
|
|
35
35
|
...(visible ? {} : { display: 'none' }),
|
|
36
36
|
}}
|
|
37
|
-
{...(title || hint ? {title:title || hint}:{})}
|
|
37
|
+
{...(title || hint ? { title: title || hint } : {})}
|
|
38
|
+
{...attr}
|
|
38
39
|
/>
|
|
39
40
|
);
|
|
40
41
|
}
|
package/jsx/Collapse.jsx
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import React, {
|
|
2
2
|
useEffect, useRef, useState,
|
|
3
3
|
} from 'react';
|
|
4
|
-
import collapse from '
|
|
4
|
+
import collapse from '../utils/collapse';
|
|
5
5
|
|
|
6
6
|
export default function Collapse({
|
|
7
7
|
className = Collapse.global.className,
|
|
8
|
-
addClass = '',
|
|
9
8
|
style = Collapse.global.style,
|
|
10
9
|
expand = true,
|
|
11
10
|
delay = Collapse.global.delay,
|
|
12
11
|
attr = {},
|
|
13
12
|
children,
|
|
14
13
|
}) {
|
|
15
|
-
if (addClass !== '') {
|
|
16
|
-
console.warn(`Collapse.addClass is deprecated, use className = ${addClass}`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
14
|
const dom = useRef(null);
|
|
20
15
|
const [position, setPosition] = useState('fixed');
|
|
21
16
|
const [show, setShow] = useState(false);
|
|
@@ -45,7 +40,7 @@ export default function Collapse({
|
|
|
45
40
|
}
|
|
46
41
|
}
|
|
47
42
|
}, [expand, dom, delay]);
|
|
48
|
-
const css = `${className}
|
|
43
|
+
const css = `${className}`;
|
|
49
44
|
|
|
50
45
|
return (
|
|
51
46
|
<>{(expand || show)
|
|
@@ -9,22 +9,25 @@ function ComboItem({
|
|
|
9
9
|
onGetItemClass = undefined,
|
|
10
10
|
style = {},
|
|
11
11
|
attr = {},
|
|
12
|
+
active = false,
|
|
12
13
|
children,
|
|
13
14
|
}) {
|
|
14
15
|
const click = () => {
|
|
15
|
-
if (!disabled && onClick) {
|
|
16
|
+
if (!disabled && !active && onClick) {
|
|
16
17
|
onClick(data);
|
|
17
18
|
}
|
|
18
19
|
};
|
|
19
20
|
return (
|
|
20
21
|
<div
|
|
21
|
-
|
|
22
|
+
combo-item=''
|
|
23
|
+
|
|
22
24
|
className={`${className} ${onGetItemClass ? onGetItemClass(data) : ''}`}
|
|
23
25
|
onClick={click}
|
|
24
26
|
title={title || ''}
|
|
25
27
|
style={style}
|
|
26
28
|
{...attr}
|
|
27
29
|
{...(disabled ? { disabled: true } : {})}
|
|
30
|
+
{...(active ? { active: '' } : {})}
|
|
28
31
|
>
|
|
29
32
|
{children}
|
|
30
33
|
</div>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import screen from '
|
|
2
|
+
import screen from '../../utils/screen';
|
|
3
3
|
import ComboItem from './ComboItem.jsx';
|
|
4
|
-
import global from '../global';
|
|
5
4
|
import ModalDialogAPI from '../ModalDialog/ModalDialogAPI';
|
|
6
|
-
import isMobile from '
|
|
5
|
+
import isMobile from '../../utils/isMobile';
|
|
7
6
|
|
|
8
7
|
function listPos({
|
|
9
|
-
left, top, width, height, mobile,
|
|
8
|
+
left, top, width, height, mobile, itemsCount, itemHeight,
|
|
10
9
|
}) {
|
|
11
10
|
const scr = screen();
|
|
12
11
|
if (mobile) {
|
|
@@ -19,9 +18,16 @@ function listPos({
|
|
|
19
18
|
const out = {
|
|
20
19
|
left, top, width, height,
|
|
21
20
|
};
|
|
22
|
-
out.height =
|
|
21
|
+
out.height = Math.max(Math.min(scr.height, (itemsCount) * (itemHeight + 1) + itemHeight / 2), height);
|
|
22
|
+
|
|
23
23
|
if (out.top + height + out.height > scr.height) {
|
|
24
|
-
out.top
|
|
24
|
+
if (out.top > scr.height / 2) {
|
|
25
|
+
out.height = Math.min(out.height, out.top) - 2;
|
|
26
|
+
out.top -= (out.height + 2);
|
|
27
|
+
} else {
|
|
28
|
+
out.top = top + height + 1;
|
|
29
|
+
out.height = scr.height - out.top;
|
|
30
|
+
}
|
|
25
31
|
} else {
|
|
26
32
|
out.top = top + height + 1;
|
|
27
33
|
}
|
|
@@ -35,7 +41,6 @@ function ComboList({
|
|
|
35
41
|
width = 100,
|
|
36
42
|
height = 100,
|
|
37
43
|
className = '',
|
|
38
|
-
addClass = '',
|
|
39
44
|
styleItem = {},
|
|
40
45
|
aliasId = 'id',
|
|
41
46
|
aliasCaption = 'caption',
|
|
@@ -43,14 +48,12 @@ function ComboList({
|
|
|
43
48
|
ItemComponent = ComboItem,
|
|
44
49
|
onGetItemClass = undefined,
|
|
45
50
|
onClick = undefined,
|
|
51
|
+
select = false,
|
|
46
52
|
}) {
|
|
47
|
-
if (addClass!=='')
|
|
48
|
-
console.warn(`ComboList.addClass is deprecated, use className = ${addClass}`);
|
|
49
|
-
|
|
50
53
|
return (
|
|
51
54
|
<div
|
|
52
|
-
|
|
53
|
-
className={`${className}
|
|
55
|
+
combo-list=''
|
|
56
|
+
className={`${className}`}
|
|
54
57
|
style = {{
|
|
55
58
|
...listPos({
|
|
56
59
|
left,
|
|
@@ -58,6 +61,8 @@ function ComboList({
|
|
|
58
61
|
width,
|
|
59
62
|
height,
|
|
60
63
|
mobile: isMobile(),
|
|
64
|
+
itemsCount: list.length,
|
|
65
|
+
itemHeight: 32,
|
|
61
66
|
}),
|
|
62
67
|
}}
|
|
63
68
|
>
|
|
@@ -71,6 +76,7 @@ function ComboList({
|
|
|
71
76
|
onGetItemClass={onGetItemClass}
|
|
72
77
|
disabled={aliasDisabled in item ? item[aliasDisabled] : false}
|
|
73
78
|
style={styleItem}
|
|
79
|
+
active={select !== false && `${select}` === `${item[aliasId]}`}
|
|
74
80
|
>
|
|
75
81
|
{item[aliasCaption]}
|
|
76
82
|
</ItemComponent>
|
package/jsx/ComboBox.jsx
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import abs from '
|
|
2
|
+
import abs from '../utils/abs';
|
|
3
3
|
import Modal from './Modal.jsx';
|
|
4
4
|
import ComboList from './ComboBox/ComboList.jsx';
|
|
5
5
|
import ComboItem from './ComboBox/ComboItem.jsx';
|
|
6
|
+
import screen from '../utils/screen';
|
|
7
|
+
|
|
8
|
+
const definingCssClass = 'wd-combo';
|
|
6
9
|
|
|
7
10
|
function ComboBox({
|
|
8
11
|
id,
|
|
9
12
|
className = ComboBox.global.className,
|
|
10
|
-
addClass = '',
|
|
11
13
|
classList = ComboBox.global.classList,
|
|
12
14
|
style = ComboBox.global.style,
|
|
13
15
|
styleOuter = {},
|
|
@@ -27,14 +29,11 @@ function ComboBox({
|
|
|
27
29
|
aliasCaption = ComboBox.global.aliasCaption,
|
|
28
30
|
aliasDisabled = ComboBox.global.aliasDisabled,
|
|
29
31
|
ItemComponent = ComboBox.global.ItemComponent,
|
|
32
|
+
attr = {},
|
|
30
33
|
|
|
31
34
|
}) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const selected = list.find((item) => (item[aliasId] == select));
|
|
36
|
-
const selectCaption = selected ? selected[aliasCaption] : false;
|
|
37
|
-
|
|
35
|
+
const [selected, setSelected] = useState(undefined);
|
|
36
|
+
const [selectCaption, setSelectCaption] = useState(false);
|
|
38
37
|
const [open, setOpen] = useState(false);
|
|
39
38
|
const [btnOpenShow, setBtnOpenShow] = useState(!hideBtnOnSelect);
|
|
40
39
|
const [focused, setFocused] = useState(false);
|
|
@@ -42,6 +41,17 @@ function ComboBox({
|
|
|
42
41
|
const [size, setSize] = useState({
|
|
43
42
|
left: 0, top: 0, width: 0, height: 0,
|
|
44
43
|
});
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (list && list.length && select !== false) {
|
|
47
|
+
const sel = list.find((item) => (item[aliasId] == select));
|
|
48
|
+
setSelected(sel);
|
|
49
|
+
setSelectCaption(sel ? sel[aliasCaption] : false);
|
|
50
|
+
} else {
|
|
51
|
+
setSelected(undefined);
|
|
52
|
+
setSelectCaption(false);
|
|
53
|
+
}
|
|
54
|
+
}, [list, select, aliasId]);
|
|
45
55
|
/*
|
|
46
56
|
useEffect(() => {
|
|
47
57
|
const resize = () => {
|
|
@@ -68,6 +78,20 @@ function ComboBox({
|
|
|
68
78
|
out.top = area.y;
|
|
69
79
|
out.width = area.w;
|
|
70
80
|
out.height = area.h;
|
|
81
|
+
const scr = screen();
|
|
82
|
+
|
|
83
|
+
if (out.width > scr.width) {
|
|
84
|
+
out.left = 1;
|
|
85
|
+
out.width = scr.width - 2;
|
|
86
|
+
} else {
|
|
87
|
+
if (out.left + out.width > scr.width) {
|
|
88
|
+
out.left -= (out.left + out.width - scr.width);
|
|
89
|
+
}
|
|
90
|
+
if (out.left < 0) {
|
|
91
|
+
out.left = 0;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
71
95
|
setSize(out);
|
|
72
96
|
}
|
|
73
97
|
}, [open]);
|
|
@@ -82,8 +106,8 @@ function ComboBox({
|
|
|
82
106
|
setOpen(false);
|
|
83
107
|
if (onChange) {
|
|
84
108
|
onChange({ id, data });
|
|
85
|
-
}else{
|
|
86
|
-
console.warn('ComboBox.onChange not set, define it..')
|
|
109
|
+
} else {
|
|
110
|
+
console.warn('ComboBox.onChange not set, define it..');
|
|
87
111
|
}
|
|
88
112
|
};
|
|
89
113
|
const getItemClass = () => {
|
|
@@ -125,9 +149,9 @@ function ComboBox({
|
|
|
125
149
|
return (
|
|
126
150
|
<>
|
|
127
151
|
<div
|
|
128
|
-
|
|
129
|
-
{...(id ? {id}:{})}
|
|
130
|
-
{
|
|
152
|
+
combo=''
|
|
153
|
+
{...(id ? { id } : {})}
|
|
154
|
+
className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
|
|
131
155
|
style={{ ...ComboBox.global.style, ...style }}
|
|
132
156
|
onClick = {click}
|
|
133
157
|
ref = {ref}
|
|
@@ -139,17 +163,19 @@ function ComboBox({
|
|
|
139
163
|
onFocus={focus}
|
|
140
164
|
onBlur={focusOut}
|
|
141
165
|
onKeyDown={keyDown}
|
|
142
|
-
|
|
166
|
+
{...attr}
|
|
143
167
|
>
|
|
144
168
|
<ItemComponent
|
|
145
169
|
title={selectCaption || ''}
|
|
146
170
|
onGetItemClass = {getItemClass}
|
|
147
171
|
attr={{ state: (selected ? 'select' : 'no-select') }}
|
|
148
172
|
style={styleOuter}
|
|
173
|
+
data={selected}
|
|
149
174
|
>
|
|
150
175
|
{selectCaption || placeholder || ''}
|
|
176
|
+
|
|
151
177
|
</ItemComponent>
|
|
152
|
-
<div style={ { ...((btnOpenShow || focused) ? {} : { display: 'none' }) }} />
|
|
178
|
+
<div style={ { ...((btnOpenShow || focused || !selected) ? {} : { display: 'none' }) }} />
|
|
153
179
|
</div>
|
|
154
180
|
{(!disabled) && <Modal
|
|
155
181
|
visible = {open}
|
|
@@ -167,6 +193,7 @@ function ComboBox({
|
|
|
167
193
|
onClick={change}
|
|
168
194
|
onGetItemClass = {onGetItemClass}
|
|
169
195
|
ItemComponent={ItemComponent}
|
|
196
|
+
select={select}
|
|
170
197
|
/>
|
|
171
198
|
</Modal>}
|
|
172
199
|
</>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Cols from './Cols.jsx';
|
|
3
|
+
|
|
4
|
+
function Row({
|
|
5
|
+
row,
|
|
6
|
+
// first = false, last = false,
|
|
7
|
+
}) {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
// {...(first ? { first: '' } : {})}
|
|
11
|
+
// {...(last ? { last: '' } : {})}
|
|
12
|
+
>
|
|
13
|
+
<Cols cols={row}/>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default Row;
|
package/jsx/Container.jsx
CHANGED
|
@@ -1,17 +1,37 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import Row from './Container/Row.jsx';
|
|
2
3
|
|
|
3
4
|
function Container({
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
maxCol = 3,
|
|
6
|
+
RowComponent = Row,
|
|
7
|
+
className = '',
|
|
6
8
|
style = { ...Container.global.style },
|
|
9
|
+
attr = {},
|
|
7
10
|
children,
|
|
8
11
|
}) {
|
|
12
|
+
const [rows, setRows] = useState([]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (children) {
|
|
15
|
+
const out = [];
|
|
16
|
+
(children.map ? children : [children]).map((child, i) => {
|
|
17
|
+
if (i % maxCol === 0) {
|
|
18
|
+
out.push([]);
|
|
19
|
+
}
|
|
20
|
+
out[out.length - 1].push(child);
|
|
21
|
+
});
|
|
22
|
+
setRows(out);
|
|
23
|
+
}
|
|
24
|
+
}, [children]);
|
|
9
25
|
return (
|
|
10
26
|
<div
|
|
11
|
-
className={ `${className} ${
|
|
27
|
+
className={ `${Container.global.className} ${className}`}
|
|
12
28
|
style={{ ...Container.global.style, ...style }}
|
|
29
|
+
{...attr}
|
|
13
30
|
>
|
|
14
|
-
{
|
|
31
|
+
{rows.map((row, key) => (<RowComponent
|
|
32
|
+
key={key}
|
|
33
|
+
row={row}
|
|
34
|
+
/>))}
|
|
15
35
|
</div>
|
|
16
36
|
);
|
|
17
37
|
}
|
package/jsx/Edit.jsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
|
|
3
|
+
const definingCssClass = 'wd-edit';
|
|
4
|
+
|
|
3
5
|
function Edit({
|
|
4
6
|
id,
|
|
5
7
|
value,
|
|
@@ -10,13 +12,13 @@ function Edit({
|
|
|
10
12
|
onKeyDown = undefined,
|
|
11
13
|
|
|
12
14
|
className = Edit.global.className,
|
|
13
|
-
addClass = '',
|
|
14
15
|
style = Edit.global.style,
|
|
15
16
|
|
|
16
17
|
placeholder = '',
|
|
17
18
|
readonly = undefined,
|
|
18
19
|
disabled = undefined,
|
|
19
20
|
required = undefined,
|
|
21
|
+
error = undefined, // true or text for show error text
|
|
20
22
|
title = '',
|
|
21
23
|
hint = '',
|
|
22
24
|
visible = true,
|
|
@@ -25,12 +27,9 @@ function Edit({
|
|
|
25
27
|
step = undefined, // for type = range or number
|
|
26
28
|
minLength = 0,
|
|
27
29
|
maxLength = 0,
|
|
28
|
-
|
|
30
|
+
attr = {},
|
|
29
31
|
children,
|
|
30
32
|
}) {
|
|
31
|
-
if (addClass !== '') {
|
|
32
|
-
console.warn(`Edit.addClass is deprecated, use className = ${addClass}`);
|
|
33
|
-
}
|
|
34
33
|
const [focused, setFocused] = useState(false);
|
|
35
34
|
|
|
36
35
|
const change = (o) => {
|
|
@@ -77,32 +76,36 @@ function Edit({
|
|
|
77
76
|
_type = focused ? type : 'text';
|
|
78
77
|
}
|
|
79
78
|
return (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
value={val}
|
|
86
|
-
onChange={change}
|
|
87
|
-
onKeyUp={keyup}
|
|
88
|
-
onKeyDown={keydn}
|
|
89
|
-
// onKeyPress={keypress} deprected
|
|
90
|
-
onFocus={focus}
|
|
91
|
-
onBlur = {unfocus}
|
|
92
|
-
style={{
|
|
93
|
-
...Edit.global.style,
|
|
94
|
-
...style,
|
|
95
|
-
...(visible ? {} : { display: 'none' }),
|
|
96
|
-
}}
|
|
97
|
-
{...(placeholder ? { placeholder } : {})}
|
|
98
|
-
{...(disabled ? { disabled: true } : {})}
|
|
99
|
-
{...(readonly ? { readOnly: 'readonly' } : {})}
|
|
100
|
-
{...((required && `${val}`.length === 0) ? { required: true } : {})}
|
|
79
|
+
<>
|
|
80
|
+
<input
|
|
81
|
+
type={_type}
|
|
82
|
+
{...(id ? { id } : {})}
|
|
83
|
+
className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
|
|
101
84
|
|
|
102
|
-
|
|
103
|
-
|
|
85
|
+
value={val}
|
|
86
|
+
onChange={change}
|
|
87
|
+
onKeyUp={keyup}
|
|
88
|
+
onKeyDown={keydn}
|
|
89
|
+
// onKeyPress={keypress} deprected
|
|
90
|
+
onFocus={focus}
|
|
91
|
+
onBlur = {unfocus}
|
|
92
|
+
style={{
|
|
93
|
+
...Edit.global.style,
|
|
94
|
+
...style,
|
|
95
|
+
...(visible ? {} : { display: 'none' }),
|
|
96
|
+
}}
|
|
97
|
+
{...(placeholder ? { placeholder } : {})}
|
|
98
|
+
{...(disabled ? { disabled: true } : {})}
|
|
99
|
+
{...(readonly ? { readOnly: 'readonly' } : {})}
|
|
100
|
+
{...((required && `${val}`.length === 0) ? { required: true } : {})}
|
|
104
101
|
|
|
105
|
-
|
|
102
|
+
{...props}
|
|
103
|
+
{...(title || hint ? { title: title || hint } : {})}
|
|
104
|
+
{...attr}
|
|
105
|
+
{...error ? { error: '' } : {}}
|
|
106
|
+
/>
|
|
107
|
+
{(typeof error === 'string') && <div className="error-edit-msg" dangerouslySetInnerHTML = {{ __html: error }}></div>}
|
|
108
|
+
</>
|
|
106
109
|
);
|
|
107
110
|
}
|
|
108
111
|
|
package/jsx/Gap/Gap.jsx
CHANGED
|
@@ -3,7 +3,6 @@ import React from 'react';
|
|
|
3
3
|
function Gap({
|
|
4
4
|
count,
|
|
5
5
|
className = Gap.global.className,
|
|
6
|
-
addClass = Gap.global.addClass,
|
|
7
6
|
style = Gap.global.style,
|
|
8
7
|
attr = {},
|
|
9
8
|
onClick = undefined,
|
|
@@ -11,11 +10,11 @@ function Gap({
|
|
|
11
10
|
children,
|
|
12
11
|
|
|
13
12
|
}) {
|
|
14
|
-
// console.log('level', count, Array(count).fill('').map(() => 's'));
|
|
15
13
|
return (
|
|
16
14
|
<div
|
|
17
|
-
|
|
18
|
-
className
|
|
15
|
+
gap=''
|
|
16
|
+
{...(className ? { className: `${className}` } : {})}
|
|
17
|
+
|
|
19
18
|
style={{
|
|
20
19
|
...Gap.global.style,
|
|
21
20
|
...style,
|
|
@@ -24,14 +23,13 @@ function Gap({
|
|
|
24
23
|
onClick={onClick}
|
|
25
24
|
onDoubleClick={onDoubleClick}
|
|
26
25
|
>
|
|
27
|
-
{Array(count).fill('').map((it, i) => <div key={i} gap=
|
|
26
|
+
{Array(count).fill('').map((it, i) => <div key={i} gap='' ></div>)}
|
|
28
27
|
{children}
|
|
29
28
|
</div>);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
Gap.global = {
|
|
33
32
|
className: '',
|
|
34
|
-
addClass: '',
|
|
35
33
|
style: {},
|
|
36
34
|
|
|
37
35
|
};
|
package/jsx/Group.jsx
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
+
const definingCssClass = 'wd-group';
|
|
5
|
+
|
|
4
6
|
function Group({
|
|
5
7
|
id,
|
|
6
8
|
className = Group.global.className,
|
|
7
|
-
addClass = '',
|
|
8
9
|
style = Group.global.style,
|
|
9
10
|
caption = '',
|
|
11
|
+
attr = {},
|
|
10
12
|
children,
|
|
11
|
-
|
|
12
13
|
}) {
|
|
13
|
-
if (addClass!=='')
|
|
14
|
-
console.warn(`Group.addClass is deprecated, use className = ${addClass}`);
|
|
15
|
-
|
|
16
14
|
return (
|
|
17
15
|
<div
|
|
18
|
-
|
|
16
|
+
group=''
|
|
19
17
|
{...(id ? { id } : {})}
|
|
20
|
-
{
|
|
18
|
+
className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
|
|
21
19
|
style={{ ...Group.global.style, ...style }}
|
|
20
|
+
{...attr}
|
|
22
21
|
>
|
|
23
|
-
{ (caption) && <div
|
|
24
|
-
<div>{children}</div>
|
|
22
|
+
{ (caption) && <div caption='' >{caption}</div>}
|
|
23
|
+
<div content='' >{children}</div>
|
|
25
24
|
</div>
|
|
26
25
|
);
|
|
27
26
|
}
|