react-ui-basics 0.0.209 → 0.0.211
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/Animated.js.map +1 -1
- package/AutocompleteSelect.js.map +1 -1
- package/Button.js.map +1 -1
- package/Checkbox.d.ts +16 -0
- package/Checkbox.js +14 -52
- package/Checkbox.js.map +1 -1
- package/CircleProgress.d.ts +12 -0
- package/CircleProgress.js +8 -31
- package/CircleProgress.js.map +1 -1
- package/CommonFields.d.ts +18 -0
- package/CommonFields.js +18 -20
- package/CommonFields.js.map +1 -1
- package/DNDDraggable.js.map +1 -1
- package/DNDDroppable.js.map +1 -1
- package/Dialog.js.map +1 -1
- package/DropFileInput.d.ts +20 -0
- package/DropFileInput.js +6 -37
- package/DropFileInput.js.map +1 -1
- package/DroppableHorizontalList.js.map +1 -1
- package/DroppableList.js.map +1 -1
- package/Dropzone.js.map +1 -1
- package/FilteredList.js.map +1 -1
- package/FloatingActionButton.d.ts +19 -0
- package/FloatingActionButton.js +7 -28
- package/FloatingActionButton.js.map +1 -1
- package/FormUploadProgress.js.map +1 -1
- package/ImageGallery.js +7 -6
- package/ImageGallery.js.map +1 -1
- package/MaterialIcon.d.ts +11 -0
- package/MaterialIcon.js +3 -18
- package/MaterialIcon.js.map +1 -1
- package/Modal.js.map +1 -1
- package/ModalMenu.d.ts +15 -0
- package/ModalMenu.js +23 -62
- package/ModalMenu.js.map +1 -1
- package/ReadyListener.js.map +1 -1
- package/Scrollable.css +3 -0
- package/Scrollable.js +20 -16
- package/Scrollable.js.map +1 -1
- package/Size.d.ts +8 -0
- package/Size.js +36 -35
- package/Size.js.map +1 -1
- package/Snackbar.d.ts +12 -0
- package/Snackbar.js +40 -62
- package/Snackbar.js.map +1 -1
- package/SpinningProgress.d.ts +4 -0
- package/SpinningProgress.js +3 -18
- package/SpinningProgress.js.map +1 -1
- package/Switch.d.ts +17 -0
- package/Switch.js +13 -60
- package/Switch.js.map +1 -1
- package/Table.js +1 -1
- package/Table.js.map +1 -1
- package/TextField.js.map +1 -1
- package/Tools.d.ts +1 -1
- package/Tools.js.map +1 -1
- package/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/bundle.css +808 -804
- package/package.json +22 -22
- package/router/HistoryTools.js.map +1 -1
- package/router/Link.js.map +1 -1
- package/router/NavLink.js.map +1 -1
- package/router/Route.js.map +1 -1
- package/src/Checkbox.tsx +37 -0
- package/src/CircleProgress.tsx +29 -0
- package/src/{CommonFields.js → CommonFields.ts} +1 -1
- package/src/DropFileInput.tsx +32 -0
- package/src/FloatingActionButton.tsx +28 -0
- package/src/MaterialIcon.tsx +1830 -0
- package/src/{ModalMenu.js → ModalMenu.tsx} +18 -9
- package/src/Scrollable.css +3 -0
- package/src/Scrollable.js +23 -19
- package/src/Scrollable.scss +4 -0
- package/src/{Size.js → Size.tsx} +24 -22
- package/src/{Snackbar.js → Snackbar.tsx} +22 -16
- package/src/SpinningProgress.tsx +13 -0
- package/src/Switch.tsx +42 -0
- package/src/Table.tsx +1 -1
- package/src/Tools.ts +1 -1
- package/store/ProxyTools.js.map +1 -1
- package/src/Checkbox.js +0 -46
- package/src/CircleProgress.js +0 -32
- package/src/DropFileInput.js +0 -39
- package/src/FloatingActionButton.js +0 -29
- package/src/MaterialIcon.js +0 -1832
- package/src/SpinningProgress.js +0 -13
- package/src/Switch.js +0 -48
|
@@ -1,26 +1,35 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, {MouseEventHandler} from 'react';
|
|
2
2
|
import ReactCreateElement from './ReactCreateElement';
|
|
3
3
|
import './ModalMenu.css'
|
|
4
4
|
import {PureComponent, stateGS, render} from "./ReactConstants";
|
|
5
5
|
import {classNames} from "./Tools";
|
|
6
6
|
import Animated from "./Animated";
|
|
7
7
|
import Button from "./Button";
|
|
8
|
-
import MaterialIcon from "./MaterialIcon";
|
|
8
|
+
import MaterialIcon, {MaterialIconType} from "./MaterialIcon";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
export interface ModalMenuItem {
|
|
11
|
+
icon: MaterialIconType,
|
|
12
|
+
action: MouseEventHandler
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ModalMenuProps {
|
|
16
|
+
items: ModalMenuItem[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class ModalMenu extends PureComponent<ModalMenuProps> {
|
|
11
20
|
|
|
12
21
|
constructor(props) {
|
|
13
22
|
super(props);
|
|
14
23
|
this.state = {};
|
|
15
|
-
const isOpen = stateGS(this);
|
|
24
|
+
const isOpen = stateGS<boolean>(this);
|
|
16
25
|
|
|
17
26
|
const toggle = () => {
|
|
18
27
|
isOpen(!isOpen());
|
|
19
28
|
};
|
|
20
|
-
this[
|
|
21
|
-
const {items} =
|
|
29
|
+
this[render] = () => {
|
|
30
|
+
const {items} = this.props;
|
|
22
31
|
const filtered = (items || []).filter(it => !!it);
|
|
23
|
-
if (
|
|
32
|
+
if (filtered.length === 0) return null;
|
|
24
33
|
|
|
25
34
|
const open = isOpen();
|
|
26
35
|
|
|
@@ -30,9 +39,9 @@ class ModalMenu extends PureComponent {
|
|
|
30
39
|
mounting={200}
|
|
31
40
|
unmounting={200}
|
|
32
41
|
mountingDelay={i * 50}
|
|
33
|
-
unmountingDelay={(
|
|
42
|
+
unmountingDelay={(filtered.length - i - 1) * 50}
|
|
34
43
|
styles={{
|
|
35
|
-
mounting: {right: ((
|
|
44
|
+
mounting: {right: ((filtered.length - i) * 36 + 5 + (filtered.length - i) * 5) + `px`},
|
|
36
45
|
}}
|
|
37
46
|
>
|
|
38
47
|
<Button flat={true} round={true} onClick={it.action}>
|
package/src/Scrollable.css
CHANGED
package/src/Scrollable.js
CHANGED
|
@@ -244,17 +244,18 @@ class Scrollable extends PureComponent {
|
|
|
244
244
|
const updateVerticalScrollbar = () => {
|
|
245
245
|
const scrollHeight = scrollHeightOf(viewport);
|
|
246
246
|
const scrollbarHeight = offsetHeightOf(scrollbar);
|
|
247
|
+
const containerHeight = offsetHeightOf(container);
|
|
247
248
|
|
|
248
249
|
!adjustedScrollWidth && adjustScrollWidth();
|
|
249
250
|
|
|
250
251
|
const newRatio = scrollHeight / scrollbarHeight;
|
|
251
|
-
if ((ratio === newRatio && Number.isFinite(newRatio)) || Number.isNaN(newRatio)) return;
|
|
252
|
+
if (!containerHeight || (ratio === newRatio && Number.isFinite(newRatio)) || Number.isNaN(newRatio)) return;
|
|
252
253
|
|
|
253
254
|
const offsetHeight = offsetHeightOf(viewport);
|
|
254
255
|
const horizontalScrollBarOffset = statusH() !== WITHOUT_SCROLL ? __clientHeight(scrollbarH) + Math.max(NATIVE_SCROLL_HEIGHT, 0) : 0;
|
|
255
256
|
|
|
256
|
-
let containerOffsetHeight =
|
|
257
|
-
if (containerOffsetHeight
|
|
257
|
+
let containerOffsetHeight = containerHeight + horizontalScrollBarOffset;
|
|
258
|
+
if (containerOffsetHeight > scrollHeight && status() === WITHOUT_SCROLL)
|
|
258
259
|
return;
|
|
259
260
|
|
|
260
261
|
if (props().autoScrollTop && scrollHeight - offsetHeight - __scrollTop(viewport) <= 20 && newRatio < ratio && Number.isFinite(newRatio) && Number.isFinite(ratio)) {
|
|
@@ -262,10 +263,11 @@ class Scrollable extends PureComponent {
|
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
ratio = newRatio;
|
|
265
|
-
|
|
266
|
+
if (newRatio > 1.02)
|
|
267
|
+
styleOf(thumb).height = (scrollbarHeight / newRatio) + 'px';
|
|
266
268
|
|
|
267
269
|
styleOf(container).height = scrollHeight - horizontalScrollBarOffset + 'px';
|
|
268
|
-
containerOffsetHeight =
|
|
270
|
+
containerOffsetHeight = containerHeight + horizontalScrollBarOffset;
|
|
269
271
|
|
|
270
272
|
if (scrollBarModeOf(props()) === SCROLLBAR_MODE_HIDDEN) {
|
|
271
273
|
if (status() !== WITHOUT_SCROLL)
|
|
@@ -274,7 +276,7 @@ class Scrollable extends PureComponent {
|
|
|
274
276
|
return
|
|
275
277
|
}
|
|
276
278
|
|
|
277
|
-
if (containerOffsetHeight
|
|
279
|
+
if (containerOffsetHeight <= scrollHeight) {
|
|
278
280
|
adjustedScrollWidth = false;
|
|
279
281
|
showScrollbar(scrollbar, viewport, adjustScrollWidth);
|
|
280
282
|
} else {
|
|
@@ -289,25 +291,25 @@ class Scrollable extends PureComponent {
|
|
|
289
291
|
};
|
|
290
292
|
|
|
291
293
|
const updateHorizontalScrollbar = () => {
|
|
292
|
-
|
|
293
294
|
const scrollWidth = scrollWidthOf(viewport);
|
|
294
295
|
const scrollbarWidth = offsetWidthOf(scrollbarH);
|
|
296
|
+
const containerWidth = offsetWidthOf(container);
|
|
295
297
|
|
|
296
298
|
!adjustedScrollWidth && adjustScrollWidth();
|
|
297
299
|
|
|
298
300
|
const newRatio = scrollWidth / scrollbarWidth;
|
|
299
|
-
if ((ratioH === newRatio && Number.isFinite(newRatio)) || Number.isNaN(newRatio)) return;
|
|
301
|
+
if (!containerWidth || (ratioH === newRatio && Number.isFinite(newRatio)) || Number.isNaN(newRatio)) return;
|
|
300
302
|
|
|
301
303
|
const offsetWidth = offsetWidthOf(viewport);
|
|
302
|
-
|
|
303
304
|
const verticalScrollBarOffset = status() !== WITHOUT_SCROLL ? __clientWidth(scrollbar) + Math.max(NATIVE_SCROLL_WIDTH, 0) : 0;
|
|
304
|
-
let containerOffsetWidth = offsetWidthOf(container) + verticalScrollBarOffset;
|
|
305
305
|
|
|
306
|
-
|
|
306
|
+
let containerOffsetWidth = containerWidth + verticalScrollBarOffset;
|
|
307
|
+
if (containerOffsetWidth > scrollWidth && statusH() === WITHOUT_SCROLL)
|
|
307
308
|
return;
|
|
308
309
|
|
|
309
310
|
ratioH = newRatio;
|
|
310
|
-
|
|
311
|
+
if (newRatio > 1.02)
|
|
312
|
+
styleOf(thumbH).width = (scrollbarWidth / newRatio) + 'px';
|
|
311
313
|
|
|
312
314
|
|
|
313
315
|
if (horizontalScrollBarModeOf(props()) === SCROLLBAR_MODE_HIDDEN) {
|
|
@@ -318,9 +320,9 @@ class Scrollable extends PureComponent {
|
|
|
318
320
|
}
|
|
319
321
|
|
|
320
322
|
styleOf(container).width = (scrollWidth - verticalScrollBarOffset) + 'px';
|
|
321
|
-
containerOffsetWidth =
|
|
323
|
+
containerOffsetWidth = containerWidth + verticalScrollBarOffset;
|
|
322
324
|
|
|
323
|
-
if (containerOffsetWidth
|
|
325
|
+
if (containerOffsetWidth <= scrollWidth) {
|
|
324
326
|
adjustedScrollWidth = false;
|
|
325
327
|
showHorizontalScrollbar(scrollbarH, viewport, adjustScrollWidth);
|
|
326
328
|
} else {
|
|
@@ -341,12 +343,14 @@ class Scrollable extends PureComponent {
|
|
|
341
343
|
};
|
|
342
344
|
} else if (sbm !== SCROLLBAR_RESIZE_DISABLED)
|
|
343
345
|
update = updateVerticalScrollbar
|
|
344
|
-
else
|
|
345
|
-
update =
|
|
346
|
+
else if (hsbm !== SCROLLBAR_RESIZE_DISABLED)
|
|
347
|
+
update = updateHorizontalScrollbar
|
|
346
348
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
349
|
+
if (update) {
|
|
350
|
+
initTimeout = setTimeout(() => {
|
|
351
|
+
resizeInterval = setInterval(update, 50);
|
|
352
|
+
}, 200)
|
|
353
|
+
}
|
|
350
354
|
};
|
|
351
355
|
|
|
352
356
|
that[ReactConstants[0]] = init;
|
package/src/Scrollable.scss
CHANGED
package/src/{Size.js → Size.tsx}
RENAMED
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import ReactCreateElement from './ReactCreateElement';
|
|
3
3
|
import {isUndefined} from "./Tools";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
<span className="Size">
|
|
7
|
-
{formatNumber(value, 1)} {formatAbbreviation(value)}
|
|
8
|
-
</span>
|
|
9
|
-
);
|
|
5
|
+
export type ToAbbreviationType = 'B' | 'KB' | 'MB' | 'GB';
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
let result;
|
|
13
|
-
if (isUndefined(fractionalLength))
|
|
14
|
-
fractionalLength = 1;
|
|
15
|
-
if (isUndefined(maxLength))
|
|
16
|
-
maxLength = -1;
|
|
17
|
-
|
|
18
|
-
do {
|
|
19
|
-
result = formatNumber(size, fractionalLength, toAbbreviation);
|
|
20
|
-
fractionalLength--;
|
|
21
|
-
} while (maxLength !== -1 && fractionalLength >= 0 && __length(result) > maxLength);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
function formatNumber(size, fractionalLength, toAbbreviation) {
|
|
7
|
+
const formatNumber = (size: number, fractionalLength: number, toAbbreviation?: ToAbbreviationType) => {
|
|
26
8
|
if (size < 1000 && !toAbbreviation || toAbbreviation === 'B')
|
|
27
9
|
return size + '';
|
|
28
10
|
size /= 1024;
|
|
@@ -35,7 +17,21 @@ function formatNumber(size, fractionalLength, toAbbreviation) {
|
|
|
35
17
|
return size.toFixed(fractionalLength);
|
|
36
18
|
};
|
|
37
19
|
|
|
38
|
-
export const
|
|
20
|
+
export const formatNumberWithMaxLength = (size: number, fractionalLength: number, toAbbreviation?: ToAbbreviationType, maxLength?: number) => {
|
|
21
|
+
let result;
|
|
22
|
+
if (isUndefined(fractionalLength))
|
|
23
|
+
fractionalLength = 1;
|
|
24
|
+
if (isUndefined(maxLength))
|
|
25
|
+
maxLength = -1;
|
|
26
|
+
|
|
27
|
+
do {
|
|
28
|
+
result = formatNumber(size, fractionalLength, toAbbreviation);
|
|
29
|
+
fractionalLength--;
|
|
30
|
+
} while (maxLength !== -1 && fractionalLength >= 0 && result.length > maxLength);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const formatAbbreviation = (size: number) => {
|
|
39
35
|
if (size < 1000)
|
|
40
36
|
return 'B';
|
|
41
37
|
size /= 1024;
|
|
@@ -48,4 +44,10 @@ export const formatAbbreviation = (size) => {
|
|
|
48
44
|
return 'GB';
|
|
49
45
|
};
|
|
50
46
|
|
|
47
|
+
const Size = ({value}: { value: number }) => (
|
|
48
|
+
<span className="Size">
|
|
49
|
+
{formatNumber(value, 1)} {formatAbbreviation(value)}
|
|
50
|
+
</span>
|
|
51
|
+
);
|
|
52
|
+
|
|
51
53
|
export default Size
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
3
|
import ReactCreateElement from './ReactCreateElement';
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
4
|
import './Snackbar.css'
|
|
6
5
|
import {classNames, setTimeout, clearTimeout} from "./Tools";
|
|
7
6
|
import {componentWillUnmount, render, props, className, PureComponent, stateGSs} from "./ReactConstants";
|
|
8
7
|
|
|
9
8
|
const shown = 'shown';
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
export interface SnackbarProps {
|
|
11
|
+
className?: string,
|
|
12
|
+
text?: string,
|
|
13
|
+
container?: Element,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type SnackbarState = [
|
|
17
|
+
(v?: boolean) => boolean,
|
|
18
|
+
(v?: string) => string,
|
|
19
|
+
(v?: string) => string,
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
class Snackbar extends PureComponent<SnackbarProps> {
|
|
12
23
|
|
|
13
24
|
constructor(properties) {
|
|
14
25
|
super(properties);
|
|
@@ -18,28 +29,28 @@ class Snackbar extends PureComponent {
|
|
|
18
29
|
isShow,
|
|
19
30
|
getText,
|
|
20
31
|
clazzName
|
|
21
|
-
] = stateGSs(this, 3);
|
|
32
|
+
] = stateGSs(this, 3) as SnackbarState;
|
|
22
33
|
|
|
23
34
|
let timeout;
|
|
24
|
-
that[
|
|
35
|
+
that[componentWillUnmount] = () => {
|
|
25
36
|
clearTimeout(timeout);
|
|
26
37
|
};
|
|
27
|
-
that[
|
|
38
|
+
that[render] = () => {
|
|
28
39
|
const _props = props(that);
|
|
29
40
|
const {container} = _props;
|
|
30
41
|
|
|
31
|
-
const el = <div className={classNames(`Snackbar`, _props[
|
|
42
|
+
const el = <div className={classNames(`Snackbar`, _props[className], isShow() && shown, clazzName())}>
|
|
32
43
|
<div className="message">{getText() || _props.text}</div>
|
|
33
44
|
</div>;
|
|
34
45
|
return container ? ReactDOM.createPortal(el, container) : el;
|
|
35
46
|
};
|
|
36
47
|
|
|
37
|
-
const hide = ()=>{
|
|
48
|
+
const hide = () => {
|
|
38
49
|
isShow(false)
|
|
39
50
|
clazzName(null)
|
|
40
51
|
}
|
|
41
52
|
|
|
42
|
-
that.show = (text, className) => {
|
|
53
|
+
that.show = (text: string, className: string) => {
|
|
43
54
|
if (isShow()) {
|
|
44
55
|
clearTimeout(timeout);
|
|
45
56
|
isShow(false);
|
|
@@ -52,14 +63,9 @@ class Snackbar extends PureComponent {
|
|
|
52
63
|
}
|
|
53
64
|
}
|
|
54
65
|
}
|
|
55
|
-
}
|
|
56
66
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
[ReactConstants[5]]: PropTypes.string,
|
|
60
|
-
text: PropTypes.string,
|
|
61
|
-
container: PropTypes.node,
|
|
62
|
-
};
|
|
67
|
+
show(text: string, className: string) {
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
export default Snackbar;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactCreateElement from './ReactCreateElement';
|
|
3
|
+
import './SpinningProgress.css'
|
|
4
|
+
|
|
5
|
+
const SpinningProgress = () => (
|
|
6
|
+
<div className="SpinningProgress">
|
|
7
|
+
<svg className="circular" viewBox="0 0 24 24">
|
|
8
|
+
<circle className="line" cx="12" cy="12" r="8.75" fill="none"/>
|
|
9
|
+
</svg>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export default SpinningProgress;
|
package/src/Switch.tsx
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, {ChangeEventHandler, MouseEventHandler, ReactElement} from 'react';
|
|
2
|
+
import ReactCreateElement from './ReactCreateElement';
|
|
3
|
+
import './Switch.css'
|
|
4
|
+
import {getRandomId, classNames} from "./Tools";
|
|
5
|
+
import {PureComponent, render} from "./ReactConstants";
|
|
6
|
+
|
|
7
|
+
export interface SwitchProps {
|
|
8
|
+
value: boolean,
|
|
9
|
+
id?: string | number,
|
|
10
|
+
label?: string | ReactElement,
|
|
11
|
+
className?: string,
|
|
12
|
+
labelOn?: string | ReactElement,
|
|
13
|
+
labelOff?: string | ReactElement,
|
|
14
|
+
onChange?: ChangeEventHandler,
|
|
15
|
+
onClick?: MouseEventHandler
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class Switch extends PureComponent<SwitchProps> {
|
|
19
|
+
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props);
|
|
22
|
+
const randomId = getRandomId('sw-');
|
|
23
|
+
|
|
24
|
+
this[render] = () => {
|
|
25
|
+
const {label, className, labelOn, labelOff, onChange, value, onClick} = this.props;
|
|
26
|
+
const id = (this.props.id || randomId) + '';
|
|
27
|
+
return (
|
|
28
|
+
<div className={classNames("Switch", className)} onClick={onClick}>
|
|
29
|
+
<input type="checkbox" id={id} className="switch-input" onChange={onChange} checked={value}/>
|
|
30
|
+
|
|
31
|
+
<label htmlFor={id} className="switch-label">
|
|
32
|
+
{label && <span className="label">{label}</span>}
|
|
33
|
+
{labelOn && <span className="toggle--on">{labelOn}</span>}
|
|
34
|
+
{labelOff && <span className="toggle--off">{labelOff}</span>}
|
|
35
|
+
</label>
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default Switch
|
package/src/Table.tsx
CHANGED
|
@@ -386,7 +386,7 @@ class Row<T> extends PureComponent<RowProps<T>> {
|
|
|
386
386
|
stopPropagation(e);
|
|
387
387
|
preventDefault(e);
|
|
388
388
|
setValue(!value, item, column.field)
|
|
389
|
-
}} value={value}/>
|
|
389
|
+
}} value={!!value}/>
|
|
390
390
|
)}
|
|
391
391
|
{displayEditor && isFunction(column.editor)
|
|
392
392
|
&& (column.editor as ((t: T, cancel: () => void, isEditing: boolean) => ReactElement))(item, cancelEditing, isEditing)}
|
package/src/Tools.ts
CHANGED
|
@@ -17,7 +17,7 @@ export const NOOP = () => {
|
|
|
17
17
|
|
|
18
18
|
export const orNoop = <T>(f: (...a: any) => T) => f || NOOP;
|
|
19
19
|
|
|
20
|
-
export const getRandomId = (prefix) => prefix + Math.random();
|
|
20
|
+
export const getRandomId = (prefix: string) => prefix + Math.random();
|
|
21
21
|
|
|
22
22
|
export const ref = (name, component) => {
|
|
23
23
|
const refKey = "__" + name;
|
package/store/ProxyTools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProxyTools.js","sources":["../src/store/ProxyTools.js"],"sourcesContent":["import {UNDEFINED} from \"../Tools\";\n\nexport const createProxy = (target) => {\n if(!target)\n return target\n if (target.__isProxy)\n return target;\n\n let changedValue = UNDEFINED;\n let deletedKeys = UNDEFINED;\n let innerProxies = UNDEFINED\n const isChanged = () => changedValue || (innerProxies && Object.values(innerProxies).some(it => it.__changed));\n\n return new Proxy(target, {\n get: function (target, prop) {\n if (prop === '__isProxy')\n return true\n if (prop === '__changed')\n return isChanged();\n if (prop === 'bake')\n return () => {\n // console.log('bake', changedValue, innerProxies)\n if (!isChanged())\n return target\n\n if (changedValue && !innerProxies)\n return changedValue\n\n if (innerProxies) {\n const result = changedValue || (Array.isArray(target) ? [...target] : {...target});\n\n for (let key in innerProxies) {\n result[key] = innerProxies[key].bake()\n }\n return result\n }\n\n throw new Error('state not implemented yet')\n }\n\n // console.log('get', {target, prop})\n const innerProxy = innerProxies && innerProxies[prop];\n if (innerProxy)\n return innerProxy\n\n const changed = changedValue && changedValue[prop]\n if (changed !== UNDEFINED)\n return changed\n\n if (deletedKeys && deletedKeys[prop])\n return null\n\n const value = target[prop];\n if (value && typeof value === 'object') {\n !innerProxies && (innerProxies = {})\n return innerProxies[prop] = createProxy(value)\n }\n\n return value;\n },\n set: function (target, prop, newval) {\n // console.log('set', {target, prop, newval})\n if (!changedValue) changedValue = Array.isArray(target) ? [...target] : {...target}\n\n if (newval && typeof newval === 'object') {\n !innerProxies && (innerProxies = {})\n innerProxies[prop] = newval = createProxy(newval)\n } else {\n innerProxies && (delete innerProxies[prop])\n }\n changedValue[prop] = newval\n // console.log('changedValue', changedValue)\n return true;\n },\n deleteProperty: function (target, prop) {\n // console.log('delete', {target, prop})\n !changedValue && (changedValue = Array.isArray(target) ? [...target] : {...target})\n\n if (!prop in changedValue)\n return false;\n\n delete changedValue[prop]\n innerProxies && delete innerProxies[prop]\n !deletedKeys && (deletedKeys = {})\n deletedKeys[prop] = true;\n return true;\n }\n })\n}\n"],"names":["createProxy","target","__isProxy","changedValue","UNDEFINED","deletedKeys","innerProxies","isChanged","Object","values","some","it","__changed","Proxy","get","prop","result","Array","isArray","key","bake","Error","innerProxy","changed","value","
|
|
1
|
+
{"version":3,"file":"ProxyTools.js","sources":["../src/store/ProxyTools.js"],"sourcesContent":["import {UNDEFINED} from \"../Tools\";\n\nexport const createProxy = (target) => {\n if(!target)\n return target\n if (target.__isProxy)\n return target;\n\n let changedValue = UNDEFINED;\n let deletedKeys = UNDEFINED;\n let innerProxies = UNDEFINED\n const isChanged = () => changedValue || (innerProxies && Object.values(innerProxies).some(it => it.__changed));\n\n return new Proxy(target, {\n get: function (target, prop) {\n if (prop === '__isProxy')\n return true\n if (prop === '__changed')\n return isChanged();\n if (prop === 'bake')\n return () => {\n // console.log('bake', changedValue, innerProxies)\n if (!isChanged())\n return target\n\n if (changedValue && !innerProxies)\n return changedValue\n\n if (innerProxies) {\n const result = changedValue || (Array.isArray(target) ? [...target] : {...target});\n\n for (let key in innerProxies) {\n result[key] = innerProxies[key].bake()\n }\n return result\n }\n\n throw new Error('state not implemented yet')\n }\n\n // console.log('get', {target, prop})\n const innerProxy = innerProxies && innerProxies[prop];\n if (innerProxy)\n return innerProxy\n\n const changed = changedValue && changedValue[prop]\n if (changed !== UNDEFINED)\n return changed\n\n if (deletedKeys && deletedKeys[prop])\n return null\n\n const value = target[prop];\n if (value && typeof value === 'object') {\n !innerProxies && (innerProxies = {})\n return innerProxies[prop] = createProxy(value)\n }\n\n return value;\n },\n set: function (target, prop, newval) {\n // console.log('set', {target, prop, newval})\n if (!changedValue) changedValue = Array.isArray(target) ? [...target] : {...target}\n\n if (newval && typeof newval === 'object') {\n !innerProxies && (innerProxies = {})\n innerProxies[prop] = newval = createProxy(newval)\n } else {\n innerProxies && (delete innerProxies[prop])\n }\n changedValue[prop] = newval\n // console.log('changedValue', changedValue)\n return true;\n },\n deleteProperty: function (target, prop) {\n // console.log('delete', {target, prop})\n !changedValue && (changedValue = Array.isArray(target) ? [...target] : {...target})\n\n if (!prop in changedValue)\n return false;\n\n delete changedValue[prop]\n innerProxies && delete innerProxies[prop]\n !deletedKeys && (deletedKeys = {})\n deletedKeys[prop] = true;\n return true;\n }\n })\n}\n"],"names":["createProxy","target","__isProxy","changedValue","UNDEFINED","deletedKeys","innerProxies","isChanged","Object","values","some","it","__changed","Proxy","get","prop","result","Array","isArray","_toConsumableArray","_objectSpread","key","bake","Error","innerProxy","changed","value","_typeof","set","newval","deleteProperty"],"mappings":";;;IAEaA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,MAAM,EAAK;AACnC,EAAA,IAAG,CAACA,MAAM,EACN,OAAOA,MAAM,CAAA;AACjB,EAAA,IAAIA,MAAM,CAACC,SAAS,EAChB,OAAOD,MAAM,CAAA;EAEjB,IAAIE,YAAY,GAAGC,SAAS,CAAA;EAC5B,IAAIC,WAAW,GAAGD,SAAS,CAAA;EAC3B,IAAIE,YAAY,GAAGF,SAAS,CAAA;AAC5B,EAAA,IAAMG,SAAS,GAAG,SAAZA,SAASA,GAAA;AAAA,IAAA,OAASJ,YAAY,IAAKG,YAAY,IAAIE,MAAM,CAACC,MAAM,CAACH,YAAY,CAAC,CAACI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KA,YAAY,GAAGc,KAAK,CAACC,OAAO,CAACjB,MAAM,CAAC,GAAAkB,kBAAA,CAAOlB,MAAM,CAAA,GAAAmB,cAAA,CAAQnB,EAAAA,EAAAA,MAAM,CAAC,CAAC,CAAA;AAEnF,MAAA,IAAI,CAACc,IAAI,IAAIZ,YAAY,EACrB,OAAO,KAAK,CAAA;MAEhB,OAAOA,YAAY,CAACY,IAAI,CAAC,CAAA;AACzBT,MAAAA,YAAY,IAAI,OAAOA,YAAY,CAACS,IAAI,CAAC,CAAA;AACzC,MAAA,CAACV,WAAW,KAAKA,WAAW,GAAG,EAAE,CAAC,CAAA;AAClCA,MAAAA,WAAW,CAACU,IAAI,CAAC,GAAG,IAAI,CAAA;AACxB,MAAA,OAAO,IAAI,CAAA;AACf,KAAA;AACJ,GAAC,CAAC,CAAA;AACN;;;;"}
|
package/src/Checkbox.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import ReactConstants from "./../ReactConstants"; import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./../CommonFields"; import {toConsumableArray as __toConsumableArray} from "./../_virtual/_rollupPluginBabelHelpers"; import {extends as __extends} from "./../_virtual/_rollupPluginBabelHelpers"; import {inherits as __inherits} from "./../_virtual/_rollupPluginBabelHelpers"; import './Checkbox.css'; import React from 'react';
|
|
2
|
-
import ReactCreateElement from './ReactCreateElement';
|
|
3
|
-
import './Checkbox.css'
|
|
4
|
-
import {classNames, getRandomId} from "./Tools";
|
|
5
|
-
import {PureComponent, render, propsGetter} from "./ReactConstants";
|
|
6
|
-
import PropTypes from "prop-types";
|
|
7
|
-
|
|
8
|
-
class Checkbox extends PureComponent {
|
|
9
|
-
|
|
10
|
-
constructor(properties) {
|
|
11
|
-
super(properties);
|
|
12
|
-
const randomId = getRandomId('cb-');
|
|
13
|
-
const props = propsGetter(this);
|
|
14
|
-
|
|
15
|
-
this[ReactConstants[3]] = () => {
|
|
16
|
-
const {label, name, onChange, value, className, disabled} = props();
|
|
17
|
-
const id = props().id || randomId;
|
|
18
|
-
return (
|
|
19
|
-
<div className={classNames("Checkbox", className)}>
|
|
20
|
-
<input name={name} id={id} type="checkbox" onChange={onChange} checked={value} disabled={disabled}/>
|
|
21
|
-
<label htmlFor={id}>{label}</label>
|
|
22
|
-
</div>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
-
Checkbox.propTypes = {
|
|
30
|
-
[ReactConstants[7]]: PropTypes.func.isRequired,
|
|
31
|
-
value: PropTypes.bool,
|
|
32
|
-
disabled: PropTypes.bool,
|
|
33
|
-
[ReactConstants[5]]: PropTypes.string,
|
|
34
|
-
label: PropTypes.oneOfType([
|
|
35
|
-
PropTypes.string,
|
|
36
|
-
PropTypes.element
|
|
37
|
-
]),
|
|
38
|
-
name: PropTypes.string,
|
|
39
|
-
id: PropTypes.oneOfType([
|
|
40
|
-
PropTypes.string,
|
|
41
|
-
PropTypes.number
|
|
42
|
-
]),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default Checkbox
|
package/src/CircleProgress.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import ReactConstants from "./../ReactConstants"; import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./../CommonFields"; import {toConsumableArray as __toConsumableArray} from "./../_virtual/_rollupPluginBabelHelpers"; import {extends as __extends} from "./../_virtual/_rollupPluginBabelHelpers"; import {inherits as __inherits} from "./../_virtual/_rollupPluginBabelHelpers"; import './CircleProgress.css'; import React from 'react';
|
|
2
|
-
import ReactCreateElement from './ReactCreateElement';
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import './CircleProgress.css'
|
|
5
|
-
|
|
6
|
-
const radius = 8.75;
|
|
7
|
-
const length = 2 * Math.PI * radius;
|
|
8
|
-
|
|
9
|
-
const dashoffset = (percent) => length * (100 - percent) / 100;
|
|
10
|
-
|
|
11
|
-
const CircleProgress = ({value}) => {
|
|
12
|
-
value = Number.parseFloat(value);
|
|
13
|
-
return (
|
|
14
|
-
<div className="CircleProgress">
|
|
15
|
-
<svg viewBox="0 0 24 24">
|
|
16
|
-
<path className="line" style={{strokeDashoffset: dashoffset(Number.isFinite(value) ? value : 0), strokeDasharray: length}}
|
|
17
|
-
d="M12 3.25A8.75 8.75 0 1 1 3.25 12 A 8.75,8.75 0 0 1 12,3.25"/>
|
|
18
|
-
</svg>
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
CircleProgress.defaultProps = {
|
|
24
|
-
value: 0,
|
|
25
|
-
};
|
|
26
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
27
|
-
CircleProgress.propTypes = {
|
|
28
|
-
value: PropTypes.number,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default CircleProgress;
|
package/src/DropFileInput.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import ReactConstants from "./../ReactConstants"; import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./../CommonFields"; import {toConsumableArray as __toConsumableArray} from "./../_virtual/_rollupPluginBabelHelpers"; import {extends as __extends} from "./../_virtual/_rollupPluginBabelHelpers"; import {inherits as __inherits} from "./../_virtual/_rollupPluginBabelHelpers"; import './DropFileInput.css'; import React from 'react';
|
|
2
|
-
import ReactCreateElement from './ReactCreateElement';
|
|
3
|
-
import './DropFileInput.css'
|
|
4
|
-
import Dropzone from "./Dropzone";
|
|
5
|
-
import PropTypes from "prop-types";
|
|
6
|
-
import {classNames} from "./Tools";
|
|
7
|
-
import MaterialIcon from "./MaterialIcon";
|
|
8
|
-
|
|
9
|
-
const DropFileInput = ({icon, label, onDrop, droppable, multiple, accept}) => (
|
|
10
|
-
<section className="DropFileInput">
|
|
11
|
-
<Dropzone droppable={droppable} onDrop={onDrop} accept={accept} multiple={multiple}>
|
|
12
|
-
<MaterialIcon className={classNames(`icon`, label && 'withText')} icon={icon}/>
|
|
13
|
-
{label && <div>{label}</div>}
|
|
14
|
-
</Dropzone>
|
|
15
|
-
</section>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
DropFileInput.defaultProps = {
|
|
19
|
-
icon: 'cloud_upload',
|
|
20
|
-
droppable: false,
|
|
21
|
-
multiple: true,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
25
|
-
DropFileInput.propTypes = {
|
|
26
|
-
icon: MaterialIcon.propTypes.icon,
|
|
27
|
-
label: PropTypes.oneOfType([
|
|
28
|
-
PropTypes.string,
|
|
29
|
-
PropTypes.element
|
|
30
|
-
]),
|
|
31
|
-
droppable: PropTypes.bool,
|
|
32
|
-
onDrop: PropTypes.func,
|
|
33
|
-
multiple: PropTypes.bool,
|
|
34
|
-
accept: PropTypes.string,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export default DropFileInput;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import ReactConstants from "./../ReactConstants"; import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./../CommonFields"; import {toConsumableArray as __toConsumableArray} from "./../_virtual/_rollupPluginBabelHelpers"; import {extends as __extends} from "./../_virtual/_rollupPluginBabelHelpers"; import {inherits as __inherits} from "./../_virtual/_rollupPluginBabelHelpers"; import './FloatingActionButton.css'; import React from 'react';
|
|
2
|
-
import ReactCreateElement from './ReactCreateElement';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import './FloatingActionButton.css'
|
|
5
|
-
import Button from "./Button";
|
|
6
|
-
import {classNames} from "./Tools";
|
|
7
|
-
import MaterialIcon from "./MaterialIcon";
|
|
8
|
-
|
|
9
|
-
const FloatingActionButton = ({icon, onClick, mini, className, hidden}) => {
|
|
10
|
-
return <Button onClick={onClick} round={true} className={classNames("FloatingActionButton", className, mini && 'mini', hidden && 'hidden')}>
|
|
11
|
-
<MaterialIcon icon={icon}/>
|
|
12
|
-
</Button>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
16
|
-
FloatingActionButton.propTypes = {
|
|
17
|
-
icon: MaterialIcon.propTypes.icon,
|
|
18
|
-
mini: PropTypes.bool,
|
|
19
|
-
hidden: PropTypes.bool,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
FloatingActionButton.defaultProps = {
|
|
24
|
-
icon: 'add',
|
|
25
|
-
mini: false,
|
|
26
|
-
hidden: false,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default FloatingActionButton;
|