@rolster/react-components 18.15.1 → 18.15.3
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/dist/cjs/assets/{index-xOmRdBnF.css → index-VCzqT0sQ.css} +27 -11
- package/dist/cjs/index.js +1759 -1574
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-xOmRdBnF.css → index-VCzqT0sQ.css} +27 -11
- package/dist/es/index.js +1641 -1456
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/CheckBox/CheckBox.js +2 -2
- package/dist/esm/components/atoms/CheckBox/CheckBox.js.map +1 -1
- package/dist/esm/components/atoms/Input/Input.js +4 -4
- package/dist/esm/components/atoms/InputMoney/InputMoney.js +2 -2
- package/dist/esm/components/atoms/InputMoney/InputMoney.js.map +1 -1
- package/dist/esm/components/atoms/InputNumber/InputNumber.js +2 -2
- package/dist/esm/components/atoms/InputPassword/InputPassword.js +1 -1
- package/dist/esm/components/atoms/InputText/InputText.js +2 -2
- package/dist/esm/components/atoms/InputText/InputText.js.map +1 -1
- package/dist/esm/components/atoms/SkeletonText/SkeletonText.css +6 -1
- package/dist/esm/components/atoms/Switch/Switch.js +2 -2
- package/dist/esm/components/molecules/Ballot/Ballot.css +6 -0
- package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.js +4 -4
- package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js +4 -4
- package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.js +4 -4
- package/dist/esm/components/molecules/Pagination/Pagination.d.ts +7 -19
- package/dist/esm/components/molecules/Pagination/Pagination.js +42 -198
- package/dist/esm/components/molecules/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.css +5 -3
- package/dist/esm/components/molecules/PickerDay/PickerDay.js +6 -6
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js +4 -4
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js +6 -6
- package/dist/esm/components/molecules/PickerMonthTitle/PickerMonthTitle.css +1 -1
- package/dist/esm/components/molecules/PickerMonthTitle/PickerMonthTitle.js +16 -16
- package/dist/esm/components/molecules/PickerYear/PickerYear.css +8 -3
- package/dist/esm/components/molecules/PickerYear/PickerYear.js +6 -6
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.d.ts +5 -5
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +14 -14
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.js +6 -6
- package/dist/esm/components/organisms/FieldDate/FieldDate.d.ts +3 -2
- package/dist/esm/components/organisms/FieldDate/FieldDate.js +15 -14
- package/dist/esm/components/organisms/FieldDate/FieldDate.js.map +1 -1
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js +2 -2
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.d.ts +4 -4
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js +9 -9
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelectHook.js +4 -4
- package/dist/esm/components/organisms/PickerDate/PickerDate.css +1 -3
- package/dist/esm/components/organisms/PickerDate/PickerDate.js +23 -23
- package/dist/esm/components/organisms/PickerDate/PickerDate.js.map +1 -1
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js +13 -13
- package/dist/esm/hooks/ListControlHook.d.ts +1 -1
- package/dist/esm/hooks/ListControlHook.js +23 -23
- package/dist/esm/hooks/ListControlHook.js.map +1 -1
- package/package.json +14 -16
package/dist/cjs/index.js
CHANGED
|
@@ -1,57 +1,1361 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var require$$0 = require('react');
|
|
4
|
+
var commons = require('@rolster/commons');
|
|
5
|
+
var components = require('@rolster/components');
|
|
6
|
+
var dates = require('@rolster/dates');
|
|
7
7
|
var ReactDOM = require('react-dom');
|
|
8
|
-
require('
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
8
|
+
var i18n = require('@rolster/i18n');
|
|
9
|
+
var reactForms = require('@rolster/react-forms');
|
|
10
|
+
|
|
11
|
+
var jsxRuntime = {exports: {}};
|
|
12
|
+
|
|
13
|
+
var reactJsxRuntime_production_min = {};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @license React
|
|
17
|
+
* react-jsx-runtime.production.min.js
|
|
18
|
+
*
|
|
19
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
20
|
+
*
|
|
21
|
+
* This source code is licensed under the MIT license found in the
|
|
22
|
+
* LICENSE file in the root directory of this source tree.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var hasRequiredReactJsxRuntime_production_min;
|
|
26
|
+
|
|
27
|
+
function requireReactJsxRuntime_production_min () {
|
|
28
|
+
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
29
|
+
hasRequiredReactJsxRuntime_production_min = 1;
|
|
30
|
+
var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
|
|
31
|
+
function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
|
|
32
|
+
return reactJsxRuntime_production_min;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var reactJsxRuntime_development = {};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @license React
|
|
39
|
+
* react-jsx-runtime.development.js
|
|
40
|
+
*
|
|
41
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
42
|
+
*
|
|
43
|
+
* This source code is licensed under the MIT license found in the
|
|
44
|
+
* LICENSE file in the root directory of this source tree.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
var hasRequiredReactJsxRuntime_development;
|
|
48
|
+
|
|
49
|
+
function requireReactJsxRuntime_development () {
|
|
50
|
+
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
51
|
+
hasRequiredReactJsxRuntime_development = 1;
|
|
52
|
+
|
|
53
|
+
if (process.env.NODE_ENV !== "production") {
|
|
54
|
+
(function() {
|
|
55
|
+
|
|
56
|
+
var React = require$$0;
|
|
57
|
+
|
|
58
|
+
// ATTENTION
|
|
59
|
+
// When adding new symbols to this file,
|
|
60
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
61
|
+
// The Symbol used to tag the ReactElement-like types.
|
|
62
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
63
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
64
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
65
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
66
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
67
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
68
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
69
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
70
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
71
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
72
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
73
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
74
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
75
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
76
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
77
|
+
function getIteratorFn(maybeIterable) {
|
|
78
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
83
|
+
|
|
84
|
+
if (typeof maybeIterator === 'function') {
|
|
85
|
+
return maybeIterator;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
92
|
+
|
|
93
|
+
function error(format) {
|
|
94
|
+
{
|
|
95
|
+
{
|
|
96
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
97
|
+
args[_key2 - 1] = arguments[_key2];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
printWarning('error', format, args);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function printWarning(level, format, args) {
|
|
106
|
+
// When changing this logic, you might want to also
|
|
107
|
+
// update consoleWithStackDev.www.js as well.
|
|
108
|
+
{
|
|
109
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
110
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
111
|
+
|
|
112
|
+
if (stack !== '') {
|
|
113
|
+
format += '%s';
|
|
114
|
+
args = args.concat([stack]);
|
|
115
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
var argsWithFormat = args.map(function (item) {
|
|
119
|
+
return String(item);
|
|
120
|
+
}); // Careful: RN currently depends on this prefix
|
|
121
|
+
|
|
122
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
123
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
124
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
125
|
+
|
|
126
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// -----------------------------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
133
|
+
var enableCacheElement = false;
|
|
134
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
135
|
+
|
|
136
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
137
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
138
|
+
// issues in DEV builds.
|
|
139
|
+
|
|
140
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
141
|
+
|
|
142
|
+
var REACT_MODULE_REFERENCE;
|
|
143
|
+
|
|
144
|
+
{
|
|
145
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function isValidElementType(type) {
|
|
149
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
150
|
+
return true;
|
|
151
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (typeof type === 'object' && type !== null) {
|
|
159
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
160
|
+
// types supported by any Flight configuration anywhere since
|
|
161
|
+
// we don't know which Flight build this will end up being used
|
|
162
|
+
// with.
|
|
163
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
172
|
+
var displayName = outerType.displayName;
|
|
173
|
+
|
|
174
|
+
if (displayName) {
|
|
175
|
+
return displayName;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
179
|
+
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
180
|
+
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
function getContextName(type) {
|
|
184
|
+
return type.displayName || 'Context';
|
|
185
|
+
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
function getComponentNameFromType(type) {
|
|
189
|
+
if (type == null) {
|
|
190
|
+
// Host root, text node or just invalid type.
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
{
|
|
195
|
+
if (typeof type.tag === 'number') {
|
|
196
|
+
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (typeof type === 'function') {
|
|
201
|
+
return type.displayName || type.name || null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (typeof type === 'string') {
|
|
205
|
+
return type;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
switch (type) {
|
|
209
|
+
case REACT_FRAGMENT_TYPE:
|
|
210
|
+
return 'Fragment';
|
|
211
|
+
|
|
212
|
+
case REACT_PORTAL_TYPE:
|
|
213
|
+
return 'Portal';
|
|
214
|
+
|
|
215
|
+
case REACT_PROFILER_TYPE:
|
|
216
|
+
return 'Profiler';
|
|
217
|
+
|
|
218
|
+
case REACT_STRICT_MODE_TYPE:
|
|
219
|
+
return 'StrictMode';
|
|
220
|
+
|
|
221
|
+
case REACT_SUSPENSE_TYPE:
|
|
222
|
+
return 'Suspense';
|
|
223
|
+
|
|
224
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
225
|
+
return 'SuspenseList';
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (typeof type === 'object') {
|
|
230
|
+
switch (type.$$typeof) {
|
|
231
|
+
case REACT_CONTEXT_TYPE:
|
|
232
|
+
var context = type;
|
|
233
|
+
return getContextName(context) + '.Consumer';
|
|
234
|
+
|
|
235
|
+
case REACT_PROVIDER_TYPE:
|
|
236
|
+
var provider = type;
|
|
237
|
+
return getContextName(provider._context) + '.Provider';
|
|
238
|
+
|
|
239
|
+
case REACT_FORWARD_REF_TYPE:
|
|
240
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
241
|
+
|
|
242
|
+
case REACT_MEMO_TYPE:
|
|
243
|
+
var outerName = type.displayName || null;
|
|
244
|
+
|
|
245
|
+
if (outerName !== null) {
|
|
246
|
+
return outerName;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return getComponentNameFromType(type.type) || 'Memo';
|
|
250
|
+
|
|
251
|
+
case REACT_LAZY_TYPE:
|
|
252
|
+
{
|
|
253
|
+
var lazyComponent = type;
|
|
254
|
+
var payload = lazyComponent._payload;
|
|
255
|
+
var init = lazyComponent._init;
|
|
256
|
+
|
|
257
|
+
try {
|
|
258
|
+
return getComponentNameFromType(init(payload));
|
|
259
|
+
} catch (x) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// eslint-disable-next-line no-fallthrough
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
var assign = Object.assign;
|
|
272
|
+
|
|
273
|
+
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
274
|
+
// replaying on render function. This currently only patches the object
|
|
275
|
+
// lazily which won't cover if the log function was extracted eagerly.
|
|
276
|
+
// We could also eagerly patch the method.
|
|
277
|
+
var disabledDepth = 0;
|
|
278
|
+
var prevLog;
|
|
279
|
+
var prevInfo;
|
|
280
|
+
var prevWarn;
|
|
281
|
+
var prevError;
|
|
282
|
+
var prevGroup;
|
|
283
|
+
var prevGroupCollapsed;
|
|
284
|
+
var prevGroupEnd;
|
|
285
|
+
|
|
286
|
+
function disabledLog() {}
|
|
287
|
+
|
|
288
|
+
disabledLog.__reactDisabledLog = true;
|
|
289
|
+
function disableLogs() {
|
|
290
|
+
{
|
|
291
|
+
if (disabledDepth === 0) {
|
|
292
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
293
|
+
prevLog = console.log;
|
|
294
|
+
prevInfo = console.info;
|
|
295
|
+
prevWarn = console.warn;
|
|
296
|
+
prevError = console.error;
|
|
297
|
+
prevGroup = console.group;
|
|
298
|
+
prevGroupCollapsed = console.groupCollapsed;
|
|
299
|
+
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
300
|
+
|
|
301
|
+
var props = {
|
|
302
|
+
configurable: true,
|
|
303
|
+
enumerable: true,
|
|
304
|
+
value: disabledLog,
|
|
305
|
+
writable: true
|
|
306
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
307
|
+
|
|
308
|
+
Object.defineProperties(console, {
|
|
309
|
+
info: props,
|
|
310
|
+
log: props,
|
|
311
|
+
warn: props,
|
|
312
|
+
error: props,
|
|
313
|
+
group: props,
|
|
314
|
+
groupCollapsed: props,
|
|
315
|
+
groupEnd: props
|
|
316
|
+
});
|
|
317
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
disabledDepth++;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
function reenableLogs() {
|
|
324
|
+
{
|
|
325
|
+
disabledDepth--;
|
|
326
|
+
|
|
327
|
+
if (disabledDepth === 0) {
|
|
328
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
329
|
+
var props = {
|
|
330
|
+
configurable: true,
|
|
331
|
+
enumerable: true,
|
|
332
|
+
writable: true
|
|
333
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
334
|
+
|
|
335
|
+
Object.defineProperties(console, {
|
|
336
|
+
log: assign({}, props, {
|
|
337
|
+
value: prevLog
|
|
338
|
+
}),
|
|
339
|
+
info: assign({}, props, {
|
|
340
|
+
value: prevInfo
|
|
341
|
+
}),
|
|
342
|
+
warn: assign({}, props, {
|
|
343
|
+
value: prevWarn
|
|
344
|
+
}),
|
|
345
|
+
error: assign({}, props, {
|
|
346
|
+
value: prevError
|
|
347
|
+
}),
|
|
348
|
+
group: assign({}, props, {
|
|
349
|
+
value: prevGroup
|
|
350
|
+
}),
|
|
351
|
+
groupCollapsed: assign({}, props, {
|
|
352
|
+
value: prevGroupCollapsed
|
|
353
|
+
}),
|
|
354
|
+
groupEnd: assign({}, props, {
|
|
355
|
+
value: prevGroupEnd
|
|
356
|
+
})
|
|
357
|
+
});
|
|
358
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (disabledDepth < 0) {
|
|
362
|
+
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
368
|
+
var prefix;
|
|
369
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
370
|
+
{
|
|
371
|
+
if (prefix === undefined) {
|
|
372
|
+
// Extract the VM specific prefix used by each line.
|
|
373
|
+
try {
|
|
374
|
+
throw Error();
|
|
375
|
+
} catch (x) {
|
|
376
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
377
|
+
prefix = match && match[1] || '';
|
|
378
|
+
}
|
|
379
|
+
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
return '\n' + prefix + name;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
var reentry = false;
|
|
386
|
+
var componentFrameCache;
|
|
387
|
+
|
|
388
|
+
{
|
|
389
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
390
|
+
componentFrameCache = new PossiblyWeakMap();
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function describeNativeComponentFrame(fn, construct) {
|
|
394
|
+
// If something asked for a stack inside a fake render, it should get ignored.
|
|
395
|
+
if ( !fn || reentry) {
|
|
396
|
+
return '';
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
{
|
|
400
|
+
var frame = componentFrameCache.get(fn);
|
|
401
|
+
|
|
402
|
+
if (frame !== undefined) {
|
|
403
|
+
return frame;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
var control;
|
|
408
|
+
reentry = true;
|
|
409
|
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
410
|
+
|
|
411
|
+
Error.prepareStackTrace = undefined;
|
|
412
|
+
var previousDispatcher;
|
|
413
|
+
|
|
414
|
+
{
|
|
415
|
+
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
416
|
+
// for warnings.
|
|
417
|
+
|
|
418
|
+
ReactCurrentDispatcher.current = null;
|
|
419
|
+
disableLogs();
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
try {
|
|
423
|
+
// This should throw.
|
|
424
|
+
if (construct) {
|
|
425
|
+
// Something should be setting the props in the constructor.
|
|
426
|
+
var Fake = function () {
|
|
427
|
+
throw Error();
|
|
428
|
+
}; // $FlowFixMe
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
Object.defineProperty(Fake.prototype, 'props', {
|
|
432
|
+
set: function () {
|
|
433
|
+
// We use a throwing setter instead of frozen or non-writable props
|
|
434
|
+
// because that won't throw in a non-strict mode function.
|
|
435
|
+
throw Error();
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
440
|
+
// We construct a different control for this case to include any extra
|
|
441
|
+
// frames added by the construct call.
|
|
442
|
+
try {
|
|
443
|
+
Reflect.construct(Fake, []);
|
|
444
|
+
} catch (x) {
|
|
445
|
+
control = x;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
Reflect.construct(fn, [], Fake);
|
|
449
|
+
} else {
|
|
450
|
+
try {
|
|
451
|
+
Fake.call();
|
|
452
|
+
} catch (x) {
|
|
453
|
+
control = x;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
fn.call(Fake.prototype);
|
|
457
|
+
}
|
|
458
|
+
} else {
|
|
459
|
+
try {
|
|
460
|
+
throw Error();
|
|
461
|
+
} catch (x) {
|
|
462
|
+
control = x;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
fn();
|
|
466
|
+
}
|
|
467
|
+
} catch (sample) {
|
|
468
|
+
// This is inlined manually because closure doesn't do it for us.
|
|
469
|
+
if (sample && control && typeof sample.stack === 'string') {
|
|
470
|
+
// This extracts the first frame from the sample that isn't also in the control.
|
|
471
|
+
// Skipping one frame that we assume is the frame that calls the two.
|
|
472
|
+
var sampleLines = sample.stack.split('\n');
|
|
473
|
+
var controlLines = control.stack.split('\n');
|
|
474
|
+
var s = sampleLines.length - 1;
|
|
475
|
+
var c = controlLines.length - 1;
|
|
476
|
+
|
|
477
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
478
|
+
// We expect at least one stack frame to be shared.
|
|
479
|
+
// Typically this will be the root most one. However, stack frames may be
|
|
480
|
+
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
481
|
+
// earlier than the other. We assume that the sample is longer or the same
|
|
482
|
+
// and there for cut off earlier. So we should find the root most frame in
|
|
483
|
+
// the sample somewhere in the control.
|
|
484
|
+
c--;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
|
488
|
+
// Next we find the first one that isn't the same which should be the
|
|
489
|
+
// frame that called our sample function and the control.
|
|
490
|
+
if (sampleLines[s] !== controlLines[c]) {
|
|
491
|
+
// In V8, the first line is describing the message but other VMs don't.
|
|
492
|
+
// If we're about to return the first line, and the control is also on the same
|
|
493
|
+
// line, that's a pretty good indicator that our sample threw at same line as
|
|
494
|
+
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
495
|
+
// This can happen if you passed a class to function component, or non-function.
|
|
496
|
+
if (s !== 1 || c !== 1) {
|
|
497
|
+
do {
|
|
498
|
+
s--;
|
|
499
|
+
c--; // We may still have similar intermediate frames from the construct call.
|
|
500
|
+
// The next one that isn't the same should be our match though.
|
|
501
|
+
|
|
502
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
503
|
+
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
504
|
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
505
|
+
// but we have a user-provided "displayName"
|
|
506
|
+
// splice it in to make the stack more readable.
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
510
|
+
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
{
|
|
514
|
+
if (typeof fn === 'function') {
|
|
515
|
+
componentFrameCache.set(fn, _frame);
|
|
516
|
+
}
|
|
517
|
+
} // Return the line we found.
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
return _frame;
|
|
521
|
+
}
|
|
522
|
+
} while (s >= 1 && c >= 0);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
break;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
} finally {
|
|
530
|
+
reentry = false;
|
|
531
|
+
|
|
532
|
+
{
|
|
533
|
+
ReactCurrentDispatcher.current = previousDispatcher;
|
|
534
|
+
reenableLogs();
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
538
|
+
} // Fallback to just using the name if we couldn't make it throw.
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
var name = fn ? fn.displayName || fn.name : '';
|
|
542
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
543
|
+
|
|
544
|
+
{
|
|
545
|
+
if (typeof fn === 'function') {
|
|
546
|
+
componentFrameCache.set(fn, syntheticFrame);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
return syntheticFrame;
|
|
551
|
+
}
|
|
552
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
553
|
+
{
|
|
554
|
+
return describeNativeComponentFrame(fn, false);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function shouldConstruct(Component) {
|
|
559
|
+
var prototype = Component.prototype;
|
|
560
|
+
return !!(prototype && prototype.isReactComponent);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
564
|
+
|
|
565
|
+
if (type == null) {
|
|
566
|
+
return '';
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (typeof type === 'function') {
|
|
570
|
+
{
|
|
571
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
if (typeof type === 'string') {
|
|
576
|
+
return describeBuiltInComponentFrame(type);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
switch (type) {
|
|
580
|
+
case REACT_SUSPENSE_TYPE:
|
|
581
|
+
return describeBuiltInComponentFrame('Suspense');
|
|
582
|
+
|
|
583
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
584
|
+
return describeBuiltInComponentFrame('SuspenseList');
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
if (typeof type === 'object') {
|
|
588
|
+
switch (type.$$typeof) {
|
|
589
|
+
case REACT_FORWARD_REF_TYPE:
|
|
590
|
+
return describeFunctionComponentFrame(type.render);
|
|
591
|
+
|
|
592
|
+
case REACT_MEMO_TYPE:
|
|
593
|
+
// Memo may contain any component type so we recursively resolve it.
|
|
594
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
595
|
+
|
|
596
|
+
case REACT_LAZY_TYPE:
|
|
597
|
+
{
|
|
598
|
+
var lazyComponent = type;
|
|
599
|
+
var payload = lazyComponent._payload;
|
|
600
|
+
var init = lazyComponent._init;
|
|
601
|
+
|
|
602
|
+
try {
|
|
603
|
+
// Lazy may contain any component type so we recursively resolve it.
|
|
604
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
605
|
+
} catch (x) {}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
return '';
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
614
|
+
|
|
615
|
+
var loggedTypeFailures = {};
|
|
616
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
617
|
+
|
|
618
|
+
function setCurrentlyValidatingElement(element) {
|
|
619
|
+
{
|
|
620
|
+
if (element) {
|
|
621
|
+
var owner = element._owner;
|
|
622
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
623
|
+
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
624
|
+
} else {
|
|
625
|
+
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
631
|
+
{
|
|
632
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
633
|
+
var has = Function.call.bind(hasOwnProperty);
|
|
634
|
+
|
|
635
|
+
for (var typeSpecName in typeSpecs) {
|
|
636
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
637
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
638
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
639
|
+
// After these have been cleaned up, we'll let them throw.
|
|
640
|
+
|
|
641
|
+
try {
|
|
642
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
643
|
+
// behavior as without this statement except with a better message.
|
|
644
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
645
|
+
// eslint-disable-next-line react-internal/prod-error-codes
|
|
646
|
+
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
|
647
|
+
err.name = 'Invariant Violation';
|
|
648
|
+
throw err;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
652
|
+
} catch (ex) {
|
|
653
|
+
error$1 = ex;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
657
|
+
setCurrentlyValidatingElement(element);
|
|
658
|
+
|
|
659
|
+
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
|
660
|
+
|
|
661
|
+
setCurrentlyValidatingElement(null);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
665
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
666
|
+
// same error.
|
|
667
|
+
loggedTypeFailures[error$1.message] = true;
|
|
668
|
+
setCurrentlyValidatingElement(element);
|
|
669
|
+
|
|
670
|
+
error('Failed %s type: %s', location, error$1.message);
|
|
671
|
+
|
|
672
|
+
setCurrentlyValidatingElement(null);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
680
|
+
|
|
681
|
+
function isArray(a) {
|
|
682
|
+
return isArrayImpl(a);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/*
|
|
686
|
+
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
687
|
+
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
688
|
+
*
|
|
689
|
+
* The functions in this module will throw an easier-to-understand,
|
|
690
|
+
* easier-to-debug exception with a clear errors message message explaining the
|
|
691
|
+
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
692
|
+
* of the `value` object).
|
|
693
|
+
*/
|
|
694
|
+
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
695
|
+
function typeName(value) {
|
|
696
|
+
{
|
|
697
|
+
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
698
|
+
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
699
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
700
|
+
return type;
|
|
701
|
+
}
|
|
702
|
+
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
function willCoercionThrow(value) {
|
|
706
|
+
{
|
|
707
|
+
try {
|
|
708
|
+
testStringCoercion(value);
|
|
709
|
+
return false;
|
|
710
|
+
} catch (e) {
|
|
711
|
+
return true;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
function testStringCoercion(value) {
|
|
717
|
+
// If you ended up here by following an exception call stack, here's what's
|
|
718
|
+
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
719
|
+
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
720
|
+
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
721
|
+
//
|
|
722
|
+
// The most common types that will cause this exception are `Symbol` instances
|
|
723
|
+
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
724
|
+
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
725
|
+
// exception. (Library authors do this to prevent users from using built-in
|
|
726
|
+
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
727
|
+
// methods are needed to perform accurate arithmetic or comparison.)
|
|
728
|
+
//
|
|
729
|
+
// To fix the problem, coerce this object or symbol value to a string before
|
|
730
|
+
// passing it to React. The most reliable way is usually `String(value)`.
|
|
731
|
+
//
|
|
732
|
+
// To find which value is throwing, check the browser or debugger console.
|
|
733
|
+
// Before this exception was thrown, there should be `console.error` output
|
|
734
|
+
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
735
|
+
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
736
|
+
// In most cases, this console output also shows the component and its
|
|
737
|
+
// ancestor components where the exception happened.
|
|
738
|
+
//
|
|
739
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
740
|
+
return '' + value;
|
|
741
|
+
}
|
|
742
|
+
function checkKeyStringCoercion(value) {
|
|
743
|
+
{
|
|
744
|
+
if (willCoercionThrow(value)) {
|
|
745
|
+
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
746
|
+
|
|
747
|
+
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
753
|
+
var RESERVED_PROPS = {
|
|
754
|
+
key: true,
|
|
755
|
+
ref: true,
|
|
756
|
+
__self: true,
|
|
757
|
+
__source: true
|
|
758
|
+
};
|
|
759
|
+
var specialPropKeyWarningShown;
|
|
760
|
+
var specialPropRefWarningShown;
|
|
761
|
+
var didWarnAboutStringRefs;
|
|
762
|
+
|
|
763
|
+
{
|
|
764
|
+
didWarnAboutStringRefs = {};
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
function hasValidRef(config) {
|
|
768
|
+
{
|
|
769
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
770
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
771
|
+
|
|
772
|
+
if (getter && getter.isReactWarning) {
|
|
773
|
+
return false;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
return config.ref !== undefined;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
function hasValidKey(config) {
|
|
782
|
+
{
|
|
783
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
784
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
785
|
+
|
|
786
|
+
if (getter && getter.isReactWarning) {
|
|
787
|
+
return false;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
return config.key !== undefined;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
796
|
+
{
|
|
797
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
798
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
799
|
+
|
|
800
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
801
|
+
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
|
802
|
+
|
|
803
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
810
|
+
{
|
|
811
|
+
var warnAboutAccessingKey = function () {
|
|
812
|
+
if (!specialPropKeyWarningShown) {
|
|
813
|
+
specialPropKeyWarningShown = true;
|
|
814
|
+
|
|
815
|
+
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
820
|
+
Object.defineProperty(props, 'key', {
|
|
821
|
+
get: warnAboutAccessingKey,
|
|
822
|
+
configurable: true
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
828
|
+
{
|
|
829
|
+
var warnAboutAccessingRef = function () {
|
|
830
|
+
if (!specialPropRefWarningShown) {
|
|
831
|
+
specialPropRefWarningShown = true;
|
|
832
|
+
|
|
833
|
+
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
838
|
+
Object.defineProperty(props, 'ref', {
|
|
839
|
+
get: warnAboutAccessingRef,
|
|
840
|
+
configurable: true
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
846
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
847
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
848
|
+
* if something is a React Element.
|
|
849
|
+
*
|
|
850
|
+
* @param {*} type
|
|
851
|
+
* @param {*} props
|
|
852
|
+
* @param {*} key
|
|
853
|
+
* @param {string|object} ref
|
|
854
|
+
* @param {*} owner
|
|
855
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
856
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
857
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
858
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
859
|
+
* change in behavior.
|
|
860
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
861
|
+
* indicating filename, line number, and/or other information.
|
|
862
|
+
* @internal
|
|
863
|
+
*/
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
867
|
+
var element = {
|
|
868
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
869
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
870
|
+
// Built-in properties that belong on the element
|
|
871
|
+
type: type,
|
|
872
|
+
key: key,
|
|
873
|
+
ref: ref,
|
|
874
|
+
props: props,
|
|
875
|
+
// Record the component responsible for creating this element.
|
|
876
|
+
_owner: owner
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
{
|
|
880
|
+
// The validation flag is currently mutative. We put it on
|
|
881
|
+
// an external backing store so that we can freeze the whole object.
|
|
882
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
883
|
+
// commonly used development environments.
|
|
884
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
885
|
+
// the validation flag non-enumerable (where possible, which should
|
|
886
|
+
// include every environment we run tests in), so the test framework
|
|
887
|
+
// ignores it.
|
|
888
|
+
|
|
889
|
+
Object.defineProperty(element._store, 'validated', {
|
|
890
|
+
configurable: false,
|
|
891
|
+
enumerable: false,
|
|
892
|
+
writable: true,
|
|
893
|
+
value: false
|
|
894
|
+
}); // self and source are DEV only properties.
|
|
895
|
+
|
|
896
|
+
Object.defineProperty(element, '_self', {
|
|
897
|
+
configurable: false,
|
|
898
|
+
enumerable: false,
|
|
899
|
+
writable: false,
|
|
900
|
+
value: self
|
|
901
|
+
}); // Two elements created in two different places should be considered
|
|
902
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
903
|
+
|
|
904
|
+
Object.defineProperty(element, '_source', {
|
|
905
|
+
configurable: false,
|
|
906
|
+
enumerable: false,
|
|
907
|
+
writable: false,
|
|
908
|
+
value: source
|
|
909
|
+
});
|
|
910
|
+
|
|
911
|
+
if (Object.freeze) {
|
|
912
|
+
Object.freeze(element.props);
|
|
913
|
+
Object.freeze(element);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
return element;
|
|
918
|
+
};
|
|
919
|
+
/**
|
|
920
|
+
* https://github.com/reactjs/rfcs/pull/107
|
|
921
|
+
* @param {*} type
|
|
922
|
+
* @param {object} props
|
|
923
|
+
* @param {string} key
|
|
924
|
+
*/
|
|
925
|
+
|
|
926
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
|
927
|
+
{
|
|
928
|
+
var propName; // Reserved names are extracted
|
|
929
|
+
|
|
930
|
+
var props = {};
|
|
931
|
+
var key = null;
|
|
932
|
+
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
933
|
+
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
934
|
+
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
935
|
+
// but as an intermediary step, we will use jsxDEV for everything except
|
|
936
|
+
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
937
|
+
// key is explicitly declared to be undefined or not.
|
|
938
|
+
|
|
939
|
+
if (maybeKey !== undefined) {
|
|
940
|
+
{
|
|
941
|
+
checkKeyStringCoercion(maybeKey);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
key = '' + maybeKey;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
if (hasValidKey(config)) {
|
|
948
|
+
{
|
|
949
|
+
checkKeyStringCoercion(config.key);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
key = '' + config.key;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
if (hasValidRef(config)) {
|
|
956
|
+
ref = config.ref;
|
|
957
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
958
|
+
} // Remaining properties are added to a new props object
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
for (propName in config) {
|
|
962
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
963
|
+
props[propName] = config[propName];
|
|
964
|
+
}
|
|
965
|
+
} // Resolve default props
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
if (type && type.defaultProps) {
|
|
969
|
+
var defaultProps = type.defaultProps;
|
|
970
|
+
|
|
971
|
+
for (propName in defaultProps) {
|
|
972
|
+
if (props[propName] === undefined) {
|
|
973
|
+
props[propName] = defaultProps[propName];
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
if (key || ref) {
|
|
979
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
980
|
+
|
|
981
|
+
if (key) {
|
|
982
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
if (ref) {
|
|
986
|
+
defineRefPropWarningGetter(props, displayName);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
995
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
996
|
+
|
|
997
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
998
|
+
{
|
|
999
|
+
if (element) {
|
|
1000
|
+
var owner = element._owner;
|
|
1001
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
1002
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
1003
|
+
} else {
|
|
1004
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
var propTypesMisspellWarningShown;
|
|
1010
|
+
|
|
1011
|
+
{
|
|
1012
|
+
propTypesMisspellWarningShown = false;
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Verifies the object is a ReactElement.
|
|
1016
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1017
|
+
* @param {?object} object
|
|
1018
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
1019
|
+
* @final
|
|
1020
|
+
*/
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
function isValidElement(object) {
|
|
1024
|
+
{
|
|
1025
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
function getDeclarationErrorAddendum() {
|
|
1030
|
+
{
|
|
1031
|
+
if (ReactCurrentOwner$1.current) {
|
|
1032
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
1033
|
+
|
|
1034
|
+
if (name) {
|
|
1035
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
return '';
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
function getSourceInfoErrorAddendum(source) {
|
|
1044
|
+
{
|
|
1045
|
+
|
|
1046
|
+
return '';
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1051
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
1052
|
+
* updates.
|
|
1053
|
+
*/
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
var ownerHasKeyUseWarning = {};
|
|
1057
|
+
|
|
1058
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
1059
|
+
{
|
|
1060
|
+
var info = getDeclarationErrorAddendum();
|
|
1061
|
+
|
|
1062
|
+
if (!info) {
|
|
1063
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1064
|
+
|
|
1065
|
+
if (parentName) {
|
|
1066
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
return info;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1075
|
+
* This element is in an array. The array could grow and shrink or be
|
|
1076
|
+
* reordered. All children that haven't already been validated are required to
|
|
1077
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1078
|
+
* will only be shown once.
|
|
1079
|
+
*
|
|
1080
|
+
* @internal
|
|
1081
|
+
* @param {ReactElement} element Element that requires a key.
|
|
1082
|
+
* @param {*} parentType element's parent's type.
|
|
1083
|
+
*/
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
function validateExplicitKey(element, parentType) {
|
|
1087
|
+
{
|
|
1088
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
element._store.validated = true;
|
|
1093
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1094
|
+
|
|
1095
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
1100
|
+
// property, it may be the creator of the child that's responsible for
|
|
1101
|
+
// assigning it a key.
|
|
1102
|
+
|
|
1103
|
+
var childOwner = '';
|
|
1104
|
+
|
|
1105
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
1106
|
+
// Give the component that originally created this child.
|
|
1107
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
setCurrentlyValidatingElement$1(element);
|
|
1111
|
+
|
|
1112
|
+
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1113
|
+
|
|
1114
|
+
setCurrentlyValidatingElement$1(null);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Ensure that every element either is passed in a static location, in an
|
|
1119
|
+
* array with an explicit keys property defined, or in an object literal
|
|
1120
|
+
* with valid key property.
|
|
1121
|
+
*
|
|
1122
|
+
* @internal
|
|
1123
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
1124
|
+
* @param {*} parentType node's parent's type.
|
|
1125
|
+
*/
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
function validateChildKeys(node, parentType) {
|
|
1129
|
+
{
|
|
1130
|
+
if (typeof node !== 'object') {
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
if (isArray(node)) {
|
|
1135
|
+
for (var i = 0; i < node.length; i++) {
|
|
1136
|
+
var child = node[i];
|
|
1137
|
+
|
|
1138
|
+
if (isValidElement(child)) {
|
|
1139
|
+
validateExplicitKey(child, parentType);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
} else if (isValidElement(node)) {
|
|
1143
|
+
// This element was passed in a valid location.
|
|
1144
|
+
if (node._store) {
|
|
1145
|
+
node._store.validated = true;
|
|
1146
|
+
}
|
|
1147
|
+
} else if (node) {
|
|
1148
|
+
var iteratorFn = getIteratorFn(node);
|
|
1149
|
+
|
|
1150
|
+
if (typeof iteratorFn === 'function') {
|
|
1151
|
+
// Entry iterators used to provide implicit keys,
|
|
1152
|
+
// but now we print a separate warning for them later.
|
|
1153
|
+
if (iteratorFn !== node.entries) {
|
|
1154
|
+
var iterator = iteratorFn.call(node);
|
|
1155
|
+
var step;
|
|
1156
|
+
|
|
1157
|
+
while (!(step = iterator.next()).done) {
|
|
1158
|
+
if (isValidElement(step.value)) {
|
|
1159
|
+
validateExplicitKey(step.value, parentType);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
1169
|
+
* provided by the type.
|
|
1170
|
+
*
|
|
1171
|
+
* @param {ReactElement} element
|
|
1172
|
+
*/
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
function validatePropTypes(element) {
|
|
1176
|
+
{
|
|
1177
|
+
var type = element.type;
|
|
1178
|
+
|
|
1179
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
var propTypes;
|
|
1184
|
+
|
|
1185
|
+
if (typeof type === 'function') {
|
|
1186
|
+
propTypes = type.propTypes;
|
|
1187
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1188
|
+
// Inner props are checked in the reconciler.
|
|
1189
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1190
|
+
propTypes = type.propTypes;
|
|
1191
|
+
} else {
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
if (propTypes) {
|
|
1196
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
|
1197
|
+
var name = getComponentNameFromType(type);
|
|
1198
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
1199
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1200
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1201
|
+
|
|
1202
|
+
var _name = getComponentNameFromType(type);
|
|
1203
|
+
|
|
1204
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
1208
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
1214
|
+
* @param {ReactElement} fragment
|
|
1215
|
+
*/
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
function validateFragmentProps(fragment) {
|
|
1219
|
+
{
|
|
1220
|
+
var keys = Object.keys(fragment.props);
|
|
1221
|
+
|
|
1222
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1223
|
+
var key = keys[i];
|
|
1224
|
+
|
|
1225
|
+
if (key !== 'children' && key !== 'key') {
|
|
1226
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
1227
|
+
|
|
1228
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1229
|
+
|
|
1230
|
+
setCurrentlyValidatingElement$1(null);
|
|
1231
|
+
break;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
if (fragment.ref !== null) {
|
|
1236
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
1237
|
+
|
|
1238
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1239
|
+
|
|
1240
|
+
setCurrentlyValidatingElement$1(null);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1246
|
+
{
|
|
1247
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1248
|
+
// succeed and there will likely be errors in render.
|
|
1249
|
+
|
|
1250
|
+
if (!validType) {
|
|
1251
|
+
var info = '';
|
|
1252
|
+
|
|
1253
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1254
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
var sourceInfo = getSourceInfoErrorAddendum();
|
|
1258
|
+
|
|
1259
|
+
if (sourceInfo) {
|
|
1260
|
+
info += sourceInfo;
|
|
1261
|
+
} else {
|
|
1262
|
+
info += getDeclarationErrorAddendum();
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
var typeString;
|
|
1266
|
+
|
|
1267
|
+
if (type === null) {
|
|
1268
|
+
typeString = 'null';
|
|
1269
|
+
} else if (isArray(type)) {
|
|
1270
|
+
typeString = 'array';
|
|
1271
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1272
|
+
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
1273
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1274
|
+
} else {
|
|
1275
|
+
typeString = typeof type;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1282
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1283
|
+
|
|
1284
|
+
if (element == null) {
|
|
1285
|
+
return element;
|
|
1286
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1287
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1288
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
1289
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1290
|
+
// fixed, the key warnings will appear.)
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
if (validType) {
|
|
1294
|
+
var children = props.children;
|
|
1295
|
+
|
|
1296
|
+
if (children !== undefined) {
|
|
1297
|
+
if (isStaticChildren) {
|
|
1298
|
+
if (isArray(children)) {
|
|
1299
|
+
for (var i = 0; i < children.length; i++) {
|
|
1300
|
+
validateChildKeys(children[i], type);
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
if (Object.freeze) {
|
|
1304
|
+
Object.freeze(children);
|
|
1305
|
+
}
|
|
1306
|
+
} else {
|
|
1307
|
+
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
1308
|
+
}
|
|
1309
|
+
} else {
|
|
1310
|
+
validateChildKeys(children, type);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
1316
|
+
validateFragmentProps(element);
|
|
1317
|
+
} else {
|
|
1318
|
+
validatePropTypes(element);
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
return element;
|
|
1322
|
+
}
|
|
1323
|
+
} // These two functions exist to still get child warnings in dev
|
|
1324
|
+
// even with the prod transform. This means that jsxDEV is purely
|
|
1325
|
+
// opt-in behavior for better messages but that we won't stop
|
|
1326
|
+
// giving you warnings if you use production apis.
|
|
1327
|
+
|
|
1328
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
1329
|
+
{
|
|
1330
|
+
return jsxWithValidation(type, props, key, true);
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
1334
|
+
{
|
|
1335
|
+
return jsxWithValidation(type, props, key, false);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
1340
|
+
// for now we can ship identical prod functions
|
|
1341
|
+
|
|
1342
|
+
var jsxs = jsxWithValidationStatic ;
|
|
1343
|
+
|
|
1344
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
1345
|
+
reactJsxRuntime_development.jsx = jsx;
|
|
1346
|
+
reactJsxRuntime_development.jsxs = jsxs;
|
|
1347
|
+
})();
|
|
1348
|
+
}
|
|
1349
|
+
return reactJsxRuntime_development;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1353
|
+
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
1354
|
+
} else {
|
|
1355
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
var jsxRuntimeExports = jsxRuntime.exports;
|
|
55
1359
|
|
|
56
1360
|
const baseCls = 'rls-tabular-text';
|
|
57
1361
|
const pointers = ['.', ','];
|
|
@@ -59,11 +1363,11 @@ function charClass(char) {
|
|
|
59
1363
|
return pointers.includes(char) ? `${baseCls}__pointer` : `${baseCls}__char`;
|
|
60
1364
|
}
|
|
61
1365
|
function RlsTabularText({ value }) {
|
|
62
|
-
return (
|
|
1366
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-tabular-text", children: value?.split('').map((char, index) => (jsxRuntimeExports.jsx("span", { className: charClass(char), children: char }, index))) }));
|
|
63
1367
|
}
|
|
64
1368
|
|
|
65
1369
|
function RlsAmount({ value, decimals, rlsTheme, symbol }) {
|
|
66
|
-
return (
|
|
1370
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsxRuntimeExports.jsx("span", { children: symbol }), jsxRuntimeExports.jsx(RlsTabularText, { value: commons.currencyFormat({ value, decimals }) })] }));
|
|
67
1371
|
}
|
|
68
1372
|
|
|
69
1373
|
function renderClassStatus(base, status = {}, aditionals) {
|
|
@@ -82,45 +1386,45 @@ function renderClassStatus(base, status = {}, aditionals) {
|
|
|
82
1386
|
}
|
|
83
1387
|
|
|
84
1388
|
function RlsAvatar({ children, rounded, skeleton, rlsTheme }) {
|
|
85
|
-
return (
|
|
1389
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-avatar', { rounded, skeleton }), "rls-theme": rlsTheme, children: children }));
|
|
86
1390
|
}
|
|
87
1391
|
|
|
88
1392
|
function RlsBadge({ children, rlsTheme }) {
|
|
89
|
-
return (
|
|
1393
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-badge", "rls-theme": rlsTheme, children: children }));
|
|
90
1394
|
}
|
|
91
1395
|
|
|
92
1396
|
function RlsBreadcrumb({ labels }) {
|
|
93
|
-
return (
|
|
1397
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-breadcrumb", children: labels.map(({ label, onClick }, index) => (jsxRuntimeExports.jsx("label", { className: "rls-breadcrumb__label", onClick: onClick, children: jsxRuntimeExports.jsx("a", { className: "rls-breadcrumb__label__a", children: label }) }, index))) }));
|
|
94
1398
|
}
|
|
95
1399
|
|
|
96
1400
|
function RlsIcon({ value, skeleton }) {
|
|
97
|
-
return (
|
|
1401
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-icon', { skeleton }), children: jsxRuntimeExports.jsx("i", { className: `rls-icon-${value}` }) }));
|
|
98
1402
|
}
|
|
99
1403
|
|
|
100
1404
|
function RlsButton({ type, children, disabled, prefixIcon, suffixIcon, rlsTheme, onClick }) {
|
|
101
|
-
return (
|
|
1405
|
+
return (jsxRuntimeExports.jsx("button", { className: "rls-button", onClick: onClick, "rls-theme": rlsTheme, disabled: disabled, children: jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-button__content', { type }), children: [prefixIcon && jsxRuntimeExports.jsx(RlsIcon, { value: prefixIcon }), children && jsxRuntimeExports.jsx("div", { className: "rls-button__label", children: children }), suffixIcon && jsxRuntimeExports.jsx(RlsIcon, { value: suffixIcon })] }) }));
|
|
102
1406
|
}
|
|
103
1407
|
|
|
104
1408
|
function RlsButtonAction({ icon, disabled, tooltip, onClick }) {
|
|
105
|
-
return (
|
|
1409
|
+
return (jsxRuntimeExports.jsxs("button", { className: "rls-button-action", onClick: onClick, disabled: disabled, children: [jsxRuntimeExports.jsx("div", { className: "rls-button-action__content", children: jsxRuntimeExports.jsx(RlsIcon, { value: icon }) }), tooltip && (jsxRuntimeExports.jsx("div", { className: "rls-button-action__tooltip caption-semibold", children: jsxRuntimeExports.jsx("span", { children: tooltip }) }))] }));
|
|
106
1410
|
}
|
|
107
1411
|
|
|
108
1412
|
function RlsCheckBox({ checked, disabled, onClick, rlsTheme }) {
|
|
109
|
-
return (
|
|
1413
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-checkbox', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-checkbox__component" }) }));
|
|
110
1414
|
}
|
|
111
1415
|
function RlsCheckBoxControl({ formControl, disabled, rlsTheme }) {
|
|
112
|
-
return (
|
|
113
|
-
formControl.
|
|
1416
|
+
return (jsxRuntimeExports.jsx(RlsCheckBox, { checked: !!formControl.value, disabled: disabled, onClick: () => {
|
|
1417
|
+
formControl.setValue(!formControl.value);
|
|
114
1418
|
}, rlsTheme: rlsTheme }));
|
|
115
1419
|
}
|
|
116
1420
|
|
|
117
1421
|
function RlsInput({ children, disabled, formControl, placeholder, type, value, onValue }) {
|
|
118
|
-
const [focused, setFocused] =
|
|
1422
|
+
const [focused, setFocused] = require$$0.useState(false);
|
|
119
1423
|
function onChange(event) {
|
|
120
|
-
|
|
1424
|
+
setValue(type === 'number' ? +event.target.value : event.target.value);
|
|
121
1425
|
}
|
|
122
|
-
function
|
|
123
|
-
formControl?.
|
|
1426
|
+
function setValue(value) {
|
|
1427
|
+
formControl?.setValue(value);
|
|
124
1428
|
if (onValue) {
|
|
125
1429
|
onValue(value);
|
|
126
1430
|
}
|
|
@@ -133,15 +1437,15 @@ function RlsInput({ children, disabled, formControl, placeholder, type, value, o
|
|
|
133
1437
|
formControl?.blur();
|
|
134
1438
|
setFocused(false);
|
|
135
1439
|
}
|
|
136
|
-
return (
|
|
1440
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-input', {
|
|
137
1441
|
focused: formControl?.focused || focused,
|
|
138
1442
|
disabled: formControl?.disabled || disabled
|
|
139
|
-
}), children: [
|
|
1443
|
+
}), children: [jsxRuntimeExports.jsx("input", { ref: formControl?.elementRef, className: "rls-input__component", autoComplete: "off", type: type || 'text', placeholder: placeholder, disabled: formControl?.disabled || disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange, value: formControl?.value || value || '' }), jsxRuntimeExports.jsx("span", { className: "rls-input__value", children: children })] }));
|
|
140
1444
|
}
|
|
141
1445
|
|
|
142
1446
|
function RlsInputMoney({ decimals, disabled, formControl, placeholder, symbol, value, onValue }) {
|
|
143
|
-
const [valueInput, setValueInput] =
|
|
144
|
-
function
|
|
1447
|
+
const [valueInput, setValueInput] = require$$0.useState(value || 0);
|
|
1448
|
+
function onChange(value) {
|
|
145
1449
|
if (!formControl) {
|
|
146
1450
|
setValueInput(value);
|
|
147
1451
|
}
|
|
@@ -149,12 +1453,12 @@ function RlsInputMoney({ decimals, disabled, formControl, placeholder, symbol, v
|
|
|
149
1453
|
onValue(value);
|
|
150
1454
|
}
|
|
151
1455
|
}
|
|
152
|
-
return (
|
|
1456
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-input-money", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: jsxRuntimeExports.jsx(RlsAmount, { value: formControl?.value || value || valueInput, symbol: symbol, decimals: decimals }) }) }));
|
|
153
1457
|
}
|
|
154
1458
|
|
|
155
1459
|
function RlsInputNumber({ disabled, formControl, placeholder, value, onValue }) {
|
|
156
|
-
const [valueInput, setValueInput] =
|
|
157
|
-
function
|
|
1460
|
+
const [valueInput, setValueInput] = require$$0.useState(value || 0);
|
|
1461
|
+
function onChange(value) {
|
|
158
1462
|
if (!formControl) {
|
|
159
1463
|
setValueInput(value);
|
|
160
1464
|
}
|
|
@@ -162,13 +1466,13 @@ function RlsInputNumber({ disabled, formControl, placeholder, value, onValue })
|
|
|
162
1466
|
onValue(value);
|
|
163
1467
|
}
|
|
164
1468
|
}
|
|
165
|
-
return (
|
|
1469
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-input-number", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: formControl?.value || value || valueInput }) }));
|
|
166
1470
|
}
|
|
167
1471
|
|
|
168
1472
|
function RlsInputPassword({ disabled, formControl, placeholder, type, onValue }) {
|
|
169
|
-
const [focused, setFocused] =
|
|
1473
|
+
const [focused, setFocused] = require$$0.useState(false);
|
|
170
1474
|
function onChange(event) {
|
|
171
|
-
formControl?.
|
|
1475
|
+
formControl?.setValue(event.target.value);
|
|
172
1476
|
if (onValue) {
|
|
173
1477
|
onValue(event.target.value);
|
|
174
1478
|
}
|
|
@@ -181,19 +1485,19 @@ function RlsInputPassword({ disabled, formControl, placeholder, type, onValue })
|
|
|
181
1485
|
formControl?.blur();
|
|
182
1486
|
setFocused(false);
|
|
183
1487
|
}
|
|
184
|
-
return (
|
|
1488
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-input-password', {
|
|
185
1489
|
focused: formControl?.focused || focused,
|
|
186
1490
|
disabled
|
|
187
|
-
}), children:
|
|
1491
|
+
}), children: jsxRuntimeExports.jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type || 'password', placeholder: placeholder, disabled: disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange }) }));
|
|
188
1492
|
}
|
|
189
1493
|
|
|
190
1494
|
function RlsInputSearch({ formControl, placeholder, onSearch }) {
|
|
191
|
-
return (
|
|
1495
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-input-search", children: [jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, placeholder: placeholder }), onSearch && jsxRuntimeExports.jsx(RlsButtonAction, { icon: "search", onClick: onSearch })] }));
|
|
192
1496
|
}
|
|
193
1497
|
|
|
194
1498
|
function RlsInputText({ disabled, formControl, placeholder, value, onValue }) {
|
|
195
|
-
const [valueInput, setValueInput] =
|
|
196
|
-
function
|
|
1499
|
+
const [valueInput, setValueInput] = require$$0.useState(value || '');
|
|
1500
|
+
function onChange(value) {
|
|
197
1501
|
if (!formControl) {
|
|
198
1502
|
setValueInput(value);
|
|
199
1503
|
}
|
|
@@ -201,64 +1505,64 @@ function RlsInputText({ disabled, formControl, placeholder, value, onValue }) {
|
|
|
201
1505
|
onValue(value);
|
|
202
1506
|
}
|
|
203
1507
|
}
|
|
204
|
-
return (
|
|
1508
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-input-text", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "text", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: formControl?.value || value || valueInput }) }));
|
|
205
1509
|
}
|
|
206
1510
|
|
|
207
1511
|
function RlsLabel({ children, rlsTheme }) {
|
|
208
|
-
return (
|
|
1512
|
+
return (jsxRuntimeExports.jsx("label", { className: "rls-label", "rls-theme": rlsTheme, children: children }));
|
|
209
1513
|
}
|
|
210
1514
|
|
|
211
1515
|
function RlsMessageIcon({ icon, children, rlsTheme }) {
|
|
212
|
-
return (
|
|
1516
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-message-icon", "rls-theme": rlsTheme, children: [icon && jsxRuntimeExports.jsx(RlsIcon, { value: icon }), jsxRuntimeExports.jsx("span", { className: "truncate", children: children })] }));
|
|
213
1517
|
}
|
|
214
1518
|
|
|
215
1519
|
function RlsPoster({ children, rlsTheme }) {
|
|
216
|
-
return (
|
|
1520
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-poster", "rls-theme": rlsTheme, children: children }));
|
|
217
1521
|
}
|
|
218
1522
|
|
|
219
1523
|
function RlsProgressBar({ indeterminate, percentage, rlsTheme }) {
|
|
220
|
-
return (
|
|
1524
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-progress-bar', { indeterminate }), "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-progress-bar__component", style: { width: `${percentage || 0}%` } }) }));
|
|
221
1525
|
}
|
|
222
1526
|
|
|
223
1527
|
function RlsProgressCircular({ rlsTheme }) {
|
|
224
|
-
return (
|
|
1528
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-progress-circular", "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("svg", { className: "rls-progress-circular__svg", viewBox: "0 0 36 36", children: jsxRuntimeExports.jsx("circle", { className: "rls-progress-circular__circle", cx: "18", cy: "18", r: "12" }) }) }));
|
|
225
1529
|
}
|
|
226
1530
|
|
|
227
1531
|
function RlsRadioButton({ checked, disabled, rlsTheme, onClick }) {
|
|
228
|
-
return (
|
|
1532
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-radiobutton', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-radiobutton__component" }) }));
|
|
229
1533
|
}
|
|
230
1534
|
|
|
231
1535
|
function RlsSkeleton({ rlsTheme }) {
|
|
232
|
-
return
|
|
1536
|
+
return jsxRuntimeExports.jsx("div", { className: "rls-skeleton", "rls-theme": rlsTheme });
|
|
233
1537
|
}
|
|
234
1538
|
|
|
235
1539
|
function RlsSkeletonText({ active, children, rlsTheme }) {
|
|
236
|
-
return (
|
|
1540
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-skeleton-text", "rls-theme": rlsTheme, children: active ? (jsxRuntimeExports.jsx(RlsSkeleton, {})) : (jsxRuntimeExports.jsx("span", { className: "rls-skeleton-text__value", children: children })) }));
|
|
237
1541
|
}
|
|
238
1542
|
|
|
239
1543
|
function RlsSwitch({ checked, disabled, rlsTheme, onClick }) {
|
|
240
|
-
return (
|
|
1544
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-switch', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsxs("div", { className: "rls-switch__component", children: [jsxRuntimeExports.jsx("div", { className: "rls-switch__component__element" }), jsxRuntimeExports.jsx("div", { className: "rls-switch__component__bar" })] }) }));
|
|
241
1545
|
}
|
|
242
1546
|
function RlsSwitchControl({ formControl, disabled, rlsTheme }) {
|
|
243
|
-
return (
|
|
244
|
-
formControl.
|
|
1547
|
+
return (jsxRuntimeExports.jsx(RlsSwitch, { checked: formControl.value || false, disabled: disabled, onClick: () => {
|
|
1548
|
+
formControl.setValue(!formControl.value);
|
|
245
1549
|
}, rlsTheme: rlsTheme }));
|
|
246
1550
|
}
|
|
247
1551
|
|
|
248
1552
|
function RlsBallot({ bordered, children, img, initials, skeleton, subtitle, rlsTheme }) {
|
|
249
|
-
return (
|
|
1553
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-ballot', { bordered, skeleton }), "rls-theme": rlsTheme, children: [(img || initials) && (jsxRuntimeExports.jsxs(RlsAvatar, { skeleton: skeleton, children: [img && jsxRuntimeExports.jsx("img", { src: img }), initials && jsxRuntimeExports.jsx("span", { children: initials })] })), jsxRuntimeExports.jsxs("div", { className: "rls-ballot__component", children: [jsxRuntimeExports.jsx("label", { className: "rls-ballot__title", children: jsxRuntimeExports.jsx(RlsSkeletonText, { active: skeleton, children: children }) }), subtitle && (jsxRuntimeExports.jsx("label", { className: "rls-ballot__subtitle", children: jsxRuntimeExports.jsx(RlsSkeletonText, { active: skeleton, children: subtitle }) }))] })] }));
|
|
250
1554
|
}
|
|
251
1555
|
|
|
252
1556
|
function RlsButtonProgress({ icon, disabled, onClick, progressing, rlsTheme }) {
|
|
253
|
-
return (
|
|
1557
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-button-progress', { progressing }), "rls-theme": rlsTheme, children: [!progressing && (jsxRuntimeExports.jsx(RlsButtonAction, { icon: icon, onClick: onClick, disabled: disabled })), progressing && jsxRuntimeExports.jsx(RlsProgressCircular, {})] }));
|
|
254
1558
|
}
|
|
255
1559
|
|
|
256
1560
|
function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsTheme }) {
|
|
257
|
-
const componentRef =
|
|
1561
|
+
const componentRef = require$$0.useRef(null);
|
|
258
1562
|
const [firstAction] = options;
|
|
259
|
-
const [action, setAction] =
|
|
260
|
-
const [visible, setVisible] =
|
|
261
|
-
|
|
1563
|
+
const [action, setAction] = require$$0.useState(firstAction);
|
|
1564
|
+
const [visible, setVisible] = require$$0.useState(false);
|
|
1565
|
+
require$$0.useEffect(() => {
|
|
262
1566
|
function onCloseMenu({ target }) {
|
|
263
1567
|
if (!componentRef?.current?.contains(target)) {
|
|
264
1568
|
setVisible(false);
|
|
@@ -279,1209 +1583,187 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
279
1583
|
onAction(action.value);
|
|
280
1584
|
}
|
|
281
1585
|
}
|
|
282
|
-
return (
|
|
1586
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle", ref: componentRef, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__action", children: jsxRuntimeExports.jsx(RlsButton, { disabled: disabled, type: type, onClick: () => onAction(action.value), children: action.label }) })), jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__icon", children: jsxRuntimeExports.jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-button-toggle__list', {
|
|
283
1587
|
visible,
|
|
284
1588
|
hide: !visible
|
|
285
|
-
}), children:
|
|
1589
|
+
}), children: jsxRuntimeExports.jsx("ul", { children: options.map((action, index) => (jsxRuntimeExports.jsx("li", { className: "truncate", onClick: () => onSelectAction(action), children: action.label }, index))) }) })] }));
|
|
286
1590
|
}
|
|
287
1591
|
|
|
288
1592
|
function RlsMessageFormError({ className, formControl }) {
|
|
289
|
-
return (
|
|
1593
|
+
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: formControl?.wrong && (jsxRuntimeExports.jsx("div", { className: className, children: jsxRuntimeExports.jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl?.error?.message }) })) }));
|
|
290
1594
|
}
|
|
291
1595
|
|
|
292
1596
|
function RlsFieldMoney({ children, decimals, disabled, formControl, placeholder, symbol, rlsTheme, value, onValue }) {
|
|
293
|
-
return (
|
|
1597
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', {
|
|
294
1598
|
focused: formControl?.focused,
|
|
295
1599
|
error: formControl?.wrong,
|
|
296
1600
|
disabled: formControl?.disabled || disabled
|
|
297
|
-
}, 'rls-field-money'), "rls-theme": rlsTheme, children: [children &&
|
|
1601
|
+
}, 'rls-field-money'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputMoney, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, symbol: symbol, decimals: decimals, onValue: onValue }) }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
298
1602
|
}
|
|
299
1603
|
|
|
300
1604
|
function RlsFieldNumber({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
|
|
301
|
-
return (
|
|
1605
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', {
|
|
302
1606
|
focused: formControl?.focused,
|
|
303
1607
|
error: formControl?.wrong,
|
|
304
1608
|
disabled: formControl?.disabled || disabled
|
|
305
|
-
}, 'rls-field-number'), "rls-theme": rlsTheme, children: [children &&
|
|
1609
|
+
}, 'rls-field-number'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputNumber, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
306
1610
|
}
|
|
307
1611
|
|
|
308
1612
|
function RlsFieldPassword({ children, disabled, formControl, placeholder, rlsTheme }) {
|
|
309
|
-
const [password, setPassword] =
|
|
1613
|
+
const [password, setPassword] = require$$0.useState(true);
|
|
310
1614
|
function onToggleInput() {
|
|
311
1615
|
setPassword(!password);
|
|
312
1616
|
}
|
|
313
|
-
return (
|
|
1617
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus(' rls-field-box', {
|
|
314
1618
|
focused: formControl?.focused,
|
|
315
1619
|
error: formControl?.wrong,
|
|
316
1620
|
disabled: formControl?.disabled || disabled
|
|
317
|
-
}, 'rls-field-password'), "rls-theme": rlsTheme, children: [children &&
|
|
1621
|
+
}, 'rls-field-password'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx(RlsInputPassword, { formControl: formControl, disabled: disabled, placeholder: placeholder, type: password ? 'password' : 'text' }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: password ? 'eye' : 'eye-off', onClick: onToggleInput })] }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
318
1622
|
}
|
|
319
1623
|
|
|
320
1624
|
function RlsFieldText({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
|
|
321
|
-
return (
|
|
1625
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', {
|
|
322
1626
|
focused: formControl?.focused,
|
|
323
1627
|
error: formControl?.wrong,
|
|
324
1628
|
disabled: formControl?.disabled || disabled
|
|
325
|
-
}, 'rls-field-text'), "rls-theme": rlsTheme, children: [children &&
|
|
1629
|
+
}, 'rls-field-text'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputText, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
326
1630
|
}
|
|
327
1631
|
|
|
328
1632
|
function RlsLabelCheckBox({ children, disabled, extended, formControl, rlsTheme }) {
|
|
329
|
-
const [checked, setChecked] =
|
|
330
|
-
|
|
331
|
-
setChecked(!!formControl?.
|
|
332
|
-
}, [formControl?.
|
|
1633
|
+
const [checked, setChecked] = require$$0.useState(!!formControl?.value);
|
|
1634
|
+
require$$0.useEffect(() => {
|
|
1635
|
+
setChecked(!!formControl?.value);
|
|
1636
|
+
}, [formControl?.value]);
|
|
333
1637
|
function onToggle() {
|
|
334
1638
|
if (formControl) {
|
|
335
|
-
formControl?.
|
|
1639
|
+
formControl?.setValue(!formControl.value);
|
|
336
1640
|
}
|
|
337
1641
|
else {
|
|
338
1642
|
setChecked(!checked);
|
|
339
1643
|
}
|
|
340
1644
|
}
|
|
341
|
-
return (
|
|
1645
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-label-checkbox', {
|
|
342
1646
|
disabled,
|
|
343
1647
|
extended
|
|
344
|
-
}), "rls-theme": rlsTheme, children: [
|
|
1648
|
+
}), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-checkbox__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsCheckBox, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-checkbox__text", children: children })] }));
|
|
345
1649
|
}
|
|
346
1650
|
|
|
347
1651
|
function RlsLabelRadioButton({ children, disabled, extended, formControl, rlsTheme, value }) {
|
|
348
|
-
const [checked, setChecked] =
|
|
349
|
-
|
|
350
|
-
setChecked(formControl?.
|
|
351
|
-
}, [formControl?.
|
|
1652
|
+
const [checked, setChecked] = require$$0.useState(formControl?.value === value);
|
|
1653
|
+
require$$0.useEffect(() => {
|
|
1654
|
+
setChecked(formControl?.value === value);
|
|
1655
|
+
}, [formControl?.value]);
|
|
352
1656
|
function onSelect() {
|
|
353
1657
|
if (formControl) {
|
|
354
|
-
formControl?.
|
|
1658
|
+
formControl?.setValue(value);
|
|
355
1659
|
}
|
|
356
1660
|
}
|
|
357
|
-
return (
|
|
1661
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-label-radiobutton', {
|
|
358
1662
|
disabled,
|
|
359
1663
|
extended
|
|
360
|
-
}), "rls-theme": rlsTheme, children: [
|
|
1664
|
+
}), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-radiobutton__component", onClick: onSelect, children: jsxRuntimeExports.jsx(RlsRadioButton, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-radiobutton__text", children: children })] }));
|
|
361
1665
|
}
|
|
362
1666
|
|
|
363
1667
|
function RlsLabelSwitch({ children, disabled, extended, formControl, rlsTheme }) {
|
|
364
|
-
const [checked, setChecked] =
|
|
365
|
-
|
|
366
|
-
setChecked(!!formControl?.
|
|
367
|
-
}, [formControl?.
|
|
1668
|
+
const [checked, setChecked] = require$$0.useState(!!formControl?.value);
|
|
1669
|
+
require$$0.useEffect(() => {
|
|
1670
|
+
setChecked(!!formControl?.value);
|
|
1671
|
+
}, [formControl?.value]);
|
|
368
1672
|
function onToggle() {
|
|
369
1673
|
if (formControl) {
|
|
370
|
-
formControl?.
|
|
1674
|
+
formControl?.setValue(!formControl.value);
|
|
371
1675
|
}
|
|
372
1676
|
else {
|
|
373
1677
|
setChecked(!checked);
|
|
374
1678
|
}
|
|
375
1679
|
}
|
|
376
|
-
return (
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}, [
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
const isLastPage = currentPagination?.value === maxPage - 1;
|
|
399
|
-
setFirstPage(isFirstPage);
|
|
400
|
-
setLastPage(isLastPage);
|
|
401
|
-
if (onPagination) {
|
|
402
|
-
onPagination({ firstPage: isFirstPage, lastPage: isLastPage });
|
|
403
|
-
}
|
|
404
|
-
}, [currentPagination]);
|
|
405
|
-
react.useEffect(() => {
|
|
406
|
-
refreshFromFilter(filter);
|
|
1680
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-label-switch', { disabled, extended }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-switch__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsSwitch, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-switch__text", children: children })] }));
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
function RlsPagination({ suggestions, count, filter, onPagination }) {
|
|
1684
|
+
const controller = require$$0.useRef(new components.PaginationController({ suggestions, count }));
|
|
1685
|
+
const [template, setTemplate] = require$$0.useState(controller.current.template);
|
|
1686
|
+
require$$0.useEffect(() => {
|
|
1687
|
+
controller.current = new components.PaginationController({
|
|
1688
|
+
suggestions,
|
|
1689
|
+
count,
|
|
1690
|
+
position: template.currentPage.value
|
|
1691
|
+
});
|
|
1692
|
+
onPagination &&
|
|
1693
|
+
onPagination({
|
|
1694
|
+
firstPage: controller.current.template.firstPage,
|
|
1695
|
+
lastPage: controller.current.template.lastPage,
|
|
1696
|
+
suggestions: controller.current.page.collection
|
|
1697
|
+
});
|
|
1698
|
+
setTemplate(controller.current.template);
|
|
1699
|
+
}, [suggestions, count]);
|
|
1700
|
+
require$$0.useEffect(() => {
|
|
1701
|
+
refreshPagination(controller.current.filtrable(filter));
|
|
407
1702
|
}, [filter]);
|
|
408
|
-
function
|
|
409
|
-
if (
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
1703
|
+
function refreshPagination(pagination) {
|
|
1704
|
+
if (pagination) {
|
|
1705
|
+
const { page, template } = pagination;
|
|
1706
|
+
const { firstPage, lastPage } = template;
|
|
1707
|
+
onPagination &&
|
|
1708
|
+
onPagination({
|
|
1709
|
+
firstPage,
|
|
1710
|
+
lastPage,
|
|
1711
|
+
suggestions: page.collection
|
|
1712
|
+
});
|
|
1713
|
+
setTemplate(template);
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
function goToPagination(page) {
|
|
1717
|
+
refreshPagination(controller.current.goToPage(page));
|
|
415
1718
|
}
|
|
416
|
-
function
|
|
417
|
-
|
|
418
|
-
pagination.active = true;
|
|
419
|
-
setIndex(value);
|
|
420
|
-
setCurrentPagination(pagination);
|
|
421
|
-
refreshFromChanged(clonePage({ index: value }));
|
|
422
|
-
}
|
|
423
|
-
function goPagination(pagination) {
|
|
424
|
-
if (currentPagination) {
|
|
425
|
-
currentPagination.active = false;
|
|
426
|
-
}
|
|
427
|
-
onSelectPagination(pagination);
|
|
1719
|
+
function goFirstPagination() {
|
|
1720
|
+
refreshPagination(controller.current.goFirstPage());
|
|
428
1721
|
}
|
|
429
1722
|
function goPreviousPagination() {
|
|
430
|
-
|
|
431
|
-
const { prev, value } = currentPagination;
|
|
432
|
-
if (prev) {
|
|
433
|
-
onSelectPagination(prev);
|
|
434
|
-
currentPagination.active = false;
|
|
435
|
-
}
|
|
436
|
-
else {
|
|
437
|
-
const prevIndex = value - MIN_NUMBER_PAGE;
|
|
438
|
-
if (prevIndex >= FIRST_PAGE) {
|
|
439
|
-
refreshFromChanged(clonePageFromIndex(prevIndex));
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
function goFirstPagination() {
|
|
445
|
-
if (collection.length) {
|
|
446
|
-
refreshFromChanged(clonePageFromIndex(FIRST_PAGE));
|
|
447
|
-
}
|
|
1723
|
+
refreshPagination(controller.current.goPreviousPage());
|
|
448
1724
|
}
|
|
449
1725
|
function goNextPagination() {
|
|
450
|
-
|
|
451
|
-
const { next, value } = currentPagination;
|
|
452
|
-
if (next) {
|
|
453
|
-
onSelectPagination(next);
|
|
454
|
-
currentPagination.active = false;
|
|
455
|
-
}
|
|
456
|
-
else {
|
|
457
|
-
const nextIndex = value + 1;
|
|
458
|
-
if (nextIndex <= maxPage) {
|
|
459
|
-
refreshFromChanged(clonePageFromIndex(nextIndex));
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
1726
|
+
refreshPagination(controller.current.goNextPage());
|
|
463
1727
|
}
|
|
464
1728
|
function goLastPagination() {
|
|
465
|
-
|
|
466
|
-
refreshFromChanged(clonePageFromIndex(maxPage - MIN_NUMBER_PAGE));
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
function createPageCollection(props) {
|
|
470
|
-
const { collection, count, index } = props;
|
|
471
|
-
if (collection.length) {
|
|
472
|
-
const finish = (index + MIN_NUMBER_PAGE) * count;
|
|
473
|
-
const start = index * count;
|
|
474
|
-
return collection.slice(start, finish);
|
|
475
|
-
}
|
|
476
|
-
return [];
|
|
477
|
-
}
|
|
478
|
-
function refreshFromElements(elements) {
|
|
479
|
-
elements.length
|
|
480
|
-
? refreshFromChanged(refreshPage(elements, filter))
|
|
481
|
-
: rebootPagination();
|
|
482
|
-
}
|
|
483
|
-
function refreshFromFilter(filter) {
|
|
484
|
-
refreshFromChanged(refreshPage(elements, filter));
|
|
485
|
-
}
|
|
486
|
-
function refreshFromChanged(page) {
|
|
487
|
-
refreshPaginations(page);
|
|
488
|
-
refreshDescription(page);
|
|
489
|
-
onChangeElements(createPageCollection(page));
|
|
490
|
-
}
|
|
491
|
-
function refreshCollection(elements, filter) {
|
|
492
|
-
const collection = filter
|
|
493
|
-
? elements.filter((element) => helpersString.hasPattern(JSON.stringify(element), filter))
|
|
494
|
-
: elements;
|
|
495
|
-
setCollection(collection);
|
|
496
|
-
return collection;
|
|
497
|
-
}
|
|
498
|
-
function refreshMaxPage(collection, count) {
|
|
499
|
-
const maxPage = calculateMaxPage(collection, count);
|
|
500
|
-
setMaxPage(maxPage);
|
|
501
|
-
return maxPage;
|
|
502
|
-
}
|
|
503
|
-
function refreshIndex(collection, currentMaxPage) {
|
|
504
|
-
const maxPage = currentMaxPage || refreshMaxPage(collection, count);
|
|
505
|
-
if (index < maxPage || index === FIRST_PAGE) {
|
|
506
|
-
return index;
|
|
507
|
-
}
|
|
508
|
-
const newIndex = maxPage - 1;
|
|
509
|
-
setIndex(newIndex);
|
|
510
|
-
return newIndex;
|
|
511
|
-
}
|
|
512
|
-
function refreshDescription(page) {
|
|
513
|
-
const { collection, count, index } = page;
|
|
514
|
-
const totalCount = elements.length;
|
|
515
|
-
const start = index * count + MIN_NUMBER_PAGE;
|
|
516
|
-
let end = (index + MIN_NUMBER_PAGE) * count;
|
|
517
|
-
if (end > collection.length) {
|
|
518
|
-
end = collection.length;
|
|
519
|
-
}
|
|
520
|
-
setDescription(`${start} - ${end} de ${totalCount}`);
|
|
521
|
-
}
|
|
522
|
-
function refreshPaginations({ index, maxPage }) {
|
|
523
|
-
let maxPageVisible = index + DEFAULT_MAX_VISIBLE;
|
|
524
|
-
if (maxPageVisible > maxPage) {
|
|
525
|
-
maxPageVisible = maxPage;
|
|
526
|
-
}
|
|
527
|
-
let minIndexPage = maxPageVisible - DEFAULT_MAX_VISIBLE;
|
|
528
|
-
if (minIndexPage < 0) {
|
|
529
|
-
minIndexPage = 0;
|
|
530
|
-
}
|
|
531
|
-
if (minIndexPage > index) {
|
|
532
|
-
minIndexPage = index;
|
|
533
|
-
}
|
|
534
|
-
let prevPagination = undefined;
|
|
535
|
-
const paginations = [];
|
|
536
|
-
for (let i = minIndexPage; i < maxPageVisible; i++) {
|
|
537
|
-
const pagination = createPagination(i, index);
|
|
538
|
-
paginations.push(pagination);
|
|
539
|
-
pagination.prev = prevPagination;
|
|
540
|
-
if (prevPagination) {
|
|
541
|
-
prevPagination.next = pagination;
|
|
542
|
-
}
|
|
543
|
-
prevPagination = pagination;
|
|
544
|
-
}
|
|
545
|
-
setPaginations(paginations);
|
|
546
|
-
}
|
|
547
|
-
function clonePage(pagePartial) {
|
|
548
|
-
return {
|
|
549
|
-
collection: pagePartial.collection || collection,
|
|
550
|
-
index: typeof pagePartial.index === 'number' ? pagePartial.index : index,
|
|
551
|
-
count: pagePartial.count || count,
|
|
552
|
-
maxPage: typeof pagePartial.maxPage === 'number' ? pagePartial.maxPage : maxPage
|
|
553
|
-
};
|
|
1729
|
+
refreshPagination(controller.current.goLastPage());
|
|
554
1730
|
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
}
|
|
558
|
-
function refreshPage(elements, filter) {
|
|
559
|
-
const collection = refreshCollection(elements, filter);
|
|
560
|
-
const maxPage = refreshMaxPage(collection, count);
|
|
561
|
-
const index = refreshIndex(collection, maxPage);
|
|
562
|
-
return clonePage({ collection, index, maxPage });
|
|
563
|
-
}
|
|
564
|
-
function createPagination(value, index) {
|
|
565
|
-
const active = value === index;
|
|
566
|
-
const pagination = {
|
|
567
|
-
label: (value + 1).toString(),
|
|
568
|
-
value,
|
|
569
|
-
active
|
|
570
|
-
};
|
|
571
|
-
if (active) {
|
|
572
|
-
setCurrentPagination(pagination);
|
|
573
|
-
}
|
|
574
|
-
return pagination;
|
|
575
|
-
}
|
|
576
|
-
function rebootPagination() {
|
|
577
|
-
setCollection([]);
|
|
578
|
-
setMaxPage(0);
|
|
579
|
-
setIndex(0);
|
|
580
|
-
setPaginations([]);
|
|
581
|
-
onChangeElements([]);
|
|
582
|
-
}
|
|
583
|
-
return (jsxRuntime.jsxs("div", { className: "rls-pagination", children: [jsxRuntime.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntime.jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: firstPage, children: jsxRuntime.jsx(RlsIcon, { value: "arrowhead-left" }) }), jsxRuntime.jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: firstPage, children: jsxRuntime.jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsxRuntime.jsx("div", { className: "rls-pagination__pages", children: paginations.map((page, index) => {
|
|
584
|
-
return (jsxRuntime.jsx("div", { className: renderClassStatus('rls-pagination__page', {
|
|
1731
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-pagination", children: [jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: template.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-left" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: template.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__pages", children: template.pages.map((page, index) => {
|
|
1732
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-pagination__page', {
|
|
585
1733
|
active: page.active
|
|
586
1734
|
}), onClick: () => {
|
|
587
|
-
|
|
1735
|
+
goToPagination(page);
|
|
588
1736
|
}, children: page.label }, index));
|
|
589
|
-
}) }),
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
const dateI18n = i18n.i18n({
|
|
593
|
-
es: {
|
|
594
|
-
// Months
|
|
595
|
-
january: 'Enero',
|
|
596
|
-
february: 'Febrero',
|
|
597
|
-
march: 'Marzo',
|
|
598
|
-
april: 'Abril',
|
|
599
|
-
may: 'Mayo',
|
|
600
|
-
june: 'Junio',
|
|
601
|
-
july: 'Julio',
|
|
602
|
-
august: 'Agosto',
|
|
603
|
-
september: 'Septiembre',
|
|
604
|
-
october: 'Octubre',
|
|
605
|
-
november: 'Noviembre',
|
|
606
|
-
december: 'Diciembre',
|
|
607
|
-
// Days
|
|
608
|
-
monday: 'Lunes',
|
|
609
|
-
tuesday: 'Martes',
|
|
610
|
-
wednesday: 'Miércoles',
|
|
611
|
-
thursday: 'Jueves',
|
|
612
|
-
friday: 'Viernes',
|
|
613
|
-
saturday: 'Sábado',
|
|
614
|
-
sunday: 'Domingo',
|
|
615
|
-
// Timestamps
|
|
616
|
-
year: 'año',
|
|
617
|
-
month: 'mes',
|
|
618
|
-
week: 'semana',
|
|
619
|
-
day: 'día',
|
|
620
|
-
hour: 'hora',
|
|
621
|
-
minute: 'minuto',
|
|
622
|
-
second: 'segundo'
|
|
623
|
-
},
|
|
624
|
-
en: {
|
|
625
|
-
// Months
|
|
626
|
-
january: 'January',
|
|
627
|
-
february: 'February',
|
|
628
|
-
march: 'March',
|
|
629
|
-
april: 'April',
|
|
630
|
-
may: 'May',
|
|
631
|
-
june: 'June',
|
|
632
|
-
july: 'July',
|
|
633
|
-
august: 'August',
|
|
634
|
-
september: 'September',
|
|
635
|
-
october: 'October',
|
|
636
|
-
november: 'November',
|
|
637
|
-
december: 'December',
|
|
638
|
-
// Days
|
|
639
|
-
monday: 'Monday',
|
|
640
|
-
tuesday: 'Tuesday',
|
|
641
|
-
wednesday: 'Wednesday',
|
|
642
|
-
thursday: 'Thursday',
|
|
643
|
-
friday: 'Friday',
|
|
644
|
-
saturday: 'Saturday',
|
|
645
|
-
sunday: 'Sunday',
|
|
646
|
-
// Timestamps
|
|
647
|
-
year: 'year',
|
|
648
|
-
month: 'month',
|
|
649
|
-
week: 'week',
|
|
650
|
-
day: 'day',
|
|
651
|
-
hour: 'hour',
|
|
652
|
-
minute: 'minute',
|
|
653
|
-
second: 'second'
|
|
654
|
-
}
|
|
655
|
-
});
|
|
656
|
-
|
|
657
|
-
var Miliseconds;
|
|
658
|
-
(function (Miliseconds) {
|
|
659
|
-
Miliseconds[Miliseconds["Year"] = 31536000000] = "Year";
|
|
660
|
-
Miliseconds[Miliseconds["Month"] = 2592000000] = "Month";
|
|
661
|
-
Miliseconds[Miliseconds["Week"] = 604800000] = "Week";
|
|
662
|
-
Miliseconds[Miliseconds["Day"] = 86400000] = "Day";
|
|
663
|
-
Miliseconds[Miliseconds["Hour"] = 3600000] = "Hour";
|
|
664
|
-
Miliseconds[Miliseconds["Minute"] = 60000] = "Minute";
|
|
665
|
-
Miliseconds[Miliseconds["Second"] = 1000] = "Second";
|
|
666
|
-
})(Miliseconds || (Miliseconds = {}));
|
|
667
|
-
var Day;
|
|
668
|
-
(function (Day) {
|
|
669
|
-
Day[Day["Sunday"] = 0] = "Sunday";
|
|
670
|
-
Day[Day["Monday"] = 1] = "Monday";
|
|
671
|
-
Day[Day["Tuesday"] = 2] = "Tuesday";
|
|
672
|
-
Day[Day["Wednesday"] = 3] = "Wednesday";
|
|
673
|
-
Day[Day["Thursday"] = 4] = "Thursday";
|
|
674
|
-
Day[Day["Friday"] = 5] = "Friday";
|
|
675
|
-
Day[Day["Saturday"] = 6] = "Saturday";
|
|
676
|
-
})(Day || (Day = {}));
|
|
677
|
-
var Month;
|
|
678
|
-
(function (Month) {
|
|
679
|
-
Month[Month["January"] = 0] = "January";
|
|
680
|
-
Month[Month["February"] = 1] = "February";
|
|
681
|
-
Month[Month["March"] = 2] = "March";
|
|
682
|
-
Month[Month["April"] = 3] = "April";
|
|
683
|
-
Month[Month["May"] = 4] = "May";
|
|
684
|
-
Month[Month["June"] = 5] = "June";
|
|
685
|
-
Month[Month["July"] = 6] = "July";
|
|
686
|
-
Month[Month["August"] = 7] = "August";
|
|
687
|
-
Month[Month["September"] = 8] = "September";
|
|
688
|
-
Month[Month["October"] = 9] = "October";
|
|
689
|
-
Month[Month["November"] = 10] = "November";
|
|
690
|
-
Month[Month["December"] = 11] = "December";
|
|
691
|
-
})(Month || (Month = {}));
|
|
692
|
-
var MonthDay;
|
|
693
|
-
(function (MonthDay) {
|
|
694
|
-
MonthDay[MonthDay["January"] = 31] = "January";
|
|
695
|
-
MonthDay[MonthDay["February"] = 28] = "February";
|
|
696
|
-
MonthDay[MonthDay["March"] = 31] = "March";
|
|
697
|
-
MonthDay[MonthDay["April"] = 30] = "April";
|
|
698
|
-
MonthDay[MonthDay["May"] = 31] = "May";
|
|
699
|
-
MonthDay[MonthDay["June"] = 30] = "June";
|
|
700
|
-
MonthDay[MonthDay["July"] = 31] = "July";
|
|
701
|
-
MonthDay[MonthDay["August"] = 31] = "August";
|
|
702
|
-
MonthDay[MonthDay["September"] = 30] = "September";
|
|
703
|
-
MonthDay[MonthDay["October"] = 31] = "October";
|
|
704
|
-
MonthDay[MonthDay["November"] = 30] = "November";
|
|
705
|
-
MonthDay[MonthDay["December"] = 31] = "December";
|
|
706
|
-
})(MonthDay || (MonthDay = {}));
|
|
707
|
-
|
|
708
|
-
let MONTH_NAMES_I18N = [];
|
|
709
|
-
let MONTH_LABELS_I18N = [];
|
|
710
|
-
let DAY_NAMES_I18N = [];
|
|
711
|
-
let DAY_LABELS_I18N = [];
|
|
712
|
-
function loadI18n(language = 'es') {
|
|
713
|
-
MONTH_NAMES_I18N = [
|
|
714
|
-
dateI18n('january', { language }),
|
|
715
|
-
dateI18n('february', { language }),
|
|
716
|
-
dateI18n('march', { language }),
|
|
717
|
-
dateI18n('april', { language }),
|
|
718
|
-
dateI18n('may', { language }),
|
|
719
|
-
dateI18n('june', { language }),
|
|
720
|
-
dateI18n('july', { language }),
|
|
721
|
-
dateI18n('august', { language }),
|
|
722
|
-
dateI18n('september', { language }),
|
|
723
|
-
dateI18n('october', { language }),
|
|
724
|
-
dateI18n('november', { language }),
|
|
725
|
-
dateI18n('december', { language })
|
|
726
|
-
];
|
|
727
|
-
MONTH_LABELS_I18N = MONTH_NAMES_I18N.map((name) => name.substring(0, 3));
|
|
728
|
-
DAY_NAMES_I18N = [
|
|
729
|
-
dateI18n('sunday', { language }),
|
|
730
|
-
dateI18n('monday', { language }),
|
|
731
|
-
dateI18n('tuesday', { language }),
|
|
732
|
-
dateI18n('wednesday', { language }),
|
|
733
|
-
dateI18n('thursday', { language }),
|
|
734
|
-
dateI18n('friday', { language }),
|
|
735
|
-
dateI18n('saturday', { language })
|
|
736
|
-
];
|
|
737
|
-
DAY_LABELS_I18N = DAY_NAMES_I18N.map((name) => name.substring(0, 3));
|
|
738
|
-
}
|
|
739
|
-
function isNumber(value) {
|
|
740
|
-
return value !== undefined && value !== null;
|
|
741
|
-
}
|
|
742
|
-
loadI18n();
|
|
743
|
-
i18n.i18nSubscribe((language) => loadI18n(language));
|
|
744
|
-
const MONTH_DAYS = [
|
|
745
|
-
MonthDay.January,
|
|
746
|
-
MonthDay.February,
|
|
747
|
-
MonthDay.March,
|
|
748
|
-
MonthDay.April,
|
|
749
|
-
MonthDay.May,
|
|
750
|
-
MonthDay.June,
|
|
751
|
-
MonthDay.July,
|
|
752
|
-
MonthDay.August,
|
|
753
|
-
MonthDay.September,
|
|
754
|
-
MonthDay.October,
|
|
755
|
-
MonthDay.November,
|
|
756
|
-
MonthDay.December
|
|
757
|
-
];
|
|
758
|
-
function MONTH_NAMES(index) {
|
|
759
|
-
return isNumber(index) ? MONTH_NAMES_I18N[index] || '' : MONTH_NAMES_I18N;
|
|
760
|
-
}
|
|
761
|
-
function MONTH_LABELS(index) {
|
|
762
|
-
return isNumber(index) ? MONTH_LABELS_I18N[index] || '' : MONTH_LABELS_I18N;
|
|
763
|
-
}
|
|
764
|
-
function DAY_NAMES(index) {
|
|
765
|
-
return isNumber(index) ? DAY_NAMES_I18N[index] || '' : DAY_NAMES_I18N;
|
|
766
|
-
}
|
|
767
|
-
function DAY_LABELS(index) {
|
|
768
|
-
return isNumber(index) ? DAY_LABELS_I18N[index] || '' : DAY_LABELS_I18N;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
function completFormat(value, size) {
|
|
772
|
-
return value.toString().padStart(size, '0');
|
|
773
|
-
}
|
|
774
|
-
function hourFormat(date) {
|
|
775
|
-
const hour = date.getHours();
|
|
776
|
-
return hour > 12 ? hour - 12 : hour === 0 ? 12 : hour;
|
|
777
|
-
}
|
|
778
|
-
function verifyDayInYear(date, year) {
|
|
779
|
-
const days = getDaysOfMonth(year, date.getMonth());
|
|
780
|
-
if (days < date.getDate()) {
|
|
781
|
-
date.setDate(days);
|
|
782
|
-
}
|
|
783
|
-
date.setFullYear(year); // Establecer el año
|
|
784
|
-
}
|
|
785
|
-
function verifyDayInMonth(date, month) {
|
|
786
|
-
const days = getDaysOfMonth(date.getFullYear(), month);
|
|
787
|
-
if (days < date.getDate()) {
|
|
788
|
-
date.setDate(days);
|
|
789
|
-
}
|
|
790
|
-
date.setMonth(month); // Establecer el mes
|
|
791
|
-
}
|
|
792
|
-
const formatters = {
|
|
793
|
-
dd: (date) => {
|
|
794
|
-
return completFormat(date.getDate(), 2);
|
|
795
|
-
},
|
|
796
|
-
dw: (date) => {
|
|
797
|
-
return DAY_NAMES()[date.getDay()];
|
|
798
|
-
},
|
|
799
|
-
dx: (date) => {
|
|
800
|
-
return DAY_NAMES()[date.getDay()];
|
|
801
|
-
},
|
|
802
|
-
mm: (date) => {
|
|
803
|
-
return completFormat(date.getMonth() + 1, 2);
|
|
804
|
-
},
|
|
805
|
-
mn: (date) => {
|
|
806
|
-
return MONTH_NAMES(date.getMonth());
|
|
807
|
-
},
|
|
808
|
-
mx: (date) => {
|
|
809
|
-
return MONTH_LABELS(date.getMonth());
|
|
810
|
-
},
|
|
811
|
-
aa: (date) => {
|
|
812
|
-
return completFormat(date.getFullYear(), 4);
|
|
813
|
-
},
|
|
814
|
-
hh: (date) => {
|
|
815
|
-
return completFormat(date.getHours(), 2);
|
|
816
|
-
},
|
|
817
|
-
ii: (date) => {
|
|
818
|
-
return completFormat(date.getMinutes(), 2);
|
|
819
|
-
},
|
|
820
|
-
ss: (date) => {
|
|
821
|
-
return completFormat(date.getSeconds(), 2);
|
|
822
|
-
},
|
|
823
|
-
hz: (date) => {
|
|
824
|
-
return completFormat(hourFormat(date), 2);
|
|
825
|
-
},
|
|
826
|
-
zz: (date) => {
|
|
827
|
-
return date.getHours() > 11 ? 'PM' : 'AM';
|
|
828
|
-
}
|
|
829
|
-
};
|
|
830
|
-
const createElapsedTime = (value, single, charPlural = 's', plural) => {
|
|
831
|
-
plural = plural || `${single}${charPlural}`;
|
|
832
|
-
const label = `${single}(${charPlural})`;
|
|
833
|
-
return {
|
|
834
|
-
value,
|
|
835
|
-
label,
|
|
836
|
-
single,
|
|
837
|
-
plural
|
|
838
|
-
};
|
|
839
|
-
};
|
|
840
|
-
[
|
|
841
|
-
createElapsedTime(Miliseconds.Year, 'año'),
|
|
842
|
-
createElapsedTime(Miliseconds.Month, 'mes', 'es'),
|
|
843
|
-
createElapsedTime(Miliseconds.Week, 'semana'),
|
|
844
|
-
createElapsedTime(Miliseconds.Day, 'día', 's', 'dias'),
|
|
845
|
-
createElapsedTime(Miliseconds.Hour, 'hora'),
|
|
846
|
-
createElapsedTime(Miliseconds.Minute, 'minuto'),
|
|
847
|
-
createElapsedTime(Miliseconds.Second, 'segundo')
|
|
848
|
-
];
|
|
849
|
-
function getDateWeight(date) {
|
|
850
|
-
return date.getFullYear() * 365 + (date.getMonth() + 1) * 30 + date.getDate();
|
|
851
|
-
}
|
|
852
|
-
function dateIsEquals(date, compare = new Date()) {
|
|
853
|
-
return date.getTime() === compare.getTime();
|
|
854
|
-
}
|
|
855
|
-
function dateIsEqualsWeight(date, compare = new Date()) {
|
|
856
|
-
return getDateWeight(date) === getDateWeight(compare);
|
|
857
|
-
}
|
|
858
|
-
function dateIsBefore(date, compare = new Date()) {
|
|
859
|
-
return date.getTime() > compare.getTime();
|
|
860
|
-
}
|
|
861
|
-
function dateIsAfter(date, compare = new Date()) {
|
|
862
|
-
return date.getTime() < compare.getTime();
|
|
863
|
-
}
|
|
864
|
-
function dateIsBetween(minDate, maxDate, compare = new Date()) {
|
|
865
|
-
return dateIsAfter(minDate, compare) && dateIsBefore(maxDate, compare);
|
|
866
|
-
}
|
|
867
|
-
function getTimeDifference(date, compare = new Date()) {
|
|
868
|
-
return date.getTime() - compare.getTime();
|
|
869
|
-
}
|
|
870
|
-
function normalizeMinTime(date) {
|
|
871
|
-
const normalize = new Date(date.getTime());
|
|
872
|
-
normalize.setHours(0);
|
|
873
|
-
normalize.setMinutes(0);
|
|
874
|
-
normalize.setSeconds(0);
|
|
875
|
-
normalize.setMilliseconds(0);
|
|
876
|
-
return normalize;
|
|
877
|
-
}
|
|
878
|
-
function normalizeMaxTime(date) {
|
|
879
|
-
const normalize = new Date(date.getTime());
|
|
880
|
-
normalize.setHours(23);
|
|
881
|
-
normalize.setMinutes(59);
|
|
882
|
-
normalize.setSeconds(59);
|
|
883
|
-
normalize.setMilliseconds(0);
|
|
884
|
-
return normalize;
|
|
885
|
-
}
|
|
886
|
-
function getDaysOfMonth(year, month) {
|
|
887
|
-
return month === 1 && isLeapYear(year) ? 29 : MONTH_DAYS[month];
|
|
888
|
-
}
|
|
889
|
-
function isLeapYear(value) {
|
|
890
|
-
const year = value instanceof Date ? value.getFullYear() : value;
|
|
891
|
-
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
892
|
-
}
|
|
893
|
-
const regInterpolation = /{([^{}]*)}/g;
|
|
894
|
-
function dateFormatTemplate(date, template) {
|
|
895
|
-
return template.replace(regInterpolation, (value, key) => formatters[key] ? formatters[key](date) : value);
|
|
896
|
-
}
|
|
897
|
-
function assignYearInDate(date, year) {
|
|
898
|
-
const newDate = new Date(date.getTime());
|
|
899
|
-
verifyDayInYear(newDate, year);
|
|
900
|
-
newDate.setFullYear(year);
|
|
901
|
-
return newDate;
|
|
902
|
-
}
|
|
903
|
-
function assignMonthInDate(date, month) {
|
|
904
|
-
const newDate = new Date(date.getTime());
|
|
905
|
-
verifyDayInMonth(newDate, month);
|
|
906
|
-
newDate.setMonth(month);
|
|
907
|
-
return newDate;
|
|
908
|
-
}
|
|
909
|
-
function assignDayInDate(date, day) {
|
|
910
|
-
const newDate = new Date(date.getTime());
|
|
911
|
-
newDate.setDate(day);
|
|
912
|
-
return newDate;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
class DateRange {
|
|
916
|
-
constructor(minDate, maxDate) {
|
|
917
|
-
this.minDate = normalizeMinTime(minDate);
|
|
918
|
-
this.maxDate =
|
|
919
|
-
maxDate && dateIsBefore(maxDate, minDate)
|
|
920
|
-
? normalizeMinTime(maxDate)
|
|
921
|
-
: normalizeMinTime(minDate);
|
|
922
|
-
}
|
|
923
|
-
get minISOFormat() {
|
|
924
|
-
return this.minDate.toISOString();
|
|
925
|
-
}
|
|
926
|
-
get maxISOFormat() {
|
|
927
|
-
return this.maxDate.toISOString();
|
|
928
|
-
}
|
|
929
|
-
between(date) {
|
|
930
|
-
return dateIsBetween(this.minDate, this.maxDate, date);
|
|
931
|
-
}
|
|
932
|
-
equals({ maxDate, minDate }) {
|
|
933
|
-
return dateIsEquals(this.minDate, minDate) && dateIsEquals(this.maxDate, maxDate);
|
|
934
|
-
}
|
|
935
|
-
recalculate(date) {
|
|
936
|
-
if (dateIsBefore(this.minDate, date)) {
|
|
937
|
-
return new DateRange(date, this.maxDate);
|
|
938
|
-
}
|
|
939
|
-
if (dateIsAfter(this.maxDate, date)) {
|
|
940
|
-
return new DateRange(this.minDate, date);
|
|
941
|
-
}
|
|
942
|
-
const minDifference = getTimeDifference(date, this.minDate);
|
|
943
|
-
const maxDifference = getTimeDifference(this.maxDate, date);
|
|
944
|
-
return minDifference > maxDifference
|
|
945
|
-
? new DateRange(this.minDate, date)
|
|
946
|
-
: new DateRange(date, this.maxDate);
|
|
947
|
-
}
|
|
948
|
-
static now() {
|
|
949
|
-
return new DateRange(new Date());
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
function dateIsOutRangeMin(props) {
|
|
954
|
-
const { date, minDate } = props;
|
|
955
|
-
return !!minDate && dateIsBefore(normalizeMinTime(minDate), date);
|
|
956
|
-
}
|
|
957
|
-
function dateIsOutRangeMax(props) {
|
|
958
|
-
const { date, maxDate } = props;
|
|
959
|
-
return !!maxDate && dateIsAfter(normalizeMaxTime(maxDate), date);
|
|
960
|
-
}
|
|
961
|
-
function dateOutRange(props) {
|
|
962
|
-
return dateIsOutRangeMin(props) || dateIsOutRangeMax(props);
|
|
963
|
-
}
|
|
964
|
-
function checkDateRange(props) {
|
|
965
|
-
const { date, maxDate, minDate } = props;
|
|
966
|
-
return minDate && dateIsOutRangeMax(props)
|
|
967
|
-
? minDate
|
|
968
|
-
: maxDate && dateIsOutRangeMax(props)
|
|
969
|
-
? maxDate
|
|
970
|
-
: date;
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
const DAYS_WEEK = 7;
|
|
974
|
-
const COUNT_YEAR_RANGE = 4;
|
|
975
|
-
|
|
976
|
-
function createDayState(props, today, value) {
|
|
977
|
-
const { date, day, month, year } = props;
|
|
978
|
-
const dateValue = value && new Date(year, month, value);
|
|
979
|
-
return {
|
|
980
|
-
disabled: dayIsOutside(props, value || 0),
|
|
981
|
-
focused: !!value && day === value,
|
|
982
|
-
forbidden: !value,
|
|
983
|
-
selected: !!dateValue && dateIsEqualsWeight(date, dateValue),
|
|
984
|
-
today: !!dateValue && dateIsEqualsWeight(today, dateValue),
|
|
985
|
-
value
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
function createFirstWeek$1(props, date, today) {
|
|
989
|
-
const days = [];
|
|
990
|
-
let day = 1;
|
|
991
|
-
for (let start = 0; start < date.getDay(); start++) {
|
|
992
|
-
days.push(createDayState(props, today));
|
|
993
|
-
}
|
|
994
|
-
for (let end = date.getDay(); end < 7; end++) {
|
|
995
|
-
days.push(createDayState(props, today, day));
|
|
996
|
-
day++;
|
|
997
|
-
}
|
|
998
|
-
return { days };
|
|
999
|
-
}
|
|
1000
|
-
function createDaysPending$1(props, today, days) {
|
|
1001
|
-
const daysPending = [];
|
|
1002
|
-
const length = 7 - days;
|
|
1003
|
-
for (let index = 0; index < length; index++) {
|
|
1004
|
-
daysPending.push(createDayState(props, today));
|
|
1005
|
-
}
|
|
1006
|
-
return daysPending;
|
|
1007
|
-
}
|
|
1008
|
-
function createNextWeeks$1(props, date, today) {
|
|
1009
|
-
const daysMonth = getDaysOfMonth(date.getFullYear(), date.getMonth());
|
|
1010
|
-
const weeks = [];
|
|
1011
|
-
let days = [];
|
|
1012
|
-
let countDays = 1;
|
|
1013
|
-
let day = DAYS_WEEK - date.getDay() + 1;
|
|
1014
|
-
do {
|
|
1015
|
-
days.push(createDayState(props, today, day));
|
|
1016
|
-
day++;
|
|
1017
|
-
countDays++;
|
|
1018
|
-
if (countDays > DAYS_WEEK) {
|
|
1019
|
-
weeks.push({ days });
|
|
1020
|
-
days = [];
|
|
1021
|
-
countDays = 1;
|
|
1022
|
-
}
|
|
1023
|
-
} while (day <= daysMonth);
|
|
1024
|
-
if (days.length && days.length < DAYS_WEEK) {
|
|
1025
|
-
weeks.push({
|
|
1026
|
-
days: [...days, ...createDaysPending$1(props, today, days.length)]
|
|
1027
|
-
});
|
|
1028
|
-
}
|
|
1029
|
-
return weeks;
|
|
1030
|
-
}
|
|
1031
|
-
function dayIsOutsideMin(props, day) {
|
|
1032
|
-
const { month, year, minDate } = props;
|
|
1033
|
-
return minDate
|
|
1034
|
-
? getDateWeight(new Date(year, month, day)) < getDateWeight(minDate)
|
|
1035
|
-
: false;
|
|
1036
|
-
}
|
|
1037
|
-
function dayIsOutsideMax(props, day) {
|
|
1038
|
-
const { month, year, maxDate } = props;
|
|
1039
|
-
return maxDate
|
|
1040
|
-
? getDateWeight(new Date(year, month, day)) > getDateWeight(maxDate)
|
|
1041
|
-
: false;
|
|
1042
|
-
}
|
|
1043
|
-
function dayIsOutside(props, day) {
|
|
1044
|
-
return dayIsOutsideMin(props, day) || dayIsOutsideMax(props, day);
|
|
1045
|
-
}
|
|
1046
|
-
function checkDayPicker(props) {
|
|
1047
|
-
const { day, maxDate, minDate } = props;
|
|
1048
|
-
return minDate && dayIsOutsideMin(props, day)
|
|
1049
|
-
? minDate.getDate()
|
|
1050
|
-
: maxDate && dayIsOutsideMax(props, day)
|
|
1051
|
-
? maxDate.getDate()
|
|
1052
|
-
: undefined;
|
|
1053
|
-
}
|
|
1054
|
-
function createDayPicker(props) {
|
|
1055
|
-
const date = new Date(props.year, props.month, 1);
|
|
1056
|
-
const today = new Date();
|
|
1057
|
-
const firstWeek = createFirstWeek$1(props, date, today);
|
|
1058
|
-
const nextWeeks = createNextWeeks$1(props, date, today);
|
|
1059
|
-
return [firstWeek, ...nextWeeks];
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
function dateIsSelected(base, date, day) {
|
|
1063
|
-
return (date.getFullYear() === base.getFullYear() &&
|
|
1064
|
-
date.getMonth() === base.getMonth() &&
|
|
1065
|
-
day === date.getDate());
|
|
1066
|
-
}
|
|
1067
|
-
function sourceIsSelected({ sourceDate }, base, day) {
|
|
1068
|
-
return dateIsSelected(base, sourceDate, day);
|
|
1069
|
-
}
|
|
1070
|
-
function rangeIsSelected({ range }, base, day) {
|
|
1071
|
-
return (dateIsSelected(base, range.minDate, day) ||
|
|
1072
|
-
dateIsSelected(base, range.maxDate, day));
|
|
1073
|
-
}
|
|
1074
|
-
function dayIsRange({ range }, base, day) {
|
|
1075
|
-
return dateIsBetween(range.minDate, range.maxDate, assignDayInDate(base, day));
|
|
1076
|
-
}
|
|
1077
|
-
function createDayRangeState(props, base, day) {
|
|
1078
|
-
return {
|
|
1079
|
-
disabled: dayRangeIsOutside(props, day || 0),
|
|
1080
|
-
end: day ? rangeIsSelected(props, base, day) : false,
|
|
1081
|
-
forbidden: !day,
|
|
1082
|
-
ranged: day ? dayIsRange(props, base, day) : false,
|
|
1083
|
-
source: day ? sourceIsSelected(props, base, day) : false,
|
|
1084
|
-
value: day
|
|
1085
|
-
};
|
|
1086
|
-
}
|
|
1087
|
-
function createFirstWeek(props, base) {
|
|
1088
|
-
const days = [];
|
|
1089
|
-
let day = 1;
|
|
1090
|
-
for (let start = 0; start < base.getDay(); start++) {
|
|
1091
|
-
days.push(createDayRangeState(props, base));
|
|
1092
|
-
}
|
|
1093
|
-
for (let end = base.getDay(); end < 7; end++) {
|
|
1094
|
-
days.push(createDayRangeState(props, base, day));
|
|
1095
|
-
day++;
|
|
1096
|
-
}
|
|
1097
|
-
return { days };
|
|
1098
|
-
}
|
|
1099
|
-
function createDaysPending(props, base, days) {
|
|
1100
|
-
const daysPending = [];
|
|
1101
|
-
const length = 7 - days;
|
|
1102
|
-
for (let index = 0; index < length; index++) {
|
|
1103
|
-
daysPending.push(createDayRangeState(props, base));
|
|
1104
|
-
}
|
|
1105
|
-
return daysPending;
|
|
1106
|
-
}
|
|
1107
|
-
function createNextWeeks(props, base) {
|
|
1108
|
-
const weeks = [];
|
|
1109
|
-
const { date } = props;
|
|
1110
|
-
const dayCount = getDaysOfMonth(date.getFullYear(), date.getMonth());
|
|
1111
|
-
let days = [];
|
|
1112
|
-
let countDays = 1;
|
|
1113
|
-
let day = DAYS_WEEK - base.getDay() + 1;
|
|
1114
|
-
do {
|
|
1115
|
-
days.push(createDayRangeState(props, date, day));
|
|
1116
|
-
day++;
|
|
1117
|
-
countDays++;
|
|
1118
|
-
if (countDays > 7) {
|
|
1119
|
-
weeks.push({ days });
|
|
1120
|
-
days = [];
|
|
1121
|
-
countDays = 1;
|
|
1122
|
-
}
|
|
1123
|
-
} while (day <= dayCount);
|
|
1124
|
-
if (days.length && days.length < DAYS_WEEK) {
|
|
1125
|
-
weeks.push({
|
|
1126
|
-
days: [...days, ...createDaysPending(props, base, days.length)]
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
return weeks;
|
|
1130
|
-
}
|
|
1131
|
-
function dayRangeIsOutsideMin(props, day) {
|
|
1132
|
-
const { date, minDate } = props;
|
|
1133
|
-
return minDate
|
|
1134
|
-
? getDateWeight(assignDayInDate(date, day)) < getDateWeight(minDate)
|
|
1135
|
-
: false;
|
|
1136
|
-
}
|
|
1137
|
-
function dayRangeIsOutsideMax(props, day) {
|
|
1138
|
-
const { date, maxDate } = props;
|
|
1139
|
-
return maxDate
|
|
1140
|
-
? getDateWeight(assignDayInDate(date, day)) > getDateWeight(maxDate)
|
|
1141
|
-
: false;
|
|
1142
|
-
}
|
|
1143
|
-
function dayRangeIsOutside(props, day) {
|
|
1144
|
-
return dayRangeIsOutsideMin(props, day) || dayRangeIsOutsideMax(props, day);
|
|
1145
|
-
}
|
|
1146
|
-
function createDayRangePicker(props) {
|
|
1147
|
-
const date = new Date(props.date.getFullYear(), props.date.getMonth(), 1);
|
|
1148
|
-
const firstWeek = createFirstWeek(props, date);
|
|
1149
|
-
const nextWeeks = createNextWeeks(props, date);
|
|
1150
|
-
return [firstWeek, ...nextWeeks];
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
function createMonthState(props, value) {
|
|
1154
|
-
const { date, month, year } = props;
|
|
1155
|
-
return {
|
|
1156
|
-
disabled: monthIsOutside(props, value),
|
|
1157
|
-
focused: value === month,
|
|
1158
|
-
label: MONTH_NAMES()[value],
|
|
1159
|
-
selected: date.getFullYear() === year && value === date.getMonth(),
|
|
1160
|
-
value
|
|
1161
|
-
};
|
|
1162
|
-
}
|
|
1163
|
-
function monthIsOutsideMin(props, month) {
|
|
1164
|
-
const { year, minDate } = props;
|
|
1165
|
-
return minDate
|
|
1166
|
-
? minDate.getFullYear() === year && month < minDate.getMonth()
|
|
1167
|
-
: false;
|
|
1168
|
-
}
|
|
1169
|
-
function monthIsOutsideMax(props, month) {
|
|
1170
|
-
const { year, maxDate } = props;
|
|
1171
|
-
return maxDate
|
|
1172
|
-
? maxDate.getFullYear() === year && month > maxDate.getMonth()
|
|
1173
|
-
: false;
|
|
1174
|
-
}
|
|
1175
|
-
function monthIsOutside(props, month) {
|
|
1176
|
-
return monthIsOutsideMin(props, month) || monthIsOutsideMax(props, month);
|
|
1177
|
-
}
|
|
1178
|
-
function checkMonthPicker(props) {
|
|
1179
|
-
const { maxDate, minDate, month } = props;
|
|
1180
|
-
return minDate && monthIsOutsideMin(props, month)
|
|
1181
|
-
? minDate.getMonth()
|
|
1182
|
-
: maxDate && monthIsOutsideMax(props, month)
|
|
1183
|
-
? maxDate.getMonth()
|
|
1184
|
-
: undefined;
|
|
1185
|
-
}
|
|
1186
|
-
function createMonthPicker(props) {
|
|
1187
|
-
return [
|
|
1188
|
-
createMonthState(props, Month.January),
|
|
1189
|
-
createMonthState(props, Month.February),
|
|
1190
|
-
createMonthState(props, Month.March),
|
|
1191
|
-
createMonthState(props, Month.April),
|
|
1192
|
-
createMonthState(props, Month.May),
|
|
1193
|
-
createMonthState(props, Month.June),
|
|
1194
|
-
createMonthState(props, Month.July),
|
|
1195
|
-
createMonthState(props, Month.August),
|
|
1196
|
-
createMonthState(props, Month.September),
|
|
1197
|
-
createMonthState(props, Month.October),
|
|
1198
|
-
createMonthState(props, Month.November),
|
|
1199
|
-
createMonthState(props, Month.December)
|
|
1200
|
-
];
|
|
1201
|
-
}
|
|
1202
|
-
function monthIsLimitMin(props) {
|
|
1203
|
-
const { month, date, minDate } = props;
|
|
1204
|
-
if (itIsDefined(month) && date) {
|
|
1205
|
-
const minYear = minDate ? minDate.getFullYear() : 0;
|
|
1206
|
-
const minMonth = minDate ? minDate.getMonth() : 0;
|
|
1207
|
-
return date.getFullYear() === minYear && month <= minMonth;
|
|
1208
|
-
}
|
|
1209
|
-
return false;
|
|
1210
|
-
}
|
|
1211
|
-
function monthIsLimitMax(props) {
|
|
1212
|
-
const { month, date, maxDate } = props;
|
|
1213
|
-
if (itIsDefined(month) && date) {
|
|
1214
|
-
const maxYear = maxDate ? maxDate.getFullYear() : 10000;
|
|
1215
|
-
const maxMonth = maxDate ? maxDate.getMonth() : 11;
|
|
1216
|
-
return date.getFullYear() === maxYear && month >= maxMonth;
|
|
1217
|
-
}
|
|
1218
|
-
return false;
|
|
1219
|
-
}
|
|
1220
|
-
function monthLimitTemplate(props) {
|
|
1221
|
-
return {
|
|
1222
|
-
limitNext: monthIsLimitMax(props),
|
|
1223
|
-
limitPrevious: monthIsLimitMin(props)
|
|
1224
|
-
};
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
var PickerListenerType;
|
|
1228
|
-
(function (PickerListenerType) {
|
|
1229
|
-
PickerListenerType["Select"] = "PickerSelect";
|
|
1230
|
-
PickerListenerType["Now"] = "PickerNow";
|
|
1231
|
-
PickerListenerType["Cancel"] = "PickerCancel";
|
|
1232
|
-
})(PickerListenerType || (PickerListenerType = {}));
|
|
1233
|
-
|
|
1234
|
-
function createYear(props, value) {
|
|
1235
|
-
const { date, year } = props;
|
|
1236
|
-
return {
|
|
1237
|
-
disabled: !value,
|
|
1238
|
-
focused: value === year,
|
|
1239
|
-
selected: value === date.getFullYear(),
|
|
1240
|
-
value
|
|
1241
|
-
};
|
|
1242
|
-
}
|
|
1243
|
-
function yearIsOutlineMin(props) {
|
|
1244
|
-
const { year, minDate } = props;
|
|
1245
|
-
return minDate ? year < minDate.getFullYear() : false;
|
|
1246
|
-
}
|
|
1247
|
-
function yearIsOutlineMax(props) {
|
|
1248
|
-
const { year, maxDate } = props;
|
|
1249
|
-
return maxDate ? year > maxDate.getFullYear() : false;
|
|
1250
|
-
}
|
|
1251
|
-
function checkYearPicker(props) {
|
|
1252
|
-
const { maxDate, minDate } = props;
|
|
1253
|
-
return minDate && yearIsOutlineMin(props)
|
|
1254
|
-
? minDate.getFullYear()
|
|
1255
|
-
: maxDate && yearIsOutlineMax(props)
|
|
1256
|
-
? maxDate.getFullYear()
|
|
1257
|
-
: undefined;
|
|
1258
|
-
}
|
|
1259
|
-
function createYearPicker(props) {
|
|
1260
|
-
const { year, maxDate, minDate } = props;
|
|
1261
|
-
const prevYears = [];
|
|
1262
|
-
const nextYears = [];
|
|
1263
|
-
let minRange = year;
|
|
1264
|
-
let maxRange = year;
|
|
1265
|
-
const minYear = minDate?.getFullYear() || 0;
|
|
1266
|
-
const maxYear = maxDate?.getFullYear() || 10000;
|
|
1267
|
-
for (let index = 0; index < COUNT_YEAR_RANGE; index++) {
|
|
1268
|
-
const prevValue = year - COUNT_YEAR_RANGE + index;
|
|
1269
|
-
const nextValue = year + index + 1;
|
|
1270
|
-
const prevYear = prevValue >= minYear ? prevValue : undefined;
|
|
1271
|
-
const nextYear = nextValue <= maxYear ? nextValue : undefined;
|
|
1272
|
-
const prevState = createYear(props, prevYear);
|
|
1273
|
-
const nextState = createYear(props, nextYear);
|
|
1274
|
-
prevYears.push(prevState);
|
|
1275
|
-
nextYears.push(nextState);
|
|
1276
|
-
if (!!prevState.value && minRange > prevState.value) {
|
|
1277
|
-
minRange = prevState.value;
|
|
1278
|
-
}
|
|
1279
|
-
if (!!nextState.value && maxRange < nextState.value) {
|
|
1280
|
-
maxRange = nextState.value;
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
const yearCenter = createYear(props, year);
|
|
1284
|
-
return {
|
|
1285
|
-
canPrevious: minYear < minRange,
|
|
1286
|
-
canNext: maxYear > maxRange,
|
|
1287
|
-
maxRange,
|
|
1288
|
-
minRange,
|
|
1289
|
-
years: [...prevYears, yearCenter, ...nextYears]
|
|
1290
|
-
};
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
const normalize = (word) => {
|
|
1294
|
-
return word
|
|
1295
|
-
.slice()
|
|
1296
|
-
.replace(/á/g, 'a')
|
|
1297
|
-
.replace(/Á/g, 'A')
|
|
1298
|
-
.replace(/é/g, 'e')
|
|
1299
|
-
.replace(/É/g, 'E')
|
|
1300
|
-
.replace(/í/g, 'i')
|
|
1301
|
-
.replace(/Í/g, 'I')
|
|
1302
|
-
.replace(/ó/g, 'o')
|
|
1303
|
-
.replace(/Ó/g, 'O')
|
|
1304
|
-
.replace(/ú/g, 'u')
|
|
1305
|
-
.replace(/Ú/g, 'U');
|
|
1306
|
-
};
|
|
1307
|
-
const hasPattern = (word, pattern, force = false) => {
|
|
1308
|
-
let filter = pattern.toLowerCase();
|
|
1309
|
-
let test = word.toLowerCase();
|
|
1310
|
-
if (force) {
|
|
1311
|
-
test = normalize(test);
|
|
1312
|
-
filter = normalize(filter);
|
|
1313
|
-
}
|
|
1314
|
-
return !!test.match(`^.*${filter}.*$`);
|
|
1315
|
-
};
|
|
1316
|
-
|
|
1317
|
-
function createEmptyStore() {
|
|
1318
|
-
return {
|
|
1319
|
-
coincidences: undefined,
|
|
1320
|
-
pattern: '',
|
|
1321
|
-
previous: null
|
|
1322
|
-
};
|
|
1323
|
-
}
|
|
1324
|
-
function searchForPattern(props) {
|
|
1325
|
-
const { pattern, store } = props;
|
|
1326
|
-
if (!store?.pattern) {
|
|
1327
|
-
return null;
|
|
1328
|
-
}
|
|
1329
|
-
let newStore = store;
|
|
1330
|
-
let search = false;
|
|
1331
|
-
while (!search && newStore) {
|
|
1332
|
-
search = hasPattern(pattern || '', newStore.pattern, true);
|
|
1333
|
-
if (!search) {
|
|
1334
|
-
newStore = newStore.previous;
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
return newStore || createEmptyStore();
|
|
1338
|
-
}
|
|
1339
|
-
function createStoreAutocomplete(props) {
|
|
1340
|
-
const { pattern, suggestions, reboot } = props;
|
|
1341
|
-
if (!pattern) {
|
|
1342
|
-
return { collection: suggestions, store: createEmptyStore() };
|
|
1343
|
-
}
|
|
1344
|
-
const store = reboot ? createEmptyStore() : searchForPattern(props);
|
|
1345
|
-
const elements = store?.coincidences || suggestions;
|
|
1346
|
-
const coincidences = elements.filter((element) => element.hasCoincidence(pattern));
|
|
1347
|
-
return {
|
|
1348
|
-
collection: coincidences,
|
|
1349
|
-
store: {
|
|
1350
|
-
coincidences,
|
|
1351
|
-
pattern,
|
|
1352
|
-
previous: store
|
|
1353
|
-
}
|
|
1354
|
-
};
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
const classElement = '.rls-list-field__element';
|
|
1358
|
-
const POSITION_INITIAL = 0;
|
|
1359
|
-
function locationListIsBottom(contentElement, listElement) {
|
|
1360
|
-
if (contentElement && listElement) {
|
|
1361
|
-
const { top, height } = contentElement.getBoundingClientRect();
|
|
1362
|
-
const { clientHeight } = listElement;
|
|
1363
|
-
return top + height + clientHeight < window.innerHeight;
|
|
1364
|
-
}
|
|
1365
|
-
return true;
|
|
1366
|
-
}
|
|
1367
|
-
function navigationInputDown(props) {
|
|
1368
|
-
const { contentElement, listElement } = props;
|
|
1369
|
-
if (!locationListIsBottom(contentElement, listElement)) {
|
|
1370
|
-
return undefined;
|
|
1371
|
-
}
|
|
1372
|
-
const elements = listElement?.querySelectorAll(classElement);
|
|
1373
|
-
if (elements?.length) {
|
|
1374
|
-
elements.item(0).focus();
|
|
1375
|
-
setTimeout(() => {
|
|
1376
|
-
listElement?.scroll({ top: 0, behavior: 'smooth' });
|
|
1377
|
-
}, 100);
|
|
1378
|
-
}
|
|
1379
|
-
return POSITION_INITIAL;
|
|
1380
|
-
}
|
|
1381
|
-
function navigationInputUp(props) {
|
|
1382
|
-
const { contentElement, listElement } = props;
|
|
1383
|
-
if (locationListIsBottom(contentElement, listElement)) {
|
|
1384
|
-
return undefined;
|
|
1385
|
-
}
|
|
1386
|
-
const elements = listElement?.querySelectorAll(classElement);
|
|
1387
|
-
if (!elements?.length) {
|
|
1388
|
-
return POSITION_INITIAL;
|
|
1389
|
-
}
|
|
1390
|
-
const position = elements.length - 1;
|
|
1391
|
-
const element = elements.item(position);
|
|
1392
|
-
element?.focus();
|
|
1393
|
-
setTimeout(() => {
|
|
1394
|
-
listElement?.scroll({
|
|
1395
|
-
top: element?.offsetTop + element?.offsetLeft,
|
|
1396
|
-
behavior: 'smooth'
|
|
1397
|
-
});
|
|
1398
|
-
}, 100);
|
|
1399
|
-
return position;
|
|
1400
|
-
}
|
|
1401
|
-
function navigationElementDown(props) {
|
|
1402
|
-
const { contentElement, inputElement, listElement, position } = props;
|
|
1403
|
-
const elements = listElement?.querySelectorAll(classElement);
|
|
1404
|
-
const newPosition = position + 1;
|
|
1405
|
-
if (newPosition < (elements?.length || 0)) {
|
|
1406
|
-
elements?.item(newPosition)?.focus();
|
|
1407
|
-
return newPosition;
|
|
1408
|
-
}
|
|
1409
|
-
if (!locationListIsBottom(contentElement, listElement)) {
|
|
1410
|
-
inputElement?.focus();
|
|
1411
|
-
}
|
|
1412
|
-
return position;
|
|
1413
|
-
}
|
|
1414
|
-
function navigationElementUp(props) {
|
|
1415
|
-
const { contentElement, inputElement, listElement, position } = props;
|
|
1416
|
-
if (position > 0) {
|
|
1417
|
-
const elements = listElement?.querySelectorAll(classElement);
|
|
1418
|
-
const newPosition = position - 1;
|
|
1419
|
-
elements?.item(newPosition)?.focus();
|
|
1420
|
-
return newPosition;
|
|
1421
|
-
}
|
|
1422
|
-
if (locationListIsBottom(contentElement, listElement)) {
|
|
1423
|
-
inputElement?.focus();
|
|
1424
|
-
}
|
|
1425
|
-
return POSITION_INITIAL;
|
|
1426
|
-
}
|
|
1427
|
-
function listNavigationInput(props) {
|
|
1428
|
-
switch (props.event.code) {
|
|
1429
|
-
case 'ArrowDown':
|
|
1430
|
-
return navigationInputDown(props);
|
|
1431
|
-
case 'ArrowUp':
|
|
1432
|
-
return navigationInputUp(props);
|
|
1433
|
-
default:
|
|
1434
|
-
return undefined;
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1437
|
-
function listNavigationElement(props) {
|
|
1438
|
-
const { event } = props;
|
|
1439
|
-
switch (event.code) {
|
|
1440
|
-
case 'ArrowDown':
|
|
1441
|
-
return navigationElementDown(props);
|
|
1442
|
-
case 'ArrowUp':
|
|
1443
|
-
return navigationElementUp(props);
|
|
1444
|
-
default:
|
|
1445
|
-
return POSITION_INITIAL;
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
class ListCollection {
|
|
1450
|
-
constructor(value) {
|
|
1451
|
-
this.value = value;
|
|
1452
|
-
}
|
|
1453
|
-
find(element) {
|
|
1454
|
-
return this.value.find((current) => current.compareTo(element));
|
|
1455
|
-
}
|
|
1737
|
+
}) }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__description", children: template.description }), jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: template.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: template.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
|
|
1456
1738
|
}
|
|
1457
1739
|
|
|
1458
1740
|
function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, month, minDate, onValue, rlsTheme, year }) {
|
|
1459
1741
|
const currentDate = date || new Date(); // Initial date
|
|
1460
|
-
const [weeks, setWeeks] =
|
|
1461
|
-
const [value, setValue] =
|
|
1462
|
-
|
|
1742
|
+
const [weeks, setWeeks] = require$$0.useState([]);
|
|
1743
|
+
const [value, setValue] = require$$0.useState(formControl?.value || currentDate.getDate());
|
|
1744
|
+
require$$0.useEffect(() => {
|
|
1463
1745
|
const props = createPickerProps();
|
|
1464
|
-
const day = checkDayPicker(props);
|
|
1465
|
-
day ? setDayValue(day) : setWeeks(createDayPicker(props));
|
|
1746
|
+
const day = components.checkDayPicker(props);
|
|
1747
|
+
day ? setDayValue(day) : setWeeks(components.createDayPicker(props));
|
|
1466
1748
|
}, [date, month, year, value, minDate, maxDate]);
|
|
1467
|
-
|
|
1468
|
-
const day = checkDayPicker(createPickerProps());
|
|
1749
|
+
require$$0.useEffect(() => {
|
|
1750
|
+
const day = components.checkDayPicker(createPickerProps());
|
|
1469
1751
|
day
|
|
1470
|
-
? formControl?.
|
|
1471
|
-
: setValue(formControl?.
|
|
1472
|
-
}, [formControl?.
|
|
1752
|
+
? formControl?.setValue(day)
|
|
1753
|
+
: setValue(formControl?.value || currentDate.getDate());
|
|
1754
|
+
}, [formControl?.value]);
|
|
1473
1755
|
function createPickerProps() {
|
|
1474
1756
|
return {
|
|
1475
1757
|
date: currentDate,
|
|
1476
|
-
day: formControl?.
|
|
1477
|
-
month: itIsDefined(month) ? month : currentDate.getMonth(),
|
|
1758
|
+
day: formControl?.value || value,
|
|
1759
|
+
month: commons.itIsDefined(month) ? month : currentDate.getMonth(),
|
|
1478
1760
|
year: year || currentDate.getFullYear(),
|
|
1479
1761
|
minDate,
|
|
1480
1762
|
maxDate
|
|
1481
1763
|
};
|
|
1482
1764
|
}
|
|
1483
1765
|
function setDayValue(value) {
|
|
1484
|
-
formControl ? formControl.
|
|
1766
|
+
formControl ? formControl.setValue(value) : setValue(value);
|
|
1485
1767
|
}
|
|
1486
1768
|
function onChange(value) {
|
|
1487
1769
|
setDayValue(value);
|
|
@@ -1489,25 +1771,24 @@ function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, mo
|
|
|
1489
1771
|
onValue(value);
|
|
1490
1772
|
}
|
|
1491
1773
|
}
|
|
1492
|
-
return (
|
|
1774
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-day__header", children: dates.DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("label", { className: "rls-picker-day__label", children: title }, index))) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__week", children: days.map(({ value, disabled, focused, forbidden, selected, today }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-day__element', {
|
|
1493
1775
|
disabled: disabled || disabledPicker,
|
|
1494
1776
|
focused,
|
|
1495
1777
|
forbidden,
|
|
1496
1778
|
selected,
|
|
1497
1779
|
today
|
|
1498
|
-
}), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children:
|
|
1780
|
+
}), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day__element__span", children: value || '??' }) }, index))) }, index))) })] }));
|
|
1499
1781
|
}
|
|
1500
1782
|
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1783
|
+
const FORMAT_RANGE = '{dd}/{mx}/{aa}';
|
|
1503
1784
|
function RlsPickerDayRange({ date, disabled: disabledPicker, formControl, maxDate, minDate, rlsTheme }) {
|
|
1504
|
-
const currentRange = formControl?.
|
|
1505
|
-
const currentDate = normalizeMinTime(date || currentRange.minDate);
|
|
1506
|
-
const sourceDate =
|
|
1507
|
-
const [weeks, setWeeks] =
|
|
1508
|
-
const [range, setRange] =
|
|
1509
|
-
|
|
1510
|
-
setWeeks(createDayRangePicker({
|
|
1785
|
+
const currentRange = formControl?.value || dates.DateRange.now();
|
|
1786
|
+
const currentDate = dates.normalizeMinTime(date || currentRange.minDate);
|
|
1787
|
+
const sourceDate = require$$0.useRef(currentRange.minDate);
|
|
1788
|
+
const [weeks, setWeeks] = require$$0.useState([]);
|
|
1789
|
+
const [range, setRange] = require$$0.useState(currentRange);
|
|
1790
|
+
require$$0.useEffect(() => {
|
|
1791
|
+
setWeeks(components.createDayRangePicker({
|
|
1511
1792
|
date: currentDate,
|
|
1512
1793
|
range,
|
|
1513
1794
|
sourceDate: sourceDate.current,
|
|
@@ -1516,49 +1797,49 @@ function RlsPickerDayRange({ date, disabled: disabledPicker, formControl, maxDat
|
|
|
1516
1797
|
}));
|
|
1517
1798
|
}, [range, date, minDate, maxDate]);
|
|
1518
1799
|
function onChange(value) {
|
|
1519
|
-
const date = assignDayInDate(currentDate, value);
|
|
1520
|
-
const range = dateIsBefore(date, sourceDate.current)
|
|
1521
|
-
? new DateRange(sourceDate.current, date)
|
|
1522
|
-
: new DateRange(date, sourceDate.current);
|
|
1800
|
+
const date = dates.assignDayInDate(currentDate, value);
|
|
1801
|
+
const range = dates.dateIsBefore(date, sourceDate.current)
|
|
1802
|
+
? new dates.DateRange(sourceDate.current, date)
|
|
1803
|
+
: new dates.DateRange(date, sourceDate.current);
|
|
1523
1804
|
sourceDate.current = date;
|
|
1524
1805
|
setRange(range);
|
|
1525
|
-
formControl?.
|
|
1806
|
+
formControl?.setValue(range);
|
|
1526
1807
|
}
|
|
1527
|
-
return (
|
|
1808
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__title", children: dates.dateFormatTemplate(sourceDate.current, FORMAT_RANGE) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__header", children: dates.DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("label", { className: "rls-picker-day-range__label", children: title }, index))) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__week", children: days.map(({ disabled, end, forbidden, source, ranged, value }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-day-range__element', {
|
|
1528
1809
|
disabled: disabled || disabledPicker,
|
|
1529
1810
|
end,
|
|
1530
1811
|
forbidden,
|
|
1531
1812
|
ranged,
|
|
1532
1813
|
source
|
|
1533
|
-
}), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children:
|
|
1814
|
+
}), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day-range__element__span", children: value || '??' }) }, index))) }, index))) })] }));
|
|
1534
1815
|
}
|
|
1535
1816
|
|
|
1536
1817
|
function RlsPickerMonth({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme, year }) {
|
|
1537
1818
|
const currentDate = date || new Date();
|
|
1538
|
-
const [months, setMonths] =
|
|
1539
|
-
const [value, setValue] =
|
|
1540
|
-
|
|
1819
|
+
const [months, setMonths] = require$$0.useState([]);
|
|
1820
|
+
const [value, setValue] = require$$0.useState(formControl?.value || currentDate.getMonth());
|
|
1821
|
+
require$$0.useEffect(() => {
|
|
1541
1822
|
const props = createPickerProps(); // MonthPickerProps
|
|
1542
|
-
const month = checkMonthPicker(props);
|
|
1543
|
-
month ? setMonthValue(month) : setMonths(createMonthPicker(props));
|
|
1823
|
+
const month = components.checkMonthPicker(props);
|
|
1824
|
+
month ? setMonthValue(month) : setMonths(components.createMonthPicker(props));
|
|
1544
1825
|
}, [date, year, value, minDate, maxDate]);
|
|
1545
|
-
|
|
1546
|
-
const month = checkMonthPicker(createPickerProps());
|
|
1547
|
-
itIsDefined(month)
|
|
1548
|
-
? formControl?.
|
|
1549
|
-
: setValue(formControl?.
|
|
1550
|
-
}, [formControl?.
|
|
1826
|
+
require$$0.useEffect(() => {
|
|
1827
|
+
const month = components.checkMonthPicker(createPickerProps());
|
|
1828
|
+
commons.itIsDefined(month)
|
|
1829
|
+
? formControl?.setValue(month)
|
|
1830
|
+
: setValue(formControl?.value || currentDate.getMonth());
|
|
1831
|
+
}, [formControl?.value]);
|
|
1551
1832
|
function createPickerProps() {
|
|
1552
1833
|
return {
|
|
1553
1834
|
date: currentDate,
|
|
1554
|
-
month: itIsDefined(formControl?.
|
|
1835
|
+
month: commons.itIsDefined(formControl?.value) ? formControl?.value : value,
|
|
1555
1836
|
year: year || currentDate.getFullYear(),
|
|
1556
1837
|
minDate,
|
|
1557
1838
|
maxDate
|
|
1558
1839
|
};
|
|
1559
1840
|
}
|
|
1560
1841
|
function setMonthValue(value) {
|
|
1561
|
-
formControl ? formControl.
|
|
1842
|
+
formControl ? formControl.setValue(value) : setValue(value);
|
|
1562
1843
|
}
|
|
1563
1844
|
function onChange(value) {
|
|
1564
1845
|
setMonthValue(value);
|
|
@@ -1566,80 +1847,80 @@ function RlsPickerMonth({ date, disabled: disabledPicker, formControl, maxDate,
|
|
|
1566
1847
|
onValue(value);
|
|
1567
1848
|
}
|
|
1568
1849
|
}
|
|
1569
|
-
return (
|
|
1850
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-month", "rls-theme": rlsTheme, children: months.map(({ label, value, disabled, focused, selected }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-month__component', {
|
|
1570
1851
|
disabled: disabled || disabledPicker,
|
|
1571
1852
|
focused,
|
|
1572
1853
|
selected
|
|
1573
|
-
}), onClick: !(disabled || disabledPicker) ? () => onChange(value) : undefined, children:
|
|
1854
|
+
}), onClick: !(disabled || disabledPicker) ? () => onChange(value) : undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-month__span", children: label }) }, index))) }));
|
|
1574
1855
|
}
|
|
1575
1856
|
|
|
1576
1857
|
function RlsPickerMonthTitle({ monthControl, type, yearControl, date, disabled, maxDate, minDate, onClick }) {
|
|
1577
|
-
const { limitNext, limitPrevious } = monthLimitTemplate({
|
|
1858
|
+
const { limitNext, limitPrevious } = components.monthLimitTemplate({
|
|
1578
1859
|
date,
|
|
1579
1860
|
maxDate,
|
|
1580
1861
|
minDate,
|
|
1581
|
-
month: monthControl.
|
|
1862
|
+
month: monthControl.value
|
|
1582
1863
|
});
|
|
1583
|
-
const monthName = MONTH_NAMES()[monthControl.
|
|
1864
|
+
const monthName = dates.MONTH_NAMES()[monthControl.value || 0];
|
|
1584
1865
|
function onPreviousMonth() {
|
|
1585
|
-
if (itIsDefined(monthControl.
|
|
1586
|
-
if (monthControl.
|
|
1587
|
-
monthControl.
|
|
1866
|
+
if (commons.itIsDefined(monthControl.value) && commons.itIsDefined(yearControl.value)) {
|
|
1867
|
+
if (monthControl.value > dates.Month.January) {
|
|
1868
|
+
monthControl.setValue(monthControl.value - 1);
|
|
1588
1869
|
}
|
|
1589
1870
|
else {
|
|
1590
|
-
monthControl.
|
|
1591
|
-
yearControl.
|
|
1871
|
+
monthControl.setValue(dates.Month.December);
|
|
1872
|
+
yearControl.setValue(yearControl.value - 1);
|
|
1592
1873
|
}
|
|
1593
1874
|
}
|
|
1594
1875
|
}
|
|
1595
1876
|
function onPreviousYear() {
|
|
1596
|
-
if (itIsDefined(yearControl.
|
|
1597
|
-
yearControl.
|
|
1877
|
+
if (commons.itIsDefined(yearControl.value)) {
|
|
1878
|
+
yearControl.setValue(yearControl.value - 1);
|
|
1598
1879
|
}
|
|
1599
1880
|
}
|
|
1600
1881
|
function onPrevious() {
|
|
1601
1882
|
type === 'month' ? onPreviousMonth() : onPreviousYear();
|
|
1602
1883
|
}
|
|
1603
1884
|
function onNextMonth() {
|
|
1604
|
-
if (itIsDefined(monthControl.
|
|
1605
|
-
if (monthControl.
|
|
1606
|
-
monthControl.
|
|
1885
|
+
if (commons.itIsDefined(monthControl.value) && commons.itIsDefined(yearControl.value)) {
|
|
1886
|
+
if (monthControl.value < dates.Month.December) {
|
|
1887
|
+
monthControl.setValue(monthControl.value + 1);
|
|
1607
1888
|
}
|
|
1608
1889
|
else {
|
|
1609
|
-
monthControl.
|
|
1610
|
-
yearControl.
|
|
1890
|
+
monthControl.setValue(dates.Month.January);
|
|
1891
|
+
yearControl.setValue(yearControl.value + 1);
|
|
1611
1892
|
}
|
|
1612
1893
|
}
|
|
1613
1894
|
}
|
|
1614
1895
|
function onNextYear() {
|
|
1615
|
-
if (itIsDefined(yearControl.
|
|
1616
|
-
yearControl.
|
|
1896
|
+
if (commons.itIsDefined(yearControl.value)) {
|
|
1897
|
+
yearControl.setValue(yearControl.value + 1);
|
|
1617
1898
|
}
|
|
1618
1899
|
}
|
|
1619
1900
|
function onNext() {
|
|
1620
1901
|
type === 'month' ? onNextMonth() : onNextYear();
|
|
1621
1902
|
}
|
|
1622
|
-
return (
|
|
1903
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-month-title", children: [jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onPrevious, disabled: limitPrevious || disabled }), jsxRuntimeExports.jsx("span", { onClick: onClick, children: monthName }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onNext, disabled: limitNext || disabled })] }));
|
|
1623
1904
|
}
|
|
1624
1905
|
|
|
1625
1906
|
function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme }) {
|
|
1626
1907
|
const currentDate = date || new Date();
|
|
1627
|
-
const [value, setValue] =
|
|
1628
|
-
const [year, setYear] =
|
|
1629
|
-
const [template, setTemplate] =
|
|
1630
|
-
|
|
1908
|
+
const [value, setValue] = require$$0.useState(formControl?.value || currentDate.getFullYear());
|
|
1909
|
+
const [year, setYear] = require$$0.useState(formControl?.value || currentDate.getFullYear());
|
|
1910
|
+
const [template, setTemplate] = require$$0.useState(components.createYearPicker(createPickerProps()));
|
|
1911
|
+
require$$0.useEffect(() => {
|
|
1631
1912
|
const props = createPickerProps(); // YearPickerProps
|
|
1632
|
-
const year = checkYearPicker(props);
|
|
1913
|
+
const year = components.checkYearPicker(props);
|
|
1633
1914
|
year
|
|
1634
1915
|
? setYearValue(year)
|
|
1635
|
-
: setTemplate(createYearPicker(createPickerProps()));
|
|
1916
|
+
: setTemplate(components.createYearPicker(createPickerProps()));
|
|
1636
1917
|
}, [date, year, value, minDate, maxDate]);
|
|
1637
|
-
|
|
1638
|
-
const year = checkYearPicker(createPickerProps());
|
|
1639
|
-
itIsDefined(year)
|
|
1640
|
-
? formControl?.
|
|
1641
|
-
: setValue(formControl?.
|
|
1642
|
-
}, [formControl?.
|
|
1918
|
+
require$$0.useEffect(() => {
|
|
1919
|
+
const year = components.checkYearPicker(createPickerProps());
|
|
1920
|
+
commons.itIsDefined(year)
|
|
1921
|
+
? formControl?.setValue(year)
|
|
1922
|
+
: setValue(formControl?.value || currentDate.getFullYear());
|
|
1923
|
+
}, [formControl?.value]);
|
|
1643
1924
|
function createPickerProps() {
|
|
1644
1925
|
return {
|
|
1645
1926
|
date: currentDate,
|
|
@@ -1649,7 +1930,7 @@ function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, m
|
|
|
1649
1930
|
};
|
|
1650
1931
|
}
|
|
1651
1932
|
function setYearValue(value) {
|
|
1652
|
-
formControl ? formControl.
|
|
1933
|
+
formControl ? formControl.setValue(value) : setValue(value);
|
|
1653
1934
|
setYear(value);
|
|
1654
1935
|
}
|
|
1655
1936
|
function onClickPrev() {
|
|
@@ -1664,19 +1945,19 @@ function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, m
|
|
|
1664
1945
|
onValue(value);
|
|
1665
1946
|
}
|
|
1666
1947
|
}
|
|
1667
|
-
return (
|
|
1948
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-year", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-year__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-year__action rls-picker-year__action--prev", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onClickPrev, disabled: !template.canPrevious || disabledPicker }) }), jsxRuntimeExports.jsxs("label", { className: "rls-title-bold", children: [template.minRange, " - ", template.maxRange] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__action rls-picker-year__action--next", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onClickNext, disabled: !template.canNext || disabledPicker }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__component", children: template.years.map(({ value, disabled, focused, selected }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-year__year', {
|
|
1668
1949
|
disabled: disabled || disabledPicker,
|
|
1669
1950
|
focused,
|
|
1670
1951
|
selected
|
|
1671
|
-
}), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children:
|
|
1952
|
+
}), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-year__year__span rls-body1-medium", children: value || '????' }) }, index))) })] }));
|
|
1672
1953
|
}
|
|
1673
1954
|
|
|
1674
1955
|
function RlsToolbar({ actions, children, subtitle }) {
|
|
1675
|
-
return (
|
|
1956
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-toolbar", children: [jsxRuntimeExports.jsxs("div", { className: "rls-toolbar__description", children: [children && jsxRuntimeExports.jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsxRuntimeExports.jsx("label", { className: "rls-toolbar__subtitle smalltext-semibold", children: subtitle }))] }), actions && (jsxRuntimeExports.jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsxRuntimeExports.jsx("div", { children: action }, index))) }))] }));
|
|
1676
1957
|
}
|
|
1677
1958
|
|
|
1678
1959
|
function RlsCard({ children, outline, rlsTheme }) {
|
|
1679
|
-
return (
|
|
1960
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-card', { outline }), "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-card__content", children: children }) }));
|
|
1680
1961
|
}
|
|
1681
1962
|
|
|
1682
1963
|
const reactI18n = i18n.i18n({
|
|
@@ -1700,7 +1981,7 @@ const reactI18n = i18n.i18n({
|
|
|
1700
1981
|
}
|
|
1701
1982
|
});
|
|
1702
1983
|
|
|
1703
|
-
class ConfirmationResult extends PartialSealed {
|
|
1984
|
+
class ConfirmationResult extends commons.PartialSealed {
|
|
1704
1985
|
static approved() {
|
|
1705
1986
|
return new ConfirmationResult('approved');
|
|
1706
1987
|
}
|
|
@@ -1709,12 +1990,12 @@ class ConfirmationResult extends PartialSealed {
|
|
|
1709
1990
|
}
|
|
1710
1991
|
}
|
|
1711
1992
|
function RlsConfirmation({ approved, content, reject, rlsTheme, subtitle, title, visible }) {
|
|
1712
|
-
return (
|
|
1993
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-confirmation', { visible }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__component", children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__header", children: [title && jsxRuntimeExports.jsx("div", { className: "rls-confirmation__title", children: title }), subtitle && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__subtitle", children: subtitle }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__body", children: content && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__message", children: content })) }), (approved || reject) && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__actions", children: [approved && (jsxRuntimeExports.jsx(RlsButton, { type: "raised", onClick: approved.onClick, children: approved.label })), reject && (jsxRuntimeExports.jsx(RlsButton, { type: "outline", onClick: reject.onClick, children: reject.label }))] }) }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__backdrop" })] }));
|
|
1713
1994
|
}
|
|
1714
1995
|
function useConfirmationService() {
|
|
1715
|
-
const [config, setConfig] =
|
|
1716
|
-
const [visible, setVisible] =
|
|
1717
|
-
const rlsConfirmation = ReactDOM.createPortal(
|
|
1996
|
+
const [config, setConfig] = require$$0.useState({});
|
|
1997
|
+
const [visible, setVisible] = require$$0.useState(false);
|
|
1998
|
+
const rlsConfirmation = ReactDOM.createPortal(jsxRuntimeExports.jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
|
|
1718
1999
|
function confirmation(config) {
|
|
1719
2000
|
return new Promise((resolve) => {
|
|
1720
2001
|
const { content, rlsTheme, subtitle, title, approved, reject } = config;
|
|
@@ -1750,33 +2031,33 @@ function useConfirmationService() {
|
|
|
1750
2031
|
}
|
|
1751
2032
|
|
|
1752
2033
|
function RlsDatatableHeader({ children }) {
|
|
1753
|
-
return
|
|
2034
|
+
return jsxRuntimeExports.jsx("tr", { className: "rls-datatable__header", children: children });
|
|
1754
2035
|
}
|
|
1755
2036
|
function RlsDatatableTitle({ children, className, control }) {
|
|
1756
|
-
return (
|
|
2037
|
+
return (jsxRuntimeExports.jsx("th", { className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
|
|
1757
2038
|
}
|
|
1758
2039
|
function RlsDatatableData({ children, className, error }) {
|
|
1759
|
-
return (
|
|
2040
|
+
return (jsxRuntimeExports.jsx("tr", { className: renderClassStatus('rls-datatable__data', { error }, className).trim(), children: children }));
|
|
1760
2041
|
}
|
|
1761
2042
|
function RlsDatatableCell({ children, className, control, overflow }) {
|
|
1762
|
-
return (
|
|
2043
|
+
return (jsxRuntimeExports.jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
|
|
1763
2044
|
}
|
|
1764
2045
|
function RlsDatatableTotals({ children, className, error }) {
|
|
1765
|
-
return (
|
|
2046
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-datatable__totals', { error }, className).trim(), children: children }));
|
|
1766
2047
|
}
|
|
1767
2048
|
function RlsDatatableInfo({ children, className, control, overflow }) {
|
|
1768
|
-
return (
|
|
2049
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-datatable__info', { control, overflow }, className).trim(), children: children }));
|
|
1769
2050
|
}
|
|
1770
2051
|
function RlsDatatable({ children, datatable, footer, header, rlsTheme, summary }) {
|
|
1771
|
-
return (
|
|
2052
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-datatable', {
|
|
1772
2053
|
scrolleable: datatable?.scrolleable
|
|
1773
|
-
}), "rls-theme": rlsTheme, children: [
|
|
2054
|
+
}), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("table", { children: [header && jsxRuntimeExports.jsx("thead", { className: "rls-datatable__thead", children: header }), jsxRuntimeExports.jsx("tbody", { ref: datatable?.bodyRef, className: "rls-datatable__tbody", children: children })] }), summary && jsxRuntimeExports.jsx("div", { className: "rls-datatable__tsummary", children: summary }), footer && jsxRuntimeExports.jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
|
|
1774
2055
|
}
|
|
1775
2056
|
|
|
1776
2057
|
function useDatatable() {
|
|
1777
|
-
const [scrolleable, setScrolleable] =
|
|
1778
|
-
const bodyRef =
|
|
1779
|
-
|
|
2058
|
+
const [scrolleable, setScrolleable] = require$$0.useState(false);
|
|
2059
|
+
const bodyRef = require$$0.useRef(null);
|
|
2060
|
+
require$$0.useEffect(() => {
|
|
1780
2061
|
let observer;
|
|
1781
2062
|
const body = bodyRef?.current;
|
|
1782
2063
|
if (body) {
|
|
@@ -1795,21 +2076,21 @@ function useDatatable() {
|
|
|
1795
2076
|
}
|
|
1796
2077
|
|
|
1797
2078
|
function useListControl({ suggestions, formControl }) {
|
|
1798
|
-
const
|
|
1799
|
-
const listRef =
|
|
1800
|
-
const inputRef =
|
|
1801
|
-
const [
|
|
1802
|
-
collection: new ListCollection([]),
|
|
2079
|
+
const contentRef = require$$0.useRef(null);
|
|
2080
|
+
const listRef = require$$0.useRef(null);
|
|
2081
|
+
const inputRef = require$$0.useRef(null);
|
|
2082
|
+
const [state, setState] = require$$0.useState({
|
|
2083
|
+
collection: new components.ListCollection([]),
|
|
1803
2084
|
focused: false,
|
|
1804
2085
|
higher: false,
|
|
1805
2086
|
value: '',
|
|
1806
2087
|
visible: false
|
|
1807
2088
|
});
|
|
1808
|
-
const position =
|
|
1809
|
-
|
|
2089
|
+
const position = require$$0.useRef(0);
|
|
2090
|
+
require$$0.useEffect(() => {
|
|
1810
2091
|
function onCloseSuggestions({ target }) {
|
|
1811
|
-
if (!
|
|
1812
|
-
|
|
2092
|
+
if (!contentRef?.current?.contains(target)) {
|
|
2093
|
+
setState((state) => ({ ...state, visible: false }));
|
|
1813
2094
|
}
|
|
1814
2095
|
}
|
|
1815
2096
|
document.addEventListener('click', onCloseSuggestions);
|
|
@@ -1817,52 +2098,52 @@ function useListControl({ suggestions, formControl }) {
|
|
|
1817
2098
|
document.removeEventListener('click', onCloseSuggestions);
|
|
1818
2099
|
};
|
|
1819
2100
|
}, []);
|
|
1820
|
-
|
|
1821
|
-
const
|
|
2101
|
+
require$$0.useEffect(() => {
|
|
2102
|
+
const content = contentRef.current;
|
|
1822
2103
|
const list = listRef.current;
|
|
1823
2104
|
formControl?.touch();
|
|
1824
|
-
|
|
2105
|
+
setState((state) => ({
|
|
1825
2106
|
...state,
|
|
1826
|
-
higher:
|
|
2107
|
+
higher: components.locationListCanTop(content, list)
|
|
1827
2108
|
}));
|
|
1828
|
-
}, [
|
|
1829
|
-
|
|
1830
|
-
|
|
2109
|
+
}, [state.visible]);
|
|
2110
|
+
require$$0.useEffect(() => {
|
|
2111
|
+
setState((state) => ({
|
|
1831
2112
|
...state,
|
|
1832
|
-
collection: new ListCollection(suggestions)
|
|
2113
|
+
collection: new components.ListCollection(suggestions)
|
|
1833
2114
|
}));
|
|
1834
2115
|
}, [suggestions]);
|
|
1835
2116
|
function setFocused(focused) {
|
|
1836
|
-
|
|
2117
|
+
setState((state) => ({ ...state, focused }));
|
|
1837
2118
|
}
|
|
1838
2119
|
function setValue(value) {
|
|
1839
|
-
|
|
2120
|
+
setState((state) => ({ ...state, value }));
|
|
1840
2121
|
}
|
|
1841
2122
|
function setVisible(visible) {
|
|
1842
|
-
|
|
2123
|
+
setState((state) => ({ ...state, visible }));
|
|
1843
2124
|
}
|
|
1844
2125
|
function navigationInput(event) {
|
|
1845
|
-
if (
|
|
1846
|
-
const newPosition =
|
|
1847
|
-
|
|
2126
|
+
if (state.visible) {
|
|
2127
|
+
const newPosition = components.navigationListFromInput({
|
|
2128
|
+
content: contentRef.current,
|
|
1848
2129
|
event: event,
|
|
1849
|
-
|
|
2130
|
+
list: listRef.current
|
|
1850
2131
|
});
|
|
1851
2132
|
position.current = newPosition || 0;
|
|
1852
2133
|
}
|
|
1853
2134
|
}
|
|
1854
2135
|
function navigationElement(event) {
|
|
1855
|
-
position.current =
|
|
1856
|
-
|
|
2136
|
+
position.current = components.navigationListFromElement({
|
|
2137
|
+
content: contentRef.current,
|
|
1857
2138
|
event: event,
|
|
1858
|
-
|
|
1859
|
-
|
|
2139
|
+
input: inputRef.current,
|
|
2140
|
+
list: listRef.current,
|
|
1860
2141
|
position: position.current
|
|
1861
2142
|
});
|
|
1862
2143
|
}
|
|
1863
2144
|
return {
|
|
1864
|
-
...
|
|
1865
|
-
|
|
2145
|
+
...state,
|
|
2146
|
+
contentRef,
|
|
1866
2147
|
inputRef,
|
|
1867
2148
|
listRef,
|
|
1868
2149
|
navigationElement,
|
|
@@ -1876,25 +2157,25 @@ function useListControl({ suggestions, formControl }) {
|
|
|
1876
2157
|
const DURATION_ANIMATION$1 = 240;
|
|
1877
2158
|
const MAX_ELEMENTS = 6;
|
|
1878
2159
|
function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, suggestions }) {
|
|
1879
|
-
const [pattern, setPattern] =
|
|
1880
|
-
const [coincidences, setCoincidences] =
|
|
1881
|
-
const currentStore =
|
|
2160
|
+
const [pattern, setPattern] = require$$0.useState('');
|
|
2161
|
+
const [coincidences, setCoincidences] = require$$0.useState([]);
|
|
2162
|
+
const currentStore = require$$0.useRef({
|
|
1882
2163
|
pattern: '',
|
|
1883
2164
|
coincidences: [],
|
|
1884
2165
|
previous: null
|
|
1885
2166
|
});
|
|
1886
2167
|
const listControl = useListControl({ suggestions, formControl });
|
|
1887
2168
|
const { collection, inputRef, navigationElement, navigationInput, setFocused, setValue, setVisible } = listControl;
|
|
1888
|
-
const initializedState =
|
|
1889
|
-
const initializedCollection =
|
|
1890
|
-
const changeInternal =
|
|
1891
|
-
|
|
2169
|
+
const initializedState = require$$0.useRef(false);
|
|
2170
|
+
const initializedCollection = require$$0.useRef(false);
|
|
2171
|
+
const changeInternal = require$$0.useRef(false);
|
|
2172
|
+
require$$0.useEffect(() => {
|
|
1892
2173
|
refreshCoincidences(pattern, true);
|
|
1893
2174
|
}, [suggestions]);
|
|
1894
|
-
|
|
2175
|
+
require$$0.useEffect(() => {
|
|
1895
2176
|
refreshCoincidences(pattern);
|
|
1896
2177
|
}, [pattern]);
|
|
1897
|
-
|
|
2178
|
+
require$$0.useEffect(() => {
|
|
1898
2179
|
if (!initializedState.current || !initializedCollection.current) {
|
|
1899
2180
|
initializedState.current = true;
|
|
1900
2181
|
return;
|
|
@@ -1903,14 +2184,14 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
|
|
|
1903
2184
|
changeInternal.current = false;
|
|
1904
2185
|
return;
|
|
1905
2186
|
}
|
|
1906
|
-
refresh(collection, formControl?.
|
|
1907
|
-
}, [formControl?.
|
|
1908
|
-
|
|
2187
|
+
refresh(collection, formControl?.value);
|
|
2188
|
+
}, [formControl?.value]);
|
|
2189
|
+
require$$0.useEffect(() => {
|
|
1909
2190
|
if (!initializedCollection.current || !initializedState.current) {
|
|
1910
2191
|
initializedCollection.current = true;
|
|
1911
2192
|
return;
|
|
1912
2193
|
}
|
|
1913
|
-
refresh(collection, formControl?.
|
|
2194
|
+
refresh(collection, formControl?.value);
|
|
1914
2195
|
}, [collection]);
|
|
1915
2196
|
function refresh(collection, state) {
|
|
1916
2197
|
if (!state) {
|
|
@@ -1926,7 +2207,7 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
|
|
|
1926
2207
|
function setFormState(value) {
|
|
1927
2208
|
if (formControl) {
|
|
1928
2209
|
changeInternal.current = true;
|
|
1929
|
-
formControl.
|
|
2210
|
+
formControl.setValue(value);
|
|
1930
2211
|
}
|
|
1931
2212
|
}
|
|
1932
2213
|
function onClickControl() {
|
|
@@ -1989,7 +2270,7 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
|
|
|
1989
2270
|
}
|
|
1990
2271
|
}
|
|
1991
2272
|
function refreshCoincidences(pattern, reboot = false) {
|
|
1992
|
-
const { collection, store } =
|
|
2273
|
+
const { collection, store } = components.createAutocompleteStore({
|
|
1993
2274
|
pattern,
|
|
1994
2275
|
suggestions,
|
|
1995
2276
|
reboot,
|
|
@@ -2014,175 +2295,77 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
|
|
|
2014
2295
|
};
|
|
2015
2296
|
}
|
|
2016
2297
|
|
|
2017
|
-
function RlsFieldAutocompleteTemplate({ suggestions, children, disabled, formControl, hiddenIcon,
|
|
2018
|
-
const
|
|
2298
|
+
function RlsFieldAutocompleteTemplate({ render, suggestions, children, disabled, formControl, hiddenIcon, onSearch, onSelect, onValue, placeholder, rlsTheme, searching }) {
|
|
2299
|
+
const fieldAutocomplete = useFieldAutocomplete({
|
|
2019
2300
|
suggestions,
|
|
2020
2301
|
disabled,
|
|
2021
2302
|
formControl,
|
|
2022
2303
|
onSelect,
|
|
2023
2304
|
onValue
|
|
2024
2305
|
});
|
|
2025
|
-
return (
|
|
2306
|
+
return (jsxRuntimeExports.jsxs("div", { ref: fieldAutocomplete.listControl.contentRef, className: renderClassStatus('rls-field-box', {
|
|
2026
2307
|
disabled,
|
|
2027
|
-
focused: listControl.focused,
|
|
2028
|
-
selected: !!listControl.value
|
|
2029
|
-
}, 'rls-field-list rls-field-autocomplete'), "rls-theme": rlsTheme, children: [children &&
|
|
2030
|
-
visible: listControl.visible,
|
|
2031
|
-
hide: !listControl.visible,
|
|
2032
|
-
higher: listControl.higher
|
|
2033
|
-
}), children: [
|
|
2034
|
-
setPattern(value);
|
|
2035
|
-
}, disabled: disabled || searching, onFocus: onFocusInput, onBlur: onBlurInput, onKeyDown: onKeydownInput }), onSearch && (
|
|
2036
|
-
onSearch(pattern);
|
|
2037
|
-
}, children:
|
|
2308
|
+
focused: fieldAutocomplete.listControl.focused,
|
|
2309
|
+
selected: !!fieldAutocomplete.listControl.value
|
|
2310
|
+
}, 'rls-field-list rls-field-autocomplete'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("label", { className: "rls-field-list__control", onClick: fieldAutocomplete.onClickControl, children: fieldAutocomplete.listControl.value ? (jsxRuntimeExports.jsx("span", { className: "rls-field-list__control__description", children: fieldAutocomplete.listControl.value })) : (jsxRuntimeExports.jsx("span", { className: "rls-field-list__control__placeholder", children: placeholder })) }), !hiddenIcon && fieldAutocomplete.listControl.value && (jsxRuntimeExports.jsx("button", { className: "rls-field-list__action", disabled: disabled, onClick: fieldAutocomplete.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: "trash-2" }) }))] }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
|
|
2311
|
+
visible: fieldAutocomplete.listControl.visible,
|
|
2312
|
+
hide: !fieldAutocomplete.listControl.visible,
|
|
2313
|
+
higher: fieldAutocomplete.listControl.higher
|
|
2314
|
+
}), children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: fieldAutocomplete.listControl.listRef, className: "rls-field-list__ul", children: [jsxRuntimeExports.jsxs("div", { className: "rls-field-list__ul__search", children: [jsxRuntimeExports.jsx("input", { ref: fieldAutocomplete.listControl.inputRef, className: "rls-field-list__ul__control", type: "text", placeholder: reactI18n('listInputPlaceholder'), value: fieldAutocomplete.pattern, onChange: ({ target: { value } }) => {
|
|
2315
|
+
fieldAutocomplete.setPattern(value);
|
|
2316
|
+
}, disabled: disabled || searching, onFocus: fieldAutocomplete.onFocusInput, onBlur: fieldAutocomplete.onBlurInput, onKeyDown: fieldAutocomplete.onKeydownInput }), onSearch && (jsxRuntimeExports.jsx("button", { disabled: disabled || searching, onClick: () => {
|
|
2317
|
+
onSearch(fieldAutocomplete.pattern);
|
|
2318
|
+
}, children: jsxRuntimeExports.jsx(RlsIcon, { value: "search" }) }))] }), searching && jsxRuntimeExports.jsx(RlsProgressBar, { indeterminate: true }), fieldAutocomplete.coincidences.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: fieldAutocomplete.onClickElement(element), onKeyDown: fieldAutocomplete.onKeydownElement(element), children: render(element) }, index))), !fieldAutocomplete.coincidences.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold truncate", children: reactI18n('listEmptyTitle') }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: reactI18n('listEmptyDescription') })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: fieldAutocomplete.onClickBackdrop })] })] }));
|
|
2038
2319
|
}
|
|
2039
2320
|
function RlsFieldAutocomplete(props) {
|
|
2040
|
-
return (
|
|
2321
|
+
return (jsxRuntimeExports.jsx(RlsFieldAutocompleteTemplate, { ...props, render: (element) => (jsxRuntimeExports.jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
|
|
2041
2322
|
}
|
|
2042
2323
|
|
|
2324
|
+
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
2325
|
+
|
|
2043
2326
|
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
2044
|
-
const minFormat = dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
2045
|
-
const maxFormat = dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
2327
|
+
const minFormat = dates.dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
2328
|
+
const maxFormat = dates.dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
2046
2329
|
return `${minFormat} - ${maxFormat}`;
|
|
2047
2330
|
}
|
|
2048
2331
|
|
|
2049
2332
|
function RlsModal({ children, visible, rlsTheme }) {
|
|
2050
|
-
return ReactDOM.createPortal(
|
|
2051
|
-
}
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
return (typeof props === 'object' && ('state' in props || 'validators' in props));
|
|
2055
|
-
}
|
|
2056
|
-
function createFormControlOptions(...argsProps) {
|
|
2057
|
-
const [props, validators] = argsProps;
|
|
2058
|
-
if (!props) {
|
|
2059
|
-
return { state: props, validators };
|
|
2060
|
-
}
|
|
2061
|
-
if (!validators && itIsFormControlOptions(props)) {
|
|
2062
|
-
return props;
|
|
2063
|
-
}
|
|
2064
|
-
return {
|
|
2065
|
-
state: props,
|
|
2066
|
-
validators
|
|
2067
|
-
};
|
|
2068
|
-
}
|
|
2069
|
-
|
|
2070
|
-
const controlIsValid = ({ state, validators }) => {
|
|
2071
|
-
return validators.reduce((errors, validator) => {
|
|
2072
|
-
const error = validator(state);
|
|
2073
|
-
if (error) {
|
|
2074
|
-
errors.push(error);
|
|
2075
|
-
}
|
|
2076
|
-
return errors;
|
|
2077
|
-
}, []);
|
|
2078
|
-
};
|
|
2079
|
-
|
|
2080
|
-
function useControl(controlOptions, controlValidators) {
|
|
2081
|
-
const { state, touched, validators } = createFormControlOptions(controlOptions, controlValidators);
|
|
2082
|
-
const [controlState, setControlState] = react.useState({
|
|
2083
|
-
dirty: false,
|
|
2084
|
-
disabled: false,
|
|
2085
|
-
focused: false,
|
|
2086
|
-
state: state,
|
|
2087
|
-
touched: !!touched,
|
|
2088
|
-
validators: validators
|
|
2089
|
-
});
|
|
2090
|
-
const initialState = react.useRef(state);
|
|
2091
|
-
const elementRef = react.useRef(null);
|
|
2092
|
-
const errors = validators ? controlIsValid({ state, validators }) : [];
|
|
2093
|
-
const valid = errors.length === 0;
|
|
2094
|
-
function focus() {
|
|
2095
|
-
setControlState((state) => ({ ...state, focused: true }));
|
|
2096
|
-
}
|
|
2097
|
-
function blur() {
|
|
2098
|
-
setControlState((state) => ({ ...state, focused: false, touched: true }));
|
|
2099
|
-
}
|
|
2100
|
-
function disable() {
|
|
2101
|
-
setControlState((state) => ({ ...state, disabled: true }));
|
|
2102
|
-
}
|
|
2103
|
-
function enable() {
|
|
2104
|
-
setControlState((state) => ({ ...state, disabled: false }));
|
|
2105
|
-
}
|
|
2106
|
-
function touch() {
|
|
2107
|
-
setControlState((state) => ({ ...state, touched: true }));
|
|
2108
|
-
}
|
|
2109
|
-
function setState(state) {
|
|
2110
|
-
setControlState((currentState) => ({
|
|
2111
|
-
...currentState,
|
|
2112
|
-
dirty: true,
|
|
2113
|
-
state
|
|
2114
|
-
}));
|
|
2115
|
-
}
|
|
2116
|
-
function setValidators(validators) {
|
|
2117
|
-
setControlState((state) => ({ ...state, validators }));
|
|
2118
|
-
}
|
|
2119
|
-
function reset() {
|
|
2120
|
-
setControlState((currentState) => ({
|
|
2121
|
-
...currentState,
|
|
2122
|
-
dirty: false,
|
|
2123
|
-
state: initialState.current,
|
|
2124
|
-
touched: false
|
|
2125
|
-
}));
|
|
2126
|
-
}
|
|
2127
|
-
return {
|
|
2128
|
-
...controlState,
|
|
2129
|
-
blur,
|
|
2130
|
-
disable,
|
|
2131
|
-
elementRef,
|
|
2132
|
-
enable,
|
|
2133
|
-
enabled: !controlState.disabled,
|
|
2134
|
-
error: errors[0],
|
|
2135
|
-
errors,
|
|
2136
|
-
focus,
|
|
2137
|
-
invalid: !valid,
|
|
2138
|
-
pristine: !controlState.dirty,
|
|
2139
|
-
reset,
|
|
2140
|
-
setState,
|
|
2141
|
-
setValidators,
|
|
2142
|
-
touch,
|
|
2143
|
-
unfocused: !controlState.focused,
|
|
2144
|
-
untouched: !controlState.touched,
|
|
2145
|
-
valid,
|
|
2146
|
-
wrong: controlState.touched && !valid
|
|
2147
|
-
};
|
|
2148
|
-
}
|
|
2149
|
-
function useReactControl(options, validators) {
|
|
2150
|
-
return useControl(options, validators);
|
|
2151
|
-
}
|
|
2152
|
-
|
|
2153
|
-
const FORMAT_DESCRIPTION = '{dw}, {mx} {dd} de {aa}';
|
|
2333
|
+
return ReactDOM.createPortal(jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-modal', { visible }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-modal__component", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-modal__backdrop" })] }), document.body);
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
const FORMAT_TITLE = '{dw}, {mx} {dd} de {aa}';
|
|
2154
2337
|
function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
2155
2338
|
const today = new Date(); // Initial current date in component
|
|
2156
|
-
const dateInitial = formControl?.
|
|
2157
|
-
const yearControl = useReactControl(dateInitial.getFullYear());
|
|
2158
|
-
const dayControl = useReactControl(dateInitial.getDate());
|
|
2159
|
-
const monthControl = useReactControl(dateInitial.getMonth());
|
|
2160
|
-
const [value, setValue] =
|
|
2161
|
-
const [visibility, setVisibility] =
|
|
2162
|
-
|
|
2163
|
-
const dateCheck = checkDateRange({
|
|
2164
|
-
date: formControl?.
|
|
2339
|
+
const dateInitial = formControl?.value || date || today;
|
|
2340
|
+
const yearControl = reactForms.useReactControl(dateInitial.getFullYear());
|
|
2341
|
+
const dayControl = reactForms.useReactControl(dateInitial.getDate());
|
|
2342
|
+
const monthControl = reactForms.useReactControl(dateInitial.getMonth());
|
|
2343
|
+
const [value, setValue] = require$$0.useState(dateInitial);
|
|
2344
|
+
const [visibility, setVisibility] = require$$0.useState('DAY');
|
|
2345
|
+
require$$0.useEffect(() => {
|
|
2346
|
+
const dateCheck = components.checkDateRange({
|
|
2347
|
+
date: formControl?.value || date || today,
|
|
2165
2348
|
minDate,
|
|
2166
2349
|
maxDate
|
|
2167
2350
|
});
|
|
2168
2351
|
setValue(dateCheck);
|
|
2169
|
-
formControl?.
|
|
2352
|
+
formControl?.setValue(dateCheck);
|
|
2170
2353
|
}, []);
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
}, [yearControl.
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
}, [monthControl.
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
}, [dayControl.
|
|
2354
|
+
require$$0.useEffect(() => {
|
|
2355
|
+
if (commons.itIsDefined(yearControl.value)) {
|
|
2356
|
+
setValue(dates.assignYearInDate(value, yearControl.value));
|
|
2357
|
+
}
|
|
2358
|
+
}, [yearControl.value]);
|
|
2359
|
+
require$$0.useEffect(() => {
|
|
2360
|
+
if (commons.itIsDefined(monthControl.value)) {
|
|
2361
|
+
setValue(dates.assignMonthInDate(value, monthControl.value));
|
|
2362
|
+
}
|
|
2363
|
+
}, [monthControl.value]);
|
|
2364
|
+
require$$0.useEffect(() => {
|
|
2365
|
+
if (commons.itIsDefined(dayControl.value)) {
|
|
2366
|
+
setValue(dates.assignDayInDate(value, dayControl.value));
|
|
2367
|
+
}
|
|
2368
|
+
}, [dayControl.value]);
|
|
2186
2369
|
function onVisibilityDay() {
|
|
2187
2370
|
setVisibility('DAY');
|
|
2188
2371
|
}
|
|
@@ -2194,58 +2377,57 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
2194
2377
|
}
|
|
2195
2378
|
function onCancel() {
|
|
2196
2379
|
if (onListener) {
|
|
2197
|
-
onListener({ type: PickerListenerType.Cancel });
|
|
2380
|
+
onListener({ type: components.PickerListenerType.Cancel });
|
|
2198
2381
|
}
|
|
2199
2382
|
}
|
|
2200
2383
|
function onToday() {
|
|
2201
|
-
yearControl.
|
|
2202
|
-
dayControl.
|
|
2203
|
-
monthControl.
|
|
2204
|
-
formControl?.
|
|
2384
|
+
yearControl.setValue(today.getFullYear());
|
|
2385
|
+
dayControl.setValue(today.getDate());
|
|
2386
|
+
monthControl.setValue(today.getMonth());
|
|
2387
|
+
formControl?.setValue(today);
|
|
2205
2388
|
if (onListener) {
|
|
2206
|
-
onListener({ type: PickerListenerType.Now, value: today });
|
|
2389
|
+
onListener({ type: components.PickerListenerType.Now, value: today });
|
|
2207
2390
|
}
|
|
2208
2391
|
}
|
|
2209
2392
|
function onSelect() {
|
|
2210
|
-
formControl?.
|
|
2393
|
+
formControl?.setValue(value);
|
|
2211
2394
|
if (onListener) {
|
|
2212
|
-
onListener({ type: PickerListenerType.Select, value });
|
|
2395
|
+
onListener({ type: components.PickerListenerType.Select, value });
|
|
2213
2396
|
}
|
|
2214
2397
|
}
|
|
2215
|
-
return (
|
|
2398
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title rls-picker-date__title--description", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: dates.dateFormatTemplate(dateInitial, FORMAT_TITLE) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title rls-picker-date__title--year", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityYear, children: yearControl.value }) }), jsxRuntimeExports.jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityMonth })] }), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-picker-date__component', {
|
|
2216
2399
|
day: visibility === 'DAY',
|
|
2217
2400
|
month: visibility === 'MONTH',
|
|
2218
2401
|
year: visibility === 'YEAR'
|
|
2219
|
-
}), children: [
|
|
2402
|
+
}), children: [jsxRuntimeExports.jsx(RlsPickerDay, { formControl: dayControl, date: dateInitial, month: monthControl.value, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, date: dateInitial, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, date: dateInitial, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), !automatic && (jsxRuntimeExports.jsx("div", { className: "rls-picker-date__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--today", children: jsxRuntimeExports.jsx(RlsButton, { type: "ghost", onClick: onToday, disabled: components.dateOutRange({ date: today, maxDate, minDate }), children: reactI18n('dateActionToday') }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) }))] }));
|
|
2220
2403
|
}
|
|
2221
2404
|
|
|
2222
|
-
|
|
2405
|
+
const FORMAT_DATE = '{dd}/{mx}/{aa}';
|
|
2406
|
+
function RlsFieldDate({ children, date, disabled, formControl, format, maxDate, minDate, onValue, placeholder, rlsTheme }) {
|
|
2223
2407
|
const today = new Date(); // Initial current date in component
|
|
2224
|
-
const [value, setValue] =
|
|
2225
|
-
const [modalIsVisible, setModalIsVisible] =
|
|
2226
|
-
|
|
2227
|
-
const dateCheck = checkDateRange({
|
|
2228
|
-
date: formControl?.
|
|
2408
|
+
const [value, setValue] = require$$0.useState();
|
|
2409
|
+
const [modalIsVisible, setModalIsVisible] = require$$0.useState(false);
|
|
2410
|
+
require$$0.useEffect(() => {
|
|
2411
|
+
const dateCheck = components.checkDateRange({
|
|
2412
|
+
date: formControl?.value || date || today,
|
|
2229
2413
|
minDate,
|
|
2230
2414
|
maxDate
|
|
2231
2415
|
});
|
|
2232
2416
|
setValue(dateCheck);
|
|
2233
|
-
formControl?.
|
|
2417
|
+
formControl?.setValue(dateCheck);
|
|
2234
2418
|
}, []);
|
|
2235
|
-
function
|
|
2236
|
-
setModalIsVisible(true);
|
|
2237
|
-
}
|
|
2238
|
-
function onChange(value, ignoreControl = false) {
|
|
2239
|
-
if (!ignoreControl) {
|
|
2240
|
-
formControl?.setState(value);
|
|
2241
|
-
}
|
|
2419
|
+
function onChange(value) {
|
|
2242
2420
|
setValue(value);
|
|
2243
2421
|
if (onValue) {
|
|
2244
2422
|
onValue(value);
|
|
2245
2423
|
}
|
|
2246
2424
|
}
|
|
2247
|
-
function
|
|
2425
|
+
function onClickInput() {
|
|
2426
|
+
setModalIsVisible(true);
|
|
2427
|
+
}
|
|
2428
|
+
function onClickAction() {
|
|
2248
2429
|
if (value) {
|
|
2430
|
+
formControl?.setValue(undefined);
|
|
2249
2431
|
formControl?.touch();
|
|
2250
2432
|
onChange(undefined);
|
|
2251
2433
|
}
|
|
@@ -2253,9 +2435,12 @@ function RlsFieldDate({ children, date, disabled, formControl, maxDate, minDate,
|
|
|
2253
2435
|
setModalIsVisible(true);
|
|
2254
2436
|
}
|
|
2255
2437
|
}
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2438
|
+
const valueInput = value
|
|
2439
|
+
? dates.dateFormatTemplate(value, format || FORMAT_DATE)
|
|
2440
|
+
: '';
|
|
2441
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-date__control", type: "text", value: valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsxRuntimeExports.jsx("button", { className: "rls-field-date__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }), jsxRuntimeExports.jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDate, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value, type }) => {
|
|
2442
|
+
if (type !== components.PickerListenerType.Cancel) {
|
|
2443
|
+
onChange(value);
|
|
2259
2444
|
}
|
|
2260
2445
|
formControl?.touch();
|
|
2261
2446
|
setModalIsVisible(false);
|
|
@@ -2263,34 +2448,34 @@ function RlsFieldDate({ children, date, disabled, formControl, maxDate, minDate,
|
|
|
2263
2448
|
}
|
|
2264
2449
|
|
|
2265
2450
|
function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
2266
|
-
const dateInitial = normalizeMinTime(datePicker || new Date());
|
|
2267
|
-
const rangeInitial = formControl?.
|
|
2268
|
-
const yearControl = useReactControl(dateInitial.getFullYear());
|
|
2269
|
-
const monthControl = useReactControl(dateInitial.getMonth());
|
|
2270
|
-
const dayControl = useReactControl(rangeInitial);
|
|
2271
|
-
const [value, setValue] =
|
|
2272
|
-
const [date, setDate] =
|
|
2273
|
-
const [visibility, setVisibility] =
|
|
2274
|
-
|
|
2451
|
+
const dateInitial = dates.normalizeMinTime(datePicker || new Date());
|
|
2452
|
+
const rangeInitial = formControl?.value || dates.DateRange.now();
|
|
2453
|
+
const yearControl = reactForms.useReactControl(dateInitial.getFullYear());
|
|
2454
|
+
const monthControl = reactForms.useReactControl(dateInitial.getMonth());
|
|
2455
|
+
const dayControl = reactForms.useReactControl(rangeInitial);
|
|
2456
|
+
const [value, setValue] = require$$0.useState(rangeInitial);
|
|
2457
|
+
const [date, setDate] = require$$0.useState(dateInitial);
|
|
2458
|
+
const [visibility, setVisibility] = require$$0.useState('DAY');
|
|
2459
|
+
require$$0.useEffect(() => {
|
|
2275
2460
|
setDate((prevValue) => {
|
|
2276
|
-
return typeof yearControl.
|
|
2277
|
-
? assignYearInDate(prevValue, yearControl.
|
|
2461
|
+
return typeof yearControl.value === 'number'
|
|
2462
|
+
? dates.assignYearInDate(prevValue, yearControl.value)
|
|
2278
2463
|
: prevValue;
|
|
2279
2464
|
});
|
|
2280
|
-
}, [yearControl.
|
|
2281
|
-
|
|
2465
|
+
}, [yearControl.value]);
|
|
2466
|
+
require$$0.useEffect(() => {
|
|
2282
2467
|
setDate((prevValue) => {
|
|
2283
|
-
return typeof monthControl.
|
|
2284
|
-
? assignMonthInDate(prevValue, monthControl.
|
|
2468
|
+
return typeof monthControl.value === 'number'
|
|
2469
|
+
? dates.assignMonthInDate(prevValue, monthControl.value)
|
|
2285
2470
|
: prevValue;
|
|
2286
2471
|
});
|
|
2287
|
-
}, [monthControl.
|
|
2288
|
-
|
|
2289
|
-
if (dayControl.
|
|
2290
|
-
setValue(dayControl.
|
|
2472
|
+
}, [monthControl.value]);
|
|
2473
|
+
require$$0.useEffect(() => {
|
|
2474
|
+
if (dayControl.value) {
|
|
2475
|
+
setValue(dayControl.value);
|
|
2291
2476
|
}
|
|
2292
2477
|
setVisibility('DAY');
|
|
2293
|
-
}, [dayControl.
|
|
2478
|
+
}, [dayControl.value]);
|
|
2294
2479
|
function onVisibilityDay() {
|
|
2295
2480
|
setVisibility('DAY');
|
|
2296
2481
|
}
|
|
@@ -2302,42 +2487,42 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
2302
2487
|
}
|
|
2303
2488
|
function onCancel() {
|
|
2304
2489
|
if (onListener) {
|
|
2305
|
-
onListener({ type: PickerListenerType.Cancel });
|
|
2490
|
+
onListener({ type: components.PickerListenerType.Cancel });
|
|
2306
2491
|
}
|
|
2307
2492
|
}
|
|
2308
2493
|
function onSelect() {
|
|
2309
|
-
formControl?.
|
|
2494
|
+
formControl?.setValue(value);
|
|
2310
2495
|
if (onListener) {
|
|
2311
|
-
onListener({ type: PickerListenerType.Select, value });
|
|
2496
|
+
onListener({ type: components.PickerListenerType.Select, value });
|
|
2312
2497
|
}
|
|
2313
2498
|
}
|
|
2314
|
-
return (
|
|
2499
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--description", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: rangeFormatTemplate(value) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--year", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityYear, children: yearControl.value }) }), jsxRuntimeExports.jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: visibility === 'MONTH' ? 'year' : 'month', onClick: onVisibilityMonth })] }), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-picker-date-range__component', {
|
|
2315
2500
|
day: visibility === 'DAY',
|
|
2316
2501
|
month: visibility === 'MONTH',
|
|
2317
2502
|
year: visibility === 'YEAR'
|
|
2318
|
-
}), children: [
|
|
2503
|
+
}), children: [jsxRuntimeExports.jsx(RlsPickerDayRange, { formControl: dayControl, date: date, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-date-range__footer', {
|
|
2319
2504
|
automatic
|
|
2320
|
-
}), children:
|
|
2505
|
+
}), children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) })] }));
|
|
2321
2506
|
}
|
|
2322
2507
|
|
|
2323
2508
|
function RlsFieldDateRange({ children, date: datePicker, disabled, formControl, maxDate, minDate, placeholder, rlsTheme }) {
|
|
2324
|
-
const currentRange = formControl?.
|
|
2509
|
+
const currentRange = formControl?.value || dates.DateRange.now();
|
|
2325
2510
|
const currentDate = datePicker || new Date();
|
|
2326
|
-
const [value, setValue] =
|
|
2327
|
-
const [modalIsVisible, setModalIsVisible] =
|
|
2511
|
+
const [value, setValue] = require$$0.useState(currentRange);
|
|
2512
|
+
const [modalIsVisible, setModalIsVisible] = require$$0.useState(false);
|
|
2328
2513
|
function onClickInput() {
|
|
2329
2514
|
setModalIsVisible(true);
|
|
2330
2515
|
}
|
|
2331
2516
|
function onClickAction() {
|
|
2332
2517
|
if (value) {
|
|
2333
|
-
formControl?.
|
|
2518
|
+
formControl?.setValue(undefined);
|
|
2334
2519
|
setValue(undefined);
|
|
2335
2520
|
}
|
|
2336
2521
|
else {
|
|
2337
2522
|
setModalIsVisible(true);
|
|
2338
2523
|
}
|
|
2339
2524
|
}
|
|
2340
|
-
return (
|
|
2525
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-date-range__control", type: "text", value: value ? rangeFormatTemplate(value) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsxRuntimeExports.jsx("button", { className: "rls-field-date-range__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }), jsxRuntimeExports.jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value }) => {
|
|
2341
2526
|
if (value) {
|
|
2342
2527
|
setValue(value);
|
|
2343
2528
|
}
|
|
@@ -2348,10 +2533,10 @@ function RlsFieldDateRange({ children, date: datePicker, disabled, formControl,
|
|
|
2348
2533
|
function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
|
|
2349
2534
|
const listControl = useListControl({ suggestions, formControl });
|
|
2350
2535
|
const { collection, inputRef, visible, navigationElement, navigationInput, setFocused, setValue, setVisible } = listControl;
|
|
2351
|
-
const initializedState =
|
|
2352
|
-
const initializedCollection =
|
|
2353
|
-
const changeInternal =
|
|
2354
|
-
|
|
2536
|
+
const initializedState = require$$0.useRef(false);
|
|
2537
|
+
const initializedCollection = require$$0.useRef(false);
|
|
2538
|
+
const changeInternal = require$$0.useRef(false);
|
|
2539
|
+
require$$0.useEffect(() => {
|
|
2355
2540
|
if (!initializedState.current || !initializedCollection.current) {
|
|
2356
2541
|
initializedState.current = true;
|
|
2357
2542
|
return;
|
|
@@ -2360,14 +2545,14 @@ function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
|
|
|
2360
2545
|
changeInternal.current = false;
|
|
2361
2546
|
return;
|
|
2362
2547
|
}
|
|
2363
|
-
refresh(collection, formControl?.
|
|
2364
|
-
}, [formControl?.
|
|
2365
|
-
|
|
2548
|
+
refresh(collection, formControl?.value);
|
|
2549
|
+
}, [formControl?.value]);
|
|
2550
|
+
require$$0.useEffect(() => {
|
|
2366
2551
|
if (!initializedCollection.current || !initializedState.current) {
|
|
2367
2552
|
initializedCollection.current = true;
|
|
2368
2553
|
return;
|
|
2369
2554
|
}
|
|
2370
|
-
refresh(collection, formControl?.
|
|
2555
|
+
refresh(collection, formControl?.value);
|
|
2371
2556
|
}, [collection]);
|
|
2372
2557
|
function refresh(collection, state) {
|
|
2373
2558
|
if (!state) {
|
|
@@ -2383,7 +2568,7 @@ function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
|
|
|
2383
2568
|
function setFormState(value) {
|
|
2384
2569
|
if (formControl) {
|
|
2385
2570
|
changeInternal.current = true;
|
|
2386
|
-
formControl.
|
|
2571
|
+
formControl.setValue(value);
|
|
2387
2572
|
}
|
|
2388
2573
|
}
|
|
2389
2574
|
function onFocusInput() {
|
|
@@ -2456,28 +2641,28 @@ function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
|
|
|
2456
2641
|
};
|
|
2457
2642
|
}
|
|
2458
2643
|
|
|
2459
|
-
function RlsFieldSelectTemplate({ suggestions, children, disabled, formControl,
|
|
2460
|
-
const
|
|
2644
|
+
function RlsFieldSelectTemplate({ render, suggestions, children, disabled, formControl, onSelect, onValue, placeholder, rlsTheme }) {
|
|
2645
|
+
const fieldSelect = useFieldSelect({
|
|
2461
2646
|
suggestions,
|
|
2462
2647
|
disabled,
|
|
2463
2648
|
formControl,
|
|
2464
2649
|
onSelect,
|
|
2465
2650
|
onValue
|
|
2466
2651
|
});
|
|
2467
|
-
return (
|
|
2468
|
-
visible: listControl.visible
|
|
2469
|
-
}), disabled: disabled, onClick: onClickAction, children:
|
|
2470
|
-
visible: listControl.visible,
|
|
2471
|
-
hide: !listControl.visible,
|
|
2472
|
-
higher: listControl.higher
|
|
2473
|
-
}), children: [
|
|
2652
|
+
return (jsxRuntimeExports.jsxs("div", { ref: fieldSelect.listControl.contentRef, className: renderClassStatus('rls-field-box', { focused: fieldSelect.listControl.focused, disabled }, 'rls-field-list rls-field-select'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { ref: fieldSelect.listControl.inputRef, className: "rls-field-list__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: fieldSelect.listControl.value, onFocus: fieldSelect.onFocusInput, onBlur: fieldSelect.onBlurInput, onClick: fieldSelect.onClickInput, onKeyDown: fieldSelect.onKeydownInput }), jsxRuntimeExports.jsx("button", { className: renderClassStatus('rls-field-list__action', {
|
|
2653
|
+
visible: fieldSelect.listControl.visible
|
|
2654
|
+
}), disabled: disabled, onClick: fieldSelect.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
|
|
2655
|
+
visible: fieldSelect.listControl.visible,
|
|
2656
|
+
hide: !fieldSelect.listControl.visible,
|
|
2657
|
+
higher: fieldSelect.listControl.higher
|
|
2658
|
+
}), children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: fieldSelect.listControl.listRef, className: "rls-field-list__ul", children: [suggestions.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: fieldSelect.onClickElement(element), onKeyDown: fieldSelect.onKeydownElement(element), children: render(element) }, index))), !suggestions.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold truncate", children: reactI18n('listEmptyTitle') }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: reactI18n('listEmptyDescription') })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: fieldSelect.onClickBackdrop })] })] }));
|
|
2474
2659
|
}
|
|
2475
2660
|
function RlsFieldSelect(props) {
|
|
2476
|
-
return (
|
|
2661
|
+
return (jsxRuntimeExports.jsx(RlsFieldSelectTemplate, { ...props, render: (element) => (jsxRuntimeExports.jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
|
|
2477
2662
|
}
|
|
2478
2663
|
|
|
2479
2664
|
function RlsFormNavigation({ children, visible, rlsTheme }) {
|
|
2480
|
-
return (
|
|
2665
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-form-navigation', { visible }), "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-form-navigation__body", children: children }) }));
|
|
2481
2666
|
}
|
|
2482
2667
|
|
|
2483
2668
|
const DURATION_ANIMATION = 240;
|
|
@@ -2496,15 +2681,15 @@ function calculateDuration({ length }) {
|
|
|
2496
2681
|
return duration + DURATION_RESET;
|
|
2497
2682
|
}
|
|
2498
2683
|
function RlsSnackbar({ content, icon, title, visible, rlsTheme }) {
|
|
2499
|
-
return (
|
|
2684
|
+
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-snackbar', { visible }), "rls-theme": rlsTheme, children: [icon && (jsxRuntimeExports.jsx("div", { className: "rls-snackbar__avatar", children: jsxRuntimeExports.jsx(RlsIcon, { value: icon }) })), jsxRuntimeExports.jsxs("div", { className: "rls-snackbar__component", children: [title && jsxRuntimeExports.jsx("div", { className: "rls-snackbar__title", children: title }), jsxRuntimeExports.jsx("div", { className: "rls-snackbar__content", children: content })] })] }));
|
|
2500
2685
|
}
|
|
2501
2686
|
function useSnackbarService() {
|
|
2502
|
-
const [config, setConfig] =
|
|
2503
|
-
const [duration, setDuration] =
|
|
2504
|
-
const [timeoutId, setTimeoutId] =
|
|
2505
|
-
const [visible, setVisible] =
|
|
2506
|
-
const rlsSnackbar =
|
|
2507
|
-
|
|
2687
|
+
const [config, setConfig] = require$$0.useState({});
|
|
2688
|
+
const [duration, setDuration] = require$$0.useState(4000);
|
|
2689
|
+
const [timeoutId, setTimeoutId] = require$$0.useState();
|
|
2690
|
+
const [visible, setVisible] = require$$0.useState(false);
|
|
2691
|
+
const rlsSnackbar = jsxRuntimeExports.jsx(RlsSnackbar, { ...config, visible: visible });
|
|
2692
|
+
require$$0.useEffect(() => {
|
|
2508
2693
|
if (visible) {
|
|
2509
2694
|
const timeoutId = setTimeout(() => {
|
|
2510
2695
|
setVisible(false);
|
|
@@ -2529,7 +2714,7 @@ function useSnackbarService() {
|
|
|
2529
2714
|
};
|
|
2530
2715
|
}
|
|
2531
2716
|
|
|
2532
|
-
const RlsContext =
|
|
2717
|
+
const RlsContext = require$$0.createContext({
|
|
2533
2718
|
confirmation: () => {
|
|
2534
2719
|
return Promise.resolve(ConfirmationResult.approved());
|
|
2535
2720
|
},
|
|
@@ -2538,7 +2723,7 @@ const RlsContext = react.createContext({
|
|
|
2538
2723
|
function RlsApplication({ children }) {
|
|
2539
2724
|
const { RlsConfirmation, confirmation } = useConfirmationService();
|
|
2540
2725
|
const { RlsSnackbar, snackbar } = useSnackbarService();
|
|
2541
|
-
return (
|
|
2726
|
+
return (jsxRuntimeExports.jsxs(RlsContext.Provider, { value: { confirmation, snackbar }, children: [jsxRuntimeExports.jsx("div", { className: "rls-app__body", children: children }), RlsSnackbar, RlsConfirmation] }));
|
|
2542
2727
|
}
|
|
2543
2728
|
|
|
2544
2729
|
exports.ConfirmationResult = ConfirmationResult;
|