@widergy/energy-ui 2.12.1 → 2.12.2
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/components/EnergyThemeProvider/index.js +36 -13
- package/dist/components/Loading/constants.js +2 -1
- package/dist/components/Loading/index.js +12 -13
- package/dist/components/Loading/theme.js +2 -4
- package/dist/components/UTAlert/AlertHandler.js +101 -75
- package/dist/components/UTAlert/index.js +87 -65
- package/dist/components/UTAlert/theme.js +32 -32
- package/dist/components/UTAttachment/components/Preview/index.js +9 -8
- package/dist/components/UTAttachment/constants.js +13 -7
- package/dist/components/UTAttachment/index.js +250 -159
- package/dist/components/UTAttachment/layout.js +27 -26
- package/dist/components/UTAttachment/theme.js +2 -4
- package/dist/components/UTAttachment/utils.js +117 -34
- package/dist/components/UTAutocomplete/components/ListBox/index.js +21 -13
- package/dist/components/UTAutocomplete/components/ListBox/utils.js +11 -9
- package/dist/components/UTAutocomplete/constants.js +23 -12
- package/dist/components/UTAutocomplete/index.js +94 -54
- package/dist/components/UTAutocomplete/theme.js +4 -6
- package/dist/components/UTAvatar/constants.js +3 -2
- package/dist/components/UTAvatar/index.js +17 -18
- package/dist/components/UTBarChart/components/Bars/components/Bar/components/Rect/index.js +22 -22
- package/dist/components/UTBarChart/components/Bars/components/Bar/constants.js +1 -1
- package/dist/components/UTBarChart/components/Bars/components/Bar/index.js +22 -21
- package/dist/components/UTBarChart/components/Bars/constants.js +6 -3
- package/dist/components/UTBarChart/components/Bars/index.js +80 -70
- package/dist/components/UTBarChart/components/Legend/constants.js +18 -12
- package/dist/components/UTBarChart/components/Legend/index.js +93 -75
- package/dist/components/UTBarChart/components/Legend/utils.js +5 -1
- package/dist/components/UTBarChart/components/Levels/index.js +14 -16
- package/dist/components/UTBarChart/components/Levels/utils.js +27 -25
- package/dist/components/UTBarChart/components/LinearPlot/constants.js +5 -3
- package/dist/components/UTBarChart/components/LinearPlot/index.js +20 -25
- package/dist/components/UTBarChart/components/LinearPlot/utils.js +39 -37
- package/dist/components/UTBarChart/components/Pagination/constants.js +2 -1
- package/dist/components/UTBarChart/components/Pagination/index.js +24 -20
- package/dist/components/UTBarChart/components/XAxis/components/AxisElement/index.js +32 -21
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/constants.js +4 -2
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/index.js +19 -20
- package/dist/components/UTBarChart/components/XAxis/constants.js +2 -1
- package/dist/components/UTBarChart/components/XAxis/index.js +65 -54
- package/dist/components/UTBarChart/components/YAxis/AxisElement/index.js +11 -12
- package/dist/components/UTBarChart/components/YAxis/constants.js +2 -1
- package/dist/components/UTBarChart/components/YAxis/index.js +37 -30
- package/dist/components/UTBarChart/components/YAxis/utils.js +6 -4
- package/dist/components/UTBarChart/constants.js +8 -4
- package/dist/components/UTBarChart/hooks/use-dynamic-margins.js +40 -23
- package/dist/components/UTBarChart/index.js +166 -152
- package/dist/components/UTBarChart/theme.js +2 -4
- package/dist/components/UTBarChart/types.js +19 -10
- package/dist/components/UTBarChart/utils.js +111 -107
- package/dist/components/UTBreadcrumbs/constants.js +31 -23
- package/dist/components/UTBreadcrumbs/index.js +101 -76
- package/dist/components/UTBreadcrumbs/theme.js +2 -4
- package/dist/components/UTButton/constants.js +17 -11
- package/dist/components/UTButton/index.js +31 -28
- package/dist/components/UTButton/theme.js +23 -23
- package/dist/components/UTCBUInput/index.js +40 -36
- package/dist/components/UTCBUInput/theme.js +2 -4
- package/dist/components/UTCaptcha/index.js +45 -19
- package/dist/components/UTCard/components/UTCardFooter/index.js +16 -15
- package/dist/components/UTCard/index.js +120 -85
- package/dist/components/UTCard/theme.js +12 -11
- package/dist/components/UTCard/types.js +3 -2
- package/dist/components/UTCarousel/components/Button/index.js +13 -13
- package/dist/components/UTCarousel/components/Legend/index.js +15 -13
- package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +16 -16
- package/dist/components/UTCarousel/components/Slider/constants.js +10 -5
- package/dist/components/UTCarousel/components/Slider/index.js +273 -204
- package/dist/components/UTCarousel/components/Slider/layout.js +94 -67
- package/dist/components/UTCarousel/index.js +15 -14
- package/dist/components/UTCarousel/theme.js +2 -4
- package/dist/components/UTCheckList/constants.js +2 -1
- package/dist/components/UTCheckList/index.js +93 -72
- package/dist/components/UTCheckList/theme.js +31 -31
- package/dist/components/UTCheckbox/constants.js +6 -3
- package/dist/components/UTCheckbox/index.js +44 -32
- package/dist/components/UTCheckbox/theme.js +35 -35
- package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +9 -9
- package/dist/components/UTConsumptionBar/constants.js +6 -3
- package/dist/components/UTConsumptionBar/index.js +80 -53
- package/dist/components/UTCuit/index.js +133 -109
- package/dist/components/UTCuit/theme.js +53 -51
- package/dist/components/UTDatePicker/components/Day/constants.js +2 -1
- package/dist/components/UTDatePicker/components/Day/index.js +12 -12
- package/dist/components/UTDatePicker/constants.js +31 -20
- package/dist/components/UTDatePicker/index.js +102 -60
- package/dist/components/UTDatePicker/theme.js +3 -5
- package/dist/components/UTDatePicker/types.js +3 -2
- package/dist/components/UTDatePicker/utils.js +6 -2
- package/dist/components/UTDialog/constants.js +4 -2
- package/dist/components/UTDialog/index.js +37 -38
- package/dist/components/UTDialog/theme.js +2 -4
- package/dist/components/UTDialog/types.js +3 -2
- package/dist/components/UTDotMenu/index.js +61 -39
- package/dist/components/UTEmojiPicker/constants.js +11 -6
- package/dist/components/UTEmojiPicker/index.js +65 -45
- package/dist/components/UTEmojiPicker/theme.js +2 -4
- package/dist/components/UTEmojiPicker/utils.js +51 -21
- package/dist/components/UTExternalLink/constants.js +5 -3
- package/dist/components/UTExternalLink/index.js +15 -18
- package/dist/components/UTExternalLink/theme.js +6 -8
- package/dist/components/UTFileInput/constants.js +4 -2
- package/dist/components/UTFileInput/index.js +31 -7
- package/dist/components/UTFileInput/layout.js +97 -68
- package/dist/components/UTIconButton/index.js +72 -49
- package/dist/components/UTIconButton/theme.js +2 -4
- package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +58 -53
- package/dist/components/UTImageRadio/constants.js +6 -3
- package/dist/components/UTImageRadio/index.js +47 -39
- package/dist/components/UTImageRadio/theme.js +12 -11
- package/dist/components/UTImageRadio/types.js +3 -2
- package/dist/components/UTImageRadio/utils.js +6 -2
- package/dist/components/UTLabel/constants.js +20 -14
- package/dist/components/UTLabel/index.js +20 -18
- package/dist/components/UTLabel/theme.js +15 -15
- package/dist/components/UTList/index.js +18 -15
- package/dist/components/UTLoading/index.js +15 -15
- package/dist/components/UTMap/components/GoogleMaps/constants.js +11 -8
- package/dist/components/UTMap/components/GoogleMaps/index.js +91 -63
- package/dist/components/UTMap/components/GoogleMaps/styles.js +3 -2
- package/dist/components/UTMap/constants.js +12 -6
- package/dist/components/UTMap/index.js +198 -163
- package/dist/components/UTMap/types.js +6 -4
- package/dist/components/UTMap/utils.js +46 -29
- package/dist/components/UTMap/withGoogleMapScript.js +22 -18
- package/dist/components/UTMenu/index.js +69 -52
- package/dist/components/UTMenu/theme.js +3 -5
- package/dist/components/UTMenu/utils.js +11 -5
- package/dist/components/UTModal/constants.js +13 -9
- package/dist/components/UTModal/index.js +30 -26
- package/dist/components/UTModal/theme.js +2 -4
- package/dist/components/UTPagination/components/PageSizeSelector/index.js +10 -11
- package/dist/components/UTPagination/components/PageSizeSelector/utils.js +13 -7
- package/dist/components/UTPagination/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTPagination/components/Pagination/index.js +39 -28
- package/dist/components/UTPagination/components/Pagination/utils.js +14 -8
- package/dist/components/UTPagination/constants.js +6 -3
- package/dist/components/UTPagination/index.js +17 -16
- package/dist/components/UTPagination/theme.js +2 -4
- package/dist/components/UTPanel/index.js +44 -38
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +10 -13
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +19 -22
- package/dist/components/UTPasswordField/components/PasswordValidations/index.js +50 -63
- package/dist/components/UTPasswordField/components/PasswordWarning/index.js +26 -25
- package/dist/components/UTPasswordField/index.js +23 -26
- package/dist/components/UTPasswordField/theme.js +2 -4
- package/dist/components/UTPhoneInput/constants.js +6 -3
- package/dist/components/UTPhoneInput/index.js +205 -180
- package/dist/components/UTPhoneInput/theme.js +77 -77
- package/dist/components/UTPieChart/components/ArrowLabel/constants.js +8 -4
- package/dist/components/UTPieChart/components/ArrowLabel/index.js +23 -24
- package/dist/components/UTPieChart/components/Legend/contants.js +6 -3
- package/dist/components/UTPieChart/components/Legend/index.js +24 -27
- package/dist/components/UTPieChart/constants.js +26 -13
- package/dist/components/UTPieChart/hooks/use-animated-value/index.js +33 -15
- package/dist/components/UTPieChart/index.js +76 -73
- package/dist/components/UTPieChart/theme.js +2 -4
- package/dist/components/UTPieChart/utils.js +2 -4
- package/dist/components/UTProgressBar/constants.js +4 -2
- package/dist/components/UTProgressBar/index.js +17 -15
- package/dist/components/UTProgressBar/theme.js +2 -4
- package/dist/components/UTProgressBar/types.js +3 -2
- package/dist/components/UTRadioGroup/index.js +83 -56
- package/dist/components/UTRadioGroup/theme.js +52 -52
- package/dist/components/UTRating/components/Circle/index.js +56 -41
- package/dist/components/UTRating/components/Faces/constants.js +4 -2
- package/dist/components/UTRating/components/Faces/index.js +36 -34
- package/dist/components/UTRating/components/Star/index.js +40 -36
- package/dist/components/UTRating/constants.js +8 -4
- package/dist/components/UTRating/index.js +46 -31
- package/dist/components/UTRating/theme.js +2 -4
- package/dist/components/UTRipple/Ripple.js +39 -22
- package/dist/components/UTRipple/index.js +37 -18
- package/dist/components/UTSelect/components/Option/index.js +13 -13
- package/dist/components/UTSelect/constants.js +8 -4
- package/dist/components/UTSelect/index.js +85 -63
- package/dist/components/UTSelect/stylesJS.js +3 -2
- package/dist/components/UTSelect/theme.js +4 -6
- package/dist/components/UTSelect/utils.js +13 -3
- package/dist/components/UTSidebar/components/ListOption/index.js +49 -34
- package/dist/components/UTSidebar/components/LogosContainer/components/DynamicIcon/index.js +8 -8
- package/dist/components/UTSidebar/components/LogosContainer/index.js +14 -14
- package/dist/components/UTSidebar/components/Option/constants.js +3 -2
- package/dist/components/UTSidebar/components/Option/index.js +32 -28
- package/dist/components/UTSidebar/components/Toggler/index.js +11 -11
- package/dist/components/UTSidebar/index.js +53 -42
- package/dist/components/UTSidebar/theme.js +2 -4
- package/dist/components/UTSidebar/types.js +10 -5
- package/dist/components/UTSkeleton/index.js +36 -10
- package/dist/components/UTStatus/constants.js +9 -5
- package/dist/components/UTStatus/index.js +15 -16
- package/dist/components/UTStatus/theme.js +49 -66
- package/dist/components/UTSwitch/constants.js +6 -3
- package/dist/components/UTSwitch/index.js +57 -42
- package/dist/components/UTSwitch/theme.js +2 -4
- package/dist/components/UTTable/components/ActionIcons/constants.js +2 -1
- package/dist/components/UTTable/components/ActionIcons/index.js +85 -47
- package/dist/components/UTTable/components/Cell/components/ActionButton/index.js +12 -10
- package/dist/components/UTTable/components/Cell/index.js +23 -18
- package/dist/components/UTTable/components/HeaderCell/constants.js +3 -2
- package/dist/components/UTTable/components/HeaderCell/index.js +30 -23
- package/dist/components/UTTable/components/HeaderCell/utils.js +3 -3
- package/dist/components/UTTable/components/PrimaryAction/index.js +11 -12
- package/dist/components/UTTable/components/ResponsiveCell/index.js +20 -19
- package/dist/components/UTTable/components/Status/index.js +19 -18
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/index.js +9 -10
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/utils.js +13 -7
- package/dist/components/UTTable/components/TableFooter/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTTable/components/TableFooter/components/Pagination/index.js +32 -21
- package/dist/components/UTTable/components/TableFooter/components/Pagination/utils.js +14 -8
- package/dist/components/UTTable/components/TableFooter/constants.js +2 -1
- package/dist/components/UTTable/components/TableFooter/index.js +15 -15
- package/dist/components/UTTable/components/TableHeader/index.js +11 -11
- package/dist/components/UTTable/components/TableRow/constants.js +6 -3
- package/dist/components/UTTable/components/TableRow/index.js +94 -79
- package/dist/components/UTTable/constants.js +43 -26
- package/dist/components/UTTable/hook.js +26 -11
- package/dist/components/UTTable/index.js +223 -132
- package/dist/components/UTTable/theme.js +17 -17
- package/dist/components/UTTable/types.js +8 -4
- package/dist/components/UTTable/utils.js +74 -70
- package/dist/components/UTTabs/components/TooltipTab/index.js +30 -20
- package/dist/components/UTTabs/constants.js +8 -4
- package/dist/components/UTTabs/index.js +86 -57
- package/dist/components/UTTabs/theme.js +2 -4
- package/dist/components/UTTabs/utils.js +1 -1
- package/dist/components/UTTextArea/constants.js +6 -3
- package/dist/components/UTTextArea/index.js +23 -23
- package/dist/components/UTTextArea/theme.js +2 -4
- package/dist/components/UTTextInput/constants.js +3 -2
- package/dist/components/UTTextInput/index.js +165 -137
- package/dist/components/UTTextInput/theme.js +4 -6
- package/dist/components/UTThirdPartyCookieChecker/index.js +21 -17
- package/dist/components/UTToggle/components/ToggleOption/index.js +17 -16
- package/dist/components/UTToggle/index.js +26 -25
- package/dist/components/UTToggle/theme.js +2 -4
- package/dist/components/UTTooltip/index.js +30 -23
- package/dist/components/UTTooltip/theme.js +2 -4
- package/dist/components/UTTopbar/components/Notifications/index.js +14 -11
- package/dist/components/UTTopbar/components/UserMenu/index.js +15 -15
- package/dist/components/UTTopbar/index.js +31 -28
- package/dist/components/UTTopbar/theme.js +2 -4
- package/dist/components/UTTopbar/types.js +9 -5
- package/dist/components/UTTouchableWithoutFeedback/index.js +27 -14
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/constants.js +4 -2
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/index.js +31 -34
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/utils.js +4 -4
- package/dist/components/UTVirtualizedList/components/VirtualizedData/constants.js +12 -6
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-ledger.js +18 -8
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-virtualized-data.js +47 -23
- package/dist/components/UTVirtualizedList/components/VirtualizedData/index.js +34 -31
- package/dist/components/UTVirtualizedList/components/VirtualizedData/utils.js +93 -81
- package/dist/components/UTVirtualizedList/constants.js +8 -4
- package/dist/components/UTVirtualizedList/index.js +38 -26
- package/dist/components/UTWorkflowContainer/components/ActionButton/index.js +21 -17
- package/dist/components/UTWorkflowContainer/constants.js +6 -3
- package/dist/components/UTWorkflowContainer/hooks/use-previous.js +3 -3
- package/dist/components/UTWorkflowContainer/index.js +51 -32
- package/dist/components/UTWorkflowContainer/theme.js +53 -60
- package/dist/components/UTWorkflowContainer/types.js +3 -2
- package/dist/components/WithLoading/index.js +15 -10
- package/dist/components/WithTheme/index.js +17 -10
- package/dist/components/WithTheme/layout.js +28 -22
- package/dist/components/WithTouch/index.js +19 -12
- package/dist/constants/UTTable.js +3 -2
- package/dist/index.js +58 -58
- package/dist/theme.js +5 -6
- package/dist/types/commonTypes.js +5 -3
- package/dist/types/consumptionTypes.js +5 -3
- package/dist/types/formTypes.js +7 -4
- package/dist/types/tableTypes.js +3 -2
- package/dist/utils/classesUtils.js +13 -5
- package/dist/utils/componentUtils.js +13 -10
- package/dist/utils/helperFunctions.js +4 -4
- package/dist/utils/shadowUtils.js +11 -13
- package/dist/utils/useScreenSize.js +3 -2
- package/package.json +1 -1
|
@@ -5,59 +5,142 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.pdfAspectRatioValidation = exports.isVideo = exports.isValidFile = exports.isPDF = exports.isNewFile = exports.isImage = exports.isHTML = exports.isAudio = exports.hasPreview = exports.getBlobFromUrl = void 0;
|
|
7
7
|
var _files = require("@widergy/web-utils/lib/constants/files");
|
|
8
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
9
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
10
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
12
|
if (window['pdfjs-dist/build/pdf']) window['pdfjs-dist/build/pdf'].GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(window['pdfjs-dist/build/pdf'].version, "/pdf.worker.js");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
var getImage = /*#__PURE__*/function () {
|
|
14
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(imageUrl) {
|
|
15
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
return _context.abrupt("return", fetch(imageUrl, {
|
|
19
|
+
method: 'GET'
|
|
20
|
+
}).catch(function (error) {
|
|
21
|
+
return console.error(error);
|
|
22
|
+
}));
|
|
23
|
+
case 1:
|
|
24
|
+
case "end":
|
|
25
|
+
return _context.stop();
|
|
26
|
+
}
|
|
27
|
+
}, _callee);
|
|
28
|
+
}));
|
|
29
|
+
return function getImage(_x) {
|
|
30
|
+
return _ref.apply(this, arguments);
|
|
31
|
+
};
|
|
32
|
+
}(); // eslint-disable-line no-console
|
|
12
33
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
34
|
+
var getBlobFromUrl = /*#__PURE__*/function () {
|
|
35
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(imageUrl, callback) {
|
|
36
|
+
var response;
|
|
37
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
38
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
39
|
+
case 0:
|
|
40
|
+
if (!(!imageUrl || !callback)) {
|
|
41
|
+
_context2.next = 2;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
return _context2.abrupt("return", false);
|
|
45
|
+
case 2:
|
|
46
|
+
_context2.next = 4;
|
|
47
|
+
return getImage(imageUrl);
|
|
48
|
+
case 4:
|
|
49
|
+
response = _context2.sent;
|
|
50
|
+
if (response !== null && response !== void 0 && response.ok) response.blob().then(function (blob) {
|
|
51
|
+
return callback(blob);
|
|
52
|
+
});else callback(null);
|
|
53
|
+
case 6:
|
|
54
|
+
case "end":
|
|
55
|
+
return _context2.stop();
|
|
56
|
+
}
|
|
57
|
+
}, _callee2);
|
|
58
|
+
}));
|
|
59
|
+
return function getBlobFromUrl(_x2, _x3) {
|
|
60
|
+
return _ref2.apply(this, arguments);
|
|
61
|
+
};
|
|
62
|
+
}();
|
|
18
63
|
exports.getBlobFromUrl = getBlobFromUrl;
|
|
19
|
-
|
|
20
|
-
|
|
64
|
+
var lengthMatches = function lengthMatches(length1, length2, toleranceInPercentage) {
|
|
65
|
+
var delta = length1 * (toleranceInPercentage / 100);
|
|
21
66
|
return Math.abs(length1 - length2) < delta;
|
|
22
67
|
};
|
|
23
|
-
|
|
24
|
-
|
|
68
|
+
var pageMatches = function pageMatches(page, allowedPDFUploadSizes) {
|
|
69
|
+
var viewport = page.getViewport({
|
|
25
70
|
scale: 1
|
|
26
71
|
});
|
|
27
|
-
return allowedPDFUploadSizes.some(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const documentLoadingTask = window['pdfjs-dist/build/pdf'].getDocument(URL.createObjectURL(file));
|
|
31
|
-
const document = await documentLoadingTask.promise;
|
|
32
|
-
const totalPages = document.numPages;
|
|
33
|
-
const getPagePromises = [];
|
|
34
|
-
for (let pageNumber = 1; pageNumber <= totalPages; pageNumber += 1) {
|
|
35
|
-
getPagePromises.push(document.getPage(pageNumber));
|
|
36
|
-
}
|
|
37
|
-
const pages = await Promise.all(getPagePromises);
|
|
38
|
-
return pages.every(page => pageMatches(page, allowedPDFUploadSizes));
|
|
72
|
+
return allowedPDFUploadSizes.some(function (size) {
|
|
73
|
+
return lengthMatches(size.heightInPt, viewport.height, size.toleranceInPercentage) && lengthMatches(size.widthInPt, viewport.width, size.toleranceInPercentage) || lengthMatches(size.heightInPt, viewport.width, size.toleranceInPercentage) && lengthMatches(size.widthInPt, viewport.height, size.toleranceInPercentage);
|
|
74
|
+
});
|
|
39
75
|
};
|
|
76
|
+
var pdfAspectRatioValidation = /*#__PURE__*/function () {
|
|
77
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(file, allowedPDFUploadSizes) {
|
|
78
|
+
var documentLoadingTask, document, totalPages, getPagePromises, pageNumber, pages;
|
|
79
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
80
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
81
|
+
case 0:
|
|
82
|
+
documentLoadingTask = window['pdfjs-dist/build/pdf'].getDocument(URL.createObjectURL(file));
|
|
83
|
+
_context3.next = 3;
|
|
84
|
+
return documentLoadingTask.promise;
|
|
85
|
+
case 3:
|
|
86
|
+
document = _context3.sent;
|
|
87
|
+
totalPages = document.numPages;
|
|
88
|
+
getPagePromises = [];
|
|
89
|
+
for (pageNumber = 1; pageNumber <= totalPages; pageNumber += 1) {
|
|
90
|
+
getPagePromises.push(document.getPage(pageNumber));
|
|
91
|
+
}
|
|
92
|
+
_context3.next = 9;
|
|
93
|
+
return Promise.all(getPagePromises);
|
|
94
|
+
case 9:
|
|
95
|
+
pages = _context3.sent;
|
|
96
|
+
return _context3.abrupt("return", pages.every(function (page) {
|
|
97
|
+
return pageMatches(page, allowedPDFUploadSizes);
|
|
98
|
+
}));
|
|
99
|
+
case 11:
|
|
100
|
+
case "end":
|
|
101
|
+
return _context3.stop();
|
|
102
|
+
}
|
|
103
|
+
}, _callee3);
|
|
104
|
+
}));
|
|
105
|
+
return function pdfAspectRatioValidation(_x4, _x5) {
|
|
106
|
+
return _ref3.apply(this, arguments);
|
|
107
|
+
};
|
|
108
|
+
}();
|
|
40
109
|
exports.pdfAspectRatioValidation = pdfAspectRatioValidation;
|
|
41
|
-
|
|
110
|
+
var isImage = function isImage(file) {
|
|
111
|
+
return _files.inputFiles.image.validType.includes(file === null || file === void 0 ? void 0 : file.type);
|
|
112
|
+
};
|
|
42
113
|
exports.isImage = isImage;
|
|
43
|
-
|
|
114
|
+
var isPDF = function isPDF(file) {
|
|
115
|
+
return _files.inputFiles.pdf.validType.includes(file === null || file === void 0 ? void 0 : file.type);
|
|
116
|
+
};
|
|
44
117
|
exports.isPDF = isPDF;
|
|
45
|
-
|
|
118
|
+
var isAudio = function isAudio(file) {
|
|
119
|
+
return _files.inputFiles.audio.validType.includes(file === null || file === void 0 ? void 0 : file.type);
|
|
120
|
+
};
|
|
46
121
|
exports.isAudio = isAudio;
|
|
47
|
-
|
|
122
|
+
var isVideo = function isVideo(file) {
|
|
123
|
+
return _files.inputFiles.video.validType.includes(file === null || file === void 0 ? void 0 : file.type);
|
|
124
|
+
};
|
|
48
125
|
exports.isVideo = isVideo;
|
|
49
|
-
|
|
126
|
+
var isHTML = function isHTML(file) {
|
|
127
|
+
return _files.inputFiles.html.validType.includes(file === null || file === void 0 ? void 0 : file.type);
|
|
128
|
+
};
|
|
50
129
|
exports.isHTML = isHTML;
|
|
51
|
-
|
|
130
|
+
var hasPreview = function hasPreview(file) {
|
|
131
|
+
return isImage(file) || isAudio(file) || isVideo(file);
|
|
132
|
+
};
|
|
52
133
|
exports.hasPreview = hasPreview;
|
|
53
|
-
|
|
134
|
+
var isValidFile = function isValidFile(file) {
|
|
135
|
+
return hasPreview(file) || isPDF(file) || isHTML(file);
|
|
136
|
+
};
|
|
54
137
|
exports.isValidFile = isValidFile;
|
|
55
|
-
|
|
138
|
+
var isNewFile = function isNewFile(newFile, oldFile) {
|
|
56
139
|
var _newFile$file, _oldFile$file;
|
|
57
140
|
if (!newFile && !oldFile) return false;
|
|
58
141
|
if (!newFile || !oldFile) return true;
|
|
59
|
-
|
|
60
|
-
|
|
142
|
+
var newFileType = _typeof(newFile);
|
|
143
|
+
var oldFileType = _typeof(oldFile);
|
|
61
144
|
if (newFileType !== oldFileType) return true;
|
|
62
145
|
if (newFileType === 'string') return newFile !== oldFile;
|
|
63
146
|
return ((_newFile$file = newFile.file) === null || _newFile$file === void 0 ? void 0 : _newFile$file.lastModified) !== ((_oldFile$file = oldFile.file) === null || _oldFile$file === void 0 ? void 0 : _oldFile$file.lastModified);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -9,19 +10,25 @@ var _reactWindow = require("react-window");
|
|
|
9
10
|
var _propTypes = require("prop-types");
|
|
10
11
|
var _constants = require("../../constants");
|
|
11
12
|
var _utils = require("./utils");
|
|
12
|
-
|
|
13
|
-
function
|
|
13
|
+
var _excluded = ["children", "fixedSizeListProps"];
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
16
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
|
+
var Listbox = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
20
|
+
var children = _ref.children,
|
|
21
|
+
_ref$fixedSizeListPro = _ref.fixedSizeListProps,
|
|
22
|
+
fixedSizeListProps = _ref$fixedSizeListPro === void 0 ? {} : _ref$fixedSizeListPro,
|
|
23
|
+
other = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
var itemCount = Array.isArray(children) ? children.length : 0;
|
|
25
|
+
var outerElementType = (0, _react.useMemo)(function () {
|
|
26
|
+
return /*#__PURE__*/(0, _react.forwardRef)(function (props2, ref2) {
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
28
|
+
ref: ref2
|
|
29
|
+
}, props2, other));
|
|
30
|
+
});
|
|
31
|
+
}, []);
|
|
25
32
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
26
33
|
ref: ref
|
|
27
34
|
}, /*#__PURE__*/_react.default.createElement(_reactWindow.FixedSizeList, _extends({
|
|
@@ -39,4 +46,5 @@ const Listbox = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
39
46
|
Listbox.propTypes = {
|
|
40
47
|
fixedSizeListProps: _propTypes.object
|
|
41
48
|
};
|
|
42
|
-
var _default =
|
|
49
|
+
var _default = /*#__PURE__*/(0, _react.memo)(Listbox);
|
|
50
|
+
exports.default = _default;
|
|
@@ -7,16 +7,18 @@ exports.renderRow = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
+
var renderRow = function renderRow(_ref) {
|
|
17
|
+
var data = _ref.data,
|
|
18
|
+
index = _ref.index,
|
|
19
|
+
style = _ref.style;
|
|
16
20
|
return /*#__PURE__*/(0, _react.cloneElement)(data[index], {
|
|
17
|
-
style: {
|
|
18
|
-
...style
|
|
19
|
-
},
|
|
21
|
+
style: _objectSpread({}, style),
|
|
20
22
|
className: "".concat(data[index].props.className, " ").concat(_stylesModule.default.rowRender)
|
|
21
23
|
});
|
|
22
24
|
};
|
|
@@ -4,18 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ROW_HEIGHT = exports.OPEN_TEXT = exports.MIN_ROW_HEIGHT_FACTOR = exports.MAX_HEIGHT = exports.LIST_BOX_DEFAULT_PROPS = exports.INVALID_OPTION = exports.ERROR_EMPTY_OPTIONS = exports.DEFAULT_VALUE_KEY = exports.DEFAULT_LABEL_KEY = exports.CLOSE_TEXT = exports.CLEAR_TEXT = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
var INVALID_OPTION = 'El texto ingresado no corresponde a una opción valida';
|
|
8
|
+
exports.INVALID_OPTION = INVALID_OPTION;
|
|
9
|
+
var ERROR_EMPTY_OPTIONS = 'No se cargaron opciones';
|
|
10
|
+
exports.ERROR_EMPTY_OPTIONS = ERROR_EMPTY_OPTIONS;
|
|
11
|
+
var CLEAR_TEXT = 'Borrar selección';
|
|
12
|
+
exports.CLEAR_TEXT = CLEAR_TEXT;
|
|
13
|
+
var OPEN_TEXT = 'Ver opciones';
|
|
14
|
+
exports.OPEN_TEXT = OPEN_TEXT;
|
|
15
|
+
var CLOSE_TEXT = 'Cerrar menu';
|
|
16
|
+
exports.CLOSE_TEXT = CLOSE_TEXT;
|
|
17
|
+
var DEFAULT_VALUE_KEY = 'value';
|
|
18
|
+
exports.DEFAULT_VALUE_KEY = DEFAULT_VALUE_KEY;
|
|
19
|
+
var DEFAULT_LABEL_KEY = 'name';
|
|
20
|
+
exports.DEFAULT_LABEL_KEY = DEFAULT_LABEL_KEY;
|
|
21
|
+
var ROW_HEIGHT = 40;
|
|
22
|
+
exports.ROW_HEIGHT = ROW_HEIGHT;
|
|
23
|
+
var MAX_HEIGHT = 300;
|
|
24
|
+
exports.MAX_HEIGHT = MAX_HEIGHT;
|
|
25
|
+
var MIN_ROW_HEIGHT_FACTOR = 8;
|
|
26
|
+
exports.MIN_ROW_HEIGHT_FACTOR = MIN_ROW_HEIGHT_FACTOR;
|
|
27
|
+
var LIST_BOX_DEFAULT_PROPS = {
|
|
18
28
|
height: 250,
|
|
19
29
|
innerElementType: 'ul',
|
|
20
30
|
overscanCount: 5
|
|
21
|
-
};
|
|
31
|
+
};
|
|
32
|
+
exports.LIST_BOX_DEFAULT_PROPS = LIST_BOX_DEFAULT_PROPS;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -19,73 +20,109 @@ var _theme = require("./theme");
|
|
|
19
20
|
var _ListBox = _interopRequireDefault(require("./components/ListBox"));
|
|
20
21
|
var _constants = require("./constants");
|
|
21
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
function _getRequireWildcardCache(
|
|
23
|
-
function _interopRequireWildcard(
|
|
23
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
25
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
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
|
-
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
28
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
29
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
30
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
+
var UTAutocomplete = function UTAutocomplete(_ref) {
|
|
33
|
+
var ArrowIcon = _ref.ArrowIcon,
|
|
34
|
+
autocompleteProps = _ref.autocompleteProps,
|
|
35
|
+
_ref$classes = _ref.classes,
|
|
36
|
+
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
|
37
|
+
disabled = _ref.disabled,
|
|
38
|
+
field = _ref.field,
|
|
39
|
+
fixedSizeListProps = _ref.fixedSizeListProps,
|
|
40
|
+
input = _ref.input,
|
|
41
|
+
label = _ref.label,
|
|
42
|
+
loading = _ref.loading,
|
|
43
|
+
meta = _ref.meta,
|
|
44
|
+
options = _ref.options,
|
|
45
|
+
placeholder = _ref.placeholder,
|
|
46
|
+
textFieldProps = _ref.textFieldProps,
|
|
47
|
+
variant = _ref.variant;
|
|
48
|
+
var _ref2 = field.configuration || {},
|
|
49
|
+
_ref2$field_options_v = _ref2.field_options_value_key,
|
|
50
|
+
valueKey = _ref2$field_options_v === void 0 ? _constants.DEFAULT_VALUE_KEY : _ref2$field_options_v,
|
|
51
|
+
_ref2$field_options_l = _ref2.field_options_label_key,
|
|
52
|
+
labelKey = _ref2$field_options_l === void 0 ? _constants.DEFAULT_LABEL_KEY : _ref2$field_options_l,
|
|
53
|
+
_ref2$field_options_n = _ref2.field_options_no_results_message,
|
|
54
|
+
noOptionsMessage = _ref2$field_options_n === void 0 ? _constants.INVALID_OPTION : _ref2$field_options_n,
|
|
55
|
+
_ref2$field_options_e = _ref2.field_options_empty_message,
|
|
56
|
+
emptyOptionsLabel = _ref2$field_options_e === void 0 ? _constants.ERROR_EMPTY_OPTIONS : _ref2$field_options_e,
|
|
57
|
+
_ref2$multiple = _ref2.multiple,
|
|
58
|
+
multiple = _ref2$multiple === void 0 ? false : _ref2$multiple;
|
|
59
|
+
var initialValue = (0, _react.useMemo)(function () {
|
|
60
|
+
return multiple ? [] : '';
|
|
61
|
+
}, [multiple]);
|
|
62
|
+
var _useState = (0, _react.useState)(initialValue),
|
|
63
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
64
|
+
componentValue = _useState2[0],
|
|
65
|
+
setComponentValue = _useState2[1];
|
|
66
|
+
var textInputLabel = (0, _array.isEmpty)(options) ? emptyOptionsLabel : label;
|
|
67
|
+
var fieldDisabled = disabled || loading || (0, _array.isEmpty)(options);
|
|
68
|
+
var onChange = function onChange(_, values) {
|
|
69
|
+
input.onChange(multiple ? values === null || values === void 0 ? void 0 : values.map(function (val) {
|
|
70
|
+
return val[valueKey];
|
|
71
|
+
}) : values === null || values === void 0 ? void 0 : values[valueKey]);
|
|
55
72
|
if (!values) setComponentValue(initialValue);
|
|
56
73
|
if (field.onChange) field.onChange(values);
|
|
57
74
|
};
|
|
58
|
-
(0, _react.useEffect)(()
|
|
59
|
-
setComponentValue(input.value && !(0, _array.isEmpty)(options) ? multiple ? options.filter(
|
|
75
|
+
(0, _react.useEffect)(function () {
|
|
76
|
+
setComponentValue(input.value && !(0, _array.isEmpty)(options) ? multiple ? options.filter(function (option) {
|
|
77
|
+
return input.value.some(function (inputValue) {
|
|
78
|
+
return inputValue === option[valueKey];
|
|
79
|
+
});
|
|
80
|
+
}) : options.find(function (option) {
|
|
81
|
+
return option[valueKey] === input.value;
|
|
82
|
+
}) : multiple ? [] : '');
|
|
60
83
|
}, [input.value]);
|
|
61
|
-
(0, _react.useEffect)(()
|
|
84
|
+
(0, _react.useEffect)(function () {
|
|
62
85
|
if ((0, _array.isEmpty)(options) || (multiple ? (0, _array.isEmpty)(input.value) : !input.value)) {
|
|
63
86
|
if (multiple && !(0, _array.isEmpty)(componentValue) || componentValue) {
|
|
64
87
|
input.onChange(initialValue);
|
|
65
88
|
setComponentValue(initialValue);
|
|
66
89
|
}
|
|
67
90
|
} else {
|
|
68
|
-
|
|
91
|
+
var newInputValue = multiple ? input.value.filter(function (inputValue) {
|
|
92
|
+
return options.some(function (option) {
|
|
93
|
+
return inputValue === option[valueKey];
|
|
94
|
+
});
|
|
95
|
+
}) : options.some(function (option) {
|
|
96
|
+
return option[valueKey] === input.value;
|
|
97
|
+
}) ? input.value : '';
|
|
69
98
|
input.onChange(newInputValue);
|
|
70
|
-
|
|
99
|
+
var updatedValue = multiple ? options.filter(function (option) {
|
|
100
|
+
return newInputValue.some(function (inputValue) {
|
|
101
|
+
return inputValue === option[valueKey];
|
|
102
|
+
});
|
|
103
|
+
}) : options.find(function (option) {
|
|
104
|
+
return option[valueKey] === newInputValue;
|
|
105
|
+
});
|
|
71
106
|
setComponentValue(updatedValue);
|
|
72
107
|
}
|
|
73
108
|
}, [options]);
|
|
74
|
-
|
|
109
|
+
var textInputEndAdornment = loading ? /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
|
|
75
110
|
className: classes.loadingIcon
|
|
76
111
|
}) : ArrowIcon || /*#__PURE__*/_react.default.createElement(_KeyboardArrowDown.default, {
|
|
77
112
|
className: "".concat(disabled ? classes.arrowIconDisabled : classes.arrowIcon)
|
|
78
113
|
});
|
|
79
|
-
|
|
114
|
+
var errorMessage = (0, _form.shouldShowErrors)(meta) && meta.error || '';
|
|
80
115
|
return /*#__PURE__*/_react.default.createElement(_Autocomplete.default, _extends({
|
|
81
116
|
clearText: _constants.CLEAR_TEXT,
|
|
82
117
|
closeText: _constants.CLOSE_TEXT,
|
|
83
118
|
disabled: fieldDisabled,
|
|
84
|
-
getOptionLabel:
|
|
119
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
120
|
+
return option[labelKey] || '';
|
|
121
|
+
},
|
|
85
122
|
id: field.key,
|
|
86
123
|
ListboxComponent: _ListBox.default,
|
|
87
124
|
ListboxProps: {
|
|
88
|
-
fixedSizeListProps
|
|
125
|
+
fixedSizeListProps: fixedSizeListProps
|
|
89
126
|
},
|
|
90
127
|
multiple: multiple,
|
|
91
128
|
noOptionsText: noOptionsMessage,
|
|
@@ -94,18 +131,20 @@ const UTAutocomplete = _ref => {
|
|
|
94
131
|
options: options,
|
|
95
132
|
popupIcon: textInputEndAdornment,
|
|
96
133
|
value: componentValue,
|
|
97
|
-
renderInput:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
134
|
+
renderInput: function renderInput(params) {
|
|
135
|
+
return /*#__PURE__*/_react.default.createElement(_TextField.default, _extends({}, params, {
|
|
136
|
+
label: textInputLabel,
|
|
137
|
+
fullWidth: true,
|
|
138
|
+
error: (0, _form.shouldShowErrors)(meta),
|
|
139
|
+
helperText: errorMessage ? /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
140
|
+
className: classes.errorLabel,
|
|
141
|
+
colorTheme: "error",
|
|
142
|
+
variant: "small"
|
|
143
|
+
}, errorMessage) : undefined,
|
|
144
|
+
placeholder: placeholder,
|
|
145
|
+
variant: variant
|
|
146
|
+
}, textFieldProps));
|
|
147
|
+
}
|
|
109
148
|
}, autocompleteProps));
|
|
110
149
|
};
|
|
111
150
|
UTAutocomplete.propTypes = {
|
|
@@ -124,4 +163,5 @@ UTAutocomplete.propTypes = {
|
|
|
124
163
|
textFieldProps: _propTypes.object,
|
|
125
164
|
variant: _propTypes.string
|
|
126
165
|
};
|
|
127
|
-
var _default =
|
|
166
|
+
var _default = (0, _WithTheme.default)(_theme.retrieveStyle, _theme.retrieveMuiTheme)(UTAutocomplete);
|
|
167
|
+
exports.default = _default;
|
|
@@ -9,11 +9,9 @@ var _lodash = _interopRequireDefault(require("lodash"));
|
|
|
9
9
|
var _colorsModule = _interopRequireDefault(require("../../scss/variables/colors.module.scss"));
|
|
10
10
|
var _classesUtils = require("../../utils/classesUtils");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
12
|
+
var retrieveStyle = function retrieveStyle(_ref) {
|
|
13
13
|
var _theme$UTAutocomplete, _theme$UTTextInput, _theme$UTAutocomplete2, _theme$UTTextInput2, _theme$UTAutocomplete3, _theme$UTTextInput3, _theme$UTAutocomplete4, _theme$UTAutocomplete5, _theme$UTAutocomplete6;
|
|
14
|
-
|
|
15
|
-
theme
|
|
16
|
-
} = _ref;
|
|
14
|
+
var theme = _ref.theme;
|
|
17
15
|
return {
|
|
18
16
|
arrowIcon: {
|
|
19
17
|
color: ((_theme$UTAutocomplete = theme.UTAutocomplete) === null || _theme$UTAutocomplete === void 0 || (_theme$UTAutocomplete = _theme$UTAutocomplete.arrowIcon) === null || _theme$UTAutocomplete === void 0 ? void 0 : _theme$UTAutocomplete.color) || ((_theme$UTTextInput = theme.UTTextInput) === null || _theme$UTTextInput === void 0 ? void 0 : _theme$UTTextInput.color)
|
|
@@ -30,9 +28,9 @@ const retrieveStyle = _ref => {
|
|
|
30
28
|
};
|
|
31
29
|
};
|
|
32
30
|
exports.retrieveStyle = retrieveStyle;
|
|
33
|
-
|
|
31
|
+
var retrieveMuiTheme = function retrieveMuiTheme(theme, muiTheme) {
|
|
34
32
|
var _theme$Fonts, _theme$UTTextInput4, _theme$UTTextInput5, _theme$UTTextInput6, _theme$Fonts2, _theme$UTTextInput7, _theme$UTTextInput8, _theme$UTTextInput9, _theme$UTTextInput10, _theme$UTTextInput11, _theme$UTTextInput12, _theme$UTTextInput13, _theme$UTTextInput14, _theme$UTTextInput15, _theme$Fonts3, _theme$UTTextInput16, _theme$UTTextInput17, _theme$UTTextInput18, _theme$UTTextInput19, _theme$UTTextInput20, _theme$UTTextInput21, _theme$UTTextInput22, _theme$UTTextInput23, _theme$UTTextInput24, _theme$UTTextInput25, _theme$UTTextInput26, _theme$UTAutocomplete7, _theme$UTAutocomplete8, _theme$UTAutocomplete9, _theme$UTTextInput27, _theme$UTTextInput28, _theme$UTTextInput29, _theme$UTTextInput30, _theme$Fonts4, _theme$UTTextInput31, _theme$UTTextInput32, _theme$UTAutocomplete10, _theme$UTAutocomplete11, _theme$UTAutocomplete12, _theme$UTAutocomplete13, _theme$UTAutocomplete14, _theme$UTAutocomplete15, _theme$UTAutocomplete16, _theme$UTAutocomplete17, _theme$UTAutocomplete18, _theme$UTAutocomplete19;
|
|
35
|
-
|
|
33
|
+
var mui = {
|
|
36
34
|
typography: {
|
|
37
35
|
fontFamily: (_theme$Fonts = theme.Fonts) === null || _theme$Fonts === void 0 ? void 0 : _theme$Fonts.fontFamily
|
|
38
36
|
},
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.defaultPalette = void 0;
|
|
7
|
-
|
|
7
|
+
var defaultPalette = [{
|
|
8
8
|
backgroundColor: 'rgb(0, 0, 180)',
|
|
9
9
|
color: '#FFF',
|
|
10
10
|
colorTheme: 'light'
|
|
@@ -104,4 +104,5 @@ const defaultPalette = exports.defaultPalette = [{
|
|
|
104
104
|
backgroundColor: 'rgb(63,25,12)',
|
|
105
105
|
color: '#FFF',
|
|
106
106
|
colorTheme: 'light'
|
|
107
|
-
}];
|
|
107
|
+
}];
|
|
108
|
+
exports.defaultPalette = defaultPalette;
|