funda-ui 4.4.35 → 4.5.12
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/Date/index.js +1078 -77
- package/EventCalendar/index.js +8 -2
- package/EventCalendarTimeline/index.js +32 -1
- package/Input/index.d.ts +7 -0
- package/Input/index.js +699 -57
- package/MasonryLayout/index.js +11 -1
- package/MultipleSelect/index.d.ts +1 -0
- package/MultipleSelect/index.js +7 -5
- package/RangeSlider/index.js +1078 -77
- package/Select/index.js +34 -2
- package/Textarea/index.d.ts +7 -0
- package/Textarea/index.js +707 -10
- package/Tree/index.js +2 -0
- package/Utils/inputsCalculation.d.ts +18 -1
- package/Utils/inputsCalculation.js +26 -0
- package/lib/cjs/Date/index.js +1078 -77
- package/lib/cjs/EventCalendar/index.js +8 -2
- package/lib/cjs/EventCalendarTimeline/index.js +32 -1
- package/lib/cjs/Input/index.d.ts +7 -0
- package/lib/cjs/Input/index.js +699 -57
- package/lib/cjs/MasonryLayout/index.js +11 -1
- package/lib/cjs/MultipleSelect/index.d.ts +1 -0
- package/lib/cjs/MultipleSelect/index.js +7 -5
- package/lib/cjs/RangeSlider/index.js +1078 -77
- package/lib/cjs/Select/index.js +34 -2
- package/lib/cjs/Textarea/index.d.ts +7 -0
- package/lib/cjs/Textarea/index.js +707 -10
- package/lib/cjs/Tree/index.js +2 -0
- package/lib/cjs/Utils/inputsCalculation.d.ts +18 -1
- package/lib/cjs/Utils/inputsCalculation.js +26 -0
- package/lib/esm/EventCalendar/index.tsx +8 -6
- package/lib/esm/EventCalendarTimeline/index.tsx +439 -403
- package/lib/esm/Input/index.tsx +299 -77
- package/lib/esm/MasonryLayout/index.tsx +9 -2
- package/lib/esm/MultipleSelect/index.tsx +6 -4
- package/lib/esm/Textarea/index.tsx +332 -39
- package/lib/esm/Tree/TreeList.tsx +4 -1
- package/lib/esm/Tree/index.tsx +1 -0
- package/lib/esm/Utils/libs/inputsCalculation.ts +60 -31
- package/package.json +1 -1
|
@@ -246,8 +246,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
246
246
|
/***/
|
|
247
247
|
},
|
|
248
248
|
|
|
249
|
-
/***/
|
|
250
|
-
/* module decorator */module =
|
|
249
|
+
/***/954: /***/function _(module, exports, __nested_webpack_require_11464__) {
|
|
250
|
+
/* module decorator */module = __nested_webpack_require_11464__.nmd(module);
|
|
251
251
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
|
252
252
|
function _typeof(obj) {
|
|
253
253
|
"@babel/helpers - typeof";
|
|
@@ -259,7 +259,241 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
259
259
|
}, _typeof(obj);
|
|
260
260
|
}
|
|
261
261
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
262
|
-
if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(
|
|
262
|
+
if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
|
|
263
|
+
})(this, function () {
|
|
264
|
+
return (/******/function () {
|
|
265
|
+
// webpackBootstrap
|
|
266
|
+
/******/
|
|
267
|
+
"use strict";
|
|
268
|
+
|
|
269
|
+
/******/ // The require scope
|
|
270
|
+
/******/
|
|
271
|
+
var __nested_webpack_require_987__ = {};
|
|
272
|
+
/******/
|
|
273
|
+
/************************************************************************/
|
|
274
|
+
/******/ /* webpack/runtime/define property getters */
|
|
275
|
+
/******/
|
|
276
|
+
(function () {
|
|
277
|
+
/******/ // define getter functions for harmony exports
|
|
278
|
+
/******/__nested_webpack_require_987__.d = function (exports, definition) {
|
|
279
|
+
/******/for (var key in definition) {
|
|
280
|
+
/******/if (__nested_webpack_require_987__.o(definition, key) && !__nested_webpack_require_987__.o(exports, key)) {
|
|
281
|
+
/******/Object.defineProperty(exports, key, {
|
|
282
|
+
enumerable: true,
|
|
283
|
+
get: definition[key]
|
|
284
|
+
});
|
|
285
|
+
/******/
|
|
286
|
+
}
|
|
287
|
+
/******/
|
|
288
|
+
}
|
|
289
|
+
/******/
|
|
290
|
+
};
|
|
291
|
+
/******/
|
|
292
|
+
})();
|
|
293
|
+
/******/
|
|
294
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
295
|
+
/******/
|
|
296
|
+
(function () {
|
|
297
|
+
/******/__nested_webpack_require_987__.o = function (obj, prop) {
|
|
298
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
299
|
+
};
|
|
300
|
+
/******/
|
|
301
|
+
})();
|
|
302
|
+
/******/
|
|
303
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
304
|
+
/******/
|
|
305
|
+
(function () {
|
|
306
|
+
/******/ // define __esModule on exports
|
|
307
|
+
/******/__nested_webpack_require_987__.r = function (exports) {
|
|
308
|
+
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
309
|
+
/******/Object.defineProperty(exports, Symbol.toStringTag, {
|
|
310
|
+
value: 'Module'
|
|
311
|
+
});
|
|
312
|
+
/******/
|
|
313
|
+
}
|
|
314
|
+
/******/
|
|
315
|
+
Object.defineProperty(exports, '__esModule', {
|
|
316
|
+
value: true
|
|
317
|
+
});
|
|
318
|
+
/******/
|
|
319
|
+
};
|
|
320
|
+
/******/
|
|
321
|
+
})();
|
|
322
|
+
/******/
|
|
323
|
+
/************************************************************************/
|
|
324
|
+
var __webpack_exports__ = {};
|
|
325
|
+
__nested_webpack_require_987__.r(__webpack_exports__);
|
|
326
|
+
/* harmony export */
|
|
327
|
+
__nested_webpack_require_987__.d(__webpack_exports__, {
|
|
328
|
+
/* harmony export */"actualPropertyValue": function actualPropertyValue() {
|
|
329
|
+
return (/* binding */_actualPropertyValue
|
|
330
|
+
);
|
|
331
|
+
},
|
|
332
|
+
/* harmony export */"getTextTop": function getTextTop() {
|
|
333
|
+
return (/* binding */_getTextTop
|
|
334
|
+
);
|
|
335
|
+
},
|
|
336
|
+
/* harmony export */"getTextWidth": function getTextWidth() {
|
|
337
|
+
return (/* binding */_getTextWidth
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
/* harmony export */
|
|
341
|
+
});
|
|
342
|
+
/**
|
|
343
|
+
* Gets the relative upside of the text
|
|
344
|
+
* @param {Element} el - A DOM node containing one selector to match against.
|
|
345
|
+
* @returns {Number} - Returns a pure number.
|
|
346
|
+
*/
|
|
347
|
+
function _getTextTop(el) {
|
|
348
|
+
var styles = window.getComputedStyle(el);
|
|
349
|
+
var fontSize = parseFloat(styles.fontSize);
|
|
350
|
+
var lineHeight = parseFloat(styles.lineHeight) || fontSize;
|
|
351
|
+
var paddingTop = parseFloat(styles.paddingTop);
|
|
352
|
+
var borderWidth = parseFloat(styles.borderWidth);
|
|
353
|
+
var textTop = paddingTop + (lineHeight - fontSize) / 2 - borderWidth * 2;
|
|
354
|
+
return textTop;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Get the actual value with user specific methed
|
|
359
|
+
* it can be 'width', 'height', 'outerWidth', 'outerHeight'
|
|
360
|
+
* @private
|
|
361
|
+
* @param {Element} el - A DOM node containing one selector to match against.
|
|
362
|
+
* @param {String} prop - A string naming the property of style.
|
|
363
|
+
* @param {?Json} config - Whether or not margin is included. The key `includeMargin`
|
|
364
|
+
takes effect when set to true
|
|
365
|
+
* @return {Number} - Returns a pure number.
|
|
366
|
+
*/
|
|
367
|
+
function _actualPropertyValue(el, prop) {
|
|
368
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
369
|
+
if (el === null) return 0;
|
|
370
|
+
var style = window.getComputedStyle ? window.getComputedStyle(el) : el.currentStyle,
|
|
371
|
+
display = style.display,
|
|
372
|
+
position = style.position,
|
|
373
|
+
visibility = style.visibility;
|
|
374
|
+
var marginWidth = 0;
|
|
375
|
+
var marginHeight = 0;
|
|
376
|
+
var maxVal;
|
|
377
|
+
var actualVal;
|
|
378
|
+
if (config && config.includeMargin === true) {
|
|
379
|
+
marginWidth = parseFloat(style.marginLeft) + parseFloat(style.marginRight);
|
|
380
|
+
marginHeight = parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
|
381
|
+
}
|
|
382
|
+
if (prop === 'fontSize') {
|
|
383
|
+
actualVal = parseFloat(style.fontSize);
|
|
384
|
+
}
|
|
385
|
+
if (prop === 'fontFamily') {
|
|
386
|
+
actualVal = style.fontFamily;
|
|
387
|
+
}
|
|
388
|
+
if (prop === 'letterSpacing') {
|
|
389
|
+
actualVal = style.letterSpacing;
|
|
390
|
+
}
|
|
391
|
+
if (prop === 'width') {
|
|
392
|
+
maxVal = parseFloat(style.maxWidth);
|
|
393
|
+
|
|
394
|
+
// if its not hidden we just return normal height
|
|
395
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
396
|
+
return el.clientWidth;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (prop === 'height') {
|
|
400
|
+
maxVal = parseFloat(style.maxHeight);
|
|
401
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
402
|
+
return el.clientHeight;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if (prop === 'outerWidth') {
|
|
406
|
+
maxVal = parseFloat(style.maxWidth);
|
|
407
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
408
|
+
return el.offsetWidth + marginWidth;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if (prop === 'outerHeight') {
|
|
412
|
+
maxVal = parseFloat(style.maxHeight);
|
|
413
|
+
if (display !== 'none' && maxVal !== 0) {
|
|
414
|
+
return el.offsetHeight + marginHeight;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// the element is hidden so:
|
|
419
|
+
// making the el block so we can meassure its height but still be hidden
|
|
420
|
+
el.style.position = 'absolute';
|
|
421
|
+
el.style.visibility = 'hidden';
|
|
422
|
+
el.style.display = 'block';
|
|
423
|
+
if (prop === 'width') actualVal = el.clientWidth;
|
|
424
|
+
if (prop === 'height') actualVal = el.clientHeight;
|
|
425
|
+
if (prop === 'outerWidth') actualVal = el.offsetWidth + marginWidth;
|
|
426
|
+
if (prop === 'outerHeight') actualVal = el.offsetHeight + marginHeight;
|
|
427
|
+
|
|
428
|
+
// reverting to the original values
|
|
429
|
+
el.style.display = display;
|
|
430
|
+
el.style.position = position;
|
|
431
|
+
el.style.visibility = visibility;
|
|
432
|
+
return actualVal;
|
|
433
|
+
}
|
|
434
|
+
function getElCSS(input, prop, isNumber) {
|
|
435
|
+
var _document$defaultView;
|
|
436
|
+
var val = (_document$defaultView = document.defaultView) === null || _document$defaultView === void 0 ? void 0 : _document$defaultView.getComputedStyle(input, null).getPropertyValue(prop);
|
|
437
|
+
return isNumber ? isNaN(parseFloat(val)) ? 0 : parseFloat(val) : val;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Get cursor or text position in pixels for input element
|
|
442
|
+
*
|
|
443
|
+
* @param {HTMLInputElement} input Required HTMLElement with `value` attribute
|
|
444
|
+
* @param {HTMLSpanElement} fauxContainer Container of faux.
|
|
445
|
+
* @param {HTMLElement} rawTextContainer The raw text container for the comparison
|
|
446
|
+
* @returns {Number}
|
|
447
|
+
*/
|
|
448
|
+
|
|
449
|
+
function _getTextWidth(input, fauxContainer, rawTextContainer) {
|
|
450
|
+
if (input === null || fauxContainer === null || rawTextContainer === null) return 0;
|
|
451
|
+
var _off = input.selectionStart;
|
|
452
|
+
var _faux = fauxContainer;
|
|
453
|
+
var _fauxContainer = rawTextContainer;
|
|
454
|
+
if (_faux && _fauxContainer) {
|
|
455
|
+
// Styles to simulate a node in an input field
|
|
456
|
+
// use pre-wrap instead of wrap for white-space to support wrapping in textareas
|
|
457
|
+
var listOfModifiers = ['direction', 'font-family', 'font-size', 'font-size-adjust', 'font-variant', 'font-weight', 'font-style', 'letter-spacing', 'line-height', 'text-align', 'text-indent', 'text-transform', 'word-wrap', 'word-spacing'];
|
|
458
|
+
|
|
459
|
+
// default styles
|
|
460
|
+
_faux.style.setProperty('white-space', 'pre-wrap');
|
|
461
|
+
_faux.style.setProperty('padding', '0');
|
|
462
|
+
_faux.style.setProperty('margin', '0');
|
|
463
|
+
_faux.style.setProperty('display', 'none');
|
|
464
|
+
for (var i = 0; i < listOfModifiers.length; i++) {
|
|
465
|
+
var propertyValue = getElCSS(_fauxContainer, listOfModifiers[i], false);
|
|
466
|
+
_faux.style.setProperty(listOfModifiers[i], propertyValue);
|
|
467
|
+
}
|
|
468
|
+
_faux.textContent = input.value.substring(0, _off).replace(/\s/g, "\xA0");
|
|
469
|
+
return _actualPropertyValue(_faux, 'outerWidth');
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/******/
|
|
474
|
+
return __webpack_exports__;
|
|
475
|
+
/******/
|
|
476
|
+
}()
|
|
477
|
+
);
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
/***/
|
|
481
|
+
},
|
|
482
|
+
|
|
483
|
+
/***/85: /***/function _(module, exports, __nested_webpack_require_23494__) {
|
|
484
|
+
/* module decorator */module = __nested_webpack_require_23494__.nmd(module);
|
|
485
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
|
486
|
+
function _typeof(obj) {
|
|
487
|
+
"@babel/helpers - typeof";
|
|
488
|
+
|
|
489
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
490
|
+
return typeof obj;
|
|
491
|
+
} : function (obj) {
|
|
492
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
493
|
+
}, _typeof(obj);
|
|
494
|
+
}
|
|
495
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
496
|
+
if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_23494__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_23494__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
|
|
263
497
|
})(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
|
|
264
498
|
return (/******/function () {
|
|
265
499
|
// webpackBootstrap
|
|
@@ -419,6 +653,203 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
419
653
|
/***/
|
|
420
654
|
},
|
|
421
655
|
|
|
656
|
+
/***/702: /***/function _(module, exports, __nested_webpack_require_31582__) {
|
|
657
|
+
/* module decorator */module = __nested_webpack_require_31582__.nmd(module);
|
|
658
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
|
|
659
|
+
function _typeof(obj) {
|
|
660
|
+
"@babel/helpers - typeof";
|
|
661
|
+
|
|
662
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
663
|
+
return typeof obj;
|
|
664
|
+
} : function (obj) {
|
|
665
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
666
|
+
}, _typeof(obj);
|
|
667
|
+
}
|
|
668
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
669
|
+
if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_31582__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_31582__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
|
|
670
|
+
})(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
|
|
671
|
+
return (/******/function () {
|
|
672
|
+
// webpackBootstrap
|
|
673
|
+
/******/
|
|
674
|
+
"use strict";
|
|
675
|
+
|
|
676
|
+
/******/
|
|
677
|
+
var __webpack_modules__ = {
|
|
678
|
+
/***/787: /***/function _(module) {
|
|
679
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
680
|
+
|
|
681
|
+
/***/
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/******/
|
|
685
|
+
};
|
|
686
|
+
/************************************************************************/
|
|
687
|
+
/******/ // The module cache
|
|
688
|
+
/******/
|
|
689
|
+
var __webpack_module_cache__ = {};
|
|
690
|
+
/******/
|
|
691
|
+
/******/ // The require function
|
|
692
|
+
/******/
|
|
693
|
+
function __nested_webpack_require_1465__(moduleId) {
|
|
694
|
+
/******/ // Check if module is in cache
|
|
695
|
+
/******/var cachedModule = __webpack_module_cache__[moduleId];
|
|
696
|
+
/******/
|
|
697
|
+
if (cachedModule !== undefined) {
|
|
698
|
+
/******/return cachedModule.exports;
|
|
699
|
+
/******/
|
|
700
|
+
}
|
|
701
|
+
/******/ // Create a new module (and put it into the cache)
|
|
702
|
+
/******/
|
|
703
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
704
|
+
/******/ // no module.id needed
|
|
705
|
+
/******/ // no module.loaded needed
|
|
706
|
+
/******/exports: {}
|
|
707
|
+
/******/
|
|
708
|
+
};
|
|
709
|
+
/******/
|
|
710
|
+
/******/ // Execute the module function
|
|
711
|
+
/******/
|
|
712
|
+
__webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_1465__);
|
|
713
|
+
/******/
|
|
714
|
+
/******/ // Return the exports of the module
|
|
715
|
+
/******/
|
|
716
|
+
return module.exports;
|
|
717
|
+
/******/
|
|
718
|
+
}
|
|
719
|
+
/******/
|
|
720
|
+
/************************************************************************/
|
|
721
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
722
|
+
/******/
|
|
723
|
+
(function () {
|
|
724
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
725
|
+
/******/__nested_webpack_require_1465__.n = function (module) {
|
|
726
|
+
/******/var getter = module && module.__esModule ? /******/function () {
|
|
727
|
+
return module['default'];
|
|
728
|
+
} : /******/function () {
|
|
729
|
+
return module;
|
|
730
|
+
};
|
|
731
|
+
/******/
|
|
732
|
+
__nested_webpack_require_1465__.d(getter, {
|
|
733
|
+
a: getter
|
|
734
|
+
});
|
|
735
|
+
/******/
|
|
736
|
+
return getter;
|
|
737
|
+
/******/
|
|
738
|
+
};
|
|
739
|
+
/******/
|
|
740
|
+
})();
|
|
741
|
+
/******/
|
|
742
|
+
/******/ /* webpack/runtime/define property getters */
|
|
743
|
+
/******/
|
|
744
|
+
(function () {
|
|
745
|
+
/******/ // define getter functions for harmony exports
|
|
746
|
+
/******/__nested_webpack_require_1465__.d = function (exports, definition) {
|
|
747
|
+
/******/for (var key in definition) {
|
|
748
|
+
/******/if (__nested_webpack_require_1465__.o(definition, key) && !__nested_webpack_require_1465__.o(exports, key)) {
|
|
749
|
+
/******/Object.defineProperty(exports, key, {
|
|
750
|
+
enumerable: true,
|
|
751
|
+
get: definition[key]
|
|
752
|
+
});
|
|
753
|
+
/******/
|
|
754
|
+
}
|
|
755
|
+
/******/
|
|
756
|
+
}
|
|
757
|
+
/******/
|
|
758
|
+
};
|
|
759
|
+
/******/
|
|
760
|
+
})();
|
|
761
|
+
/******/
|
|
762
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
763
|
+
/******/
|
|
764
|
+
(function () {
|
|
765
|
+
/******/__nested_webpack_require_1465__.o = function (obj, prop) {
|
|
766
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
767
|
+
};
|
|
768
|
+
/******/
|
|
769
|
+
})();
|
|
770
|
+
/******/
|
|
771
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
772
|
+
/******/
|
|
773
|
+
(function () {
|
|
774
|
+
/******/ // define __esModule on exports
|
|
775
|
+
/******/__nested_webpack_require_1465__.r = function (exports) {
|
|
776
|
+
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
777
|
+
/******/Object.defineProperty(exports, Symbol.toStringTag, {
|
|
778
|
+
value: 'Module'
|
|
779
|
+
});
|
|
780
|
+
/******/
|
|
781
|
+
}
|
|
782
|
+
/******/
|
|
783
|
+
Object.defineProperty(exports, '__esModule', {
|
|
784
|
+
value: true
|
|
785
|
+
});
|
|
786
|
+
/******/
|
|
787
|
+
};
|
|
788
|
+
/******/
|
|
789
|
+
})();
|
|
790
|
+
/******/
|
|
791
|
+
/************************************************************************/
|
|
792
|
+
var __webpack_exports__ = {};
|
|
793
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
794
|
+
(function () {
|
|
795
|
+
__nested_webpack_require_1465__.r(__webpack_exports__);
|
|
796
|
+
/* harmony export */
|
|
797
|
+
__nested_webpack_require_1465__.d(__webpack_exports__, {
|
|
798
|
+
/* harmony export */"default": function _default() {
|
|
799
|
+
return __WEBPACK_DEFAULT_EXPORT__;
|
|
800
|
+
}
|
|
801
|
+
/* harmony export */
|
|
802
|
+
});
|
|
803
|
+
/* harmony import */
|
|
804
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1465__(787);
|
|
805
|
+
/* harmony import */
|
|
806
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_1465__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
807
|
+
/**
|
|
808
|
+
* Delay the execution of function or state update
|
|
809
|
+
*
|
|
810
|
+
* @usage:
|
|
811
|
+
|
|
812
|
+
const App = () => {
|
|
813
|
+
const [count, setCount] = useState(0);
|
|
814
|
+
const handleClick = useDebounce(() => setCount(count + 1), 500, [count]);
|
|
815
|
+
|
|
816
|
+
return (
|
|
817
|
+
<div className="app">
|
|
818
|
+
<button onClick={handleClick}>click</button>
|
|
819
|
+
<p>click {count} time</p>
|
|
820
|
+
</div>
|
|
821
|
+
);
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
*/
|
|
825
|
+
|
|
826
|
+
var useDebounce = function useDebounce(fn, delay, dependence) {
|
|
827
|
+
var ref = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
828
|
+
return (0, react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {
|
|
829
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
830
|
+
args[_key] = arguments[_key];
|
|
831
|
+
}
|
|
832
|
+
clearTimeout(ref.current);
|
|
833
|
+
ref.current = null;
|
|
834
|
+
ref.current = setTimeout(function () {
|
|
835
|
+
fn.apply(void 0, args);
|
|
836
|
+
}, delay);
|
|
837
|
+
}, dependence);
|
|
838
|
+
};
|
|
839
|
+
/* harmony default export */
|
|
840
|
+
var __WEBPACK_DEFAULT_EXPORT__ = useDebounce;
|
|
841
|
+
})();
|
|
842
|
+
|
|
843
|
+
/******/
|
|
844
|
+
return __webpack_exports__;
|
|
845
|
+
/******/
|
|
846
|
+
}()
|
|
847
|
+
);
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
/***/
|
|
851
|
+
},
|
|
852
|
+
|
|
422
853
|
/***/787: /***/function _(module) {
|
|
423
854
|
"use strict";
|
|
424
855
|
|
|
@@ -436,7 +867,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
436
867
|
/******/
|
|
437
868
|
/******/ // The require function
|
|
438
869
|
/******/
|
|
439
|
-
function
|
|
870
|
+
function __nested_webpack_require_41203__(moduleId) {
|
|
440
871
|
/******/ // Check if module is in cache
|
|
441
872
|
/******/var cachedModule = __webpack_module_cache__[moduleId];
|
|
442
873
|
/******/
|
|
@@ -455,7 +886,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
455
886
|
/******/
|
|
456
887
|
/******/ // Execute the module function
|
|
457
888
|
/******/
|
|
458
|
-
__webpack_modules__[moduleId].call(module.exports, module, module.exports,
|
|
889
|
+
__webpack_modules__[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_41203__);
|
|
459
890
|
/******/
|
|
460
891
|
/******/ // Flag the module as loaded
|
|
461
892
|
/******/
|
|
@@ -472,14 +903,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
472
903
|
/******/
|
|
473
904
|
(function () {
|
|
474
905
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
475
|
-
/******/
|
|
906
|
+
/******/__nested_webpack_require_41203__.n = function (module) {
|
|
476
907
|
/******/var getter = module && module.__esModule ? /******/function () {
|
|
477
908
|
return module['default'];
|
|
478
909
|
} : /******/function () {
|
|
479
910
|
return module;
|
|
480
911
|
};
|
|
481
912
|
/******/
|
|
482
|
-
|
|
913
|
+
__nested_webpack_require_41203__.d(getter, {
|
|
483
914
|
a: getter
|
|
484
915
|
});
|
|
485
916
|
/******/
|
|
@@ -493,9 +924,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
493
924
|
/******/
|
|
494
925
|
(function () {
|
|
495
926
|
/******/ // define getter functions for harmony exports
|
|
496
|
-
/******/
|
|
927
|
+
/******/__nested_webpack_require_41203__.d = function (exports, definition) {
|
|
497
928
|
/******/for (var key in definition) {
|
|
498
|
-
/******/if (
|
|
929
|
+
/******/if (__nested_webpack_require_41203__.o(definition, key) && !__nested_webpack_require_41203__.o(exports, key)) {
|
|
499
930
|
/******/Object.defineProperty(exports, key, {
|
|
500
931
|
enumerable: true,
|
|
501
932
|
get: definition[key]
|
|
@@ -512,7 +943,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
512
943
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
513
944
|
/******/
|
|
514
945
|
(function () {
|
|
515
|
-
/******/
|
|
946
|
+
/******/__nested_webpack_require_41203__.o = function (obj, prop) {
|
|
516
947
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
517
948
|
};
|
|
518
949
|
/******/
|
|
@@ -522,7 +953,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
522
953
|
/******/
|
|
523
954
|
(function () {
|
|
524
955
|
/******/ // define __esModule on exports
|
|
525
|
-
/******/
|
|
956
|
+
/******/__nested_webpack_require_41203__.r = function (exports) {
|
|
526
957
|
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
527
958
|
/******/Object.defineProperty(exports, Symbol.toStringTag, {
|
|
528
959
|
value: 'Module'
|
|
@@ -541,7 +972,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
541
972
|
/******/ /* webpack/runtime/node module decorator */
|
|
542
973
|
/******/
|
|
543
974
|
(function () {
|
|
544
|
-
/******/
|
|
975
|
+
/******/__nested_webpack_require_41203__.nmd = function (module) {
|
|
545
976
|
/******/module.paths = [];
|
|
546
977
|
/******/
|
|
547
978
|
if (!module.children) module.children = [];
|
|
@@ -558,27 +989,360 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
558
989
|
(function () {
|
|
559
990
|
"use strict";
|
|
560
991
|
|
|
561
|
-
|
|
992
|
+
__nested_webpack_require_41203__.r(__webpack_exports__);
|
|
562
993
|
/* harmony export */
|
|
563
|
-
|
|
994
|
+
__nested_webpack_require_41203__.d(__webpack_exports__, {
|
|
564
995
|
/* harmony export */"default": function _default() {
|
|
565
996
|
return __WEBPACK_DEFAULT_EXPORT__;
|
|
566
997
|
}
|
|
567
998
|
/* harmony export */
|
|
568
999
|
});
|
|
569
1000
|
/* harmony import */
|
|
570
|
-
var react__WEBPACK_IMPORTED_MODULE_0__ =
|
|
1001
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_41203__(787);
|
|
1002
|
+
/* harmony import */
|
|
1003
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_41203__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1004
|
+
/* harmony import */
|
|
1005
|
+
var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_41203__(85);
|
|
571
1006
|
/* harmony import */
|
|
572
|
-
var
|
|
1007
|
+
var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_41203__.n(funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__);
|
|
573
1008
|
/* harmony import */
|
|
574
|
-
var
|
|
1009
|
+
var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_41203__(188);
|
|
575
1010
|
/* harmony import */
|
|
576
|
-
var
|
|
1011
|
+
var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nested_webpack_require_41203__.n(funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__);
|
|
577
1012
|
/* harmony import */
|
|
578
|
-
var
|
|
1013
|
+
var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_41203__(954);
|
|
579
1014
|
/* harmony import */
|
|
580
|
-
var
|
|
581
|
-
|
|
1015
|
+
var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nested_webpack_require_41203__.n(funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_3__);
|
|
1016
|
+
/* harmony import */
|
|
1017
|
+
var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_41203__(702);
|
|
1018
|
+
/* harmony import */
|
|
1019
|
+
var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__nested_webpack_require_41203__.n(funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_4__);
|
|
1020
|
+
var _excluded = ["contentRef", "wrapperClassName", "controlClassName", "controlExClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "type", "disabled", "required", "placeholder", "pattern", "readOnly", "defaultValue", "value", "requiredLabel", "label", "units", "name", "step", "min", "max", "src", "size", "minLength", "maxLength", "alt", "inputMode", "id", "appendControl", "aiPredict", "aiPredictRemainingTextRGB", "aiPredictConfirmKey", "aiPredictFetchFuncAsync", "aiPredictFetchFuncMethod", "aiPredictFetchFuncMethodParams", "aiPredictFetchCallback", "iconLeft", "iconRight", "autoComplete", "autoCapitalize", "spellCheck", "style", "tabIndex", "onChangeCallback", "onInputCallback", "onKeyPressedCallback", "onChange", "onBlur", "onFocus", "onPressEnter"];
|
|
1021
|
+
function _regeneratorRuntime() {
|
|
1022
|
+
"use strict";
|
|
1023
|
+
|
|
1024
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
1025
|
+
_regeneratorRuntime = function _regeneratorRuntime() {
|
|
1026
|
+
return exports;
|
|
1027
|
+
};
|
|
1028
|
+
var exports = {},
|
|
1029
|
+
Op = Object.prototype,
|
|
1030
|
+
hasOwn = Op.hasOwnProperty,
|
|
1031
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
1032
|
+
obj[key] = desc.value;
|
|
1033
|
+
},
|
|
1034
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
1035
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
1036
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
1037
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
1038
|
+
function define(obj, key, value) {
|
|
1039
|
+
return Object.defineProperty(obj, key, {
|
|
1040
|
+
value: value,
|
|
1041
|
+
enumerable: !0,
|
|
1042
|
+
configurable: !0,
|
|
1043
|
+
writable: !0
|
|
1044
|
+
}), obj[key];
|
|
1045
|
+
}
|
|
1046
|
+
try {
|
|
1047
|
+
define({}, "");
|
|
1048
|
+
} catch (err) {
|
|
1049
|
+
define = function define(obj, key, value) {
|
|
1050
|
+
return obj[key] = value;
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
1054
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
1055
|
+
generator = Object.create(protoGenerator.prototype),
|
|
1056
|
+
context = new Context(tryLocsList || []);
|
|
1057
|
+
return defineProperty(generator, "_invoke", {
|
|
1058
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
1059
|
+
}), generator;
|
|
1060
|
+
}
|
|
1061
|
+
function tryCatch(fn, obj, arg) {
|
|
1062
|
+
try {
|
|
1063
|
+
return {
|
|
1064
|
+
type: "normal",
|
|
1065
|
+
arg: fn.call(obj, arg)
|
|
1066
|
+
};
|
|
1067
|
+
} catch (err) {
|
|
1068
|
+
return {
|
|
1069
|
+
type: "throw",
|
|
1070
|
+
arg: err
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
exports.wrap = wrap;
|
|
1075
|
+
var ContinueSentinel = {};
|
|
1076
|
+
function Generator() {}
|
|
1077
|
+
function GeneratorFunction() {}
|
|
1078
|
+
function GeneratorFunctionPrototype() {}
|
|
1079
|
+
var IteratorPrototype = {};
|
|
1080
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
1081
|
+
return this;
|
|
1082
|
+
});
|
|
1083
|
+
var getProto = Object.getPrototypeOf,
|
|
1084
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
1085
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
1086
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
1087
|
+
function defineIteratorMethods(prototype) {
|
|
1088
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
1089
|
+
define(prototype, method, function (arg) {
|
|
1090
|
+
return this._invoke(method, arg);
|
|
1091
|
+
});
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
1095
|
+
function invoke(method, arg, resolve, reject) {
|
|
1096
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
1097
|
+
if ("throw" !== record.type) {
|
|
1098
|
+
var result = record.arg,
|
|
1099
|
+
value = result.value;
|
|
1100
|
+
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
1101
|
+
invoke("next", value, resolve, reject);
|
|
1102
|
+
}, function (err) {
|
|
1103
|
+
invoke("throw", err, resolve, reject);
|
|
1104
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
1105
|
+
result.value = unwrapped, resolve(result);
|
|
1106
|
+
}, function (error) {
|
|
1107
|
+
return invoke("throw", error, resolve, reject);
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
reject(record.arg);
|
|
1111
|
+
}
|
|
1112
|
+
var previousPromise;
|
|
1113
|
+
defineProperty(this, "_invoke", {
|
|
1114
|
+
value: function value(method, arg) {
|
|
1115
|
+
function callInvokeWithMethodAndArg() {
|
|
1116
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
1117
|
+
invoke(method, arg, resolve, reject);
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
1125
|
+
var state = "suspendedStart";
|
|
1126
|
+
return function (method, arg) {
|
|
1127
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
1128
|
+
if ("completed" === state) {
|
|
1129
|
+
if ("throw" === method) throw arg;
|
|
1130
|
+
return doneResult();
|
|
1131
|
+
}
|
|
1132
|
+
for (context.method = method, context.arg = arg;;) {
|
|
1133
|
+
var delegate = context.delegate;
|
|
1134
|
+
if (delegate) {
|
|
1135
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
1136
|
+
if (delegateResult) {
|
|
1137
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
1138
|
+
return delegateResult;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
1142
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
1143
|
+
context.dispatchException(context.arg);
|
|
1144
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
1145
|
+
state = "executing";
|
|
1146
|
+
var record = tryCatch(innerFn, self, context);
|
|
1147
|
+
if ("normal" === record.type) {
|
|
1148
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
1149
|
+
return {
|
|
1150
|
+
value: record.arg,
|
|
1151
|
+
done: context.done
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
1159
|
+
var methodName = context.method,
|
|
1160
|
+
method = delegate.iterator[methodName];
|
|
1161
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
1162
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
1163
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
1164
|
+
var info = record.arg;
|
|
1165
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
1166
|
+
}
|
|
1167
|
+
function pushTryEntry(locs) {
|
|
1168
|
+
var entry = {
|
|
1169
|
+
tryLoc: locs[0]
|
|
1170
|
+
};
|
|
1171
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
1172
|
+
}
|
|
1173
|
+
function resetTryEntry(entry) {
|
|
1174
|
+
var record = entry.completion || {};
|
|
1175
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
1176
|
+
}
|
|
1177
|
+
function Context(tryLocsList) {
|
|
1178
|
+
this.tryEntries = [{
|
|
1179
|
+
tryLoc: "root"
|
|
1180
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
1181
|
+
}
|
|
1182
|
+
function values(iterable) {
|
|
1183
|
+
if (iterable) {
|
|
1184
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
1185
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
1186
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
1187
|
+
if (!isNaN(iterable.length)) {
|
|
1188
|
+
var i = -1,
|
|
1189
|
+
next = function next() {
|
|
1190
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
1191
|
+
return next.value = undefined, next.done = !0, next;
|
|
1192
|
+
};
|
|
1193
|
+
return next.next = next;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
return {
|
|
1197
|
+
next: doneResult
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
function doneResult() {
|
|
1201
|
+
return {
|
|
1202
|
+
value: undefined,
|
|
1203
|
+
done: !0
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
1207
|
+
value: GeneratorFunctionPrototype,
|
|
1208
|
+
configurable: !0
|
|
1209
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
1210
|
+
value: GeneratorFunction,
|
|
1211
|
+
configurable: !0
|
|
1212
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
1213
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
1214
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
1215
|
+
}, exports.mark = function (genFun) {
|
|
1216
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
1217
|
+
}, exports.awrap = function (arg) {
|
|
1218
|
+
return {
|
|
1219
|
+
__await: arg
|
|
1220
|
+
};
|
|
1221
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
1222
|
+
return this;
|
|
1223
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
1224
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
1225
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
1226
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
1227
|
+
return result.done ? result.value : iter.next();
|
|
1228
|
+
});
|
|
1229
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
1230
|
+
return this;
|
|
1231
|
+
}), define(Gp, "toString", function () {
|
|
1232
|
+
return "[object Generator]";
|
|
1233
|
+
}), exports.keys = function (val) {
|
|
1234
|
+
var object = Object(val),
|
|
1235
|
+
keys = [];
|
|
1236
|
+
for (var key in object) keys.push(key);
|
|
1237
|
+
return keys.reverse(), function next() {
|
|
1238
|
+
for (; keys.length;) {
|
|
1239
|
+
var key = keys.pop();
|
|
1240
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
1241
|
+
}
|
|
1242
|
+
return next.done = !0, next;
|
|
1243
|
+
};
|
|
1244
|
+
}, exports.values = values, Context.prototype = {
|
|
1245
|
+
constructor: Context,
|
|
1246
|
+
reset: function reset(skipTempReset) {
|
|
1247
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
1248
|
+
},
|
|
1249
|
+
stop: function stop() {
|
|
1250
|
+
this.done = !0;
|
|
1251
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
1252
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
1253
|
+
return this.rval;
|
|
1254
|
+
},
|
|
1255
|
+
dispatchException: function dispatchException(exception) {
|
|
1256
|
+
if (this.done) throw exception;
|
|
1257
|
+
var context = this;
|
|
1258
|
+
function handle(loc, caught) {
|
|
1259
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
1260
|
+
}
|
|
1261
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1262
|
+
var entry = this.tryEntries[i],
|
|
1263
|
+
record = entry.completion;
|
|
1264
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
1265
|
+
if (entry.tryLoc <= this.prev) {
|
|
1266
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
1267
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1268
|
+
if (hasCatch && hasFinally) {
|
|
1269
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1270
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
1271
|
+
} else if (hasCatch) {
|
|
1272
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1273
|
+
} else {
|
|
1274
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
1275
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
},
|
|
1280
|
+
abrupt: function abrupt(type, arg) {
|
|
1281
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1282
|
+
var entry = this.tryEntries[i];
|
|
1283
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
1284
|
+
var finallyEntry = entry;
|
|
1285
|
+
break;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
1289
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1290
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
1291
|
+
},
|
|
1292
|
+
complete: function complete(record, afterLoc) {
|
|
1293
|
+
if ("throw" === record.type) throw record.arg;
|
|
1294
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
1295
|
+
},
|
|
1296
|
+
finish: function finish(finallyLoc) {
|
|
1297
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1298
|
+
var entry = this.tryEntries[i];
|
|
1299
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
1300
|
+
}
|
|
1301
|
+
},
|
|
1302
|
+
"catch": function _catch(tryLoc) {
|
|
1303
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1304
|
+
var entry = this.tryEntries[i];
|
|
1305
|
+
if (entry.tryLoc === tryLoc) {
|
|
1306
|
+
var record = entry.completion;
|
|
1307
|
+
if ("throw" === record.type) {
|
|
1308
|
+
var thrown = record.arg;
|
|
1309
|
+
resetTryEntry(entry);
|
|
1310
|
+
}
|
|
1311
|
+
return thrown;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
throw new Error("illegal catch attempt");
|
|
1315
|
+
},
|
|
1316
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
1317
|
+
return this.delegate = {
|
|
1318
|
+
iterator: values(iterable),
|
|
1319
|
+
resultName: resultName,
|
|
1320
|
+
nextLoc: nextLoc
|
|
1321
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
1322
|
+
}
|
|
1323
|
+
}, exports;
|
|
1324
|
+
}
|
|
1325
|
+
function _toConsumableArray(arr) {
|
|
1326
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
1327
|
+
}
|
|
1328
|
+
function _nonIterableSpread() {
|
|
1329
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1330
|
+
}
|
|
1331
|
+
function _iterableToArray(iter) {
|
|
1332
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1333
|
+
}
|
|
1334
|
+
function _arrayWithoutHoles(arr) {
|
|
1335
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
1336
|
+
}
|
|
1337
|
+
function _typeof(obj) {
|
|
1338
|
+
"@babel/helpers - typeof";
|
|
1339
|
+
|
|
1340
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
1341
|
+
return typeof obj;
|
|
1342
|
+
} : function (obj) {
|
|
1343
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1344
|
+
}, _typeof(obj);
|
|
1345
|
+
}
|
|
582
1346
|
function _extends() {
|
|
583
1347
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
584
1348
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -593,6 +1357,36 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
593
1357
|
};
|
|
594
1358
|
return _extends.apply(this, arguments);
|
|
595
1359
|
}
|
|
1360
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1361
|
+
try {
|
|
1362
|
+
var info = gen[key](arg);
|
|
1363
|
+
var value = info.value;
|
|
1364
|
+
} catch (error) {
|
|
1365
|
+
reject(error);
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1368
|
+
if (info.done) {
|
|
1369
|
+
resolve(value);
|
|
1370
|
+
} else {
|
|
1371
|
+
Promise.resolve(value).then(_next, _throw);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
function _asyncToGenerator(fn) {
|
|
1375
|
+
return function () {
|
|
1376
|
+
var self = this,
|
|
1377
|
+
args = arguments;
|
|
1378
|
+
return new Promise(function (resolve, reject) {
|
|
1379
|
+
var gen = fn.apply(self, args);
|
|
1380
|
+
function _next(value) {
|
|
1381
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
1382
|
+
}
|
|
1383
|
+
function _throw(err) {
|
|
1384
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1385
|
+
}
|
|
1386
|
+
_next(undefined);
|
|
1387
|
+
});
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
596
1390
|
function _slicedToArray(arr, i) {
|
|
597
1391
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
598
1392
|
}
|
|
@@ -699,6 +1493,16 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
699
1493
|
inputMode = props.inputMode,
|
|
700
1494
|
id = props.id,
|
|
701
1495
|
appendControl = props.appendControl,
|
|
1496
|
+
_props$aiPredict = props.aiPredict,
|
|
1497
|
+
aiPredict = _props$aiPredict === void 0 ? false : _props$aiPredict,
|
|
1498
|
+
_props$aiPredictRemai = props.aiPredictRemainingTextRGB,
|
|
1499
|
+
aiPredictRemainingTextRGB = _props$aiPredictRemai === void 0 ? [153, 153, 153] : _props$aiPredictRemai,
|
|
1500
|
+
_props$aiPredictConfi = props.aiPredictConfirmKey,
|
|
1501
|
+
aiPredictConfirmKey = _props$aiPredictConfi === void 0 ? [['Enter'], ['Tab'], ['Shift', ' ']] : _props$aiPredictConfi,
|
|
1502
|
+
aiPredictFetchFuncAsync = props.aiPredictFetchFuncAsync,
|
|
1503
|
+
aiPredictFetchFuncMethod = props.aiPredictFetchFuncMethod,
|
|
1504
|
+
aiPredictFetchFuncMethodParams = props.aiPredictFetchFuncMethodParams,
|
|
1505
|
+
aiPredictFetchCallback = props.aiPredictFetchCallback,
|
|
702
1506
|
iconLeft = props.iconLeft,
|
|
703
1507
|
iconRight = props.iconRight,
|
|
704
1508
|
autoComplete = props.autoComplete,
|
|
@@ -728,6 +1532,183 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
728
1532
|
changedVal = _useState4[0],
|
|
729
1533
|
setChangedVal = _useState4[1];
|
|
730
1534
|
|
|
1535
|
+
//================================================================
|
|
1536
|
+
// AI Predict
|
|
1537
|
+
//================================================================
|
|
1538
|
+
var _useState5 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(''),
|
|
1539
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1540
|
+
currentSuggestion = _useState6[0],
|
|
1541
|
+
setCurrentSuggestion = _useState6[1];
|
|
1542
|
+
var _useState7 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
1543
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
1544
|
+
tempMatchedSuggestion = _useState8[0],
|
|
1545
|
+
setTempMatchedSuggestion = _useState8[1];
|
|
1546
|
+
var _useState9 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),
|
|
1547
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
1548
|
+
textWidth = _useState10[0],
|
|
1549
|
+
setTextWidth = _useState10[1];
|
|
1550
|
+
var aiInputRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
1551
|
+
var originInputComputedStyle = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)({
|
|
1552
|
+
fontSize: 16,
|
|
1553
|
+
fontFamily: 'inherit',
|
|
1554
|
+
letterSpacing: 'normal',
|
|
1555
|
+
textTop: 10
|
|
1556
|
+
});
|
|
1557
|
+
var _useState11 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
|
|
1558
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
1559
|
+
hasErr = _useState12[0],
|
|
1560
|
+
setHasErr = _useState12[1];
|
|
1561
|
+
var currentSuggestionIndex = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);
|
|
1562
|
+
|
|
1563
|
+
// A list of suggestions
|
|
1564
|
+
//----------------
|
|
1565
|
+
var _useState13 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
1566
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
1567
|
+
suggestions = _useState14[0],
|
|
1568
|
+
setSuggestions = _useState14[1];
|
|
1569
|
+
|
|
1570
|
+
//performance
|
|
1571
|
+
var handleChangeSuggestionsFetchSafe = funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_4___default()(function (e, curVal) {
|
|
1572
|
+
var _oparams = aiPredictFetchFuncMethodParams || [];
|
|
1573
|
+
var _params = _oparams.map(function (item) {
|
|
1574
|
+
return item !== '$QUERY_STRING' ? item : curVal;
|
|
1575
|
+
});
|
|
1576
|
+
fetchSuggestionsData(_params.join(',')).then(function (resSuggestions) {
|
|
1577
|
+
handleInputAiPredictChange(curVal, resSuggestions);
|
|
1578
|
+
});
|
|
1579
|
+
}, 350, []);
|
|
1580
|
+
function fetchSuggestionsData(_x2) {
|
|
1581
|
+
return _fetchSuggestionsData.apply(this, arguments);
|
|
1582
|
+
} // Calculates the width of the input text
|
|
1583
|
+
//----------------
|
|
1584
|
+
function _fetchSuggestionsData() {
|
|
1585
|
+
_fetchSuggestionsData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
1586
|
+
var response, _ORGIN_DATA;
|
|
1587
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1588
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1589
|
+
case 0:
|
|
1590
|
+
if (!(_typeof(aiPredictFetchFuncAsync) === 'object')) {
|
|
1591
|
+
_context.next = 11;
|
|
1592
|
+
break;
|
|
1593
|
+
}
|
|
1594
|
+
_context.next = 3;
|
|
1595
|
+
return aiPredictFetchFuncAsync["".concat(aiPredictFetchFuncMethod)].apply(aiPredictFetchFuncAsync, _toConsumableArray(params.split(',')));
|
|
1596
|
+
case 3:
|
|
1597
|
+
response = _context.sent;
|
|
1598
|
+
_ORGIN_DATA = response.data; // reset data structure
|
|
1599
|
+
if (typeof aiPredictFetchCallback === 'function') {
|
|
1600
|
+
_ORGIN_DATA = aiPredictFetchCallback(_ORGIN_DATA);
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
// Determine whether the data structure matches
|
|
1604
|
+
if (!Array.isArray(_ORGIN_DATA)) {
|
|
1605
|
+
console.warn('The data structure does not match, please refer to the example in the component documentation.');
|
|
1606
|
+
setHasErr(true);
|
|
1607
|
+
_ORGIN_DATA = [];
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
//
|
|
1611
|
+
setSuggestions(_ORGIN_DATA);
|
|
1612
|
+
return _context.abrupt("return", _ORGIN_DATA);
|
|
1613
|
+
case 11:
|
|
1614
|
+
return _context.abrupt("return", []);
|
|
1615
|
+
case 12:
|
|
1616
|
+
case "end":
|
|
1617
|
+
return _context.stop();
|
|
1618
|
+
}
|
|
1619
|
+
}, _callee);
|
|
1620
|
+
}));
|
|
1621
|
+
return _fetchSuggestionsData.apply(this, arguments);
|
|
1622
|
+
}
|
|
1623
|
+
var calculateTextWidth = function calculateTextWidth(text) {
|
|
1624
|
+
if (valRef.current) {
|
|
1625
|
+
var canvas = document.createElement('canvas');
|
|
1626
|
+
var context = canvas.getContext('2d');
|
|
1627
|
+
context.font = "".concat(originInputComputedStyle.current.fontSize, "px ").concat(originInputComputedStyle.current.fontFamily);
|
|
1628
|
+
return context.measureText(text).width;
|
|
1629
|
+
}
|
|
1630
|
+
return 0;
|
|
1631
|
+
};
|
|
1632
|
+
|
|
1633
|
+
// Get the rest of the suggested text
|
|
1634
|
+
//----------------
|
|
1635
|
+
var getRemainingText = function getRemainingText(fullSuggestion) {
|
|
1636
|
+
if (!changedVal || !fullSuggestion) return '';
|
|
1637
|
+
|
|
1638
|
+
// Only the parts of the suggested text that were not entered are returned
|
|
1639
|
+
var lastInputChar = changedVal[changedVal.length - 1];
|
|
1640
|
+
var lastCharIndex = fullSuggestion.toLowerCase().lastIndexOf(lastInputChar.toLowerCase());
|
|
1641
|
+
return fullSuggestion.slice(lastCharIndex + 1);
|
|
1642
|
+
};
|
|
1643
|
+
|
|
1644
|
+
// Match exactly from the start
|
|
1645
|
+
//----------------
|
|
1646
|
+
var preciseMatch = function preciseMatch(input, suggestions) {
|
|
1647
|
+
if (!input) return '';
|
|
1648
|
+
var filtered = suggestions.filter(function (s) {
|
|
1649
|
+
return s.toLowerCase().startsWith(input.toLowerCase());
|
|
1650
|
+
});
|
|
1651
|
+
setTempMatchedSuggestion(filtered);
|
|
1652
|
+
return filtered;
|
|
1653
|
+
};
|
|
1654
|
+
|
|
1655
|
+
// Fuzzy matching
|
|
1656
|
+
//----------------
|
|
1657
|
+
var fuzzyMatch = function fuzzyMatch(input, suggestions) {
|
|
1658
|
+
if (!input) return '';
|
|
1659
|
+
|
|
1660
|
+
// Convert input to a regular expression pattern with support for arbitrary position matching
|
|
1661
|
+
var pattern = input.split('').map(function (_char) {
|
|
1662
|
+
return _char.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
1663
|
+
}).join('.*');
|
|
1664
|
+
var regex = new RegExp(pattern, 'i');
|
|
1665
|
+
|
|
1666
|
+
// Find the first matching suggestion (multiple matches)
|
|
1667
|
+
var filtered = suggestions.filter(function (suggestion) {
|
|
1668
|
+
return regex.test(suggestion);
|
|
1669
|
+
});
|
|
1670
|
+
setTempMatchedSuggestion(filtered);
|
|
1671
|
+
return filtered;
|
|
1672
|
+
};
|
|
1673
|
+
|
|
1674
|
+
// Handle input variations
|
|
1675
|
+
//----------------
|
|
1676
|
+
var handleInputAiPredictChange = function handleInputAiPredictChange(newValue, curSuggestions) {
|
|
1677
|
+
setTextWidth(calculateTextWidth(newValue));
|
|
1678
|
+
|
|
1679
|
+
// Match results
|
|
1680
|
+
var matchedSuggestion = fuzzyMatch(newValue, curSuggestions);
|
|
1681
|
+
setCurrentSuggestion(matchedSuggestion[0] || '');
|
|
1682
|
+
};
|
|
1683
|
+
|
|
1684
|
+
// Calculate the color shade of the prompt text
|
|
1685
|
+
//----------------
|
|
1686
|
+
var calculateOpacity = function calculateOpacity() {
|
|
1687
|
+
// Transparency is calculated based on the input length
|
|
1688
|
+
var baseOpacity = 0.5;
|
|
1689
|
+
var inputLength = changedVal.length;
|
|
1690
|
+
return Math.max(0.2, baseOpacity - inputLength * 0.05);
|
|
1691
|
+
};
|
|
1692
|
+
|
|
1693
|
+
// Confirm
|
|
1694
|
+
//----------------
|
|
1695
|
+
var handleAiPredictKeyDown = function handleAiPredictKeyDown(e) {
|
|
1696
|
+
// Prevents the default behavior of the enter key
|
|
1697
|
+
e.preventDefault();
|
|
1698
|
+
var remainingText = getRemainingText(currentSuggestion);
|
|
1699
|
+
if (remainingText) {
|
|
1700
|
+
// Only the second half of the text is added
|
|
1701
|
+
setChangedVal(changedVal + remainingText);
|
|
1702
|
+
setCurrentSuggestion('');
|
|
1703
|
+
}
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
//
|
|
1707
|
+
var remainingText = getRemainingText(currentSuggestion);
|
|
1708
|
+
|
|
1709
|
+
//================================================================
|
|
1710
|
+
// General
|
|
1711
|
+
//================================================================
|
|
731
1712
|
// exposes the following methods
|
|
732
1713
|
(0, react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(contentRef, function () {
|
|
733
1714
|
return {
|
|
@@ -814,6 +1795,39 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
814
1795
|
// DO NOT USE "preventDefault()"
|
|
815
1796
|
onPressEnter === null || onPressEnter === void 0 ? void 0 : onPressEnter(event, valRef.current);
|
|
816
1797
|
}
|
|
1798
|
+
|
|
1799
|
+
// AI Predict
|
|
1800
|
+
//----
|
|
1801
|
+
if (aiPredict && currentSuggestion !== '') {
|
|
1802
|
+
var keyBindings = aiPredictConfirmKey;
|
|
1803
|
+
// The parameter 'registerKeyEvents' is an array, and each element is an object
|
|
1804
|
+
// eg. { keys: ["Control", "S"], action: () => { console.log("Ctrl+S"); } }
|
|
1805
|
+
var registerKeyEvents = keyBindings.map(function (s) {
|
|
1806
|
+
return {
|
|
1807
|
+
keys: s,
|
|
1808
|
+
action: function action() {
|
|
1809
|
+
handleAiPredictKeyDown(event);
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
});
|
|
1813
|
+
registerKeyEvents.forEach(function (binding) {
|
|
1814
|
+
var keysPressed = binding.keys.every(function (key) {
|
|
1815
|
+
return key === "Shift" ? event.shiftKey : key === "Control" ? event.ctrlKey : key === "Alt" ? event.altKey : key === "Meta" ? event.metaKey : event.key === key;
|
|
1816
|
+
});
|
|
1817
|
+
if (keysPressed) {
|
|
1818
|
+
binding.action();
|
|
1819
|
+
}
|
|
1820
|
+
});
|
|
1821
|
+
|
|
1822
|
+
// switch result of suggestions
|
|
1823
|
+
if (event.code === 'ArrowUp') {
|
|
1824
|
+
currentSuggestionIndex.current = (currentSuggestionIndex.current - 1 + tempMatchedSuggestion.length) % tempMatchedSuggestion.length;
|
|
1825
|
+
}
|
|
1826
|
+
if (event.code === 'ArrowDown') {
|
|
1827
|
+
currentSuggestionIndex.current = (currentSuggestionIndex.current + 1) % tempMatchedSuggestion.length;
|
|
1828
|
+
}
|
|
1829
|
+
setCurrentSuggestion(tempMatchedSuggestion[currentSuggestionIndex.current] || '');
|
|
1830
|
+
}
|
|
817
1831
|
}
|
|
818
1832
|
(0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
819
1833
|
// update default value
|
|
@@ -829,6 +1843,17 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
829
1843
|
//REQUIRED
|
|
830
1844
|
setChangedVal("".concat(defaultValue)); // Avoid displaying the number 0
|
|
831
1845
|
}
|
|
1846
|
+
|
|
1847
|
+
// AI Predict initalization
|
|
1848
|
+
//--------------
|
|
1849
|
+
if (aiPredict && valRef.current !== null) {
|
|
1850
|
+
originInputComputedStyle.current = {
|
|
1851
|
+
fontSize: (0, funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_3__.actualPropertyValue)(valRef.current, 'fontSize'),
|
|
1852
|
+
fontFamily: (0, funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_3__.actualPropertyValue)(valRef.current, 'fontFamily'),
|
|
1853
|
+
letterSpacing: (0, funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_3__.actualPropertyValue)(valRef.current, 'letterSpacing'),
|
|
1854
|
+
textTop: (0, funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_3__.getTextTop)(valRef.current)
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
832
1857
|
}, []);
|
|
833
1858
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
834
1859
|
className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(wrapperClassName, 'mb-3 position-relative'),
|
|
@@ -843,60 +1868,15 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
843
1868
|
htmlFor: idRes,
|
|
844
1869
|
className: "form-label"
|
|
845
1870
|
}, label)) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
846
|
-
className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)('position-relative', (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(controlGroupWrapperClassName, 'input-group'), {
|
|
1871
|
+
className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)('position-relative z-1', (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(controlGroupWrapperClassName, 'input-group'), {
|
|
847
1872
|
'has-left-content': propExist(iconLeft),
|
|
848
1873
|
'has-right-content': propExist(iconRight) || propExist(units)
|
|
849
1874
|
})
|
|
850
1875
|
}, propExist(iconLeft) ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
851
1876
|
className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(controlGroupTextClassName, 'input-group-text')
|
|
852
|
-
}, iconLeft)) : null,
|
|
853
|
-
className: "input-group-control-container
|
|
1877
|
+
}, iconLeft)) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1878
|
+
className: "input-group-control-container flex-fill position-relative"
|
|
854
1879
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", _extends({
|
|
855
|
-
ref: function ref(node) {
|
|
856
|
-
valRef.current = node;
|
|
857
|
-
if (typeof externalRef === 'function') {
|
|
858
|
-
externalRef(node);
|
|
859
|
-
} else if (externalRef) {
|
|
860
|
-
externalRef.current = node;
|
|
861
|
-
}
|
|
862
|
-
},
|
|
863
|
-
tabIndex: tabIndex || 0,
|
|
864
|
-
type: typeRes,
|
|
865
|
-
className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)(propExist(iconLeft) ? 'rounded-start-0' : 'rounded', (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(controlClassName, 'form-control ')),
|
|
866
|
-
id: idRes,
|
|
867
|
-
name: name,
|
|
868
|
-
step: step || null,
|
|
869
|
-
min: min || null,
|
|
870
|
-
max: max || null,
|
|
871
|
-
src: src || null,
|
|
872
|
-
size: size || null,
|
|
873
|
-
alt: alt || null,
|
|
874
|
-
inputMode: inputMode || 'text',
|
|
875
|
-
pattern: pattern || null,
|
|
876
|
-
placeholder: placeholder || '',
|
|
877
|
-
defaultValue: defaultValue,
|
|
878
|
-
value: changedVal,
|
|
879
|
-
minLength: minLength || null,
|
|
880
|
-
maxLength: maxLength || null,
|
|
881
|
-
autoComplete: typeof autoComplete === 'undefined' ? 'on' : autoComplete,
|
|
882
|
-
autoCapitalize: typeof autoCapitalize === 'undefined' ? 'off' : autoCapitalize,
|
|
883
|
-
spellCheck: typeof spellCheck === 'undefined' ? false : spellCheck,
|
|
884
|
-
onFocus: handleFocus,
|
|
885
|
-
onBlur: handleBlur,
|
|
886
|
-
onChange: handleChange,
|
|
887
|
-
onKeyDown: handleKeyPressed,
|
|
888
|
-
onCompositionStart: handleComposition,
|
|
889
|
-
onCompositionUpdate: handleComposition,
|
|
890
|
-
onCompositionEnd: handleComposition,
|
|
891
|
-
disabled: disabled || null,
|
|
892
|
-
required: required || null,
|
|
893
|
-
readOnly: readOnly || null,
|
|
894
|
-
style: style
|
|
895
|
-
}, attributes)), appendControl || '', propExist(units) ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
896
|
-
className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(controlGroupTextClassName, 'input-group-text')
|
|
897
|
-
}, units)) : null, propExist(iconRight) ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
898
|
-
className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(controlGroupTextClassName, 'input-group-text')
|
|
899
|
-
}, iconRight)) : null)) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", _extends({
|
|
900
1880
|
ref: function ref(node) {
|
|
901
1881
|
valRef.current = node;
|
|
902
1882
|
if (typeof externalRef === 'function') {
|
|
@@ -908,7 +1888,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
908
1888
|
tabIndex: tabIndex || 0,
|
|
909
1889
|
type: typeRes,
|
|
910
1890
|
className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)((0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(controlClassName, 'form-control'), controlExClassName, {
|
|
911
|
-
'rounded': !propExist(iconLeft) && !propExist(iconRight) && !propExist(units)
|
|
1891
|
+
'rounded': !propExist(iconLeft) && !propExist(iconRight) && !propExist(units),
|
|
1892
|
+
'rounded-start-0': propExist(iconLeft),
|
|
1893
|
+
'rounded-end-0': propExist(iconRight) || propExist(units)
|
|
912
1894
|
}),
|
|
913
1895
|
id: idRes,
|
|
914
1896
|
name: name,
|
|
@@ -929,7 +1911,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
929
1911
|
spellCheck: typeof spellCheck === 'undefined' ? false : spellCheck,
|
|
930
1912
|
onFocus: handleFocus,
|
|
931
1913
|
onBlur: handleBlur,
|
|
932
|
-
onChange:
|
|
1914
|
+
onChange: function onChange(e) {
|
|
1915
|
+
handleChange(e);
|
|
1916
|
+
|
|
1917
|
+
// AI Predict
|
|
1918
|
+
if (aiPredict) {
|
|
1919
|
+
handleChangeSuggestionsFetchSafe(e, e.target.value);
|
|
1920
|
+
}
|
|
1921
|
+
},
|
|
933
1922
|
onKeyDown: handleKeyPressed,
|
|
934
1923
|
onCompositionStart: handleComposition,
|
|
935
1924
|
onCompositionUpdate: handleComposition,
|
|
@@ -938,15 +1927,27 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
938
1927
|
required: required || null,
|
|
939
1928
|
readOnly: readOnly || null,
|
|
940
1929
|
style: style
|
|
941
|
-
}, attributes)), appendControl || '',
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1930
|
+
}, attributes)), appendControl || '', aiPredict && remainingText && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1931
|
+
ref: aiInputRef,
|
|
1932
|
+
className: "position-absolute z-1",
|
|
1933
|
+
style: {
|
|
1934
|
+
left: "".concat(originInputComputedStyle.current.fontSize + textWidth, "px"),
|
|
1935
|
+
top: originInputComputedStyle.current.textTop + 'px',
|
|
1936
|
+
color: "rgba(".concat(aiPredictRemainingTextRGB[0], ", ").concat(aiPredictRemainingTextRGB[1], ", ").concat(aiPredictRemainingTextRGB[2], ", ").concat(calculateOpacity(), ")"),
|
|
1937
|
+
pointerEvents: 'none',
|
|
1938
|
+
fontSize: originInputComputedStyle.current.fontSize + 'px',
|
|
1939
|
+
fontFamily: originInputComputedStyle.current.fontFamily,
|
|
1940
|
+
letterSpacing: originInputComputedStyle.current.letterSpacing
|
|
1941
|
+
}
|
|
1942
|
+
}, remainingText), required ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, requiredLabel || requiredLabel === '' ? requiredLabel : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
946
1943
|
className: "position-absolute end-0 top-0 my-2 mx-2"
|
|
947
1944
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
948
1945
|
className: "text-danger"
|
|
949
|
-
}, "*"))) : ''))
|
|
1946
|
+
}, "*"))) : ''), propExist(units) ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
1947
|
+
className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(controlGroupTextClassName, 'input-group-text')
|
|
1948
|
+
}, units)) : null, propExist(iconRight) ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
1949
|
+
className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(controlGroupTextClassName, 'input-group-text')
|
|
1950
|
+
}, iconRight)) : null)));
|
|
950
1951
|
});
|
|
951
1952
|
/* harmony default export */
|
|
952
1953
|
var __WEBPACK_DEFAULT_EXPORT__ = Input;
|