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.
Files changed (117) hide show
  1. package/copy-to +19 -3
  2. package/dev-bs/App.jsx +1 -1
  3. package/dev-bs/style/custom.scss +1 -1
  4. package/dist/windeco-components.js +2 -4
  5. package/dist/windeco-components.js.LICENSE.txt +3 -0
  6. package/jsx/Btn.jsx +9 -7
  7. package/jsx/BtnIcon.jsx +36 -15
  8. package/jsx/CheckBox.jsx +9 -8
  9. package/jsx/Collapse.jsx +2 -7
  10. package/jsx/ComboBox/ComboItem.jsx +5 -2
  11. package/jsx/ComboBox/ComboList.jsx +18 -12
  12. package/jsx/ComboBox.jsx +40 -14
  13. package/jsx/Container/Cols.jsx +11 -0
  14. package/jsx/Container/Row.jsx +18 -0
  15. package/jsx/Container.jsx +25 -5
  16. package/jsx/Edit.jsx +32 -29
  17. package/jsx/Gap/Gap.jsx +4 -6
  18. package/jsx/Group.jsx +8 -9
  19. package/jsx/Icon.jsx +6 -7
  20. package/jsx/Label.jsx +13 -11
  21. package/jsx/List/ListItem.jsx +5 -9
  22. package/jsx/List/ListNode.jsx +3 -25
  23. package/jsx/{List/List.jsx → List.jsx} +8 -22
  24. package/jsx/Modal.jsx +10 -5
  25. package/jsx/ModalDialog/Header.jsx +0 -0
  26. package/jsx/ModalDialog/ModalDialogAPI.js +15 -6
  27. package/jsx/ModalDialog.jsx +47 -28
  28. package/jsx/NavBar/NavItem.jsx +36 -25
  29. package/jsx/NavBar/NavLogo.jsx +5 -3
  30. package/jsx/NavBar.jsx +36 -60
  31. package/jsx/OnResize.jsx +126 -0
  32. package/jsx/StaticText.jsx +30 -0
  33. package/jsx/Table/TBody.jsx +13 -1
  34. package/jsx/Table/TD.jsx +41 -2
  35. package/jsx/Table/TH.jsx +12 -1
  36. package/jsx/Table/THead.jsx +4 -0
  37. package/jsx/Table/TR.jsx +40 -13
  38. package/jsx/Table.jsx +48 -27
  39. package/jsx/TableFixed/Data.jsx +35 -29
  40. package/jsx/TableFixed/Header.jsx +4 -0
  41. package/jsx/TableFixed/TD.jsx +27 -1
  42. package/jsx/TableFixed/TR.jsx +12 -2
  43. package/jsx/TableFixed/utils.js +1 -1
  44. package/jsx/TableFixed.jsx +49 -32
  45. package/jsx/Text.jsx +11 -12
  46. package/jsx/arch/NavBar/NavItem.jsx +45 -0
  47. package/jsx/arch/NavBar/NavLogo.jsx +23 -0
  48. package/jsx/{NavBar → arch/NavBar}/NavMenu.jsx +3 -3
  49. package/jsx/arch/NavBar.jsx +81 -0
  50. package/jsx/index.js +27 -18
  51. package/package.json +8 -7
  52. package/style/Btn.scss +36 -24
  53. package/style/BtnIcon.scss +51 -30
  54. package/style/CheckBox.scss +26 -33
  55. package/style/ComboBox.scss +70 -56
  56. package/style/Container.scss +3 -44
  57. package/style/Edit.scss +48 -33
  58. package/style/Gap.scss +10 -5
  59. package/style/Group.scss +51 -75
  60. package/style/Icon.scss +2 -3
  61. package/style/Label.scss +31 -14
  62. package/style/List.scss +22 -35
  63. package/style/Modal.scss +8 -4
  64. package/style/ModalDialog.scss +28 -30
  65. package/style/NavBar.scss +186 -194
  66. package/style/ScrollBar.scss +28 -42
  67. package/style/Table.scss +31 -33
  68. package/style/TableFixed.scss +21 -26
  69. package/style/Text.scss +1 -51
  70. package/style/arch/ComboBox.scss +1 -1
  71. package/style/arch/NavBar.scss +236 -0
  72. package/style/{utils.scss → arch/utils.scss} +27 -1
  73. package/style/{vars.scss → arch/vars.scss} +71 -87
  74. package/style/ctrls.scss +18 -18
  75. package/style/define/defineThemeVars.scss +3 -0
  76. package/style/define/get-var.scss +13 -0
  77. package/style/index.scss +3 -0
  78. package/style/readme.txt +1 -1
  79. package/style/theme-dark.scss +38 -0
  80. package/style/theme-default.scss +191 -0
  81. package/style/utils/font-family.scss +37 -0
  82. package/style/utils/getThemingRootClass.scss +3 -0
  83. package/style/utils/h.scss +34 -0
  84. package/style/utils/margin.scss +33 -0
  85. package/style/utils/no-border.scss +10 -0
  86. package/style/utils/padding.scss +33 -0
  87. package/style/utils/panel.scss +36 -0
  88. package/style/utils/screen.scss +139 -0
  89. package/style/utils/stretch.scss +3 -0
  90. package/style/utils/text-style.scss +32 -0
  91. package/style/utils/transition.scss +9 -0
  92. package/{jsx/Utils → utils}/abs.js +2 -2
  93. package/{jsx/Collapse → utils}/collapse.js +2 -2
  94. package/utils/css.js +56 -0
  95. package/utils/display.js +2 -0
  96. package/utils/get.js +24 -0
  97. package/{jsx/Utils → utils}/isCompact.js +1 -1
  98. package/utils/navbar.js +28 -0
  99. package/utils/parentDOM.js +21 -0
  100. package/utils/style.js +15 -0
  101. package/{jsx/Utils → utils}/theme.js +1 -1
  102. package/{jsx/Utils → utils}/timer.js +15 -10
  103. package/jsx/Container/Col.jsx +0 -24
  104. /package/style/{all.scss → arch/all.scss} +0 -0
  105. /package/{jsx/Utils → utils}/DOM.js +0 -0
  106. /package/{jsx/Utils → utils}/areaDOM.js +0 -0
  107. /package/{jsx/Utils → utils}/childDOM.js +0 -0
  108. /package/{jsx/Utils → utils}/filter.js +0 -0
  109. /package/{jsx/Utils → utils}/getId.js +0 -0
  110. /package/{jsx/Utils → utils}/isMobile.js +0 -0
  111. /package/{jsx/Utils → utils}/map.js +0 -0
  112. /package/{jsx/Utils → utils}/mouse.js +0 -0
  113. /package/{jsx/Utils → utils}/onResizeScreen.js +0 -0
  114. /package/{jsx/Utils → utils}/screen.js +0 -0
  115. /package/{jsx/Utils → utils}/size.js +0 -0
  116. /package/{jsx/Utils → utils}/throttle.js +0 -0
  117. /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
