react-ui-basics 0.0.173 → 0.0.176
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 -0
- package/AutocompleteSelect.js.map +1 -0
- package/Button.js.map +1 -0
- package/Checkbox.js.map +1 -0
- package/CircleProgress.js.map +1 -0
- package/CommonFields.js.map +1 -0
- package/DNDContainer.js.map +1 -0
- package/DNDDraggable.js.map +1 -0
- package/DNDDroppable.js.map +1 -0
- package/Dialog.js.map +1 -0
- package/DropFileInput.js.map +1 -0
- package/DroppableHorizontalList.js.map +1 -0
- package/DroppableList.js.map +1 -0
- package/Dropzone.js.map +1 -0
- package/FilteredList.js.map +1 -0
- package/FloatingActionButton.js.map +1 -0
- package/FormUploadProgress.js.map +1 -0
- package/ImageGallery.js.map +1 -0
- package/MaterialIcon.js.map +1 -0
- package/Modal.js.map +1 -0
- package/ModalMenu.js.map +1 -0
- package/ReactConstants.js.map +1 -0
- package/ReactCreateElement.js.map +1 -0
- package/ReadyListener.js.map +1 -0
- package/Scrollable.js.map +1 -0
- package/ScrollableTable.js.map +1 -0
- package/Size.js.map +1 -0
- package/Snackbar.js.map +1 -0
- package/SpinningProgress.js.map +1 -0
- package/Switch.js.map +1 -0
- package/Table.d.ts +17 -2
- package/Table.js +27 -14
- package/Table.js.map +1 -0
- package/TextField.js +4 -2
- package/TextField.js.map +1 -0
- package/Tools.d.ts +2 -2
- package/Tools.js.map +1 -0
- package/bundle.css +505 -505
- package/index.js.map +1 -0
- package/package.json +4 -4
- 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/router/index.js.map +1 -1
- package/src/Animated.css +7 -0
- package/src/Animated.js +219 -0
- package/src/Animated.scss +8 -0
- package/src/AutocompleteSelect.css +256 -0
- package/src/AutocompleteSelect.js +473 -0
- package/src/AutocompleteSelect.scss +322 -0
- package/src/Button.css +138 -0
- package/src/Button.js +104 -0
- package/src/Button.scss +177 -0
- package/src/Checkbox.css +56 -0
- package/src/Checkbox.js +52 -0
- package/src/Checkbox.scss +87 -0
- package/src/CircleProgress.css +11 -0
- package/src/CircleProgress.js +38 -0
- package/src/CircleProgress.scss +13 -0
- package/src/CommonFields.js +21 -0
- package/src/DNDContainer.css +26 -0
- package/src/DNDContainer.js +263 -0
- package/src/DNDContainer.scss +33 -0
- package/src/DNDDraggable.js +55 -0
- package/src/DNDDroppable.js +58 -0
- package/src/Dialog.css +36 -0
- package/src/Dialog.js +160 -0
- package/src/Dialog.scss +42 -0
- package/src/DropFileInput.css +24 -0
- package/src/DropFileInput.js +45 -0
- package/src/DropFileInput.scss +28 -0
- package/src/DroppableHorizontalList.js +190 -0
- package/src/DroppableList.css +14 -0
- package/src/DroppableList.js +201 -0
- package/src/DroppableList.scss +27 -0
- package/src/Dropzone.css +54 -0
- package/src/Dropzone.js +140 -0
- package/src/Dropzone.scss +66 -0
- package/src/FilteredList.css +68 -0
- package/src/FilteredList.js +196 -0
- package/src/FilteredList.scss +86 -0
- package/src/FloatingActionButton.css +20 -0
- package/src/FloatingActionButton.js +35 -0
- package/src/FloatingActionButton.scss +25 -0
- package/src/FormUploadProgress.css +61 -0
- package/src/FormUploadProgress.js +87 -0
- package/src/FormUploadProgress.scss +78 -0
- package/src/ImageGallery.css +196 -0
- package/src/ImageGallery.js +935 -0
- package/src/ImageGallery.scss +256 -0
- package/src/MaterialIcon.js +1837 -0
- package/src/Modal.css +61 -0
- package/src/Modal.js +160 -0
- package/src/Modal.scss +73 -0
- package/src/ModalMenu.css +30 -0
- package/src/ModalMenu.js +59 -0
- package/src/ModalMenu.scss +36 -0
- package/src/ReactConstants.ts +42 -0
- package/src/ReactCreateElement.js +5 -0
- package/src/ReadyListener.js +53 -0
- package/src/ResizeObserver.ts +50 -0
- package/src/Scrollable.css +80 -0
- package/src/Scrollable.js +388 -0
- package/src/Scrollable.scss +100 -0
- package/src/ScrollableTable.css +6 -0
- package/src/ScrollableTable.scss +12 -0
- package/src/ScrollableTable.tsx +39 -0
- package/src/Size.js +56 -0
- package/src/Snackbar.css +40 -0
- package/src/Snackbar.js +71 -0
- package/src/Snackbar.scss +47 -0
- package/src/SpinningProgress.css +49 -0
- package/src/SpinningProgress.js +19 -0
- package/src/SpinningProgress.scss +57 -0
- package/src/Switch.css +69 -0
- package/src/Switch.js +54 -0
- package/src/Switch.scss +73 -0
- package/src/Table.css +94 -0
- package/src/Table.scss +121 -0
- package/src/Table.tsx +360 -0
- package/src/TextField.css +122 -0
- package/src/TextField.js +162 -0
- package/src/TextField.scss +160 -0
- package/src/Tools.test.js +105 -0
- package/src/Tools.ts +231 -0
- package/src/global.css +1 -0
- package/src/global.scss +6 -0
- package/src/index.js +78 -0
- package/src/router/HistoryTools.js +32 -0
- package/src/router/Link.js +27 -0
- package/src/router/NavLink.js +25 -0
- package/src/router/README.md +55 -0
- package/src/router/Route.js +209 -0
- package/src/router/Route.test.js +139 -0
- package/src/router/index.js +14 -0
- package/src/store/ProxyTools.js +91 -0
- package/src/store/ProxyTools.test.js +97 -0
- package/src/store/Store.ts +91 -0
- package/store/ProxyTools.js.map +1 -1
- package/store/Store.js.map +1 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
@import "./global.scss";
|
|
2
|
+
|
|
3
|
+
$focusColor: rgb(0, 188, 212);
|
|
4
|
+
$redColor: rgb(244, 67, 54);
|
|
5
|
+
|
|
6
|
+
.TextField {
|
|
7
|
+
position: relative;
|
|
8
|
+
width: 100%;
|
|
9
|
+
|
|
10
|
+
> label {
|
|
11
|
+
font-family: $font;
|
|
12
|
+
color: rgba(0, 0, 0, 0.3);
|
|
13
|
+
|
|
14
|
+
font-size: 16px;
|
|
15
|
+
position: absolute;
|
|
16
|
+
left: 0px;
|
|
17
|
+
top: 16px;
|
|
18
|
+
margin-top: -16px;
|
|
19
|
+
transition: all 0.2s ease;
|
|
20
|
+
user-select: none;
|
|
21
|
+
cursor: text;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
> input {
|
|
25
|
+
font-family: $font;
|
|
26
|
+
color: $colorInput;
|
|
27
|
+
|
|
28
|
+
height: 19px;
|
|
29
|
+
font-size: 16px;
|
|
30
|
+
width: 100%;
|
|
31
|
+
border: 0px;
|
|
32
|
+
padding-bottom: 4px;
|
|
33
|
+
padding-top: 0;
|
|
34
|
+
outline-color: rgba(0, 0, 0, 0);
|
|
35
|
+
|
|
36
|
+
&:focus {
|
|
37
|
+
outline: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:disabled {
|
|
41
|
+
color: gray;
|
|
42
|
+
background-color: white;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&:disabled + .border {
|
|
46
|
+
height: 0px;
|
|
47
|
+
border-bottom: 2px dotted rgb(224, 224, 224);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&::placeholder {
|
|
51
|
+
font-family: $font;
|
|
52
|
+
color: rgba(0, 0, 0, 0.3);
|
|
53
|
+
opacity: 1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
> .border {
|
|
58
|
+
border-bottom: 1px solid rgb(224, 224, 224);
|
|
59
|
+
height: 1px;
|
|
60
|
+
position: relative;
|
|
61
|
+
|
|
62
|
+
.line {
|
|
63
|
+
left: 50%;
|
|
64
|
+
width: 0;
|
|
65
|
+
height: 2px;
|
|
66
|
+
min-height: 2px;
|
|
67
|
+
background-color: $focusColor;
|
|
68
|
+
transition: all 0.2s ease;
|
|
69
|
+
position: absolute;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
> .error {
|
|
74
|
+
text-align: left;
|
|
75
|
+
font-size: 10px;
|
|
76
|
+
min-height: 0;
|
|
77
|
+
line-height: 14px;
|
|
78
|
+
color: $redColor;
|
|
79
|
+
visibility: hidden;
|
|
80
|
+
opacity: 0;
|
|
81
|
+
transition: all 0.2s ease;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.focused, &.withValue {
|
|
85
|
+
> label {
|
|
86
|
+
top: 4px;
|
|
87
|
+
font-size: 12px;
|
|
88
|
+
line-height: 14px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&.errored {
|
|
93
|
+
> .error {
|
|
94
|
+
visibility: visible;
|
|
95
|
+
opacity: 1;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
> .border {
|
|
99
|
+
border-bottom-color: $redColor;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
> label {
|
|
103
|
+
color: $redColor;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.focused {
|
|
108
|
+
> label {
|
|
109
|
+
color: $focusColor;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
> .border {
|
|
113
|
+
.line {
|
|
114
|
+
left: 0;
|
|
115
|
+
width: 100%;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.disabled {
|
|
121
|
+
label, input {
|
|
122
|
+
cursor: not-allowed;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&.withLabel {
|
|
127
|
+
margin-top: 15px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
input::-webkit-contacts-auto-fill-button {
|
|
131
|
+
visibility: hidden;
|
|
132
|
+
display: none !important;
|
|
133
|
+
pointer-events: none;
|
|
134
|
+
position: absolute;
|
|
135
|
+
right: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
input:-webkit-autofill {
|
|
139
|
+
-webkit-box-shadow: inset 0 0 0px 9999px white;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@keyframes shake {
|
|
143
|
+
0%, 100% {
|
|
144
|
+
transform: translateX(0);
|
|
145
|
+
}
|
|
146
|
+
20%, 60% {
|
|
147
|
+
transform: translateX(-5px);
|
|
148
|
+
}
|
|
149
|
+
40%, 80% {
|
|
150
|
+
transform: translateX(5px);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.shake {
|
|
155
|
+
animation-duration: .5s;
|
|
156
|
+
animation-fill-mode: both;
|
|
157
|
+
animation-timing-function: ease-in-out;
|
|
158
|
+
animation-name: shake;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import ReactConstants from "./../ReactConstants";
|
|
2
|
+
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";
|
|
3
|
+
import {isDifferent} from "./Tools";
|
|
4
|
+
|
|
5
|
+
const toString = (it) => {
|
|
6
|
+
if (typeof it === 'object')
|
|
7
|
+
return JSON.stringify(it)
|
|
8
|
+
else
|
|
9
|
+
`${it}`
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
expect.extend({
|
|
13
|
+
toBeDifferentTo(a, b) {
|
|
14
|
+
return isDifferent(a, b) ? ({
|
|
15
|
+
pass: true,
|
|
16
|
+
message: () => `Expected ${toString(a)} to be same as ${toString(b)}`
|
|
17
|
+
}) : ({
|
|
18
|
+
pass: false,
|
|
19
|
+
message: () => `Expected ${toString(a)} not to be same as ${toString(b)}`
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
expect.extend({
|
|
24
|
+
toBeSameAs(a, b) {
|
|
25
|
+
return !isDifferent(a, b) ? ({
|
|
26
|
+
pass: true,
|
|
27
|
+
message: () => `Expected ${toString(a)} to be different to ${toString(b)}`
|
|
28
|
+
}) : ({
|
|
29
|
+
pass: false,
|
|
30
|
+
message: () => `Expected ${toString(a)} not to be different to ${toString(b)}`
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
const same = (a, b) => {
|
|
37
|
+
expect(a).toBeSameAs(b)
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const different = (a, b) => {
|
|
41
|
+
expect(a).toBeDifferentTo(b)
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
it('test isDifferent', () => {
|
|
45
|
+
same(1, 1);
|
|
46
|
+
different(1, 2);
|
|
47
|
+
different(1, []);
|
|
48
|
+
different(1, '1');
|
|
49
|
+
same(Infinity, Infinity);
|
|
50
|
+
different(Infinity, -Infinity);
|
|
51
|
+
different(NaN, undefined);
|
|
52
|
+
different(NaN, null);
|
|
53
|
+
different(NaN, NaN);
|
|
54
|
+
different(1, -1);
|
|
55
|
+
same(0, -0);
|
|
56
|
+
|
|
57
|
+
same(null, null);
|
|
58
|
+
same(void 0, undefined);
|
|
59
|
+
same(undefined, undefined);
|
|
60
|
+
different(null, undefined);
|
|
61
|
+
different('', null);
|
|
62
|
+
different(0, null);
|
|
63
|
+
|
|
64
|
+
same(true, true);
|
|
65
|
+
same(false, false);
|
|
66
|
+
different(true, false);
|
|
67
|
+
different(0, false);
|
|
68
|
+
different(1, true);
|
|
69
|
+
|
|
70
|
+
same('a', 'a');
|
|
71
|
+
different('a', 'b');
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
same({}, {});
|
|
75
|
+
same({a: 1, b: 2}, {a: 1, b: 2});
|
|
76
|
+
same({b: 2, a: 1}, {a: 1, b: 2});
|
|
77
|
+
|
|
78
|
+
different({a: 1, b: 2, c: []}, {a: 1, b: 2});
|
|
79
|
+
different({a: 1, b: 2}, {a: 1, b: 2, c: []});
|
|
80
|
+
different({a: 1, c: 3}, {a: 1, b: 2});
|
|
81
|
+
|
|
82
|
+
same({a: [{b: 1}]}, {a: [{b: 1}]});
|
|
83
|
+
different({a: [{b: 2}]}, {a: [{b: 1}]});
|
|
84
|
+
different({a: [{c: 1}]}, {a: [{b: 1}]});
|
|
85
|
+
|
|
86
|
+
different([], {});
|
|
87
|
+
different({}, []);
|
|
88
|
+
different({}, null);
|
|
89
|
+
different({}, undefined);
|
|
90
|
+
|
|
91
|
+
different({a: void 0}, {});
|
|
92
|
+
different({}, {a: undefined});
|
|
93
|
+
different({a: undefined}, {b: undefined});
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
same([], []);
|
|
97
|
+
same([1, 2, 3], [1, 2, 3]);
|
|
98
|
+
different([1, 2, 4], [1, 2, 3]);
|
|
99
|
+
different([1, 2], [1, 2, 3]);
|
|
100
|
+
|
|
101
|
+
same([{a: 1}, {b: 2}], [{a: 1}, {b: 2}]);
|
|
102
|
+
different([{a: 2}, {b: 2}], [{a: 1}, {b: 2}]);
|
|
103
|
+
|
|
104
|
+
different({'0': 0, '1': 1, length: 2}, [0, 1]);
|
|
105
|
+
});
|
package/src/Tools.ts
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
var global = global || window;
|
|
2
|
+
export const WINDOW = global;
|
|
3
|
+
export const DOCUMENT = WINDOW.document;
|
|
4
|
+
|
|
5
|
+
export function classNames(...classes: Array<string | number | boolean | null | void>) {
|
|
6
|
+
const filtered = [];
|
|
7
|
+
const length = classes.length;
|
|
8
|
+
for (let i = 0; i < length; i++) {
|
|
9
|
+
let it = classes[i];
|
|
10
|
+
!!it && filtered.push(it);
|
|
11
|
+
}
|
|
12
|
+
return filtered.join(' ');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const NOOP = () => {
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const orNoop = <T>(f: (...a: any) => T) => f || NOOP;
|
|
19
|
+
|
|
20
|
+
export const getRandomId = (prefix) => prefix + Math.random();
|
|
21
|
+
|
|
22
|
+
export const ref = (name, component) => {
|
|
23
|
+
const refKey = "__" + name;
|
|
24
|
+
return component[refKey] || (component[refKey] = (it) => component[name] = it)
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const createRef = (initialValue?: any) => {
|
|
28
|
+
let v = initialValue;
|
|
29
|
+
return function (value?: any) {
|
|
30
|
+
if (value != UNDEFINED)
|
|
31
|
+
v = value
|
|
32
|
+
return v;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const createAccessor = (field: string) => (o: any, value?: any) => {
|
|
37
|
+
return !o ? null : value != UNDEFINED ? o[field] = value : o[field]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const setOf = (list) => (list || []).reduce((map, key) => {
|
|
41
|
+
map[key] = TRUE;
|
|
42
|
+
return map;
|
|
43
|
+
}, {});
|
|
44
|
+
|
|
45
|
+
export const allPropsExcept = (obj, except) => {
|
|
46
|
+
let result = {};
|
|
47
|
+
for (let key in obj) {
|
|
48
|
+
if (!except[key]) result[key] = obj[key];
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const continuousIncludes = (value, inc) => {
|
|
54
|
+
const length = inc.length;
|
|
55
|
+
let from = -1;
|
|
56
|
+
for (let i = 0; i < length; i++) {
|
|
57
|
+
from = value.indexOf(inc[i], from + 1);
|
|
58
|
+
if (from === -1)
|
|
59
|
+
return FALSE
|
|
60
|
+
}
|
|
61
|
+
return TRUE;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const isArrayShallowEqual = (a, b) => {
|
|
65
|
+
if (a === b) return TRUE;
|
|
66
|
+
if (a == null || b == null) return FALSE;
|
|
67
|
+
if (a.length !== b.length) return FALSE;
|
|
68
|
+
|
|
69
|
+
let i = a.length - 1;
|
|
70
|
+
let result = TRUE;
|
|
71
|
+
while (i >= 0 && (result = (a[i] === b[i]))) {
|
|
72
|
+
i--;
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const debounce = (func, delay) => {
|
|
78
|
+
let inDebounce;
|
|
79
|
+
return function () {
|
|
80
|
+
const context = this;
|
|
81
|
+
const args = arguments;
|
|
82
|
+
clearTimeout(inDebounce);
|
|
83
|
+
inDebounce = setTimeout(() => {
|
|
84
|
+
func.apply(context, args);
|
|
85
|
+
}, delay)
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const memo = (func) => {
|
|
90
|
+
let prevArgs
|
|
91
|
+
let prevResult
|
|
92
|
+
return function () {
|
|
93
|
+
const context = this;
|
|
94
|
+
const args = arguments;
|
|
95
|
+
if (!isArrayShallowEqual(prevArgs, args)) {
|
|
96
|
+
prevArgs = args
|
|
97
|
+
prevResult = func.apply(context, args);
|
|
98
|
+
}
|
|
99
|
+
return prevResult
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const constructorOf = (v) => v && v.constructor;
|
|
104
|
+
export const typeOf = (v) => typeof v;
|
|
105
|
+
export const isFunction = (v) => typeOf(v) === 'function';
|
|
106
|
+
export const isString = (v) => typeOf(v) === 'string';
|
|
107
|
+
export const isObject = (v) => typeOf(v) === 'object';
|
|
108
|
+
|
|
109
|
+
const FALSE = false;
|
|
110
|
+
const TRUE = true;
|
|
111
|
+
|
|
112
|
+
export const isDifferent = (a, b) => {
|
|
113
|
+
if (a === null && b === null) return FALSE;
|
|
114
|
+
if (a === null || b === null) return TRUE;
|
|
115
|
+
if (a === b) return FALSE;
|
|
116
|
+
|
|
117
|
+
const constructorA = constructorOf(a);
|
|
118
|
+
const constructorB = constructorOf(b);
|
|
119
|
+
if (constructorA !== constructorB) {
|
|
120
|
+
return TRUE;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
let i;
|
|
124
|
+
if (constructorA === Array) {
|
|
125
|
+
if ((i = a.length) === b.length) {
|
|
126
|
+
while (i-- && !isDifferent(a[i], b[i])) {
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
} else if (constructorA === Object) {
|
|
130
|
+
const keysA = Object.keys(a);
|
|
131
|
+
const keysB = Object.keys(b);
|
|
132
|
+
if ((i = keysA.length) === keysB.length) {
|
|
133
|
+
let key;
|
|
134
|
+
while (i-- && ((key = keysA[i]) in b) && !isDifferent(a[key], b[key])) {
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return i !== -1;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const preventDefault = e => {
|
|
143
|
+
e && e.preventDefault();
|
|
144
|
+
};
|
|
145
|
+
export const stopPropagation = e => {
|
|
146
|
+
e && e.stopPropagation();
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const setTimeout = function (callback: (...args: any[]) => void, ms?: number, ...args: any[]) {
|
|
150
|
+
return WINDOW.setTimeout.apply(WINDOW, arguments);
|
|
151
|
+
};
|
|
152
|
+
export const clearTimeout = (id) => {
|
|
153
|
+
WINDOW.clearTimeout(id);
|
|
154
|
+
};
|
|
155
|
+
export const setInterval = function (callback: (...args: any[]) => void, ms?: number, ...args: any[]) {
|
|
156
|
+
return WINDOW.setInterval.apply(WINDOW, arguments);
|
|
157
|
+
};
|
|
158
|
+
export const clearInterval = (id) => {
|
|
159
|
+
WINDOW.clearInterval(id);
|
|
160
|
+
};
|
|
161
|
+
export const requestAnimationFrame = (cb) => WINDOW.requestAnimationFrame(cb);
|
|
162
|
+
export const addEventListener = (el, type, listener, options?) => {
|
|
163
|
+
el && el.addEventListener(type, listener, options);
|
|
164
|
+
};
|
|
165
|
+
export const removeEventListener = (el, type, listener, options?) => {
|
|
166
|
+
el && el.removeEventListener(type, listener, options);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const UNDEFINED = undefined;
|
|
170
|
+
export const isUndefined = a => a === UNDEFINED;
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
export class Comparators {
|
|
174
|
+
static SORT_ASC = 'ASC';
|
|
175
|
+
static SORT_DESC = 'DESC';
|
|
176
|
+
|
|
177
|
+
static of = (field, order, data) => {
|
|
178
|
+
let comparator;
|
|
179
|
+
if (Array.isArray(field)) {
|
|
180
|
+
const isOrderArray = Array.isArray(order);
|
|
181
|
+
comparator = Comparators.chain(field.map((it, i) => Comparators.of(it, (isOrderArray && order[i]) || Comparators.SORT_ASC, data)));
|
|
182
|
+
} else if (isFunction(field)) {
|
|
183
|
+
if (data && data[0] && isString(field(data[0]))) {
|
|
184
|
+
const collator = new Intl.Collator('default', {sensitivity: 'base'});
|
|
185
|
+
comparator = (a, b) => {
|
|
186
|
+
return collator.compare(field(a), field(b));
|
|
187
|
+
}
|
|
188
|
+
} else
|
|
189
|
+
comparator = (a, b) => {
|
|
190
|
+
const A = field(a);
|
|
191
|
+
const B = field(b);
|
|
192
|
+
return (A < B ? -1 : (A > B ? 1 : 0));
|
|
193
|
+
};
|
|
194
|
+
} else if (isString(field))
|
|
195
|
+
comparator = Comparators.of(it => it[field], Comparators.SORT_ASC, data);
|
|
196
|
+
else
|
|
197
|
+
comparator = Comparators.of(it => it, Comparators.SORT_ASC, data);
|
|
198
|
+
|
|
199
|
+
if (order && order === Comparators.SORT_DESC) {
|
|
200
|
+
return Comparators.inverse(comparator);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return addComparatorMethods(comparator);
|
|
204
|
+
};
|
|
205
|
+
static chain = (comparators) => addComparatorMethods((a, b) => {
|
|
206
|
+
let result;
|
|
207
|
+
for (let i = 0; i < comparators.length; i++) {
|
|
208
|
+
result = comparators[i](a, b);
|
|
209
|
+
if (result !== 0)
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
return result;
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
static inverse = (comparator) => addComparatorMethods((a, b) => -comparator(a, b));
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const addComparatorMethods = function (comparator) {
|
|
220
|
+
comparator.inverse = () => Comparators.inverse(comparator);
|
|
221
|
+
comparator.and = (another) => Comparators.chain([comparator, another]);
|
|
222
|
+
return comparator;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
if (window['isNotProductionEnvironment']) {
|
|
226
|
+
// will be removed in production build
|
|
227
|
+
// needed only to prevent bundler to remove 'unused' functions
|
|
228
|
+
window['tools'] = {
|
|
229
|
+
memo
|
|
230
|
+
}
|
|
231
|
+
}
|
package/src/global.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/src/global.scss
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import ReactConstants from "./../ReactConstants";
|
|
2
|
+
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";
|
|
3
|
+
import Animated from "./Animated";
|
|
4
|
+
import {toConsumableArray as __toConsumableArray} from "./../_virtual/_rollupPluginBabelHelpers";
|
|
5
|
+
import {extends as __extends} from "./../_virtual/_rollupPluginBabelHelpers";
|
|
6
|
+
import {inherits as __inherits} from "./../_virtual/_rollupPluginBabelHelpers";
|
|
7
|
+
import AutocompleteSelect from "./AutocompleteSelect";
|
|
8
|
+
import Button from "./Button";
|
|
9
|
+
import Checkbox from "./Checkbox";
|
|
10
|
+
import CircleProgress from "./CircleProgress";
|
|
11
|
+
import * as CommonFields from "./CommonFields";
|
|
12
|
+
import Dialog from "./Dialog";
|
|
13
|
+
import DNDContainer from "./DNDContainer";
|
|
14
|
+
import DNDDraggable from "./DNDDraggable";
|
|
15
|
+
import DNDDroppable from "./DNDDroppable";
|
|
16
|
+
import DropFileInput from "./DropFileInput";
|
|
17
|
+
import Dropzone from "./Dropzone";
|
|
18
|
+
import FilteredList from "./FilteredList";
|
|
19
|
+
import FloatingActionButton from "./FloatingActionButton";
|
|
20
|
+
import FormUploadProgress from "./FormUploadProgress";
|
|
21
|
+
import ImageGallery from "./ImageGallery";
|
|
22
|
+
import {ImageGalleryContainer} from "./ImageGallery";
|
|
23
|
+
import MaterialIcon from "./MaterialIcon";
|
|
24
|
+
import Modal from "./Modal";
|
|
25
|
+
import ModalMenu from "./ModalMenu";
|
|
26
|
+
import Router from "./router";
|
|
27
|
+
import Scrollable from "./Scrollable";
|
|
28
|
+
import Size from "./Size";
|
|
29
|
+
import Snackbar from "./Snackbar";
|
|
30
|
+
import SpinningProgress from "./SpinningProgress";
|
|
31
|
+
import Switch from "./Switch";
|
|
32
|
+
import ReactConstants from './ReactConstants'
|
|
33
|
+
import ReactCreateElement from './ReactCreateElement'
|
|
34
|
+
import * as ReadyListener from './ReadyListener'
|
|
35
|
+
import TextField from "./TextField";
|
|
36
|
+
import Table from "./Table";
|
|
37
|
+
import ScrollableTable from "./ScrollableTable";
|
|
38
|
+
import DroppableList from "./DroppableList";
|
|
39
|
+
import DroppableHorizontalList from "./DroppableHorizontalList";
|
|
40
|
+
import * as StoreTools from "./store/Store";
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
Animated,
|
|
44
|
+
AutocompleteSelect,
|
|
45
|
+
Button,
|
|
46
|
+
Checkbox,
|
|
47
|
+
CircleProgress,
|
|
48
|
+
CommonFields,
|
|
49
|
+
Dialog,
|
|
50
|
+
DNDContainer,
|
|
51
|
+
DNDDraggable,
|
|
52
|
+
DNDDroppable,
|
|
53
|
+
DroppableList,
|
|
54
|
+
DroppableHorizontalList,
|
|
55
|
+
DropFileInput,
|
|
56
|
+
Dropzone,
|
|
57
|
+
FilteredList,
|
|
58
|
+
FloatingActionButton,
|
|
59
|
+
FormUploadProgress,
|
|
60
|
+
ImageGallery,
|
|
61
|
+
ImageGalleryContainer,
|
|
62
|
+
MaterialIcon,
|
|
63
|
+
Modal,
|
|
64
|
+
ModalMenu,
|
|
65
|
+
Router,
|
|
66
|
+
Scrollable,
|
|
67
|
+
ScrollableTable,
|
|
68
|
+
Size,
|
|
69
|
+
Snackbar,
|
|
70
|
+
SpinningProgress,
|
|
71
|
+
Switch,
|
|
72
|
+
ReactConstants,
|
|
73
|
+
ReactCreateElement,
|
|
74
|
+
ReadyListener,
|
|
75
|
+
Table,
|
|
76
|
+
TextField,
|
|
77
|
+
StoreTools,
|
|
78
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import ReactConstants from "./ReactConstants";
|
|
2
|
+
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";
|
|
3
|
+
import {DOCUMENT, WINDOW} from "../Tools";
|
|
4
|
+
|
|
5
|
+
const history = WINDOW.history;
|
|
6
|
+
|
|
7
|
+
const events = ['pushState', 'replaceState'];
|
|
8
|
+
events.forEach(e => {
|
|
9
|
+
var original = history[e];
|
|
10
|
+
history[e] = function () {
|
|
11
|
+
original.apply(history, arguments);
|
|
12
|
+
fireEvent(e);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const fireEvent = (name) => {
|
|
17
|
+
const event = DOCUMENT.createEvent('Event');
|
|
18
|
+
event.initEvent(name, true, true);
|
|
19
|
+
WINDOW.dispatchEvent(event);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const pushLocation = (path) => path !== WINDOW.location.pathname && history[events[0]](null, null, path);
|
|
23
|
+
|
|
24
|
+
export const replaceLocation = (path) => history[events[1]](null, null, path);
|
|
25
|
+
|
|
26
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
27
|
+
// will be removed in production build
|
|
28
|
+
// needed only to prevent bundler to remove 'unused' functions
|
|
29
|
+
window['history-tools'] = {
|
|
30
|
+
replaceLocation
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import ReactConstants from "./ReactConstants";
|
|
2
|
+
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";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
|
|
5
|
+
import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
|
|
6
|
+
import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
|
7
|
+
import ReactCreateElement from '../ReactCreateElement';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import './HistoryTools'
|
|
10
|
+
import {pushLocation} from "./HistoryTools";
|
|
11
|
+
import {preventDefault} from "../Tools";
|
|
12
|
+
|
|
13
|
+
const Link = ({children, href, className}) =>
|
|
14
|
+
<a href={href} className={className} onClick={(e) => {
|
|
15
|
+
if (!e.ctrlKey) {
|
|
16
|
+
preventDefault(e);
|
|
17
|
+
pushLocation(href);
|
|
18
|
+
}
|
|
19
|
+
}}>{children}</a>;
|
|
20
|
+
|
|
21
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
22
|
+
Link.propTypes = {
|
|
23
|
+
href: PropTypes.string.isRequired,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default Link;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import ReactConstants from "./ReactConstants";
|
|
2
|
+
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";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
|
|
5
|
+
import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
|
|
6
|
+
import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
|
7
|
+
import ReactCreateElement from '../ReactCreateElement';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import './HistoryTools'
|
|
10
|
+
import Route from "./Route";
|
|
11
|
+
import Link from "./Link";
|
|
12
|
+
import {classNames} from "../Tools";
|
|
13
|
+
|
|
14
|
+
const NavLink = ({children, href, highlightPath, className, activeClassName}) =>
|
|
15
|
+
<Route path={highlightPath || href}
|
|
16
|
+
controller={matches => <Link href={href} className={classNames(className, matches && activeClassName)}>
|
|
17
|
+
{children}
|
|
18
|
+
</Link>}
|
|
19
|
+
/>;
|
|
20
|
+
|
|
21
|
+
if(process.env.NODE_ENV !== 'production') {
|
|
22
|
+
NavLink.propTypes = Link.propTypes;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default NavLink;
|