react-ui-basics 0.0.157 → 0.0.158
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 +2 -1
- package/AutocompleteSelect.js +15 -14
- package/Button.js +15 -15
- package/Button.js.map +1 -1
- package/Checkbox.js +3 -2
- package/CircleProgress.js +2 -1
- package/CommonFields.js +17 -0
- package/CommonFields.js.map +1 -0
- package/DNDContainer.js +29 -28
- package/DNDDraggable.js +1 -0
- package/DNDDroppable.js +1 -0
- package/Dialog.js +4 -3
- package/DropFileInput.js +1 -0
- package/DroppableHorizontalList.js +18 -17
- package/DroppableList.js +18 -17
- package/Dropzone.js +6 -5
- package/FilteredList.js +11 -10
- package/FloatingActionButton.js +2 -1
- package/FormUploadProgress.js +2 -1
- package/ImageGallery.js +93 -92
- package/MaterialIcon.js +2 -1
- package/Modal.js +7 -6
- package/ModalMenu.js +4 -3
- package/ReadyListener.js +1 -0
- package/ResizeObserver.d.ts +1 -0
- package/Scrollable.js +38 -37
- package/ScrollableTable.js +1 -0
- package/Size.js +3 -2
- package/Snackbar.js +1 -0
- package/SpinningProgress.js +1 -0
- package/Switch.js +3 -2
- package/Table.js +10 -9
- package/TextField.js +7 -6
- package/Tools.js +12 -12
- package/bundle.css +591 -591
- package/index.js +8 -5
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/router/Link.js +3 -2
- package/router/NavLink.js +3 -2
- package/router/Route.js +10 -9
- package/router/index.js +1 -0
- package/store/ProxyTools.js +1 -0
- package/store/Store.js +1 -0
package/Scrollable.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, assertThisInitialized as _assertThisInitialized, createClass as _createClass } from './_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import {clientHeight as __clientHeight, clientWidth as __clientWidth, getBoundingClientRect as __getBoundingClientRect, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, scrollLeft as __scrollLeft, scrollTop as __scrollTop, style as __style, top as __top, value as __value, width as __width} from "./CommonFields";
|
|
2
3
|
import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
|
|
3
4
|
import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
|
|
4
5
|
import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
|
@@ -83,14 +84,14 @@ var Scrollable = function (_PureComponent) {
|
|
|
83
84
|
var offsetWidth = offsetWidthOf(viewport);
|
|
84
85
|
var scrollbarHeight = offsetHeightOf(scrollbar);
|
|
85
86
|
var scrollbarWidth = offsetWidthOf(scrollbarH);
|
|
86
|
-
var position = viewport
|
|
87
|
-
var positionH = viewport
|
|
87
|
+
var position = viewport[__scrollTop] / (scrollHeight - offsetHeight);
|
|
88
|
+
var positionH = viewport[__scrollLeft] / (scrollWidth - offsetWidth);
|
|
88
89
|
if (position > 1) {
|
|
89
|
-
viewport
|
|
90
|
+
viewport[__scrollTop] = scrollHeight - offsetHeight;
|
|
90
91
|
position = 1;
|
|
91
92
|
}
|
|
92
|
-
styleOf(thumb)
|
|
93
|
-
styleOf(thumbH)
|
|
93
|
+
styleOf(thumb)[__top] = position * (scrollbarHeight - offsetHeightOf(thumb)) + 'px';
|
|
94
|
+
styleOf(thumbH)[__left] = positionH * (scrollbarWidth - offsetWidthOf(thumbH)) + 'px';
|
|
94
95
|
if (position >= 0.98) {
|
|
95
96
|
!scrolledToBottom && orNoop(props().onScrolledToBottom)();
|
|
96
97
|
scrolledToBottom = true;
|
|
@@ -108,16 +109,16 @@ var Scrollable = function (_PureComponent) {
|
|
|
108
109
|
var reset = function reset() {
|
|
109
110
|
removeEventListener(WINDOW, 'mouseup', reset);
|
|
110
111
|
removeEventListener(WINDOW, 'mousemove', moveListener);
|
|
111
|
-
viewport.
|
|
112
|
+
viewport[__style].scrollBehavior = '';
|
|
112
113
|
scrolling = false;
|
|
113
114
|
};
|
|
114
115
|
var moveListener = function moveListener(e) {
|
|
115
116
|
if (!scrolling) return;
|
|
116
117
|
if (scrolling === 'v') {
|
|
117
|
-
viewport
|
|
118
|
+
viewport[__scrollTop] += (e.clientY - lastY) * ratio;
|
|
118
119
|
lastY = e.clientY;
|
|
119
120
|
} else if (scrolling === 'h') {
|
|
120
|
-
viewport
|
|
121
|
+
viewport[__scrollLeft] += (e.clientX - lastX) * ratioH;
|
|
121
122
|
lastX = e.clientX;
|
|
122
123
|
}
|
|
123
124
|
};
|
|
@@ -125,7 +126,7 @@ var Scrollable = function (_PureComponent) {
|
|
|
125
126
|
lastY = e.clientY;
|
|
126
127
|
scrolling = 'v';
|
|
127
128
|
ratio = scrollHeightOf(viewport) / offsetHeightOf(viewport);
|
|
128
|
-
viewport.
|
|
129
|
+
viewport[__style].scrollBehavior = 'unset';
|
|
129
130
|
addEventListener(WINDOW, 'mouseup', reset);
|
|
130
131
|
addEventListener(WINDOW, 'mousemove', moveListener);
|
|
131
132
|
};
|
|
@@ -135,7 +136,7 @@ var Scrollable = function (_PureComponent) {
|
|
|
135
136
|
lastX = e.clientX;
|
|
136
137
|
scrolling = 'h';
|
|
137
138
|
ratioH = scrollWidthOf(viewport) / offsetWidthOf(viewport);
|
|
138
|
-
viewport.
|
|
139
|
+
viewport[__style].scrollBehavior = 'unset';
|
|
139
140
|
addEventListener(WINDOW, 'mouseup', reset);
|
|
140
141
|
addEventListener(WINDOW, 'mousemove', moveListener);
|
|
141
142
|
};
|
|
@@ -143,37 +144,37 @@ var Scrollable = function (_PureComponent) {
|
|
|
143
144
|
thumbH.onmouseup = reset;
|
|
144
145
|
scrollbar.onclick = function (e) {
|
|
145
146
|
if (e.target === scrollbar) {
|
|
146
|
-
var thumbPosition = parseInt(styleOf(thumb)
|
|
147
|
-
viewport
|
|
147
|
+
var thumbPosition = parseInt(styleOf(thumb)[__top]);
|
|
148
|
+
viewport[__scrollTop] += offsetHeightOf(viewport) * 0.9 * (e.offsetY < thumbPosition ? -1 : 1);
|
|
148
149
|
}
|
|
149
150
|
};
|
|
150
151
|
scrollbarH.onclick = function (e) {
|
|
151
152
|
if (e.target === scrollbarH) {
|
|
152
|
-
var thumbPosition = parseInt(styleOf(thumbH)
|
|
153
|
-
viewport
|
|
153
|
+
var thumbPosition = parseInt(styleOf(thumbH)[__left]);
|
|
154
|
+
viewport[__scrollLeft] += offsetWidthOf(viewport) * 0.9 * (e.offsetX < thumbPosition ? -1 : 1);
|
|
154
155
|
}
|
|
155
156
|
};
|
|
156
157
|
var adjustScrollWidth = function adjustScrollWidth() {
|
|
157
158
|
if (NATIVE_SCROLL_WIDTH < 0) {
|
|
158
|
-
NATIVE_SCROLL_WIDTH = viewport.offsetWidth - viewport
|
|
159
|
+
NATIVE_SCROLL_WIDTH = viewport.offsetWidth - viewport[__clientWidth];
|
|
159
160
|
if (NATIVE_SCROLL_WIDTH === 0 && scrollHeightOf(viewport) !== offsetHeightOf(viewport)) {
|
|
160
161
|
NATIVE_SCROLL_WIDTH = -1;
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
if (NATIVE_SCROLL_HEIGHT < 0) {
|
|
164
|
-
NATIVE_SCROLL_HEIGHT = viewport.offsetHeight - viewport
|
|
165
|
+
NATIVE_SCROLL_HEIGHT = viewport.offsetHeight - viewport[__clientHeight];
|
|
165
166
|
if (NATIVE_SCROLL_HEIGHT === 0 && scrollWidthOf(viewport) !== offsetWidthOf(viewport)) {
|
|
166
167
|
NATIVE_SCROLL_HEIGHT = -1;
|
|
167
168
|
}
|
|
168
169
|
}
|
|
169
170
|
if (!adjustedScrollWidth) {
|
|
170
171
|
if (NATIVE_SCROLL_WIDTH >= 0 && status() !== WITHOUT_SCROLL) {
|
|
171
|
-
styleOf(viewport).paddingRight = NATIVE_SCROLL_WIDTH + scrollbar
|
|
172
|
-
styleOf(viewport).marginRight = -NATIVE_SCROLL_WIDTH - scrollbar
|
|
172
|
+
styleOf(viewport).paddingRight = NATIVE_SCROLL_WIDTH + scrollbar[__clientWidth] + 'px';
|
|
173
|
+
styleOf(viewport).marginRight = -NATIVE_SCROLL_WIDTH - scrollbar[__clientWidth] + 'px';
|
|
173
174
|
}
|
|
174
175
|
if (NATIVE_SCROLL_HEIGHT >= 0 && statusH() !== WITHOUT_SCROLL) {
|
|
175
|
-
styleOf(viewport).paddingBottom = NATIVE_SCROLL_HEIGHT + scrollbarH
|
|
176
|
-
styleOf(viewport).marginBottom = -NATIVE_SCROLL_HEIGHT - scrollbarH
|
|
176
|
+
styleOf(viewport).paddingBottom = NATIVE_SCROLL_HEIGHT + scrollbarH[__clientHeight] + 'px';
|
|
177
|
+
styleOf(viewport).marginBottom = -NATIVE_SCROLL_HEIGHT - scrollbarH[__clientHeight] + 'px';
|
|
177
178
|
}
|
|
178
179
|
adjustedScrollWidth = true;
|
|
179
180
|
}
|
|
@@ -214,15 +215,15 @@ var Scrollable = function (_PureComponent) {
|
|
|
214
215
|
var newRatio = scrollHeight / scrollbarHeight;
|
|
215
216
|
if (ratio === newRatio && Number.isFinite(newRatio) || Number.isNaN(newRatio)) return;
|
|
216
217
|
var offsetHeight = offsetHeightOf(viewport);
|
|
217
|
-
var horizontalScrollBarOffset = statusH() !== WITHOUT_SCROLL ? scrollbarH
|
|
218
|
+
var horizontalScrollBarOffset = statusH() !== WITHOUT_SCROLL ? scrollbarH[__clientHeight] + Math.max(NATIVE_SCROLL_HEIGHT, 0) : 0;
|
|
218
219
|
var containerOffsetHeight = offsetHeightOf(container) + horizontalScrollBarOffset;
|
|
219
220
|
if (containerOffsetHeight === scrollHeight && status() === WITHOUT_SCROLL) return;
|
|
220
|
-
if (props().autoScrollTop && scrollHeight - offsetHeight - viewport
|
|
221
|
-
viewport
|
|
221
|
+
if (props().autoScrollTop && scrollHeight - offsetHeight - viewport[__scrollTop] <= 20 && newRatio < ratio && Number.isFinite(newRatio) && Number.isFinite(ratio)) {
|
|
222
|
+
viewport[__scrollTop] = 0;
|
|
222
223
|
}
|
|
223
224
|
ratio = newRatio;
|
|
224
|
-
styleOf(thumb)
|
|
225
|
-
styleOf(container)
|
|
225
|
+
styleOf(thumb)[__height] = scrollbarHeight / newRatio + 'px';
|
|
226
|
+
styleOf(container)[__height] = scrollHeight - horizontalScrollBarOffset + 'px';
|
|
226
227
|
containerOffsetHeight = offsetHeightOf(container) + horizontalScrollBarOffset;
|
|
227
228
|
if (scrollBarModeOf(props()) === SCROLLBAR_MODE_HIDDEN) {
|
|
228
229
|
if (status() !== WITHOUT_SCROLL) hideScrollbar(scrollbar, viewport);
|
|
@@ -236,8 +237,8 @@ var Scrollable = function (_PureComponent) {
|
|
|
236
237
|
}
|
|
237
238
|
scrolledToBottom = false;
|
|
238
239
|
scrolledToTop = false;
|
|
239
|
-
var position = viewport
|
|
240
|
-
styleOf(thumb)
|
|
240
|
+
var position = viewport[__scrollTop] / (scrollHeight - offsetHeight);
|
|
241
|
+
styleOf(thumb)[__top] = position * (scrollbarHeight - offsetHeightOf(thumb)) + 'px';
|
|
241
242
|
};
|
|
242
243
|
var updateHorizontalScrollbar = function updateHorizontalScrollbar() {
|
|
243
244
|
var scrollWidth = scrollWidthOf(viewport);
|
|
@@ -246,16 +247,16 @@ var Scrollable = function (_PureComponent) {
|
|
|
246
247
|
var newRatio = scrollWidth / scrollbarWidth;
|
|
247
248
|
if (ratioH === newRatio && Number.isFinite(newRatio) || Number.isNaN(newRatio)) return;
|
|
248
249
|
var offsetWidth = offsetWidthOf(viewport);
|
|
249
|
-
var verticalScrollBarOffset = status() !== WITHOUT_SCROLL ? scrollbar
|
|
250
|
+
var verticalScrollBarOffset = status() !== WITHOUT_SCROLL ? scrollbar[__clientWidth] + Math.max(NATIVE_SCROLL_WIDTH, 0) : 0;
|
|
250
251
|
var containerOffsetWidth = offsetWidthOf(container) + verticalScrollBarOffset;
|
|
251
252
|
if (containerOffsetWidth === scrollWidth && statusH() === WITHOUT_SCROLL) return;
|
|
252
253
|
ratioH = newRatio;
|
|
253
|
-
styleOf(thumbH)
|
|
254
|
+
styleOf(thumbH)[__width] = scrollbarWidth / newRatio + 'px';
|
|
254
255
|
if (horizontalScrollBarModeOf(props()) === SCROLLBAR_MODE_HIDDEN) {
|
|
255
256
|
if (statusH() !== WITHOUT_SCROLL) hideHorizontalScrollbar(scrollbarH, viewport);
|
|
256
257
|
return;
|
|
257
258
|
}
|
|
258
|
-
styleOf(container)
|
|
259
|
+
styleOf(container)[__width] = scrollWidth - verticalScrollBarOffset + 'px';
|
|
259
260
|
containerOffsetWidth = offsetWidthOf(container) + verticalScrollBarOffset;
|
|
260
261
|
if (containerOffsetWidth < scrollWidth) {
|
|
261
262
|
adjustedScrollWidth = false;
|
|
@@ -263,8 +264,8 @@ var Scrollable = function (_PureComponent) {
|
|
|
263
264
|
} else {
|
|
264
265
|
hideHorizontalScrollbar(scrollbarH, viewport);
|
|
265
266
|
}
|
|
266
|
-
var position = viewport
|
|
267
|
-
styleOf(thumbH)
|
|
267
|
+
var position = viewport[__scrollLeft] / (scrollWidth - offsetWidth);
|
|
268
|
+
styleOf(thumbH)[__left] = position * (scrollbarWidth - offsetWidthOf(thumbH)) + 'px';
|
|
268
269
|
};
|
|
269
270
|
initTimeout = setTimeout(function () {
|
|
270
271
|
resizeInterval = setInterval(function () {
|
|
@@ -279,21 +280,21 @@ var Scrollable = function (_PureComponent) {
|
|
|
279
280
|
if (scrollBarModeOf(props()) !== scrollBarModeOf(prevProps)) init();else if (onScroll(props()) !== onScroll(prevProps)) init();
|
|
280
281
|
};
|
|
281
282
|
that.setScroll = function (y) {
|
|
282
|
-
viewportRef()
|
|
283
|
+
viewportRef()[__scrollTop] = y;
|
|
283
284
|
};
|
|
284
285
|
that.getScroll = function () {
|
|
285
|
-
return viewportRef()
|
|
286
|
+
return viewportRef()[__scrollTop];
|
|
286
287
|
};
|
|
287
288
|
that.getScrollHeight = function () {
|
|
288
289
|
return scrollHeightOf(viewportRef());
|
|
289
290
|
};
|
|
290
291
|
that.getHeight = function () {
|
|
291
|
-
return containerRef()
|
|
292
|
+
return containerRef()[__clientHeight];
|
|
292
293
|
};
|
|
293
294
|
that[render] = function () {
|
|
294
295
|
var _props = props();
|
|
295
|
-
var className = _props
|
|
296
|
-
children = _props
|
|
296
|
+
var className = _props[__className],
|
|
297
|
+
children = _props[__children];
|
|
297
298
|
return ReactCreateElement("div", {
|
|
298
299
|
[__className]: classNames('Scrollable', className, status() || WITH_SCROLL, statusH() + '-horizontal'),
|
|
299
300
|
style: styleOf(_props),
|
package/ScrollableTable.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { jsx as jsxRuntime_2 } from 'react/jsx-runtime';
|
|
3
|
+
import {clientHeight as __clientHeight, clientWidth as __clientWidth, getBoundingClientRect as __getBoundingClientRect, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, scrollLeft as __scrollLeft, scrollTop as __scrollTop, style as __style, top as __top, value as __value, width as __width} from "./CommonFields";
|
|
3
4
|
import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
|
|
4
5
|
import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
|
|
5
6
|
import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
package/Size.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
+
import {clientHeight as __clientHeight, clientWidth as __clientWidth, getBoundingClientRect as __getBoundingClientRect, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, scrollLeft as __scrollLeft, scrollTop as __scrollTop, style as __style, top as __top, value as __value, width as __width} from "./CommonFields";
|
|
2
3
|
import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
|
|
3
4
|
import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
|
|
4
5
|
import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
|
@@ -8,7 +9,7 @@ import ReactCreateElement from './ReactCreateElement.js';
|
|
|
8
9
|
import { isUndefined } from './Tools.js';
|
|
9
10
|
|
|
10
11
|
var Size = function Size(_ref) {
|
|
11
|
-
var value = _ref
|
|
12
|
+
var value = _ref[__value];
|
|
12
13
|
return ReactCreateElement("span", {
|
|
13
14
|
[__className]: "Size"
|
|
14
15
|
}, formatNumber(value, 1), "\xA0", formatAbbreviation(value));
|
|
@@ -20,7 +21,7 @@ var formatNumberWithMaxLength = function formatNumberWithMaxLength(size, fractio
|
|
|
20
21
|
do {
|
|
21
22
|
result = formatNumber(size, fractionalLength, toAbbreviation);
|
|
22
23
|
fractionalLength--;
|
|
23
|
-
} while (maxLength !== -1 && fractionalLength >= 0 && result
|
|
24
|
+
} while (maxLength !== -1 && fractionalLength >= 0 && result[__length] > maxLength);
|
|
24
25
|
return result;
|
|
25
26
|
};
|
|
26
27
|
function formatNumber(size, fractionalLength, toAbbreviation) {
|
package/Snackbar.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, assertThisInitialized as _assertThisInitialized, slicedToArray as _slicedToArray, createClass as _createClass } from './_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import {clientHeight as __clientHeight, clientWidth as __clientWidth, getBoundingClientRect as __getBoundingClientRect, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, scrollLeft as __scrollLeft, scrollTop as __scrollTop, style as __style, top as __top, value as __value, width as __width} from "./CommonFields";
|
|
2
3
|
import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
|
|
3
4
|
import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
|
|
4
5
|
import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
package/SpinningProgress.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
+
import {clientHeight as __clientHeight, clientWidth as __clientWidth, getBoundingClientRect as __getBoundingClientRect, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, scrollLeft as __scrollLeft, scrollTop as __scrollTop, style as __style, top as __top, value as __value, width as __width} from "./CommonFields";
|
|
2
3
|
import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
|
|
3
4
|
import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
|
|
4
5
|
import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
package/Switch.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass } from './_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import {clientHeight as __clientHeight, clientWidth as __clientWidth, getBoundingClientRect as __getBoundingClientRect, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, scrollLeft as __scrollLeft, scrollTop as __scrollTop, style as __style, top as __top, value as __value, width as __width} from "./CommonFields";
|
|
2
3
|
import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
|
|
3
4
|
import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
|
|
4
5
|
import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
|
@@ -21,11 +22,11 @@ var Switch = function (_PureComponent) {
|
|
|
21
22
|
_this[render] = function () {
|
|
22
23
|
var _this$props = _this.props,
|
|
23
24
|
label = _this$props.label,
|
|
24
|
-
className = _this$props
|
|
25
|
+
className = _this$props[__className],
|
|
25
26
|
labelOn = _this$props.labelOn,
|
|
26
27
|
labelOff = _this$props.labelOff,
|
|
27
28
|
onChange = _this$props.onChange,
|
|
28
|
-
value = _this$props
|
|
29
|
+
value = _this$props[__value],
|
|
29
30
|
onClick = _this$props.onClick;
|
|
30
31
|
var id = _this.props.id || randomId;
|
|
31
32
|
return ReactCreateElement("div", {
|
package/Table.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { jsxs as jsxRuntime_1, jsx as jsxRuntime_2 } from 'react/jsx-runtime';
|
|
3
|
+
import {clientHeight as __clientHeight, clientWidth as __clientWidth, getBoundingClientRect as __getBoundingClientRect, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, scrollLeft as __scrollLeft, scrollTop as __scrollTop, style as __style, top as __top, value as __value, width as __width} from "./CommonFields";
|
|
3
4
|
import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
|
|
4
5
|
import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
|
|
5
6
|
import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
|
@@ -28,8 +29,8 @@ var Table = /** @class */ (function (_super) {
|
|
|
28
29
|
var updateHeaders = function () {
|
|
29
30
|
var hidden = headers().querySelectorAll('.hidden');
|
|
30
31
|
var fixed = headers().querySelectorAll('.fixed');
|
|
31
|
-
for (var i = 0; i < hidden
|
|
32
|
-
fixed[i]
|
|
32
|
+
for (var i = 0; i < hidden[__length]; i++) {
|
|
33
|
+
fixed[i][__style][__width] = hidden[i].offsetWidth + 'px';
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
var cancelEditing = function () {
|
|
@@ -40,15 +41,15 @@ var Table = /** @class */ (function (_super) {
|
|
|
40
41
|
};
|
|
41
42
|
var handleInputChange = function (event) {
|
|
42
43
|
var target = event.target;
|
|
43
|
-
var value = target.type === 'checkbox' ? target.checked : target
|
|
44
|
+
var value = target.type === 'checkbox' ? target.checked : target[__value];
|
|
44
45
|
_this.setState({ editing: __extends(__extends({}, state(_this).editing), { value: value }) });
|
|
45
46
|
};
|
|
46
47
|
var onFinishEditing = function () {
|
|
47
48
|
var _a;
|
|
48
49
|
var editing = state(_this).editing;
|
|
49
|
-
if (editing
|
|
50
|
+
if (editing[__value] === null)
|
|
50
51
|
return;
|
|
51
|
-
var value = editing
|
|
52
|
+
var value = editing[__value];
|
|
52
53
|
if (isString(value))
|
|
53
54
|
value = value.trim();
|
|
54
55
|
if (value === editing.item[editing.field])
|
|
@@ -107,7 +108,7 @@ var Table = /** @class */ (function (_super) {
|
|
|
107
108
|
updateHeaders();
|
|
108
109
|
};
|
|
109
110
|
_this[render] = function () {
|
|
110
|
-
var _a = props(), _b = _a.columns, columns = _b === void 0 ? [] : _b, _c = _a.onRowClick, onRowClick = _c === void 0 ? NOOP : _c, disabled = _a.disabled, className = _a
|
|
111
|
+
var _a = props(), _b = _a.columns, columns = _b === void 0 ? [] : _b, _c = _a.onRowClick, onRowClick = _c === void 0 ? NOOP : _c, disabled = _a.disabled, className = _a[__className], rowClassName = _a.rowClassName, _d = _a.toKey, toKey = _d === void 0 ? getId : _d;
|
|
111
112
|
var _e = state(_this), sortBy = _e.sortBy, sortOrder = _e.sortOrder, _f = _e.data, data = _f === void 0 ? [] : _f, editing = _e.editing;
|
|
112
113
|
return (jsxRuntime_1("table", __extends({ [__className]: classNames("Table", className) }, { [__children]: [jsxRuntime_2("thead", { [__children]: jsxRuntime_2("tr", __extends({ ref: headers }, { [__children]: columns.filter(function (it) { return !!it; }).map(function (column, i) {
|
|
113
114
|
var sortable = column.sortable || column.sortable == null;
|
|
@@ -136,11 +137,11 @@ var Row = /** @class */ (function (_super) {
|
|
|
136
137
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
137
138
|
}
|
|
138
139
|
Row.prototype.render = function () {
|
|
139
|
-
var _a = this.props, item = _a.item, disabled = _a.disabled, editing = _a.editing, onClick = _a.onClick, className = _a
|
|
140
|
+
var _a = this.props, item = _a.item, disabled = _a.disabled, editing = _a.editing, onClick = _a.onClick, className = _a[__className], columns = _a.columns, setEditing = _a.setEditing, cancelEditing = _a.cancelEditing, onFinishEditing = _a.onFinishEditing, handleInputChange = _a.handleInputChange, setValue = _a.setValue;
|
|
140
141
|
return jsxRuntime_2("tr", __extends({ onClick: function (e) { return onClick(item); }, [__className]: classNames(disabled && disabled(item) && 'disabled', className && (isFunction(className) ? className(item) : className)) }, { [__children]: columns.filter(function (it) { return !!it; }).map(function (column, i) {
|
|
141
142
|
var isEditing = editing && editing.columnIndex === i;
|
|
142
143
|
var editable = isFunction(column.editable) ? column.editable(item) : !!column.editable;
|
|
143
|
-
return (jsxRuntime_1("td", __extends({ [__className]: classNames(editable ? 'editable' : 'ro', isEditing && 'editing', column
|
|
144
|
+
return (jsxRuntime_1("td", __extends({ [__className]: classNames(editable ? 'editable' : 'ro', isEditing && 'editing', column[__className]), onClick: !isEditing && editable ? function () { return setEditing(item, i, column.field); } : NOOP }, { [__children]: [(isEditing || column.displayEditor) && !column.editor && (jsxRuntime_2(TextField, { value: column.preEditor ? column.preEditor(editing[__value]) : editing[__value], focused: true, onBlur: cancelEditing, onChange: handleInputChange, onKeyDown: function (e) {
|
|
144
145
|
if (e.keyCode === 27 /*escape*/) {
|
|
145
146
|
preventDefault(e);
|
|
146
147
|
cancelEditing();
|
|
@@ -149,7 +150,7 @@ var Row = /** @class */ (function (_super) {
|
|
|
149
150
|
preventDefault(e);
|
|
150
151
|
onFinishEditing();
|
|
151
152
|
}
|
|
152
|
-
} })), (isEditing || column.displayEditor) && column.editor === editorSelect && (jsxRuntime_2(AutocompleteSelect, { value: column.preEditor ? column.preEditor(editing
|
|
153
|
+
} })), (isEditing || column.displayEditor) && column.editor === editorSelect && (jsxRuntime_2(AutocompleteSelect, { value: column.preEditor ? column.preEditor(editing[__value]) : editing[__value], data: column.editorData, focused: true, withArrow: false, withFilter: false, selectedMode: 'inline', selectedComponent: column.editorSelectedComponent, mode: column.multiSelect ? MODE_MULTIPLE_MINI : MODE_DEFAULT, onChange: column.multiSelect && (column.onSelect ? (function (value) { return setValue(column.onSelect(value)); }) : setValue), onSelect: !column.multiSelect && (column.onSelect ? (function (value) { return setValue(column.onSelect(value)); }) : setValue), childComponent: column.editorChildCompononRowClickent, onCancel: cancelEditing, prefilter: column.prefilter })), (isEditing || column.displayEditor) && column.editor === editorSwitch && (jsxRuntime_2(Switch, { onClick: function (e) {
|
|
153
154
|
stopPropagation(e);
|
|
154
155
|
preventDefault(e);
|
|
155
156
|
setValue(!item[column.field]);
|
package/TextField.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, assertThisInitialized as _assertThisInitialized, slicedToArray as _slicedToArray, createClass as _createClass } from './_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import {clientHeight as __clientHeight, clientWidth as __clientWidth, getBoundingClientRect as __getBoundingClientRect, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, scrollLeft as __scrollLeft, scrollTop as __scrollTop, style as __style, top as __top, value as __value, width as __width} from "./CommonFields";
|
|
2
3
|
import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
|
|
3
4
|
import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
|
|
4
5
|
import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
|
@@ -31,14 +32,14 @@ var TextField = function (_PureComponent) {
|
|
|
31
32
|
var _props2 = props(),
|
|
32
33
|
required = _props2.required,
|
|
33
34
|
check = _props2.check;
|
|
34
|
-
var value = inputRef()
|
|
35
|
+
var value = inputRef()[__value];
|
|
35
36
|
var error = required && value === '' || check && check(value);
|
|
36
37
|
errorState() !== error && setTimeout(errorState, 0, error);
|
|
37
38
|
return error;
|
|
38
39
|
};
|
|
39
40
|
var onChange = function onChange(e) {
|
|
40
41
|
orNoop(props().onChange)(e);
|
|
41
|
-
isWithValue(!!inputRef()
|
|
42
|
+
isWithValue(!!inputRef()[__value]);
|
|
42
43
|
check();
|
|
43
44
|
};
|
|
44
45
|
var onFocus = function onFocus() {
|
|
@@ -52,7 +53,7 @@ var TextField = function (_PureComponent) {
|
|
|
52
53
|
};
|
|
53
54
|
that[render] = function () {
|
|
54
55
|
var _props = props();
|
|
55
|
-
var value = _props
|
|
56
|
+
var value = _props[__value],
|
|
56
57
|
name = _props.name,
|
|
57
58
|
type = _props.type,
|
|
58
59
|
label = _props.label,
|
|
@@ -67,7 +68,7 @@ var TextField = function (_PureComponent) {
|
|
|
67
68
|
onMouseUp = _props.onMouseUp,
|
|
68
69
|
autoComplete = _props.autoComplete,
|
|
69
70
|
placeholder = _props.placeholder,
|
|
70
|
-
className = _props
|
|
71
|
+
className = _props[__className];
|
|
71
72
|
var id = _props.id || randomId;
|
|
72
73
|
var error = errorState();
|
|
73
74
|
return ReactCreateElement("div", {
|
|
@@ -109,12 +110,12 @@ var TextField = function (_PureComponent) {
|
|
|
109
110
|
focused = _props3.focused,
|
|
110
111
|
input = _props3.input,
|
|
111
112
|
i = inputRef();
|
|
112
|
-
isWithValue(!!i
|
|
113
|
+
isWithValue(!!i[__value]);
|
|
113
114
|
focused && i.focus();
|
|
114
115
|
orNoop(input)(i);
|
|
115
116
|
};
|
|
116
117
|
that[componentDidUpdate] = function () {
|
|
117
|
-
if (props()
|
|
118
|
+
if (props()[__value] !== inputRef()[__value]) check();
|
|
118
119
|
var _props4 = props(),
|
|
119
120
|
focused = _props4.focused,
|
|
120
121
|
i = inputRef();
|
package/Tools.js
CHANGED
|
@@ -3,11 +3,11 @@ var WINDOW = global;
|
|
|
3
3
|
var DOCUMENT = WINDOW.document;
|
|
4
4
|
function classNames() {
|
|
5
5
|
var classes = [];
|
|
6
|
-
for (var _i = 0; _i < arguments
|
|
6
|
+
for (var _i = 0; _i < arguments[__length]; _i++) {
|
|
7
7
|
classes[_i] = arguments[_i];
|
|
8
8
|
}
|
|
9
9
|
var filtered = [];
|
|
10
|
-
var length = classes
|
|
10
|
+
var length = classes[__length];
|
|
11
11
|
for (var i = 0; i < length; i++) {
|
|
12
12
|
var it = classes[i];
|
|
13
13
|
!!it && filtered.push(it);
|
|
@@ -43,7 +43,7 @@ var allPropsExcept = function (obj, except) {
|
|
|
43
43
|
return result;
|
|
44
44
|
};
|
|
45
45
|
var continuousIncludes = function (value, inc) {
|
|
46
|
-
var length = inc
|
|
46
|
+
var length = inc[__length];
|
|
47
47
|
var from = -1;
|
|
48
48
|
for (var i = 0; i < length; i++) {
|
|
49
49
|
from = value.indexOf(inc[i], from + 1);
|
|
@@ -57,10 +57,10 @@ var isArrayShallowEqual = function (a, b) {
|
|
|
57
57
|
return true;
|
|
58
58
|
if (a == null || b == null)
|
|
59
59
|
return false;
|
|
60
|
-
if (a
|
|
60
|
+
if (a[__length] !== b[__length]) {
|
|
61
61
|
return false;
|
|
62
62
|
}
|
|
63
|
-
var i = a
|
|
63
|
+
var i = a[__length] - 1;
|
|
64
64
|
var result = true;
|
|
65
65
|
while (i >= 0 && (result = (a[i] === b[i]))) {
|
|
66
66
|
i--;
|
|
@@ -108,10 +108,10 @@ var isDifferent = function (a, b) {
|
|
|
108
108
|
return true;
|
|
109
109
|
}
|
|
110
110
|
if (Array.isArray(a)) {
|
|
111
|
-
if (a
|
|
111
|
+
if (a[__length] !== b[__length]) {
|
|
112
112
|
return true;
|
|
113
113
|
}
|
|
114
|
-
var i = a
|
|
114
|
+
var i = a[__length] - 1;
|
|
115
115
|
var result = false;
|
|
116
116
|
while (i >= 0 && !(result = isDifferent(a[i], b[i]))) {
|
|
117
117
|
i--;
|
|
@@ -121,10 +121,10 @@ var isDifferent = function (a, b) {
|
|
|
121
121
|
if (typeA === 'object') {
|
|
122
122
|
var keysA = Object.keys(a);
|
|
123
123
|
var keysB = Object.keys(b);
|
|
124
|
-
if (keysA
|
|
124
|
+
if (keysA[__length] !== keysB[__length]) {
|
|
125
125
|
return true;
|
|
126
126
|
}
|
|
127
|
-
var j = keysA
|
|
127
|
+
var j = keysA[__length] - 1;
|
|
128
128
|
var r = false;
|
|
129
129
|
while (j >= 0 && !(r = keysA[j] !== keysB[j]) && !(r = isDifferent(a[keysA[j]], b[keysB[j]]))) {
|
|
130
130
|
j--;
|
|
@@ -141,7 +141,7 @@ var stopPropagation = function (e) {
|
|
|
141
141
|
};
|
|
142
142
|
var setTimeout = function (callback, ms) {
|
|
143
143
|
var args = [];
|
|
144
|
-
for (var _i = 2; _i < arguments
|
|
144
|
+
for (var _i = 2; _i < arguments[__length]; _i++) {
|
|
145
145
|
args[_i - 2] = arguments[_i];
|
|
146
146
|
}
|
|
147
147
|
return WINDOW.setTimeout.apply(WINDOW, arguments);
|
|
@@ -151,7 +151,7 @@ var clearTimeout = function (id) {
|
|
|
151
151
|
};
|
|
152
152
|
var setInterval = function (callback, ms) {
|
|
153
153
|
var args = [];
|
|
154
|
-
for (var _i = 2; _i < arguments
|
|
154
|
+
for (var _i = 2; _i < arguments[__length]; _i++) {
|
|
155
155
|
args[_i - 2] = arguments[_i];
|
|
156
156
|
}
|
|
157
157
|
return WINDOW.setInterval.apply(WINDOW, arguments);
|
|
@@ -204,7 +204,7 @@ var Comparators = /** @class */ (function () {
|
|
|
204
204
|
};
|
|
205
205
|
Comparators.chain = function (comparators) { return addComparatorMethods(function (a, b) {
|
|
206
206
|
var result;
|
|
207
|
-
for (var i = 0; i < comparators
|
|
207
|
+
for (var i = 0; i < comparators[__length]; i++) {
|
|
208
208
|
result = comparators[i](a, b);
|
|
209
209
|
if (result !== 0)
|
|
210
210
|
return result;
|