react-ui-basics 0.0.168 → 0.0.171
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/AutocompleteSelect.js +11 -2
- package/Button.css +1 -0
- package/FilteredList.js +3 -1
- package/TextField.js +7 -2
- package/Tools.d.ts +2 -1
- package/Tools.js +32 -38
- package/bundle.css +882 -881
- package/package.json +1 -1
- package/store/ProxyTools.js +1 -1
- package/store/ProxyTools.js.map +1 -1
package/AutocompleteSelect.js
CHANGED
|
@@ -10,7 +10,7 @@ import ReactCreateElement from './ReactCreateElement.js';
|
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import TextField from './TextField.js';
|
|
12
12
|
import FilteredList, { getLabel } from './FilteredList.js';
|
|
13
|
-
import { isString, memo, continuousIncludes, orNoop, preventDefault, stopPropagation, getRandomId,
|
|
13
|
+
import { isString, memo, continuousIncludes, orNoop, isFunction, preventDefault, stopPropagation, getRandomId, isObject, addEventListener, DOCUMENT, removeEventListener, UNDEFINED, classNames, ref } from './Tools.js';
|
|
14
14
|
import Button from './Button.js';
|
|
15
15
|
import MaterialIcon from './MaterialIcon.js';
|
|
16
16
|
import { PureComponent } from './ReactConstants.js';
|
|
@@ -115,6 +115,8 @@ var AutocompleteSelect = function (_PureComponent) {
|
|
|
115
115
|
var _this$state = __state(_this),
|
|
116
116
|
filterValue = _this$state.filterValue,
|
|
117
117
|
currentSelection = _this$state.selected;
|
|
118
|
+
var _this$props$labels = __props(_this).labels,
|
|
119
|
+
labels = _this$props$labels === void 0 ? {} : _this$props$labels;
|
|
118
120
|
if (selectedId == null && (!!filterValue || !required) && allowCustom && (!_this.input || !_this.input.check())) selectedId = filterValue.trim();
|
|
119
121
|
var isMultiSelect = isMultipleSelect(mode);
|
|
120
122
|
if (!selectedId && isMultiSelect) {
|
|
@@ -132,10 +134,17 @@ var AutocompleteSelect = function (_PureComponent) {
|
|
|
132
134
|
}
|
|
133
135
|
var errored = required && Object.keys(selected) === 0;
|
|
134
136
|
var isActive = mode === MODE_MULTIPLE_MINI_INLINE || isMultiSelect && isSelected;
|
|
137
|
+
var customValue = '';
|
|
138
|
+
if (allowCustom && selectedId) {
|
|
139
|
+
var label;
|
|
140
|
+
if (isFunction(labels)) label = labels(selectedId);else label = labels[selectedId];
|
|
141
|
+
if (label && isString(label)) customValue = label;
|
|
142
|
+
}
|
|
143
|
+
var filterValueWithCustom = isMultiSelect ? '' : customValue;
|
|
135
144
|
_this.setState({
|
|
136
145
|
isActive: isActive,
|
|
137
146
|
selected: selected,
|
|
138
|
-
filterValue:
|
|
147
|
+
filterValue: filterValueWithCustom,
|
|
139
148
|
errored: errored
|
|
140
149
|
});
|
|
141
150
|
if (isActive && _this.input) _this.input.getInput().focus();
|
package/Button.css
CHANGED
package/FilteredList.js
CHANGED
|
@@ -137,7 +137,9 @@ var ItemWrapper = /** @class */ (function (_super) {
|
|
|
137
137
|
ItemWrapper.prototype[ReactConstants[3]] = function () {
|
|
138
138
|
var _this = this;
|
|
139
139
|
var _a = __props(this), id = _a.id, label = _a.label, onClick = _a[ReactConstants[6]], onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, classProvider = _a.classProvider, className = _a[ReactConstants[5]], childComponent = _a.childComponent, childProps = _a.childProps;
|
|
140
|
-
var child = React.createElement(childComponent, __extends(__extends({}, childProps), { id: id, label: label, dataConsumer: function (data) {
|
|
140
|
+
var child = React.createElement(childComponent, __extends(__extends({}, childProps), { id: id, label: label, dataConsumer: function (data) {
|
|
141
|
+
_this.data = data;
|
|
142
|
+
} }));
|
|
141
143
|
var cssClass = orNoop(classProvider)(__data(this));
|
|
142
144
|
return (jsxRuntime_2("div", __extends({ [ReactConstants[5]]: classNames('ItemWrapper', cssClass, className), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave,
|
|
143
145
|
// onMouseDown={onMouseDown}
|
package/TextField.js
CHANGED
|
@@ -7,7 +7,7 @@ import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
|
|
|
7
7
|
import './TextField.css';
|
|
8
8
|
import 'react';
|
|
9
9
|
import ReactCreateElement from './ReactCreateElement.js';
|
|
10
|
-
import { classNames, isUndefined, orNoop, addEventListener, getRandomId, createRef
|
|
10
|
+
import { classNames, isUndefined, setTimeout, orNoop, addEventListener, getRandomId, createRef } from './Tools.js';
|
|
11
11
|
import { stateGSs, render, componentDidMount, componentDidUpdate, propsGetter, PureComponent } from './ReactConstants.js';
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
13
|
|
|
@@ -110,7 +110,12 @@ var TextField = function (_PureComponent) {
|
|
|
110
110
|
focused = _props3.focused,
|
|
111
111
|
input = _props3.input,
|
|
112
112
|
i = inputRef();
|
|
113
|
-
|
|
113
|
+
var hasValue = !!__value(i);
|
|
114
|
+
isWithValue(hasValue);
|
|
115
|
+
!hasValue && setTimeout(function () {
|
|
116
|
+
var matches = i.matches(':-internal-autofill-selected');
|
|
117
|
+
matches && isWithValue(matches);
|
|
118
|
+
}, 100);
|
|
114
119
|
focused && i.focus();
|
|
115
120
|
orNoop(input)(i);
|
|
116
121
|
};
|
package/Tools.d.ts
CHANGED
|
@@ -12,11 +12,12 @@ export declare const allPropsExcept: (obj: any, except: any) => {};
|
|
|
12
12
|
export declare const continuousIncludes: (value: any, inc: any) => boolean;
|
|
13
13
|
export declare const debounce: (func: any, delay: any) => () => void;
|
|
14
14
|
export declare const memo: (func: any) => () => any;
|
|
15
|
+
export declare const constructorOf: (v: any) => any;
|
|
15
16
|
export declare const typeOf: (v: any) => "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
16
17
|
export declare const isFunction: (v: any) => boolean;
|
|
17
18
|
export declare const isString: (v: any) => boolean;
|
|
18
19
|
export declare const isObject: (v: any) => boolean;
|
|
19
|
-
export declare const isDifferent: (a: any, b: any) =>
|
|
20
|
+
export declare const isDifferent: (a: any, b: any) => boolean;
|
|
20
21
|
export declare const preventDefault: (e: any) => void;
|
|
21
22
|
export declare const stopPropagation: (e: any) => void;
|
|
22
23
|
export declare const setTimeout: (callback: (...args: any[]) => void, ms?: number, ...args: any[]) => any;
|
package/Tools.js
CHANGED
|
@@ -36,7 +36,7 @@ var createAccessor = function (field) { return function (o, value) {
|
|
|
36
36
|
return !o ? null : value != UNDEFINED ? o[field] = value : o[field];
|
|
37
37
|
}; };
|
|
38
38
|
var setOf = function (list) { return (list || []).reduce(function (map, key) {
|
|
39
|
-
map[key] =
|
|
39
|
+
map[key] = TRUE;
|
|
40
40
|
return map;
|
|
41
41
|
}, {}); };
|
|
42
42
|
var allPropsExcept = function (obj, except) {
|
|
@@ -53,20 +53,19 @@ var continuousIncludes = function (value, inc) {
|
|
|
53
53
|
for (var i = 0; i < length; i++) {
|
|
54
54
|
from = value.indexOf(inc[i], from + 1);
|
|
55
55
|
if (from === -1)
|
|
56
|
-
return
|
|
56
|
+
return FALSE;
|
|
57
57
|
}
|
|
58
|
-
return
|
|
58
|
+
return TRUE;
|
|
59
59
|
};
|
|
60
60
|
var isArrayShallowEqual = function (a, b) {
|
|
61
61
|
if (a === b)
|
|
62
|
-
return
|
|
62
|
+
return TRUE;
|
|
63
63
|
if (a == null || b == null)
|
|
64
|
-
return
|
|
65
|
-
if (__length(a) !== __length(b))
|
|
66
|
-
return
|
|
67
|
-
}
|
|
64
|
+
return FALSE;
|
|
65
|
+
if (__length(a) !== __length(b))
|
|
66
|
+
return FALSE;
|
|
68
67
|
var i = __length(a) - 1;
|
|
69
|
-
var result =
|
|
68
|
+
var result = TRUE;
|
|
70
69
|
while (i >= 0 && (result = (a[i] === b[i]))) {
|
|
71
70
|
i--;
|
|
72
71
|
}
|
|
@@ -96,47 +95,42 @@ var memo = function (func) {
|
|
|
96
95
|
return prevResult;
|
|
97
96
|
};
|
|
98
97
|
};
|
|
98
|
+
var constructorOf = function (v) { return v && v.constructor; };
|
|
99
99
|
var typeOf = function (v) { return typeof v; };
|
|
100
100
|
var isFunction = function (v) { return typeOf(v) === 'function'; };
|
|
101
101
|
var isString = function (v) { return typeOf(v) === 'string'; };
|
|
102
102
|
var isObject = function (v) { return typeOf(v) === 'object'; };
|
|
103
|
+
var FALSE = false;
|
|
104
|
+
var TRUE = true;
|
|
103
105
|
var isDifferent = function (a, b) {
|
|
104
|
-
if (a
|
|
105
|
-
return
|
|
106
|
-
if (a
|
|
107
|
-
return
|
|
106
|
+
if (a === null && b === null)
|
|
107
|
+
return FALSE;
|
|
108
|
+
if (a === null || b === null)
|
|
109
|
+
return TRUE;
|
|
108
110
|
if (a === b)
|
|
109
|
-
return
|
|
110
|
-
var
|
|
111
|
-
var
|
|
112
|
-
if (
|
|
113
|
-
return
|
|
111
|
+
return FALSE;
|
|
112
|
+
var constructorA = constructorOf(a);
|
|
113
|
+
var constructorB = constructorOf(b);
|
|
114
|
+
if (constructorA !== constructorB) {
|
|
115
|
+
return TRUE;
|
|
114
116
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
var result = false;
|
|
121
|
-
while (i >= 0 && !(result = isDifferent(a[i], b[i]))) {
|
|
122
|
-
i--;
|
|
117
|
+
var i;
|
|
118
|
+
if (constructorA === Array) {
|
|
119
|
+
if ((i = __length(a)) === __length(b)) {
|
|
120
|
+
while (i-- && !isDifferent(a[i], b[i])) {
|
|
121
|
+
}
|
|
123
122
|
}
|
|
124
|
-
return result;
|
|
125
123
|
}
|
|
126
|
-
if (
|
|
124
|
+
else if (constructorA === Object) {
|
|
127
125
|
var keysA = Object.keys(a);
|
|
128
126
|
var keysB = Object.keys(b);
|
|
129
|
-
if (__length(keysA)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
var r = false;
|
|
134
|
-
while (j >= 0 && !(r = keysA[j] !== keysB[j]) && !(r = isDifferent(a[keysA[j]], b[keysB[j]]))) {
|
|
135
|
-
j--;
|
|
127
|
+
if ((i = __length(keysA)) === __length(keysB)) {
|
|
128
|
+
var key = void 0;
|
|
129
|
+
while (i-- && ((key = keysA[i]) in b) && !isDifferent(a[key], b[key])) {
|
|
130
|
+
}
|
|
136
131
|
}
|
|
137
|
-
return r;
|
|
138
132
|
}
|
|
139
|
-
return
|
|
133
|
+
return i !== -1;
|
|
140
134
|
};
|
|
141
135
|
var preventDefault = function (e) {
|
|
142
136
|
e && e.preventDefault();
|
|
@@ -232,5 +226,5 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
232
226
|
};
|
|
233
227
|
}
|
|
234
228
|
|
|
235
|
-
export { Comparators, DOCUMENT, NOOP, UNDEFINED, WINDOW, addEventListener, allPropsExcept, classNames, clearInterval, clearTimeout, continuousIncludes, createAccessor, createRef, debounce, getRandomId, isDifferent, isFunction, isObject, isString, isUndefined, memo, orNoop, preventDefault, ref, removeEventListener, requestAnimationFrame, setInterval, setOf, setTimeout, stopPropagation, typeOf };
|
|
229
|
+
export { Comparators, DOCUMENT, NOOP, UNDEFINED, WINDOW, addEventListener, allPropsExcept, classNames, clearInterval, clearTimeout, constructorOf, continuousIncludes, createAccessor, createRef, debounce, getRandomId, isDifferent, isFunction, isObject, isString, isUndefined, memo, orNoop, preventDefault, ref, removeEventListener, requestAnimationFrame, setInterval, setOf, setTimeout, stopPropagation, typeOf };
|
|
236
230
|
//# sourceMappingURL=Tools.js.map
|