- {...(className || addClass ? {className:`${className} ${addClass}`}:{})}
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
- {...(className || addClass ? {className:`${className} ${addClass}`}:{})}
25
- onClick={onClick}
26
- tabIndex={0}
27
- {...(title || hint ? {title:title || hint}:{})}
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
- <div style = {{ display: (iconClass || (IconComponent && icon)) ? 'block' : 'none' }}className={`${iconClass ? ` ${iconClass}` : ''}`}>
32
- {IconComponent && icon && <IconComponent icon={icon}/>}
33
- </div>
34
-
35
- <div style={{ display: (value || children) ? 'block' : 'none' }}>{value || children}</div>
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
- {...(className || addClass ? {className:`${className} ${addClass}`}:{})}
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 './Collapse/collapse';
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} ${addClass}`.trim();
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
- type='combo-item'
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 '../Utils/screen';
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 '../Utils/isMobile';
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 = 150;
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 -= out.height + 3;
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
- type='combo-list'
53
- className={`${className} ${addClass}`}
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 './Utils/abs';
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 = {},
@@ -29,12 +31,8 @@ function ComboBox({
29
31
  ItemComponent = ComboBox.global.ItemComponent,
30
32
 
31
33
  }) {
32
- if (addClass!=='')
33
- console.warn(`ComboBox.addClass is deprecated, use className = ${addClass}`);
34
-
35
- const selected = list.find((item) => (item[aliasId] == select));
36
- const selectCaption = selected ? selected[aliasCaption] : false;
37
-
34
+ const [selected, setSelected] = useState(undefined);
35
+ const [selectCaption, setSelectCaption] = useState(false);
38
36
  const [open, setOpen] = useState(false);
39
37
  const [btnOpenShow, setBtnOpenShow] = useState(!hideBtnOnSelect);
40
38
  const [focused, setFocused] = useState(false);
@@ -42,6 +40,17 @@ function ComboBox({
42
40
  const [size, setSize] = useState({
43
41
  left: 0, top: 0, width: 0, height: 0,
44
42
  });
43
+
44
+ useEffect(() => {
45
+ if (list && list.length && select !== false) {
46
+ const sel = list.find((item) => (item[aliasId] == select));
47
+ setSelected(sel);
48
+ setSelectCaption(sel ? sel[aliasCaption] : false);
49
+ } else {
50
+ setSelected(undefined);
51
+ setSelectCaption(false);
52
+ }
53
+ }, [list, select, aliasId]);
45
54
  /*
46
55
  useEffect(() => {
47
56
  const resize = () => {
@@ -68,6 +77,20 @@ function ComboBox({
68
77
  out.top = area.y;
69
78
  out.width = area.w;
70
79
  out.height = area.h;
80
+ const scr = screen();
81
+
82
+ if (out.width > scr.width) {
83
+ out.left = 1;
84
+ out.width = scr.width - 2;
85
+ } else {
86
+ if (out.left + out.width > scr.width) {
87
+ out.left -= (out.left + out.width - scr.width);
88
+ }
89
+ if (out.left < 0) {
90
+ out.left = 0;
91
+ }
92
+ }
93
+
71
94
  setSize(out);
72
95
  }
73
96
  }, [open]);
@@ -82,8 +105,8 @@ function ComboBox({
82
105
  setOpen(false);
83
106
  if (onChange) {
84
107
  onChange({ id, data });
85
- }else{
86
- console.warn('ComboBox.onChange not set, define it..')
108
+ } else {
109
+ console.warn('ComboBox.onChange not set, define it..');
87
110
  }
88
111
  };
89
112
  const getItemClass = () => {
@@ -125,9 +148,9 @@ function ComboBox({
125
148
  return (
126
149
  <>
127
150
  <div
128
- type='combo'
129
- {...(id ? {id}:{})}
130
- {...(className || addClass ? {className:`${className} ${addClass}`}:{})}
151
+ combo=''
152
+ {...(id ? { id } : {})}
153
+ className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
131
154
  style={{ ...ComboBox.global.style, ...style }}
132
155
  onClick = {click}
133
156
  ref = {ref}
@@ -146,10 +169,12 @@ function ComboBox({
146
169
  onGetItemClass = {getItemClass}
147
170
  attr={{ state: (selected ? 'select' : 'no-select') }}
148
171
  style={styleOuter}
172
+ data={selected}
149
173
  >
150
174
  {selectCaption || placeholder || ''}
175
+
151
176
  </ItemComponent>
152
- <div style={ { ...((btnOpenShow || focused) ? {} : { display: 'none' }) }} />
177
+ <div style={ { ...((btnOpenShow || focused || !selected) ? {} : { display: 'none' }) }} />
153
178
  </div>
154
179
  {(!disabled) && <Modal
155
180
  visible = {open}
@@ -167,6 +192,7 @@ function ComboBox({
167
192
  onClick={change}
168
193
  onGetItemClass = {onGetItemClass}
169
194
  ItemComponent={ItemComponent}
195
+ select={select}
170
196
  />
171
197
  </Modal>}
172
198
  </>
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+
3
+ function Cols({ cols = [] }) {
4
+ return (
5
+ <>
6
+ {cols.map((col, key) => <React.Fragment key={key}>{col}</React.Fragment>)}
7
+ </>
8
+ );
9
+ }
10
+
11
+ export default Cols;
@@ -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
- className = Container.global.className,
5
- addClass = Container.global.addClass,
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} ${addClass}`}
27
+ className={ `${Container.global.className} ${className}`}
12
28
  style={{ ...Container.global.style, ...style }}
29
+ {...attr}
13
30
  >
14
- {children}
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
- <input
81
- type={_type}
82
- {...(id ? { id } : {})}
83
- {...(className || addClass ? { className: `${className} ${addClass}` } : {})}
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
- {...props}
103
- {...(title || hint ? { title: title || hint } : {})}
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
- it={'wd-gap'}
18
- className={`${className} ${addClass}`}
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={'gap'}></div>)}
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
- type='group'
16
+ group=''
19
17
  {...(id ? { id } : {})}
20
- {...(className || addClass ? {className:`${className} ${addClass}`}:{})}
18
+ className={`${definingCssClass}${(className ? ` ${className}` : '')}`}
21
19
  style={{ ...Group.global.style, ...style }}
20
+ {...attr}
22
21
  >
23
- { (caption) && <div><span>{caption}</span></div>}
24
- <div>{children}</div>
22
+ { (caption) && <div caption='' >{caption}</div>}
23
+ <div content='' >{children}</div>
25
24
  </div>
26
25
  );
27
26
  }